improve stair rendering using stair areas

This commit is contained in:
Laura Klünder 2016-12-08 12:56:49 +01:00
parent 009cf41dad
commit 6cea5949b3
2 changed files with 9 additions and 10 deletions

View file

@ -1,7 +1,7 @@
from django.db import models
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from shapely.geometry import JOIN_STYLE
from shapely.geometry import CAP_STYLE, JOIN_STYLE
from shapely.ops import cascaded_union
from c3nav.mapdata.models.base import MapItem
@ -200,8 +200,8 @@ class LevelGeometries():
return cascaded_union([stair.geometry for stair in self.level.stairs.all()]).intersection(self.accessible)
@cached_property
def stair_shadows(self):
shadows = []
def stair_areas(self):
left = []
for stair in assert_multilinestring(self.stairs):
shadows.append(stair.parallel_offset(0.1, 'left', join_style=JOIN_STYLE.mitre))
return cascaded_union(shadows)
left.append(stair.parallel_offset(0.15, 'left', join_style=JOIN_STYLE.mitre))
return cascaded_union(left).buffer(0.20, join_style=JOIN_STYLE.mitre, cap_style=CAP_STYLE.flat)

View file

@ -112,15 +112,14 @@ class LevelRenderer():
contents.append(self.polygon_svg(self.level.geometries.outsides_with_holes,
fill_color='#DCE6DC'))
contents.append(self.polygon_svg(self.level.geometries.stair_shadows,
stroke_color='#000000',
stroke_width=0.1,
stroke_opacity=0.1))
contents.append(self.polygon_svg(self.level.geometries.stair_areas,
fill_color='#000000',
fill_opacity=0.03))
contents.append(self.polygon_svg(self.level.geometries.stairs,
stroke_color='#000000',
stroke_width=0.06,
stroke_opacity=0.3))
stroke_opacity=0.2))
contents.append(self.polygon_svg(self.level.geometries.walls_shadow,
fill_color='#000000',