Salome HOME
Small fix of ImportNaming.
[modules/shaper.git] / src / Model / Model_Document.h
index 0b7a618c68119b59f67e47c7a181e98639b7c256..6aa9ef4e83578e0e0793e58107c887da9086960e 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,15 @@ 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);
+
  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,7 +184,7 @@ 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;
@@ -198,9 +205,9 @@ class Model_Document : public ModelAPI_Document
   /// 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)