Skip to content

Commit

Permalink
Update mapcss
Browse files Browse the repository at this point in the history
  • Loading branch information
Famlam committed Dec 23, 2023
1 parent ff16802 commit 0405cfb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 176 deletions.
171 changes: 0 additions & 171 deletions plugins/Josm_combinations.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,63 +957,6 @@ def node(self, data, tags):
# throwWarning:tr("alternative name without {0}","{1.key}")
err.append({'class': 9001001, 'subclass': 1822630838, 'text': mapcss.tr('alternative name without {0}', mapcss._tag_uncapture(capture_tags, '{1.key}'))})

# *[unisex=yes][female=yes][male!=yes][shop=hairdresser]
# *[unisex=yes][male=yes][female!=yes][shop=hairdresser]
if ('female' in keys and 'shop' in keys and 'unisex' in keys) or ('male' in keys and 'shop' in keys and 'unisex' in keys):
match = False
if not match:
capture_tags = {}
try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'unisex') == mapcss._value_capture(capture_tags, 0, 'yes')) and (mapcss._tag_capture(capture_tags, 1, tags, 'female') == mapcss._value_capture(capture_tags, 1, 'yes')) and (mapcss._tag_capture(capture_tags, 2, tags, 'male') != mapcss._value_const_capture(capture_tags, 2, 'yes', 'yes')) and (mapcss._tag_capture(capture_tags, 3, tags, 'shop') == mapcss._value_capture(capture_tags, 3, 'hairdresser')))
except mapcss.RuleAbort: pass
if not match:
capture_tags = {}
try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'unisex') == mapcss._value_capture(capture_tags, 0, 'yes')) and (mapcss._tag_capture(capture_tags, 1, tags, 'male') == mapcss._value_capture(capture_tags, 1, 'yes')) and (mapcss._tag_capture(capture_tags, 2, tags, 'female') != mapcss._value_const_capture(capture_tags, 2, 'yes', 'yes')) and (mapcss._tag_capture(capture_tags, 3, tags, 'shop') == mapcss._value_capture(capture_tags, 3, 'hairdresser')))
except mapcss.RuleAbort: pass
if match:
# group:tr("suspicious tag combination")
# throwWarning:tr("{0} together with {1}","{0.tag}","{1.tag}")
err.append({'class': 9001002, 'subclass': 1043941827, 'text': mapcss.tr('{0} together with {1}', mapcss._tag_uncapture(capture_tags, '{0.tag}'), mapcss._tag_uncapture(capture_tags, '{1.tag}'))})

# *[unisex=yes][female=yes][male=yes][shop=hairdresser]
if ('female' in keys and 'male' in keys and 'shop' in keys and 'unisex' in keys):
match = False
if not match:
capture_tags = {}
try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'unisex') == mapcss._value_capture(capture_tags, 0, 'yes')) and (mapcss._tag_capture(capture_tags, 1, tags, 'female') == mapcss._value_capture(capture_tags, 1, 'yes')) and (mapcss._tag_capture(capture_tags, 2, tags, 'male') == mapcss._value_capture(capture_tags, 2, 'yes')) and (mapcss._tag_capture(capture_tags, 3, tags, 'shop') == mapcss._value_capture(capture_tags, 3, 'hairdresser')))
except mapcss.RuleAbort: pass
if match:
# group:tr("suspicious tag combination")
# throwWarning:tr("{0} together with {1} and {2}. Remove {1} and {2}","{0.tag}","{1.tag}","{2.tag}")
# fixRemove:"female"
# fixRemove:"male"
err.append({'class': 9001002, 'subclass': 408307546, 'text': mapcss.tr('{0} together with {1} and {2}. Remove {1} and {2}', mapcss._tag_uncapture(capture_tags, '{0.tag}'), mapcss._tag_uncapture(capture_tags, '{1.tag}'), mapcss._tag_uncapture(capture_tags, '{2.tag}')), 'allow_fix_override': True, 'fix': {
'-': ([
'female',
'male'])
}})

