aResultShape = anAttrSelectionInList->value();
}
// deleted and copied must be jointed to one list which keeps all the history
- GeomAlgoAPI_MakeShapeList aMakeShapeList;
+ std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
// find all removed shapes
std::shared_ptr<GeomAlgoAPI_MakeShapeCustom> aDeletedSubs(new GeomAlgoAPI_MakeShapeCustom);
}
}
}
- aMakeShapeList.appendAlgo(aDeletedSubs);
+ aMakeShapeList->appendAlgo(aDeletedSubs);
std::shared_ptr<GeomAlgoAPI_Copy> aCopy(new GeomAlgoAPI_Copy(aResultShape));
aResultShape = aCopy->shape();
- aMakeShapeList.appendAlgo(aCopy);
+ aMakeShapeList->appendAlgo(aCopy);
+
+ if (aResultShape->shapeType() == GeomAPI_Shape::COMPOUND) {
+ aResultShape = GeomAlgoAPI_ShapeTools::groupSharedTopology(aResultShape);
+ if (aResultShape->shapeType() == GeomAPI_Shape::COMPOUND) {
+ // if the result has only one sub-shape, discard the compound
+ GeomAPI_ShapeIterator aSubIt(aResultShape);
+ GeomShapePtr aSub = aSubIt.current();
+ aSubIt.next();
+ if (!aSubIt.more())
+ aResultShape = aSub;
+ }
+ }
// Store result.
ResultBodyPtr aResultBody = document()->createBody(data());
- aResultBody->storeModified(aBaseShape, aResultShape, 1);
- std::set<GeomAPI_Shape::ShapeType>::iterator aTypeIter = aTypes.begin();
- for(; aTypeIter != aTypes.end(); aTypeIter++)
- aResultBody->loadDeletedShapes(&aMakeShapeList, aBaseShape, *aTypeIter, 1);
- aResultBody->loadAndOrientModifiedShapes(&aMakeShapeList, aBaseShape, GeomAPI_Shape::FACE,
- 2, "Modified_Face", *aMakeShapeList.mapOfSubShapes().get(), true, false, true);
- aResultBody->loadAndOrientModifiedShapes(&aMakeShapeList, aBaseShape, GeomAPI_Shape::EDGE,
- 3, "Modified_Edge", *aMakeShapeList.mapOfSubShapes().get(), false, false, true);
- aResultBody->loadAndOrientModifiedShapes(&aMakeShapeList, aBaseShape, GeomAPI_Shape::VERTEX,
- 4, "Modified_Vertex", *aMakeShapeList.mapOfSubShapes().get());
+ aResultBody->storeModified(aBaseShape, aResultShape);
+ for (std::set<GeomAPI_Shape::ShapeType>::iterator aTypeIter = aTypes.begin();
+ aTypeIter != aTypes.end();
+ ++aTypeIter)
+ {
+ aResultBody->loadDeletedShapes(aMakeShapeList, aBaseShape, *aTypeIter);
+ }
+
+ aResultBody->loadModifiedShapes(aMakeShapeList,
+ aBaseShape,
+ GeomAPI_Shape::FACE);
+ aResultBody->loadModifiedShapes(aMakeShapeList,
+ aBaseShape,
+ GeomAPI_Shape::EDGE);
+ aResultBody->loadModifiedShapes(aMakeShapeList,
+ aBaseShape,
+ GeomAPI_Shape::VERTEX);
setResult(aResultBody);
}