]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Provide export of a shape to string stream before_slalome_7.5.1
authorvsv <vitaly.smetannikov@opencascade.com>
Wed, 17 Dec 2014 15:39:06 +0000 (18:39 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Wed, 17 Dec 2014 15:39:06 +0000 (18:39 +0300)
src/GeomAPI/GeomAPI_Shape.cpp
src/GeomAPI/GeomAPI_Shape.h

index 6cb6f74c4b8b0dcbf7a31ce122f9c0177442deac..5a84a3d98680abc7ba2753556332fe53b31bffb1 100644 (file)
@@ -9,6 +9,9 @@
 #include <TopoDS_Shape.hxx>
 #include <BRepBndLib.hxx>
 #include <Bnd_Box.hxx>
+#include <BRepTools.hxx>
+
+#include <sstream>
 
 #define MY_SHAPE static_cast<TopoDS_Shape*>(myImpl)
 
@@ -60,4 +63,12 @@ bool GeomAPI_Shape::computeSize(double& theXmin, double& theYmin, double& theZmi
   BRepBndLib::Add(aShape, aBndBox);
   aBndBox.Get(theXmin, theYmin, theZmin, theXmax, theYmax, theZmax);
   return true;
-}
\ No newline at end of file
+}
+
+std::string GeomAPI_Shape::getShapeStream() const
+{
+  std::ostringstream aStream;
+  const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
+  BRepTools::Write(aShape, aStream);
+  return aStream.str();
+}
index 6302f8606de051e68e675b655ea6e3193f4d81ab..8ff96d9815ca5e00c3e93ed1d2dc5e2b201a6100 100644 (file)
@@ -40,6 +40,7 @@ class GEOMAPI_EXPORT GeomAPI_Shape : public GeomAPI_Interface
   bool computeSize(double& theXmin, double& theYmin, double& theZmin,
                    double& theXmax, double& theYmax, double& theZmax) const;
 
+  std::string getShapeStream() const;
 };
 
 //! Pointer on list of shapes