Look for missing base_width to use with casing-width

Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
Konstantin Pastbin 2023-01-20 13:31:47 +00:00 committed by Viktor Govako
parent 32cc5aafb6
commit 471abbd754

View file

@ -359,18 +359,19 @@ def komap_mapswithme(options):
if has_lines and not is_area_st and st.get('casing-linecap', 'butt') == 'butt':
dr_line = LineRuleProto()
# 'casing-width' has precedence over 'casing-width-add'.
if st.get('casing-width-add') is not None and st.get('casing-width') in (None, 0):
# Look for base width in other style objects (usually ::default).
base_width = 0
base_width = st.get('width', 0)
if base_width == 0:
for wst in zstyle:
if wst.get('width') not in (None, 0):
# Rail bridge styles use width from ::dash object instead of ::default.
if base_width == 0 or wst.get('object-id') != '::default':
base_width = wst.get('width', 0)
st['casing-width'] = base_width + st.get('casing-width-add')
# 'casing-width' has precedence over 'casing-width-add'.
if st.get('casing-width') in (None, 0):
st['casing-width'] = base_width + st.get('casing-width-add')
base_width = 0
dr_line.width = round((st.get('width', 0) + st.get('casing-width') * 2) * WIDTH_SCALE, 2)
dr_line.width = round((base_width + st.get('casing-width') * 2) * WIDTH_SCALE, 2)
dr_line.color = mwm_encode_color(colors, st, "casing")
if '-x-me-casing-line-priority' in st:
dr_line.priority = int(st.get('-x-me-casing-line-priority'))