dynamic_building_simulation/init.py

27 lines
781 B
Python

from geometry.geometry_factory import GeometryFactory
from physics.physics_factory import PhysicsFactory
from usage.usage_factory import UsageFactory
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':
handler = '{0}_{1}'
return handler.format(self.city.country_code, self.city.name.lower().replace(' ', '_'))
return self.city.country_code
@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