1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #include "FeaturesPlugin_Tools.h"
23 #include <ModelAPI_ResultBody.h>
25 #include <GeomAPI_ShapeIterator.h>
27 //==================================================================================================
28 void FeaturesPlugin_Tools::loadModifiedShapes(ResultBodyPtr theResultBody,
29 const ListOfShape& theBaseShapes,
30 const ListOfShape& theTools,
31 const GeomMakeShapePtr& theMakeShape,
32 const GeomShapePtr theResultShape)
34 theResultBody->storeModified(theBaseShapes, theResultShape, theMakeShape);
36 ListOfShape aShapes = theBaseShapes;
37 ListOfShape::const_iterator aToolIter = theTools.cbegin();
38 for(; aToolIter != theTools.cend(); aToolIter++)
39 aShapes.push_back(*aToolIter);
41 for (ListOfShape::const_iterator anIter = aShapes.begin(); anIter != aShapes.end(); ++anIter)
43 theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::VERTEX);
44 theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::EDGE);
45 theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::FACE);
49 //==================================================================================================
50 void FeaturesPlugin_Tools::loadModifiedShapes(ResultBodyPtr theResultBody,
51 const GeomShapePtr& theBaseShape,
52 const GeomMakeShapePtr& theMakeShape,
53 const std::string theName)
55 switch(theBaseShape->shapeType()) {
56 case GeomAPI_Shape::COMPOUND: {
57 for(GeomAPI_ShapeIterator anIt(theBaseShape); anIt.more(); anIt.next())
59 loadModifiedShapes(theResultBody,
66 case GeomAPI_Shape::COMPSOLID:
67 case GeomAPI_Shape::SOLID:
68 case GeomAPI_Shape::SHELL: {
69 theResultBody->loadModifiedShapes(theMakeShape,
74 case GeomAPI_Shape::FACE:
75 case GeomAPI_Shape::WIRE: {
76 theResultBody->loadModifiedShapes(theMakeShape,
81 case GeomAPI_Shape::EDGE: {
82 theResultBody->loadModifiedShapes(theMakeShape,
84 GeomAPI_Shape::VERTEX,
90 //==================================================================================================
91 void FeaturesPlugin_Tools::loadDeletedShapes(ResultBodyPtr theResultBody,
92 const GeomShapePtr theBaseShape,
93 const ListOfShape& theTools,
94 const GeomMakeShapePtr& theMakeShape,
95 const GeomShapePtr theResultShapesCompound)
97 ListOfShape aShapes = theTools;
98 if (theBaseShape.get())
99 aShapes.push_front(theBaseShape);
101 for (ListOfShape::const_iterator anIter = aShapes.begin(); anIter != aShapes.end(); anIter++)
103 theResultBody->loadDeletedShapes(theMakeShape,
105 GeomAPI_Shape::VERTEX,
106 theResultShapesCompound);
107 theResultBody->loadDeletedShapes(theMakeShape,
110 theResultShapesCompound);
111 theResultBody->loadDeletedShapes(theMakeShape,
114 theResultShapesCompound);
118 //==================================================================================================
119 void FeaturesPlugin_Tools::loadDeletedShapes(
120 std::vector<ResultBaseAlgo>& theResultBaseAlgoList,
121 const ListOfShape& theTools,
122 const GeomShapePtr theResultShapesCompound)
124 for (std::vector<ResultBaseAlgo>::iterator anIt = theResultBaseAlgoList.begin();
125 anIt != theResultBaseAlgoList.end();
128 ResultBaseAlgo& aRCA = *anIt;
129 loadDeletedShapes(aRCA.resultBody,
133 theResultShapesCompound);