1 // File: GeomAPI_Wire.cpp
2 // Created: 06 Oct 2014
3 // Author: Sergey BELASH
5 #include <GeomAPI_Interface.h>
6 #include <GeomAPI_Wire.h>
8 #include <Standard_TypeDef.hxx>
9 #include <TopAbs_ShapeEnum.hxx>
12 #include <TopoDS_Edge.hxx>
13 #include <TopoDS_Wire.hxx>
14 #include <BRep_Builder.hxx>
15 #include <BRepTools_WireExplorer.hxx>
19 GeomAPI_Wire::GeomAPI_Wire() : GeomAPI_Shape()
21 TopoDS_Wire aBigWireImpl;
22 BRep_Builder aBuilder;
23 aBuilder.MakeWire(aBigWireImpl);
24 this->setImpl(new TopoDS_Shape(aBigWireImpl));
27 void GeomAPI_Wire::addEdge(boost::shared_ptr<GeomAPI_Shape> theEdge)
29 const TopoDS_Edge& anEdge = theEdge->impl<TopoDS_Edge>();
30 if (anEdge.ShapeType() != TopAbs_EDGE)
32 TopoDS_Shape& aWire = const_cast<TopoDS_Shape&>(impl<TopoDS_Shape>());
33 BRep_Builder aBuilder;
34 aBuilder.Add(aWire, anEdge);
37 std::list<boost::shared_ptr<GeomAPI_Shape> > GeomAPI_Wire::getEdges()
39 TopoDS_Shape& aShape = const_cast<TopoDS_Shape&>(impl<TopoDS_Shape>());
40 BRepTools_WireExplorer aWireExp(TopoDS::Wire(aShape));
41 std::list<boost::shared_ptr<GeomAPI_Shape> > aResult;
42 for (; aWireExp.More(); aWireExp.Next()) {
43 boost::shared_ptr<GeomAPI_Shape> anEdge(new GeomAPI_Shape);
44 anEdge->setImpl(new TopoDS_Shape(aWireExp.Current()));
45 aResult.push_back(anEdge);