Salome HOME
Merge branch 'master' into cgt/devCEA
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Revolution.h
index 0bb2ddfa589d688260bb93816f7b448a59e6e1f2..b429437c1a119bdb61794fc269e9d2ff3cdab8be 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] theBaseShape face for revolution.
-   *  \param[in] theAxis axis for revolution.
-   *  \param[in] theToAngle to angle.
-   *  \param[in] theFromAngle from angle.
-   */
-  GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(std::shared_ptr<GeomAPI_Shape> theBaseShape,
-                                            std::shared_ptr<GeomAPI_Ax1>   theAxis,
-                                            double                         theToAngle,
-                                            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(std::shared_ptr<GeomAPI_Shape> theBaseShape,
-                                            std::shared_ptr<GeomAPI_Ax1>   theAxis,
-                                            std::shared_ptr<GeomAPI_Shape> theToShape,
-                                            double                         theToAngle,
-                                            std::shared_ptr<GeomAPI_Shape> theFromShape,
-                                            double                         theFromAngle);
-
-  /// \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;
-
-  /// \returns the list of from faces.
-  GEOMALGOAPI_EXPORT const ListOfShape& fromFaces() const;
-
-  /// \return the list of to faces.
-  GEOMALGOAPI_EXPORT const ListOfShape& toFaces() const;
-  /// \return map of sub-shapes of the result. To be used for History keeping.
-  GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_DataMapOfShapeShape> mapOfShapes() const;
-
-  /// \return interface for History processing.
-  GEOMALGOAPI_EXPORT std::shared_ptr<GeomAlgoAPI_MakeShape> makeShape() const;
+  /// \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 or shell.
-  TopoDS_Solid makeSolidFromShape(const TopoDS_Shape& theShape);
-
-  /** \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>& theBaseShape,
-             const std::shared_ptr<GeomAPI_Ax1>&   theAxis,
-             const std::shared_ptr<GeomAPI_Shape>& theToShape,
-             double                                theToAngle,
-             const std::shared_ptr<GeomAPI_Shape>& theFromShape,
-             double                                theFromAngle);
-
-private:
-  /// Fields.
-  bool myDone;
-  std::shared_ptr<GeomAPI_Shape> myShape;
-  ListOfShape myFromFaces;
-  ListOfShape myToFaces;
-  std::shared_ptr<GeomAPI_DataMapOfShapeShape> myMap;
-  std::shared_ptr<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