Salome HOME
Merge branch 'Dev_0.6.1' of newgeom:newgeom into Dev_0.6.1
[modules/shaper.git] / src / Model / Model_Document.h
index 519c57a19cb09a159de9f942672a7038e85b0307..ad309ce94ff6a117f647ae7a88d9bbc91ea625b7 100644 (file)
@@ -1,3 +1,5 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
 // File:        Model_Document.h
 // Created:     28 Feb 2014
 // Author:      Mikhail PONIKAROV
@@ -83,7 +85,7 @@ class Model_Document : public ModelAPI_Document
 
   //! Returns the existing feature by the label
   //! \param theLabel base label of the feature
-  MODEL_EXPORT virtual FeaturePtr feature(TDF_Label& theLabel);
+  MODEL_EXPORT virtual FeaturePtr feature(TDF_Label& theLabel) const;
 
   //! Returns the existing object: result or feature
   //! \param theLabel base label of the object
@@ -134,10 +136,18 @@ class Model_Document : public ModelAPI_Document
   ///! On abort, undo or redo it is not necessary: results in document are updated automatically
   bool executeFeatures() {return myExecuteFeatures;}
 
+  //! Registers the name of the shape for the topological naming needs
+  void addNamingName(const TDF_Label theLabel, std::string theName);
+  //! Returns the label, keeper of the name  for the topological naming needs
+  TDF_Label findNamingName(std::string theName);
+  //! Returns the result by name of the result (names of results must be unique, used for naming
+  //! selection by name.
+  ResultPtr findByName(const std::string theName);
+
  protected:
 
   //! Returns (creates if needed) the features label
-  TDF_Label featuresLabel();
+  TDF_Label featuresLabel() const;
 
   //! Initializes feature with a unique name in this group (unique name is generated as 
   //! feature type + "_" + index
@@ -177,10 +187,11 @@ class Model_Document : public ModelAPI_Document
   void updateResults(FeaturePtr theFeature);
 
   //! Returns all sub documents
-  const std::set<std::string>& subDocuments() const {return mySubs;}
+  const std::set<std::string> subDocuments(const bool theActivatedOnly) const;
 
   friend class Model_Application;
   friend class Model_Session;
+  friend class Model_Update;
   friend class Model_AttributeReference;
   friend class DFBrowser;
 
@@ -188,16 +199,18 @@ class Model_Document : public ModelAPI_Document
   std::string myID;  ///< identifier of the document in the application
   std::string myKind;  ///< kind of the document in the application
   Handle_TDocStd_Document myDoc;  ///< OCAF document
-  /// number of transactions after the last "save" call, used for "IsModified" method
-  int myTransactionsAfterSave;
+  /// counter of transactions
+  int myTransactionsCounter;
+  /// counter value of transaction on the last "save" call, used for "IsModified" method
+  int myTransactionSave;
   /// number of nested transactions performed (or -1 if not nested)
   int myNestedNum;
   /// All features managed by this document (not only in history of OB)
   /// For optimization mapped by labels
   NCollection_DataMap<TDF_Label, FeaturePtr> myObjs;
+  /// Optimization for finding the shape-label by topological naming names
+  std::map<std::string, TDF_Label> myNamingNames;
 
-  ///< set of identifiers of sub-documents of this document
-  std::set<std::string> mySubs;
   /// transaction indexes (related to myTransactionsAfterSave) which were empty in this doc
   std::map<int, bool> myIsEmptyTr;
   /// If it is true, features are not executed on update (on abort, undo, redo)