1 // File: GeomAPI_Edge.cpp
2 // Created: 24 Jul 2014
3 // Author: Artem ZHIDKOV
5 #include<GeomAPI_Edge.h>
7 #include <TopoDS_Shape.hxx>
8 #include <BRep_TEdge.hxx>
9 #include <BRep_CurveRepresentation.hxx>
10 #include <Geom_Curve.hxx>
11 #include <Geom_Line.hxx>
12 #include <Geom_Circle.hxx>
14 GeomAPI_Edge::GeomAPI_Edge()
18 bool GeomAPI_Edge::isLine() const
20 const TopoDS_Shape& aShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
21 Handle(BRep_TEdge) anEdge = Handle(BRep_TEdge)::DownCast(aShape.TShape());
22 if (anEdge->Curves().Extent() != 1)
23 return false; // too many curves in the edge
24 Handle(Geom_Curve) aCurve = anEdge->Curves().First()->Curve3D();
25 if (aCurve->IsKind(STANDARD_TYPE(Geom_Line)))
30 bool GeomAPI_Edge::isCircle() const
32 const TopoDS_Shape& aShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
33 Handle(BRep_TEdge) anEdge = Handle(BRep_TEdge)::DownCast(aShape.TShape());
34 if (anEdge->Curves().Extent() != 1)
35 return false; // too many curves in the edge
36 Handle(Geom_Curve) aCurve = anEdge->Curves().First()->Curve3D();
37 if (aCurve->IsKind(STANDARD_TYPE(Geom_Circle)) && aCurve->IsClosed())
42 bool GeomAPI_Edge::isArc() const
44 const TopoDS_Shape& aShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
45 Handle(BRep_TEdge) anEdge = Handle(BRep_TEdge)::DownCast(aShape.TShape());
46 if (anEdge->Curves().Extent() != 1)
47 return false; // too many curves in the edge
48 Handle(Geom_Curve) aCurve = anEdge->Curves().First()->Curve3D();
49 if (aCurve->IsKind(STANDARD_TYPE(Geom_Circle)) && !aCurve->IsClosed())