2020-06-09 14:07:47 -04:00
|
|
|
"""
|
|
|
|
PhysicsFactory retrieve the specific physics module for the given region
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
|
|
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
|
|
|
"""
|
2020-10-29 08:16:48 -04:00
|
|
|
from factories.physics_feeders.us_new_york_city_physics_parameters import UsNewYorkCityPhysicsParameters
|
|
|
|
from factories.physics_feeders.us_physics_parameters import UsPhysicsParameters
|
2021-01-05 15:01:36 -05:00
|
|
|
from factories.physics_feeders.ca_physics_parameters import CaPhysicsParameters
|
2020-06-26 21:10:56 -04:00
|
|
|
from pathlib import Path
|
2020-05-18 13:25:08 -04:00
|
|
|
|
|
|
|
|
|
|
|
class PhysicsFactory:
|
2020-06-11 15:45:11 -04:00
|
|
|
"""
|
|
|
|
PhysicsFactor class
|
|
|
|
"""
|
2020-06-29 19:52:05 -04:00
|
|
|
def __init__(self, handler, city, base_path=Path(Path(__file__).parent.parent / 'data/physics')):
|
2020-06-11 15:45:11 -04:00
|
|
|
self._handler = '_' + handler.lower().replace(' ', '_')
|
2020-05-18 13:25:08 -04:00
|
|
|
self._city = city
|
2020-06-04 12:47:48 -04:00
|
|
|
self._base_path = base_path
|
2020-05-18 13:25:08 -04:00
|
|
|
self.factory()
|
|
|
|
|
2021-01-06 16:42:38 -05:00
|
|
|
# todo: adapt us_new_york and us to the new version with interface
|
2020-06-26 21:10:56 -04:00
|
|
|
def _us_new_york(self):
|
2020-06-04 12:47:48 -04:00
|
|
|
UsNewYorkCityPhysicsParameters(self._city, self._base_path)
|
2020-05-18 13:25:08 -04:00
|
|
|
|
2020-06-11 15:45:11 -04:00
|
|
|
def _us(self):
|
2020-06-04 12:47:48 -04:00
|
|
|
UsPhysicsParameters(self._city, self._base_path)
|
2020-05-18 13:25:08 -04:00
|
|
|
|
2020-06-11 15:45:11 -04:00
|
|
|
def _ca(self):
|
2021-01-07 18:12:13 -05:00
|
|
|
CaPhysicsParameters(self._city, self._base_path).enrich_buildings()
|
2020-05-18 13:25:08 -04:00
|
|
|
|
2020-06-11 15:45:11 -04:00
|
|
|
def _de(self):
|
2020-10-21 09:53:07 -04:00
|
|
|
raise NotImplementedError
|
2020-05-18 13:25:08 -04:00
|
|
|
|
2020-06-11 15:45:11 -04:00
|
|
|
def _es(self):
|
2020-10-21 09:53:07 -04:00
|
|
|
raise NotImplementedError
|
2020-05-18 13:25:08 -04:00
|
|
|
|
|
|
|
def factory(self):
|
2020-06-11 15:45:11 -04:00
|
|
|
"""
|
|
|
|
Enrich the city with the physics information
|
|
|
|
:return: None
|
|
|
|
"""
|
2020-05-18 13:25:08 -04:00
|
|
|
getattr(self, self._handler, lambda: None)()
|