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>
32 /// \class ConstructionPlugin_Point
34 /// \brief Feature for creation of the new part in PartSet.
35 class ConstructionPlugin_Point: public ModelAPI_Feature, public GeomAPI_ICustomPrs
38 /// Returns the kind of a feature.
39 CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind();
42 inline static const std::string& ID()
44 static const std::string CONSTRUCTION_POINT_KIND("Point");
45 return CONSTRUCTION_POINT_KIND;
48 /*/// Attribute name for creation method.
49 inline static const std::string& CREATION_METHOD()
51 static const std::string MY_CREATION_METHOD_ID("creation_method");
52 return MY_CREATION_METHOD_ID;
55 /// Attribute name for creation method.
56 inline static const std::string& CREATION_METHOD_BY_XYZ()
58 static const std::string MY_CREATION_METHOD_ID("by_xyz");
59 return MY_CREATION_METHOD_ID;
62 /// Attribute name for creation method.
63 inline static const std::string& CREATION_METHOD_BY_DISTANCE_ON_EDGE()
65 static const std::string MY_CREATION_METHOD_ID("by_distance_on_edge");
66 return MY_CREATION_METHOD_ID;
69 /// Attribute name for creation method.
70 inline static const std::string& CREATION_METHOD_BY_PROJECTION()
72 static const std::string MY_CREATION_METHOD_ID("by_projection");
73 return MY_CREATION_METHOD_ID;
76 /// Attribute name for creation method.
77 inline static const std::string& CREATION_METHOD_BY_LINES_INTERSECTION()
79 static const std::string MY_CREATION_METHOD_ID("by_lines_intersection");
80 return MY_CREATION_METHOD_ID;
83 /// Attribute name for creation method.
84 inline static const std::string& CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION()
86 static const std::string MY_CREATION_METHOD_ID("by_line_and_plane_intersection");
87 return MY_CREATION_METHOD_ID;
90 /// Attribute name for X coordinate.
91 inline static const std::string& X()
93 static const std::string POINT_ATTR_X("x");
97 /// Attribute name for Y coordinate.
98 inline static const std::string& Y()
100 static const std::string POINT_ATTR_Y("y");
104 /// Attribute name for Z coordinate.
105 inline static const std::string& Z()
107 static const std::string POINT_ATTR_Z("z");
111 /*/// Attribute name for selected edge.
112 inline static const std::string& EDGE()
114 static const std::string ATTR_ID("edge");
118 /// Attribute name for distance.
119 inline static const std::string& DISTANCE_VALUE()
121 static const std::string ATTR_ID("value");
125 /// Attribute name for percent flag.
126 inline static const std::string& DISTANCE_PERCENT()
128 static const std::string ATTR_ID("percent");
132 /// Attribute name for reverse flag.
133 inline static const std::string& REVERSE()
135 static const std::string ATTR_ID("reverse");
139 /// Attribute name for point.
140 inline static const std::string& POINT()
142 static const std::string ATTR_ID("point");
146 /// Attribute name for plane.
147 inline static const std::string& PLANE()
149 static const std::string ATTR_ID("plane");
153 /// Attribute name for selected first line.
154 inline static const std::string& FIRST_LINE()
156 static const std::string ATTR_ID("first_line");
160 /// Attribute name for selected second line.
161 inline static const std::string& SECOND_LINE()
163 static const std::string ATTR_ID("second_line");
167 /// Attribute name for selected intersection line.
168 inline static const std::string& INTERSECTION_LINE()
170 static const std::string ATTR_ID("intersection_line");
174 /// Attribute name for selected intersection plane.
175 inline static const std::string& INTERSECTION_PLANE()
177 static const std::string ATTR_ID("intersection_plane");
181 /// Creates a new part document if needed.
182 CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
184 /// Request for initialization of data model of the feature: adding all attributes.
185 CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes();
187 /// Construction result is allways recomuted on the fly.
188 CONSTRUCTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
190 /// Use plugin manager for features creation
191 ConstructionPlugin_Point();
193 /// Customize presentation of the feature
194 virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
195 std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs);
198 std::shared_ptr<GeomAPI_Vertex> createByXYZ();
199 /*std::shared_ptr<GeomAPI_Vertex> createByDistanceOnEdge();
200 std::shared_ptr<GeomAPI_Vertex> createByProjection();
201 std::shared_ptr<GeomAPI_Vertex> createByLinesIntersection();
202 std::shared_ptr<GeomAPI_Vertex> createByLineAndPlaneIntersection();*/