#include "GeomAPI_Shape.h"
+#include <GeomAPI_Pnt.h>
#include <GeomAPI_Vertex.h>
#include <GeomAPI_Edge.h>
#include <GeomAPI_Wire.h>
return isAtLeastOne;
}
+// LCOV_EXCL_START
GeomAPI_Shape::ShapeType GeomAPI_Shape::typeOfCompoundShapes() const
{
const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
}
return (GeomAPI_Shape::ShapeType) aType;
}
+// LCOV_EXCL_STOP
// adds the nopt-compound elements recursively to the list
static void addSimpleToList(const TopoDS_Shape& theShape, NCollection_List<TopoDS_Shape>& theList)
if (aShape.IsNull())
return false;
Bnd_Box aBndBox;
- BRepBndLib::Add(aShape, aBndBox);
+ BRepBndLib::Add(aShape, aBndBox, false);
+ if (aBndBox.IsVoid())
+ return false;
aBndBox.Get(theXmin, theYmin, theZmin, theXmax, theYmax, theZmax);
return true;
}
+GeomPointPtr GeomAPI_Shape::middlePoint() const
+{
+ GeomPointPtr aMiddlePoint;
+
+ switch (shapeType()) {
+ case VERTEX:
+ aMiddlePoint = vertex()->point();
+ break;
+ case EDGE:
+ aMiddlePoint = edge()->middlePoint();
+ break;
+ case WIRE:
+ aMiddlePoint = wire()->middlePoint();
+ break;
+ case FACE:
+ aMiddlePoint = face()->middlePoint();
+ break;
+ case SHELL:
+ aMiddlePoint = shell()->middlePoint();
+ break;
+ case SOLID:
+ aMiddlePoint = solid()->middlePoint();
+ break;
+ default: {
+ // get middle point as center of the bounding box
+ double aMinX, aMinY, aMinZ, aMaxX, aMaxY, aMaxZ;
+ computeSize(aMinX, aMinY, aMinZ, aMaxX, aMaxY, aMaxZ);
+ aMiddlePoint = GeomPointPtr(new GeomAPI_Pnt(
+ (aMinX + aMaxX) * 0.5, (aMinY + aMaxY) * 0.5, (aMinZ + aMaxZ) * 0.5));
+ }
+ }
+
+ return aMiddlePoint;
+}
+
+// LCOV_EXCL_START
std::string GeomAPI_Shape::getShapeStream() const
{
std::ostringstream aStream;
BRepTools::Write(aShape, aStream);
return aStream.str();
}
+// LCOV_EXCL_STOP
GeomShapePtr GeomAPI_Shape::intersect(const GeomShapePtr theShape) const
{