2020-10-28 13:42:58 -04:00
|
|
|
"""
|
|
|
|
Layers module
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
2022-04-08 09:35:33 -04:00
|
|
|
Copyright © 2022 Concordia CERC group
|
|
|
|
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
2020-10-28 13:42:58 -04:00
|
|
|
"""
|
2021-04-01 09:25:39 -04:00
|
|
|
import uuid
|
2021-09-14 13:46:48 -04:00
|
|
|
from typing import Union
|
2021-08-06 12:28:20 -04:00
|
|
|
from city_model_structure.building_demand.material import Material
|
2020-10-28 13:42:58 -04:00
|
|
|
|
|
|
|
|
|
|
|
class Layer:
|
|
|
|
"""
|
|
|
|
Layer class
|
|
|
|
"""
|
|
|
|
def __init__(self):
|
|
|
|
self._material = None
|
|
|
|
self._thickness = None
|
2021-04-01 09:25:39 -04:00
|
|
|
self._id = None
|
|
|
|
|
|
|
|
@property
|
|
|
|
def id(self):
|
2021-06-09 14:23:45 -04:00
|
|
|
"""
|
|
|
|
Get layer id, an universally unique identifier randomly generated
|
|
|
|
:return: str
|
|
|
|
"""
|
2021-04-01 09:25:39 -04:00
|
|
|
if self._id is None:
|
|
|
|
self._id = uuid.uuid4()
|
|
|
|
return self._id
|
2020-10-28 13:42:58 -04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def material(self) -> Material:
|
|
|
|
"""
|
|
|
|
Get layer material
|
|
|
|
:return: Material
|
|
|
|
"""
|
|
|
|
return self._material
|
|
|
|
|
|
|
|
@material.setter
|
|
|
|
def material(self, value):
|
|
|
|
"""
|
|
|
|
Set layer material
|
|
|
|
:param value: Material
|
|
|
|
"""
|
|
|
|
self._material = value
|
|
|
|
|
|
|
|
@property
|
2021-09-14 13:46:48 -04:00
|
|
|
def thickness(self) -> Union[None, float]:
|
2020-10-28 13:42:58 -04:00
|
|
|
"""
|
|
|
|
Get layer thickness in meters
|
2021-09-14 13:46:48 -04:00
|
|
|
:return: None or float
|
2020-10-28 13:42:58 -04:00
|
|
|
"""
|
|
|
|
return self._thickness
|
|
|
|
|
|
|
|
@thickness.setter
|
|
|
|
def thickness(self, value):
|
|
|
|
"""
|
|
|
|
Get layer thickness in meters
|
|
|
|
:param value: float
|
|
|
|
"""
|
2021-09-14 13:46:48 -04:00
|
|
|
if value is not None:
|
|
|
|
self._thickness = float(value)
|