Skip to content

Commit

Permalink
Improve tunnel+bridge check
Browse files Browse the repository at this point in the history
Instead of only warning about `tunnel=yes + bridge=yes` on the same way, warn about all `tunnel=* + bridge=*` on the same way.
  • Loading branch information
Famlam authored and frodrigo committed May 1, 2024
1 parent d33c94a commit a56aa17
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions plugins/TagFix_MultipleTag2.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ def node(self, data, tags):
# throwWarning:tr("The tag `{0}` is deprecated in favour of {1}","{1.key}","`leaf_type`")
err.append({'class': 40106, 'subclass': 0, 'text': mapcss.tr('The tag `{0}` is deprecated in favour of {1}', mapcss._tag_uncapture(capture_tags, '{1.key}'), '`leaf_type`')})

# *[bridge=yes][tunnel=yes]
# *[bridge][tunnel][bridge!=no][tunnel!=no]
if ('bridge' in keys and 'tunnel' in keys):
match = False
if not match:
capture_tags = {}
try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'bridge') == mapcss._value_capture(capture_tags, 0, 'yes')) and (mapcss._tag_capture(capture_tags, 1, tags, 'tunnel') == mapcss._value_capture(capture_tags, 1, 'yes')))
try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'bridge')) and (mapcss._tag_capture(capture_tags, 1, tags, 'tunnel')) and (mapcss._tag_capture(capture_tags, 2, tags, 'bridge') != mapcss._value_const_capture(capture_tags, 2, 'no', 'no')) and (mapcss._tag_capture(capture_tags, 3, tags, 'tunnel') != mapcss._value_const_capture(capture_tags, 3, 'no', 'no')))
except mapcss.RuleAbort: pass
if match:
# group:tr("Tag conflict")
Expand Down Expand Up @@ -418,12 +418,12 @@ def way(self, data, tags, nds):
# assertMatch:"way highway=primary tunnel=yes"
err.append({'class': 71301, 'subclass': 0, 'text': mapcss.tr('Missing maxheight tag')})

# *[bridge=yes][tunnel=yes]
# *[bridge][tunnel][bridge!=no][tunnel!=no]
if ('bridge' in keys and 'tunnel' in keys):
match = False
if not match:
capture_tags = {}
try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'bridge') == mapcss._value_capture(capture_tags, 0, 'yes')) and (mapcss._tag_capture(capture_tags, 1, tags, 'tunnel') == mapcss._value_capture(capture_tags, 1, 'yes')))
try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'bridge')) and (mapcss._tag_capture(capture_tags, 1, tags, 'tunnel')) and (mapcss._tag_capture(capture_tags, 2, tags, 'bridge') != mapcss._value_const_capture(capture_tags, 2, 'no', 'no')) and (mapcss._tag_capture(capture_tags, 3, tags, 'tunnel') != mapcss._value_const_capture(capture_tags, 3, 'no', 'no')))
except mapcss.RuleAbort: pass
if match:
# group:tr("Tag conflict")
Expand Down Expand Up @@ -589,12 +589,12 @@ def relation(self, data, tags, members):
# assertMatch:"relation"
err.append({'class': 21102, 'subclass': 0, 'text': mapcss.tr('Missing relation type')})

# *[bridge=yes][tunnel=yes]
# *[bridge][tunnel][bridge!=no][tunnel!=no]
if ('bridge' in keys and 'tunnel' in keys):
match = False
if not match:
capture_tags = {}
try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'bridge') == mapcss._value_capture(capture_tags, 0, 'yes')) and (mapcss._tag_capture(capture_tags, 1, tags, 'tunnel') == mapcss._value_capture(capture_tags, 1, 'yes')))
try: match = ((mapcss._tag_capture(capture_tags, 0, tags, 'bridge')) and (mapcss._tag_capture(capture_tags, 1, tags, 'tunnel')) and (mapcss._tag_capture(capture_tags, 2, tags, 'bridge') != mapcss._value_const_capture(capture_tags, 2, 'no', 'no')) and (mapcss._tag_capture(capture_tags, 3, tags, 'tunnel') != mapcss._value_const_capture(capture_tags, 3, 'no', 'no')))
except mapcss.RuleAbort: pass
if match:
# group:tr("Tag conflict")
Expand Down
2 changes: 1 addition & 1 deletion plugins/TagFix_MultipleTag2.validator.mapcss
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ node[natural=tree][type][type!=palm] {
}


*[bridge=yes][tunnel=yes] {
*[bridge][tunnel][bridge!=no][tunnel!=no] {
throwWarning: tr("Conflict between tags: `{0}` and `{1}`", "{0.tag}", "{1.tag}");
group: tr("Tag conflict");
-osmoseItemClassLevel: "4030/40303:0/1";
Expand Down

0 comments on commit a56aa17

Please sign in to comment.