fix orientation problem on levels with no stairs
This commit is contained in:
parent
0253d378ed
commit
a9b1ed1914
2 changed files with 3 additions and 2 deletions
|
@ -11,6 +11,7 @@ from scipy.sparse.csgraph._shortest_path import dijkstra
|
|||
from shapely import prepared
|
||||
from shapely.affinity import scale
|
||||
from shapely.geometry import JOIN_STYLE, LineString, MultiPolygon
|
||||
from shapely.geometry.polygon import orient
|
||||
from shapely.ops import unary_union
|
||||
|
||||
from c3nav.mapdata.cache import changed_geometries
|
||||
|
@ -165,7 +166,8 @@ class AltitudeArea(LevelGeometryMixin, models.Model):
|
|||
tuple(o.buffered_geometry for o in space.lineobstacles.all()) +
|
||||
tuple(h.geometry for h in space.holes.all()))
|
||||
))
|
||||
areas = unary_union(areas+list(door.geometry for door in level.doors.all()))
|
||||
|
||||
areas = orient(unary_union(areas+list(door.geometry for door in level.doors.all())))
|
||||
|
||||
# collect all stairs on this level
|
||||
for space in level.spaces.all():
|
||||
|
|
|
@ -266,7 +266,6 @@ def cut_polygon_with_line(polygon: Polygon, line: LineString):
|
|||
|
||||
|
||||
def clean_cut_polygon(polygon: Polygon) -> Polygon:
|
||||
polygon = orient(polygon)
|
||||
interiors = []
|
||||
interiors.extend(cut_ring(polygon.exterior))
|
||||
exteriors = [(i, ring) for (i, ring) in enumerate(interiors) if ring.is_ccw]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue