]> SALOME platform Git repositories - modules/shaper.git/blob - src/ConstructionAPI/ConstructionAPI_Point.h
Salome HOME
ce20c53990f1018f27ba8f3d52680ecb673e5cee
[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   /// May be used for creation of point by coordinates using selection-vertex.
74   CONSTRUCTIONAPI_EXPORT
75   ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
76                         const ModelHighAPI_Selection& theObject,
77                         const bool theIsCircularEdge = false,
78                         const bool theIsXYZSelection = false);
79
80   /// Destructor.
81   CONSTRUCTIONAPI_EXPORT
82   virtual ~ConstructionAPI_Point();
83
84   INTERFACE_25(ConstructionPlugin_Point::ID(),
85     point, ConstructionPlugin_Point::POINT3D(),
86     GeomDataAPI_Point, /** Point attribute */,
87     creationMethod, ConstructionPlugin_Point::CREATION_METHOD(),
88     ModelAPI_AttributeString, /** Creation method */,
89     intersectionType, ConstructionPlugin_Point::INTERSECTION_TYPE(),
90     ModelAPI_AttributeString, /** Type of the intersection */,
91     intersectionLine1, ConstructionPlugin_Point::INTERSECTION_LINE_1(),
92     ModelAPI_AttributeSelection, /** Line for intersection */,
93     intersectionLine2, ConstructionPlugin_Point::INTERSECTION_LINE_2(),
94     ModelAPI_AttributeSelection, /** Line for intersection */,
95     intersectionLine, ConstructionPlugin_Point::INTERSECTION_LINE(),
96     ModelAPI_AttributeSelection, /** Line for intersection */,
97     intersectionPlane, ConstructionPlugin_Point::INTERSECTION_PLANE(),
98     ModelAPI_AttributeSelection, /** Plane for intersection */,
99     intersectionPlane1, ConstructionPlugin_Point::INTERSECTION_PLANE_1(),
100     ModelAPI_AttributeSelection, /** Plane for intersection */,
101     intersectionPlane2, ConstructionPlugin_Point::INTERSECTION_PLANE_2(),
102     ModelAPI_AttributeSelection, /** Plane for intersection */,
103     intersectionPlane3, ConstructionPlugin_Point::INTERSECTION_PLANE_3(),
104     ModelAPI_AttributeSelection, /** Plane for intersection */,
105     useOffset, ConstructionPlugin_Point::USE_OFFSET(),
106     ModelAPI_AttributeString, /** Use offset */,
107     offset, ConstructionPlugin_Point::OFFSET(),
108     ModelAPI_AttributeDouble, /** Offset */,
109     reverseOffset, ConstructionPlugin_Point::REVERSE_OFFSET(),
110     ModelAPI_AttributeBoolean, /** Reverse offset */,
111     edge, ConstructionPlugin_Point::EDGE(),
112     ModelAPI_AttributeSelection, /** Edge */,
113     offsetType, ConstructionPlugin_Point::OFFSET_TYPE(),
114     ModelAPI_AttributeString, /** Type of the offset on edge */,
115     distance, ConstructionPlugin_Point::DISTANCE(),
116     ModelAPI_AttributeDouble, /** Distance */,
117     ratio, ConstructionPlugin_Point::RATIO(),
118     ModelAPI_AttributeDouble, /** Ratio */,
119     reverse, ConstructionPlugin_Point::REVERSE(),
120     ModelAPI_AttributeBoolean, /** Reverse */,
121     pointToProject, ConstructionPlugin_Point::POINT_TO_PROJECT(),
122     ModelAPI_AttributeSelection, /** Point to project*/,
123     projectionType, ConstructionPlugin_Point::PROJECTION_TYPE(),
124     ModelAPI_AttributeString, /** Type of the point projection */,
125     faceForPointProjection, ConstructionPlugin_Point::FACE_FOR_POINT_PROJECTION(),
126     ModelAPI_AttributeSelection, /** Face for point projection */,
127     edgeForPointProjection, ConstructionPlugin_Point::EDGE_FOR_POINT_PROJECTION(),
128     ModelAPI_AttributeSelection, /** Edge for point projection */,
129     geometricalPropertyType, ConstructionPlugin_Point::GEOMETRICAL_PROPERTY_TYPE(),
130     ModelAPI_AttributeString, /** Type of the geometrical property */,
131     objectForCenterOfGravity, ConstructionPlugin_Point::OBJECT_FOR_CENTER_OF_GRAVITY(),
132     ModelAPI_AttributeSelection, /** Object for center of gravity */,
133     objectForCenterOfCircle, ConstructionPlugin_Point::OBJECT_FOR_CENTER_OF_CIRCLE(),
134     ModelAPI_AttributeSelection, /** Object for center of circle */)
135
136   /// Set point values.
137   CONSTRUCTIONAPI_EXPORT
138   void setByXYZ(const ModelHighAPI_Double & theX,
139                 const ModelHighAPI_Double & theY,
140                 const ModelHighAPI_Double & theZ);
141
142   /// Set edge and distance on it for point.
143   CONSTRUCTIONAPI_EXPORT
144   void setByOffsetOnEdge(const ModelHighAPI_Selection& theEdge,
145                          const ModelHighAPI_Double& theOffset,
146                          const bool theUseRatio = false,
147                          const bool theReverse = false);
148
149   /// Set point and edge for projection.
150   CONSTRUCTIONAPI_EXPORT
151   void setByProjectionOnEdge(const ModelHighAPI_Selection& theVertex,
152                              const ModelHighAPI_Selection& theEdge);
153
154   /// Set point and face for projection.
155   CONSTRUCTIONAPI_EXPORT
156   void setByProjectionOnFace(const ModelHighAPI_Selection& theVertex,
157                              const ModelHighAPI_Selection& theFace);
158
159   /// Set lines for intersections.
160   CONSTRUCTIONAPI_EXPORT
161   void setByLinesIntersection(const ModelHighAPI_Selection& theEdge1,
162                               const ModelHighAPI_Selection& theEdge2);
163
164   /// Set line and plane for intersections.
165   CONSTRUCTIONAPI_EXPORT
166   void setByLineAndPlaneIntersection(const ModelHighAPI_Selection& theEdge,
167                                      const ModelHighAPI_Selection& theFace);
168
169   /// Set faces for intersections.
170   CONSTRUCTIONAPI_EXPORT
171   void setByPlanesIntersection(const ModelHighAPI_Selection& theFace1,
172                                const ModelHighAPI_Selection& theFace2,
173                                const ModelHighAPI_Selection& theFace3);
174
175   /// Set object for center of gravity.
176   CONSTRUCTIONAPI_EXPORT
177   void setByCenterOfGravity(const ModelHighAPI_Selection& theObject);
178
179   /// Set object for center of circular edge.
180   CONSTRUCTIONAPI_EXPORT
181     void setByCenterOfCircle(const ModelHighAPI_Selection& theObject);
182
183   /// Dump wrapped feature
184   CONSTRUCTIONAPI_EXPORT
185   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
186 };
187
188 /// Pointer on Point object.
189 typedef std::shared_ptr<ConstructionAPI_Point> PointPtr;
190
191 /// \ingroup CPPHighAPI
192 /// \brief Create Point feature
193 CONSTRUCTIONAPI_EXPORT
194 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
195                   const ModelHighAPI_Double & theX,
196                   const ModelHighAPI_Double & theY,
197                   const ModelHighAPI_Double & theZ);
198
199 /// \ingroup CPPHighAPI
200 /// \brief Create Point feature
201 CONSTRUCTIONAPI_EXPORT
202 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
203                   const ModelHighAPI_Selection& theEdge,
204                   const ModelHighAPI_Double& theOffset,
205                   const bool theUseRatio = false,
206                   const bool theReverse = false);
207
208 /// \ingroup CPPHighAPI
209 /// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
210 CONSTRUCTIONAPI_EXPORT
211 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
212                   const ModelHighAPI_Selection& theObject1,
213                   const ModelHighAPI_Selection& theObject2);
214
215 /// \ingroup CPPHighAPI
216 /// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
217 /// with positive distance from the plane and flag to reverse the offset direction.
218 CONSTRUCTIONAPI_EXPORT
219 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
220                   const ModelHighAPI_Selection& theObject1,
221                   const ModelHighAPI_Selection& theObject2,
222                   const ModelHighAPI_Double& theDistanceValue,
223                   const bool theReverse = false);
224
225 /// \ingroup CPPHighAPI
226 /// \brief Create Point feature as an intersection of selected planes.
227 CONSTRUCTIONAPI_EXPORT
228 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
229                   const ModelHighAPI_Selection& theObject1,
230                   const ModelHighAPI_Selection& theObject2,
231                   const ModelHighAPI_Selection& theObject3);
232
233 /// \ingroup CPPHighAPI
234 /// \brief Create Point feature as a geometrical property.
235 CONSTRUCTIONAPI_EXPORT
236 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
237                   const ModelHighAPI_Selection& theObject,
238                   const bool theIsCircularEdge = false);
239
240 /// \ingroup CPPHighAPI
241 /// \brief Create Point feature by coordinates using the selected vertex.
242 CONSTRUCTIONAPI_EXPORT
243 PointPtr addPointXYZ(const std::shared_ptr<ModelAPI_Document> & thePart,
244                      const ModelHighAPI_Selection& theObject);
245
246 #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_ */