hub/geometry/geometry_factory.py

30 lines
760 B
Python

"""
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 geometry.geometry_feeders.city_gml import CityGml
from city_model_structure.city import City
class GeometryFactory:
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:
return getattr(self, self._file_type, lambda: None)