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>
16 #include <TopExp_Explorer.hxx>
20 GeomAPI_Wire::GeomAPI_Wire() : GeomAPI_Shape()
22 TopoDS_Compound aBigWireImpl;
23 BRep_Builder aBuilder;
24 aBuilder.MakeCompound(aBigWireImpl);
25 this->setImpl(new TopoDS_Shape(aBigWireImpl));
28 void GeomAPI_Wire::addEdge(boost::shared_ptr<GeomAPI_Shape> theEdge)
30 const TopoDS_Edge& anEdge = theEdge->impl<TopoDS_Edge>();
31 if (anEdge.ShapeType() != TopAbs_EDGE)
33 TopoDS_Shape& aWire = const_cast<TopoDS_Shape&>(impl<TopoDS_Shape>());
34 BRep_Builder aBuilder;
35 aBuilder.Add(aWire, anEdge);
38 std::list<boost::shared_ptr<GeomAPI_Shape> > GeomAPI_Wire::getEdges()
40 TopoDS_Shape& aShape = const_cast<TopoDS_Shape&>(impl<TopoDS_Shape>());
41 //BRepTools_WireExplorer aWireExp(TopoDS::Wire(aShape));
42 TopExp_Explorer aWireExp(aShape, TopAbs_EDGE);
43 std::list<boost::shared_ptr<GeomAPI_Shape> > aResult;
44 for (; aWireExp.More(); aWireExp.Next()) {
45 boost::shared_ptr<GeomAPI_Shape> anEdge(new GeomAPI_Shape);
46 anEdge->setImpl(new TopoDS_Shape(aWireExp.Current()));
47 aResult.push_back(anEdge);