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(), ModelAPI_AttributeString, /** Creation method */,
86 intersectionType, ConstructionPlugin_Point::INTERSECTION_TYPE(), ModelAPI_AttributeString, /** Type of the intersection */,
87 intersectionLine1, ConstructionPlugin_Point::INTERSECTION_LINE_1(), ModelAPI_AttributeSelection, /** Line for intersection */,
88 intersectionLine2, ConstructionPlugin_Point::INTERSECTION_LINE_2(), ModelAPI_AttributeSelection, /** Line for intersection */,
89 intersectionLine, ConstructionPlugin_Point::INTERSECTION_LINE(), ModelAPI_AttributeSelection, /** Line for intersection */,
90 intersectionPlane, ConstructionPlugin_Point::INTERSECTION_PLANE(), ModelAPI_AttributeSelection, /** Plane for intersection */,
91 intersectionPlane1, ConstructionPlugin_Point::INTERSECTION_PLANE_1(), ModelAPI_AttributeSelection, /** Plane for intersection */,
92 intersectionPlane2, ConstructionPlugin_Point::INTERSECTION_PLANE_2(), ModelAPI_AttributeSelection, /** Plane for intersection */,
93 intersectionPlane3, ConstructionPlugin_Point::INTERSECTION_PLANE_3(), ModelAPI_AttributeSelection, /** Plane for intersection */,
94 useOffset, ConstructionPlugin_Point::USE_OFFSET(), ModelAPI_AttributeString, /** Use offset */,
95 offset, ConstructionPlugin_Point::OFFSET(), ModelAPI_AttributeDouble, /** Offset */,
96 reverseOffset, ConstructionPlugin_Point::REVERSE_OFFSET(), ModelAPI_AttributeBoolean, /** Reverse offset */,
97 edge, ConstructionPlugin_Point::EDGE(), ModelAPI_AttributeSelection, /** Edge */,
98 offsetType, ConstructionPlugin_Point::OFFSET_TYPE(), ModelAPI_AttributeString, /** Type of the offset on edge */,
99 distance, ConstructionPlugin_Point::DISTANCE(), ModelAPI_AttributeDouble, /** Distance */,
100 ratio, ConstructionPlugin_Point::RATIO(), ModelAPI_AttributeDouble, /** Ratio */,
101 reverse, ConstructionPlugin_Point::REVERSE(), ModelAPI_AttributeBoolean, /** Reverse */,
102 poinToProject, ConstructionPlugin_Point::POINT_TO_PROJECT(), ModelAPI_AttributeSelection, /** Point to project*/,
103 projectionType, ConstructionPlugin_Point::PROJECTION_TYPE(), ModelAPI_AttributeString, /** Type of the point projection */,
104 faceForPointProjection, ConstructionPlugin_Point::FACE_FOR_POINT_PROJECTION(), ModelAPI_AttributeSelection, /** Face for point projection */,
105 edgeForPointProjection, ConstructionPlugin_Point::EDGE_FOR_POINT_PROJECTION(), ModelAPI_AttributeSelection, /** Edge for point projection */,
106 geometricalPropertyType, ConstructionPlugin_Point::GEOMETRICAL_PROPERTY_TYPE(), ModelAPI_AttributeString, /** Type of the geometrical property */,
107 objectForCenterOfGravity, ConstructionPlugin_Point::OBJECT_FOR_CENTER_OF_GRAVITY(), ModelAPI_AttributeSelection, /** Object for center of gravity */,
108 objectForCenterOfCircle, ConstructionPlugin_Point::OBJECT_FOR_CENTER_OF_CIRCLE(), ModelAPI_AttributeSelection, /** Object for center of circle */)
110 /// Set point values.
111 CONSTRUCTIONAPI_EXPORT
112 void setByXYZ(const ModelHighAPI_Double & theX,
113 const ModelHighAPI_Double & theY,
114 const ModelHighAPI_Double & theZ);
116 /// Set edge and distance on it for point.
117 CONSTRUCTIONAPI_EXPORT
118 void setByOffsetOnEdge(const ModelHighAPI_Selection& theEdge,
119 const ModelHighAPI_Double& theOffset,
120 const bool theUseRatio = false,
121 const bool theReverse = false);
123 /// Set point and edge for projection.
124 CONSTRUCTIONAPI_EXPORT
125 void setByProjectionOnEdge(const ModelHighAPI_Selection& theVertex,
126 const ModelHighAPI_Selection& theEdge);
128 /// Set point and face for projection.
129 CONSTRUCTIONAPI_EXPORT
130 void setByProjectionOnFace(const ModelHighAPI_Selection& theVertex,
131 const ModelHighAPI_Selection& theFace);
133 /// Set lines for intersections.
134 CONSTRUCTIONAPI_EXPORT
135 void setByLinesIntersection(const ModelHighAPI_Selection& theEdge1,
136 const ModelHighAPI_Selection& theEdge2);
138 /// Set line and plane for intersections.
139 CONSTRUCTIONAPI_EXPORT
140 void setByLineAndPlaneIntersection(const ModelHighAPI_Selection& theEdge,
141 const ModelHighAPI_Selection& theFace);
143 /// Set faces for intersections.
144 CONSTRUCTIONAPI_EXPORT
145 void setByPlanesIntersection(const ModelHighAPI_Selection& theFace1,
146 const ModelHighAPI_Selection& theFace2,
147 const ModelHighAPI_Selection& theFace3);
149 /// Set object for center of gravity.
150 CONSTRUCTIONAPI_EXPORT
151 void setByCenterOfGravity(const ModelHighAPI_Selection& theObject);
153 /// Set object for center of circular edge.
154 CONSTRUCTIONAPI_EXPORT
155 void setByCenterOfCircle(const ModelHighAPI_Selection& theObject);
157 /// Dump wrapped feature
158 CONSTRUCTIONAPI_EXPORT
159 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
162 /// Pointer on Point object.
163 typedef std::shared_ptr<ConstructionAPI_Point> PointPtr;
165 /// \ingroup CPPHighAPI
166 /// \brief Create Point feature
167 CONSTRUCTIONAPI_EXPORT
168 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
169 const ModelHighAPI_Double & theX,
170 const ModelHighAPI_Double & theY,
171 const ModelHighAPI_Double & theZ);
173 /// \ingroup CPPHighAPI
174 /// \brief Create Point feature
175 CONSTRUCTIONAPI_EXPORT
176 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
177 const ModelHighAPI_Selection& theEdge,
178 const ModelHighAPI_Double& theOffset,
179 const bool theUseRatio = false,
180 const bool theReverse = false);
182 /// \ingroup CPPHighAPI
183 /// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
184 CONSTRUCTIONAPI_EXPORT
185 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
186 const ModelHighAPI_Selection& theObject1,
187 const ModelHighAPI_Selection& theObject2);
189 /// \ingroup CPPHighAPI
190 /// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
191 /// with positive distance from the plane and flag to reverse the offset direction.
192 CONSTRUCTIONAPI_EXPORT
193 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
194 const ModelHighAPI_Selection& theObject1,
195 const ModelHighAPI_Selection& theObject2,
196 const ModelHighAPI_Double& theDistanceValue,
197 const bool theReverse = false);
199 /// \ingroup CPPHighAPI
200 /// \brief Create Point feature as an intersection of selected planes.
201 CONSTRUCTIONAPI_EXPORT
202 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
203 const ModelHighAPI_Selection& theObject1,
204 const ModelHighAPI_Selection& theObject2,
205 const ModelHighAPI_Selection& theObject3);
207 /// \ingroup CPPHighAPI
208 /// \brief Create Point feature as a geometrical property.
209 CONSTRUCTIONAPI_EXPORT
210 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
211 const ModelHighAPI_Selection& theObject,
212 const bool theIsCircularEdge = false);
214 #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_ */