Salome HOME
Linux porting
[modules/shaper.git] / src / GeomAPI / GeomAPI_Wire.cpp
index 39da519fe8aed86fc11cd9c2dff6d460de9359d6..039be40a873ffb450f9b7ad609a0b1bffd9c2453 100644 (file)
@@ -1,50 +1,35 @@
-// 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 <TopExp_Explorer.hxx>
-
-#include <list>
+#include <TopoDS_Wire.hxx>
 
-GeomAPI_Wire::GeomAPI_Wire() : GeomAPI_Shape()
+//==================================================================================================
+GeomAPI_Wire::GeomAPI_Wire()
 {
-  TopoDS_Compound aBigWireImpl;
-  BRep_Builder aBuilder;
-  aBuilder.MakeCompound(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));
-  TopExp_Explorer aWireExp(aShape, TopAbs_EDGE);
-  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);
 }