1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef ConstructionPlugin_Point_H_
22 #define ConstructionPlugin_Point_H_
24 #include "ConstructionPlugin.h"
26 #include <GeomAPI_ICustomPrs.h>
27 #include <ModelAPI_Feature.h>
28 #include <ModelAPI_Result.h>
34 /// \class ConstructionPlugin_Point
36 /// \brief Feature for creation of the new part in PartSet.
37 class ConstructionPlugin_Point: public ModelAPI_Feature, public GeomAPI_ICustomPrs
40 /// Returns the kind of a feature.
41 CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind();
44 inline static const std::string& ID()
46 static const std::string CONSTRUCTION_POINT_KIND("Point");
47 return CONSTRUCTION_POINT_KIND;
50 /// Attribute name for creation method.
51 inline static const std::string& CREATION_METHOD()
53 static const std::string MY_CREATION_METHOD_ID("creation_method");
54 return MY_CREATION_METHOD_ID;
57 /// Attribute name for creation method.
58 inline static const std::string& CREATION_METHOD_BY_XYZ()
60 static const std::string MY_CREATION_METHOD_ID("by_xyz");
61 return MY_CREATION_METHOD_ID;
64 /// Attribute name for creation method.
65 inline static const std::string& CREATION_METHOD_BY_DISTANCE_ON_EDGE()
67 static const std::string MY_CREATION_METHOD_ID("by_distance_on_edge");
68 return MY_CREATION_METHOD_ID;
71 /// Attribute name for creation method.
72 inline static const std::string& CREATION_METHOD_BY_PROJECTION()
74 static const std::string MY_CREATION_METHOD_ID("by_projection");
75 return MY_CREATION_METHOD_ID;
78 /// Attribute name for creation method.
79 inline static const std::string& CREATION_METHOD_BY_INTERSECTION()
81 static const std::string MY_CREATION_METHOD_ID("by_intersection");
82 return MY_CREATION_METHOD_ID;
85 /// Attribute name for creation method.
86 inline static const std::string& CREATION_METHOD_BY_GEOMETRICAL_PROPERTY()
88 static const std::string MY_CREATION_METHOD_ID("by_geometrical_property");
89 return MY_CREATION_METHOD_ID;
92 /// Attribute name for X coordinate.
93 inline static const std::string& X()
95 static const std::string POINT_ATTR_X("x");
99 /// Attribute name for Y coordinate.
100 inline static const std::string& Y()
102 static const std::string POINT_ATTR_Y("y");
106 /// Attribute name for Z coordinate.
107 inline static const std::string& Z()
109 static const std::string POINT_ATTR_Z("z");
113 /// Attribute name for selected edge.
114 inline static const std::string& EDGE()
116 static const std::string ATTR_ID("edge");
120 /// Attribute name for offset type on selected edge.
121 inline static const std::string& OFFSET_TYPE()
123 static const std::string ATTR_ID("offset_type");
127 /// Attribute name for offset type by distance.
128 inline static const std::string& OFFSET_TYPE_BY_DISTANCE()
130 static const std::string ATTR_ID("offset_type_by_distance");
134 /// Attribute name for offset type by ratio.
135 inline static const std::string& OFFSET_TYPE_BY_RATIO()
137 static const std::string ATTR_ID("offset_type_by_ratio");
141 /// Attribute name for distance.
142 inline static const std::string& DISTANCE()
144 static const std::string ATTR_ID("distance");
148 /// Attribute name for percent flag.
149 inline static const std::string& RATIO()
151 static const std::string ATTR_ID("ratio");
155 /// Attribute name for reverse flag.
156 inline static const std::string& REVERSE()
158 static const std::string ATTR_ID("reverse");
162 /// Attribute name for point to projection.
163 inline static const std::string& POINT_TO_PROJECT()
165 static const std::string ATTR_ID("point_to_project");
169 /// Attribute name for projection type.
170 inline static const std::string& PROJECTION_TYPE()
172 static const std::string ATTR_ID("projection_type");
176 /// Attribute name for projection type on edge.
177 inline static const std::string& PROJECTION_TYPE_ON_EDGE()
179 static const std::string ATTR_ID("projection_type_on_edge");
183 /// Attribute name for projection type on face.
184 inline static const std::string& PROJECTION_TYPE_ON_FACE()
186 static const std::string ATTR_ID("projection_type_on_face");
190 /// Attribute name for edge for point projection.
191 inline static const std::string& EDGE_FOR_POINT_PROJECTION()
193 static const std::string ATTR_ID("edge_for_point_projection");
197 /// Attribute name for face for point projection.
198 inline static const std::string& FACE_FOR_POINT_PROJECTION()
200 static const std::string ATTR_ID("face_for_point_projection");
204 /// Attribute name for intersection type.
205 inline static const std::string& INTERSECTION_TYPE()
207 static const std::string ATTR_ID("intersection_type");
211 /// Attribute name for intersection type by lines.
212 inline static const std::string& INTERSECTION_TYPE_BY_LINES()
214 static const std::string MY_CREATION_METHOD_ID("intersection_type_by_lines");
215 return MY_CREATION_METHOD_ID;
218 /// Attribute name for intersection type by line and plane.
219 inline static const std::string& INTERSECTION_TYPE_BY_LINE_AND_PLANE()
221 static const std::string MY_CREATION_METHOD_ID("intersection_type_by_line_and_plane");
222 return MY_CREATION_METHOD_ID;
225 /// Attribute name for intersection type by planes.
226 inline static const std::string& INTERSECTION_TYPE_BY_PLANES()
228 static const std::string MY_CREATION_METHOD_ID("intersection_type_by_planes");
229 return MY_CREATION_METHOD_ID;
232 /// Attribute name for selected first intersection line.
233 inline static const std::string& INTERSECTION_LINE_1()
235 static const std::string ATTR_ID("intersection_line_1");
239 /// Attribute name for selected second intersection line.
240 inline static const std::string& INTERSECTION_LINE_2()
242 static const std::string ATTR_ID("intersection_line_2");
246 /// Attribute name for selected intersection line.
247 inline static const std::string& INTERSECTION_LINE()
249 static const std::string ATTR_ID("intersection_line");
253 /// Attribute name for selected intersection plane.
254 inline static const std::string& INTERSECTION_PLANE()
256 static const std::string ATTR_ID("intersection_plane");
260 /// Attribute name for use offset for the intersection plane.
261 inline static const std::string& USE_OFFSET()
263 static const std::string ATTR_ID("use_offset");
267 /// Attribute name for offset for the intersection plane.
268 inline static const std::string& OFFSET()
270 static const std::string ATTR_ID("offset");
274 /// Attribute name for reverse offset for the intersection plane.
275 inline static const std::string& REVERSE_OFFSET()
277 static const std::string ATTR_ID("reverse_offset");
281 /// Attribute name for selected intersection plane.
282 inline static const std::string& INTERSECTION_PLANE_1()
284 static const std::string ATTR_ID("intersection_plane_1");
288 /// Attribute name for selected intersection plane.
289 inline static const std::string& INTERSECTION_PLANE_2()
291 static const std::string ATTR_ID("intersection_plane_2");
295 /// Attribute name for selected intersection plane.
296 inline static const std::string& INTERSECTION_PLANE_3()
298 static const std::string ATTR_ID("intersection_plane_3");
302 /// Attribute name for property type.
303 inline static const std::string& GEOMETRICAL_PROPERTY_TYPE()
305 static const std::string ATTR_ID("geometrical_property_type");
309 /// Attribute name for property type by center of gravity.
310 inline static const std::string& GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_GRAVITY()
312 static const std::string PROPERTY_TYPE("geometrical_property_type_by_center_of_gravity");
313 return PROPERTY_TYPE;
316 /// Attribute name for property type by center of circle.
317 inline static const std::string& GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_CIRCLE()
319 static const std::string PROPERTY_TYPE("geometrical_property_type_by_center_of_circle");
320 return PROPERTY_TYPE;
323 /// Attribute name for selected object for center of gravity.
324 inline static const std::string& OBJECT_FOR_CENTER_OF_GRAVITY()
326 static const std::string ATTR_ID("object_for_center_of_gravity");
330 /// Attribute name for selected object for center of cricle.
331 inline static const std::string& OBJECT_FOR_CENTER_OF_CIRCLE()
333 static const std::string ATTR_ID("object_for_center_of_circle");
337 /// Creates a new part document if needed.
338 CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
340 /// Request for initialization of data model of the feature: adding all attributes.
341 CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes();
343 /// Construction result is allways recomuted on the fly.
344 CONSTRUCTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
346 /// Use plugin manager for features creation
347 ConstructionPlugin_Point();
349 /// Customize presentation of the feature
350 virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
351 std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs);
354 std::shared_ptr<GeomAPI_Vertex> createByXYZ();
355 std::shared_ptr<GeomAPI_Vertex> createByDistanceOnEdge();
356 std::shared_ptr<GeomAPI_Vertex> createByProjectionOnEdge();
357 std::shared_ptr<GeomAPI_Vertex> createByProjectionOnFace();
358 std::shared_ptr<GeomAPI_Vertex> createByLinesIntersection();
359 std::list<std::shared_ptr<GeomAPI_Vertex> > createByLineAndPlaneIntersection();
360 std::shared_ptr<GeomAPI_Vertex> createByPlanesIntersection();
361 std::shared_ptr<GeomAPI_Vertex> createByCenterOfGravity();
362 std::shared_ptr<GeomAPI_Vertex> createByCenterOfCircle();