Salome HOME
32e2878d58b7a2e1344f5948c7322a330a87118d
[modules/shaper.git] / ConstructionAPI_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 SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_
22 #define SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_
23
24 #include "ConstructionAPI.h"
25
26 #include <ConstructionPlugin_Point.h>
27
28 #include <ModelHighAPI_Interface.h>
29 #include <ModelHighAPI_Macro.h>
30
31 class ModelAPI_AttributeDouble;
32 class ModelAPI_Document;
33 class ModelHighAPI_Double;
34
35 /// \class ConstructionAPI_Point
36 /// \ingroup CPPHighAPI
37 /// \brief Interface for Point feature.
38 class ConstructionAPI_Point: public ModelHighAPI_Interface
39 {
40 public:
41   /// Constructor without values.
42   CONSTRUCTIONAPI_EXPORT
43   explicit ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature);
44
45   /// Constructor with values.
46   CONSTRUCTIONAPI_EXPORT
47   ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
48                         const ModelHighAPI_Double& theX,
49                         const ModelHighAPI_Double& theY,
50                         const ModelHighAPI_Double& theZ);
51
52   /// Constructor with values.
53   CONSTRUCTIONAPI_EXPORT
54   ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
55                         const ModelHighAPI_Selection& theEdge,
56                         const ModelHighAPI_Double& theOffset,
57                         const bool theUseRatio = false,
58                         const bool theReverse = false);
59
60   /// Constructor with values: intersected objects.
61   CONSTRUCTIONAPI_EXPORT
62   ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
63                         const ModelHighAPI_Selection& theObject1,
64                         const ModelHighAPI_Selection& theObject2);
65
66   /// Constructor with values: intersected objects.
67   CONSTRUCTIONAPI_EXPORT
68   ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
69                         const ModelHighAPI_Selection& theObject1,
70                         const ModelHighAPI_Selection& theObject2,
71                         const ModelHighAPI_Selection& theObject3);
72
73   /// Constructor with values: object and circular edge flag.
74   CONSTRUCTIONAPI_EXPORT
75   ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
76                         const ModelHighAPI_Selection& theObject,
77                         const bool theIsCircularEdge = false);
78
79   /// Destructor.
80   CONSTRUCTIONAPI_EXPORT
81   virtual ~ConstructionAPI_Point();
82
83   INTERFACE_25(ConstructionPlugin_Point::ID(),
84     point, ConstructionPlugin_Point::POINT3D(),
85     GeomDataAPI_Point, /** Point attribute */,
86     creationMethod, ConstructionPlugin_Point::CREATION_METHOD(),
87     ModelAPI_AttributeString, /** Creation method */,
88     intersectionType, ConstructionPlugin_Point::INTERSECTION_TYPE(),
89     ModelAPI_AttributeString, /** Type of the intersection */,
90     intersectionLine1, ConstructionPlugin_Point::INTERSECTION_LINE_1(),
91     ModelAPI_AttributeSelection, /** Line for intersection */,
92     intersectionLine2, ConstructionPlugin_Point::INTERSECTION_LINE_2(),
93     ModelAPI_AttributeSelection, /** Line for intersection */,
94     intersectionLine, ConstructionPlugin_Point::INTERSECTION_LINE(),
95     ModelAPI_AttributeSelection, /** Line for intersection */,
96     intersectionPlane, ConstructionPlugin_Point::INTERSECTION_PLANE(),
97     ModelAPI_AttributeSelection, /** Plane for intersection */,
98     intersectionPlane1, ConstructionPlugin_Point::INTERSECTION_PLANE_1(),
99     ModelAPI_AttributeSelection, /** Plane for intersection */,
100     intersectionPlane2, ConstructionPlugin_Point::INTERSECTION_PLANE_2(),
101     ModelAPI_AttributeSelection, /** Plane for intersection */,
102     intersectionPlane3, ConstructionPlugin_Point::INTERSECTION_PLANE_3(),
103     ModelAPI_AttributeSelection, /** Plane for intersection */,
104     useOffset, ConstructionPlugin_Point::USE_OFFSET(),
105     ModelAPI_AttributeString, /** Use offset */,
106     offset, ConstructionPlugin_Point::OFFSET(),
107     ModelAPI_AttributeDouble, /** Offset */,
108     reverseOffset, ConstructionPlugin_Point::REVERSE_OFFSET(),
109     ModelAPI_AttributeBoolean, /** Reverse offset */,
110     edge, ConstructionPlugin_Point::EDGE(),
111     ModelAPI_AttributeSelection, /** Edge */,
112     offsetType, ConstructionPlugin_Point::OFFSET_TYPE(),
113     ModelAPI_AttributeString, /** Type of the offset on edge */,
114     distance, ConstructionPlugin_Point::DISTANCE(),
115     ModelAPI_AttributeDouble, /** Distance */,
116     ratio, ConstructionPlugin_Point::RATIO(),
117     ModelAPI_AttributeDouble, /** Ratio */,
118     reverse, ConstructionPlugin_Point::REVERSE(),
119     ModelAPI_AttributeBoolean, /** Reverse */,
120     poinToProject, ConstructionPlugin_Point::POINT_TO_PROJECT(),
121     ModelAPI_AttributeSelection, /** Point to project*/,
122     projectionType, ConstructionPlugin_Point::PROJECTION_TYPE(),
123     ModelAPI_AttributeString, /** Type of the point projection */,
124     faceForPointProjection, ConstructionPlugin_Point::FACE_FOR_POINT_PROJECTION(),
125     ModelAPI_AttributeSelection, /** Face for point projection */,
126     edgeForPointProjection, ConstructionPlugin_Point::EDGE_FOR_POINT_PROJECTION(),
127     ModelAPI_AttributeSelection, /** Edge for point projection */,
128     geometricalPropertyType, ConstructionPlugin_Point::GEOMETRICAL_PROPERTY_TYPE(),
129     ModelAPI_AttributeString, /** Type of the geometrical property */,
130     objectForCenterOfGravity, ConstructionPlugin_Point::OBJECT_FOR_CENTER_OF_GRAVITY(),
131     ModelAPI_AttributeSelection, /** Object for center of gravity */,
132     objectForCenterOfCircle, ConstructionPlugin_Point::OBJECT_FOR_CENTER_OF_CIRCLE(),
133     ModelAPI_AttributeSelection, /** Object for center of circle */)
134
135   /// Set point values.
136   CONSTRUCTIONAPI_EXPORT
137   void setByXYZ(const ModelHighAPI_Double & theX,
138                 const ModelHighAPI_Double & theY,
139                 const ModelHighAPI_Double & theZ);
140
141   /// Set edge and distance on it for point.
142   CONSTRUCTIONAPI_EXPORT
143   void setByOffsetOnEdge(const ModelHighAPI_Selection& theEdge,
144                          const ModelHighAPI_Double& theOffset,
145                          const bool theUseRatio = false,
146                          const bool theReverse = false);
147
148   /// Set point and edge for projection.
149   CONSTRUCTIONAPI_EXPORT
150   void setByProjectionOnEdge(const ModelHighAPI_Selection& theVertex,
151                              const ModelHighAPI_Selection& theEdge);
152
153   /// Set point and face for projection.
154   CONSTRUCTIONAPI_EXPORT
155   void setByProjectionOnFace(const ModelHighAPI_Selection& theVertex,
156                              const ModelHighAPI_Selection& theFace);
157
158   /// Set lines for intersections.
159   CONSTRUCTIONAPI_EXPORT
160   void setByLinesIntersection(const ModelHighAPI_Selection& theEdge1,
161                               const ModelHighAPI_Selection& theEdge2);
162
163   /// Set line and plane for intersections.
164   CONSTRUCTIONAPI_EXPORT
165   void setByLineAndPlaneIntersection(const ModelHighAPI_Selection& theEdge,
166                                      const ModelHighAPI_Selection& theFace);
167
168   /// Set faces for intersections.
169   CONSTRUCTIONAPI_EXPORT
170   void setByPlanesIntersection(const ModelHighAPI_Selection& theFace1,
171                                const ModelHighAPI_Selection& theFace2,
172                                const ModelHighAPI_Selection& theFace3);
173
174   /// Set object for center of gravity.
175   CONSTRUCTIONAPI_EXPORT
176   void setByCenterOfGravity(const ModelHighAPI_Selection& theObject);
177
178   /// Set object for center of circular edge.
179   CONSTRUCTIONAPI_EXPORT
180     void setByCenterOfCircle(const ModelHighAPI_Selection& theObject);
181
182   /// Dump wrapped feature
183   CONSTRUCTIONAPI_EXPORT
184   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
185 };
186
187 /// Pointer on Point object.
188 typedef std::shared_ptr<ConstructionAPI_Point> PointPtr;
189
190 /// \ingroup CPPHighAPI
191 /// \brief Create Point feature
192 CONSTRUCTIONAPI_EXPORT
193 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
194                   const ModelHighAPI_Double & theX,
195                   const ModelHighAPI_Double & theY,
196                   const ModelHighAPI_Double & theZ);
197
198 /// \ingroup CPPHighAPI
199 /// \brief Create Point feature
200 CONSTRUCTIONAPI_EXPORT
201 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
202                   const ModelHighAPI_Selection& theEdge,
203                   const ModelHighAPI_Double& theOffset,
204                   const bool theUseRatio = false,
205                   const bool theReverse = false);
206
207 /// \ingroup CPPHighAPI
208 /// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
209 CONSTRUCTIONAPI_EXPORT
210 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
211                   const ModelHighAPI_Selection& theObject1,
212                   const ModelHighAPI_Selection& theObject2);
213
214 /// \ingroup CPPHighAPI
215 /// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
216 /// with positive distance from the plane and flag to reverse the offset direction.
217 CONSTRUCTIONAPI_EXPORT
218 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
219                   const ModelHighAPI_Selection& theObject1,
220                   const ModelHighAPI_Selection& theObject2,
221                   const ModelHighAPI_Double& theDistanceValue,
222                   const bool theReverse = false);
223
224 /// \ingroup CPPHighAPI
225 /// \brief Create Point feature as an intersection of selected planes.
226 CONSTRUCTIONAPI_EXPORT
227 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
228                   const ModelHighAPI_Selection& theObject1,
229                   const ModelHighAPI_Selection& theObject2,
230                   const ModelHighAPI_Selection& theObject3);
231
232 /// \ingroup CPPHighAPI
233 /// \brief Create Point feature as a geometrical property.
234 CONSTRUCTIONAPI_EXPORT
235 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
236                   const ModelHighAPI_Selection& theObject,
237                   const bool theIsCircularEdge = false);
238
239 #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_ */