render wall shadows in the wall border color
This commit is contained in:
parent
e70bf8aac5
commit
2f8dc3ee32
3 changed files with 10 additions and 10 deletions
|
@ -68,7 +68,7 @@ class RenderEngine(ABC):
|
|||
pass
|
||||
|
||||
def add_geometry(self, geometry, fill: Optional[FillAttribs] = None, stroke: Optional[StrokeAttribs] = None,
|
||||
altitude=None, height=None, shape_cache_key=None, category=None, item=None):
|
||||
altitude=None, height=None, shadow_color=None, shape_cache_key=None, category=None, item=None):
|
||||
# draw a shapely geometry with a given style
|
||||
# altitude is the absolute altitude of the upper bound of the element
|
||||
# height is the height of the element
|
||||
|
@ -78,12 +78,12 @@ class RenderEngine(ABC):
|
|||
if geometry.is_empty:
|
||||
return
|
||||
|
||||
self._add_geometry(geometry=geometry, fill=fill, stroke=stroke, altitude=altitude, height=height,
|
||||
self._add_geometry(geometry=geometry, fill=fill, stroke=stroke, altitude=altitude, height=height, shadow_color=shadow_color,
|
||||
shape_cache_key=shape_cache_key, category=category, item=item)
|
||||
|
||||
@abstractmethod
|
||||
def _add_geometry(self, geometry, fill: Optional[FillAttribs], stroke: Optional[StrokeAttribs],
|
||||
altitude=None, height=None, shape_cache_key=None, category=None, item=None):
|
||||
altitude=None, height=None, shadow_color=None, shape_cache_key=None, category=None, item=None):
|
||||
pass
|
||||
|
||||
def set_mesh_lookup_data(self, data):
|
||||
|
|
|
@ -196,7 +196,7 @@ class SVGEngine(RenderEngine):
|
|||
self.clip_path_i += 1
|
||||
return defid
|
||||
|
||||
def add_shadow(self, geometry, elevation, clip_path=None):
|
||||
def add_shadow(self, geometry, elevation, color, clip_path=None):
|
||||
# add a shadow for the given geometry with the given elevation and, optionally, a clip path
|
||||
elevation = float(min(elevation, 2))
|
||||
blur_radius = elevation / 3 * 0.25
|
||||
|
@ -215,7 +215,7 @@ class SVGEngine(RenderEngine):
|
|||
'</filter>')
|
||||
self.blurs.add(elevation)
|
||||
|
||||
attribs = ' filter="url(#'+blur_id+')" fill="#000" fill-opacity="0.2"'
|
||||
attribs = ' filter="url(#'+blur_id+')" fill="'+(color or '#000')+'" fill-opacity="0.2"'
|
||||
if clip_path:
|
||||
attribs += ' clip-path="url(#'+self.register_clip_path(clip_path)+')"'
|
||||
shadow = self._create_geometry(shadow_geom, attribs)
|
||||
|
@ -237,7 +237,7 @@ class SVGEngine(RenderEngine):
|
|||
self.add_geometry(geometry=area, fill=FillAttribs('#000000', 0.1), category='darken')
|
||||
|
||||
def _add_geometry(self, geometry, fill: Optional[FillAttribs], stroke: Optional[StrokeAttribs],
|
||||
altitude=None, height=None, shape_cache_key=None, **kwargs):
|
||||
altitude=None, height=None, shadow_color=None, shape_cache_key=None, **kwargs):
|
||||
geometry = self.buffered_bbox.intersection(unwrap_hybrid_geom(geometry))
|
||||
|
||||
if geometry.is_empty:
|
||||
|
@ -268,15 +268,15 @@ class SVGEngine(RenderEngine):
|
|||
if altitude is not None or height is not None:
|
||||
if height is not None:
|
||||
if height:
|
||||
self.add_shadow(geometry, height)
|
||||
self.add_shadow(geometry, height, '#000')
|
||||
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)
|
||||
self.clip_altitudes(geometry, altitude, '#000')
|
||||
else:
|
||||
if height is not None:
|
||||
self.add_shadow(geometry, height)
|
||||
self.add_shadow(geometry, height, shadow_color)
|
||||
|
||||
element = self._create_geometry(geometry, attribs, cache_key=shape_cache_key)
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ class MapRenderer:
|
|||
engine.add_geometry(
|
||||
walls.filter(bottom=not not_full_levels,
|
||||
top=not walls_extended),
|
||||
height=geoms.default_height, fill=FillAttribs(color_manager.wall_fill), category='walls'
|
||||
height=geoms.default_height, shadow_color=color_manager.wall_border, fill=FillAttribs(color_manager.wall_fill), category='walls'
|
||||
)
|
||||
|
||||
for short_wall in geoms.short_walls:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue