Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[modules/shaper.git] / src / GeomAPI / GeomAPI_Shape.cpp
index 6cb6f74c4b8b0dcbf7a31ce122f9c0177442deac..78d5105ee98e9e55bd110eba04b3445c85033c0c 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)
 
@@ -24,6 +27,8 @@ bool GeomAPI_Shape::isNull() const
 
 bool GeomAPI_Shape::isEqual(const std::shared_ptr<GeomAPI_Shape> theShape) const
 {
+  if (!theShape.get())
+    return false;
   if (isNull())
     return theShape->isNull();
   if (theShape->isNull())
@@ -60,4 +65,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();
+}