guille
f2ff10ad47
# Conflicts: # city_model_structure/city.py # city_model_structure/energy_system.py # city_model_structure/fuel.py # city_model_structure/machine.py # city_model_structure/vehicle.py # data/life_cycle_assessment/lca_data.xml # exports/energy_systems_factory.py # helpers/constants.py # helpers/yearly_from_daily_schedules.py # imports/energy_systems/air_source_hp_parameters.py # imports/geometry/rhino.py # imports/geometry_factory.py # imports/life_cycle_assessment/lca_fuel.py # imports/life_cycle_assessment/lca_machine.py # imports/life_cycle_assessment/lca_vehicle.py # imports/life_cycle_assessment_factory.py # requirements.txt # unittests/test_life_cycle_assessment_factory.py
68 lines
1.6 KiB
Python
68 lines
1.6 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 imports.geometry.citygml import CityGml
|
|
from imports.geometry.obj import Obj
|
|
from imports.geometry.osm_subway import OsmSubway
|
|
|
|
|
|
class GeometryFactory:
|
|
"""
|
|
GeometryFactory class
|
|
"""
|
|
def __init__(self, file_type, path):
|
|
self._file_type = '_' + file_type.lower()
|
|
self._path = path
|
|
|
|
@property
|
|
def _citygml(self) -> City:
|
|
"""
|
|
Enrich the city by using CityGML information as data source
|
|
:return: City
|
|
"""
|
|
return CityGml(self._path).city
|
|
|
|
@property
|
|
def _obj(self) -> City:
|
|
"""
|
|
Enrich the city by using OBJ information as data source
|
|
:return: City
|
|
"""
|
|
return Obj(self._path).city
|
|
|
|
@property
|
|
def _osm_subway(self) -> City:
|
|
"""
|
|
Enrich the city by using OpenStreetMap information as data source
|
|
:return: City
|
|
"""
|
|
return OsmSubway(self._path).city
|
|
|
|
@property
|
|
def _rhino(self) -> City:
|
|
"""
|
|
Enrich the city by using OpenStreetMap information as data source
|
|
:return: City
|
|
"""
|
|
return Rhino(self._path).city
|
|
|
|
@property
|
|
def city(self) -> City:
|
|
"""
|
|
Enrich the city given to the class using the class given handler
|
|
:return: City
|
|
"""
|
|
return getattr(self, self._file_type, lambda: None)
|
|
|
|
@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
|