X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_Revolution.h;h=436bb0f7f842414d6722aa2e153e951cacb12339;hb=fdd802da7683f66ca609cf12b1e11be9642149d6;hp=a6df8b5aaccc023c3b7b4042505079676e539909;hpb=64e9d01b48f8c4e6e22919ebceeed715d613485e;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h b/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h index a6df8b5aa..436bb0f7f 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h @@ -1,114 +1,68 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: GeomAlgoAPI_Revolution.h -// Created: 12 May 2015 -// Author: Dmitry Bobylev +// Copyright (C) 2014-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// #ifndef GeomAlgoAPI_Revolution_H_ #define GeomAlgoAPI_Revolution_H_ -#include -#include -#include -#include +#include "GeomAlgoAPI.h" -class gp_Pln; -class gp_Pnt; -class TopoDS_Face; -class TopoDS_Shape; -class TopoDS_Solid; +#include "GeomAlgoAPI_MakeSweep.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 +#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 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 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 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] 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); - -private: - /// Fields. - std::shared_ptr myAxis; - std::shared_ptr myFromShape; - double myFromAngle; - std::shared_ptr myToShape; - double myToAngle; - bool myDone; - std::shared_ptr myShape; - std::shared_ptr myFirst; - std::shared_ptr myLast; - GeomAPI_DataMapOfShapeShape myMap; - GeomAlgoAPI_MakeShape* 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