1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_
22 #define SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_
24 #include "ConstructionAPI.h"
26 #include <ConstructionPlugin_Point.h>
28 #include <ModelHighAPI_Interface.h>
29 #include <ModelHighAPI_Macro.h>
31 class ModelAPI_AttributeDouble;
32 class ModelAPI_Document;
33 class ModelHighAPI_Double;
35 /// \class ConstructionAPI_Point
36 /// \ingroup CPPHighAPI
37 /// \brief Interface for Point feature.
38 class ConstructionAPI_Point: public ModelHighAPI_Interface
41 /// Constructor without values.
42 CONSTRUCTIONAPI_EXPORT
43 explicit ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature);
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);
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);
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);
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);
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);
80 CONSTRUCTIONAPI_EXPORT
81 virtual ~ConstructionAPI_Point();
83 INTERFACE_25(ConstructionPlugin_Point::ID(),
84 point, ConstructionPlugin_Point::point3d(), 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 poinToProject, 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_ */