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);
67 CONSTRUCTIONAPI_EXPORT
68 virtual ~ConstructionAPI_Point();
70 INTERFACE_16(ConstructionPlugin_Point::ID(),
71 x, ConstructionPlugin_Point::X(), ModelAPI_AttributeDouble, /** X attribute */,
72 y, ConstructionPlugin_Point::Y(), ModelAPI_AttributeDouble, /** Y attribute */,
73 z, ConstructionPlugin_Point::Z(), ModelAPI_AttributeDouble, /** Z attribute */,
74 creationMethod, ConstructionPlugin_Point::CREATION_METHOD(),
75 ModelAPI_AttributeString, /** Creation method */,
76 intersectionLine, ConstructionPlugin_Point::INTERSECTION_LINE(),
77 ModelAPI_AttributeSelection, /** Line for intersection */,
78 intersectionPlane, ConstructionPlugin_Point::INTERSECTION_PLANE(),
79 ModelAPI_AttributeSelection, /** Plane for intersection */,
80 useOffset, ConstructionPlugin_Point::USE_OFFSET(),
81 ModelAPI_AttributeString, /** Use offset */,
82 offset, ConstructionPlugin_Point::OFFSET(),
83 ModelAPI_AttributeDouble, /** Offset */,
84 reverseOffset, ConstructionPlugin_Point::REVERSE_OFFSET(),
85 ModelAPI_AttributeBoolean, /** Reverse offset */,
86 edge, ConstructionPlugin_Point::EDGE(),
87 ModelAPI_AttributeSelection, /** Edge */,
88 offsetType, ConstructionPlugin_Point::OFFSET_TYPE(),
89 ModelAPI_AttributeString, /** Type of the offset on edge */,
90 distance, ConstructionPlugin_Point::DISTANCE(),
91 ModelAPI_AttributeDouble, /** Distance */,
92 ratio, ConstructionPlugin_Point::RATIO(),
93 ModelAPI_AttributeDouble, /** Ratio */,
94 reverse, ConstructionPlugin_Point::REVERSE(),
95 ModelAPI_AttributeBoolean, /** Reverse */,
96 poinToProjectOnFace, ConstructionPlugin_Point::POINT_TO_PROJECT_ON_FACE(),
97 ModelAPI_AttributeSelection, /** Point to project on face */,
98 faceForPointProjection, ConstructionPlugin_Point::FACE_FOR_POINT_PROJECTION(),
99 ModelAPI_AttributeSelection, /** Face for point projection */)
102 /// Set point values.
103 CONSTRUCTIONAPI_EXPORT
104 void setByXYZ(const ModelHighAPI_Double & theX,
105 const ModelHighAPI_Double & theY,
106 const ModelHighAPI_Double & theZ);
108 /// Set edge and distance on it for point.
109 CONSTRUCTIONAPI_EXPORT
110 void setByOffsetOnEdge(const ModelHighAPI_Selection& theEdge,
111 const ModelHighAPI_Double& theOffset,
112 const bool theUseRatio = false,
113 const bool theReverse = false);
115 /// Set point and plane for projection.
116 CONSTRUCTIONAPI_EXPORT
117 void setByProjectionOnFace(const ModelHighAPI_Selection& theVertex,
118 const ModelHighAPI_Selection& theFace);
121 /// Set lines for intersections.
122 CONSTRUCTIONAPI_EXPORT
123 void setByLinesIntersection(const ModelHighAPI_Selection& theEdge1,
124 const ModelHighAPI_Selection& theEdge2);
127 /// Set line and plane for intersections.
128 CONSTRUCTIONAPI_EXPORT
129 void setByLineAndPlaneIntersection(const ModelHighAPI_Selection& theEdge,
130 const ModelHighAPI_Selection& theFace);
132 /// Dump wrapped feature
133 CONSTRUCTIONAPI_EXPORT
134 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
137 /// Pointer on Point object.
138 typedef std::shared_ptr<ConstructionAPI_Point> PointPtr;
140 /// \ingroup CPPHighAPI
141 /// \brief Create Point feature
142 CONSTRUCTIONAPI_EXPORT
143 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
144 const ModelHighAPI_Double & theX,
145 const ModelHighAPI_Double & theY,
146 const ModelHighAPI_Double & theZ);
148 /// \ingroup CPPHighAPI
149 /// \brief Create Point feature
150 CONSTRUCTIONAPI_EXPORT
151 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
152 const ModelHighAPI_Selection& theEdge,
153 const ModelHighAPI_Double& theOffset,
154 const bool theUseRatio = false,
155 const bool theReverse = false);
157 /// \ingroup CPPHighAPI
158 /// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
159 CONSTRUCTIONAPI_EXPORT
160 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
161 const ModelHighAPI_Selection& theObject1,
162 const ModelHighAPI_Selection& theObject2);
164 /// \ingroup CPPHighAPI
165 /// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
166 /// with positive distance from the plane and flag to reverse the offset direction.
167 CONSTRUCTIONAPI_EXPORT
168 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
169 const ModelHighAPI_Selection& theObject1,
170 const ModelHighAPI_Selection& theObject2,
171 const ModelHighAPI_Double& theDistanceValue,
172 const bool theReverse = false);
174 #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_ */