summer_course_2024/geometry/geometry_factory.py

37 lines
897 B
Python
Raw Normal View History

2020-06-09 14:07:47 -04:00
"""
GeometryFactory retrieve the specific geometric module to load the given format
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from city_model_structure.city import City
from geometry.geometry_feeders.city_gml import CityGml
class GeometryFactory:
2020-06-15 11:38:18 -04:00
"""
GeometryFactory class
"""
def __init__(self, file_type, path):
self._file_type = '_' + file_type.lower()
self._path = path
@property
def _citygml(self):
return CityGml(self._path).city
@property
def _geojson(self):
raise Exception('Not implemented')
@property
def _bim(self):
raise Exception('Not implemented')
@property
def city(self) -> City:
"""
2020-06-15 11:38:18 -04:00
Load the city model structure from a geometry source
:return: City
"""
return getattr(self, self._file_type, lambda: None)