Merge remote-tracking branch 'origin/shared_surfaces_method' into shared_surfaces_method
This commit is contained in:
commit
0378d60100
|
@ -441,26 +441,3 @@ class Building(CityObject):
|
|||
for usage in internal_zone.usages:
|
||||
_usage = f'{_usage}{usage.name}_{usage.percentage} '
|
||||
return _usage.rstrip()
|
||||
|
||||
def identify_shared_walls(self):
|
||||
"""
|
||||
Identifies which building' walls adjoin the neighbouring building and saves that information in the
|
||||
corresponding surfaces
|
||||
"""
|
||||
x = int((self.upper_corner[0] - self.lower_corner[0]) / 2)
|
||||
y = int((self.upper_corner[1] - self.lower_corner[1]) / 2)
|
||||
city_map = [['' for _ in range(y+1)] for _ in range(x+1)]
|
||||
city_image = [[0 for _ in range(y+1)] for _ in range(x+1)]
|
||||
for building_name in building_names:
|
||||
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
|
||||
|
|
|
@ -91,7 +91,7 @@ class GeometryHelper:
|
|||
j = 0
|
||||
next_coordinate = ground.perimeter_polygon.coordinates[j]
|
||||
line_dictionary = {"line": line, "coordinate_1": coordinate, "coordinate_2":next_coordinate, "points": 0}
|
||||
print(line_dictionary)
|
||||
print(building_name, line_dictionary['line'])
|
||||
point = GeometryHelper.coordinate_to_map_point(coordinate, city)
|
||||
distance = GeometryHelper.distance_between_points(coordinate, next_coordinate)
|
||||
if distance == 0:
|
||||
|
@ -101,7 +101,7 @@ class GeometryHelper:
|
|||
for k in range(0, int(distance)):
|
||||
x = MapPoint(point.x + (delta_x * k), point.y + (delta_y * k)).x
|
||||
y = MapPoint(point.x + (delta_x * k), point.y + (delta_y * k)).y
|
||||
if city_map[x][y] == '':
|
||||
if city_map[x][y] == {}:
|
||||
city_map[x][y] = building.name
|
||||
city_image[x, y] = (100, 0, 0)
|
||||
elif city_map[x][y] != building.name:
|
||||
|
|
Loading…
Reference in New Issue
Block a user