+ // Store modified shape.
+ if(!aBaseShape.get() || aBaseShape->isEqual(theResultShape)) {
+ aResultBody->store(theResultShape);
+ setResult(aResultBody, theIndex);
+ return;
+ }
+
+ const int aDelTag = 1;
+ /// sub solids will be placed at labels 3, 4, etc. if result is compound of solids
+ const int aSubTag = 2;
+ int aModTag = aSubTag + 10000;
+ const std::string aModName = "Modified";
+
+ aResultBody->storeModified(aBaseShape, theResultShape, aSubTag);
+
+ std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfSubShapes = theMakeShape->mapOfSubShapes();
+ theObjects.insert(theObjects.end(), thePlanes.begin(), thePlanes.end());
+ int anIndex = 1;
+ for(ListOfShape::const_iterator anIt = theObjects.cbegin(); anIt != theObjects.cend(); ++anIt) {
+ GeomShapePtr aShape = *anIt;
+ std::string aModEdgeName = aModName + "_Edge_" + std::to_string((long long)anIndex);
+ std::string aModFaceName = aModName + "_Face_" + std::to_string((long long)anIndex++);
+ aResultBody->loadAndOrientModifiedShapes(theMakeShape.get(), aShape, GeomAPI_Shape::EDGE,
+ aModTag, aModEdgeName, *aMapOfSubShapes.get(), true);
+ aModTag += 10000;
+ aResultBody->loadAndOrientModifiedShapes(theMakeShape.get(), aShape, GeomAPI_Shape::FACE,
+ aModTag, aModFaceName, *aMapOfSubShapes.get(), true);
+ aModTag += 10000;
+ aResultBody->loadDeletedShapes(theMakeShape.get(), aShape, GeomAPI_Shape::EDGE, aDelTag);
+ aResultBody->loadDeletedShapes(theMakeShape.get(), aShape, GeomAPI_Shape::FACE, aDelTag);
+ }
+
+ setResult(aResultBody, theIndex);
+}
+
+
+//=================================================================================================
+GeomShapePtr findBase(const GeomShapePtr theObjectShape,
+ const GeomShapePtr theResultShape,
+ const GeomAPI_Shape::ShapeType theShapeType,
+ const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
+{
+ GeomShapePtr aBaseShape;
+ std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfSubShapes = theMakeShape->mapOfSubShapes();
+ for(GeomAPI_ShapeExplorer anObjectSubShapesExp(theObjectShape, theShapeType);
+ anObjectSubShapesExp.more();
+ anObjectSubShapesExp.next()) {
+ GeomShapePtr anObjectSubShape = anObjectSubShapesExp.current();
+ ListOfShape aModifiedShapes;
+ theMakeShape->modified(anObjectSubShape, aModifiedShapes);
+ for(ListOfShape::const_iterator
+ aModIt = aModifiedShapes.cbegin(); aModIt != aModifiedShapes.cend(); ++aModIt) {
+ GeomShapePtr aModShape = *aModIt;
+ if(aMapOfSubShapes->isBound(aModShape)) {
+ aModShape = aMapOfSubShapes->find(aModShape);
+ }
+ if(theResultShape->isSubShape(aModShape)) {
+ aBaseShape = theObjectShape;
+ break;
+ }
+ }
+ if(aBaseShape.get()) {
+ break;