Skip to content

Commit 826752c

Browse files
committed
Geomserver bounding box sizes
1 parent c3adcf6 commit 826752c

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

src/ifcgeomserver/IfcGeomServer.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949

5050
#include <GProp_GProps.hxx>
5151
#include <BRepGProp.hxx>
52+
#include <BRepBndLib.hxx>
53+
#include <Bnd_Box.hxx>
5254
#include <Geom_Plane.hxx>
5355

5456
#include <memory>
@@ -402,6 +404,8 @@ static const std::string SURFACE_AREA_ALONG_Y = "SURFACE_AREA_ALONG_Y";
402404
static const std::string SURFACE_AREA_ALONG_Z = "SURFACE_AREA_ALONG_Z";
403405
static const std::string WALKABLE_SURFACE_AREA = "WALKABLE_SURFACE_AREA";
404406
static const std::string LARGEST_FACE_AREA = "LARGEST_FACE_AREA";
407+
static const std::string BOUNDING_BOX_SIZE_ALONG_ = "BOUNDING_BOX_SIZE_ALONG_";
408+
static const std::array<std::string, 3> XYZ = { "X", "Y", "Z" };
405409

406410
class QuantityWriter_v0 : public EntityExtension {
407411
private:
@@ -454,6 +458,24 @@ class QuantityWriter_v1 : public EntityExtension {
454458
}
455459

456460
put_json(LARGEST_FACE_AREA, largest_face_area);
461+
462+
{
463+
Bnd_Box box;
464+
double xyz[6];
465+
466+
for (auto& part : elem->geometry()) {
467+
BRepBndLib::AddClose(part.Shape(), box);
468+
}
469+
470+
if (!box.IsVoid()) {
471+
box.Get(xyz[0], xyz[1], xyz[2], xyz[3], xyz[4], xyz[5]);
472+
for (int i = 0; i < 3; ++i) {
473+
const double bsz = xyz[i + 3] - xyz[i];
474+
put_json(BOUNDING_BOX_SIZE_ALONG_ + XYZ[i], bsz);
475+
}
476+
}
477+
478+
}
457479
}
458480
};
459481

0 commit comments

Comments
 (0)