Salome HOME
#1118 Crash the SALOME application after export
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Partition.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAlgoAPI_Partition.h
4 // Created:     21 Aug 2015
5 // Author:      Sergey POKHODENKO
6
7 #ifndef GeomAlgoAPI_Partition_H_
8 #define GeomAlgoAPI_Partition_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_Partition
20  *  \ingroup DataAlgo
21  *  \brief Allows to perform of partition operations
22  */
23 class GeomAlgoAPI_Partition : public GeomAPI_Interface
24 {
25 public:
26   /** \brief Creates common partition operation.
27    *  \param[in] theObjects the main shape.
28    *  \param[in] theTools  second shape.
29    *  \return a solid as result of operation.
30    */
31   GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape> make(const ListOfShape& theObjects,
32                                                                 const ListOfShape& theTools);
33
34   /// Constructor.
35   GEOMALGOAPI_EXPORT GeomAlgoAPI_Partition(const ListOfShape& theObjects,
36                                            const ListOfShape& theTools);
37
38   /// \return true if algorithm succeed.
39   GEOMALGOAPI_EXPORT const bool isDone() const;
40
41   /// \return true if resulting shape is valid.
42   GEOMALGOAPI_EXPORT const bool isValid() const;
43
44   /// \return result of the boolean algorithm.
45   GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& shape() const;
46
47   /// \return map of sub-shapes of the result. To be used for History keeping.
48   GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_DataMapOfShapeShape> mapOfShapes() const;
49
50   /// \return interface for for History processing.
51   GEOMALGOAPI_EXPORT std::shared_ptr<GeomAlgoAPI_MakeShape> makeShape() const;
52
53 private:
54   /// Builds resulting shape.
55   void build(const ListOfShape& theObjects,
56              const ListOfShape& theTools);
57
58 private:
59   /// Fields.
60   bool myDone;
61   std::shared_ptr<GeomAPI_Shape> myShape;
62   std::shared_ptr<GeomAPI_DataMapOfShapeShape> myMap;
63   std::shared_ptr<GeomAlgoAPI_MakeShape> myMkShape;
64 };
65
66 #endif