1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomAlgoAPI_Revolution.h
4 // Created: 12 May 2015
5 // Author: Dmitry Bobylev
7 #ifndef GeomAlgoAPI_Revolution_H_
8 #define GeomAlgoAPI_Revolution_H_
10 #include <GeomAlgoAPI.h>
11 #include <GeomAlgoAPI_MakeShape.h>
12 #include <GeomAPI_Ax1.h>
13 #include <GeomAPI_DataMapOfShapeShape.h>
21 /** \class GeomAlgoAPI_Revolution
23 * \brief Allows to create the revolution based on a given face, angles and bounding planes.
24 * \n Note that only the planar faces are allowed as bounding faces and resulting
25 * revolution will be bounded by the infinite planes taken from the faces.
26 * \n If the bounding plane was specified with the angle then this plane will be rotated around
27 * the axis to the value of the angle.
28 * \n Note that algorithm return only one solid object. So in case when after cutting with bounding
29 * planes algorithm got more than one solid it will return the closest to the center of mass of
32 class GeomAlgoAPI_Revolution : public GeomAPI_Interface
35 /** \brief Creates revolution for the given shape
36 * \param[in] theBasis face for revolution
37 * \param[in] theFromShape from bounding shape
38 * \param[in] theFromAngle from angle
39 * \param[in] theToShape to bounding shape
40 * \param[in] theToAngle to angle
41 * \return a solid which is obtained from specified one
43 GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(std::shared_ptr<GeomAPI_Shape> theBasis,
44 std::shared_ptr<GeomAPI_Ax1> theAxis,
45 std::shared_ptr<GeomAPI_Shape> theFromShape,
47 std::shared_ptr<GeomAPI_Shape> theToShape,
50 /// \return true if algorithm succeed.
51 GEOMALGOAPI_EXPORT const bool isDone() const;
53 /// \return true if resulting shape is valid.
54 GEOMALGOAPI_EXPORT const bool isValid() const;
56 /// \return true if resulting shape has volume.
57 GEOMALGOAPI_EXPORT const bool hasVolume() const;
59 /// \return result of the Revolution algorithm.
60 GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& shape() const;
62 /// \return the first shape.
63 GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& firstShape();
65 /// \return the last shape.
66 GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& lastShape();
68 /// \return 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 History processing.
72 GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape* makeShape() const;
75 GEOMALGOAPI_EXPORT ~GeomAlgoAPI_Revolution();
78 /** \brief Constructs infinite face from thePlane, and with axis located on the same side
79 * of the plane as thePoint. Modifies thePlane axis direction.
80 * \param[in,out] thePlane plane to construct face.
81 * \param[in] thePoint point to locate plane axis.
82 * \return constructed face.
84 TopoDS_Face makeFaceFromPlane(gp_Pln& thePlane, const gp_Pnt& thePoint);
86 /// \return solid created from face.
87 TopoDS_Solid makeSolidFromFace(const TopoDS_Face& theFace);
89 /** \brief Selects solid from theShape with closest center of mass to thePoint
90 * \param[in] theShape compound with solids.
91 * \param[in] thePoint point.
94 TopoDS_Shape findClosest(const TopoDS_Shape& theShape, const gp_Pnt& thePoint);
96 /// Builds resulting shape.
97 void build(const std::shared_ptr<GeomAPI_Shape>& theBasis);
101 std::shared_ptr<GeomAPI_Ax1> myAxis;
102 std::shared_ptr<GeomAPI_Shape> myFromShape;
104 std::shared_ptr<GeomAPI_Shape> myToShape;
107 std::shared_ptr<GeomAPI_Shape> myShape;
108 std::shared_ptr<GeomAPI_Shape> myFirst;
109 std::shared_ptr<GeomAPI_Shape> myLast;
110 GeomAPI_DataMapOfShapeShape myMap;
111 GeomAlgoAPI_MakeShape* myMkShape;