2021-01-19 11:18:26 +11:00
|
|
|
class Data:
|
|
|
|
|
is_loaded = False
|
|
|
|
|
map_conversion = {}
|
|
|
|
|
projected_crs = {}
|
2021-04-04 08:58:24 +10:00
|
|
|
true_north = {}
|
2021-01-19 11:18:26 +11:00
|
|
|
|
2021-02-03 17:30:19 +11:00
|
|
|
@classmethod
|
|
|
|
|
def purge(cls):
|
|
|
|
|
cls.is_loaded = False
|
|
|
|
|
cls.map_conversion = {}
|
|
|
|
|
cls.projected_crs = {}
|
2021-04-04 08:58:24 +10:00
|
|
|
cls.true_north = None
|
2021-02-03 17:30:19 +11:00
|
|
|
|
2021-01-19 11:18:26 +11:00
|
|
|
@classmethod
|
2021-03-25 10:48:31 +11:00
|
|
|
def load(cls, file):
|
2021-01-19 11:18:26 +11:00
|
|
|
if not file:
|
|
|
|
|
return
|
|
|
|
|
cls.map_conversion = {}
|
|
|
|
|
cls.projected_crs = {}
|
2021-04-04 08:58:24 +10:00
|
|
|
cls.true_north = {}
|
2021-01-19 11:18:26 +11:00
|
|
|
if file.schema == "IFC2X3":
|
|
|
|
|
return
|
|
|
|
|
for context in file.by_type("IfcGeometricRepresentationContext", include_subtypes=False):
|
|
|
|
|
if not context.HasCoordinateOperation:
|
|
|
|
|
continue
|
|
|
|
|
map_conversion = context.HasCoordinateOperation[0]
|
|
|
|
|
cls.map_conversion = map_conversion.get_info()
|
|
|
|
|
cls.map_conversion["SourceCRS"] = cls.map_conversion["SourceCRS"].id()
|
|
|
|
|
cls.map_conversion["TargetCRS"] = cls.map_conversion["TargetCRS"].id()
|
|
|
|
|
cls.projected_crs = map_conversion.TargetCRS.get_info()
|
|
|
|
|
if cls.projected_crs["MapUnit"]:
|
|
|
|
|
cls.projected_crs["MapUnit"] = map_conversion.TargetCRS.MapUnit.get_info()
|
|
|
|
|
break
|
2021-04-04 08:58:24 +10:00
|
|
|
for context in file.by_type("IfcGeometricRepresentationContext", include_subtypes=False):
|
|
|
|
|
if not context.TrueNorth:
|
|
|
|
|
continue
|
|
|
|
|
cls.true_north = context.TrueNorth.DirectionRatios
|
|
|
|
|
break
|
2021-01-19 11:18:26 +11:00
|
|
|
cls.is_loaded = True
|