1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef FeaturesPlugin_Revolution_H_
22 #define FeaturesPlugin_Revolution_H_
24 #include "FeaturesPlugin.h"
26 #include "FeaturesPlugin_CompositeSketch.h"
28 #include <GeomAlgoAPI_MakeShape.h>
30 /// \class FeaturesPlugin_Revolution
32 /// \brief Feature for creation of revolution from the planar face.
33 /// Revolution creates the lateral faces based on edges of the base face and
34 /// the start and end faces and/or start and end angles.
35 class FeaturesPlugin_Revolution: public FeaturesPlugin_CompositeSketch
39 inline static const std::string& ID()
41 static const std::string MY_ID("Revolution");
45 /// Attribute name for creation method.
46 inline static const std::string& CREATION_METHOD()
48 static const std::string MY_CREATION_METHOD_ID("CreationMethod");
49 return MY_CREATION_METHOD_ID;
52 /// Attribute name for creation method.
53 inline static const std::string& CREATION_METHOD_BY_ANGLES()
55 static const std::string MY_CREATION_METHOD_ID("ByAngles");
56 return MY_CREATION_METHOD_ID;
59 /// Attribute name for creation method.
60 inline static const std::string& CREATION_METHOD_BY_PLANES()
62 static const std::string MY_CREATION_METHOD_ID("ByPlanesAndOffsets");
63 return MY_CREATION_METHOD_ID;
66 /// Attribute name of an revolution axis.
67 inline static const std::string& AXIS_OBJECT_ID()
69 static const std::string MY_AXIS_OBJECT_ID("axis_object");
70 return MY_AXIS_OBJECT_ID;
73 /// Attribute name of revolution to angle.
74 inline static const std::string& TO_ANGLE_ID()
76 static const std::string MY_TO_ANGLE_ID("to_angle");
77 return MY_TO_ANGLE_ID;
80 /// Attribute name of revolution from angle.
81 inline static const std::string& FROM_ANGLE_ID()
83 static const std::string MY_FROM_ANGLE_ID("from_angle");
84 return MY_FROM_ANGLE_ID;
87 /// Attribute name of an object to which the revolution grows.
88 inline static const std::string& TO_OBJECT_ID()
90 static const std::string MY_TO_OBJECT_ID("to_object");
91 return MY_TO_OBJECT_ID;
94 /// Attribute name of revolution offset.
95 inline static const std::string& TO_OFFSET_ID()
97 static const std::string MY_TO_OFFSET_ID("to_offset");
98 return MY_TO_OFFSET_ID;
101 /// Attribute name of an object from which the revolution grows.
102 inline static const std::string& FROM_OBJECT_ID()
104 static const std::string MY_FROM_OBJECT_ID("from_object");
105 return MY_FROM_OBJECT_ID;
108 /// Attribute name of revolution offset.
109 inline static const std::string& FROM_OFFSET_ID()
111 static const std::string MY_FROM_OFFSET_ID("from_offset");
112 return MY_FROM_OFFSET_ID;
115 /// \return the kind of a feature.
116 FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
118 static std::string MY_KIND = FeaturesPlugin_Revolution::ID();
122 /// Creates a new part document if needed.
123 FEATURESPLUGIN_EXPORT virtual void execute();
125 /// Request for initialization of data model of the feature: adding all attributes.
126 FEATURESPLUGIN_EXPORT virtual void initAttributes();
128 /// Use plugin manager for features creation.
129 FeaturesPlugin_Revolution();
132 /// Generates revolutions.
133 /// \param[out] theBaseShapes list of base shapes.
134 /// \param[out] theMakeShapes list of according algos.
135 /// \return false in case one of algo failed.
136 bool makeRevolutions(ListOfShape& theBaseShapes,
137 ListOfMakeShape& theMakeShapes);