diff options
author | Daria Volvenkova <d.volvenkova@corp.mail.ru> | 2017-10-26 17:41:02 +0300 |
---|---|---|
committer | Ilya Zverev <ilya@zverev.info> | 2017-11-02 15:24:08 +0300 |
commit | b3dcf878e3bd95c13dc808e9200aa33a0f702eee (patch) | |
tree | abc041925aa9ac17dd44515c06164b518daecbf5 /tools/python/transit/transit_graph_generator.py | |
parent | 1fd010804342d63618c741d1d7b0e42c3886b835 (diff) |
Transit colours updated, added line interval and stop time processing.
Diffstat (limited to 'tools/python/transit/transit_graph_generator.py')
-rwxr-xr-x | tools/python/transit/transit_graph_generator.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/tools/python/transit/transit_graph_generator.py b/tools/python/transit/transit_graph_generator.py index 491e55e4e1..310564a990 100755 --- a/tools/python/transit/transit_graph_generator.py +++ b/tools/python/transit/transit_graph_generator.py @@ -168,19 +168,26 @@ class TransitGraphBuilder: 'network_id': network_id, 'title': line_name, 'number': route_item['ref'], - 'stop_ids': line_stops} + 'interval': line_item['interval'], + 'stop_ids': []} if 'colour' in route_item: line['color'] = self.palette.get_nearest_color(route_item['colour']) + else: + line['color'] = self.palette.get_default_color() # TODO: Add processing of line_item['shape'] when this data will be available. # TODO: Add processing of line_item['trip_ids'] when this data will be available. # Create an edge for each connection of stops. for i in range(len(line_stops)): - self.stops[line_stops[i]]['line_ids'].append(line_id) - if i < len(line_stops) - 1: - edge = {'stop1_id': line_stops[i], - 'stop2_id': line_stops[i + 1], + stop1 = line_stops[i] + line['stop_ids'].append(stop1[0]) + self.stops[stop1[0]]['line_ids'].append(line_id) + if i + 1 < len(line_stops): + stop2 = line_stops[i + 1] + edge = {'stop1_id': stop1[0], + 'stop2_id': stop2[0], + 'weight': stop2[1] - stop1[1], 'transfer': False, 'line_id': line_id, 'shape_ids': []} |