Salome HOME
Issue #1942: group - names are empty strings
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Tools.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        FeaturesPlugin_Tools.cpp
4 // Created:     17 November 2016
5 // Author:      Dmitry Bobylev
6
7 #include "FeaturesPlugin_Tools.h"
8
9 #include <ModelAPI_ResultBody.h>
10
11 #include <GeomAPI_ShapeIterator.h>
12
13 void FeaturesPlugin_Tools::storeModifiedShapes(GeomAlgoAPI_MakeShape& theAlgo,
14                                                std::shared_ptr<ModelAPI_ResultBody> theResultBody,
15                                                std::shared_ptr<GeomAPI_Shape> theBaseShape,
16                                                int& theTag,
17                                                const std::string theName,
18                                                GeomAPI_DataMapOfShapeShape& theSubShapes)
19 {
20   switch(theBaseShape->shapeType()) {
21     case GeomAPI_Shape::COMPOUND: {
22       for(GeomAPI_ShapeIterator anIt(theBaseShape); anIt.more(); anIt.next())
23       {
24         storeModifiedShapes(theAlgo, theResultBody, theBaseShape, theTag, theName, theSubShapes);
25         theTag++;
26       }
27       break;
28     }
29     case GeomAPI_Shape::COMPSOLID:
30     case GeomAPI_Shape::SOLID:
31     case GeomAPI_Shape::SHELL: {
32       theResultBody->loadAndOrientModifiedShapes(&theAlgo,
33                                 theBaseShape, GeomAPI_Shape::FACE,
34                                 theTag, theName + "_Face", theSubShapes);
35       if (theBaseShape->shapeType() == GeomAPI_Shape::COMPSOLID
36           || theBaseShape->shapeType() == GeomAPI_Shape::SOLID) {
37         break;
38       }
39     }
40     case GeomAPI_Shape::FACE:
41     case GeomAPI_Shape::WIRE:
42       theResultBody->loadAndOrientModifiedShapes(&theAlgo,
43                                 theBaseShape, GeomAPI_Shape::EDGE,
44                                 ++theTag, theName + "_Edge", theSubShapes);
45     case GeomAPI_Shape::EDGE:
46       theResultBody->loadAndOrientModifiedShapes(&theAlgo,
47                               theBaseShape, GeomAPI_Shape::VERTEX,
48                               ++theTag, theName + "_Vertex", theSubShapes);
49   }
50 }