# *[female=yes][male=yes][!unisex][shop=hairdresser]
if ('female' in keys and 'male' in keys and 'shop' in keys):
match = False
if not match:
capture_tags = {}
try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'female') == mapcss._value_capture(capture_tags, 0, 'yes')) and (mapcss._tag_capture(capture_tags, 1, tags, 'male') == mapcss._value_capture(capture_tags, 1, 'yes')) and (not mapcss._tag_capture(capture_tags, 2, tags, 'unisex')) and (mapcss._tag_capture(capture_tags, 3, tags, 'shop') == mapcss._value_capture(capture_tags, 3, 'hairdresser')))
except mapcss.RuleAbort: pass
if match:
# group:tr("suspicious tag combination")
# throwWarning:tr("{0} together with {1}","{0.tag}","{1.tag}")
# suggestAlternative:"unisex=yes"
# fixRemove:"female"
# fixRemove:"male"
# fixAdd:"unisex=yes"
err.append({'class': 9001002, 'subclass': 831595594, 'text': mapcss.tr('{0} together with {1}', mapcss._tag_uncapture(capture_tags, '{0.tag}'), mapcss._tag_uncapture(capture_tags, '{1.tag}')), 'allow_fix_override': True, 'fix': {
'+': dict([
['unisex','yes']]),
'-': ([
'female',
'male'])
}})

# node[leisure=park][natural=tree]
if ('leisure' in keys and 'natural' in keys):
match = False
Expand Down Expand Up @@ -2812,63 +2755,6 @@ def way(self, data, tags, nds):
# way[waterway][layer][layer=~/^(-1|-2|-3|-4|-5)$/][!tunnel][culvert!=yes][covered!=yes][pipeline!=yes][location!=underground][eval(waylength())>400]
# Part of rule not implemented

# *[unisex=yes][female=yes][male!=yes][shop=hairdresser]
# *[unisex=yes][male=yes][female!=yes][shop=hairdresser]
if ('female' in keys and 'shop' in keys and 'unisex' in keys) or ('male' in keys and 'shop' in keys and 'unisex' in keys):
match = False
if not match:
capture_tags = {}
try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'unisex') == mapcss._value_capture(capture_tags, 0, 'yes')) and (mapcss._tag_capture(capture_tags, 1, tags, 'female') == mapcss._value_capture(capture_tags, 1, 'yes')) and (mapcss._tag_capture(capture_tags, 2, tags, 'male') != mapcss._value_const_capture(capture_tags, 2, 'yes', 'yes')) and (mapcss._tag_capture(capture_tags, 3, tags, 'shop') == mapcss._value_capture(capture_tags, 3, 'hairdresser')))
except mapcss.RuleAbort: pass
if not match:
capture_tags = {}
try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'unisex') == mapcss._value_capture(capture_tags, 0, 'yes')) and (mapcss._tag_capture(capture_tags, 1, tags, 'male') == mapcss._value_capture(capture_tags, 1, 'yes')) and (mapcss._tag_capture(capture_tags, 2, tags, 'female') != mapcss._value_const_capture(capture_tags, 2, 'yes', 'yes')) and (mapcss._tag_capture(capture_tags, 3, tags, 'shop') == mapcss._value_capture(capture_tags, 3, 'hairdresser')))
except mapcss.RuleAbort: pass
if match:
# group:tr("suspicious tag combination")
# throwWarning:tr("{0} together with {1}","{0.tag}","{1.tag}")
err.append({'class': 9001002, 'subclass': 1043941827, 'text': mapcss.tr('{0} together with {1}', mapcss._tag_uncapture(capture_tags, '{0.tag}'), mapcss._tag_uncapture(capture_tags, '{1.tag}'))})

