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 #ifndef FeaturesPlugin_CompositeBoolean_H_
22 #define FeaturesPlugin_CompositeBoolean_H_
24 #include "FeaturesPlugin.h"
26 #include <ModelAPI_Feature.h>
27 #include <ModelAPI_ResultBody.h>
28 #include <GeomAlgoAPI_MakeShape.h>
30 /// \class FeaturesPlugin_CompositeBoolean
32 /// \brief Interface for the composite boolean feature.
33 class FeaturesPlugin_CompositeBoolean
43 /// Attribute name of main objects.
44 inline static const std::string& OBJECTS_ID()
46 static const std::string MY_OBJECTS_ID("main_objects");
50 /// Creates a new part document if needed.
51 FEATURESPLUGIN_EXPORT virtual void executeCompositeBoolean();
54 FeaturesPlugin_CompositeBoolean(){};
56 /// Initializes boolean attributes.
57 void initBooleanAttributes();
59 /// This function need to be defined for extrusion/revolution generation.
60 virtual bool makeGeneration(ListOfShape& theBaseShapes,
61 ListOfMakeShape& theMakeShapes) = 0;
63 /// Makes boolean operation.
64 /// \param[in] theTools list of tools.
65 /// \param[out] theObjects list of objects.
66 /// \param[out] theMakeShapes list of according algos.
67 /// \return false in failed.
68 bool makeBoolean(const ListOfShape& theTools,
69 ListOfShape& theObjects,
70 ListOfMakeShape& theMakeShapes);
72 /// Stores generation history.
73 virtual void storeGenerationHistory(ResultBodyPtr theResultBody,
74 const GeomShapePtr theBaseShape,
75 const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
78 /// Stores modification history.
79 void storeModificationHistory(ResultBodyPtr theResultBody,
80 const GeomShapePtr theObject,
81 const ListOfShape& theTools,
82 const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
86 ModelAPI_Feature* myFeature;
87 OperationType myOperationType;