1 // File: GeomAlgoAPI_Boolean.h
2 // Created: 02 Sept 2014
3 // Author: Vitaly Smetannikov
5 #ifndef GeomAlgoAPI_Boolean_H_
6 #define GeomAlgoAPI_Boolean_H_
8 #include <GeomAlgoAPI.h>
9 #include <GeomAPI_Shape.h>
10 #include <GeomAlgoAPI_MakeShape.h>
11 #include <GeomAPI_DataMapOfShapeShape.h>
12 #include <boost/shared_ptr.hpp>
14 /**\class GeomAlgoAPI_Boolean
16 * \brief Allows to perform of boolean operations
18 class GeomAlgoAPI_Boolean : public GeomAPI_Interface
21 /* \brief Creates cut boolean operation
22 * \param[in] theShape the main shape
23 * \param[in] theTool toole shape for boolean
24 * \return a solid as result of operation
26 GEOMALGOAPI_EXPORT static boost::shared_ptr<GeomAPI_Shape> makeCut(
27 boost::shared_ptr<GeomAPI_Shape> theShape,
28 boost::shared_ptr<GeomAPI_Shape> theTool);
30 /* \brief Creates fuse boolean operation
31 * \param[in] theShape the main shape
32 * \param[in] theTool second shape
33 * \return a solid as result of operation
35 GEOMALGOAPI_EXPORT static boost::shared_ptr<GeomAPI_Shape> makeFuse(
36 boost::shared_ptr<GeomAPI_Shape> theShape,
37 boost::shared_ptr<GeomAPI_Shape> theTool);
39 /* \brief Creates common boolean operation
40 * \param[in] theObject the main shape
41 * \param[in] theTool second shape
42 * \param[in] theType type of the operation: Fuse, Cut, Common
43 * \return a solid as result of operation
45 GEOMALGOAPI_EXPORT static boost::shared_ptr<GeomAPI_Shape> makeCommon(
46 boost::shared_ptr<GeomAPI_Shape> theObject,
47 boost::shared_ptr<GeomAPI_Shape> theTool);
55 GEOMALGOAPI_EXPORT GeomAlgoAPI_Boolean (boost::shared_ptr<GeomAPI_Shape> theObject,
56 boost::shared_ptr<GeomAPI_Shape> theTool,
59 /// Returns True if algorithm succeed
60 GEOMALGOAPI_EXPORT const bool isDone() const;
62 /// Returns True if resulting shape is valid
63 GEOMALGOAPI_EXPORT const bool isValid() const;
65 /// Returns result of the boolean algorithm which may be a Solid or a Face
66 GEOMALGOAPI_EXPORT const boost::shared_ptr<GeomAPI_Shape>& shape () const;
68 /// Returns map of sub-shapes of the result. To be used for History keeping
69 GEOMALGOAPI_EXPORT void mapOfShapes (GeomAPI_DataMapOfShapeShape& theMap) const;
71 /// Return interface for for History processing
72 GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape* makeShape () const;
75 GEOMALGOAPI_EXPORT ~GeomAlgoAPI_Boolean();
78 /// builds resulting shape
79 void build(boost::shared_ptr<GeomAPI_Shape> theObject,
80 boost::shared_ptr<GeomAPI_Shape> theTool);
85 boost::shared_ptr<GeomAPI_Shape> myShape;
86 GeomAPI_DataMapOfShapeShape myMap;
87 GeomAlgoAPI_MakeShape * myMkShape;