From: vsv Date: Wed, 17 Dec 2014 15:39:06 +0000 (+0300) Subject: Provide export of a shape to string stream X-Git-Tag: before_slalome_7.5.1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a49774d199ccb418fbac66a7a16cf7b881b4fd65;p=modules%2Fshaper.git Provide export of a shape to string stream --- diff --git a/src/GeomAPI/GeomAPI_Shape.cpp b/src/GeomAPI/GeomAPI_Shape.cpp index 6cb6f74c4..5a84a3d98 100644 --- a/src/GeomAPI/GeomAPI_Shape.cpp +++ b/src/GeomAPI/GeomAPI_Shape.cpp @@ -9,6 +9,9 @@ #include #include #include +#include + +#include #define MY_SHAPE static_cast(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(this)->impl(); + BRepTools::Write(aShape, aStream); + return aStream.str(); +} diff --git a/src/GeomAPI/GeomAPI_Shape.h b/src/GeomAPI/GeomAPI_Shape.h index 6302f8606..8ff96d981 100644 --- a/src/GeomAPI/GeomAPI_Shape.h +++ b/src/GeomAPI/GeomAPI_Shape.h @@ -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