dynamic_building_simulation/init.py

27 lines
781 B
Python
Raw Normal View History

from geometry.geometry_factory import GeometryFactory
from physics.physics_factory import PhysicsFactory
from usage.usage_factory import UsageFactory
2020-05-18 13:56:54 -04:00
import pyproj
import reverse_geocoder as rg
class Init:
def __init__(self, geometry_path):
self._geometry_path = geometry_path
self._city = None
@property
def handler(self):
if self.city.name == 'New York City':
2020-05-18 13:56:54 -04:00
handler = '{0}_{1}'
return handler.format(self.city.country_code, self.city.name.lower().replace(' ', '_'))
return self.city.country_code
2020-05-18 13:56:54 -04:00
@property
def city(self):
if self._city is None:
self._city = GeometryFactory('citygml', self._geometry_path).city
PhysicsFactory(self.handler, self._city)
UsageFactory(self.handler, self._city)
return self._city