44 lines
926 B
Python
44 lines
926 B
Python
|
from city_model_structure.city_object import CityObject
|
||
|
from typing import List, Union
|
||
|
|
||
|
|
||
|
class City:
|
||
|
def __init__(self, lower_corner, upper_corner, city_objects, srs_name):
|
||
|
self._city_objects = None
|
||
|
self._name = None
|
||
|
self._lower_corner = lower_corner
|
||
|
self._upper_corner = upper_corner
|
||
|
self._city_objects = city_objects
|
||
|
self._srs_name = srs_name
|
||
|
|
||
|
@property
|
||
|
def city_objects(self) -> List[CityObject]:
|
||
|
return self._city_objects
|
||
|
|
||
|
@property
|
||
|
def lower_corner(self):
|
||
|
return self._lower_corner
|
||
|
|
||
|
@property
|
||
|
def upper_corner(self):
|
||
|
return self._upper_corner
|
||
|
|
||
|
def city_object(self, name) -> Union[CityObject, None]:
|
||
|
for c in self.city_objects:
|
||
|
if c.name == name:
|
||
|
return c
|
||
|
return None
|
||
|
|
||
|
@property
|
||
|
def srs_name(self):
|
||
|
return self._srs_name
|
||
|
|
||
|
@property
|
||
|
def name(self):
|
||
|
return self._name
|
||
|
|
||
|
@name.setter
|
||
|
def name(self, value):
|
||
|
self._name = value
|
||
|
|