#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;
+
public:
- /// All features of this sketch (list of references)
- inline static const std::string& BODIES_ID()
- {
- static const std::string MY_BODIES_ID("Bodies");
- return MY_BODIES_ID;
- }
/// Removes the stored builders
MODEL_EXPORT virtual ~Model_ResultCompSolid();
/// Request for initialization of data model of the object: adding all attributes
MODEL_EXPORT virtual void initAttributes();
- /// Adds result to the sketch and to its document
- /// \param theIndex an index of the created body result in the compsolid
- /// The real index in the document of the result is an incremented given index
- /// The reason is that the first index is used for the comp solid result on the data
- virtual std::shared_ptr<ModelAPI_ResultBody> addResult(const int theIndex);
+ /// 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);
- /// 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);
+ /// 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);
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;
};