Starting line information dictionary

This commit is contained in:
Guille Gutierrez 2023-02-24 15:15:27 -05:00
parent 70c0dba6bd
commit 4caea94271
2 changed files with 2 additions and 25 deletions

View File

@ -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

View File

@ -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: