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& theDistanceValue,
57 const bool theDistancePercent = 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_9(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 */)
89 CONSTRUCTIONAPI_EXPORT
90 void setByXYZ(const ModelHighAPI_Double & theX,
91 const ModelHighAPI_Double & theY,
92 const ModelHighAPI_Double & theZ);
94 /*/// Set edge and distance on it for point.
95 CONSTRUCTIONAPI_EXPORT
96 void setByDistanceOnEdge(const ModelHighAPI_Selection& theEdge,
97 const ModelHighAPI_Double& theDistanceValue,
98 const bool theDistancePercent = false,
99 const bool theReverse = false);
101 /// Set point and plane for projection.
102 CONSTRUCTIONAPI_EXPORT
103 void setByProjection(const ModelHighAPI_Selection& theVertex,
104 const ModelHighAPI_Selection& theFace);
106 /// Set lines for intersections.
107 CONSTRUCTIONAPI_EXPORT
108 void setByLinesIntersection(const ModelHighAPI_Selection& theEdge1,
109 const ModelHighAPI_Selection& theEdge2);
111 /// Set line and plane for intersections.
112 CONSTRUCTIONAPI_EXPORT
113 void setByLineAndPlaneIntersection(const ModelHighAPI_Selection& theEdge,
114 const ModelHighAPI_Selection& theFace);
116 /// Dump wrapped feature
117 CONSTRUCTIONAPI_EXPORT
118 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
121 /// Pointer on Point object.
122 typedef std::shared_ptr<ConstructionAPI_Point> PointPtr;
124 /// \ingroup CPPHighAPI
125 /// \brief Create Point feature
126 CONSTRUCTIONAPI_EXPORT
127 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
128 const ModelHighAPI_Double & theX,
129 const ModelHighAPI_Double & theY,
130 const ModelHighAPI_Double & theZ);
132 /*/// \ingroup CPPHighAPI
133 /// \brief Create Point feature
134 CONSTRUCTIONAPI_EXPORT
135 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
136 const ModelHighAPI_Selection& theEdge,
137 const ModelHighAPI_Double& theDistanceValue,
138 const bool theDistancePercent = false,
139 const bool theReverse = false);
141 /// \ingroup CPPHighAPI
142 /// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
143 CONSTRUCTIONAPI_EXPORT
144 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
145 const ModelHighAPI_Selection& theObject1,
146 const ModelHighAPI_Selection& theObject2);
148 /// \ingroup CPPHighAPI
149 /// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
150 /// with positive distance from the plane and flag to reverse the offset direction.
151 CONSTRUCTIONAPI_EXPORT
152 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
153 const ModelHighAPI_Selection& theObject1,
154 const ModelHighAPI_Selection& theObject2,
155 const ModelHighAPI_Double& theDistanceValue,
156 const bool theReverse = false);
158 #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_ */