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