SHAPER  9.12.0
ConstructionPlugin_Axis.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 ConstructionPlugin_Axis_H
21 #define ConstructionPlugin_Axis_H
22 
23 #include "ConstructionPlugin.h"
24 #include <ModelAPI_Feature.h>
25 #include <ModelAPI_Result.h>
26 #include <GeomAPI_ICustomPrs.h>
27 
33 {
34  public:
36  CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind()
37  {
38  static std::string MY_KIND = ConstructionPlugin_Axis::ID();
39  return MY_KIND;
40  }
41 
43  inline static const std::string& ID()
44  {
45  static const std::string CONSTRUCTION_AXIS_KIND("Axis");
46  return CONSTRUCTION_AXIS_KIND;
47  }
48 
50  inline static const std::string& METHOD()
51  {
52  static const std::string METHOD_ATTR("CreationMethod");
53  return METHOD_ATTR;
54  }
55 
57  inline static const std::string& CREATION_METHOD_BY_TWO_POINTS()
58  {
59  static const std::string METHOD_ATTR("AxisByPointsCase");
60  return METHOD_ATTR;
61  }
62 
64  inline static const std::string& CREATION_METHOD_BY_CYLINDRICAL_FACE()
65  {
66  static const std::string METHOD_ATTR("AxisByCylindricalFaceCase");
67  return METHOD_ATTR;
68  }
69 
71  inline static const std::string& CREATION_METHOD_BY_POINT_AND_DIRECTION()
72  {
73  static const std::string METHOD_ATTR("AxisByPointAndDirection");
74  return METHOD_ATTR;
75  }
76 
78  inline static const std::string& CREATION_METHOD_BY_DIMENSIONS()
79  {
80  static const std::string METHOD_ATTR("AxisByDimensionsCase");
81  return METHOD_ATTR;
82  }
83 
85  inline static const std::string& CREATION_METHOD_BY_LINE()
86  {
87  static const std::string METHOD_ATTR("by_line");
88  return METHOD_ATTR;
89  }
90 
92  inline static const std::string& CREATION_METHOD_BY_PLANE_AND_POINT()
93  {
94  static const std::string METHOD_ATTR("by_plane_and_point");
95  return METHOD_ATTR;
96  }
97 
99  inline static const std::string& CREATION_METHOD_BY_TWO_PLANES()
100  {
101  static const std::string METHOD_ATTR("by_two_planes");
102  return METHOD_ATTR;
103  }
104 
106  inline static const std::string& POINT_FIRST()
107  {
108  static const std::string POINT_ATTR_FIRST("FirstPoint");
109  return POINT_ATTR_FIRST;
110  }
112  inline static const std::string& POINT_SECOND()
113  {
114  static const std::string POINT_ATTR_SECOND("SecondPoint");
115  return POINT_ATTR_SECOND;
116  }
118  inline static const std::string& CYLINDRICAL_FACE()
119  {
120  static const std::string CYLINDRICAL_FACE_ATTR("CylindricalFace");
121  return CYLINDRICAL_FACE_ATTR;
122  }
124  inline static const std::string& DX()
125  {
126  static const std::string DX_ATTR("DX");
127  return DX_ATTR;
128  }
130  inline static const std::string& DY()
131  {
132  static const std::string DY_ATTR("DY");
133  return DY_ATTR;
134  }
136  inline static const std::string& DZ()
137  {
138  static const std::string DZ_ATTR("DZ");
139  return DZ_ATTR;
140  }
141 
143  inline static const std::string& X_DIRECTION()
144  {
145  static const std::string ATTR_X_DIRECTION("X_Direction");
146  return ATTR_X_DIRECTION;
147  }
148 
150  inline static const std::string& Y_DIRECTION()
151  {
152  static const std::string ATTR_Y_DIRECTION("Y_Direction");
153  return ATTR_Y_DIRECTION;
154  }
155 
157  inline static const std::string& Z_DIRECTION()
158  {
159  static const std::string ATTR_Z_DIRECTION("Z_Direction");
160  return ATTR_Z_DIRECTION;
161  }
162 
164  inline static const std::string& LINE()
165  {
166  static const std::string ATTR_ID("line");
167  return ATTR_ID;
168  }
169 
171  inline static const std::string& PLANE()
172  {
173  static const std::string ATTR_ID("plane");
174  return ATTR_ID;
175  }
176 
178  inline static const std::string& POINT()
179  {
180  static const std::string ATTR_ID("point");
181  return ATTR_ID;
182  }
183 
185  inline static const std::string& PLANE1()
186  {
187  static const std::string ATTR_ID("plane1");
188  return ATTR_ID;
189  }
190 
192  inline static const std::string& USE_OFFSET1()
193  {
194  static const std::string ATTR_ID("use_offset1");
195  return ATTR_ID;
196  }
197 
199  inline static const std::string& OFFSET1()
200  {
201  static const std::string ATTR_ID("offset1");
202  return ATTR_ID;
203  }
204 
206  inline static const std::string& REVERSE_OFFSET1()
207  {
208  static const std::string ATTR_ID("reverse_offset1");
209  return ATTR_ID;
210  }
211 
213  inline static const std::string& PLANE2()
214  {
215  static const std::string ATTR_ID("plane2");
216  return ATTR_ID;
217  }
218 
220  inline static const std::string& USE_OFFSET2()
221  {
222  static const std::string ATTR_ID("use_offset2");
223  return ATTR_ID;
224  }
225 
227  inline static const std::string& OFFSET2()
228  {
229  static const std::string ATTR_ID("offset2");
230  return ATTR_ID;
231  }
232 
234  inline static const std::string& REVERSE_OFFSET2()
235  {
236  static const std::string ATTR_ID("reverse_offset2");
237  return ATTR_ID;
238  }
239 
241  inline static const double MINIMAL_LENGTH() { return 1.e-5; }
242 
244  CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
245 
247  CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes();
248 
251 
253  virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs);
254 
255  protected:
257  void createAxisByTwoPoints();
259  void createAxisByDimensions();
264  void createAxisByLine();
265  void createAxisByPlaneAndPoint();
266  void createAxisByTwoPlanes();
267 };
268 
269 
270 #endif
Feature for creation of the new axis in PartSet.
Definition: ConstructionPlugin_Axis.h:33
void createAxisByTwoPoints()
Creates a new axis by two defined points.
Definition: ConstructionPlugin_Axis.cpp:106
static const std::string & X_DIRECTION()
attribute name for X direction
Definition: ConstructionPlugin_Axis.h:143
static const std::string & ID()
Axis kind.
Definition: ConstructionPlugin_Axis.h:43
static const std::string & USE_OFFSET1()
Attribute name for use offset for plane 1.
Definition: ConstructionPlugin_Axis.h:192
static const std::string & CREATION_METHOD_BY_TWO_PLANES()
Attribute name for creation method.
Definition: ConstructionPlugin_Axis.h:99
void createAxisByPointAndDirection()
Creates a new axis by point and direction.
Definition: ConstructionPlugin_Axis.cpp:133
static const std::string & OFFSET1()
Attribute name for offset for plane 1.
Definition: ConstructionPlugin_Axis.h:199
static const std::string & DZ()
attribute name for the Z dimension
Definition: ConstructionPlugin_Axis.h:136
virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs)
Customize presentation of the feature.
Definition: ConstructionPlugin_Axis.cpp:393
static const std::string & CREATION_METHOD_BY_LINE()
Attribute name for creation method.
Definition: ConstructionPlugin_Axis.h:85
void createAxisByDimensions()
Creates a new axis using three dimensions.
Definition: ConstructionPlugin_Axis.cpp:192
static const std::string & Z_DIRECTION()
attribute name for Y direction
Definition: ConstructionPlugin_Axis.h:157
ConstructionPlugin_Axis()
Use plugin manager for features creation.
Definition: ConstructionPlugin_Axis.cpp:49
virtual void execute()
Creates a new part document if needed.
Definition: ConstructionPlugin_Axis.cpp:372
static const std::string & PLANE1()
Attribute name for plane 1.
Definition: ConstructionPlugin_Axis.h:185
static const std::string & OFFSET2()
Attribute name for offset for plane 2.
Definition: ConstructionPlugin_Axis.h:227
static const std::string & POINT_FIRST()
attribute name for first point
Definition: ConstructionPlugin_Axis.h:106
static const std::string & CREATION_METHOD_BY_DIMENSIONS()
Attribute name for creation method.
Definition: ConstructionPlugin_Axis.h:78
static const std::string & DY()
attribute name for the Y dimension
Definition: ConstructionPlugin_Axis.h:130
static const std::string & METHOD()
attribute name for first point
Definition: ConstructionPlugin_Axis.h:50
static const std::string & DX()
attribute name for the X dimension
Definition: ConstructionPlugin_Axis.h:124
static const std::string & USE_OFFSET2()
Attribute name for use offset for plane 2.
Definition: ConstructionPlugin_Axis.h:220
static const std::string & CREATION_METHOD_BY_TWO_POINTS()
Attribute name for creation method.
Definition: ConstructionPlugin_Axis.h:57
static const std::string & REVERSE_OFFSET1()
Attribute name for reverse offset for plane 1.
Definition: ConstructionPlugin_Axis.h:206
virtual void initAttributes()
Request for initialization of data model of the feature: adding all attributes.
Definition: ConstructionPlugin_Axis.cpp:53
static const double MINIMAL_LENGTH()
Returns a minimal length for axis.
Definition: ConstructionPlugin_Axis.h:241
static const std::string & PLANE()
Attribute name for plane.
Definition: ConstructionPlugin_Axis.h:171
static const std::string & CYLINDRICAL_FACE()
attribute name for second point
Definition: ConstructionPlugin_Axis.h:118
static const std::string & POINT_SECOND()
attribute name for second point
Definition: ConstructionPlugin_Axis.h:112
void createAxisByCylindricalFace()
Creates a new axis as copy of cylindrical face axis.
Definition: ConstructionPlugin_Axis.cpp:168
static const std::string & PLANE2()
Attribute name for plane 2.
Definition: ConstructionPlugin_Axis.h:213
static const std::string & CREATION_METHOD_BY_PLANE_AND_POINT()
Attribute name for creation method.
Definition: ConstructionPlugin_Axis.h:92
static const std::string & Y_DIRECTION()
attribute name for Y direction
Definition: ConstructionPlugin_Axis.h:150
static const std::string & REVERSE_OFFSET2()
Attribute name for reverse offset for plane 2.
Definition: ConstructionPlugin_Axis.h:234
static const std::string & POINT()
Attribute name for point.
Definition: ConstructionPlugin_Axis.h:178
static const std::string & LINE()
Attribute name for line.
Definition: ConstructionPlugin_Axis.h:164
virtual const std::string & getKind()
Returns the kind of a feature.
Definition: ConstructionPlugin_Axis.h:36
static const std::string & CREATION_METHOD_BY_POINT_AND_DIRECTION()
Attribute name for creation method.
Definition: ConstructionPlugin_Axis.h:71
static const std::string & CREATION_METHOD_BY_CYLINDRICAL_FACE()
Attribute name for creation method.
Definition: ConstructionPlugin_Axis.h:64
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:39