1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ConstructionPlugin_Point.h
5 // Author: Mikhail PONIKAROV
7 #ifndef ConstructionPlugin_Point_H_
8 #define ConstructionPlugin_Point_H_
10 #include "ConstructionPlugin.h"
12 #include <GeomAPI_ICustomPrs.h>
13 #include <ModelAPI_Feature.h>
14 #include <ModelAPI_Result.h>
18 /// \class ConstructionPlugin_Point
20 /// \brief Feature for creation of the new part in PartSet.
21 class ConstructionPlugin_Point: public ModelAPI_Feature, public GeomAPI_ICustomPrs
24 /// Returns the kind of a feature.
25 CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind();
28 inline static const std::string& ID()
30 static const std::string CONSTRUCTION_POINT_KIND("Point");
31 return CONSTRUCTION_POINT_KIND;
34 /// Attribute name for creation method.
35 inline static const std::string& CREATION_METHOD()
37 static const std::string MY_CREATION_METHOD_ID("creation_method");
38 return MY_CREATION_METHOD_ID;
41 /// Attribute name for creation method.
42 inline static const std::string& CREATION_METHOD_BY_XYZ()
44 static const std::string MY_CREATION_METHOD_ID("by_xyz");
45 return MY_CREATION_METHOD_ID;
48 /// Attribute name for creation method.
49 inline static const std::string& CREATION_METHOD_BY_DISTANCE_ON_EDGE()
51 static const std::string MY_CREATION_METHOD_ID("by_distance_on_edge");
52 return MY_CREATION_METHOD_ID;
55 /// Attribute name for creation method.
56 inline static const std::string& CREATION_METHOD_BY_PROJECTION()
58 static const std::string MY_CREATION_METHOD_ID("by_projection");
59 return MY_CREATION_METHOD_ID;
62 /// Attribute name for creation method.
63 inline static const std::string& CREATION_METHOD_BY_LINES_INTERSECTION()
65 static const std::string MY_CREATION_METHOD_ID("by_lines_intersection");
66 return MY_CREATION_METHOD_ID;
69 /// Attribute name for X coordinate.
70 inline static const std::string& X()
72 static const std::string POINT_ATTR_X("x");
76 /// Attribute name for Y coordinate.
77 inline static const std::string& Y()
79 static const std::string POINT_ATTR_Y("y");
83 /// Attribute name for Z coordinate.
84 inline static const std::string& Z()
86 static const std::string POINT_ATTR_Z("z");
90 /// Attribute name for seleted edge.
91 inline static const std::string& EDGE()
93 static const std::string ATTR_ID("edge");
97 /// Attribute name for distance.
98 inline static const std::string& DISTANCE_VALUE()
100 static const std::string ATTR_ID("value");
104 /// Attribute name for percent flag.
105 inline static const std::string& DISTANCE_PERCENT()
107 static const std::string ATTR_ID("percent");
111 /// Attribute name for reverse flag.
112 inline static const std::string& REVERSE()
114 static const std::string ATTR_ID("reverse");
118 /// Attribute name for point.
119 inline static const std::string& POINT()
121 static const std::string ATTR_ID("point");
125 /// Attribute name for plane.
126 inline static const std::string& PLANE()
128 static const std::string ATTR_ID("plane");
132 /// Attribute name for seleted first line.
133 inline static const std::string& FIRST_LINE()
135 static const std::string ATTR_ID("first_line");
139 /// Attribute name for seleted second line.
140 inline static const std::string& SECOND_LINE()
142 static const std::string ATTR_ID("second_line");
146 /// Creates a new part document if needed.
147 CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
149 /// Request for initialization of data model of the feature: adding all attributes.
150 CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes();
152 /// Construction result is allways recomuted on the fly.
153 CONSTRUCTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
155 /// Use plugin manager for features creation
156 ConstructionPlugin_Point();
158 /// Customize presentation of the feature
159 virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
160 std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs);
163 std::shared_ptr<GeomAPI_Vertex> createByXYZ();
164 std::shared_ptr<GeomAPI_Vertex> createByDistanceOnEdge();
165 std::shared_ptr<GeomAPI_Vertex> createByProjection();
166 std::shared_ptr<GeomAPI_Vertex> createByIntersection();