forked from s_ranjbar/city_retrofit
variable name correction, it will overwrite index and most likely case bugs in case of more than one scene.
This commit is contained in:
parent
7e5ead2363
commit
d91da411fd
|
@ -54,7 +54,7 @@ class GPandas:
|
||||||
"""
|
"""
|
||||||
if self._city is None:
|
if self._city is None:
|
||||||
self._city = City(self._lower_corner, self._upper_corner, self._srs_name)
|
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
|
geom = bldg.geom
|
||||||
polygon = ShapelyPoly(geom['coordinates'][0])
|
polygon = ShapelyPoly(geom['coordinates'][0])
|
||||||
height = float(bldg['height_mean'])
|
height = float(bldg['height_mean'])
|
||||||
|
@ -62,7 +62,7 @@ class GPandas:
|
||||||
trimesh.repair.fill_holes(building_mesh)
|
trimesh.repair.fill_holes(building_mesh)
|
||||||
trimesh.repair.fix_winding(building_mesh)
|
trimesh.repair.fix_winding(building_mesh)
|
||||||
year_of_construction = int(bldg['year_built'])
|
year_of_construction = int(bldg['year_built'])
|
||||||
name = str(ix)
|
name = str(scene_index)
|
||||||
lod = 1
|
lod = 1
|
||||||
if year_of_construction > 2000:
|
if year_of_construction > 2000:
|
||||||
function = cte.RESIDENTIAL
|
function = cte.RESIDENTIAL
|
||||||
|
@ -71,13 +71,13 @@ class GPandas:
|
||||||
|
|
||||||
surfaces = []
|
surfaces = []
|
||||||
face_normal = building_mesh.face_normals
|
face_normal = building_mesh.face_normals
|
||||||
for ix, face in enumerate(building_mesh.faces):
|
for face_index, face in enumerate(building_mesh.faces):
|
||||||
points = []
|
points = []
|
||||||
for vertex_index in face:
|
for vertex_index in face:
|
||||||
points.append(building_mesh.vertices[vertex_index])
|
points.append(building_mesh.vertices[vertex_index])
|
||||||
solid_polygon = Polygon(points)
|
solid_polygon = Polygon(points)
|
||||||
perimeter_polygon = solid_polygon
|
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)
|
surface = Surface(solid_polygon, perimeter_polygon, surface_type=s_type)
|
||||||
surfaces.append(surface)
|
surfaces.append(surface)
|
||||||
building = Building(name, lod, surfaces, year_of_construction, function, self._lower_corner, terrains=None)
|
building = Building(name, lod, surfaces, year_of_construction, function, self._lower_corner, terrains=None)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user