1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomAlgoAPI_Boolean.h
4 // Created: 02 Sept 2014
5 // Author: Vitaly Smetannikov
7 #ifndef GeomAlgoAPI_Boolean_H_
8 #define GeomAlgoAPI_Boolean_H_
10 #include <GeomAlgoAPI.h>
11 #include <GeomAlgoAPI_MakeShape.h>
13 #include <GeomAPI_Shape.h>
14 #include <GeomAPI_Interface.h>
15 #include <GeomAPI_DataMapOfShapeShape.h>
19 /** \class GeomAlgoAPI_Boolean
21 * \brief Allows to perform of boolean operations
23 class GeomAlgoAPI_Boolean : public GeomAPI_Interface
26 /// Type of booelan operation
28 BOOL_CUT, ///< Cut objects
29 BOOL_FUSE, ///< Fuse objects
30 BOOL_COMMON ///< Take common part of objects
34 /** \brief Creates cut boolean operation.
35 * \param[in] theObjects the main shape.
36 * \param[in] theTools toole shape for boolean.
37 * \return a solid or compound of solids as result of operation.
39 GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape> makeCut(const ListOfShape& theObjects,
40 const ListOfShape& theTools);
42 /** \brief Creates fuse boolean operation.
43 * \param[in] theObjects the main shape.
44 * \param[in] theTools second shape.
45 * \return a solid as result of operation.
47 GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape> makeFuse(const ListOfShape& theObjects,
48 const ListOfShape& theTools);
50 /** \brief Creates common boolean operation.
51 * \param[in] theObjects the main shape.
52 * \param[in] theTools second shape.
53 * \return a solid as result of operation.
55 GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape> makeCommon(const ListOfShape& theObjects,
56 const ListOfShape& theTools);
59 GEOMALGOAPI_EXPORT GeomAlgoAPI_Boolean(const ListOfShape& theObjects,
60 const ListOfShape& theTools,
61 const OperationType theOperationType);
63 /// \return true if algorithm succeed.
64 GEOMALGOAPI_EXPORT const bool isDone() const;
66 /// \return true if resulting shape is valid.
67 GEOMALGOAPI_EXPORT const bool isValid() const;
69 /// \return result of the boolean algorithm.
70 GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& shape() const;
72 /// \return map of sub-shapes of the result. To be used for History keeping.
73 GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_DataMapOfShapeShape> mapOfShapes() const;
75 /// \return interface for for History processing.
76 GEOMALGOAPI_EXPORT std::shared_ptr<GeomAlgoAPI_MakeShape> makeShape() const;
79 /// Builds resulting shape.
80 void build(const ListOfShape& theObjects,
81 const ListOfShape& theTools,
82 const OperationType theOperationType);
87 std::shared_ptr<GeomAPI_Shape> myShape;
88 std::shared_ptr<GeomAPI_DataMapOfShapeShape> myMap;
89 std::shared_ptr<GeomAlgoAPI_MakeShape> myMkShape;