]> SALOME platform Git repositories - modules/shaper.git/blob - src/ConstructionAPI/ConstructionAPI_Point.h
Salome HOME
2.3.5 Point creation: by geometrical property
[modules/shaper.git] / src / ConstructionAPI / 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_27(ConstructionPlugin_Point::ID(),
84                x, ConstructionPlugin_Point::X(), ModelAPI_AttributeDouble, /** X attribute */,
85                y, ConstructionPlugin_Point::Y(), ModelAPI_AttributeDouble, /** Y attribute */,
86                z, ConstructionPlugin_Point::Z(), ModelAPI_AttributeDouble, /** Z 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                poinToProject, 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 #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_ */