summer_course_2024/geometry/geometry_factory.py

34 lines
859 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 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:
"""
Geometry factory city model structure with geometry
:return: City
"""
return getattr(self, self._file_type, lambda: None)