]> SALOME platform Git repositories - modules/shaper.git/blob - src/FeaturesPlugin/FeaturesPlugin_Tools.cpp
Salome HOME
Issue #2052: Modification of parameters don't work (sketch, extrusion)
[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                                                const int theFaceTag,
17                                                const int theEdgeTag,
18                                                const int theVertexTag,
19                                                const std::string theName,
20                                                GeomAPI_DataMapOfShapeShape& theSubShapes)
21 {
22   switch(theBaseShape->shapeType()) {
23     case GeomAPI_Shape::COMPOUND: {
24       for(GeomAPI_ShapeIterator anIt(theBaseShape); anIt.more(); anIt.next())
25       {
26         storeModifiedShapes(theAlgo,
27                             theResultBody,
28                             anIt.current(),
29                             theFaceTag,
30                             theEdgeTag,
31                             theVertexTag,
32                             theName,
33                             theSubShapes);
34       }
35       break;
36     }
37     case GeomAPI_Shape::COMPSOLID:
38     case GeomAPI_Shape::SOLID:
39     case GeomAPI_Shape::SHELL: {
40       theResultBody->loadAndOrientModifiedShapes(&theAlgo,
41                                 theBaseShape, GeomAPI_Shape::FACE,
42                                 theFaceTag, theName + "_Face", theSubShapes, false, true);
43       if (theBaseShape->shapeType() == GeomAPI_Shape::COMPSOLID
44           || theBaseShape->shapeType() == GeomAPI_Shape::SOLID) {
45         break;
46       }
47     }
48     case GeomAPI_Shape::FACE:
49     case GeomAPI_Shape::WIRE: {
50       theResultBody->loadAndOrientModifiedShapes(&theAlgo,
51                                 theBaseShape, GeomAPI_Shape::EDGE,
52                                 theEdgeTag, theName + "_Edge", theSubShapes, false, true);
53     }
54     case GeomAPI_Shape::EDGE: {
55       theResultBody->loadAndOrientModifiedShapes(&theAlgo,
56                               theBaseShape, GeomAPI_Shape::VERTEX,
57                               theVertexTag, theName + "_Vertex", theSubShapes, false, true);
58     }
59   }
60 }