From 0e472cfdfd79da1b38b6d97aa93c7e2007bcea19 Mon Sep 17 00:00:00 2001 From: Ilya Zverev Date: Fri, 3 Nov 2017 09:52:29 +0300 Subject: [PATCH] =?UTF-8?q?Casing=20=E2=86=92=20infill?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mapsme_subways.py | 6 ++++-- subway_structure.py | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/mapsme_subways.py b/mapsme_subways.py index d11d6cd..c25cbd0 100755 --- a/mapsme_subways.py +++ b/mapsme_subways.py @@ -172,7 +172,7 @@ def dump_data(city, f): 'ref': route.ref, 'name': route.name, 'colour': route.colour, - 'casing': route.casing, + 'infill': route.infill, 'itineraries': [] } for variant in route: @@ -302,10 +302,12 @@ def prepare_mapsme_data(transfers, cities): 'ref': route.ref, 'name': route.name, 'colour': format_colour(route.colour), - 'casing': format_colour(route.casing), 'route_id': uid(route.id, 'r'), 'itineraries': [] } + if route.infill: + routes['casing'] = routes['colour'] + routes['colour'] = format_colour(route.infill) for i, variant in enumerate(route): itin = [] for stop in variant: diff --git a/subway_structure.py b/subway_structure.py index ccec9e0..0d80482 100644 --- a/subway_structure.py +++ b/subway_structure.py @@ -566,10 +566,10 @@ class Route: self.colour = None city.warn(str(e), relation) try: - self.casing = normalize_colour(relation['tags'].get( - 'colour:casing', master_tags.get('colour:casing', None))) + self.infill = normalize_colour(relation['tags'].get( + 'colour:infill', master_tags.get('colour:infill', None))) except ValueError as e: - self.casing = None + self.infill = None city.warn(str(e), relation) self.network = Route.get_network(relation) self.mode = relation['tags']['route'] @@ -714,7 +714,7 @@ class RouteMaster: except ValueError: self.colour = None try: - self.casing = normalize_colour(master['tags'].get('colour:casing', None)) + self.infill = normalize_colour(master['tags'].get('colour:infill', None)) except ValueError: self.colour = None self.network = Route.get_network(master) @@ -723,7 +723,7 @@ class RouteMaster: else: self.ref = None self.colour = None - self.casing = None + self.infill = None self.network = None self.mode = None self.name = None @@ -741,11 +741,11 @@ class RouteMaster: city.warn('Route "{}" has different colour from master "{}"'.format( route.colour, self.colour), route.element) - if not self.casing: - self.casing = route.casing - elif route.casing and route.casing != self.casing: - city.warn('Route "{}" has different casing colour from master "{}"'.format( - route.casing, self.casing), route.element) + if not self.infill: + self.infill = route.infill + elif route.infill and route.infill != self.infill: + city.warn('Route "{}" has different infill colour from master "{}"'.format( + route.infill, self.infill), route.element) if not self.ref: self.ref = route.ref