Salome HOME
e0847dec241a408a9f47f3ddc06e1cf5aacd47b3
[modules/shaper.git] / src / ConstructionAPI / ConstructionAPI_Plane.h
1 // Copyright (C) 2014-2023  CEA, EDF
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 SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_PLANE_H_
21 #define SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_PLANE_H_
22
23 #include "ConstructionAPI.h"
24
25 #include <ConstructionPlugin_Plane.h>
26
27 #include <ModelHighAPI_Interface.h>
28 #include <ModelHighAPI_Macro.h>
29 #include <ModelHighAPI_Integer.h>
30
31 class ModelHighAPI_Double;
32 class ModelHighAPI_Selection;
33
34 /// \class ConstructionAPI_Plane
35 /// \ingroup CPPHighAPI
36 /// \brief Interface for Plane feature
37 class ConstructionAPI_Plane: public ModelHighAPI_Interface
38 {
39 public:
40   /// Constructor without values
41   CONSTRUCTIONAPI_EXPORT
42   explicit ConstructionAPI_Plane(const std::shared_ptr<ModelAPI_Feature>& theFeature);
43
44   /// Constructor with values
45   CONSTRUCTIONAPI_EXPORT
46   ConstructionAPI_Plane(const std::shared_ptr<ModelAPI_Feature>& theFeature,
47                         const ModelHighAPI_Selection& theFace,
48                         const ModelHighAPI_Double& theDistance,
49                         const bool theIsReverse,
50                         const ModelHighAPI_Integer& theNbCopy = ModelHighAPI_Integer(1));
51
52   /// Constructor with values
53   CONSTRUCTIONAPI_EXPORT
54   ConstructionAPI_Plane(const std::shared_ptr<ModelAPI_Feature>& theFeature,
55                         const ModelHighAPI_Double& theA,
56                         const ModelHighAPI_Double& theB,
57                         const ModelHighAPI_Double& theC,
58                         const ModelHighAPI_Double& theD);
59
60   /// Constructor with values
61   CONSTRUCTIONAPI_EXPORT
62   ConstructionAPI_Plane(const std::shared_ptr<ModelAPI_Feature>& theFeature,
63                         const ModelHighAPI_Selection& thePoint1,
64                         const ModelHighAPI_Selection& thePoint2,
65                         const ModelHighAPI_Selection& thePoint3);
66
67   /// Constructor with values
68   CONSTRUCTIONAPI_EXPORT
69   ConstructionAPI_Plane(const std::shared_ptr<ModelAPI_Feature>& theFeature,
70                         const ModelHighAPI_Selection& theLine,
71                         const ModelHighAPI_Selection& thePoint,
72                         const bool theIsPerpendicular);
73
74   /// Constructor with values
75   CONSTRUCTIONAPI_EXPORT
76   ConstructionAPI_Plane(const std::shared_ptr<ModelAPI_Feature>& theFeature,
77                         const ModelHighAPI_Selection& theObject1,
78                         const ModelHighAPI_Selection& theObject2);
79
80   /// Constructor with values
81   CONSTRUCTIONAPI_EXPORT
82   ConstructionAPI_Plane(const std::shared_ptr<ModelAPI_Feature>& theFeature,
83                         const ModelHighAPI_Selection& thePlane,
84                         const ModelHighAPI_Selection& theAxis,
85                         const ModelHighAPI_Double& theAngle,
86                         const ModelHighAPI_Integer& theNbCopy = ModelHighAPI_Integer(1));
87
88   /// Destructor
89   CONSTRUCTIONAPI_EXPORT
90   virtual ~ConstructionAPI_Plane();
91
92   INTERFACE_21(ConstructionPlugin_Plane::ID(),
93                creationMethod, ConstructionPlugin_Plane::CREATION_METHOD(),
94                ModelAPI_AttributeString, /** Creation method */,
95                A, ConstructionPlugin_Plane::A(),
96                ModelAPI_AttributeDouble, /** Parameter A for general equation */,
97                B, ConstructionPlugin_Plane::B(),
98                ModelAPI_AttributeDouble, /** Parameter B for general equation */,
99                C, ConstructionPlugin_Plane::C(),
100                ModelAPI_AttributeDouble, /** Parameter C for general equation */,
101                D, ConstructionPlugin_Plane::D(),
102                ModelAPI_AttributeDouble, /** Parameter D for general equation */,
103                point1, ConstructionPlugin_Plane::POINT1(),
104                ModelAPI_AttributeSelection, /** Point 1 for plane */,
105                point2, ConstructionPlugin_Plane::POINT2(),
106                ModelAPI_AttributeSelection, /** Point 2 for plane */,
107                point3, ConstructionPlugin_Plane::POINT3(),
108                ModelAPI_AttributeSelection, /** Point 3 for plane */,
109                line, ConstructionPlugin_Plane::LINE(),
110                ModelAPI_AttributeSelection, /** Line for plane */,
111                point, ConstructionPlugin_Plane::POINT(),
112                ModelAPI_AttributeSelection, /** Point for plane */,
113                perpendicular, ConstructionPlugin_Plane::PERPENDICULAR(),
114                ModelAPI_AttributeBoolean, /** Perpendicular flag */,
115                creationMethodByOtherPlane,
116                ConstructionPlugin_Plane::CREATION_METHOD_BY_OTHER_PLANE_OPTION(),
117                ModelAPI_AttributeString, /** Creation method  by other plane*/,
118                plane, ConstructionPlugin_Plane::PLANE(),
119                ModelAPI_AttributeSelection, /** Plane face */,
120                distance, ConstructionPlugin_Plane::DISTANCE(),
121                ModelAPI_AttributeDouble, /** Distance */,
122                reverse, ConstructionPlugin_Plane::REVERSE(),
123                ModelAPI_AttributeBoolean, /** Reverse flag */,
124                coincidentPoint, ConstructionPlugin_Plane::COINCIDENT_POINT(),
125                ModelAPI_AttributeSelection, /** Coincident point */,
126                axis, ConstructionPlugin_Plane::AXIS(),
127                ModelAPI_AttributeSelection, /** Axis for rotation */,
128                angle, ConstructionPlugin_Plane::ANGLE(),
129                ModelAPI_AttributeDouble, /** Rotation angle */,
130                plane1, ConstructionPlugin_Plane::PLANE1(),
131                ModelAPI_AttributeSelection, /** Plane 1 */,
132                plane2, ConstructionPlugin_Plane::PLANE2(),
133                ModelAPI_AttributeSelection, /** Plane 2 */,
134                nbcopy, ConstructionPlugin_Plane::NB_COPIES(),
135                ModelAPI_AttributeInteger, /** Number of copies */)
136
137   /// Set face and distance
138   CONSTRUCTIONAPI_EXPORT
139   void setByFaceAndDistance(const ModelHighAPI_Selection& theFace,
140                             const ModelHighAPI_Double& theDistance,
141                             const bool theIsReverse,
142                             const ModelHighAPI_Integer& theNbCopy = ModelHighAPI_Integer(1));
143
144   /// Set GeneralEquation parameters of the feature
145   CONSTRUCTIONAPI_EXPORT
146   void setByGeneralEquation(const ModelHighAPI_Double& theA,
147                             const ModelHighAPI_Double& theB,
148                             const ModelHighAPI_Double& theC,
149                             const ModelHighAPI_Double& theD);
150
151   /// Set by three points.
152   CONSTRUCTIONAPI_EXPORT
153   void setByThreePoints(const ModelHighAPI_Selection& thePoint1,
154                         const ModelHighAPI_Selection& thePoint2,
155                         const ModelHighAPI_Selection& thePoint3);
156
157   /// Set by line and point.
158   CONSTRUCTIONAPI_EXPORT
159   void setByLineAndPoint(const ModelHighAPI_Selection& theLine,
160                          const ModelHighAPI_Selection& thePoint,
161                          const bool theIsPerpendicular);
162
163   /// Set by two parallel planes.
164   CONSTRUCTIONAPI_EXPORT
165   void setByTwoParallelPlanes(const ModelHighAPI_Selection& thePlane1,
166                               const ModelHighAPI_Selection& thePlane2);
167
168   /// Set by coincident to point.
169   CONSTRUCTIONAPI_EXPORT
170   void setByCoincidentToPoint(const ModelHighAPI_Selection& thePlane,
171                               const ModelHighAPI_Selection& thePoint);
172
173   /// Set by rotation.
174   CONSTRUCTIONAPI_EXPORT
175   void setByRotation(const ModelHighAPI_Selection& thePlane,
176                      const ModelHighAPI_Selection& theAxis,
177                      const ModelHighAPI_Double& theAngle,
178                      const ModelHighAPI_Integer& theNbCopy = ModelHighAPI_Integer(1));
179
180   /// Dump wrapped feature
181   CONSTRUCTIONAPI_EXPORT
182   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
183 };
184
185 /// Pointer on Plane object
186 typedef std::shared_ptr<ConstructionAPI_Plane> PlanePtr;
187
188 /// \ingroup CPPHighAPI
189 /// \brief Create Plane feature
190 CONSTRUCTIONAPI_EXPORT
191 PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document>& thePart,
192                   const ModelHighAPI_Selection& theFace,
193                   const ModelHighAPI_Double& theDistance,
194                   const bool theIsReverse,
195                   const ModelHighAPI_Integer& theNbCopy = ModelHighAPI_Integer(1));
196
197 /// \ingroup CPPHighAPI
198 /// \brief Create Plane feature
199 CONSTRUCTIONAPI_EXPORT
200 PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document>& thePart,
201                   const ModelHighAPI_Double& theA,
202                   const ModelHighAPI_Double& theB,
203                   const ModelHighAPI_Double& theC,
204                   const ModelHighAPI_Double& theD);
205
206 /// \ingroup CPPHighAPI
207 /// \brief Create Plane feature
208 CONSTRUCTIONAPI_EXPORT
209 PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document>& thePart,
210                   const ModelHighAPI_Selection& thePoint1,
211                   const ModelHighAPI_Selection& thePoint2,
212                   const ModelHighAPI_Selection& thePoint3);
213
214 /// \ingroup CPPHighAPI
215 /// \brief Create Plane feature
216 CONSTRUCTIONAPI_EXPORT
217 PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document>& thePart,
218                   const ModelHighAPI_Selection& theLine,
219                   const ModelHighAPI_Selection& thePoint,
220                   const bool theIsPerpendicular);
221
222 /// \ingroup CPPHighAPI
223 /// \brief Create Plane feature
224 CONSTRUCTIONAPI_EXPORT
225 PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document>& thePart,
226                   const ModelHighAPI_Selection& theObject1,
227                   const ModelHighAPI_Selection& theObject2);
228
229 /// \ingroup CPPHighAPI
230 /// \brief Create Plane feature
231 CONSTRUCTIONAPI_EXPORT
232 PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document>& thePart,
233                   const ModelHighAPI_Selection& thePlane,
234                   const ModelHighAPI_Selection& theAxis,
235                   const ModelHighAPI_Double& theAngle,
236                   const ModelHighAPI_Integer& theNbCopy = ModelHighAPI_Integer(1));
237
238 #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_PLANE_H_ */