genPOI: add icon and createInfoWindow support for filters
The defaults for "icon" and "createInfoWindow" are read from the POI, but can be overridden by a filter function returning an appripriate dict.
This commit is contained in:
committed by
MasterofJOKers
parent
4b9d0a5c87
commit
b08e34b064
@@ -290,6 +290,13 @@ def create_marker_from_filter_result(poi, result):
|
|||||||
else:
|
else:
|
||||||
d = dict((v, poi[v]) for v in 'xyz')
|
d = dict((v, poi[v]) for v in 'xyz')
|
||||||
|
|
||||||
|
# read some Defaults from POI
|
||||||
|
if "icon" in poi:
|
||||||
|
d["icon"] = poi['icon']
|
||||||
|
if "createInfoWindow" in poi:
|
||||||
|
d["createInfoWindow"] = poi['createInfoWindow']
|
||||||
|
|
||||||
|
# Fill in the rest from result
|
||||||
if isinstance(result, basestring):
|
if isinstance(result, basestring):
|
||||||
d.update(dict(text=result, hovertext=result))
|
d.update(dict(text=result, hovertext=result))
|
||||||
elif type(result) == tuple:
|
elif type(result) == tuple:
|
||||||
@@ -313,10 +320,10 @@ def create_marker_from_filter_result(poi, result):
|
|||||||
if isinstance(result['color'], basestring):
|
if isinstance(result['color'], basestring):
|
||||||
d['strokeColor'] = result['color']
|
d['strokeColor'] = result['color']
|
||||||
|
|
||||||
if "icon" in poi:
|
if "icon" in result:
|
||||||
d.update({"icon": poi['icon']})
|
d["icon"] = result['icon']
|
||||||
if "createInfoWindow" in poi:
|
if "createInfoWindow" in result:
|
||||||
d.update({"createInfoWindow": poi['createInfoWindow']})
|
d["createInfoWindow"] = result['createInfoWindow']
|
||||||
|
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user