make sure thin walls are always visible
This commit is contained in:
parent
38a63c5a6a
commit
0dd94d7459
2 changed files with 9 additions and 3 deletions
|
@ -31,8 +31,11 @@ def render_svg(level, miny, minx, maxy, maxx, scale=1):
|
||||||
|
|
||||||
spaces_geom = bbox.intersection(unary_union([s.geometry for s in level.spaces.all()]))
|
spaces_geom = bbox.intersection(unary_union([s.geometry for s in level.spaces.all()]))
|
||||||
doors_geom = bbox.intersection(unary_union([d.geometry for d in level.doors.all()]))
|
doors_geom = bbox.intersection(unary_union([d.geometry for d in level.doors.all()]))
|
||||||
doors_geom = doors_geom.difference(spaces_geom)
|
|
||||||
|
|
||||||
svg.add_geometry(spaces_geom, fill_color='#ffffff')
|
svg.add_geometry(spaces_geom, fill_color='#ffffff')
|
||||||
|
|
||||||
|
walls_geom = buildings_geom.difference(spaces_geom).difference(doors_geom)
|
||||||
|
|
||||||
|
svg.add_geometry(walls_geom, fill_color='#aaaaaa', stroke_px=0.5, stroke_color='#aaaaaa')
|
||||||
|
|
||||||
return svg.get_xml()
|
return svg.get_xml()
|
||||||
|
|
|
@ -84,7 +84,8 @@ class SVGImage:
|
||||||
return defid
|
return defid
|
||||||
|
|
||||||
def add_geometry(self, geometry=None, fill_color=None, fill_opacity=None, opacity=None, filter=None,
|
def add_geometry(self, geometry=None, fill_color=None, fill_opacity=None, opacity=None, filter=None,
|
||||||
stroke_width=0.0, stroke_color=None, stroke_opacity=None, stroke_linejoin=None, clip_path=None):
|
stroke_px=0.0, stroke_width=0.0, stroke_color=None, stroke_opacity=None, stroke_linejoin=None,
|
||||||
|
clip_path=None):
|
||||||
if geometry is not None:
|
if geometry is not None:
|
||||||
if not geometry:
|
if not geometry:
|
||||||
return
|
return
|
||||||
|
@ -97,7 +98,9 @@ class SVGImage:
|
||||||
element.set('fill', fill_color or 'none')
|
element.set('fill', fill_color or 'none')
|
||||||
if fill_opacity:
|
if fill_opacity:
|
||||||
element.set('fill-opacity', str(fill_opacity)[:4])
|
element.set('fill-opacity', str(fill_opacity)[:4])
|
||||||
if stroke_width:
|
if stroke_px:
|
||||||
|
element.set('stroke-width', self._trim_decimals(str(stroke_px)))
|
||||||
|
elif stroke_width:
|
||||||
element.set('stroke-width', self._trim_decimals(str(stroke_width * self.scale)))
|
element.set('stroke-width', self._trim_decimals(str(stroke_width * self.scale)))
|
||||||
if stroke_color:
|
if stroke_color:
|
||||||
element.set('stroke', stroke_color)
|
element.set('stroke', stroke_color)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue