Salome HOME
bos #29481 Merge branch 'CR29481'
[modules/shaper.git] / src / ModelAPI / ModelAPI_Tools.h
index 29f6554845cfe8a9b6bda6dea97a4756d95992d2..0ad6923412cf3eb5551368159c05110b17a95d84 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2021  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2022  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -21,6 +21,7 @@
 #define ModelAPI_Tools_HeaderFile
 
 #include "ModelAPI.h"
+#include <ModelAPI_AttributeSelectionList.h>
 
 class ModelAPI_CompositeFeature;
 class ModelAPI_Document;
@@ -50,7 +51,7 @@ MODELAPI_EXPORT std::shared_ptr<GeomAPI_Shape> shape(
  */
 MODELAPI_EXPORT std::string getFeatureError(const std::shared_ptr<ModelAPI_Feature>& theFeature);
 
-MODELAPI_EXPORT struct ResultBaseAlgo {
+struct ResultBaseAlgo {
   std::shared_ptr<ModelAPI_ResultBody> resultBody;
   std::shared_ptr<GeomAPI_Shape> baseShape;
   std::shared_ptr<GeomAlgoAPI_MakeShape> makeShape;
@@ -324,6 +325,13 @@ MODELAPI_EXPORT void setTransparency(std::shared_ptr<ModelAPI_Result> theResult,
 MODELAPI_EXPORT void copyVisualizationAttrs(std::shared_ptr<ModelAPI_Result> theSource,
                                             std::shared_ptr<ModelAPI_Result> theDest);
 
+/*! Copies image attribute from one result to another.
+* \param theSource a result that contains the image data
+* \param theDest a destination result that takes the image data
+*/
+MODELAPI_EXPORT void copyImageAttribute(std::shared_ptr<ModelAPI_Result> theSource,
+                                        std::shared_ptr<ModelAPI_Result> theDest);
+
 /*! Produces list of features that reference to the given target (directly or through sub-results)
 * \param theTarget the referenced result
 * \param theFeatureKind the resulting features filter: the feature kind or all for the empty string
@@ -333,6 +341,12 @@ MODELAPI_EXPORT std::list<std::shared_ptr<ModelAPI_Feature> > referencedFeatures
   std::shared_ptr<ModelAPI_Result> theTarget, const std::string& theFeatureKind,
   const bool theSortResults);
 
+/*!
+ * Returns true if something in selection is presented in the results list
+ */
+MODELAPI_EXPORT bool isInResults(AttributeSelectionListPtr theSelection,
+                                 const std::list<ResultPtr>& theResults,
+                                 std::set<ResultPtr>& theCashedResults);
 
 /*! Returns a container with the current color value.
 *   These are tree int values for RGB definition.
@@ -342,6 +356,16 @@ MODELAPI_EXPORT std::list<std::shared_ptr<ModelAPI_Feature> > referencedFeatures
 */
 MODELAPI_EXPORT void findRandomColor(std::vector<int>& theValues, bool theReset = false);
 
+/*!
+* Checks the movement of features possibility. The feature cannot appear before the feature
+* depended on it. Used in drag and drop part features.
+* \param theAfter feature after which the moved features are placed, or null for the first place
+* \param theMoved ordered list of the moved features
+* \returns string with error text, dependencies that do not allow make movement or empty string
+*/
+MODELAPI_EXPORT std::wstring validateMovement(
+  const FeaturePtr& theAfter, const std::list<FeaturePtr> theMoved);
+
 }
 
 #endif