mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Show georeferencing unit symbols to make it clearer what units things are in
This commit is contained in:
@@ -38,6 +38,8 @@ class GeoreferenceData:
|
||||
cls.data["projected_crs"] = cls.projected_crs()
|
||||
cls.data["true_north"] = cls.true_north()
|
||||
cls.data["true_derived_angle"] = cls.true_derived_angle()
|
||||
cls.data["local_unit_symbol"] = cls.local_unit_symbol()
|
||||
cls.data["map_unit_symbol"] = cls.map_unit_symbol()
|
||||
cls.is_loaded = True
|
||||
|
||||
@classmethod
|
||||
@@ -131,3 +133,20 @@ class GeoreferenceData:
|
||||
def true_derived_angle(cls):
|
||||
if cls.data["true_north"]:
|
||||
return str(round(ifcopenshell.util.geolocation.yaxis2angle(*cls.data["true_north"][0:2]), 3))
|
||||
|
||||
@classmethod
|
||||
def local_unit_symbol(cls):
|
||||
if not (unit := ifcopenshell.util.unit.get_project_unit(tool.Ifc.get(), "LENGTHUNIT")):
|
||||
return "n/a"
|
||||
return ifcopenshell.util.unit.get_unit_symbol(unit)
|
||||
|
||||
@classmethod
|
||||
def map_unit_symbol(cls):
|
||||
if tool.Ifc.get().schema == "IFC2X3":
|
||||
return cls.local_unit_symbol()
|
||||
if crs := tool.Ifc.get().by_type("IfcProjectedCRS"):
|
||||
crs = crs[0]
|
||||
if not (unit := crs.MapUnit):
|
||||
return cls.local_unit_symbol()
|
||||
return ifcopenshell.util.unit.get_unit_symbol(unit)
|
||||
return "n/a"
|
||||
|
||||
@@ -93,13 +93,13 @@ class BIM_PT_gis(Panel):
|
||||
row.label(text="Blender Session Origin", icon="TRACKING_REFINE_FORWARDS")
|
||||
|
||||
row = self.layout.row(align=True)
|
||||
row.label(text="Eastings")
|
||||
row.label(text=f"Eastings ({GeoreferenceData.data['local_unit_symbol']})")
|
||||
row.label(text=props.blender_eastings)
|
||||
row = self.layout.row(align=True)
|
||||
row.label(text="Northings")
|
||||
row.label(text=f"Northings ({GeoreferenceData.data['local_unit_symbol']})")
|
||||
row.label(text=props.blender_northings)
|
||||
row = self.layout.row(align=True)
|
||||
row.label(text="OrthogonalHeight")
|
||||
row.label(text=f"OrthogonalHeight ({GeoreferenceData.data['local_unit_symbol']})")
|
||||
row.label(text=props.blender_orthogonal_height)
|
||||
row = self.layout.row(align=True)
|
||||
row.label(text="XAxisAbscissa")
|
||||
@@ -133,7 +133,10 @@ class BIM_PT_gis(Panel):
|
||||
if value is None:
|
||||
continue
|
||||
row = self.layout.row(align=True)
|
||||
row.label(text=key)
|
||||
if key in ("Eastings", "Northings", "OrthogonalHeight"):
|
||||
row.label(text=f"{key} ({GeoreferenceData.data['map_unit_symbol']})")
|
||||
else:
|
||||
row.label(text=key)
|
||||
row.label(text=str(value))
|
||||
if key == "XAxisOrdinate":
|
||||
row = self.layout.row(align=True)
|
||||
|
||||
Reference in New Issue
Block a user