]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/Model/Model_Document.cpp
Salome HOME
#2027 Sketcher Trim feature - highlight should be cleared when the mouse is moved...
[modules/shaper.git] / src / Model / Model_Document.cpp
index e3af397f36feadbbaac93639749c7ed852b43acb..89c596d6d2026e2df305d0709adba247570732d2 100755 (executable)
@@ -38,6 +38,7 @@
 #include <TDF_ListIteratorOfLabelList.hxx>
 #include <TDF_LabelMap.hxx>
 #include <TDF_DeltaOnAddition.hxx>
+#include <TNaming_Builder.hxx>
 #include <TNaming_SameShapeIterator.hxx>
 #include <TNaming_Iterator.hxx>
 #include <TNaming_NamedShape.hxx>
@@ -77,7 +78,7 @@ Model_Document::Model_Document(const int theID, const std::string theKind)
     : myID(theID), myKind(theKind), myIsActive(false),
       myDoc(new TDocStd_Document("BinOcaf"))  // binary OCAF format
 {
-#ifdef DFBROWSER
+#ifdef TINSPECTOR
   CDF_Session::CurrentSession()->Directory()->Add(myDoc);
 #endif
   myObjs = new Model_Objects(myDoc->Main());
@@ -196,6 +197,7 @@ bool Model_Document::load(const char* theDirName, const char* theFileName, Docum
   if (!isError) {
     myDoc = aLoaded;
     myDoc->SetUndoLimit(UNDO_LIMIT);
+
     // to avoid the problem that feature is created in the current, not this, document
     aSession->setActiveDocument(anApp->document(myID), false);
     aSession->setCheckTransactions(false);
@@ -680,7 +682,7 @@ void Model_Document::abortOperation()
   for (; aSubIter != aSubs.end(); aSubIter++)
     subDoc(*aSubIter)->abortOperation();
   // references may be changed because they are set in attributes on the fly
-  myObjs->synchronizeFeatures(aDeltaLabels, true, false, isRoot());
+  myObjs->synchronizeFeatures(aDeltaLabels, true, false, false, isRoot());
 }
 
 bool Model_Document::isOperation() const
@@ -747,7 +749,7 @@ void Model_Document::undoInternal(const bool theWithSubs, const bool theSynchron
   }
   // after undo of all sub-documents to avoid updates on not-modified data (issue 370)
   if (theSynchronize) {
-    myObjs->synchronizeFeatures(aDeltaLabels, true, false, isRoot());
+    myObjs->synchronizeFeatures(aDeltaLabels, true, false, false, isRoot());
     // update the current features status
     setCurrentFeature(currentFeature(false), false);
   }
@@ -794,7 +796,7 @@ void Model_Document::redo()
     subDoc(*aSubIter)->redo();
 
   // after redo of all sub-documents to avoid updates on not-modified data (issue 370)
-  myObjs->synchronizeFeatures(aDeltaLabels, true, false, isRoot());
+  myObjs->synchronizeFeatures(aDeltaLabels, true, false, false, isRoot());
   // update the current features status
   setCurrentFeature(currentFeature(false), false);
 }
@@ -1239,6 +1241,20 @@ TDF_Label Model_Document::findNamingName(std::string theName)
         if (aName->Get() == aSubName)
           return aName->Label();
       }
+      // If not found child label with the exact sub-name, then try to find compound with
+      // such sub-name without suffix.
+      Standard_Integer aSuffixPos = aSubName.SearchFromEnd('_');
+      if (aSuffixPos != -1) {
+        TCollection_ExtendedString anIndexStr = aSubName.Split(aSuffixPos);
+        aSubName.Remove(aSuffixPos);
+        aNamesIter.Initialize(aFind->second, TDataStd_Name::GetID(), Standard_True);
+        for(; aNamesIter.More(); aNamesIter.Next()) {
+          Handle(TDataStd_Name) aName = Handle(TDataStd_Name)::DownCast(aNamesIter.Value());
+          if (aName->Get() == aSubName) {
+            return aName->Label();
+          }
+        }
+      }
     }
   }
   return TDF_Label(); // not found