Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / ConstructionPlugin / ConstructionPlugin_Point.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef ConstructionPlugin_Point_H_
22 #define ConstructionPlugin_Point_H_
23
24 #include "ConstructionPlugin.h"
25
26 #include <GeomAPI_ICustomPrs.h>
27 #include <ModelAPI_Feature.h>
28 #include <ModelAPI_Result.h>
29
30 class GeomAPI_Vertex;
31
32 /// \class ConstructionPlugin_Point
33 /// \ingroup Plugins
34 /// \brief Feature for creation of the new part in PartSet.
35 class ConstructionPlugin_Point: public ModelAPI_Feature, public GeomAPI_ICustomPrs
36 {
37 public:
38   /// Returns the kind of a feature.
39   CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind();
40
41   /// Point kind.
42   inline static const std::string& ID()
43   {
44     static const std::string CONSTRUCTION_POINT_KIND("Point");
45     return CONSTRUCTION_POINT_KIND;
46   }
47
48   /*/// Attribute name for creation method.
49   inline static const std::string& CREATION_METHOD()
50   {
51     static const std::string MY_CREATION_METHOD_ID("creation_method");
52     return MY_CREATION_METHOD_ID;
53   }
54
55   /// Attribute name for creation method.
56   inline static const std::string& CREATION_METHOD_BY_XYZ()
57   {
58     static const std::string MY_CREATION_METHOD_ID("by_xyz");
59     return MY_CREATION_METHOD_ID;
60   }
61
62   /// Attribute name for creation method.
63   inline static const std::string& CREATION_METHOD_BY_DISTANCE_ON_EDGE()
64   {
65     static const std::string MY_CREATION_METHOD_ID("by_distance_on_edge");
66     return MY_CREATION_METHOD_ID;
67   }
68
69   /// Attribute name for creation method.
70   inline static const std::string& CREATION_METHOD_BY_PROJECTION()
71   {
72     static const std::string MY_CREATION_METHOD_ID("by_projection");
73     return MY_CREATION_METHOD_ID;
74   }
75
76   /// Attribute name for creation method.
77   inline static const std::string& CREATION_METHOD_BY_LINES_INTERSECTION()
78   {
79     static const std::string MY_CREATION_METHOD_ID("by_lines_intersection");
80     return MY_CREATION_METHOD_ID;
81   }
82
83   /// Attribute name for creation method.
84   inline static const std::string& CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION()
85   {
86     static const std::string MY_CREATION_METHOD_ID("by_line_and_plane_intersection");
87     return MY_CREATION_METHOD_ID;
88   }*/
89
90   /// Attribute name for X coordinate.
91   inline static const std::string& X()
92   {
93     static const std::string POINT_ATTR_X("x");
94     return POINT_ATTR_X;
95   }
96
97   /// Attribute name for Y coordinate.
98   inline static const std::string& Y()
99   {
100     static const std::string POINT_ATTR_Y("y");
101     return POINT_ATTR_Y;
102   }
103
104   /// Attribute name for Z coordinate.
105   inline static const std::string& Z()
106   {
107     static const std::string POINT_ATTR_Z("z");
108     return POINT_ATTR_Z;
109   }
110
111   /*/// Attribute name for selected edge.
112   inline static const std::string& EDGE()
113   {
114     static const std::string ATTR_ID("edge");
115     return ATTR_ID;
116   }
117
118   /// Attribute name for distance.
119   inline static const std::string& DISTANCE_VALUE()
120   {
121     static const std::string ATTR_ID("value");
122     return ATTR_ID;
123   }
124
125   /// Attribute name for percent flag.
126   inline static const std::string& DISTANCE_PERCENT()
127   {
128     static const std::string ATTR_ID("percent");
129     return ATTR_ID;
130   }
131
132   /// Attribute name for reverse flag.
133   inline static const std::string& REVERSE()
134   {
135     static const std::string ATTR_ID("reverse");
136     return ATTR_ID;
137   }
138
139   /// Attribute name for point.
140   inline static const std::string& POINT()
141   {
142     static const std::string ATTR_ID("point");
143     return ATTR_ID;
144   }
145
146   /// Attribute name for plane.
147   inline static const std::string& PLANE()
148   {
149     static const std::string ATTR_ID("plane");
150     return ATTR_ID;
151   }
152
153   /// Attribute name for selected first line.
154   inline static const std::string& FIRST_LINE()
155   {
156     static const std::string ATTR_ID("first_line");
157     return ATTR_ID;
158   }
159
160   /// Attribute name for selected second line.
161   inline static const std::string& SECOND_LINE()
162   {
163     static const std::string ATTR_ID("second_line");
164     return ATTR_ID;
165   }
166
167   /// Attribute name for selected intersection line.
168   inline static const std::string& INTERSECTION_LINE()
169   {
170     static const std::string ATTR_ID("intersection_line");
171     return ATTR_ID;
172   }
173
174   /// Attribute name for selected intersection plane.
175   inline static const std::string& INTERSECTION_PLANE()
176   {
177     static const std::string ATTR_ID("intersection_plane");
178     return ATTR_ID;
179   }*/
180
181   /// Creates a new part document if needed.
182   CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
183
184   /// Request for initialization of data model of the feature: adding all attributes.
185   CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes();
186
187   /// Construction result is allways recomuted on the fly.
188   CONSTRUCTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
189
190   /// Use plugin manager for features creation
191   ConstructionPlugin_Point();
192
193   /// Customize presentation of the feature
194   virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
195                                      std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs);
196
197 private:
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();*/
203
204 };
205
206 #endif