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