diff --git a/data/tags.yml b/data/tags.yml index 953a9b6..77129d1 100644 --- a/data/tags.yml +++ b/data/tags.yml @@ -65,17 +65,6 @@ colors: node_icons: - # Priorities: - # - leisure, - # - part of major transport network (bus stops, train stations, ports), - # - important buildings (embassy), - # - useful buildings (shops, restaurants), - # - important street amenities (vending machines, ATMs), - # - useful street amenities (trash cans, benches), - # - doors, - # - small objects unimportant for the majority of users (trees, lamps, - # clocks, poles, manholes). - # No draw - tags: {type: multipolygon} @@ -281,6 +270,33 @@ node_icons: icon: [frame] - tags: {tourism: gallery} icon: [picture] + - tags: {amenity: cafe} + icon: [cafe] + - tags: {amenity: ice_cream} + icon: [ice_cream] + - tags: {amenity: biergarten} + icon: [beer] + - tags: {amenity: nightclub} + icon: [night_club] + - tags: {amenity: restaurant} + icon: [restaurant] + - tags: {amenity: restaurant;bar} + icon: [restaurant] + add_icon: [bar] + - tags: {shop: ice_cream} + icon: [ice_cream] + - tags: {shop: gift} + icon: [gift] + - tags: {shop: clothes} + icon: [shop_clothes] + - tags: {amenity: shop, shop: clothes} + icon: [shop_clothes] + - tags: {shop: convenience} + icon: [shop_convenience] + - tags: {amenity: shop, shop: convenience} + icon: [shop_convenience] + - tags: {shop: electronics} + icon: [tv] # Big objects not for all @@ -298,20 +314,6 @@ node_icons: icon: [japan_elementary_school] - tags: {office: telecommunication} icon: [telephone] - - tags: {shop: clothes} - icon: [shop_clothes] - - tags: {amenity: shop, shop: clothes} - icon: [shop_clothes] - - tags: {shop: convenience} - icon: [shop_convenience] - - tags: {amenity: shop, shop: convenience} - icon: [shop_convenience] - - tags: {shop: electronics} - icon: [tv] - - tags: {shop: ice_cream} - icon: [ice_cream] - - tags: {shop: gift} - icon: [gift] # Not important big objects diff --git a/roentgen/scheme.py b/roentgen/scheme.py index 8ea08e1..e6896cf 100644 --- a/roentgen/scheme.py +++ b/roentgen/scheme.py @@ -35,7 +35,7 @@ class LineStyle: priority: float = 0.0 -def is_not_matched_tag( +def is_matched_tag( matcher_tag_key: str, matcher_tag_value: str, tags: Dict[str, str]) -> bool: """ @@ -45,10 +45,13 @@ def is_not_matched_tag( :param matcher_tag_value: tag value, tag value list, or "*" :param tags: element tags to check """ - return (matcher_tag_key not in tags or - (matcher_tag_value != "*" and - tags[matcher_tag_key] != matcher_tag_value and - tags[matcher_tag_key] not in matcher_tag_value)) + return ( + matcher_tag_key in tags and + (matcher_tag_value == "*" or + isinstance(matcher_tag_value, str) and + tags[matcher_tag_key] == matcher_tag_value or + isinstance(matcher_tag_value, list) and + tags[matcher_tag_key] in matcher_tag_value)) def is_matched(matcher: Dict[str, Any], tags: Dict[str, str]) -> bool: @@ -62,14 +65,14 @@ def is_matched(matcher: Dict[str, Any], tags: Dict[str, str]) -> bool: for config_tag_key in matcher["tags"]: # type: str tag_matcher = matcher["tags"][config_tag_key] - if is_not_matched_tag(config_tag_key, tag_matcher, tags): + if not is_matched_tag(config_tag_key, tag_matcher, tags): matched = False break if "no_tags" in matcher: for config_tag_key in matcher["no_tags"]: # type: str tag_matcher = matcher["no_tags"][config_tag_key] - if not is_not_matched_tag(config_tag_key, tag_matcher, tags): + if is_matched_tag(config_tag_key, tag_matcher, tags): matched = False break