Salome HOME
Issue #2130: arc is done not as desired
[modules/shaper.git] / src / BuildPlugin / BuildPlugin_SubShapes.cpp
index 1689fb785000ea4ce43ce1ff7857eabf7f25920d..0eaa6a2e73bd1f02e0cf0fca94d84d51c023049b 100644 (file)
@@ -42,10 +42,11 @@ void BuildPlugin_SubShapes::attributeChanged(const std::string& theID)
     if(!aShapeAttrSelection.get() || !aSubShapesAttrList.get()) {
       return;
     }
-    ResultPtr aContext = aShapeAttrSelection->context();
 
     aSubShapesAttrList->clear();
 
+    ResultPtr aContext = aShapeAttrSelection->context();
+
     GeomShapePtr aBaseShape = aShapeAttrSelection->value();
     if(!aBaseShape.get()) {
       return;
@@ -103,20 +104,24 @@ void BuildPlugin_SubShapes::execute()
 
   // Copy sub-shapes from list to new shape.
   if(!aShapesToAdd.empty()) {
-    aBuilder.add(aResultShape, aShapesToAdd);
+    aBuilder.addInternal(aResultShape, aShapesToAdd);
     aResultShape = aBuilder.shape();
   }
 
   // Store result.
+  const int aModVertexTag = 1;
+  const int aModEdgeTag = 2;
   ResultBodyPtr aResultBody = document()->createBody(data());
   aResultBody->storeModified(aBaseShape, aResultShape);
-  aResultBody->loadAndOrientModifiedShapes(&aBuilder, aBaseShape, GeomAPI_Shape::EDGE, 1,
+  aResultBody->loadAndOrientModifiedShapes(&aBuilder, aBaseShape, GeomAPI_Shape::EDGE, aModEdgeTag,
                                           "Modified_Edge", *aBuilder.mapOfSubShapes().get());
-  for(ListOfShape::const_iterator anIt = aShapesToAdd.cbegin(); anIt != aShapesToAdd.cend(); ++anIt) {
+  for(ListOfShape::const_iterator
+      anIt = aShapesToAdd.cbegin(); anIt != aShapesToAdd.cend(); ++anIt) {
     GeomAPI_Shape::ShapeType aShType = (*anIt)->shapeType();
-    aResultBody->loadAndOrientModifiedShapes(&aBuilder, *anIt, aShType, 1,
-                                             aShType == GeomAPI_Shape::VERTEX ? "Modified_Vertex" : "Modified_Edge",
-                                             *aBuilder.mapOfSubShapes().get());
+    aResultBody->loadAndOrientModifiedShapes(&aBuilder, *anIt, aShType,
+                        aShType == GeomAPI_Shape::VERTEX ? aModVertexTag : aModEdgeTag,
+                        aShType == GeomAPI_Shape::VERTEX ? "Modified_Vertex" : "Modified_Edge",
+                        *aBuilder.mapOfSubShapes().get());
   }
   setResult(aResultBody);
 }