mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 22:11:36 +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["projected_crs"] = cls.projected_crs()
|
||||||
cls.data["true_north"] = cls.true_north()
|
cls.data["true_north"] = cls.true_north()
|
||||||
cls.data["true_derived_angle"] = cls.true_derived_angle()
|
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
|
cls.is_loaded = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -131,3 +133,20 @@ class GeoreferenceData:
|
|||||||
def true_derived_angle(cls):
|
def true_derived_angle(cls):
|
||||||
if cls.data["true_north"]:
|
if cls.data["true_north"]:
|
||||||
return str(round(ifcopenshell.util.geolocation.yaxis2angle(*cls.data["true_north"][0:2]), 3))
|
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.label(text="Blender Session Origin", icon="TRACKING_REFINE_FORWARDS")
|
||||||
|
|
||||||
row = self.layout.row(align=True)
|
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.label(text=props.blender_eastings)
|
||||||
row = self.layout.row(align=True)
|
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.label(text=props.blender_northings)
|
||||||
row = self.layout.row(align=True)
|
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.label(text=props.blender_orthogonal_height)
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.label(text="XAxisAbscissa")
|
row.label(text="XAxisAbscissa")
|
||||||
@@ -133,7 +133,10 @@ class BIM_PT_gis(Panel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
continue
|
continue
|
||||||
row = self.layout.row(align=True)
|
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))
|
row.label(text=str(value))
|
||||||
if key == "XAxisOrdinate":
|
if key == "XAxisOrdinate":
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user