]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Recover feature is dumped without "setName" (issue #1930)
authorazv <azv@opencascade.com>
Tue, 27 Dec 2016 15:17:18 +0000 (18:17 +0300)
committerazv <azv@opencascade.com>
Tue, 27 Dec 2016 15:17:47 +0000 (18:17 +0300)
Do not add to stack already dumped feature.

src/ModelHighAPI/ModelHighAPI_Dumper.cpp

index effc2d1d3af90857aa45264bd0aaa71c01062ca6..180b5c16fe3a50c8448a01e58c9108960cda8a6d 100644 (file)
@@ -624,18 +624,21 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(
 
 ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const FeaturePtr& theEntity)
 {
+  bool isFound = myNames.find(theEntity) != myNames.end();
   myDumpBuffer << name(theEntity);
 
-  bool isUserDefinedName = !myNames[theEntity].myIsDefault;
-  // store results if they have user-defined names or colors
-  std::list<ResultPtr> aResultsWithNameOrColor;
-  const std::list<ResultPtr>& aResults = theEntity->results();
-  std::list<ResultPtr>::const_iterator aResIt = aResults.begin();
-  for (; aResIt != aResults.end(); ++aResIt)
-    if (!myNames[*aResIt].myIsDefault || !isDefaultColor(*aResIt) || !isDefaultDeflection(*aResIt))
-      aResultsWithNameOrColor.push_back(*aResIt);
-  // store just dumped entity to stack
-  myEntitiesStack.push(LastDumpedEntity(theEntity, isUserDefinedName, aResultsWithNameOrColor));
+  if (!isFound) {
+    bool isUserDefinedName = !myNames[theEntity].myIsDefault;
+    // store results if they have user-defined names or colors
+    std::list<ResultPtr> aResultsWithNameOrColor;
+    const std::list<ResultPtr>& aResults = theEntity->results();
+    std::list<ResultPtr>::const_iterator aResIt = aResults.begin();
+    for (; aResIt != aResults.end(); ++aResIt)
+      if (!myNames[*aResIt].myIsDefault || !isDefaultColor(*aResIt) || !isDefaultDeflection(*aResIt))
+        aResultsWithNameOrColor.push_back(*aResIt);
+    // store just dumped entity to stack
+    myEntitiesStack.push(LastDumpedEntity(theEntity, isUserDefinedName, aResultsWithNameOrColor));
+  }
 
   // remove entity from the list of not dumped items
   myNotDumpedEntities.erase(theEntity);