X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_Objects.h;h=72c85936b48c00153b3cf9eda46f7905e8ad9cc7;hb=ca5c4cc6ea4aa54000fe0e8729f9c14b8a59abfd;hp=bf9b2baceb0d04f37fdb8aaf5f04411f40bf3130;hpb=96912644cf6607688466ac69f1f098fd2fff37b7;p=modules%2Fshaper.git diff --git a/src/Model/Model_Objects.h b/src/Model/Model_Objects.h index bf9b2bace..72c85936b 100644 --- a/src/Model/Model_Objects.h +++ b/src/Model/Model_Objects.h @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -51,9 +52,12 @@ class Model_Objects //! \param theFeature a removed feature void removeFeature(FeaturePtr theFeature); + //! Moves the feature to make it after the given one in the history. + void moveFeature(FeaturePtr theMoved, FeaturePtr theAfterThis); + //! Returns the existing feature by the label //! \param theLabel base label of the feature - FeaturePtr feature(TDF_Label& theLabel) const; + FeaturePtr feature(TDF_Label theLabel) const; //! Returns the existing object: result or feature //! \param theLabel base label of the object @@ -67,7 +71,7 @@ class Model_Objects const std::string& theGroupID, const std::string& theName); //! Returns the result by the result name - ResultPtr Model_Objects::findByName(const std::string theName); + ResultPtr findByName(const std::string theName); //! Returns the object index in the group. Object must be visible. Otherwise returns -1. @@ -83,19 +87,35 @@ class Model_Objects //! Returns the number of features in the group int size(const std::string& theGroupID); - /// Creates a construction cresults + ///! Returns all (and disabled) results of the given type. Not fast method (iterates all features). + void allResults(const std::string& theGroupID, std::list& theResults); + + //! Returns the number of all features: in the history or not + int numInternalFeatures(); + //! Returns the feature by zero-based index: features in the history or not + std::shared_ptr internalFeature(const int theIndex); + + //! Returns feature by the id of the feature (produced by the Data "featureId" method) + std::shared_ptr featureById(const int theId); + + + /// Creates a construction result std::shared_ptr createConstruction( const std::shared_ptr& theFeatureData, const int theIndex = 0); - /// Creates a body results + /// Creates a body result std::shared_ptr createBody( const std::shared_ptr& theFeatureData, const int theIndex = 0); - /// Creates a part results + /// Creates a part result std::shared_ptr createPart( const std::shared_ptr& theFeatureData, const int theIndex = 0); - /// Creates a group results + /// Copies a part result, keeping the reference to origin + std::shared_ptr copyPart( + const std::shared_ptr& theOrigin, + const std::shared_ptr& theFeatureData, const int theIndex = 0); + /// Creates a group result std::shared_ptr createGroup( const std::shared_ptr& theFeatureData, const int theIndex = 0); - + /// Creates a parameter result std::shared_ptr createParameter( const std::shared_ptr& theFeatureData, const int theIndex = 0); @@ -104,7 +124,7 @@ class Model_Objects feature(const std::shared_ptr& theResult); //! Sets the owner of this manager - void setOwner(DocumentPtr theDoc) {myDoc = theDoc;} + void setOwner(DocumentPtr theDoc); //! Returns the owner of this manager DocumentPtr owner() {return myDoc;} @@ -122,11 +142,12 @@ class Model_Objects void setUniqueName(FeaturePtr theFeature); //! Synchronizes myFeatures list with the updated document - //! \param theMarkUpdated causes the "update" event for all features + //! \param theUpdated list of labels that are marked as modified, so featrues must be also //! \param theUpdateReferences causes the update of back-references + //! \param theOpen - on open nothing must be reexecuted, except not persistent results //! \param theFlush makes flush all events in the end of all modifications of this method - void synchronizeFeatures(const bool theMarkUpdated, const bool theUpdateReferences, - const bool theFlush); + void synchronizeFeatures(const TDF_LabelList& theUpdated, const bool theUpdateReferences, + const bool theOpen, const bool theFlush); //! Synchronizes the BackReferences list in Data of Features and Results void synchronizeBackRefs(); @@ -159,13 +180,28 @@ class Model_Objects /// Creates the history: up to date with the current state void createHistory(const std::string& theGroupID); - /// Returns to the next (from the history point of view) feature, any: invisible or disabled + /// Returns the next (from the history point of view) feature, any: invisible or disabled + /// \param theCurrent previous to the resulting feature /// \param theReverse if it is true, iterates in reverced order (next becomes previous) FeaturePtr nextFeature(FeaturePtr theCurrent, const bool theReverse = false); /// Returns to the first (from the history point of view) feature, any: invisible or disabled FeaturePtr firstFeature(); /// Returns to the last (from the history point of view) feature, any: invisible or disabled FeaturePtr lastFeature(); + /// Returns true if theLater is in history of features creation later than theCurrent + bool isLater(FeaturePtr theLater, FeaturePtr theCurrent) const; + + /// Returns the result group identifier of the given feature (for this at least one result must + /// be created before) + std::string featureResultGroup(FeaturePtr theFeature); + + //! Returns all features of the document including the hidden features which are not in + //! history. Not very fast method, for calling once, not in big cycles. + std::list > allFeatures(); + + //! synchronises back references for the given object basing on the collected data + void synchronizeBackRefsForObject( + const std::set>& theNewRefs, ObjectPtr theObject); private: TDF_Label myMain; ///< main label of the data storage @@ -186,6 +222,8 @@ class Model_Objects friend class Model_AttributeReference; friend class Model_AttributeRefAttr; friend class Model_AttributeRefList; + friend class Model_AttributeRefList; + friend class Model_SelectionNaming; }; #endif