From a49774d199ccb418fbac66a7a16cf7b881b4fd65 Mon Sep 17 00:00:00 2001 From: vsv Date: Wed, 17 Dec 2014 18:39:06 +0300 Subject: [PATCH] Provide export of a shape to string stream --- src/GeomAPI/GeomAPI_Shape.cpp | 13 ++++++++++++- src/GeomAPI/GeomAPI_Shape.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) 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 -- 2.39.2