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()
19 bool GeomAPI_Edge::isLine() const
21 const TopoDS_Shape& aShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
22 Handle(BRep_TEdge) anEdge = Handle(BRep_TEdge)::DownCast(aShape.TShape());
23 if (anEdge->Curves().Extent() != 1)
24 return false; // too many curves in the edge
25 Handle(Geom_Curve) aCurve = anEdge->Curves().First()->Curve3D();
26 if (aCurve->IsKind(STANDARD_TYPE(Geom_Line)))
31 bool GeomAPI_Edge::isCircle() const
33 const TopoDS_Shape& aShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
34 Handle(BRep_TEdge) anEdge = Handle(BRep_TEdge)::DownCast(aShape.TShape());
35 if (anEdge->Curves().Extent() != 1)
36 return false; // too many curves in the edge
37 Handle(Geom_Curve) aCurve = anEdge->Curves().First()->Curve3D();
38 if (aCurve->IsKind(STANDARD_TYPE(Geom_Circle)) && aCurve->IsClosed())
43 bool GeomAPI_Edge::isArc() const
45 const TopoDS_Shape& aShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
46 Handle(BRep_TEdge) anEdge = Handle(BRep_TEdge)::DownCast(aShape.TShape());
47 if (anEdge->Curves().Extent() != 1)
48 return false; // too many curves in the edge
49 Handle(Geom_Curve) aCurve = anEdge->Curves().First()->Curve3D();
50 if (aCurve->IsKind(STANDARD_TYPE(Geom_Circle)) && !aCurve->IsClosed())