Salome HOME
Meet the coding style (line length <= 100)
[modules/shaper.git] / src / GeomAPI / GeomAPI_Wire.cpp
index c70d5c5e8998374913a70eb7f69f913ad83d4e45..e5eb9d41007d647433f976d5d3857a065b3d2499 100644 (file)
@@ -1,48 +1,21 @@
-// File:        GeomAPI_Wire.cpp
-// Created:     06 Oct 2014
-// Author:      Sergey BELASH
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
 
-#include <GeomAPI_Interface.h>
-#include <GeomAPI_Wire.h>
+// File:        GeomAPI_Wire.cpp
+// Created:     28 April 2016
+// Author:      Dmitry Bobylev
 
-#include <Standard_TypeDef.hxx>
-#include <TopAbs_ShapeEnum.hxx>
+#include "GeomAPI_Wire.h"
 
-#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);
 }