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