X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_ResultCompSolid.h;h=ba92674e8c80a03228a3349655dc711447eef05a;hb=530f5aff42069e844c4a4ef164088ea23ba0e2dd;hp=f1c697e5631fec076819af8933099d3c329290c9;hpb=5bd71db89b7a145e0e1e51b03361e7ed400b961a;p=modules%2Fshaper.git diff --git a/src/Model/Model_ResultCompSolid.h b/src/Model/Model_ResultCompSolid.h index f1c697e56..ba92674e8 100755 --- a/src/Model/Model_ResultCompSolid.h +++ b/src/Model/Model_ResultCompSolid.h @@ -9,22 +9,24 @@ #include "Model.h" #include +#include /**\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 > 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: - /// 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(); @@ -32,33 +34,53 @@ public: /// 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 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& theShape); + + /// Stores the generated shape. Creates sub-results for compsolid. + MODEL_EXPORT virtual void storeGenerated(const std::shared_ptr& theFromShape, + const std::shared_ptr& theToShape); + + /// Stores the modified shape. Creates sub-results for compsolid. + MODEL_EXPORT virtual void storeModified(const std::shared_ptr& theOldShape, + const std::shared_ptr& 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 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 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; - /// 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 theResult); + /// 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 theThis, + const bool theFlag); + + /// 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& 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& theThisShape); + friend class Model_Objects; };