From: mpv Date: Thu, 18 Dec 2014 14:37:05 +0000 (+0300) Subject: Added methods for naming names optimized access X-Git-Tag: V_0.7.0_rc1~67 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ee873b34633b1cdd0fdb2b5efad9420ff4c51806;p=modules%2Fshaper.git Added methods for naming names optimized access --- diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 389bbfb4b..0eca5e794 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -1094,3 +1094,16 @@ Standard_Boolean IsEqual(const TDF_Label& theLab1, const TDF_Label& theLab2) { return TDF_LabelMapHasher::IsEqual(theLab1, theLab2); } + +void Model_Document::addNamingName(const TDF_Label theLabel, std::string theName) +{ + myNamingNames[theName] = theLabel; +} + +TDF_Label Model_Document::findNamingName(std::string theName) +{ + std::map::iterator aFind = myNamingNames.find(theName); + if (aFind == myNamingNames.end()) + return TDF_Label(); // not found + return aFind->second; +} diff --git a/src/Model/Model_Document.h b/src/Model/Model_Document.h index db04509ba..758255864 100644 --- a/src/Model/Model_Document.h +++ b/src/Model/Model_Document.h @@ -136,6 +136,11 @@ 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 @@ -200,6 +205,8 @@ 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 myObjs; + /// Optimization for finding the shape-label by topological naming names + std::map myNamingNames; ///< set of identifiers of sub-documents of this document std::set mySubs; diff --git a/src/ModelAPI/ModelAPI.i b/src/ModelAPI/ModelAPI.i index f601d1b11..1558e49dc 100644 --- a/src/ModelAPI/ModelAPI.i +++ b/src/ModelAPI/ModelAPI.i @@ -118,8 +118,8 @@ template std::shared_ptr shared_ptr_cast(std::shared_ptr theObject); %template(modelAPI_CompositeFeature) shared_ptr_cast; +%template(modelAPI_Feature) shared_ptr_cast; %template(modelAPI_ResultConstruction) shared_ptr_cast; %template(modelAPI_ResultBody) shared_ptr_cast; %template(modelAPI_ResultPart) shared_ptr_cast; - - +%template(modelAPI_ResultGroup) shared_ptr_cast;