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 email : webmaster.salome@opencascade.com<mailto: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>
31 /// \class ConstructionPlugin_Point
33 /// \brief Feature for creation of the new part in PartSet.
34 class ConstructionPlugin_Point: public ModelAPI_Feature, public GeomAPI_ICustomPrs
37 /// Returns the kind of a feature.
38 CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind();
41 inline static const std::string& ID()
43 static const std::string CONSTRUCTION_POINT_KIND("Point");
44 return CONSTRUCTION_POINT_KIND;
47 /*/// Attribute name for creation method.
48 inline static const std::string& CREATION_METHOD()
50 static const std::string MY_CREATION_METHOD_ID("creation_method");
51 return MY_CREATION_METHOD_ID;
54 /// Attribute name for creation method.
55 inline static const std::string& CREATION_METHOD_BY_XYZ()
57 static const std::string MY_CREATION_METHOD_ID("by_xyz");
58 return MY_CREATION_METHOD_ID;
61 /// Attribute name for creation method.
62 inline static const std::string& CREATION_METHOD_BY_DISTANCE_ON_EDGE()
64 static const std::string MY_CREATION_METHOD_ID("by_distance_on_edge");
65 return MY_CREATION_METHOD_ID;
68 /// Attribute name for creation method.
69 inline static const std::string& CREATION_METHOD_BY_PROJECTION()
71 static const std::string MY_CREATION_METHOD_ID("by_projection");
72 return MY_CREATION_METHOD_ID;
75 /// Attribute name for creation method.
76 inline static const std::string& CREATION_METHOD_BY_LINES_INTERSECTION()
78 static const std::string MY_CREATION_METHOD_ID("by_lines_intersection");
79 return MY_CREATION_METHOD_ID;
82 /// Attribute name for creation method.
83 inline static const std::string& CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION()
85 static const std::string MY_CREATION_METHOD_ID("by_line_and_plane_intersection");
86 return MY_CREATION_METHOD_ID;
89 /// Attribute name for X coordinate.
90 inline static const std::string& X()
92 static const std::string POINT_ATTR_X("x");
96 /// Attribute name for Y coordinate.
97 inline static const std::string& Y()
99 static const std::string POINT_ATTR_Y("y");
103 /// Attribute name for Z coordinate.
104 inline static const std::string& Z()
106 static const std::string POINT_ATTR_Z("z");
110 /*/// Attribute name for selected edge.
111 inline static const std::string& EDGE()
113 static const std::string ATTR_ID("edge");
117 /// Attribute name for distance.
118 inline static const std::string& DISTANCE_VALUE()
120 static const std::string ATTR_ID("value");
124 /// Attribute name for percent flag.
125 inline static const std::string& DISTANCE_PERCENT()
127 static const std::string ATTR_ID("percent");
131 /// Attribute name for reverse flag.
132 inline static const std::string& REVERSE()
134 static const std::string ATTR_ID("reverse");
138 /// Attribute name for point.
139 inline static const std::string& POINT()
141 static const std::string ATTR_ID("point");
145 /// Attribute name for plane.
146 inline static const std::string& PLANE()
148 static const std::string ATTR_ID("plane");
152 /// Attribute name for selected first line.
153 inline static const std::string& FIRST_LINE()
155 static const std::string ATTR_ID("first_line");
159 /// Attribute name for selected second line.
160 inline static const std::string& SECOND_LINE()
162 static const std::string ATTR_ID("second_line");
166 /// Attribute name for selected intersection line.
167 inline static const std::string& INTERSECTION_LINE()
169 static const std::string ATTR_ID("intersection_line");
173 /// Attribute name for selected intersection plane.
174 inline static const std::string& INTERSECTION_PLANE()
176 static const std::string ATTR_ID("intersection_plane");
180 /// Creates a new part document if needed.
181 CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
183 /// Request for initialization of data model of the feature: adding all attributes.
184 CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes();
186 /// Construction result is allways recomuted on the fly.
187 CONSTRUCTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
189 /// Use plugin manager for features creation
190 ConstructionPlugin_Point();
192 /// Customize presentation of the feature
193 virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
194 std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs);
197 std::shared_ptr<GeomAPI_Vertex> createByXYZ();
198 /*std::shared_ptr<GeomAPI_Vertex> createByDistanceOnEdge();
199 std::shared_ptr<GeomAPI_Vertex> createByProjection();
200 std::shared_ptr<GeomAPI_Vertex> createByLinesIntersection();
201 std::shared_ptr<GeomAPI_Vertex> createByLineAndPlaneIntersection();*/