Skip to content

Commit

Permalink
Restored previous set_map_property behaviour.
Browse files Browse the repository at this point in the history
  • Loading branch information
malloch committed Jun 26, 2019
1 parent c2932d3 commit c896789
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions webmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,24 +238,32 @@ def set_map_properties(props, map):
for key in props:
if key in ['version']:
continue;
elif key == 'srcs':
srcs = props[key]
i = 0
for srcProps in srcs:
# find src slot index
src = map.source(i)
for srcKey in srcProps:
if srcKey in ['name', 'type', 'length', 'num_instances']:
continue
src.set_property(srcKey, srcProps[srcKey])
i = i + 1
elif key == 'dst':
dstProps = props[key]
dst = map.destination()
for dstKey in dstProps:
if dstKey in ['name', 'type', 'length', 'num_instances']:
continue
dst.set_property(dstKey, dstProps[dstKey])
elif key.startswith('src'):
srcidx = -1
argidx = -1
if key[3] == '[' and key[5:6] == '].':
srcidx = int(key[4])
argidx = 7
elif key[3] == '.':
srcidx = 0
argidx = 4
else:
continue
subkey = key[argidx:]
value = props[key]
if subkey == 'min' or subkey == 'max':
value = as_number(value)
elif subkey == 'bound_min' or subkey == 'bound_max':
value = boundaryStrings[value]
map.source(srcidx).set_property(subkey, value)
elif key.startswith('dst.'):
subkey = key[4:]
value = props[key]
if subkey == 'min' or subkey == 'max':
value = as_number(value)
elif subkey == 'bound_min' or subkey == 'bound_max':
value = boundaryStrings[value]
map.destination().set_property(subkey, value)
elif key == 'mode':
if props['mode'] == 'linear':
map.mode = mapper.MODE_LINEAR
Expand Down

0 comments on commit c896789

Please sign in to comment.