Salome HOME
Add Model_AttributeSelection::setId()
[modules/shaper.git] / src / Model / Model_ResultCompSolid.h
index 6e7c2c663c98732d279a1e58b130d9c2c749ffdc..ba92674e8c80a03228a3349655dc711447eef05a 100755 (executable)
@@ -9,43 +9,78 @@
 
 #include "Model.h"
 #include <ModelAPI_ResultCompSolid.h>
+#include <vector>
 
 /**\class Model_ResultCompSolid
- * \ingroup DataModel
- * \brief The compsolid (container of body results) result of a feature.
- *
- * Provides a container of shapes that may be displayed in the viewer.
- */
+* \ingroup DataModel
+* \brief The compsolid (container of body results) result of a feature.
+*
+* Provides a container of shapes that may be displayed in the viewer.
+*/
 class Model_ResultCompSolid : public ModelAPI_ResultCompSolid
 {
+  /// Sub-bodies if this is compsolid: zero base index to subs
+  std::vector<std::shared_ptr<ModelAPI_ResultBody> > mySubs;
+  /// Flag that stores the previous state of "concealed": if it is changed,
+  /// The event must be generated to redisplay this and all subs.
+  bool myLastConcealed;
+
+
 public:
+
   /// Removes the stored builders
   MODEL_EXPORT virtual ~Model_ResultCompSolid();
 
-  /// Adds result to the sketch and to its document
-  virtual std::shared_ptr<ModelAPI_ResultBody> addResult(std::string theID);
+  /// Request for initialization of data model of the object: adding all attributes
+  MODEL_EXPORT virtual void initAttributes();
+
+  /// Stores the shape (called by the execution method). Creates sub-results for compsolid.
+  MODEL_EXPORT virtual void store(const std::shared_ptr<GeomAPI_Shape>& theShape);
+
+  /// Stores the generated shape.  Creates sub-results for compsolid.
+  MODEL_EXPORT virtual void storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
+    const std::shared_ptr<GeomAPI_Shape>& theToShape);
+
+  /// Stores the modified shape.  Creates sub-results for compsolid.
+  MODEL_EXPORT virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
+    const std::shared_ptr<GeomAPI_Shape>& theNewShape, const int theDecomposeSolidsTag = 0);
 
   /// Returns the number of sub-elements
-  virtual int numberOfSubs(bool forTree = false) const;
+  MODEL_EXPORT virtual int numberOfSubs(bool forTree = false) const;
 
   /// Returns the sub-result by zero-base index
-  virtual std::shared_ptr<ModelAPI_ResultBody> subResult(const int theIndex,
-                                                         bool forTree = false) const;
-
-  /// Returns the sub-feature unique identifier in this composite feature by zero-base index
-  virtual int subResultId(const int theIndex) const;
+  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultBody> subResult(const int theIndex,
+    bool forTree = false) const;
 
   /// Returns true if feature or reuslt belong to this composite feature as subs
-  virtual bool isSub(ObjectPtr theObject) const;
+  MODEL_EXPORT virtual bool isSub(ObjectPtr theObject) const;
+
+  /// Returns the parameters of color definition in the resources config manager
+  MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName,
+                                            std::string& theDefault);
+
+  /// Disables the result body: keeps the resulting shape as selection, but erases the underlaying
+  /// naming data structure if theFlag if false. Or restores everything on theFlag is true.
+  MODEL_EXPORT virtual bool setDisabled(std::shared_ptr<ModelAPI_Result> theThis,
+    const bool theFlag);
 
-  /// This method to inform that sub-feature is removed and must be removed from the internal data
-  /// structures of the owner (the remove from the document will be done outside just after)
-  virtual void removeResult(std::shared_ptr<ModelAPI_ResultBody> theResult);
+  /// The compsolid is concealed if at least one of the sub is concealed
+  MODEL_EXPORT virtual bool isConcealed();
+
+  /// Sets all subs as concealed in the data tree (referenced by other objects)
+  MODEL_EXPORT virtual void setIsConcealed(const bool theValue);
+
+  /// Returns true if the latest modification of this body in the naming history
+  // is equal to the given shape
+  MODEL_EXPORT virtual bool isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape);
 
 protected:
   /// Makes a body on the given feature
   Model_ResultCompSolid();
 
+  /// Updates the sub-bodies if shape of this object is composite-solid
+  void updateSubs(const std::shared_ptr<GeomAPI_Shape>& theThisShape);
+
   friend class Model_Objects;
 };