do not merge obstacles. this seems to get to complicated for libgeos
This commit is contained in:
parent
7a02f58175
commit
7c726ef845
4 changed files with 29 additions and 19 deletions
|
@ -42,8 +42,11 @@ class AltitudeAreaGeometries:
|
|||
faces_offset, vertices_offset)
|
||||
|
||||
for key in tuple(self.obstacles.keys()):
|
||||
faces_offset, vertices_offset = self._call_create_full(self.obstacles, key, faces, vertices,
|
||||
faces_offset, vertices_offset)
|
||||
height_obstacles = list(self.obstacles[key])
|
||||
for i in range(len(height_obstacles)):
|
||||
faces_offset, vertices_offset = self._call_create_full(height_obstacles, i, faces, vertices,
|
||||
faces_offset, vertices_offset)
|
||||
self.obstacles[key] = tuple(height_obstacles)
|
||||
|
||||
if not vertices:
|
||||
return np.empty((0, 2), dtype=np.int32), np.empty((0, 3), dtype=np.uint32)
|
||||
|
@ -90,8 +93,9 @@ class AltitudeAreaGeometries:
|
|||
lower=altitudes,
|
||||
upper=altitudes + int(0.001 * 1000),
|
||||
crops=crops)
|
||||
for height, geometry in self.obstacles.items():
|
||||
geometry.build_polyhedron(create_polyhedron,
|
||||
lower=altitudes,
|
||||
upper=altitudes + height,
|
||||
crops=crops)
|
||||
for height, height_geometries in self.obstacles.items():
|
||||
for geometry in height_geometries:
|
||||
geometry.build_polyhedron(create_polyhedron,
|
||||
lower=altitudes,
|
||||
upper=altitudes + height,
|
||||
crops=crops)
|
||||
|
|
|
@ -148,9 +148,6 @@ class LevelGeometries:
|
|||
for access_restriction, areas in tuple(color_group.items()):
|
||||
color_group[access_restriction] = unary_union(areas)
|
||||
|
||||
# merge obstacles
|
||||
obstacles = {key: unary_union(polygons) for key, polygons in obstacles.items()}
|
||||
|
||||
# add altitudegroup geometries and split ground colors into them
|
||||
for altitudearea in level.altitudeareas.all():
|
||||
altitudearea_prep = prepared.prep(altitudearea.geometry)
|
||||
|
@ -160,9 +157,13 @@ class LevelGeometries:
|
|||
for color, areas in colors.items()}
|
||||
altitudearea_colors = {color: areas for color, areas in altitudearea_colors.items() if areas}
|
||||
|
||||
altitudearea_obstacles = {height: area.intersection(altitudearea.geometry)
|
||||
for height, area in obstacles.items()
|
||||
if altitudearea_prep.intersects(area)}
|
||||
altitudearea_obstacles = {height: tuple(obstacle.intersection(altitudearea.geometry)
|
||||
for obstacle in height_obstacles
|
||||
if altitudearea_prep.intersects(obstacle))
|
||||
for height, height_obstacles in obstacles.items()}
|
||||
altitudearea_obstacles = {height: height_obstacles
|
||||
for height, height_obstacles in obstacles.items()
|
||||
if height_obstacles}
|
||||
geoms.altitudeareas.append(AltitudeAreaGeometries(altitudearea,
|
||||
altitudearea_colors,
|
||||
altitudearea_obstacles))
|
||||
|
|
|
@ -189,9 +189,13 @@ class LevelRenderData:
|
|||
new_colors[color] = new_areas
|
||||
new_altitudearea.colors = new_colors
|
||||
|
||||
new_altitudearea.obstacles = {key: new_geometry.intersection(areas)
|
||||
for key, areas in altitudearea.obstacles.items()
|
||||
if new_geometry_prep.intersects(areas)}
|
||||
new_altitudearea.obstacles = {key: tuple(new_geometry.intersection(obstacle)
|
||||
for obstacle in height_obstacles
|
||||
if new_geometry_prep.intersects(obstacle))
|
||||
for key, height_obstacles in altitudearea.obstacles.items()}
|
||||
new_altitudearea.obstacles = {height: height_obstacles
|
||||
for height, height_obstacles in new_altitudearea.obstacles.items()
|
||||
if height_obstacles}
|
||||
|
||||
new_geoms.altitudeareas.append(new_altitudearea)
|
||||
|
||||
|
|
|
@ -105,9 +105,10 @@ class MapRenderer:
|
|||
|
||||
# add obstacles after everything related to ground for the nice right order
|
||||
for i, altitudearea in enumerate(geoms.altitudeareas):
|
||||
for height, obstacle in altitudearea.obstacles.items():
|
||||
engine.add_geometry(obstacle, fill=FillAttribs('#B7B7B7'),
|
||||
stroke=StrokeAttribs('#888888', 0.05, min_px=0.2), category='obstacles')
|
||||
for height, height_obstacles in altitudearea.obstacles.items():
|
||||
for obstacle in height_obstacles:
|
||||
engine.add_geometry(obstacle, fill=FillAttribs('#B7B7B7'),
|
||||
stroke=StrokeAttribs('#888888', 0.05, min_px=0.2), category='obstacles')
|
||||
|
||||
# add walls, stroke_px makes sure that all walls are at least 1px thick on all zoom levels,
|
||||
walls = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue