Salome HOME
bos #29479 Show edges directions
[modules/shaper.git] / src / ModelAPI / ModelAPI_Tools.h
index bf49fe5dfd510b2154a0a9ef6c5d1997c50b408b..83a1e010ef4a0e9676105322008018e9d0ffc829 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;
@@ -29,6 +30,7 @@ class ModelAPI_Result;
 class ModelAPI_ResultParameter;
 class ModelAPI_ResultBody;
 
+class GeomAlgoAPI_MakeShape;
 class GeomAPI_Shape;
 class GeomAPI_ShapeHierarchy;
 
@@ -49,6 +51,35 @@ MODELAPI_EXPORT std::shared_ptr<GeomAPI_Shape> shape(
  */
 MODELAPI_EXPORT std::string getFeatureError(const std::shared_ptr<ModelAPI_Feature>& theFeature);
 
+struct ResultBaseAlgo {
+  std::shared_ptr<ModelAPI_ResultBody> resultBody;
+  std::shared_ptr<GeomAPI_Shape> baseShape;
+  std::shared_ptr<GeomAlgoAPI_MakeShape> makeShape;
+};
+
+MODELAPI_EXPORT void loadModifiedShapes(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
+  const std::list<std::shared_ptr<GeomAPI_Shape>>& theBaseShapes,
+  const std::list<std::shared_ptr<GeomAPI_Shape>>& theTools,
+  const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape,
+  const std::shared_ptr<GeomAPI_Shape> theResultShape,
+  const std::string& theNamePrefix = "");
+
+MODELAPI_EXPORT void loadModifiedShapes(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
+  const std::shared_ptr<GeomAPI_Shape>& theBaseShape,
+  const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape,
+  const std::string theName);
+/// Stores deleted shapes.
+MODELAPI_EXPORT void loadDeletedShapes(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
+  const std::shared_ptr<GeomAPI_Shape> theBaseShape,
+  const std::list<std::shared_ptr<GeomAPI_Shape>>& theTools,
+  const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape,
+  const std::shared_ptr<GeomAPI_Shape> theResultShapesCompound);
+
+/// Stores deleted shapes.
+MODELAPI_EXPORT void loadDeletedShapes(std::vector<ResultBaseAlgo>& theResultBaseAlgoList,
+  const std::list<std::shared_ptr<GeomAPI_Shape>>& theTools,
+  const std::shared_ptr<GeomAPI_Shape> theResultShapesCompound);
+
 /*!
  * Searches for variable with name \param theName in \param theDocument.
  * If found, set it value in the \param outValue and returns true.
@@ -273,6 +304,14 @@ MODELAPI_EXPORT void showIsoLines(std::shared_ptr<ModelAPI_Result> theResult, bo
 
 MODELAPI_EXPORT bool isShownIsoLines(std::shared_ptr<ModelAPI_Result> theResult);
 
+/*! Set visibility of edges direction
+* \param[in] theResult a result object
+* \param[in] theShow is a visibility flag
+*/
+MODELAPI_EXPORT void showEdgesDirection(std::shared_ptr<ModelAPI_Result> theResult, bool theShow);
+
+MODELAPI_EXPORT bool isShowEdgesDirection(std::shared_ptr<ModelAPI_Result> theResult);
+
 /*! Returns current transparency in the given result
 * \param theResult a result object
 * \return a transparency value or -1 if it was not defined
@@ -310,6 +349,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.
@@ -319,6 +364,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