Salome HOME
Issue #1343 validators update
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Revolution.h
index a6df8b5aaccc023c3b7b4042505079676e539909..6a75f2e21beed0bac42c9790ecd76f905f16b71a 100644 (file)
 #ifndef GeomAlgoAPI_Revolution_H_
 #define GeomAlgoAPI_Revolution_H_
 
-#include <GeomAlgoAPI.h>
-#include <GeomAlgoAPI_MakeShape.h>
-#include <GeomAPI_Ax1.h>
-#include <GeomAPI_DataMapOfShapeShape.h>
+#include "GeomAlgoAPI.h"
+
+#include "GeomAlgoAPI_MakeSweep.h"
 
-class gp_Pln;
-class gp_Pnt;
-class TopoDS_Face;
-class TopoDS_Shape;
-class TopoDS_Solid;
+#include <GeomAPI_Ax1.h>
 
-/** \class GeomAlgoAPI_Revolution
- *  \ingroup DataAlgo
- *  \brief Allows to create the revolution based on a given face, angles and bounding planes.
- *  \n Note that only the planar faces are allowed as bounding faces and resulting
- *  revolution will be bounded by the infinite planes taken from the faces.
- *  \n If the bounding plane was specified with the angle then this plane will be rotated around
- *  the axis to the value of the angle.
- *  \n Note that algorithm return only one solid object. So in case when after cutting with bounding
- *  planes algorithm got more than one solid it will return the closest to the center of mass of
- *  the base face.
- */
-class GeomAlgoAPI_Revolution : public GeomAPI_Interface
+/// \class GeomAlgoAPI_Revolution
+/// \ingroup DataAlgo
+/// \brief Allows to create the revolution based on a given face, angles and bounding planes.
+/// \n Note that only the planar faces are allowed as bounding faces and resulting
+/// revolution will be bounded by the infinite planes taken from the faces.
+/// \n If the bounding plane was specified with the angle then this plane will be rotated around
+/// the axis to the value of the angle.
+/// \n Note that algorithm return only one solid object. So in case when after cutting with bounding
+/// planes algorithm got more than one solid it will return the closest to the center of mass of
+/// the base face.
+class GeomAlgoAPI_Revolution : public GeomAlgoAPI_MakeSweep
 {
 public:
-  /** \brief Creates revolution for the given shape
-   *  \param[in] theBasis face for revolution
-   *  \param[in] theFromShape from bounding shape
-   *  \param[in] theFromAngle from angle
-   *  \param[in] theToShape to bounding shape
-   *  \param[in] theToAngle to angle
-   *  \return a solid which is obtained from specified one
-   */
-  GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(std::shared_ptr<GeomAPI_Shape> theBasis,
-                                            std::shared_ptr<GeomAPI_Ax1>   theAxis,
-                                            std::shared_ptr<GeomAPI_Shape> theFromShape,
-                                            double                         theFromAngle,
-                                            std::shared_ptr<GeomAPI_Shape> theToShape,
-                                            double                         theToAngle);
-
-  /// \return true if algorithm succeed.
-  GEOMALGOAPI_EXPORT const bool isDone() const;
-
-  /// \return true if resulting shape is valid.
-  GEOMALGOAPI_EXPORT const bool isValid() const;
-
-  /// \return true if resulting shape has volume.
-  GEOMALGOAPI_EXPORT const bool hasVolume() const;
-
-  /// \return result of the Revolution algorithm.
-  GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& shape() const;
-
-  /// \return the first shape.
-  GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& firstShape();
-
-  /// \return the last shape.
-  GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& lastShape();
-  /// \return map of sub-shapes of the result. To be used for History keeping.
-  GEOMALGOAPI_EXPORT void mapOfShapes(GeomAPI_DataMapOfShapeShape& theMap) const;
-
-  /// \return interface for History processing.
-  GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape* makeShape() const;
-
-  /// Destructor.
-  GEOMALGOAPI_EXPORT ~GeomAlgoAPI_Revolution();
+  /// \brief Creates revolution for the given shape.
+  /// \param[in] theBaseShape face for revolution.
+  /// \param[in] theAxis axis for revolution.
+  /// \param[in] theToAngle to angle.
+  /// \param[in] theFromAngle from angle.
+  GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(const GeomShapePtr                 theBaseShape,
+                                            const std::shared_ptr<GeomAPI_Ax1> theAxis,
+                                            const double                       theToAngle,
+                                            const double                       theFromAngle);
+
+  /// \brief Creates revolution for the given shape.
+  /// \param[in] theBaseShape face for revolution.
+  /// \param[in] theAxis axis for revolution.
+  /// \param[in] theToShape to bounding shape. Can be empty. In this case offset will be applied to the basis.
+  /// \param[in] theToAngle to angle.
+  /// \param[in] theFromShape from bounding shape. Can be empty. In this case offset will be applied to the basis.
+  /// \param[in] theFromAngle from angle.
+  GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(const GeomShapePtr                 theBaseShape,
+                                            const std::shared_ptr<GeomAPI_Ax1> theAxis,
+                                            const GeomShapePtr                 theToShape,
+                                            const double                       theToAngle,
+                                            const GeomShapePtr                 theFromShape,
+                                            const double                       theFromAngle);
 
 private:
-  /** \brief Constructs infinite face from thePlane, and with axis located on the same side
-   *  of the plane as thePoint. Modifies thePlane axis direction.
-   *  \param[in,out] thePlane plane to construct face.
-   *  \param[in] thePoint point to locate plane axis.
-   *  \return constructed face.
-   */
-  TopoDS_Face makeFaceFromPlane(gp_Pln& thePlane, const gp_Pnt& thePoint);
-
-  /// \return solid created from face.
-  TopoDS_Solid makeSolidFromFace(const TopoDS_Face& theFace);
-
-  /** \brief Selects solid from theShape with closest center of mass to thePoint
-   *  \param[in] theShape compound with solids.
-   *  \param[in] thePoint point.
-   *  \return solid.
-   */
-  TopoDS_Shape findClosest(const TopoDS_Shape& theShape, const gp_Pnt& thePoint);
-
   /// Builds resulting shape.
-  void build(const std::shared_ptr<GeomAPI_Shape>& theBasis);
-
-private:
-  /// Fields.
-  std::shared_ptr<GeomAPI_Ax1>   myAxis;
-  std::shared_ptr<GeomAPI_Shape> myFromShape;
-  double myFromAngle;
-  std::shared_ptr<GeomAPI_Shape> myToShape;
-  double myToAngle;
-  bool myDone;
-  std::shared_ptr<GeomAPI_Shape> myShape;
-  std::shared_ptr<GeomAPI_Shape> myFirst;
-  std::shared_ptr<GeomAPI_Shape> myLast;
-  GeomAPI_DataMapOfShapeShape myMap;
-  GeomAlgoAPI_MakeShape* myMkShape;
+  void build(const GeomShapePtr&                 theBaseShape,
+             const std::shared_ptr<GeomAPI_Ax1>& theAxis,
+             const GeomShapePtr&                 theToShape,
+             const double                        theToAngle,
+             const GeomShapePtr&                 theFromShape,
+             const double                        theFromAngle);
 };
 
 #endif
\ No newline at end of file