# *[unisex=yes][female=yes][male=yes][shop=hairdresser]
if ('female' in keys and 'male' in keys and 'shop' in keys and 'unisex' in keys):
match = False
if not match:
capture_tags = {}
try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'unisex') == mapcss._value_capture(capture_tags, 0, 'yes')) and (mapcss._tag_capture(capture_tags, 1, tags, 'female') == mapcss._value_capture(capture_tags, 1, 'yes')) and (mapcss._tag_capture(capture_tags, 2, tags, 'male') == mapcss._value_capture(capture_tags, 2, 'yes')) and (mapcss._tag_capture(capture_tags, 3, tags, 'shop') == mapcss._value_capture(capture_tags, 3, 'hairdresser')))
except mapcss.RuleAbort: pass
if match:
# group:tr("suspicious tag combination")
# throwWarning:tr("{0} together with {1} and {2}. Remove {1} and {2}","{0.tag}","{1.tag}","{2.tag}")
# fixRemove:"female"
# fixRemove:"male"
err.append({'class': 9001002, 'subclass': 408307546, 'text': mapcss.tr('{0} together with {1} and {2}. Remove {1} and {2}', mapcss._tag_uncapture(capture_tags, '{0.tag}'), mapcss._tag_uncapture(capture_tags, '{1.tag}'), mapcss._tag_uncapture(capture_tags, '{2.tag}')), 'allow_fix_override': True, 'fix': {
'-': ([
'female',
'male'])
}})

# *[female=yes][male=yes][!unisex][shop=hairdresser]
if ('female' in keys and 'male' in keys and 'shop' in keys):
match = False
if not match:
capture_tags = {}
try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'female') == mapcss._value_capture(capture_tags, 0, 'yes')) and (mapcss._tag_capture(capture_tags, 1, tags, 'male') == mapcss._value_capture(capture_tags, 1, 'yes')) and (not mapcss._tag_capture(capture_tags, 2, tags, 'unisex')) and (mapcss._tag_capture(capture_tags, 3, tags, 'shop') == mapcss._value_capture(capture_tags, 3, 'hairdresser')))
except mapcss.RuleAbort: pass
if match:
# group:tr("suspicious tag combination")
# throwWarning:tr("{0} together with {1}","{0.tag}","{1.tag}")
# suggestAlternative:"unisex=yes"
# fixRemove:"female"
# fixRemove:"male"
# fixAdd:"unisex=yes"
err.append({'class': 9001002, 'subclass': 831595594, 'text': mapcss.tr('{0} together with {1}', mapcss._tag_uncapture(capture_tags, '{0.tag}'), mapcss._tag_uncapture(capture_tags, '{1.tag}')), 'allow_fix_override': True, 'fix': {
'+': dict([
['unisex','yes']]),
'-': ([
'female',
'male'])
}})

# way[water][natural!~/water|bay|strait/][water!=intermittent][amenity!=lavoir]!:closed
# area[water][natural!~/water|bay|strait/][water!=intermittent][amenity!=lavoir]:closed
if ('water' in keys):
Expand Down Expand Up @@ -4303,63 +4189,6 @@ def relation(self, data, tags, members):
# throwWarning:tr("{0} on a relation without {1}","{0.key}","{1.tag}")
err.append({'class': 9001003, 'subclass': 1921058011, 'text': mapcss.tr('{0} on a relation without {1}', mapcss._tag_uncapture(capture_tags, '{0.key}'), mapcss._tag_uncapture(capture_tags, '{1.tag}'))})

