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);
74 CONSTRUCTIONAPI_EXPORT
75 virtual ~ConstructionAPI_Point();
77 INTERFACE_24(ConstructionPlugin_Point::ID(),
78 x, ConstructionPlugin_Point::X(), ModelAPI_AttributeDouble, /** X attribute */,
79 y, ConstructionPlugin_Point::Y(), ModelAPI_AttributeDouble, /** Y attribute */,
80 z, ConstructionPlugin_Point::Z(), ModelAPI_AttributeDouble, /** Z attribute */,
81 creationMethod, ConstructionPlugin_Point::CREATION_METHOD(),
82 ModelAPI_AttributeString, /** Creation method */,
83 intersectionType, ConstructionPlugin_Point::INTERSECTION_TYPE(),
84 ModelAPI_AttributeString, /** Type of the intersection */,
85 intersectionLine1, ConstructionPlugin_Point::INTERSECTION_LINE_1(),
86 ModelAPI_AttributeSelection, /** Line for intersection */,
87 intersectionLine2, ConstructionPlugin_Point::INTERSECTION_LINE_2(),
88 ModelAPI_AttributeSelection, /** Line for intersection */,
89 intersectionLine, ConstructionPlugin_Point::INTERSECTION_LINE(),
90 ModelAPI_AttributeSelection, /** Line for intersection */,
91 intersectionPlane, ConstructionPlugin_Point::INTERSECTION_PLANE(),
92 ModelAPI_AttributeSelection, /** Plane for intersection */,
93 intersectionPlane1, ConstructionPlugin_Point::INTERSECTION_PLANE_1(),
94 ModelAPI_AttributeSelection, /** Plane for intersection */,
95 intersectionPlane2, ConstructionPlugin_Point::INTERSECTION_PLANE_2(),
96 ModelAPI_AttributeSelection, /** Plane for intersection */,
97 intersectionPlane3, ConstructionPlugin_Point::INTERSECTION_PLANE_3(),
98 ModelAPI_AttributeSelection, /** Plane for intersection */,
99 useOffset, ConstructionPlugin_Point::USE_OFFSET(),
100 ModelAPI_AttributeString, /** Use offset */,
101 offset, ConstructionPlugin_Point::OFFSET(),
102 ModelAPI_AttributeDouble, /** Offset */,
103 reverseOffset, ConstructionPlugin_Point::REVERSE_OFFSET(),
104 ModelAPI_AttributeBoolean, /** Reverse offset */,
105 edge, ConstructionPlugin_Point::EDGE(),
106 ModelAPI_AttributeSelection, /** Edge */,
107 offsetType, ConstructionPlugin_Point::OFFSET_TYPE(),
108 ModelAPI_AttributeString, /** Type of the offset on edge */,
109 distance, ConstructionPlugin_Point::DISTANCE(),
110 ModelAPI_AttributeDouble, /** Distance */,
111 ratio, ConstructionPlugin_Point::RATIO(),
112 ModelAPI_AttributeDouble, /** Ratio */,
113 reverse, ConstructionPlugin_Point::REVERSE(),
114 ModelAPI_AttributeBoolean, /** Reverse */,
115 poinToProject, ConstructionPlugin_Point::POINT_TO_PROJECT(),
116 ModelAPI_AttributeSelection, /** Point to project*/,
117 projectionType, ConstructionPlugin_Point::PROJECTION_TYPE(),
118 ModelAPI_AttributeString, /** Type of the point projection */,
119 faceForPointProjection, ConstructionPlugin_Point::FACE_FOR_POINT_PROJECTION(),
120 ModelAPI_AttributeSelection, /** Point to project on edge */,
121 edgeForPointProjection, ConstructionPlugin_Point::EDGE_FOR_POINT_PROJECTION(),
122 ModelAPI_AttributeSelection, /** Edge for point projection */)
125 /// Set point values.
126 CONSTRUCTIONAPI_EXPORT
127 void setByXYZ(const ModelHighAPI_Double & theX,
128 const ModelHighAPI_Double & theY,
129 const ModelHighAPI_Double & theZ);
131 /// Set edge and distance on it for point.
132 CONSTRUCTIONAPI_EXPORT
133 void setByOffsetOnEdge(const ModelHighAPI_Selection& theEdge,
134 const ModelHighAPI_Double& theOffset,
135 const bool theUseRatio = false,
136 const bool theReverse = false);
138 /// Set point and edge for projection.
139 CONSTRUCTIONAPI_EXPORT
140 void setByProjectionOnEdge(const ModelHighAPI_Selection& theVertex,
141 const ModelHighAPI_Selection& theEdge);
143 /// Set point and face for projection.
144 CONSTRUCTIONAPI_EXPORT
145 void setByProjectionOnFace(const ModelHighAPI_Selection& theVertex,
146 const ModelHighAPI_Selection& theFace);
148 /// Set lines for intersections.
149 CONSTRUCTIONAPI_EXPORT
150 void setByLinesIntersection(const ModelHighAPI_Selection& theEdge1,
151 const ModelHighAPI_Selection& theEdge2);
153 /// Set line and plane for intersections.
154 CONSTRUCTIONAPI_EXPORT
155 void setByLineAndPlaneIntersection(const ModelHighAPI_Selection& theEdge,
156 const ModelHighAPI_Selection& theFace);
158 /// Set faces for intersections.
159 CONSTRUCTIONAPI_EXPORT
160 void setByPlanesIntersection(const ModelHighAPI_Selection& theFace1,
161 const ModelHighAPI_Selection& theFace2,
162 const ModelHighAPI_Selection& theFace3);
164 /// Dump wrapped feature
165 CONSTRUCTIONAPI_EXPORT
166 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
169 /// Pointer on Point object.
170 typedef std::shared_ptr<ConstructionAPI_Point> PointPtr;
172 /// \ingroup CPPHighAPI
173 /// \brief Create Point feature
174 CONSTRUCTIONAPI_EXPORT
175 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
176 const ModelHighAPI_Double & theX,
177 const ModelHighAPI_Double & theY,
178 const ModelHighAPI_Double & theZ);
180 /// \ingroup CPPHighAPI
181 /// \brief Create Point feature
182 CONSTRUCTIONAPI_EXPORT
183 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
184 const ModelHighAPI_Selection& theEdge,
185 const ModelHighAPI_Double& theOffset,
186 const bool theUseRatio = false,
187 const bool theReverse = false);
189 /// \ingroup CPPHighAPI
190 /// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
191 CONSTRUCTIONAPI_EXPORT
192 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
193 const ModelHighAPI_Selection& theObject1,
194 const ModelHighAPI_Selection& theObject2);
196 /// \ingroup CPPHighAPI
197 /// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
198 /// with positive distance from the plane and flag to reverse the offset direction.
199 CONSTRUCTIONAPI_EXPORT
200 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
201 const ModelHighAPI_Selection& theObject1,
202 const ModelHighAPI_Selection& theObject2,
203 const ModelHighAPI_Double& theDistanceValue,
204 const bool theReverse = false);
206 /// \ingroup CPPHighAPI
207 /// \brief Create Point feature as an intersection of selected planes
208 CONSTRUCTIONAPI_EXPORT
209 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
210 const ModelHighAPI_Selection& theObject1,
211 const ModelHighAPI_Selection& theObject2,
212 const ModelHighAPI_Selection& theObject3);
214 #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_ */