only look through holes to levels below

This commit is contained in:
Laura Klünder 2017-10-19 15:31:30 +02:00
parent ed2cedaa87
commit f167a72a49
2 changed files with 36 additions and 5 deletions

View file

@ -13,6 +13,13 @@ class LevelGeometries:
self.altitudeareas = []
self.walls = None
self.doors = None
self.holes = None
@staticmethod
def crop(self, geometry, crop_to):
if crop_to is None:
return geometry
return geometry.intersection(crop_to)
@staticmethod
def rebuild():
@ -32,6 +39,9 @@ class LevelGeometries:
spaces_geom = unary_union([s.geometry for s in level.spaces.all()])
geoms.doors = unary_union([d.geometry for d in level.doors.all()])
walkable_geom = unary_union([s.walkable_geom for s in level.spaces.all()]).union(geoms.doors)
if level.on_top_of_id is None:
geoms.holes = spaces_geom.difference(walkable_geom)
print(level.pk, geoms.holes.area)
for altitudearea in level.altitudeareas.all():
geoms.altitudeareas.append((altitudearea.geometry.intersection(walkable_geom), altitudearea.altitude))