SHAPER 9.16.0
ConstructionPlugin_Plane.h
1// Copyright (C) 2014-2026 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 ConstructionPlugin_Plane_H
21#define ConstructionPlugin_Plane_H
22
23#include "ConstructionPlugin.h"
24
25#include <ModelAPI_Feature.h>
26#include <ModelAPI_Result.h>
27#include <GeomAPI_ICustomPrs.h>
28#include <GeomAPI_Shape.h>
29
34{
35public:
37 CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind()
38 {
39 static std::string MY_KIND = ConstructionPlugin_Plane::ID();
40 return MY_KIND;
41 }
42
44 inline static const std::string& DEFAULT_COLOR()
45 {
46 static const std::string CONSTRUCTION_PLANE_COLOR("150,150,180");
47 return CONSTRUCTION_PLANE_COLOR;
48 }
49
51 inline static const std::string& COLOR_NAME()
52 {
53 static const std::string PLANE_COLOR_NAME("construction_plane_color");
54 return PLANE_COLOR_NAME;
55 }
56
58 inline static const std::string& ID()
59 {
60 static const std::string CONSTRUCTION_PLANE_KIND("Plane");
61 return CONSTRUCTION_PLANE_KIND;
62 }
63
65 inline static const std::string& CREATION_METHOD()
66 {
67 static const std::string MY_CREATION_METHOD_ID("creation_method");
68 return MY_CREATION_METHOD_ID;
69 }
70
72 inline static const std::string& CREATION_METHOD_BY_GENERAL_EQUATION()
73 {
74 static const std::string MY_CREATION_METHOD_ID("by_general_equation");
75 return MY_CREATION_METHOD_ID;
76 }
77
79 inline static const std::string& CREATION_METHOD_BY_THREE_POINTS()
80 {
81 static const std::string MY_CREATION_METHOD_ID("by_three_points");
82 return MY_CREATION_METHOD_ID;
83 }
84
86 inline static const std::string& CREATION_METHOD_BY_LINE_AND_POINT()
87 {
88 static const std::string MY_CREATION_METHOD_ID("by_line_and_point");
89 return MY_CREATION_METHOD_ID;
90 }
91
93 inline static const std::string& CREATION_METHOD_BY_OTHER_PLANE()
94 {
95 static const std::string MY_CREATION_METHOD_ID("by_other_plane");
96 return MY_CREATION_METHOD_ID;
97 }
98
100 inline static const std::string& CREATION_METHOD_BY_OTHER_PLANE_OPTION()
101 {
102 static const std::string MY_CREATION_METHOD_ID("by_other_plane_option");
103 return MY_CREATION_METHOD_ID;
104 }
105
107 inline static const std::string& CREATION_METHOD_BY_DISTANCE_FROM_OTHER()
108 {
109 static const std::string MY_CREATION_METHOD_ID("by_distance_from_other");
110 return MY_CREATION_METHOD_ID;
111 }
112
114 inline static const std::string& CREATION_METHOD_BY_COINCIDENT_TO_POINT()
115 {
116 static const std::string MY_CREATION_METHOD_ID("by_coincident_to_point");
117 return MY_CREATION_METHOD_ID;
118 }
119
121 inline static const std::string& CREATION_METHOD_BY_ROTATION()
122 {
123 static const std::string MY_CREATION_METHOD_ID("by_rotation");
124 return MY_CREATION_METHOD_ID;
125 }
126
128 inline static const std::string& CREATION_METHOD_BY_TWO_PARALLEL_PLANES()
129 {
130 static const std::string MY_CREATION_METHOD_ID("by_two_parallel_planes");
131 return MY_CREATION_METHOD_ID;
132 }
133
135 inline static const std::string& POINT1()
136 {
137 static const std::string ATTR_ID("point1");
138 return ATTR_ID;
139 }
140
142 inline static const std::string& POINT2()
143 {
144 static const std::string ATTR_ID("point2");
145 return ATTR_ID;
146 }
147
149 inline static const std::string& POINT3()
150 {
151 static const std::string ATTR_ID("point3");
152 return ATTR_ID;
153 }
154
156 inline static const std::string& LINE()
157 {
158 static const std::string ATTR_ID("line");
159 return ATTR_ID;
160 }
161
163 inline static const std::string& POINT()
164 {
165 static const std::string ATTR_ID("point");
166 return ATTR_ID;
167 }
168
170 inline static const std::string& PERPENDICULAR()
171 {
172 static const std::string ATTR_ID("perpendicular");
173 return ATTR_ID;
174 }
175
177 inline static const std::string& PLANE()
178 {
179 static const std::string ATTR_ID("plane");
180 return ATTR_ID;
181 }
182
184 inline static const std::string& DISTANCE()
185 {
186 static const std::string ATTR_ID("distance");
187 return ATTR_ID;
188 }
189
191 inline static const std::string& REVERSE()
192 {
193 static const std::string ATTR_ID("reverse");
194 return ATTR_ID;
195 }
196
198 inline static const std::string& COINCIDENT_POINT()
199 {
200 static const std::string ATTR_ID("coincident_point");
201 return ATTR_ID;
202 }
203
205 inline static const std::string& AXIS()
206 {
207 static const std::string ATTR_ID("axis");
208 return ATTR_ID;
209 }
210
212 inline static const std::string& ANGLE()
213 {
214 static const std::string ATTR_ID("angle");
215 return ATTR_ID;
216 }
217
218 inline static const std::string& PLANE1()
219 {
220 static const std::string ATTR_ID("plane1");
221 return ATTR_ID;
222 }
223
224 inline static const std::string& PLANE2()
225 {
226 static const std::string ATTR_ID("plane2");
227 return ATTR_ID;
228 }
229
230 inline static const std::string& NB_COPIES()
231 {
232 static const std::string ATTR_ID("nb_copies");
233 return ATTR_ID;
234 }
235
237 inline static const std::string& A()
238 {
239 static const std::string ATTR_ID("A");
240 return ATTR_ID;
241 }
243 inline static const std::string& B()
244 {
245 static const std::string ATTR_ID("B");
246 return ATTR_ID;
247 }
249 inline static const std::string& C()
250 {
251 static const std::string ATTR_ID("C");
252 return ATTR_ID;
253 }
255 inline static const std::string& D()
256 {
257 static const std::string ATTR_ID("D");
258 return ATTR_ID;
259 }
260
262 CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
263
265 CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes();
266
269
271 virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs);
272
273protected:
275 std::shared_ptr<GeomAPI_Shape> createByGeneralEquation();
276 std::shared_ptr<GeomAPI_Shape> createByThreePoints();
277 std::shared_ptr<GeomAPI_Shape> createByLineAndPoint();
278 std::shared_ptr<GeomAPI_Shape> createByCoincidentPoint();
279 void createByRotation(ListOfShape& theShapes);
280 std::shared_ptr<GeomAPI_Shape> createByTwoParallelPlanes();
283 void createByDistanceFromOther(ListOfShape& theShapes);
284};
285
286#endif
Feature for creation of the new planar surface in PartSet.
Definition: ConstructionPlugin_Plane.h:34
static const std::string & CREATION_METHOD()
Attribute name for creation method.
Definition: ConstructionPlugin_Plane.h:65
virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs)
Customize presentation of the feature.
Definition: ConstructionPlugin_Plane.cpp:163
static const std::string & PLANE()
Attribute name for selected plane.
Definition: ConstructionPlugin_Plane.h:177
static const std::string & POINT1()
Attribute name for first point.
Definition: ConstructionPlugin_Plane.h:135
virtual const std::string & getKind()
Definition: ConstructionPlugin_Plane.h:37
virtual void execute()
Creates a new part document if needed.
Definition: ConstructionPlugin_Plane.cpp:113
static const std::string & CREATION_METHOD_BY_DISTANCE_FROM_OTHER()
Attribute name for creation method.
Definition: ConstructionPlugin_Plane.h:107
std::shared_ptr< GeomAPI_Shape > createByGeneralEquation()
Creates a new plane by general equation.
Definition: ConstructionPlugin_Plane.cpp:189
void createByDistanceFromOther(ListOfShape &theShapes)
Creates a new plane by copy of face plane with translation along the normal to the specified distance...
Definition: ConstructionPlugin_Plane.cpp:295
static const std::string & COLOR_NAME()
Default color property name.
Definition: ConstructionPlugin_Plane.h:51
static const std::string & AXIS()
Attribute name for axis.
Definition: ConstructionPlugin_Plane.h:205
static const std::string & B()
Attribute name for b parameter for the general equation of a plane (ax+by+cz+d=0)
Definition: ConstructionPlugin_Plane.h:243
static const std::string & DISTANCE()
Attribute name for distance.
Definition: ConstructionPlugin_Plane.h:184
static const std::string & COINCIDENT_POINT()
Attribute name for coincident point.
Definition: ConstructionPlugin_Plane.h:198
static const std::string & CREATION_METHOD_BY_ROTATION()
Attribute name for creation method.
Definition: ConstructionPlugin_Plane.h:121
static const std::string & LINE()
Attribute name for line.
Definition: ConstructionPlugin_Plane.h:156
static const std::string & CREATION_METHOD_BY_GENERAL_EQUATION()
Attribute name for creation method.
Definition: ConstructionPlugin_Plane.h:72
static const std::string & POINT3()
Attribute name for third point.
Definition: ConstructionPlugin_Plane.h:149
static const std::string & CREATION_METHOD_BY_OTHER_PLANE()
Attribute name for creation method.
Definition: ConstructionPlugin_Plane.h:93
static const std::string & ID()
Plane kind.
Definition: ConstructionPlugin_Plane.h:58
static const std::string & CREATION_METHOD_BY_COINCIDENT_TO_POINT()
Attribute name for creation method.
Definition: ConstructionPlugin_Plane.h:114
static const std::string & CREATION_METHOD_BY_OTHER_PLANE_OPTION()
Attribute name for creation method.
Definition: ConstructionPlugin_Plane.h:100
static const std::string & POINT2()
Attribute name for second point.
Definition: ConstructionPlugin_Plane.h:142
static const std::string & ANGLE()
Attribute name for angle.
Definition: ConstructionPlugin_Plane.h:212
static const std::string & POINT()
Attribute name for point.
Definition: ConstructionPlugin_Plane.h:163
static const std::string & DEFAULT_COLOR()
Default color for a plane.
Definition: ConstructionPlugin_Plane.h:44
static const std::string & CREATION_METHOD_BY_TWO_PARALLEL_PLANES()
Attribute name for creation method.
Definition: ConstructionPlugin_Plane.h:128
static const std::string & PERPENDICULAR()
Attribute name for perpendicular flag.
Definition: ConstructionPlugin_Plane.h:170
static const std::string & REVERSE()
Attribute name for reverse flag.
Definition: ConstructionPlugin_Plane.h:191
static const std::string & D()
Attribute name for d parameter for the general equation of a plane (ax+by+cz+d=0)
Definition: ConstructionPlugin_Plane.h:255
ConstructionPlugin_Plane()
Use plugin manager for features creation.
Definition: ConstructionPlugin_Plane.cpp:61
virtual void initAttributes()
Request for initialization of data model of the feature: adding all attributes.
Definition: ConstructionPlugin_Plane.cpp:66
static const std::string & CREATION_METHOD_BY_THREE_POINTS()
Attribute name for creation method.
Definition: ConstructionPlugin_Plane.h:79
static const std::string & CREATION_METHOD_BY_LINE_AND_POINT()
Attribute name for creation method.
Definition: ConstructionPlugin_Plane.h:86
static const std::string & A()
Attribute name for a parameter for the general equation of a plane (ax+by+cz+d=0)
Definition: ConstructionPlugin_Plane.h:237
static const std::string & C()
Attribute name for c parameter for the general equation of a plane (ax+by+cz+d=0)
Definition: ConstructionPlugin_Plane.h:249
Interface of a class which can provide specific customization of object presentation.
Definition: GeomAPI_ICustomPrs.h:37
Feature function that represents the particular functionality of this operation.
Definition: ModelAPI_Feature.h:41