X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FFeaturesPlugin_Revolution.h;h=d9c2b99101c7237fe72888edb0c0d155da52de9e;hb=1dfcab3d738e427bea678317e167c587dfbff195;hp=ffb7ae2a545479a88fe16964276d156d2134df75;hpb=64e9d01b48f8c4e6e22919ebceeed715d613485e;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_Revolution.h b/src/FeaturesPlugin/FeaturesPlugin_Revolution.h index ffb7ae2a5..d9c2b9910 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Revolution.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Revolution.h @@ -1,59 +1,89 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: FeaturesPlugin_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 FeaturesPlugin_Revolution_H_ #define FeaturesPlugin_Revolution_H_ -#include +#include "FeaturesPlugin.h" -#include -#include +#include "FeaturesPlugin_CompositeSketch.h" -class GeomAPI_Shape; -class ModelAPI_ResultBody; +#include -/** \class FeaturesPlugin_Revolution - * \ingroup Plugins - * \brief Feature for creation of revolution from the planar face. - * Revolution creates the lateral faces based on edges of the base face and - * the start and end faces and/or start and end angles. - */ -class FeaturesPlugin_Revolution : public ModelAPI_Feature +/// \class FeaturesPlugin_Revolution +/// \ingroup Plugins +/// \brief Feature for creation of revolution from the planar face. +/// Revolution creates the lateral faces based on edges of the base face and +/// the start and end faces and/or start and end angles. +class FeaturesPlugin_Revolution: public FeaturesPlugin_CompositeSketch { - public: - /// Revolution kind. +public: + /// Feature kind. inline static const std::string& ID() { - static const std::string MY_REVOLUTION_ID("Revolution"); - return MY_REVOLUTION_ID; + static const std::string MY_ID("Revolution"); + return MY_ID; } - /// Attribute name of references sketch entities list, it should contain a sketch result or - /// a pair a sketch result to sketch face. - inline static const std::string& LIST_ID() + /// Attribute name for creation method. + inline static const std::string& CREATION_METHOD() { - static const std::string MY_GROUP_LIST_ID("base"); - return MY_GROUP_LIST_ID; + static const std::string MY_CREATION_METHOD_ID("CreationMethod"); + return MY_CREATION_METHOD_ID; } - /// Attribute name of an object to which the extrusion grows. + /// Attribute name for creation method. + inline static const std::string& CREATION_METHOD_THROUGH_ALL() + { + static const std::string MY_CREATION_METHOD_ID("ThroughAll"); + return MY_CREATION_METHOD_ID; + } + + /// Attribute name for creation method. + inline static const std::string& CREATION_METHOD_BY_ANGLES() + { + static const std::string MY_CREATION_METHOD_ID("ByAngles"); + return MY_CREATION_METHOD_ID; + } + + /// Attribute name for creation method. + inline static const std::string& CREATION_METHOD_BY_PLANES() + { + static const std::string MY_CREATION_METHOD_ID("ByPlanesAndOffsets"); + return MY_CREATION_METHOD_ID; + } + + /// Attribute name of an revolution axis. inline static const std::string& AXIS_OBJECT_ID() { - static const std::string MY_TO_OBJECT_ID("axis_object"); - return MY_TO_OBJECT_ID; + static const std::string MY_AXIS_OBJECT_ID("axis_object"); + return MY_AXIS_OBJECT_ID; } - /// Attribute name of revolution angle. + /// Attribute name of revolution to angle. inline static const std::string& TO_ANGLE_ID() { static const std::string MY_TO_ANGLE_ID("to_angle"); return MY_TO_ANGLE_ID; } - /// Attribute name of revolution angle. + /// Attribute name of revolution from angle. inline static const std::string& FROM_ANGLE_ID() { static const std::string MY_FROM_ANGLE_ID("from_angle"); @@ -67,13 +97,27 @@ class FeaturesPlugin_Revolution : public ModelAPI_Feature return MY_TO_OBJECT_ID; } - /// Attribute name of tool object. + /// Attribute name of revolution offset. + inline static const std::string& TO_OFFSET_ID() + { + static const std::string MY_TO_OFFSET_ID("to_offset"); + return MY_TO_OFFSET_ID; + } + + /// Attribute name of an object from which the revolution grows. inline static const std::string& FROM_OBJECT_ID() { static const std::string MY_FROM_OBJECT_ID("from_object"); return MY_FROM_OBJECT_ID; } + /// Attribute name of revolution offset. + inline static const std::string& FROM_OFFSET_ID() + { + static const std::string MY_FROM_OFFSET_ID("from_offset"); + return MY_FROM_OFFSET_ID; + } + /// \return the kind of a feature. FEATURESPLUGIN_EXPORT virtual const std::string& getKind() { @@ -81,7 +125,7 @@ class FeaturesPlugin_Revolution : public ModelAPI_Feature return MY_KIND; } - /// Creates a new part document if needed. + /// Performs the algorithm and stores results it in the data structure. FEATURESPLUGIN_EXPORT virtual void execute(); /// Request for initialization of data model of the feature: adding all attributes. @@ -90,11 +134,13 @@ class FeaturesPlugin_Revolution : public ModelAPI_Feature /// Use plugin manager for features creation. FeaturesPlugin_Revolution(); -private: - /// Load Naming data structure of the feature to the document. - void LoadNamingDS(GeomAlgoAPI_Revolution& theFeature, std::shared_ptr theResultBody, - std::shared_ptr theBasis, - std::shared_ptr theContext); + protected: + /// Generates revolutions. + /// \param[out] theBaseShapes list of base shapes. + /// \param[out] theMakeShapes list of according algos. + /// \return false in case one of algo failed. + bool makeRevolutions(ListOfShape& theBaseShapes, + ListOfMakeShape& theMakeShapes); }; #endif