# *[unisex=yes][female=yes][male!=yes][shop=hairdresser]
# *[unisex=yes][male=yes][female!=yes][shop=hairdresser]
if ('female' in keys and 'shop' in keys and 'unisex' in keys) or ('male' in keys and 'shop' in keys and 'unisex' in keys):
match = False
if not match:
capture_tags = {}
try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'unisex') == mapcss._value_capture(capture_tags, 0, 'yes')) and (mapcss._tag_capture(capture_tags, 1, tags, 'female') == mapcss._value_capture(capture_tags, 1, 'yes')) and (mapcss._tag_capture(capture_tags, 2, tags, 'male') != mapcss._value_const_capture(capture_tags, 2, 'yes', 'yes')) and (mapcss._tag_capture(capture_tags, 3, tags, 'shop') == mapcss._value_capture(capture_tags, 3, 'hairdresser')))
except mapcss.RuleAbort: pass
if not match:
capture_tags = {}
try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'unisex') == mapcss._value_capture(capture_tags, 0, 'yes')) and (mapcss._tag_capture(capture_tags, 1, tags, 'male') == mapcss._value_capture(capture_tags, 1, 'yes')) and (mapcss._tag_capture(capture_tags, 2, tags, 'female') != mapcss._value_const_capture(capture_tags, 2, 'yes', 'yes')) and (mapcss._tag_capture(capture_tags, 3, tags, 'shop') == mapcss._value_capture(capture_tags, 3, 'hairdresser')))
except mapcss.RuleAbort: pass
if match:
# group:tr("suspicious tag combination")
# throwWarning:tr("{0} together with {1}","{0.tag}","{1.tag}")
err.append({'class': 9001002, 'subclass': 1043941827, 'text': mapcss.tr('{0} together with {1}', mapcss._tag_uncapture(capture_tags, '{0.tag}'), mapcss._tag_uncapture(capture_tags, '{1.tag}'))})

# *[unisex=yes][female=yes][male=yes][shop=hairdresser]
if ('female' in keys and 'male' in keys and 'shop' in keys and 'unisex' in keys):
match = False
if not match:
capture_tags = {}
try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'unisex') == mapcss._value_capture(capture_tags, 0, 'yes')) and (mapcss._tag_capture(capture_tags, 1, tags, 'female') == mapcss._value_capture(capture_tags, 1, 'yes')) and (mapcss._tag_capture(capture_tags, 2, tags, 'male') == mapcss._value_capture(capture_tags, 2, 'yes')) and (mapcss._tag_capture(capture_tags, 3, tags, 'shop') == mapcss._value_capture(capture_tags, 3, 'hairdresser')))
except mapcss.RuleAbort: pass
if match:
# group:tr("suspicious tag combination")
# throwWarning:tr("{0} together with {1} and {2}. Remove {1} and {2}","{0.tag}","{1.tag}","{2.tag}")
# fixRemove:"female"
# fixRemove:"male"
err.append({'class': 9001002, 'subclass': 408307546, 'text': mapcss.tr('{0} together with {1} and {2}. Remove {1} and {2}', mapcss._tag_uncapture(capture_tags, '{0.tag}'), mapcss._tag_uncapture(capture_tags, '{1.tag}'), mapcss._tag_uncapture(capture_tags, '{2.tag}')), 'allow_fix_override': True, 'fix': {
'-': ([
'female',
'male'])
}})

# *[female=yes][male=yes][!unisex][shop=hairdresser]
if ('female' in keys and 'male' in keys and 'shop' in keys):
match = False
if not match:
capture_tags = {}
try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'female') == mapcss._value_capture(capture_tags, 0, 'yes')) and (mapcss._tag_capture(capture_tags, 1, tags, 'male') == mapcss._value_capture(capture_tags, 1, 'yes')) and (not mapcss._tag_capture(capture_tags, 2, tags, 'unisex')) and (mapcss._tag_capture(capture_tags, 3, tags, 'shop') == mapcss._value_capture(capture_tags, 3, 'hairdresser')))
except mapcss.RuleAbort: pass
if match:
# group:tr("suspicious tag combination")
# throwWarning:tr("{0} together with {1}","{0.tag}","{1.tag}")
# suggestAlternative:"unisex=yes"
# fixRemove:"female"
# fixRemove:"male"
# fixAdd:"unisex=yes"
err.append({'class': 9001002, 'subclass': 831595594, 'text': mapcss.tr('{0} together with {1}', mapcss._tag_uncapture(capture_tags, '{0.tag}'), mapcss._tag_uncapture(capture_tags, '{1.tag}')), 'allow_fix_override': True, 'fix': {
'+': dict([
['unisex','yes']]),
'-': ([
'female',
'male'])
}})

