-// File: GeomAPI_Wire.cpp
-// Created: 06 Oct 2014
-// Author: Sergey BELASH
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
-#include <GeomAPI_Interface.h>
-#include <GeomAPI_Wire.h>
+#include "GeomAPI_Wire.h"
-#include <Standard_TypeDef.hxx>
-#include <TopAbs_ShapeEnum.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Wire.hxx>
#include <BRep_Builder.hxx>
-#include <BRepTools_WireExplorer.hxx>
-
-#include <list>
+#include <TopoDS_Wire.hxx>
-GeomAPI_Wire::GeomAPI_Wire() : GeomAPI_Shape()
+//==================================================================================================
+GeomAPI_Wire::GeomAPI_Wire()
{
- TopoDS_Wire aBigWireImpl;
- BRep_Builder aBuilder;
- aBuilder.MakeWire(aBigWireImpl);
- this->setImpl(new TopoDS_Shape(aBigWireImpl));
-}
+ TopoDS_Wire* aWire = new TopoDS_Wire();
-void GeomAPI_Wire::addEdge(boost::shared_ptr<GeomAPI_Shape> theEdge)
-{
- const TopoDS_Edge& anEdge = theEdge->impl<TopoDS_Edge>();
- if (anEdge.ShapeType() != TopAbs_EDGE)
- return;
- TopoDS_Shape& aWire = const_cast<TopoDS_Shape&>(impl<TopoDS_Shape>());
BRep_Builder aBuilder;
- aBuilder.Add(aWire, anEdge);
-}
+ aBuilder.MakeWire(*aWire);
-std::list<boost::shared_ptr<GeomAPI_Shape> > GeomAPI_Wire::getEdges()
-{
- TopoDS_Shape& aShape = const_cast<TopoDS_Shape&>(impl<TopoDS_Shape>());
- BRepTools_WireExplorer aWireExp(TopoDS::Wire(aShape));
- std::list<boost::shared_ptr<GeomAPI_Shape> > aResult;
- for (; aWireExp.More(); aWireExp.Next()) {
- boost::shared_ptr<GeomAPI_Shape> anEdge(new GeomAPI_Shape);
- anEdge->setImpl(new TopoDS_Shape(aWireExp.Current()));
- aResult.push_back(anEdge);
- }
- return aResult;
+ this->setImpl(aWire);
}