2020-05-19 11:16:54 -04:00
|
|
|
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):
|
2020-05-28 15:22:46 -04:00
|
|
|
if self.city.name == 'New York City':
|
2020-05-18 13:56:54 -04:00
|
|
|
handler = '{0}_{1}'
|
2020-05-28 15:22:46 -04:00
|
|
|
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
|