Porównaj commity

...

2 Commity

Autor SHA1 Wiadomość Data
Hartmut Holzgraefe 7f55ad3a4d do not draw icon and icon backdrop on "Circle" markers ( #111 ) 2024-03-23 14:39:30 +00:00
Hartmut Holzgraefe 2aeb4b81fd fillColor needs to default to color if not set (Issue #110) 2024-03-23 12:51:08 +00:00
2 zmienionych plików z 17 dodań i 9 usunięć

Wyświetl plik

@ -79,14 +79,22 @@ def get_default_properties(json, umap_defaults, create_copy=True):
if create_copy:
umap_defaults = copy.deepcopy(umap_defaults)
values = {}
for path in ['$.properties.*', '$.properties._storage.*', '$._storage.*', '$.properties._storage_options.*', '$._storage_options.*', '$.properties._umap_options.*', '$._umap_options.*']:
for key,value in flattened(json, path).items():
if key in ['name', 'opacity', 'fillOpacity', 'weight', 'dashArray', 'iconClass', 'iconUrl']:
if value == True:
value = 'yes'
umap_defaults[key] = value
values[key] = value
elif key in ['color', 'fillColor']:
umap_defaults[key] = color2hex(value)
values[key] = color2hex(value)
# fillColor defaults to color if not set
if 'color' in values and 'fillColor' not in values:
values['fillColor'] = values['color']
for key, value in values.items():
umap_defaults[key] = value
if create_copy:
return umap_defaults
@ -199,10 +207,10 @@ class UmapStylesheet(Stylesheet):
marker_offsets = {
'Default': -18,
'Square': -18,
'Drop' : -18,
'Circle': 0,
'Ball' : -16
'Square' : -18,
'Drop' : -18,
'Circle' : 0,
'Ball' : -16,
}
http = urllib3.PoolManager()
@ -250,7 +258,7 @@ class UmapStylesheet(Stylesheet):
iconUrl = new_props['iconUrl']
# if icon class is one of those used by Umap:
if iconClass in ['Square', 'Drop', 'Default']:
if iconClass in ['Circle', 'Square', 'Drop', 'Default']:
# check whether one of the default UMAP icons is used
# by known URL pattern, or external
if validators.url(iconUrl):

Wyświetl plik

@ -37,12 +37,12 @@
</Rule>
<Rule>
<!-- the marker symbol if given -->
<Filter>(not ([iconUrl] = null or [iconUrl] = '')) and ([mapnik::geometry_type]=point)</Filter>
<Filter>(not ([iconClass] = 'Circle')) and (not ([iconUrl] = null or [iconUrl] = '')) and ([mapnik::geometry_type]=point)</Filter>
<MarkersSymbolizer base="root" file="[iconUrl]" allow-overlap="true" transform='translate(0,-23)' fill='[iconFill]' width='20'/>
</Rule>
<Rule>
<!-- the in-marker text instead of an icon if given -->
<Filter>(not ([iconLabel] = null or [iconLabel] = '')) and ([mapnik::geometry_type]=point)</Filter>
<Filter>(not ([iconClass] = 'Circle')) and (not ([iconLabel] = null or [iconLabel] = '')) and ([mapnik::geometry_type]=point)</Filter>
<TextSymbolizer fontset-name="my-fonts" size="10" placement="point" allow-overlap="true" dy="[offset]" fill="white" horizontal_alignment='middle' vertical_alignement='middle'>[iconLabel]</TextSymbolizer>
</Rule>
<Rule>