1 // Copyright (C) 2014-2020 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef ConstructionPlugin_Point_H_
21 #define ConstructionPlugin_Point_H_
23 #include "ConstructionPlugin.h"
25 #include <GeomAPI_ICustomPrs.h>
26 #include <ModelAPI_Feature.h>
27 #include <ModelAPI_Result.h>
33 /// \class ConstructionPlugin_Point
35 /// \brief Feature for creation of the new part in PartSet.
36 class ConstructionPlugin_Point: public ModelAPI_Feature, public GeomAPI_ICustomPrs
39 /// Returns the kind of a feature.
40 CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind();
42 /// Default color for a point.
43 inline static const std::string& DEFAULT_COLOR()
45 static const std::string POINT_COLOR("85,85,0");
49 /// Default color property name.
50 inline static const std::string& COLOR_NAME()
52 static const std::string POINT_COLOR_NAME("construction_point_color");
53 return POINT_COLOR_NAME;
58 inline static const std::string& ID()
60 static const std::string CONSTRUCTION_POINT_KIND("Point");
61 return CONSTRUCTION_POINT_KIND;
64 /// Attribute name for creation method.
65 inline static const std::string& CREATION_METHOD()
67 static const std::string MY_CREATION_METHOD_ID("creation_method");
68 return MY_CREATION_METHOD_ID;
71 /// Attribute name for creation method.
72 inline static const std::string& CREATION_METHOD_BY_XYZ()
74 static const std::string MY_CREATION_METHOD_ID("by_xyz");
75 return MY_CREATION_METHOD_ID;
78 /// Attribute name for creation method.
79 inline static const std::string& CREATION_METHOD_BY_DISTANCE_ON_EDGE()
81 static const std::string MY_CREATION_METHOD_ID("by_distance_on_edge");
82 return MY_CREATION_METHOD_ID;
85 /// Attribute name for creation method.
86 inline static const std::string& CREATION_METHOD_BY_PROJECTION()
88 static const std::string MY_CREATION_METHOD_ID("by_projection");
89 return MY_CREATION_METHOD_ID;
92 /// Attribute name for creation method.
93 inline static const std::string& CREATION_METHOD_BY_INTERSECTION()
95 static const std::string MY_CREATION_METHOD_ID("by_intersection");
96 return MY_CREATION_METHOD_ID;
99 /// Attribute name for creation method.
100 inline static const std::string& CREATION_METHOD_BY_GEOMETRICAL_PROPERTY()
102 static const std::string MY_CREATION_METHOD_ID("by_geometrical_property");
103 return MY_CREATION_METHOD_ID;
106 inline static const std::string& POINT3D()
108 static const std::string POINT_ATTR("point3d");
112 /// Attribute name for selected edge.
113 inline static const std::string& EDGE()
115 static const std::string ATTR_ID("edge");
119 /// Attribute name for offset type on selected edge.
120 inline static const std::string& OFFSET_TYPE()
122 static const std::string ATTR_ID("offset_type");
126 /// Attribute name for offset type by distance.
127 inline static const std::string& OFFSET_TYPE_BY_DISTANCE()
129 static const std::string ATTR_ID("offset_type_by_distance");
133 /// Attribute name for offset type by ratio.
134 inline static const std::string& OFFSET_TYPE_BY_RATIO()
136 static const std::string ATTR_ID("offset_type_by_ratio");
140 /// Attribute name for distance.
141 inline static const std::string& DISTANCE()
143 static const std::string ATTR_ID("distance");
147 /// Attribute name for percent flag.
148 inline static const std::string& RATIO()
150 static const std::string ATTR_ID("ratio");
154 /// Attribute name for reverse flag.
155 inline static const std::string& REVERSE()
157 static const std::string ATTR_ID("reverse");
161 /// Attribute name for point to projection.
162 inline static const std::string& POINT_TO_PROJECT()
164 static const std::string ATTR_ID("point_to_project");
168 /// Attribute name for projection type.
169 inline static const std::string& PROJECTION_TYPE()
171 static const std::string ATTR_ID("projection_type");
175 /// Attribute name for projection type on edge.
176 inline static const std::string& PROJECTION_TYPE_ON_EDGE()
178 static const std::string ATTR_ID("projection_type_on_edge");
182 /// Attribute name for projection type on face.
183 inline static const std::string& PROJECTION_TYPE_ON_FACE()
185 static const std::string ATTR_ID("projection_type_on_face");
189 /// Attribute name for edge for point projection.
190 inline static const std::string& EDGE_FOR_POINT_PROJECTION()
192 static const std::string ATTR_ID("edge_for_point_projection");
196 /// Attribute name for face for point projection.
197 inline static const std::string& FACE_FOR_POINT_PROJECTION()
199 static const std::string ATTR_ID("face_for_point_projection");
203 /// Attribute name for intersection type.
204 inline static const std::string& INTERSECTION_TYPE()
206 static const std::string ATTR_ID("intersection_type");
210 /// Attribute name for intersection type by lines.
211 inline static const std::string& INTERSECTION_TYPE_BY_LINES()
213 static const std::string MY_CREATION_METHOD_ID("intersection_type_by_lines");
214 return MY_CREATION_METHOD_ID;
217 /// Attribute name for intersection type by line and plane.
218 inline static const std::string& INTERSECTION_TYPE_BY_LINE_AND_PLANE()
220 static const std::string MY_CREATION_METHOD_ID("intersection_type_by_line_and_plane");
221 return MY_CREATION_METHOD_ID;
224 /// Attribute name for intersection type by planes.
225 inline static const std::string& INTERSECTION_TYPE_BY_PLANES()
227 static const std::string MY_CREATION_METHOD_ID("intersection_type_by_planes");
228 return MY_CREATION_METHOD_ID;
231 /// Attribute name for selected first intersection line.
232 inline static const std::string& INTERSECTION_LINE_1()
234 static const std::string ATTR_ID("intersection_line_1");
238 /// Attribute name for selected second intersection line.
239 inline static const std::string& INTERSECTION_LINE_2()
241 static const std::string ATTR_ID("intersection_line_2");
245 /// Attribute name for selected intersection line.
246 inline static const std::string& INTERSECTION_LINE()
248 static const std::string ATTR_ID("intersection_line");
252 /// Attribute name for selected intersection plane.
253 inline static const std::string& INTERSECTION_PLANE()
255 static const std::string ATTR_ID("intersection_plane");
259 /// Attribute name for use offset for the intersection plane.
260 inline static const std::string& USE_OFFSET()
262 static const std::string ATTR_ID("use_offset");
266 /// Attribute name for offset for the intersection plane.
267 inline static const std::string& OFFSET()
269 static const std::string ATTR_ID("offset");
273 /// Attribute name for reverse offset for the intersection plane.
274 inline static const std::string& REVERSE_OFFSET()
276 static const std::string ATTR_ID("reverse_offset");
280 /// Attribute name for selected intersection plane.
281 inline static const std::string& INTERSECTION_PLANE_1()
283 static const std::string ATTR_ID("intersection_plane_1");
287 /// Attribute name for selected intersection plane.
288 inline static const std::string& INTERSECTION_PLANE_2()
290 static const std::string ATTR_ID("intersection_plane_2");
294 /// Attribute name for selected intersection plane.
295 inline static const std::string& INTERSECTION_PLANE_3()
297 static const std::string ATTR_ID("intersection_plane_3");
301 /// Attribute name for property type.
302 inline static const std::string& GEOMETRICAL_PROPERTY_TYPE()
304 static const std::string ATTR_ID("geometrical_property_type");
308 /// Attribute name for property type by center of gravity.
309 inline static const std::string& GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_GRAVITY()
311 static const std::string PROPERTY_TYPE("geometrical_property_type_by_center_of_gravity");
312 return PROPERTY_TYPE;
315 /// Attribute name for property type by center of circle.
316 inline static const std::string& GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_CIRCLE()
318 static const std::string PROPERTY_TYPE("geometrical_property_type_by_center_of_circle");
319 return PROPERTY_TYPE;
322 /// Attribute name for selected object for center of gravity.
323 inline static const std::string& OBJECT_FOR_CENTER_OF_GRAVITY()
325 static const std::string ATTR_ID("object_for_center_of_gravity");
329 /// Attribute name for selected object for center of cricle.
330 inline static const std::string& OBJECT_FOR_CENTER_OF_CIRCLE()
332 static const std::string ATTR_ID("object_for_center_of_circle");
336 /// Creates a new part document if needed.
337 CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
339 /// Request for initialization of data model of the feature: adding all attributes.
340 CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes();
342 /// Use plugin manager for features creation
343 ConstructionPlugin_Point();
345 /// Customize presentation of the feature
346 virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs);
349 std::shared_ptr<GeomAPI_Vertex> createByXYZ();
350 std::shared_ptr<GeomAPI_Vertex> createByDistanceOnEdge();
351 std::shared_ptr<GeomAPI_Vertex> createByProjectionOnEdge();
352 std::shared_ptr<GeomAPI_Vertex> createByProjectionOnFace();
353 std::shared_ptr<GeomAPI_Vertex> createByLinesIntersection();
354 std::list<std::shared_ptr<GeomAPI_Vertex> > createByLineAndPlaneIntersection();
355 std::shared_ptr<GeomAPI_Vertex> createByPlanesIntersection();
356 std::shared_ptr<GeomAPI_Vertex> createByCenterOfGravity();
357 std::shared_ptr<GeomAPI_Vertex> createByCenterOfCircle();