1 // Copyright (C) 2014-2022 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef FeaturesPlugin_Revolution_H_
21 #define FeaturesPlugin_Revolution_H_
23 #include "FeaturesPlugin.h"
25 #include "FeaturesPlugin_CompositeSketch.h"
27 #include <GeomAlgoAPI_MakeShape.h>
29 /// \class FeaturesPlugin_Revolution
31 /// \brief Feature for creation of revolution from the planar face.
32 /// Revolution creates the lateral faces based on edges of the base face and
33 /// the start and end faces and/or start and end angles.
34 class FeaturesPlugin_Revolution: public FeaturesPlugin_CompositeSketch
38 inline static const std::string& ID()
40 static const std::string MY_ID("Revolution");
44 /// Attribute name for creation method.
45 inline static const std::string& CREATION_METHOD()
47 static const std::string MY_CREATION_METHOD_ID("CreationMethod");
48 return MY_CREATION_METHOD_ID;
51 /// Attribute name for creation method.
52 inline static const std::string& CREATION_METHOD_THROUGH_ALL()
54 static const std::string MY_CREATION_METHOD_THROUGH_ALL("ThroughAll");
55 return MY_CREATION_METHOD_THROUGH_ALL;
58 /// Attribute name for creation method.
59 inline static const std::string& CREATION_METHOD_BY_ANGLES()
61 static const std::string MY_CREATION_METHOD_BY_ANGLES("ByAngles");
62 return MY_CREATION_METHOD_BY_ANGLES;
65 /// Attribute name for creation method.
66 inline static const std::string& CREATION_METHOD_BY_PLANES()
68 static const std::string MY_CREATION_METHOD_BY_PLANES("ByPlanesAndOffsets");
69 return MY_CREATION_METHOD_BY_PLANES;
72 /// Attribute name of an revolution axis.
73 inline static const std::string& AXIS_OBJECT_ID()
75 static const std::string MY_AXIS_OBJECT_ID("axis_object");
76 return MY_AXIS_OBJECT_ID;
79 /// Attribute name of revolution to angle.
80 inline static const std::string& TO_ANGLE_ID()
82 static const std::string MY_TO_ANGLE_ID("to_angle");
83 return MY_TO_ANGLE_ID;
86 /// Attribute name of revolution from angle.
87 inline static const std::string& FROM_ANGLE_ID()
89 static const std::string MY_FROM_ANGLE_ID("from_angle");
90 return MY_FROM_ANGLE_ID;
93 /// Attribute name of an object to which the revolution grows.
94 inline static const std::string& TO_OBJECT_ID()
96 static const std::string MY_TO_OBJECT_ID("to_object");
97 return MY_TO_OBJECT_ID;
100 /// Attribute name of revolution offset.
101 inline static const std::string& TO_OFFSET_ID()
103 static const std::string MY_TO_OFFSET_ID("to_offset");
104 return MY_TO_OFFSET_ID;
107 /// Attribute name of an object from which the revolution grows.
108 inline static const std::string& FROM_OBJECT_ID()
110 static const std::string MY_FROM_OBJECT_ID("from_object");
111 return MY_FROM_OBJECT_ID;
114 /// Attribute name of revolution offset.
115 inline static const std::string& FROM_OFFSET_ID()
117 static const std::string MY_FROM_OFFSET_ID("from_offset");
118 return MY_FROM_OFFSET_ID;
121 /// \return the kind of a feature.
122 FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
124 static std::string MY_KIND = FeaturesPlugin_Revolution::ID();
128 /// Performs the algorithm and stores results it in the data structure.
129 FEATURESPLUGIN_EXPORT virtual void execute();
131 /// Request for initialization of data model of the feature: adding all attributes.
132 FEATURESPLUGIN_EXPORT virtual void initAttributes();
134 /// Use plugin manager for features creation.
135 FeaturesPlugin_Revolution();
138 /// Generates revolutions.
139 /// \param[out] theBaseShapes list of base shapes.
140 /// \param[out] theMakeShapes list of according algos.
141 /// \return false in case one of algo failed.
142 bool makeRevolutions(ListOfShape& theBaseShapes,
143 ListOfMakeShape& theMakeShapes);