reorganized properties in city_object and building
This commit is contained in:
parent
1498731275
commit
fc588fab62
|
@ -11,9 +11,10 @@ class BixiFeature(CityObject):
|
|||
BixiFeature(CityObject) class
|
||||
"""
|
||||
def __init__(self, lod, surfaces, name, feature_type, coordinates):
|
||||
super().__init__(lod, surfaces, name)
|
||||
super().__init__(lod, surfaces, name, [])
|
||||
self._feature_type = feature_type
|
||||
self._coordinates = coordinates
|
||||
self._type = 'bixi_feature'
|
||||
|
||||
@property
|
||||
def feature_type(self):
|
||||
|
|
|
@ -17,7 +17,6 @@ from city_model_structure.attributes.thermal_zone import ThermalZone
|
|||
from city_model_structure.attributes.usage_zone import UsageZone
|
||||
from city_model_structure.city_object import CityObject
|
||||
from helpers.geometry_helper import GeometryHelper as gh
|
||||
from helpers.configuration_helper import ConfigurationHelper
|
||||
from trimesh import Trimesh
|
||||
|
||||
|
||||
|
@ -26,14 +25,12 @@ class Building(CityObject):
|
|||
Building(CityObject) class
|
||||
"""
|
||||
def __init__(self, name, lod, surfaces, terrains, year_of_construction, function, city_lower_corner):
|
||||
super().__init__(lod, surfaces, name)
|
||||
super().__init__(lod, surfaces, name, city_lower_corner)
|
||||
self._basement_heated = None
|
||||
self._attic_heated = None
|
||||
self._terrains = terrains
|
||||
self._year_of_construction = year_of_construction
|
||||
self._function = function
|
||||
self._city_lower_corner = city_lower_corner
|
||||
self._building_lower_corner = None
|
||||
self._average_storey_height = None
|
||||
self._storeys_above_ground = None
|
||||
self._floor_area = None
|
||||
|
@ -42,14 +39,6 @@ class Building(CityObject):
|
|||
self._type = 'building'
|
||||
self._heating = dict()
|
||||
self._cooling = dict()
|
||||
self._external_temperature = dict()
|
||||
self._global_horizontal = dict()
|
||||
self._diffuse = dict()
|
||||
self._beam = dict()
|
||||
self._min_x = ConfigurationHelper().max_coordinate
|
||||
self._min_y = ConfigurationHelper().max_coordinate
|
||||
self._min_z = ConfigurationHelper().max_coordinate
|
||||
self._centroid = None
|
||||
self._eave_height = None
|
||||
|
||||
self._grounds = []
|
||||
|
@ -257,14 +246,6 @@ class Building(CityObject):
|
|||
def _tuple_to_point(xy_tuple):
|
||||
return [xy_tuple[0], xy_tuple[1], 0.0]
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
"""
|
||||
building type
|
||||
:return: str
|
||||
"""
|
||||
return self._type
|
||||
|
||||
@property
|
||||
def heating(self) -> dict:
|
||||
"""
|
||||
|
@ -297,76 +278,6 @@ class Building(CityObject):
|
|||
"""
|
||||
self._cooling = value
|
||||
|
||||
@property
|
||||
def external_temperature(self) -> dict:
|
||||
"""
|
||||
external temperature surrounding the building in grads Celsius
|
||||
:return: dict{DataFrame(float)}
|
||||
"""
|
||||
return self._external_temperature
|
||||
|
||||
@external_temperature.setter
|
||||
def external_temperature(self, value):
|
||||
"""
|
||||
external temperature surrounding the building in grads Celsius
|
||||
:param value: dict{DataFrame(float)}
|
||||
"""
|
||||
self._external_temperature = value
|
||||
|
||||
@property
|
||||
def global_horizontal(self) -> dict:
|
||||
"""
|
||||
global horizontal radiation surrounding the building in W/m2
|
||||
:return: dict{DataFrame(float)}
|
||||
"""
|
||||
return self._global_horizontal
|
||||
|
||||
@global_horizontal.setter
|
||||
def global_horizontal(self, value):
|
||||
"""
|
||||
global horizontal radiation surrounding the building in W/m2
|
||||
:param value: dict{DataFrame(float)}
|
||||
"""
|
||||
self._global_horizontal = value
|
||||
|
||||
@property
|
||||
def diffuse(self) -> dict:
|
||||
"""
|
||||
diffuse radiation surrounding the building in W/m2
|
||||
:return: dict{DataFrame(float)}
|
||||
"""
|
||||
return self._diffuse
|
||||
|
||||
@diffuse.setter
|
||||
def diffuse(self, value):
|
||||
"""
|
||||
diffuse radiation surrounding the building in W/m2
|
||||
:param value: dict{DataFrame(float)}
|
||||
"""
|
||||
self._diffuse = value
|
||||
|
||||
@property
|
||||
def beam(self) -> dict:
|
||||
"""
|
||||
beam radiation surrounding the building in W/m2
|
||||
:return: dict{DataFrame(float)}
|
||||
"""
|
||||
return self._beam
|
||||
|
||||
@beam.setter
|
||||
def beam(self, value):
|
||||
"""
|
||||
beam radiation surrounding the building in W/m2
|
||||
:param value: dict{DataFrame(float)}
|
||||
"""
|
||||
self._beam = value
|
||||
|
||||
@property
|
||||
def building_lower_corner(self):
|
||||
if self._building_lower_corner is None:
|
||||
self._building_lower_corner = [self._min_x, self._min_y, self._min_z]
|
||||
return self._building_lower_corner
|
||||
|
||||
@property
|
||||
def eave_height(self):
|
||||
"""
|
||||
|
@ -406,8 +317,8 @@ class Building(CityObject):
|
|||
|
||||
storeys = []
|
||||
for n in range(0, number_of_storeys - 1):
|
||||
point_plane = [self.building_lower_corner[0], self.building_lower_corner[1],
|
||||
self.building_lower_corner[2] + height * (n + 1)]
|
||||
point_plane = [self.city_object_lower_corner[0], self.city_object_lower_corner[1],
|
||||
self.city_object_lower_corner[2] + height * (n + 1)]
|
||||
normal = [0, 0, -1]
|
||||
storey, trimesh = gh.divide_mesh_by_plane(trimesh, normal, point_plane)
|
||||
storeys.append(storey)
|
||||
|
@ -440,9 +351,3 @@ class Building(CityObject):
|
|||
if surface.type == 'Ground':
|
||||
self._floor_area += surface.perimeter_polygon.area
|
||||
return self._floor_area
|
||||
|
||||
@property
|
||||
def centroid(self):
|
||||
if self._centroid is None:
|
||||
self._centroid = self.simplified_polyhedron.centroid
|
||||
return self._centroid
|
||||
|
|
|
@ -5,8 +5,8 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
|
|||
"""
|
||||
from typing import List, Union
|
||||
from city_model_structure.attributes.surface import Surface
|
||||
from helpers.geometry_helper import GeometryHelper
|
||||
from city_model_structure.attributes.polyhedron import Polyhedron
|
||||
from helpers.configuration_helper import ConfigurationHelper
|
||||
import math
|
||||
|
||||
|
||||
|
@ -14,13 +14,23 @@ class CityObject:
|
|||
"""
|
||||
class CityObject
|
||||
"""
|
||||
def __init__(self, lod, surfaces, name):
|
||||
def __init__(self, lod, surfaces, name, city_lower_corner):
|
||||
self._name = name
|
||||
self._lod = lod
|
||||
self._surfaces = surfaces
|
||||
self._city_lower_corner = city_lower_corner
|
||||
self._type = None
|
||||
self._city_object_lower_corner = None
|
||||
self._detailed_polyhedron = None
|
||||
self._simplified_polyhedron = None
|
||||
self._geometry = GeometryHelper()
|
||||
self._min_x = ConfigurationHelper().max_coordinate
|
||||
self._min_y = ConfigurationHelper().max_coordinate
|
||||
self._min_z = ConfigurationHelper().max_coordinate
|
||||
self._centroid = None
|
||||
self._external_temperature = dict()
|
||||
self._global_horizontal = dict()
|
||||
self._diffuse = dict()
|
||||
self._beam = dict()
|
||||
|
||||
@property
|
||||
def lod(self):
|
||||
|
@ -31,6 +41,14 @@ class CityObject:
|
|||
lod = math.log(self._lod, 2) + 1
|
||||
return lod
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
"""
|
||||
city object type
|
||||
:return: str
|
||||
"""
|
||||
return self._type
|
||||
|
||||
@property
|
||||
def volume(self):
|
||||
"""
|
||||
|
@ -93,7 +111,9 @@ class CityObject:
|
|||
City object location
|
||||
:return: [x,y,z]
|
||||
"""
|
||||
return self.simplified_polyhedron.centroid
|
||||
if self._centroid is None:
|
||||
self._centroid = self.simplified_polyhedron.centroid
|
||||
return self._centroid
|
||||
|
||||
@property
|
||||
def max_height(self):
|
||||
|
@ -102,3 +122,73 @@ class CityObject:
|
|||
:return: float
|
||||
"""
|
||||
return self.simplified_polyhedron.max_z
|
||||
|
||||
@property
|
||||
def external_temperature(self) -> dict:
|
||||
"""
|
||||
external temperature surrounding the city object in grads Celsius
|
||||
:return: dict{DataFrame(float)}
|
||||
"""
|
||||
return self._external_temperature
|
||||
|
||||
@external_temperature.setter
|
||||
def external_temperature(self, value):
|
||||
"""
|
||||
external temperature surrounding the city object in grads Celsius
|
||||
:param value: dict{DataFrame(float)}
|
||||
"""
|
||||
self._external_temperature = value
|
||||
|
||||
@property
|
||||
def global_horizontal(self) -> dict:
|
||||
"""
|
||||
global horizontal radiation surrounding the city object in W/m2
|
||||
:return: dict{DataFrame(float)}
|
||||
"""
|
||||
return self._global_horizontal
|
||||
|
||||
@global_horizontal.setter
|
||||
def global_horizontal(self, value):
|
||||
"""
|
||||
global horizontal radiation surrounding the city object in W/m2
|
||||
:param value: dict{DataFrame(float)}
|
||||
"""
|
||||
self._global_horizontal = value
|
||||
|
||||
@property
|
||||
def diffuse(self) -> dict:
|
||||
"""
|
||||
diffuse radiation surrounding the city object in W/m2
|
||||
:return: dict{DataFrame(float)}
|
||||
"""
|
||||
return self._diffuse
|
||||
|
||||
@diffuse.setter
|
||||
def diffuse(self, value):
|
||||
"""
|
||||
diffuse radiation surrounding the city object in W/m2
|
||||
:param value: dict{DataFrame(float)}
|
||||
"""
|
||||
self._diffuse = value
|
||||
|
||||
@property
|
||||
def beam(self) -> dict:
|
||||
"""
|
||||
beam radiation surrounding the city object in W/m2
|
||||
:return: dict{DataFrame(float)}
|
||||
"""
|
||||
return self._beam
|
||||
|
||||
@beam.setter
|
||||
def beam(self, value):
|
||||
"""
|
||||
beam radiation surrounding the city object in W/m2
|
||||
:param value: dict{DataFrame(float)}
|
||||
"""
|
||||
self._beam = value
|
||||
|
||||
@property
|
||||
def city_object_lower_corner(self):
|
||||
if self._city_object_lower_corner is None:
|
||||
self._city_object_lower_corner = [self._min_x, self._min_y, self._min_z]
|
||||
return self._city_object_lower_corner
|
||||
|
|
|
@ -11,9 +11,10 @@ class CompostingPlant(CityObject):
|
|||
CompostingPlant(CityObject) class
|
||||
"""
|
||||
def __init__(self, lod, surfaces, name, waste_type, capacity):
|
||||
super().__init__(lod, surfaces, name)
|
||||
super().__init__(lod, surfaces, name, [])
|
||||
self._waste_type = waste_type
|
||||
self._capacity = capacity
|
||||
self._type = 'composting_plant'
|
||||
|
||||
@property
|
||||
def waste_type(self):
|
||||
|
|
|
@ -11,10 +11,11 @@ class SubwayEntrance(CityObject):
|
|||
SubwayEntrance(CityObject) class
|
||||
"""
|
||||
def __init__(self, name, latitude, longitude):
|
||||
super().__init__(0, [], name)
|
||||
super().__init__(0, [], name, [])
|
||||
self._name = name
|
||||
self._latitude = latitude
|
||||
self._longitude = longitude
|
||||
self._type = 'subway_entrance'
|
||||
|
||||
@property
|
||||
def latitude(self):
|
||||
|
|
|
@ -11,9 +11,10 @@ class Tree(CityObject):
|
|||
Tree(CityObject) class
|
||||
"""
|
||||
def __init__(self, lod, surfaces, name, height, canopy):
|
||||
super().__init__(lod, surfaces, name)
|
||||
super().__init__(lod, surfaces, name, [])
|
||||
self._height = height
|
||||
self._canopy = canopy
|
||||
self._type = 'tree'
|
||||
|
||||
@property
|
||||
def height(self):
|
||||
|
|
|
@ -4,7 +4,6 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|||
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||
Contributors Pilar Monsalvete Álvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
import sys
|
||||
import math
|
||||
import numpy as np
|
||||
import requests
|
||||
|
|
Loading…
Reference in New Issue
Block a user