X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_Revolution.h;h=b429437c1a119bdb61794fc269e9d2ff3cdab8be;hb=5b6031b015602aa07f5a6fc668c13ac3faf7a8a9;hp=a10b093b05f485a2dd36285423150193fe19fa9c;hpb=8030eb14e6863867336c9d09653db64c1c5a4db8;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h b/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h index a10b093b0..b429437c1 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h @@ -7,114 +7,59 @@ #ifndef GeomAlgoAPI_Revolution_H_ #define GeomAlgoAPI_Revolution_H_ -#include -#include -#include -#include +#include "GeomAlgoAPI.h" + +#include "GeomAlgoAPI_MakeSweep.h" -class gp_Pln; -class gp_Pnt; -class TopoDS_Face; -class TopoDS_Shape; -class TopoDS_Solid; +#include -/** \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] theFromAngle from angle. - * \param[in] theToAngle to angle. - */ - GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(std::shared_ptr theBasis, - std::shared_ptr theAxis, - double theFromAngle, - double theToAngle); - - /** \brief Creates revolution for the given shape. - * \param[in] theBasis face for revolution. - * \param[in] theFromShape from bounding shape. Can be empty. In this case offset will be applied to the basis. - * \param[in] theFromAngle from angle. - * \param[in] theToShape to bounding shape. Can be empty. In this case offset will be applied to the basis. - * \param[in] theToAngle to angle. - */ - GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(std::shared_ptr theBasis, - std::shared_ptr theAxis, - std::shared_ptr theFromShape, - double theFromAngle, - std::shared_ptr 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& shape() const; - - /// \return the first shape. - GEOMALGOAPI_EXPORT const std::shared_ptr& firstShape(); - - /// \return the last shape. - GEOMALGOAPI_EXPORT const std::shared_ptr& lastShape(); - - /// \return map of sub-shapes of the result. To be used for History keeping. - GEOMALGOAPI_EXPORT std::shared_ptr mapOfShapes() const; - - /// \return interface for History processing. - GEOMALGOAPI_EXPORT std::shared_ptr 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 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 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& theBasis, - const std::shared_ptr& theAxis, - const std::shared_ptr& theFromShape, - double theFromAngle, - const std::shared_ptr& theToShape, - double theToAngle); - -private: - /// Fields. - bool myDone; - std::shared_ptr myShape; - std::shared_ptr myFirst; - std::shared_ptr myLast; - std::shared_ptr myMap; - std::shared_ptr myMkShape; + void build(const GeomShapePtr& theBaseShape, + const std::shared_ptr& theAxis, + const GeomShapePtr& theToShape, + const double theToAngle, + const GeomShapePtr& theFromShape, + const double theFromAngle); }; #endif \ No newline at end of file