]> SALOME platform Git repositories - modules/shaper.git/blob - src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h
Salome HOME
Merge branch 'python_parametric_api' of https://git.salome-platform.org/git/modules...
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Boolean.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAlgoAPI_Boolean.h
4 // Created:     02 Sept 2014
5 // Author:      Vitaly Smetannikov
6
7 #ifndef GeomAlgoAPI_Boolean_H_
8 #define GeomAlgoAPI_Boolean_H_
9
10 #include <GeomAlgoAPI.h>
11 #include <GeomAlgoAPI_MakeShape.h>
12
13 #include <GeomAPI_Shape.h>
14 #include <GeomAPI_Interface.h>
15 #include <GeomAPI_DataMapOfShapeShape.h>
16
17 #include <memory>
18
19 /** \class GeomAlgoAPI_Boolean
20  *  \ingroup DataAlgo
21  *  \brief Allows to perform of boolean operations
22  */
23 class GeomAlgoAPI_Boolean : public GeomAPI_Interface
24 {
25 public:
26   /// Type of booelan operation
27   enum OperationType{
28     BOOL_CUT, ///< Cut objects
29     BOOL_FUSE, ///< Fuse objects
30     BOOL_COMMON ///< Take common part of objects
31   };
32
33  public:
34
35   /// Constructor.
36   GEOMALGOAPI_EXPORT GeomAlgoAPI_Boolean(const ListOfShape& theObjects,
37                                          const ListOfShape& theTools,
38                                          const OperationType theOperationType);
39
40   /// \return true if algorithm succeed.
41   GEOMALGOAPI_EXPORT const bool isDone() const;
42
43   /// \return true if resulting shape is valid.
44   GEOMALGOAPI_EXPORT const bool isValid() const;
45
46   /// \return result of the boolean algorithm.
47   GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& shape() const;
48
49   /// \return map of sub-shapes of the result. To be used for History keeping.
50   GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_DataMapOfShapeShape> mapOfShapes() const;
51
52   /// \return interface for for History processing.
53   GEOMALGOAPI_EXPORT std::shared_ptr<GeomAlgoAPI_MakeShape> makeShape() const;
54
55 private:
56   /// Builds resulting shape.
57   void build(const ListOfShape& theObjects,
58              const ListOfShape& theTools,
59              const OperationType theOperationType);
60
61 private:
62   /// Fields.
63   bool myDone;
64   std::shared_ptr<GeomAPI_Shape> myShape;
65   std::shared_ptr<GeomAPI_DataMapOfShapeShape> myMap;
66   std::shared_ptr<GeomAlgoAPI_MakeShape> myMkShape;
67 };
68
69 #endif