mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Derive map units from IFC scale
Use IfcMapConversion.Scale as the source of truth for converting map coordinates to metres, instead of deriving that scale from IfcProjectedCRS.MapUnit. Bump the sidecar version because cached georef matrices and unit scales may differ under the new interpretation. Generated with the assistance of an AI coding tool.
This commit is contained in:
@@ -105,18 +105,9 @@ ModelGeoref computeModelGeoref(ifcopenshell::file* ifc_file) {
|
||||
out.units.project_length_to_meters =
|
||||
calculateUnitScale(ifc_file, "LENGTHUNIT");
|
||||
|
||||
if (auto map_unit = getMapUnit(ifc_file)) {
|
||||
if (auto s = siScaleFromNamedUnit(*map_unit)) {
|
||||
out.units.map_unit_to_meters = *s;
|
||||
} else {
|
||||
out.units.map_unit_to_meters = out.units.project_length_to_meters;
|
||||
}
|
||||
} else {
|
||||
// No MapUnit on the IfcProjectedCRS — fall back to project length unit.
|
||||
out.units.map_unit_to_meters = out.units.project_length_to_meters;
|
||||
}
|
||||
|
||||
auto params = getHelmertTransformationParameters(ifc_file);
|
||||
const double scale = (params && params->scale != 0.0) ? params->scale : 1.0;
|
||||
out.units.map_unit_to_meters = out.units.project_length_to_meters / scale;
|
||||
if (!params) return out;
|
||||
|
||||
Eigen::Matrix4d helmert =
|
||||
|
||||
Reference in New Issue
Block a user