X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_ResultConstruction.h;h=4efeb0e3ee2678255765439bc93d7ec7f4c549d5;hb=1803da706614befff7cacbe408c69ea14d71a8bb;hp=e5081240976388fbd85640eaff8013c29f05530a;hpb=5352bbb1915f98d1f02b1cb953a2de19b286a28c;p=modules%2Fshaper.git diff --git a/src/Model/Model_ResultConstruction.h b/src/Model/Model_ResultConstruction.h index e50812409..4efeb0e3e 100644 --- a/src/Model/Model_ResultConstruction.h +++ b/src/Model/Model_ResultConstruction.h @@ -11,6 +11,9 @@ #include #include +class ModelAPI_Document; +class TDF_Label; + /**\class Model_ResultConstruction * \ingroup DataModel * \brief The construction element result of a feature. @@ -23,20 +26,12 @@ class Model_ResultConstruction : public ModelAPI_ResultConstruction std::shared_ptr myOwner; ///< owner of this result std::shared_ptr myShape; ///< shape of this result created "on the fly" bool myFacesUpToDate; ///< is true if faces in myuFaces are computed and up to date - std::vector > myFaces; ///< stores the up to date faces if they exist + /// stores the up to date faces if they exist + std::vector > myFaces; bool myIsInHistory; + bool myIsInfinite; public: - /// default color for a result construction - inline static const std::string& DEFAULT_COLOR() - { - static const std::string RESULT_CONSTRUCTION_COLOR("120,120,120"); - return RESULT_CONSTRUCTION_COLOR; - } - - /// Request for initialization of data model of the result: adding all attributes - virtual void initAttributes(); - - // Retuns the parameters of color definition in the resources config manager + /// Retuns the parameters of color definition in the resources config manager MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName, std::string& theDefault); @@ -59,10 +54,47 @@ class Model_ResultConstruction : public ModelAPI_ResultConstruction /// if the construction result may be used as faces, this method returns face by zero based index MODEL_EXPORT virtual std::shared_ptr face(const int theIndex); + /// By default object is not infinite. + MODEL_EXPORT virtual bool isInfinite(); + /// Sets the flag that it is infinite + MODEL_EXPORT virtual void setInfinite(const bool theInfinite); + /// The construction element is never concealed + MODEL_EXPORT virtual void setIsConcealed(const bool theValue); + + // methods related to selection of sub-shapes in construction, used by SelectionAttribute + + /// Selects theSubShape in the construction. Returns an index of the selected sub-shape. + /// Puts the selected shape with a needed BRepNaming sub-structure to the data tree of result. + /// If theSubShape is null, it selects the whole construction and returns zero index. + /// If theIndex is not -1, it re-selects over the existing data (used for update selection). + /// If theExtDoc is document where this selection is needed, if it differs from this, + /// naming structures will be located there. + int select(const std::shared_ptr& theSubShape, + const std::shared_ptr theExtDoc, const int theIndex = -1); + + /// Returns already selected shape by the given index. Zero index means the whole construction, + /// so, the returned shape in this case is null. + /// If theExtDoc is document where this selection is needed, if it differs from this, + /// naming structures will be located there. + std::shared_ptr shape(const int theIndex, + const std::shared_ptr theExtDoc); + + /// Updates the existing selection by the index. + /// Returns false if update is failed. Returns theModified true if the selection was updated. + /// If theExtDoc is document where this selection is needed, if it differs from this, + /// naming structures will be updated there. + bool update(const int theIndex, const std::shared_ptr theExtDoc, + bool& theModified); + protected: /// Makes a body on the given feature Model_ResultConstruction(); + /// Searchies for the working label selection/update will start from + /// Returns true if this is label of the external document. + /// theExtDoc is document where this selection is required + TDF_Label startLabel(const std::shared_ptr theExtDoc, bool& theExternal); + friend class Model_Objects; };