-
-//=================================================================================================
-void FeaturesPlugin_Intersection::loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
- const ListOfShape& theObjects,
- GeomAlgoAPI_MakeShape& theMakeShape)
-{
- std::shared_ptr<GeomAPI_Shape> aResultShape = theMakeShape.shape();
- theResultBody->storeModified(theObjects.front(), aResultShape);
-
- GeomAPI_DataMapOfShapeShape aShapesMap; // Map to store {result_shape, original_shape}
- const int aShapeTypesNb = 2;
- const GeomAPI_Shape::ShapeType aShapeTypes[aShapeTypesNb] =
- {GeomAPI_Shape::VERTEX, GeomAPI_Shape::EDGE};
- for (ListOfShape::const_iterator anIt = theObjects.cbegin(); anIt != theObjects.cend(); ++anIt) {
- const GeomShapePtr aShape = *anIt;
- for(int anIndex = 0; anIndex < aShapeTypesNb; ++anIndex) {
- for(GeomAPI_ShapeExplorer anOrigShapeExp(aShape, aShapeTypes[anIndex]);
- anOrigShapeExp.more();
- anOrigShapeExp.next()) {
- ListOfShape aHistory;
- const GeomShapePtr aSubShape = anOrigShapeExp.current();
- theMakeShape.modified(aSubShape, aHistory);
- for(ListOfShape::const_iterator aHistoryIt = aHistory.cbegin();
- aHistoryIt != aHistory.cend();
- ++aHistoryIt) {
- aShapesMap.bind(*aHistoryIt, aSubShape);
- }
- }
- }
- }
-
- int aModifiedVertexIndex(1),
- aGeneratedVertexIndex(1),
- aModifiedEdgeIndex(1),
- aGeneratedEdgeIndex(1);
- int aTag = 4;
- GeomAPI_DataMapOfShapeShape aStoredShapes;
- for(int anIndex = 0; anIndex < aShapeTypesNb; ++anIndex) {
- for(GeomAPI_ShapeExplorer aShapeExp(aResultShape, aShapeTypes[anIndex]);
- aShapeExp.more();
- aShapeExp.next()) {
- const GeomShapePtr aSubShape = aShapeExp.current();
- if(aStoredShapes.isBound(aSubShape)) {
- continue;
- }
- if(aShapesMap.isBound(aSubShape)) {
- theResultBody->modified(aShapesMap.find(aSubShape),
- aSubShape,
- std::string("Modified_")
- + (anIndex == 0 ? "Vertex_" : "Edge_")
- + std::to_string((long long)(anIndex == 0 ? aModifiedVertexIndex++
- : aModifiedEdgeIndex++)),
- aTag++);
- } else {
- theResultBody->generated(
- aSubShape,
- std::string("Generated_")
- + (anIndex == 0 ? "Vertex_" : "Edge_")
- + std::to_string((long long)(anIndex == 0 ? aGeneratedVertexIndex++
- : aGeneratedEdgeIndex++)));
- }
- aStoredShapes.bind(aSubShape, aSubShape);
- }
- }
-}