Skip to content

Commit

Permalink
Update JOSM Mapcss
Browse files Browse the repository at this point in the history
  • Loading branch information
frodrigo committed Sep 29, 2019
1 parent f35ed64 commit e37629a
Show file tree
Hide file tree
Showing 9 changed files with 6,399 additions and 3,319 deletions.
7 changes: 5 additions & 2 deletions mapcss/item_map.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#-*- coding: utf-8 -*-
item_map = \
{'FranceSpecificRules': {'class': {'a': 1},
{'FranceSpecificRules': {'class': {"Cette station vend-elle toujours du SP95, ou a-t'il été remplacé par le SP95-E10 ?": 2,
'a': 1},
'item': 9999,
'prefix': 'Josm_',
'tags': []},
Expand Down Expand Up @@ -207,6 +208,7 @@
'missing tag': 9004009,
'wrong crossing tag on a way': 9004002,
'wrong highway tag on a node': 9004008,
'{0} on a node': 9004010,
'{0} used with {1}': 9004005},
'item': 9004,
'prefix': 'Josm_',
Expand All @@ -223,7 +225,8 @@
'item': 9005,
'prefix': 'Josm_',
'tags': ['tag', 'value']},
'numeric': {'class': {'Unnecessary amount of decimal places': 9006021,
'numeric': {'class': {'Airport tagging': 9006022,
'Unnecessary amount of decimal places': 9006021,
'numerical key': 9006001,
'unusual value of {0}': 9006010,
'unusual value of {0}: kilometers is default; point is decimal separator; if units, put space then unit': 9006020,
Expand Down
37 changes: 37 additions & 0 deletions plugins/Josm_FranceSpecificRules.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Josm_FranceSpecificRules(Plugin):
def init(self, logger):
Plugin.init(self, logger)
tags = capture_tags = {}
self.errors[2] = {'item': 9999, 'level': 3, 'tag': [], 'desc': mapcss.tr(u'Cette station vend-elle toujours du SP95, ou a-t\'il été remplacé par le SP95-E10 ?')}
self.errors[20806] = {'item': 2080, 'level': 3, 'tag': mapcss.list_(u'parking', u'amenity', u'fix:chair'), 'desc': mapcss.tr(u'Missing tag carpool on area')}
self.errors[21600] = {'item': 2160, 'level': 3, 'tag': mapcss.list_(u'tag', u'railway'), 'desc': mapcss.tr(u'Missing tag gauge on rail')}

Expand Down Expand Up @@ -43,6 +44,18 @@ def node(self, data, tags):
[u'carpool',u'designated']])
}})

# *[amenity=fuel][fuel:octane_95=yes][!fuel:e10][inside("FR")]
if (u'amenity' in keys and u'fuel:octane_95' in keys):
match = False
if not match:
capture_tags = {}
try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'amenity') == mapcss._value_capture(capture_tags, 0, u'fuel') and mapcss._tag_capture(capture_tags, 1, tags, u'fuel:octane_95') == mapcss._value_capture(capture_tags, 1, u'yes') and not mapcss._tag_capture(capture_tags, 2, tags, u'fuel:e10') and mapcss.inside(self.father.config.options, u'FR'))
except mapcss.RuleAbort: pass
if match:
# throwWarning:tr("Cette station vend-elle toujours du SP95, ou a-t'il été remplacé par le SP95-E10 ?")
# suggestAlternative:"fuel:e10=yes/no"
err.append({'class': 2, 'subclass': 662274675, 'text': mapcss.tr(u'Cette station vend-elle toujours du SP95, ou a-t\'il été remplacé par le SP95-E10 ?')})

return err

def way(self, data, tags, nds):
Expand Down Expand Up @@ -90,6 +103,18 @@ def way(self, data, tags, nds):
[u'carpool',u'designated']])
}})

# *[amenity=fuel][fuel:octane_95=yes][!fuel:e10][inside("FR")]
if (u'amenity' in keys and u'fuel:octane_95' in keys):
match = False
if not match:
capture_tags = {}
try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'amenity') == mapcss._value_capture(capture_tags, 0, u'fuel') and mapcss._tag_capture(capture_tags, 1, tags, u'fuel:octane_95') == mapcss._value_capture(capture_tags, 1, u'yes') and not mapcss._tag_capture(capture_tags, 2, tags, u'fuel:e10') and mapcss.inside(self.father.config.options, u'FR'))
except mapcss.RuleAbort: pass
if match:
# throwWarning:tr("Cette station vend-elle toujours du SP95, ou a-t'il été remplacé par le SP95-E10 ?")
# suggestAlternative:"fuel:e10=yes/no"
err.append({'class': 2, 'subclass': 662274675, 'text': mapcss.tr(u'Cette station vend-elle toujours du SP95, ou a-t\'il été remplacé par le SP95-E10 ?')})

return err

def relation(self, data, tags, members):
Expand Down Expand Up @@ -117,6 +142,18 @@ def relation(self, data, tags, members):
[u'carpool',u'designated']])
}})

# *[amenity=fuel][fuel:octane_95=yes][!fuel:e10][inside("FR")]
if (u'amenity' in keys and u'fuel:octane_95' in keys):
match = False
if not match:
capture_tags = {}
try: match = (mapcss._tag_capture(capture_tags, 0, tags, u'amenity') == mapcss._value_capture(capture_tags, 0, u'fuel') and mapcss._tag_capture(capture_tags, 1, tags, u'fuel:octane_95') == mapcss._value_capture(capture_tags, 1, u'yes') and not mapcss._tag_capture(capture_tags, 2, tags, u'fuel:e10') and mapcss.inside(self.father.config.options, u'FR'))
except mapcss.RuleAbort: pass
if match:
# throwWarning:tr("Cette station vend-elle toujours du SP95, ou a-t'il été remplacé par le SP95-E10 ?")
# suggestAlternative:"fuel:e10=yes/no"
err.append({'class': 2, 'subclass': 662274675, 'text': mapcss.tr(u'Cette station vend-elle toujours du SP95, ou a-t\'il été remplacé par le SP95-E10 ?')})

return err


Expand Down
Loading

0 comments on commit e37629a

Please sign in to comment.