1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_
21 #define SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_
23 #include "ConstructionAPI.h"
25 #include <ConstructionPlugin_Point.h>
27 #include <ModelHighAPI_Interface.h>
28 #include <ModelHighAPI_Macro.h>
30 class ModelAPI_AttributeDouble;
31 class ModelAPI_Document;
32 class ModelHighAPI_Double;
34 /// \class ConstructionAPI_Point
35 /// \ingroup CPPHighAPI
36 /// \brief Interface for Point feature.
37 class ConstructionAPI_Point: public ModelHighAPI_Interface
40 /// Constructor without values.
41 CONSTRUCTIONAPI_EXPORT
42 explicit ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature);
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);
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);
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);
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);
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);
79 CONSTRUCTIONAPI_EXPORT
80 virtual ~ConstructionAPI_Point();
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 */)
134 /// Set point values.
135 CONSTRUCTIONAPI_EXPORT
136 void setByXYZ(const ModelHighAPI_Double & theX,
137 const ModelHighAPI_Double & theY,
138 const ModelHighAPI_Double & theZ);
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);
147 /// Set point and edge for projection.
148 CONSTRUCTIONAPI_EXPORT
149 void setByProjectionOnEdge(const ModelHighAPI_Selection& theVertex,
150 const ModelHighAPI_Selection& theEdge);
152 /// Set point and face for projection.
153 CONSTRUCTIONAPI_EXPORT
154 void setByProjectionOnFace(const ModelHighAPI_Selection& theVertex,
155 const ModelHighAPI_Selection& theFace);
157 /// Set lines for intersections.
158 CONSTRUCTIONAPI_EXPORT
159 void setByLinesIntersection(const ModelHighAPI_Selection& theEdge1,
160 const ModelHighAPI_Selection& theEdge2);
162 /// Set line and plane for intersections.
163 CONSTRUCTIONAPI_EXPORT
164 void setByLineAndPlaneIntersection(const ModelHighAPI_Selection& theEdge,
165 const ModelHighAPI_Selection& theFace);
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);
173 /// Set object for center of gravity.
174 CONSTRUCTIONAPI_EXPORT
175 void setByCenterOfGravity(const ModelHighAPI_Selection& theObject);
177 /// Set object for center of circular edge.
178 CONSTRUCTIONAPI_EXPORT
179 void setByCenterOfCircle(const ModelHighAPI_Selection& theObject);
181 /// Dump wrapped feature
182 CONSTRUCTIONAPI_EXPORT
183 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
186 /// Pointer on Point object.
187 typedef std::shared_ptr<ConstructionAPI_Point> PointPtr;
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);
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);
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);
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);
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);
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);
238 #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_ */