Included energy systems attribute
This commit is contained in:
parent
df3f33b45a
commit
567fde0012
|
@ -2,6 +2,7 @@
|
||||||
City module
|
City module
|
||||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||||
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||||
|
Contributor Peter Yefi peteryefi@gmail.com
|
||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
import sys
|
import sys
|
||||||
|
@ -20,6 +21,7 @@ from city_model_structure.parts_consisting_building import PartsConsistingBuildi
|
||||||
from city_model_structure.subway_entrance import SubwayEntrance
|
from city_model_structure.subway_entrance import SubwayEntrance
|
||||||
from helpers.geometry_helper import GeometryHelper
|
from helpers.geometry_helper import GeometryHelper
|
||||||
from helpers.location import Location
|
from helpers.location import Location
|
||||||
|
from city_model_structure.energy_system import EnergySystem
|
||||||
|
|
||||||
|
|
||||||
class City:
|
class City:
|
||||||
|
@ -47,6 +49,7 @@ class City:
|
||||||
self._parts_consisting_buildings = None
|
self._parts_consisting_buildings = None
|
||||||
self._city_objects_clusters = None
|
self._city_objects_clusters = None
|
||||||
self._city_objects = None
|
self._city_objects = None
|
||||||
|
self._energy_systems = None
|
||||||
|
|
||||||
def _get_location(self) -> Location:
|
def _get_location(self) -> Location:
|
||||||
if self._location is None:
|
if self._location is None:
|
||||||
|
@ -129,6 +132,9 @@ class City:
|
||||||
if self.subway_entrances is not None:
|
if self.subway_entrances is not None:
|
||||||
for subway_entrance in self.subway_entrances:
|
for subway_entrance in self.subway_entrances:
|
||||||
self._city_objects.append(subway_entrance)
|
self._city_objects.append(subway_entrance)
|
||||||
|
if self.energy_systems is not None:
|
||||||
|
for energy_system in self.energy_systems:
|
||||||
|
self._city_objects.append(energy_system)
|
||||||
return self._city_objects
|
return self._city_objects
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -188,6 +194,10 @@ class City:
|
||||||
if self._subway_entrances is None:
|
if self._subway_entrances is None:
|
||||||
self._subway_entrances = []
|
self._subway_entrances = []
|
||||||
self._subway_entrances.append(new_city_object)
|
self._subway_entrances.append(new_city_object)
|
||||||
|
elif new_city_object.type == 'energy_system':
|
||||||
|
if self._energy_systems is None:
|
||||||
|
self._energy_systems = []
|
||||||
|
self._energy_systems.append(new_city_object)
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError(new_city_object.type)
|
raise NotImplementedError(new_city_object.type)
|
||||||
|
|
||||||
|
@ -329,6 +339,14 @@ class City:
|
||||||
"""
|
"""
|
||||||
return self._parts_consisting_buildings
|
return self._parts_consisting_buildings
|
||||||
|
|
||||||
|
@property
|
||||||
|
def energy_systems(self) -> Union[List[EnergySystem], None]:
|
||||||
|
"""
|
||||||
|
Get energy systems belonging to the city
|
||||||
|
:return: None or [EnergySystem]
|
||||||
|
"""
|
||||||
|
return self._energy_systems
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def city_objects_clusters(self) -> Union[List[CityObjectsCluster], None]:
|
def city_objects_clusters(self) -> Union[List[CityObjectsCluster], None]:
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user