# area[water][natural!~/water|bay|strait/][water!=intermittent][amenity!=lavoir]:closed
if ('type' in keys and 'water' in keys):
match = False
Expand Down
10 changes: 5 additions & 5 deletions plugins/Josm_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def init(self, logger):
self.errors[9003013] = self.def_class(item = 9003, level = 3, tags = ["geom"], title = mapcss.tr('{0} is the tag for the linear waterway. To tag the water area use {1} + {2} instead.', mapcss._tag_uncapture(capture_tags, '{1.tag}'), 'natural=water', 'water=*'))

self.re_22f56734 = re.compile(r'^(no_right_turn|no_left_turn|no_u_turn|no_straight_on|only_right_turn|only_left_turn|only_straight_on|no_entry|no_exit)$')
self.re_3fa2f9f1 = re.compile(r'^(water|wetland|coastline)$')
self.re_76b0146b = re.compile(r'^(water|wetland)$')


def node(self, data, tags):
Expand Down Expand Up @@ -694,14 +694,14 @@ def way(self, data, tags, nds):
# throwWarning:tr("{0} on a closed way. Should be used on an unclosed way.","{1.tag}")
err.append({'class': 9003011, 'subclass': 2100265426, 'text': mapcss.tr('{0} on a closed way. Should be used on an unclosed way.', mapcss._tag_uncapture(capture_tags, '{1.tag}'))})

# area[natural=~/^(water|wetland|coastline)$/]
# area[natural=~/^(water|wetland)$/]
# area[waterway=riverbank]
# area[landuse=reservoir]
if ('landuse' in keys) or ('natural' in keys) or ('waterway' in keys):
match = False
if not match:
capture_tags = {}
try: match = ((mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_3fa2f9f1), mapcss._tag_capture(capture_tags, 0, tags, 'natural'))) and (mapcss._tag_capture(capture_tags, -1, tags, 'area') != mapcss._value_const_capture(capture_tags, -1, 'no', 'no')))
try: match = ((mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_76b0146b), mapcss._tag_capture(capture_tags, 0, tags, 'natural'))) and (mapcss._tag_capture(capture_tags, -1, tags, 'area') != mapcss._value_const_capture(capture_tags, -1, 'no', 'no')))
except mapcss.RuleAbort: pass
if not match:
capture_tags = {}
Expand Down Expand Up @@ -778,14 +778,14 @@ def relation(self, data, tags, members):
mapcss._tag_uncapture(capture_tags, '{0.key}')])
}})

# area[natural=~/^(water|wetland|coastline)$/]
# area[natural=~/^(water|wetland)$/]
# area[waterway=riverbank]
# area[landuse=reservoir]
if ('landuse' in keys and 'type' in keys) or ('natural' in keys and 'type' in keys) or ('type' in keys and 'waterway' in keys):
match = False
if not match:
capture_tags = {}
try: match = ((mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_3fa2f9f1), mapcss._tag_capture(capture_tags, 0, tags, 'natural'))) and (mapcss._tag_capture(capture_tags, -1, tags, 'type') == mapcss._value_capture(capture_tags, -1, 'multipolygon')))
try: match = ((mapcss.regexp_test(mapcss._value_capture(capture_tags, 0, self.re_76b0146b), mapcss._tag_capture(capture_tags, 0, tags, 'natural'))) and (mapcss._tag_capture(capture_tags, -1, tags, 'type') == mapcss._value_capture(capture_tags, -1, 'multipolygon')))
except mapcss.RuleAbort: pass
if not match:
capture_tags = {}
Expand Down

0 comments on commit 0405cfb

Please sign in to comment.