variable name correction, it will overwrite index and most likely case bugs in case of more than one scene.

This commit is contained in:
Guille Gutierrez 2022-11-15 11:28:23 -05:00
parent 7e5ead2363
commit d91da411fd

View File

@ -54,7 +54,7 @@ class GPandas:
"""
if self._city is None:
self._city = City(self._lower_corner, self._upper_corner, self._srs_name)
for ix, bldg in self._scene.iterrows():
for scene_index, bldg in self._scene.iterrows():
geom = bldg.geom
polygon = ShapelyPoly(geom['coordinates'][0])
height = float(bldg['height_mean'])
@ -62,7 +62,7 @@ class GPandas:
trimesh.repair.fill_holes(building_mesh)
trimesh.repair.fix_winding(building_mesh)
year_of_construction = int(bldg['year_built'])
name = str(ix)
name = str(scene_index)
lod = 1
if year_of_construction > 2000:
function = cte.RESIDENTIAL
@ -71,13 +71,13 @@ class GPandas:
surfaces = []
face_normal = building_mesh.face_normals
for ix, face in enumerate(building_mesh.faces):
for face_index, face in enumerate(building_mesh.faces):
points = []
for vertex_index in face:
points.append(building_mesh.vertices[vertex_index])
solid_polygon = Polygon(points)
perimeter_polygon = solid_polygon
s_type = cte.GROUND if face_normal[ix][2] == -1 else (cte.ROOF if face_normal[ix][2] == 1 else cte.WALL)
s_type = cte.GROUND if face_normal[face_index][2] == -1 else (cte.ROOF if face_normal[face_index][2] == 1 else cte.WALL)
surface = Surface(solid_polygon, perimeter_polygon, surface_type=s_type)
surfaces.append(surface)
building = Building(name, lod, surfaces, year_of_construction, function, self._lower_corner, terrains=None)