From 891a1df418b281c19328cd94da1d0150a5800e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Sun, 5 Nov 2017 13:24:35 +0100 Subject: [PATCH] =?UTF-8?q?rename=20elevation=20=E2=86=92=20height?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/c3nav/mapdata/render/engines/base.py | 11 ++++++----- src/c3nav/mapdata/render/engines/svg.py | 16 ++++++++-------- src/c3nav/mapdata/render/renderer.py | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/c3nav/mapdata/render/engines/base.py b/src/c3nav/mapdata/render/engines/base.py index 6af4bee5..a01c9fda 100644 --- a/src/c3nav/mapdata/render/engines/base.py +++ b/src/c3nav/mapdata/render/engines/base.py @@ -48,10 +48,11 @@ class RenderEngine(ABC): pass def add_geometry(self, geometry, fill: Optional[FillAttribs] = None, stroke: Optional[StrokeAttribs] = None, - filter=None, clip_path=None, altitude=None, elevation=None, shape_cache_key=None): + filter=None, clip_path=None, altitude=None, heigth=None, shape_cache_key=None): # draw a shapely geometry with a given style - # if altitude is set, the geometry will get a calculated shadow relative to the other geometries - # if elevation is set, the geometry will get a shadow with exactly this elevation + # altitude is the absolute altitude of the upper bound of the element + # height is the height of the element + # if altitude is not set but height is, the altitude will depend on the geometries below # if fill_color is set, filter out geometries that cannot be filled if fill is not None: @@ -66,9 +67,9 @@ class RenderEngine(ABC): return self._add_geometry(geometry=geometry, fill=fill, stroke=stroke, filter=filter, clip_path=clip_path, - altitude=altitude, elevation=elevation, shape_cache_key=shape_cache_key) + altitude=altitude, height=heigth, shape_cache_key=shape_cache_key) @abstractmethod def _add_geometry(self, geometry, fill: Optional[FillAttribs] = None, stroke: Optional[StrokeAttribs] = None, - filter=None, clip_path=None, altitude=None, elevation=None, shape_cache_key=None): + filter=None, clip_path=None, altitude=None, height=None, shape_cache_key=None): pass diff --git a/src/c3nav/mapdata/render/engines/svg.py b/src/c3nav/mapdata/render/engines/svg.py index 560977cd..443928e0 100644 --- a/src/c3nav/mapdata/render/engines/svg.py +++ b/src/c3nav/mapdata/render/engines/svg.py @@ -202,7 +202,7 @@ class SVGEngine(RenderEngine): self.g += shadow def clip_altitudes(self, new_geometry, new_altitude=None): - # registrer new geometry with specific (or no) altitude + # register new geometry with specific (or no) altitude # a geometry with no altitude will reset the altitude information of its area as if nothing was ever there for altitude, geometry in tuple(self.altitudes.items()): if altitude != new_altitude: @@ -219,7 +219,7 @@ class SVGEngine(RenderEngine): self.altitudes[new_altitude] = new_geometry def _add_geometry(self, geometry, fill: Optional[FillAttribs] = None, stroke: Optional[StrokeAttribs] = None, - filter=None, clip_path=None, altitude=None, elevation=None, shape_cache_key=None): + filter=None, clip_path=None, altitude=None, height=None, shape_cache_key=None): if fill: attribs = ' fill="'+(fill.color)+'"' @@ -245,18 +245,18 @@ class SVGEngine(RenderEngine): if False: # old shadow rendering. currently needs too much resources - if altitude is not None or elevation is not None: - if elevation is not None: - if elevation: - self.add_shadow(geometry, elevation) + if altitude is not None or height is not None: + if height is not None: + if height: + self.add_shadow(geometry, height) else: for other_altitude, other_geom in self.altitudes.items(): self.add_shadow(geometry, altitude-other_altitude, clip_path=other_geom) self.clip_altitudes(geometry, altitude) else: - if elevation is not None: - self.add_shadow(geometry, elevation) + if height is not None: + self.add_shadow(geometry, height) element = self._create_geometry(geometry, attribs, cache_key=shape_cache_key) diff --git a/src/c3nav/mapdata/render/renderer.py b/src/c3nav/mapdata/render/renderer.py index daf3b466..11038504 100644 --- a/src/c3nav/mapdata/render/renderer.py +++ b/src/c3nav/mapdata/render/renderer.py @@ -106,7 +106,7 @@ class ImageRenderer: walls = bbox.intersection(geoms.walls.union(add_walls)) if walls is not None: - svg.add_geometry(walls, elevation=default_height, fill=FillAttribs('#aaaaaa')) + svg.add_geometry(walls, heigth=default_height, fill=FillAttribs('#aaaaaa')) if not geoms.doors.is_empty: svg.add_geometry(bbox.intersection(geoms.doors.difference(add_walls)), fill=FillAttribs('#ffffff'),