Salome HOME
Issue #608: Usage of OCCT in interface -- Remove OCCT from *Export/Import interfaces...
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_BREPImport.cpp
index 6d676af7c31bc9131eb1c8b158d0f10efe81df38..e067acc9e94b3d09067a197063934ac7bebac752 100644 (file)
@@ -1,6 +1,12 @@
 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
 
-#include <GEOMALGOAPI_BREPImport.h>
+// File:    GeomAlgoAPI_BREPImport.cpp
+// Created: May 14, 2015
+// Author:  Sergey POKHODENKO
+
+#include <GeomAlgoAPI_BREPImport.h>
+
+#include <TopoDS_Shape.hxx>
 
 #include <BRepTools.hxx>
 #include <BRep_Builder.hxx>
  *
  */
 //=============================================================================
-//extern "C" {
-namespace BREPImport {
-TopoDS_Shape Import(const TCollection_AsciiString& theFileName,
-                    const TCollection_AsciiString&,
-                    TCollection_AsciiString& theError, const TDF_Label&)
+std::shared_ptr<GeomAPI_Shape> BREPImport(const std::string& theFileName,
+                                          const std::string&,
+                                          std::string& theError)
 {
   #ifdef _DEBUG
   std::cout << "Import BREP from file " << theFileName << std::endl;
   #endif
   TopoDS_Shape aShape;
   BRep_Builder aBuilder;
-  BRepTools::Read(aShape, theFileName.ToCString(), aBuilder);
+  BRepTools::Read(aShape, theFileName.c_str(), aBuilder);
   if (aShape.IsNull()) {
     theError = "BREP Import failed";
   }
-  return aShape;
-}
 
+  std::shared_ptr<GeomAPI_Shape> aGeomShape(new GeomAPI_Shape);
+  aGeomShape->setImpl(new TopoDS_Shape(aShape));
+  return aGeomShape;
 }
-//}