Salome HOME
b947db43b7d612531460a38342852f22d0ce6d19
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_Revolution.h
1 // Copyright (C) 2014-2020  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 email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef FeaturesAPI_Revolution_H_
21 #define FeaturesAPI_Revolution_H_
22
23 #include "FeaturesAPI.h"
24
25 #include <FeaturesPlugin_Revolution.h>
26
27 #include <ModelHighAPI_Interface.h>
28 #include <ModelHighAPI_Macro.h>
29
30 class ModelHighAPI_Double;
31 class ModelHighAPI_Reference;
32 class ModelHighAPI_Selection;
33
34 /// \class FeaturesAPI_Revolution
35 /// \ingroup CPPHighAPI
36 /// \brief Interface for Revolution feature.
37 class FeaturesAPI_Revolution: public ModelHighAPI_Interface
38 {
39 public:
40   /// Constructor without values.
41   FEATURESAPI_EXPORT
42   explicit FeaturesAPI_Revolution(const std::shared_ptr<ModelAPI_Feature>& theFeature);
43
44   /// Constructor with values.
45   FEATURESAPI_EXPORT
46   explicit FeaturesAPI_Revolution(const std::shared_ptr<ModelAPI_Feature>& theFeature,
47                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
48                                   const ModelHighAPI_Selection& theAxis,
49                                   const ModelHighAPI_Double& theAngle);
50
51   /// Constructor with values.
52   FEATURESAPI_EXPORT
53   explicit FeaturesAPI_Revolution(const std::shared_ptr<ModelAPI_Feature>& theFeature,
54                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
55                                   const ModelHighAPI_Selection& theAxis,
56                                   const ModelHighAPI_Double& theToAngle,
57                                   const ModelHighAPI_Double& theFromAngle);
58
59   /// Constructor with values.
60   FEATURESAPI_EXPORT
61   explicit FeaturesAPI_Revolution(const std::shared_ptr<ModelAPI_Feature>& theFeature,
62                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
63                                   const ModelHighAPI_Selection& theAxis,
64                                   const ModelHighAPI_Selection& theToObject,
65                                   const ModelHighAPI_Double& theToOffset,
66                                   const ModelHighAPI_Selection& theFromObject,
67                                   const ModelHighAPI_Double& theFromOffset);
68
69   /// Destructor.
70   FEATURESAPI_EXPORT
71   virtual ~FeaturesAPI_Revolution();
72
73   INTERFACE_10(FeaturesPlugin_Revolution::ID(),
74                sketch, FeaturesPlugin_Revolution::SKETCH_ID(),
75                ModelAPI_AttributeReference, /** Sketch launcher */,
76                baseObjects, FeaturesPlugin_Revolution::BASE_OBJECTS_ID(),
77                ModelAPI_AttributeSelectionList, /** Base objects */,
78                axis, FeaturesPlugin_Revolution::AXIS_OBJECT_ID(),
79                ModelAPI_AttributeSelection, /** Axis */,
80                creationMethod, FeaturesPlugin_Revolution::CREATION_METHOD(),
81                ModelAPI_AttributeString, /** Creation method */,
82                toAngle, FeaturesPlugin_Revolution::TO_ANGLE_ID(),
83                ModelAPI_AttributeDouble, /** To angle */,
84                fromAngle, FeaturesPlugin_Revolution::FROM_ANGLE_ID(),
85                ModelAPI_AttributeDouble, /** From angle */,
86                toObject, FeaturesPlugin_Revolution::TO_OBJECT_ID(),
87                ModelAPI_AttributeSelection, /** To object */,
88                toOffset, FeaturesPlugin_Revolution::TO_OFFSET_ID(),
89                ModelAPI_AttributeDouble, /** To offset */,
90                fromObject, FeaturesPlugin_Revolution::FROM_OBJECT_ID(),
91                ModelAPI_AttributeSelection, /** From object */,
92                fromOffset, FeaturesPlugin_Revolution::FROM_OFFSET_ID(),
93                ModelAPI_AttributeDouble, /** From offset */)
94
95   /// Modify base attribute of the feature.
96   FEATURESAPI_EXPORT
97   void setNestedSketch(const ModelHighAPI_Reference& theSketch);
98
99   /// Modify base attribute of the feature.
100   FEATURESAPI_EXPORT
101   void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
102
103   /// Modify axis_object attribute of the feature.
104   FEATURESAPI_EXPORT
105   void setAxis(const ModelHighAPI_Selection& theAxis);
106
107   /// Modify CreationMethod, to_angle, from_angle attributes of the feature.
108   FEATURESAPI_EXPORT
109   void setAngles(const ModelHighAPI_Double& theToAngle,
110                  const ModelHighAPI_Double& theFromAngle);
111
112   /// Modify CreationMethod, to_angle, from_angle attributes of the feature.
113   FEATURESAPI_EXPORT
114   void setAngle(const ModelHighAPI_Double& theAngle);
115
116   /// Modify CreationMethod, to_object, to_offset,
117   /// from_object, from_offset attributes of the feature.
118   FEATURESAPI_EXPORT
119   void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
120                            const ModelHighAPI_Double& theToOffset,
121                            const ModelHighAPI_Selection& theFromObject,
122                            const ModelHighAPI_Double& theFromOffset);
123
124   /// Dump wrapped feature
125   FEATURESAPI_EXPORT
126   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
127
128 private:
129   void execIfBaseNotEmpty();
130 };
131
132 /// Pointer on Revolution object.
133 typedef std::shared_ptr<FeaturesAPI_Revolution> RevolutionPtr;
134
135 /// \ingroup CPPHighAPI
136 /// \brief Create Revolution feature.
137 FEATURESAPI_EXPORT
138 RevolutionPtr addRevolution(const std::shared_ptr<ModelAPI_Document>& thePart,
139                             const std::list<ModelHighAPI_Selection>& theBaseObjects,
140                             const ModelHighAPI_Selection& theAxis,
141                             const ModelHighAPI_Double& theAngle);
142
143 /// \ingroup CPPHighAPI
144 /// \brief Create Revolution feature.
145 FEATURESAPI_EXPORT
146 RevolutionPtr addRevolution(const std::shared_ptr<ModelAPI_Document>& thePart,
147                             const std::list<ModelHighAPI_Selection>& theBaseObjects,
148                             const ModelHighAPI_Selection& theAxis,
149                             const ModelHighAPI_Double& theToAngle,
150                             const ModelHighAPI_Double& theFromAngle);
151
152 /// \ingroup CPPHighAPI
153 /// \brief Create Revolution feature.
154 FEATURESAPI_EXPORT
155 RevolutionPtr addRevolution(const std::shared_ptr<ModelAPI_Document>& thePart,
156                             const std::list<ModelHighAPI_Selection>& theBaseObjects,
157                             const ModelHighAPI_Selection& theAxis,
158                             const ModelHighAPI_Selection& theToObject,
159                             const ModelHighAPI_Double& theToOffset,
160                             const ModelHighAPI_Selection& theFromObject,
161                             const ModelHighAPI_Double& theFromOffset);
162
163 #endif // FeaturesAPI_Revolution_H_