]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Added methods for naming names optimized access
authormpv <mikhail.ponikarov@opencascade.com>
Thu, 18 Dec 2014 14:37:05 +0000 (17:37 +0300)
committermpv <mikhail.ponikarov@opencascade.com>
Thu, 18 Dec 2014 14:37:05 +0000 (17:37 +0300)
src/Model/Model_Document.cpp
src/Model/Model_Document.h
src/ModelAPI/ModelAPI.i

index 389bbfb4b9c1214897dd96f87754f8c35f1160fb..0eca5e7948f158b793b8e68354a013d514e6d114 100644 (file)
@@ -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<std::string, TDF_Label>::iterator aFind = myNamingNames.find(theName);
+  if (aFind == myNamingNames.end())
+    return TDF_Label(); // not found
+  return aFind->second;
+}
index db04509ba5e941d98f11140deda59744ad2577f8..75825586474b1dd93bef02be0455018c9a034273 100644 (file)
@@ -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<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;
index f601d1b11ea2317844500fba0bdee5e2de0eeba7..1558e49dc64c226f2027e9732caedb7b92cf2354 100644 (file)
 
 template<class T1, class T2> std::shared_ptr<T1> shared_ptr_cast(std::shared_ptr<T2> theObject);
 %template(modelAPI_CompositeFeature) shared_ptr_cast<ModelAPI_CompositeFeature, ModelAPI_Feature>;
+%template(modelAPI_Feature) shared_ptr_cast<ModelAPI_Feature, ModelAPI_Object>;
 %template(modelAPI_ResultConstruction) shared_ptr_cast<ModelAPI_ResultConstruction, ModelAPI_Result>;
 %template(modelAPI_ResultBody) shared_ptr_cast<ModelAPI_ResultBody, ModelAPI_Result>;
 %template(modelAPI_ResultPart) shared_ptr_cast<ModelAPI_ResultPart, ModelAPI_Result>;
-
-
+%template(modelAPI_ResultGroup) shared_ptr_cast<ModelAPI_ResultPart, ModelAPI_ResultGroup>;