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
|
|
|
|
"""
|
2021-04-08 11:47:58 -04:00
|
|
|
|
2020-05-18 13:25:08 -04:00
|
|
|
from city_model_structure.city import City
|
2021-06-01 18:31:50 -04:00
|
|
|
from imports.geometry.citygml import CityGml
|
|
|
|
from imports.geometry.obj import Obj
|
2021-08-27 12:51:30 -04:00
|
|
|
from imports.geometry.osm_subway import OsmSubway
|
2021-10-25 13:28:43 -04:00
|
|
|
from imports.geometry.rhino import Rhino
|
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
|
2021-09-22 07:25:53 -04:00
|
|
|
def _citygml(self) -> City:
|
|
|
|
"""
|
|
|
|
Enrich the city by using CityGML information as data source
|
|
|
|
:return: City
|
|
|
|
"""
|
2020-05-18 13:25:08 -04:00
|
|
|
return CityGml(self._path).city
|
|
|
|
|
2021-03-16 16:58:52 -04:00
|
|
|
@property
|
2021-09-22 07:25:53 -04:00
|
|
|
def _obj(self) -> City:
|
|
|
|
"""
|
|
|
|
Enrich the city by using OBJ information as data source
|
|
|
|
:return: City
|
|
|
|
"""
|
2021-08-27 12:51:30 -04:00
|
|
|
return Obj(self._path).city
|
2021-03-16 16:58:52 -04:00
|
|
|
|
2020-05-18 13:25:08 -04:00
|
|
|
@property
|
2021-09-22 07:25:53 -04:00
|
|
|
def _osm_subway(self) -> City:
|
|
|
|
"""
|
|
|
|
Enrich the city by using OpenStreetMap information as data source
|
|
|
|
:return: City
|
|
|
|
"""
|
2021-08-27 12:51:30 -04:00
|
|
|
return OsmSubway(self._path).city
|
2020-05-18 13:25:08 -04:00
|
|
|
|
2021-10-25 13:28:43 -04:00
|
|
|
@property
|
|
|
|
def _rhino(self) -> City:
|
|
|
|
"""
|
|
|
|
Enrich the city by using OpenStreetMap information as data source
|
|
|
|
:return: City
|
|
|
|
"""
|
|
|
|
return Rhino(self._path).city
|
|
|
|
|
2020-05-18 13:25:08 -04:00
|
|
|
@property
|
|
|
|
def city(self) -> City:
|
2020-06-11 15:45:11 -04:00
|
|
|
"""
|
2021-09-22 07:25:53 -04:00
|
|
|
Enrich the city given to the class using the class given handler
|
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)
|
2021-10-25 13:28:43 -04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def city_debug(self) -> City:
|
|
|
|
"""
|
|
|
|
Enrich the city given to the class using the class given handler
|
|
|
|
:return: City
|
|
|
|
"""
|
|
|
|
return Rhino(self._path).city
|