Salome HOME
Task 2.3: Fix compilation error
[modules/shaper.git] / src / GeomAPI / GeomAPI_Edge.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef GeomAPI_Edge_H_
22 #define GeomAPI_Edge_H_
23
24 #include <GeomAPI_Shape.h>
25
26 class GeomAPI_Pln;
27 class GeomAPI_Pnt;
28 class GeomAPI_Circ;
29 class GeomAPI_Lin;
30 class GeomAPI_Ellipse;
31
32 /**\class GeomAPI_Edge
33 * \ingroup DataModel
34  * \brief Interface to the edge object
35  */
36
37 class GeomAPI_Edge : public GeomAPI_Shape
38 {
39 public:
40    /// Makes an undefined Edge (no geometry).
41   GEOMAPI_EXPORT
42    GeomAPI_Edge();
43
44    /// Creation of edge by the edge-shape
45   GEOMAPI_EXPORT
46    GeomAPI_Edge(const std::shared_ptr<GeomAPI_Shape>& theShape);
47
48   /// Verifies that the edge is a line
49   GEOMAPI_EXPORT
50   bool isLine() const;
51
52   /// Verifies that the edge is a circle
53   GEOMAPI_EXPORT
54   bool isCircle() const;
55
56   /// Verifies that the edge is an arc of circle
57   GEOMAPI_EXPORT
58   bool isArc() const;
59
60   /// Verifies that the edge is an arc of circle
61   GEOMAPI_EXPORT
62   bool isEllipse() const;
63
64   /// Returns the first vertex coordinates of the edge
65   GEOMAPI_EXPORT
66   std::shared_ptr<GeomAPI_Pnt> firstPoint();
67
68   /// Returns the Last vertex coordinates of the edge
69   GEOMAPI_EXPORT
70   std::shared_ptr<GeomAPI_Pnt> lastPoint();
71
72   /// Returns a circle if edge is based on the circle curve
73   GEOMAPI_EXPORT
74   std::shared_ptr<GeomAPI_Circ> circle() const;
75
76   /// Returns an ellipse if edge is based on the ellipse curve
77   GEOMAPI_EXPORT
78   std::shared_ptr<GeomAPI_Ellipse> ellipse() const;
79
80   /// Returns a line if edge is based on the linear curve
81   GEOMAPI_EXPORT
82   std::shared_ptr<GeomAPI_Lin> line() const;
83
84   /// Returns true if the current edge is geometrically equal to the given edge
85   GEOMAPI_EXPORT
86   bool isEqual(const std::shared_ptr<GeomAPI_Shape> theEdge) const;
87
88   /// Returns range of parameter on the curve
89   GEOMAPI_EXPORT
90   void getRange(double& theFirst, double& theLast) const;
91
92   /// Returns true, if the edge is fully placed in the specified plane
93   /// \param thePlane a plane for intersection
94   GEOMAPI_EXPORT
95   bool isInPlane(const std::shared_ptr<GeomAPI_Pln> thePlane) const;
96
97   /// Returns list of intersection points if the edge has intersections with the given plane
98   /// \param thePlane a plane for intersection
99   GEOMAPI_EXPORT
100   void intersectWithPlane(const std::shared_ptr<GeomAPI_Pln> thePlane, std::list<std::shared_ptr<GeomAPI_Pnt> >& theResult) const;
101
102   /// Returns edge length.
103   GEOMAPI_EXPORT
104   double length() const;
105
106   /// Returns true if the edge is closed (like full circle)
107   GEOMAPI_EXPORT
108   bool isClosed() const;
109
110   /// Returns true if the edge is degenerated (has no 3D curve)
111   GEOMAPI_EXPORT
112   bool isDegenerated() const;
113
114   GEOMAPI_EXPORT
115   void setFirstPointTolerance(const double theTolerance);
116
117   GEOMAPI_EXPORT
118   void setLastPointTolerance(const double theTolerance);
119 };
120
121 //! Pointer on attribute object
122 typedef std::shared_ptr<GeomAPI_Edge> GeomEdgePtr;
123
124 #endif
125