1 // Copyright (C) 2014-2019 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();
43 inline static const std::string& ID()
45 static const std::string CONSTRUCTION_POINT_KIND("Point");
46 return CONSTRUCTION_POINT_KIND;
49 /// Attribute name for creation method.
50 inline static const std::string& CREATION_METHOD()
52 static const std::string MY_CREATION_METHOD_ID("creation_method");
53 return MY_CREATION_METHOD_ID;
56 /// Attribute name for creation method.
57 inline static const std::string& CREATION_METHOD_BY_XYZ()
59 static const std::string MY_CREATION_METHOD_ID("by_xyz");
60 return MY_CREATION_METHOD_ID;
63 /// Attribute name for creation method.
64 inline static const std::string& CREATION_METHOD_BY_DISTANCE_ON_EDGE()
66 static const std::string MY_CREATION_METHOD_ID("by_distance_on_edge");
67 return MY_CREATION_METHOD_ID;
70 /// Attribute name for creation method.
71 inline static const std::string& CREATION_METHOD_BY_PROJECTION()
73 static const std::string MY_CREATION_METHOD_ID("by_projection");
74 return MY_CREATION_METHOD_ID;
77 /// Attribute name for creation method.
78 inline static const std::string& CREATION_METHOD_BY_INTERSECTION()
80 static const std::string MY_CREATION_METHOD_ID("by_intersection");
81 return MY_CREATION_METHOD_ID;
84 /// Attribute name for creation method.
85 inline static const std::string& CREATION_METHOD_BY_GEOMETRICAL_PROPERTY()
87 static const std::string MY_CREATION_METHOD_ID("by_geometrical_property");
88 return MY_CREATION_METHOD_ID;
91 inline static const std::string& POINT3D()
93 static const std::string POINT_ATTR("point3d");
97 /// Attribute name for selected edge.
98 inline static const std::string& EDGE()
100 static const std::string ATTR_ID("edge");
104 /// Attribute name for offset type on selected edge.
105 inline static const std::string& OFFSET_TYPE()
107 static const std::string ATTR_ID("offset_type");
111 /// Attribute name for offset type by distance.
112 inline static const std::string& OFFSET_TYPE_BY_DISTANCE()
114 static const std::string ATTR_ID("offset_type_by_distance");
118 /// Attribute name for offset type by ratio.
119 inline static const std::string& OFFSET_TYPE_BY_RATIO()
121 static const std::string ATTR_ID("offset_type_by_ratio");
125 /// Attribute name for distance.
126 inline static const std::string& DISTANCE()
128 static const std::string ATTR_ID("distance");
132 /// Attribute name for percent flag.
133 inline static const std::string& RATIO()
135 static const std::string ATTR_ID("ratio");
139 /// Attribute name for reverse flag.
140 inline static const std::string& REVERSE()
142 static const std::string ATTR_ID("reverse");
146 /// Attribute name for point to projection.
147 inline static const std::string& POINT_TO_PROJECT()
149 static const std::string ATTR_ID("point_to_project");
153 /// Attribute name for projection type.
154 inline static const std::string& PROJECTION_TYPE()
156 static const std::string ATTR_ID("projection_type");
160 /// Attribute name for projection type on edge.
161 inline static const std::string& PROJECTION_TYPE_ON_EDGE()
163 static const std::string ATTR_ID("projection_type_on_edge");
167 /// Attribute name for projection type on face.
168 inline static const std::string& PROJECTION_TYPE_ON_FACE()
170 static const std::string ATTR_ID("projection_type_on_face");
174 /// Attribute name for edge for point projection.
175 inline static const std::string& EDGE_FOR_POINT_PROJECTION()
177 static const std::string ATTR_ID("edge_for_point_projection");
181 /// Attribute name for face for point projection.
182 inline static const std::string& FACE_FOR_POINT_PROJECTION()
184 static const std::string ATTR_ID("face_for_point_projection");
188 /// Attribute name for intersection type.
189 inline static const std::string& INTERSECTION_TYPE()
191 static const std::string ATTR_ID("intersection_type");
195 /// Attribute name for intersection type by lines.
196 inline static const std::string& INTERSECTION_TYPE_BY_LINES()
198 static const std::string MY_CREATION_METHOD_ID("intersection_type_by_lines");
199 return MY_CREATION_METHOD_ID;
202 /// Attribute name for intersection type by line and plane.
203 inline static const std::string& INTERSECTION_TYPE_BY_LINE_AND_PLANE()
205 static const std::string MY_CREATION_METHOD_ID("intersection_type_by_line_and_plane");
206 return MY_CREATION_METHOD_ID;
209 /// Attribute name for intersection type by planes.
210 inline static const std::string& INTERSECTION_TYPE_BY_PLANES()
212 static const std::string MY_CREATION_METHOD_ID("intersection_type_by_planes");
213 return MY_CREATION_METHOD_ID;
216 /// Attribute name for selected first intersection line.
217 inline static const std::string& INTERSECTION_LINE_1()
219 static const std::string ATTR_ID("intersection_line_1");
223 /// Attribute name for selected second intersection line.
224 inline static const std::string& INTERSECTION_LINE_2()
226 static const std::string ATTR_ID("intersection_line_2");
230 /// Attribute name for selected intersection line.
231 inline static const std::string& INTERSECTION_LINE()
233 static const std::string ATTR_ID("intersection_line");
237 /// Attribute name for selected intersection plane.
238 inline static const std::string& INTERSECTION_PLANE()
240 static const std::string ATTR_ID("intersection_plane");
244 /// Attribute name for use offset for the intersection plane.
245 inline static const std::string& USE_OFFSET()
247 static const std::string ATTR_ID("use_offset");
251 /// Attribute name for offset for the intersection plane.
252 inline static const std::string& OFFSET()
254 static const std::string ATTR_ID("offset");
258 /// Attribute name for reverse offset for the intersection plane.
259 inline static const std::string& REVERSE_OFFSET()
261 static const std::string ATTR_ID("reverse_offset");
265 /// Attribute name for selected intersection plane.
266 inline static const std::string& INTERSECTION_PLANE_1()
268 static const std::string ATTR_ID("intersection_plane_1");
272 /// Attribute name for selected intersection plane.
273 inline static const std::string& INTERSECTION_PLANE_2()
275 static const std::string ATTR_ID("intersection_plane_2");
279 /// Attribute name for selected intersection plane.
280 inline static const std::string& INTERSECTION_PLANE_3()
282 static const std::string ATTR_ID("intersection_plane_3");
286 /// Attribute name for property type.
287 inline static const std::string& GEOMETRICAL_PROPERTY_TYPE()
289 static const std::string ATTR_ID("geometrical_property_type");
293 /// Attribute name for property type by center of gravity.
294 inline static const std::string& GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_GRAVITY()
296 static const std::string PROPERTY_TYPE("geometrical_property_type_by_center_of_gravity");
297 return PROPERTY_TYPE;
300 /// Attribute name for property type by center of circle.
301 inline static const std::string& GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_CIRCLE()
303 static const std::string PROPERTY_TYPE("geometrical_property_type_by_center_of_circle");
304 return PROPERTY_TYPE;
307 /// Attribute name for selected object for center of gravity.
308 inline static const std::string& OBJECT_FOR_CENTER_OF_GRAVITY()
310 static const std::string ATTR_ID("object_for_center_of_gravity");
314 /// Attribute name for selected object for center of cricle.
315 inline static const std::string& OBJECT_FOR_CENTER_OF_CIRCLE()
317 static const std::string ATTR_ID("object_for_center_of_circle");
321 /// Creates a new part document if needed.
322 CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
324 /// Request for initialization of data model of the feature: adding all attributes.
325 CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes();
327 /// Use plugin manager for features creation
328 ConstructionPlugin_Point();
330 /// Customize presentation of the feature
331 virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
332 std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs);
335 std::shared_ptr<GeomAPI_Vertex> createByXYZ();
336 std::shared_ptr<GeomAPI_Vertex> createByDistanceOnEdge();
337 std::shared_ptr<GeomAPI_Vertex> createByProjectionOnEdge();
338 std::shared_ptr<GeomAPI_Vertex> createByProjectionOnFace();
339 std::shared_ptr<GeomAPI_Vertex> createByLinesIntersection();
340 std::list<std::shared_ptr<GeomAPI_Vertex> > createByLineAndPlaneIntersection();
341 std::shared_ptr<GeomAPI_Vertex> createByPlanesIntersection();
342 std::shared_ptr<GeomAPI_Vertex> createByCenterOfGravity();
343 std::shared_ptr<GeomAPI_Vertex> createByCenterOfCircle();