mirror of
https://github.com/enzet/map-machine.git
synced 2025-06-01 02:11:58 +02:00
Issue #63: support MapCSS 0.2 for icons.
Support MapCSS 0.2 scheme generation with icons for nodes and areas.
This commit is contained in:
parent
557cc0cc98
commit
2eeccdb877
2 changed files with 37 additions and 6 deletions
|
@ -72,10 +72,9 @@ class Matcher:
|
|||
Tag matching.
|
||||
"""
|
||||
def __init__(self, structure: Dict[str, Any]):
|
||||
self.tags = structure["tags"]
|
||||
|
||||
self.exception = None
|
||||
self.tags: Dict[str, str] = structure["tags"]
|
||||
|
||||
self.exception: Dict[str, str] = {}
|
||||
if "exception" in structure:
|
||||
self.exception = structure["exception"]
|
||||
|
||||
|
@ -155,6 +154,14 @@ class NodeMatcher(Matcher):
|
|||
if "with_icon" in structure:
|
||||
self.with_icon = structure["with_icon"]
|
||||
|
||||
def get_mapcss_selector(self) -> str:
|
||||
"""
|
||||
Construct MapCSS 0.2 selector from the node matcher.
|
||||
|
||||
See https://wiki.openstreetmap.org/wiki/MapCSS/0.2
|
||||
"""
|
||||
return "".join([f"[{x}={y}]" for (x, y) in self.tags.items()])
|
||||
|
||||
|
||||
class WayMatcher(Matcher):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue