mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 19:07:57 +00:00
GeomServer: precision on double formatting, compound in meters, bounding box also from compound
This commit is contained in:
@@ -91,10 +91,18 @@ std::string format_json(const std::string& s) {
|
||||
return "\"" + s + "\"";
|
||||
}
|
||||
|
||||
template <>
|
||||
std::string format_json(const double& d) {
|
||||
std::stringstream ss;
|
||||
ss << std::setprecision(std::numeric_limits<double>::digits10) << d;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
template <>
|
||||
std::string format_json(const gp_Dir& d) {
|
||||
std::stringstream ss;
|
||||
ss << "[" << d.X() << "," << d.Y() << "," << d.Z() << "]";
|
||||
ss << std::setprecision(std::numeric_limits<double>::digits10)
|
||||
<< "[" << d.X() << "," << d.Y() << "," << d.Z() << "]";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
@@ -470,7 +478,7 @@ public:
|
||||
boost::optional<gp_Dir> largest_face_dir;
|
||||
|
||||
{
|
||||
TopoDS_Compound compound = elem_->geometry().as_compound();
|
||||
TopoDS_Compound compound = elem_->geometry().as_compound(true);
|
||||
TopExp_Explorer exp(compound, TopAbs_FACE);
|
||||
for (; exp.More(); exp.Next()) {
|
||||
GProp_GProps prop;
|
||||
@@ -488,20 +496,11 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (largest_face_dir) {
|
||||
put_json(LARGEST_FACE_DIRECTION, *largest_face_dir);
|
||||
put_json(LARGEST_FACE_AREA, largest_face_area);
|
||||
}
|
||||
|
||||
{
|
||||
Bnd_Box box;
|
||||
double xyz[6];
|
||||
double xyz[6];
|
||||
|
||||
for (auto& part : elem->geometry()) {
|
||||
BRepBndLib::AddClose(part.Shape(), box);
|
||||
}
|
||||
BRepBndLib::AddClose(compound, box);
|
||||
|
||||
if (!box.IsVoid()) {
|
||||
box.Get(xyz[0], xyz[1], xyz[2], xyz[3], xyz[4], xyz[5]);
|
||||
@@ -510,7 +509,11 @@ public:
|
||||
put_json(BOUNDING_BOX_SIZE_ALONG_ + XYZ[i], bsz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (largest_face_dir) {
|
||||
put_json(LARGEST_FACE_DIRECTION, *largest_face_dir);
|
||||
put_json(LARGEST_FACE_AREA, largest_face_area);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user