X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_Shape.cpp;h=78d5105ee98e9e55bd110eba04b3445c85033c0c;hb=7f873aed4bae5a98dca078209699b54276b46fce;hp=f656eb2bea907a9237cd740a6c995f73510c04ce;hpb=a7f44a41bdf29e7bd978ff3b8c8bd514d1223be7;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_Shape.cpp b/src/GeomAPI/GeomAPI_Shape.cpp index f656eb2be..78d5105ee 100644 --- a/src/GeomAPI/GeomAPI_Shape.cpp +++ b/src/GeomAPI/GeomAPI_Shape.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: GeomAPI_Shape.cpp // Created: 23 Apr 2014 // Author: Mikhail PONIKAROV @@ -5,6 +7,11 @@ #include #include +#include +#include +#include + +#include #define MY_SHAPE static_cast(myImpl) @@ -20,6 +27,8 @@ bool GeomAPI_Shape::isNull() const bool GeomAPI_Shape::isEqual(const std::shared_ptr theShape) const { + if (!theShape.get()) + return false; if (isNull()) return theShape->isNull(); if (theShape->isNull()) @@ -45,3 +54,23 @@ bool GeomAPI_Shape::isFace() const const TopoDS_Shape& aShape = const_cast(this)->impl(); return aShape.ShapeType() == TopAbs_FACE; } + +bool GeomAPI_Shape::computeSize(double& theXmin, double& theYmin, double& theZmin, + double& theXmax, double& theYmax, double& theZmax) const +{ + const TopoDS_Shape& aShape = const_cast(this)->impl(); + if (aShape.IsNull()) + return false; + Bnd_Box aBndBox; + BRepBndLib::Add(aShape, aBndBox); + aBndBox.Get(theXmin, theYmin, theZmin, theXmax, theYmax, theZmax); + return true; +} + +std::string GeomAPI_Shape::getShapeStream() const +{ + std::ostringstream aStream; + const TopoDS_Shape& aShape = const_cast(this)->impl(); + BRepTools::Write(aShape, aStream); + return aStream.str(); +}