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