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] theBaseShape face for revolution.
37 * \param[in] theAxis axis for revolution.
38 * \param[in] theToAngle to angle.
39 * \param[in] theFromAngle from angle.
41 GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(std::shared_ptr<GeomAPI_Shape> theBaseShape,
42 std::shared_ptr<GeomAPI_Ax1> theAxis,
46 /** \brief Creates revolution for the given shape.
47 * \param[in] theBaseShape face for revolution.
48 * \param[in] theAxis axis for revolution.
49 * \param[in] theToShape to bounding shape. Can be empty. In this case offset will be applied to the basis.
50 * \param[in] theToAngle to angle.
51 * \param[in] theFromShape from bounding shape. Can be empty. In this case offset will be applied to the basis.
52 * \param[in] theFromAngle from angle.
54 GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(std::shared_ptr<GeomAPI_Shape> theBaseShape,
55 std::shared_ptr<GeomAPI_Ax1> theAxis,
56 std::shared_ptr<GeomAPI_Shape> theToShape,
58 std::shared_ptr<GeomAPI_Shape> theFromShape,
61 /// \return true if algorithm succeed.
62 GEOMALGOAPI_EXPORT const bool isDone() const;
64 /// \return true if resulting shape is valid.
65 GEOMALGOAPI_EXPORT const bool isValid() const;
67 /// \return true if resulting shape has volume.
68 GEOMALGOAPI_EXPORT const bool hasVolume() const;
70 /// \return result of the Revolution algorithm.
71 GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& shape() const;
73 /// \returns the list of from faces.
74 GEOMALGOAPI_EXPORT const ListOfShape& fromFaces() const;
76 /// \return the list of to faces.
77 GEOMALGOAPI_EXPORT const ListOfShape& toFaces() const;
79 /// \return map of sub-shapes of the result. To be used for History keeping.
80 GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_DataMapOfShapeShape> mapOfShapes() const;
82 /// \return interface for History processing.
83 GEOMALGOAPI_EXPORT std::shared_ptr<GeomAlgoAPI_MakeShape> makeShape() const;
86 /** \brief Constructs infinite face from thePlane, and with axis located on the same side
87 * of the plane as thePoint. Modifies thePlane axis direction.
88 * \param[in,out] thePlane plane to construct face.
89 * \param[in] thePoint point to locate plane axis.
90 * \return constructed face.
92 TopoDS_Face makeFaceFromPlane(gp_Pln& thePlane, const gp_Pnt& thePoint);
94 /// \return solid created from face or shell.
95 TopoDS_Solid makeSolidFromShape(const TopoDS_Shape& theShape);
97 /** \brief Selects solid from theShape with closest center of mass to thePoint
98 * \param[in] theShape compound with solids.
99 * \param[in] thePoint point.
102 TopoDS_Shape findClosest(const TopoDS_Shape& theShape, const gp_Pnt& thePoint);
104 /// Builds resulting shape.
105 void build(const std::shared_ptr<GeomAPI_Shape>& theBaseShape,
106 const std::shared_ptr<GeomAPI_Ax1>& theAxis,
107 const std::shared_ptr<GeomAPI_Shape>& theToShape,
109 const std::shared_ptr<GeomAPI_Shape>& theFromShape,
110 double theFromAngle);
115 std::shared_ptr<GeomAPI_Shape> myShape;
116 ListOfShape myFromFaces;
117 ListOfShape myToFaces;
118 std::shared_ptr<GeomAPI_DataMapOfShapeShape> myMap;
119 std::shared_ptr<GeomAlgoAPI_MakeShape> myMkShape;