Casing → infill

This commit is contained in:
Ilya Zverev 2017-11-03 09:52:29 +03:00
parent 94d68d2236
commit 0e472cfdfd
2 changed files with 14 additions and 12 deletions

View file

@ -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:

View file

@ -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