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_ON_EDGE()
74 static const std::string MY_CREATION_METHOD_ID("by_projection_on_edge");
75 return MY_CREATION_METHOD_ID;
78 /// Attribute name for creation method.
79 inline static const std::string& CREATION_METHOD_BY_PROJECTION_ON_FACE()
81 static const std::string MY_CREATION_METHOD_ID("by_projection_on_face");
82 return MY_CREATION_METHOD_ID;
86 /// Attribute name for creation method.
87 inline static const std::string& CREATION_METHOD_BY_LINES_INTERSECTION()
89 static const std::string MY_CREATION_METHOD_ID("by_lines_intersection");
90 return MY_CREATION_METHOD_ID;
94 /// Attribute name for creation method.
95 inline static const std::string& CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION()
97 static const std::string MY_CREATION_METHOD_ID("by_line_and_plane_intersection");
98 return MY_CREATION_METHOD_ID;
101 /// Attribute name for X coordinate.
102 inline static const std::string& X()
104 static const std::string POINT_ATTR_X("x");
108 /// Attribute name for Y coordinate.
109 inline static const std::string& Y()
111 static const std::string POINT_ATTR_Y("y");
115 /// Attribute name for Z coordinate.
116 inline static const std::string& Z()
118 static const std::string POINT_ATTR_Z("z");
122 /// Attribute name for selected edge.
123 inline static const std::string& EDGE()
125 static const std::string ATTR_ID("edge");
129 /// Attribute name for offset type on selected edge.
130 inline static const std::string& OFFSET_TYPE()
132 static const std::string ATTR_ID("offset_type");
136 /// Attribute name for offset type by distance.
137 inline static const std::string& OFFSET_TYPE_BY_DISTANCE()
139 static const std::string ATTR_ID("offset_type_by_distance");
143 /// Attribute name for offset type by ratio.
144 inline static const std::string& OFFSET_TYPE_BY_RATIO()
146 static const std::string ATTR_ID("offset_type_by_ratio");
150 /// Attribute name for distance.
151 inline static const std::string& DISTANCE()
153 static const std::string ATTR_ID("distance");
157 /// Attribute name for percent flag.
158 inline static const std::string& RATIO()
160 static const std::string ATTR_ID("ratio");
164 /// Attribute name for reverse flag.
165 inline static const std::string& REVERSE()
167 static const std::string ATTR_ID("reverse");
171 /// Attribute name for point to project on edge.
172 inline static const std::string& POINT_TO_PROJECT_ON_EDGE()
174 static const std::string ATTR_ID("point_to_project_on_edge");
178 /// Attribute name for edge for point projection.
179 inline static const std::string& EDGE_FOR_POINT_PROJECTION()
181 static const std::string ATTR_ID("edge_for_point_projection");
185 /// Attribute name for point to project on surface.
186 inline static const std::string& POINT_TO_PROJECT_ON_FACE()
188 static const std::string ATTR_ID("point_to_project_on_face");
192 /// Attribute name for face for point projection.
193 inline static const std::string& FACE_FOR_POINT_PROJECTION()
195 static const std::string ATTR_ID("face_for_point_projection");
200 /// Attribute name for selected first line.
201 inline static const std::string& FIRST_LINE()
203 static const std::string ATTR_ID("first_line");
207 /// Attribute name for selected second line.
208 inline static const std::string& SECOND_LINE()
210 static const std::string ATTR_ID("second_line");
215 /// Attribute name for selected intersection line.
216 inline static const std::string& INTERSECTION_LINE()
218 static const std::string ATTR_ID("intersection_line");
222 /// Attribute name for selected intersection plane.
223 inline static const std::string& INTERSECTION_PLANE()
225 static const std::string ATTR_ID("intersection_plane");
229 /// Attribute name for use offset for the intersection plane.
230 inline static const std::string& USE_OFFSET()
232 static const std::string ATTR_ID("use_offset");
236 /// Attribute name for offset for the intersection plane.
237 inline static const std::string& OFFSET()
239 static const std::string ATTR_ID("offset");
243 /// Attribute name for reverse offset for the intersection plane.
244 inline static const std::string& REVERSE_OFFSET()
246 static const std::string ATTR_ID("reverse_offset");
250 /// Creates a new part document if needed.
251 CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
253 /// Request for initialization of data model of the feature: adding all attributes.
254 CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes();
256 /// Construction result is allways recomuted on the fly.
257 CONSTRUCTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
259 /// Use plugin manager for features creation
260 ConstructionPlugin_Point();
262 /// Customize presentation of the feature
263 virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
264 std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs);
267 std::shared_ptr<GeomAPI_Vertex> createByXYZ();
268 std::shared_ptr<GeomAPI_Vertex> createByDistanceOnEdge();
269 std::shared_ptr<GeomAPI_Vertex> createByProjectionOnEdge();
270 std::shared_ptr<GeomAPI_Vertex> createByProjectionOnFace();
271 /*std::shared_ptr<GeomAPI_Vertex> createByLinesIntersection();*/
272 std::list<std::shared_ptr<GeomAPI_Vertex> > createByLineAndPlaneIntersection();