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