2022-03-03 16:52:01 -05:00
|
|
|
"""
|
|
|
|
Greenery catalog publish the greenery information
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
|
|
Copyright © 2022 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
|
|
|
"""
|
|
|
|
|
|
|
|
from pathlib import Path
|
|
|
|
from catalogs.greenery.greenery_catalog import GreeneryCatalog
|
|
|
|
|
|
|
|
|
|
|
|
class GreeneryCatalogFactory:
|
|
|
|
"""
|
|
|
|
GeometryFactory class
|
|
|
|
"""
|
|
|
|
def __init__(self, file_type, base_path=None):
|
|
|
|
if base_path is None:
|
|
|
|
base_path = Path(Path(__file__).parent.parent / 'data/greenery')
|
|
|
|
self._file_type = '_' + file_type.lower()
|
|
|
|
self._path = base_path
|
|
|
|
|
|
|
|
@property
|
|
|
|
def _nrel(self) -> GreeneryCatalog:
|
|
|
|
"""
|
|
|
|
Return a greenery catalog using ecore as datasource
|
|
|
|
:return: GreeneryCatalog
|
|
|
|
"""
|
|
|
|
return GreeneryCatalog((self._path / 'ecore_greenery_catalog.xml').resolve())
|
|
|
|
|
|
|
|
@property
|
|
|
|
def catalog(self) -> GreeneryCatalog:
|
|
|
|
"""
|
|
|
|
Enrich the city given to the class using the class given handler
|
|
|
|
:return: City
|
|
|
|
"""
|
|
|
|
return getattr(self, self._file_type, lambda: None)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def catalog_debug(self) -> GreeneryCatalog:
|
|
|
|
"""
|
|
|
|
Enrich the city given to the class using the class given handler
|
|
|
|
:return: City
|
|
|
|
"""
|
2022-03-08 20:25:50 -05:00
|
|
|
return GreeneryCatalog((self._path / 'ecore_greenery_catalog.xml').resolve())
|