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] theToAngle to angle.
38 * \param[in] theFromAngle from angle.
40 GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(std::shared_ptr<GeomAPI_Shape> theBasis,
41 std::shared_ptr<GeomAPI_Ax1> theAxis,
45 /** \brief Creates revolution for the given shape.
46 * \param[in] theBasis face for revolution.
47 * \param[in] theToShape to bounding shape. Can be empty. In this case offset will be applied to the basis.
48 * \param[in] theToAngle to angle.
49 * \param[in] theFromShape from bounding shape. Can be empty. In this case offset will be applied to the basis.
50 * \param[in] theFromAngle from angle.
52 GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(std::shared_ptr<GeomAPI_Shape> theBasis,
53 std::shared_ptr<GeomAPI_Ax1> theAxis,
54 std::shared_ptr<GeomAPI_Shape> theToShape,
56 std::shared_ptr<GeomAPI_Shape> theFromShape,
59 /// \return true if algorithm succeed.
60 GEOMALGOAPI_EXPORT const bool isDone() const;
62 /// \return true if resulting shape is valid.
63 GEOMALGOAPI_EXPORT const bool isValid() const;
65 /// \return true if resulting shape has volume.
66 GEOMALGOAPI_EXPORT const bool hasVolume() const;
68 /// \return result of the Revolution algorithm.
69 GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& shape() const;
71 /// \return the first shape.
72 GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& firstShape();
74 /// \return the last shape.
75 GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& lastShape();
77 /// \return map of sub-shapes of the result. To be used for History keeping.
78 GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_DataMapOfShapeShape> mapOfShapes() const;
80 /// \return interface for History processing.
81 GEOMALGOAPI_EXPORT std::shared_ptr<GeomAlgoAPI_MakeShape> makeShape() const;
84 /** \brief Constructs infinite face from thePlane, and with axis located on the same side
85 * of the plane as thePoint. Modifies thePlane axis direction.
86 * \param[in,out] thePlane plane to construct face.
87 * \param[in] thePoint point to locate plane axis.
88 * \return constructed face.
90 TopoDS_Face makeFaceFromPlane(gp_Pln& thePlane, const gp_Pnt& thePoint);
92 /// \return solid created from face.
93 TopoDS_Solid makeSolidFromFace(const TopoDS_Face& theFace);
95 /** \brief Selects solid from theShape with closest center of mass to thePoint
96 * \param[in] theShape compound with solids.
97 * \param[in] thePoint point.
100 TopoDS_Shape findClosest(const TopoDS_Shape& theShape, const gp_Pnt& thePoint);
102 /// Builds resulting shape.
103 void build(const std::shared_ptr<GeomAPI_Shape>& theBasis,
104 const std::shared_ptr<GeomAPI_Ax1>& theAxis,
105 const std::shared_ptr<GeomAPI_Shape>& theToShape,
107 const std::shared_ptr<GeomAPI_Shape>& theFromShape,
108 double theFromAngle);
113 std::shared_ptr<GeomAPI_Shape> myShape;
114 std::shared_ptr<GeomAPI_Shape> myFirst;
115 std::shared_ptr<GeomAPI_Shape> myLast;
116 std::shared_ptr<GeomAPI_DataMapOfShapeShape> myMap;
117 std::shared_ptr<GeomAlgoAPI_MakeShape> myMkShape;