forked from s_ranjbar/city_retrofit
82 lines
2.0 KiB
Python
82 lines
2.0 KiB
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 city_model_structure.city import City
|
|
from city_model_structure.city_object import CityObject
|
|
from imports.geometry_feeders.citygml import CityGml
|
|
from imports.geometry_feeders.osm_subway import OsmSubway
|
|
from imports.geometry_feeders.obj import Obj
|
|
|
|
|
|
class GeometryFactory:
|
|
"""
|
|
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 _stl(self):
|
|
raise Exception('Not implemented')
|
|
|
|
@property
|
|
def _obj(self):
|
|
return Obj(self._path).scene
|
|
|
|
@property
|
|
def _geojson(self):
|
|
raise Exception('Not implemented')
|
|
|
|
@property
|
|
def _bim(self):
|
|
raise Exception('Not implemented')
|
|
|
|
@property
|
|
def city(self) -> City:
|
|
"""
|
|
Load the city model structure from a geometry source
|
|
:return: City
|
|
"""
|
|
return getattr(self, self._file_type, lambda: None)
|
|
|
|
@property
|
|
def scene(self):
|
|
"""
|
|
Load the city model structure from a geometry source
|
|
:return: Trimesh scene
|
|
"""
|
|
return getattr(self, self._file_type, lambda: None)
|
|
|
|
@property
|
|
def _scene_debug(self):
|
|
"""
|
|
just for debug. More information is provided without the lambda parameter
|
|
"""
|
|
return getattr(self, self._file_type)
|
|
|
|
@property
|
|
def _city_debug(self):
|
|
"""
|
|
just for debug. More information is provided without the lambda parameter
|
|
"""
|
|
return CityGml(self._path).city
|
|
|
|
@property
|
|
def _osm_subway(self):
|
|
return OsmSubway(self._path).subway_entrances
|
|
|
|
@property
|
|
def features(self) -> [CityObject]:
|
|
"""
|
|
Load the city model structure from a geometry source
|
|
:return: [CityObject]
|
|
"""
|
|
return getattr(self, self._file_type, lambda: None)
|