1 // Copyright (C) 2014-2019 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 email : webmaster.salome@opencascade.com
20 #ifndef FeaturesPlugin_CompositeBoolean_H_
21 #define FeaturesPlugin_CompositeBoolean_H_
23 #include "FeaturesPlugin.h"
25 #include <ModelAPI_Feature.h>
26 #include <ModelAPI_ResultBody.h>
27 #include <GeomAlgoAPI_MakeShape.h>
29 /// \class FeaturesPlugin_CompositeBoolean
31 /// \brief Interface for the composite boolean feature.
32 class FeaturesPlugin_CompositeBoolean
42 /// Attribute name of main objects.
43 inline static const std::string& OBJECTS_ID()
45 static const std::string MY_OBJECTS_ID("main_objects");
49 /// Performs the algorithm and stores results it in the data structure.
50 FEATURESPLUGIN_EXPORT virtual void executeCompositeBoolean();
53 struct ResultBaseAlgo {
54 ResultBodyPtr resultBody;
55 GeomShapePtr baseShape;
56 std::shared_ptr<GeomAlgoAPI_MakeShape> makeShape;
60 FeaturesPlugin_CompositeBoolean(){};
62 /// Initializes boolean attributes.
63 void initBooleanAttributes();
65 /// This function need to be defined for extrusion/revolution generation.
66 virtual bool makeGeneration(ListOfShape& theBaseShapes,
67 ListOfMakeShape& theMakeShapes) = 0;
69 /// Makes boolean operation.
70 /// \param[in] theTools list of tools.
71 /// \param[out] theObjects list of objects.
72 /// \param[out] theMakeShapes list of according algos.
73 /// \return false in failed.
74 bool makeBoolean(const ListOfShape& theTools,
75 ListOfShape& theObjects,
76 ListOfMakeShape& theMakeShapes);
78 /// Stores generation history.
79 virtual void storeGenerationHistory(ResultBodyPtr theResultBody,
80 const GeomShapePtr theBaseShape,
81 const GeomMakeShapePtr theMakeShape) = 0;
83 /// Stores modification history.
84 void storeModificationHistory(ResultBodyPtr theResultBody,
85 const GeomShapePtr theObject,
86 const ListOfShape& theTools,
87 const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
89 /// Stores deleted shapes.
90 void storeDeletedShapes(std::vector<ResultBaseAlgo>& theResultBaseAlgoList,
91 const ListOfShape& theTools,
92 const GeomShapePtr theResultShapesCompound);
95 ModelAPI_Feature* myFeature;
96 OperationType myOperationType;