Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Revolution.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef FeaturesPlugin_Revolution_H_
22 #define FeaturesPlugin_Revolution_H_
23
24 #include "FeaturesPlugin.h"
25
26 #include "FeaturesPlugin_CompositeSketch.h"
27
28 #include <GeomAlgoAPI_MakeShape.h>
29
30 /// \class FeaturesPlugin_Revolution
31 /// \ingroup Plugins
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
36 {
37 public:
38   /// Feature kind.
39   inline static const std::string& ID()
40   {
41     static const std::string MY_ID("Revolution");
42     return MY_ID;
43   }
44
45   /// Attribute name for creation method.
46   inline static const std::string& CREATION_METHOD()
47   {
48     static const std::string MY_CREATION_METHOD_ID("CreationMethod");
49     return MY_CREATION_METHOD_ID;
50   }
51
52   /// Attribute name for creation method.
53   inline static const std::string& CREATION_METHOD_BY_ANGLES()
54   {
55     static const std::string MY_CREATION_METHOD_ID("ByAngles");
56     return MY_CREATION_METHOD_ID;
57   }
58
59   /// Attribute name for creation method.
60   inline static const std::string& CREATION_METHOD_BY_PLANES()
61   {
62     static const std::string MY_CREATION_METHOD_ID("ByPlanesAndOffsets");
63     return MY_CREATION_METHOD_ID;
64   }
65
66   /// Attribute name of an revolution axis.
67   inline static const std::string& AXIS_OBJECT_ID()
68   {
69     static const std::string MY_AXIS_OBJECT_ID("axis_object");
70     return MY_AXIS_OBJECT_ID;
71   }
72
73   /// Attribute name of revolution to angle.
74   inline static const std::string& TO_ANGLE_ID()
75   {
76     static const std::string MY_TO_ANGLE_ID("to_angle");
77     return MY_TO_ANGLE_ID;
78   }
79
80   /// Attribute name of revolution from angle.
81   inline static const std::string& FROM_ANGLE_ID()
82   {
83     static const std::string MY_FROM_ANGLE_ID("from_angle");
84     return MY_FROM_ANGLE_ID;
85   }
86
87   /// Attribute name of an object to which the revolution grows.
88   inline static const std::string& TO_OBJECT_ID()
89   {
90     static const std::string MY_TO_OBJECT_ID("to_object");
91     return MY_TO_OBJECT_ID;
92   }
93
94   /// Attribute name of revolution offset.
95   inline static const std::string& TO_OFFSET_ID()
96   {
97     static const std::string MY_TO_OFFSET_ID("to_offset");
98     return MY_TO_OFFSET_ID;
99   }
100
101   /// Attribute name of an object from which the revolution grows.
102   inline static const std::string& FROM_OBJECT_ID()
103   {
104     static const std::string MY_FROM_OBJECT_ID("from_object");
105     return MY_FROM_OBJECT_ID;
106   }
107
108   /// Attribute name of revolution offset.
109   inline static const std::string& FROM_OFFSET_ID()
110   {
111     static const std::string MY_FROM_OFFSET_ID("from_offset");
112     return MY_FROM_OFFSET_ID;
113   }
114
115   /// \return the kind of a feature.
116   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
117   {
118     static std::string MY_KIND = FeaturesPlugin_Revolution::ID();
119     return MY_KIND;
120   }
121
122   /// Creates a new part document if needed.
123   FEATURESPLUGIN_EXPORT virtual void execute();
124
125   /// Request for initialization of data model of the feature: adding all attributes.
126   FEATURESPLUGIN_EXPORT virtual void initAttributes();
127
128   /// Use plugin manager for features creation.
129   FeaturesPlugin_Revolution();
130
131   protected:
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);
138 };
139
140 #endif