rename elevation → height
This commit is contained in:
parent
f928fd8b6e
commit
891a1df418
3 changed files with 15 additions and 14 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue