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
|
|
|
|
"""
|
2020-05-18 13:25:08 -04:00
|
|
|
from city_model_structure.city import City
|
2020-06-30 16:14:39 -04:00
|
|
|
from city_model_structure.city_object import CityObject
|
2020-06-16 10:34:17 -04:00
|
|
|
from geometry.geometry_feeders.city_gml import CityGml
|
2020-06-30 16:14:39 -04:00
|
|
|
from geometry.geometry_feeders.osm_subway import OsmSubway
|
2020-05-18 13:25:08 -04:00
|
|
|
|
|
|
|
|
|
|
|
class GeometryFactory:
|
2020-06-15 11:38:18 -04:00
|
|
|
"""
|
|
|
|
GeometryFactory class
|
|
|
|
"""
|
2020-05-18 13:25:08 -04:00
|
|
|
def __init__(self, file_type, path):
|
2020-06-11 15:45:11 -04:00
|
|
|
self._file_type = '_' + file_type.lower()
|
2020-05-18 13:25:08 -04:00
|
|
|
self._path = path
|
|
|
|
|
|
|
|
@property
|
2020-06-11 15:45:11 -04:00
|
|
|
def _citygml(self):
|
2020-05-18 13:25:08 -04:00
|
|
|
return CityGml(self._path).city
|
|
|
|
|
|
|
|
@property
|
2020-06-11 15:45:11 -04:00
|
|
|
def _geojson(self):
|
2020-05-18 13:25:08 -04:00
|
|
|
raise Exception('Not implemented')
|
|
|
|
|
|
|
|
@property
|
2020-06-11 15:45:11 -04:00
|
|
|
def _bim(self):
|
2020-05-18 13:25:08 -04:00
|
|
|
raise Exception('Not implemented')
|
|
|
|
|
|
|
|
@property
|
|
|
|
def city(self) -> City:
|
2020-06-11 15:45:11 -04:00
|
|
|
"""
|
2020-06-15 11:38:18 -04:00
|
|
|
Load the city model structure from a geometry source
|
2020-06-11 15:45:11 -04:00
|
|
|
:return: City
|
|
|
|
"""
|
2020-05-18 13:25:08 -04:00
|
|
|
return getattr(self, self._file_type, lambda: None)
|
2020-06-30 16:14:39 -04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def _osm_subway(self):
|
2020-06-30 18:06:27 -04:00
|
|
|
return OsmSubway(self._path).subway_entrances
|
2020-06-30 16:14:39 -04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def features(self) -> [CityObject]:
|
|
|
|
"""
|
|
|
|
Load the city model structure from a geometry source
|
|
|
|
:return: [CityObject]
|
|
|
|
"""
|
|
|
|
return getattr(self, self._file_type, lambda: None)
|