Salome HOME
2cde7c24d5fa55284087a53b373e9ce5974e9740
[modules/shaper.git] / src / GeomAPI / GeomAPI_Edge.cpp
1 // File:        GeomAPI_Edge.cpp
2 // Created:     24 Jul 2014
3 // Author:      Artem ZHIDKOV
4
5 #include<GeomAPI_Edge.h>
6
7 #include <TopoDS_Shape.hxx>
8 #include <TopoDS_Edge.hxx>
9 #include <BRep_Tool.hxx>
10 #include <Geom_Curve.hxx>
11 #include <Geom_Line.hxx>
12 #include <Geom_Circle.hxx>
13
14 GeomAPI_Edge::GeomAPI_Edge()
15     : GeomAPI_Shape()
16 {
17 }
18
19 bool GeomAPI_Edge::isLine() const
20 {
21   const TopoDS_Shape& aShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
22   double aFirst, aLast;
23   Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast);
24   if (aCurve->IsKind(STANDARD_TYPE(Geom_Line)))
25     return true;
26   return false;
27 }
28
29 bool GeomAPI_Edge::isCircle() const
30 {
31   const TopoDS_Shape& aShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
32   double aFirst, aLast;
33   Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast);
34   if (aCurve->IsKind(STANDARD_TYPE(Geom_Circle)) && aCurve->IsClosed())
35     return true;
36   return false;
37 }
38
39 bool GeomAPI_Edge::isArc() const
40 {
41   const TopoDS_Shape& aShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
42   double aFirst, aLast;
43   Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast);
44   if (aCurve->IsKind(STANDARD_TYPE(Geom_Circle)) && !aCurve->IsClosed())
45     return true;
46   return false;
47 }