forked from s_ranjbar/city_retrofit
partially implemented shared walls
This commit is contained in:
parent
e04b713416
commit
7092f43f32
|
@ -447,9 +447,20 @@ class Building(CityObject):
|
||||||
Identifies which building' walls adjoin the neighbouring building and saves that information in the
|
Identifies which building' walls adjoin the neighbouring building and saves that information in the
|
||||||
corresponding surfaces
|
corresponding surfaces
|
||||||
"""
|
"""
|
||||||
for wall in self.walls:
|
x = int((self.upper_corner[0] - self.lower_corner[0]) / 2)
|
||||||
percentage = 0
|
y = int((self.upper_corner[1] - self.lower_corner[1]) / 2)
|
||||||
for building in self._neighbours:
|
city_map = [['' for _ in range(y+1)] for _ in range(x+1)]
|
||||||
for neighbour_wall in building.walls:
|
city_image = [[0 for _ in range(y+1)] for _ in range(x+1)]
|
||||||
percentage += wall.shared_percentage(neighbour_wall)
|
for building_name in building_names:
|
||||||
wall.set_shared_percentage(percentage)
|
building = city.city_object(building_name)
|
||||||
|
for ground in building.grounds:
|
||||||
|
length = len(ground.perimeter_polygon.coordinates) - 1
|
||||||
|
for i, coordinate in enumerate(ground.perimeter_polygon.coordinates):
|
||||||
|
j = i+1
|
||||||
|
if i == length:
|
||||||
|
j = 0
|
||||||
|
next_coordinate = ground.perimeter_polygon.coordinates[j]
|
||||||
|
point_1 = GeometryHelper.coordinate_to_map_point(coordinate, city)
|
||||||
|
point_2 = GeometryHelper.coordinate_to_map_point(next_coordinate, city)
|
||||||
|
for x in range(point_1.x, point_2.x):
|
||||||
|
y = GeometryHelper.point_between_point(point_1, point_2, x).y
|
||||||
|
|
|
@ -336,12 +336,3 @@ class Surface:
|
||||||
:param value: None or [ThermalBoundary]
|
:param value: None or [ThermalBoundary]
|
||||||
"""
|
"""
|
||||||
self._associated_thermal_boundaries = value
|
self._associated_thermal_boundaries = value
|
||||||
|
|
||||||
def shared_percentage(self, neighbour_surface):
|
|
||||||
"""
|
|
||||||
Calculate the percentage of a surface that is shared with a neighbour surface
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
_shared_percentage = 0
|
|
||||||
|
|
||||||
return _shared_percentage
|
|
|
@ -24,11 +24,15 @@ class CityObject:
|
||||||
self._surfaces = surfaces
|
self._surfaces = surfaces
|
||||||
self._type = None
|
self._type = None
|
||||||
self._city_object_lower_corner = None
|
self._city_object_lower_corner = None
|
||||||
|
self._city_object_upper_corner = None
|
||||||
self._detailed_polyhedron = None
|
self._detailed_polyhedron = None
|
||||||
self._simplified_polyhedron = None
|
self._simplified_polyhedron = None
|
||||||
self._min_x = ConfigurationHelper().max_coordinate
|
self._min_x = ConfigurationHelper().max_coordinate
|
||||||
self._min_y = ConfigurationHelper().max_coordinate
|
self._min_y = ConfigurationHelper().max_coordinate
|
||||||
self._min_z = ConfigurationHelper().max_coordinate
|
self._min_z = ConfigurationHelper().max_coordinate
|
||||||
|
self._max_x = ConfigurationHelper().min_coordinate
|
||||||
|
self._max_y = ConfigurationHelper().min_coordinate
|
||||||
|
self._max_z = ConfigurationHelper().min_coordinate
|
||||||
self._centroid = None
|
self._centroid = None
|
||||||
self._external_temperature = dict()
|
self._external_temperature = dict()
|
||||||
self._global_horizontal = dict()
|
self._global_horizontal = dict()
|
||||||
|
@ -212,6 +216,16 @@ class CityObject:
|
||||||
self._city_object_lower_corner = [self._min_x, self._min_y, self._min_z]
|
self._city_object_lower_corner = [self._min_x, self._min_y, self._min_z]
|
||||||
return self._city_object_lower_corner
|
return self._city_object_lower_corner
|
||||||
|
|
||||||
|
@property
|
||||||
|
def upper_corner(self):
|
||||||
|
"""
|
||||||
|
Get city object upper corner coordinates [x, y, z]
|
||||||
|
:return: [x,y,z]
|
||||||
|
"""
|
||||||
|
if self._city_object_upper_corner is None:
|
||||||
|
self._city_object_upper_corner = [self._max_x, self._max_y, self._max_z]
|
||||||
|
return self._city_object_upper_corner
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def sensors(self) -> List[Sensor]:
|
def sensors(self) -> List[Sensor]:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -14,6 +14,7 @@ from hub.city_model_structure.attributes.polygon import Polygon
|
||||||
from hub.city_model_structure.attributes.polyhedron import Polyhedron
|
from hub.city_model_structure.attributes.polyhedron import Polyhedron
|
||||||
from hub.helpers.location import Location
|
from hub.helpers.location import Location
|
||||||
|
|
||||||
|
|
||||||
class MapPoint:
|
class MapPoint:
|
||||||
def __init__(self, x, y):
|
def __init__(self, x, y):
|
||||||
self.x = int(x)
|
self.x = int(x)
|
||||||
|
@ -22,10 +23,12 @@ class MapPoint:
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'({self.x}, {self.y})'
|
return f'({self.x}, {self.y})'
|
||||||
|
|
||||||
|
|
||||||
class GeometryHelper:
|
class GeometryHelper:
|
||||||
"""
|
"""
|
||||||
Geometry helper class
|
Geometry helper class
|
||||||
"""
|
"""
|
||||||
|
# todo: complete dictionary
|
||||||
srs_transformations = {
|
srs_transformations = {
|
||||||
'urn:adv:crs:ETRS89_UTM32*DE_DHHN92_NH': 'epsg:25832'
|
'urn:adv:crs:ETRS89_UTM32*DE_DHHN92_NH': 'epsg:25832'
|
||||||
}
|
}
|
||||||
|
@ -43,7 +46,7 @@ class GeometryHelper:
|
||||||
m = (point_1.y - point_2.y)/(point_1.x - point_2.x)
|
m = (point_1.y - point_2.y)/(point_1.x - point_2.x)
|
||||||
c = point_2.y - (m*point_2.x)
|
c = point_2.y - (m*point_2.x)
|
||||||
y = (m*x)+c
|
y = (m*x)+c
|
||||||
return MapPoint(x,y)
|
return MapPoint(x, y)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def city_mapping(city, building_names=None):
|
def city_mapping(city, building_names=None):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user