85 lines
1.9 KiB
Python
85 lines
1.9 KiB
Python
"""
|
|
InternalZone module. It saves the original geometrical information from interiors together with some attributes of those
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
Copyright © 2022 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
|
"""
|
|
import uuid
|
|
from city_model_structure.building_demand.usage_zone import UsageZone
|
|
from city_model_structure.attributes.polyhedron import Polyhedron
|
|
|
|
|
|
class InternalZone:
|
|
"""
|
|
InternalZone class
|
|
"""
|
|
def __init__(self, surfaces, area):
|
|
self._surfaces = surfaces
|
|
self._id = None
|
|
self._geometry = None
|
|
self._volume = None
|
|
self._area = area
|
|
self._usage_zones = []
|
|
|
|
@property
|
|
def id(self):
|
|
"""
|
|
Get internal zone id, an universally unique identifier randomly generated
|
|
:return: str
|
|
"""
|
|
if self._id is None:
|
|
self._id = uuid.uuid4()
|
|
return self._id
|
|
|
|
@property
|
|
def geometry(self) -> Polyhedron:
|
|
"""
|
|
Get internal zone geometry
|
|
:return: Polyhedron
|
|
"""
|
|
if self._geometry is None:
|
|
polygons = []
|
|
for surface in self.surfaces:
|
|
polygons.append(surface.perimeter_polygon)
|
|
self._geometry = Polyhedron(polygons)
|
|
return self._geometry
|
|
|
|
@property
|
|
def surfaces(self):
|
|
"""
|
|
Get internal zone surfaces
|
|
:return: [Surface]
|
|
"""
|
|
return self._surfaces
|
|
|
|
@property
|
|
def volume(self):
|
|
"""
|
|
Get internal zone volume in cubic meters
|
|
:return: float
|
|
"""
|
|
return self.geometry.volume
|
|
|
|
@property
|
|
def area(self):
|
|
"""
|
|
Get internal zone area in square meters
|
|
:return: float
|
|
"""
|
|
return self._area
|
|
|
|
@property
|
|
def usage_zones(self) -> [UsageZone]:
|
|
"""
|
|
Get internal zone usage zones
|
|
:return: [UsageZone]
|
|
"""
|
|
return self._usage_zones
|
|
|
|
@usage_zones.setter
|
|
def usage_zones(self, value):
|
|
"""
|
|
Set internal zone usage zones
|
|
:param value: [UsageZone]
|
|
"""
|
|
self._usage_zones = value
|