Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaria Volvenkova <d.volvenkova@corp.mail.ru>2017-10-26 17:41:02 +0300
committerIlya Zverev <ilya@zverev.info>2017-11-02 15:24:08 +0300
commitb3dcf878e3bd95c13dc808e9200aa33a0f702eee (patch)
treeabc041925aa9ac17dd44515c06164b518daecbf5
parent1fd010804342d63618c741d1d7b0e42c3886b835 (diff)
Transit colours updated, added line interval and stop time processing.
-rw-r--r--data/transit_colors.txt210
-rw-r--r--tools/python/transit/transit_color_palette.py14
-rwxr-xr-xtools/python/transit/transit_graph_generator.py17
3 files changed, 220 insertions, 21 deletions
diff --git a/data/transit_colors.txt b/data/transit_colors.txt
index d910ef74a4..92c27d125f 100644
--- a/data/transit_colors.txt
+++ b/data/transit_colors.txt
@@ -1,20 +1,214 @@
{
"colors": [
{
- "clear": "000000",
- "night": "555555"
+ "name": "default",
+ "clear": "231F20",
+ "night": "231F20",
+ "text": "231F20"
},
{
- "clear": "ff0000",
- "night": "aa0000"
+ "name": "gray",
+ "clear": "8B8B8C",
+ "night": "464647",
+ "text": "231F20"
},
{
- "clear": "00ff00",
- "night": "00aa00"
+ "name": "brown",
+ "clear": "9C491F",
+ "night": "4D210B",
+ "text": "3E2723"
},
{
- "clear": "0000ff",
- "night": "0000aa"
+ "name": "brown_light",
+ "clear": "B39B8F",
+ "night": "5A4E48",
+ "text": "3E2723"
+ },
+ {
+ "name": "red_dark",
+ "clear": "7A1212",
+ "night": "3E0A0A",
+ "text": "7A1212"
+ },
+ {
+ "name": "red",
+ "clear": "FA1E38",
+ "night": "800B19",
+ "text": "7A1212"
+ },
+ {
+ "name": "red_light",
+ "clear": "E57373",
+ "night": "733A3A",
+ "text": "7A1212"
+ },
+ {
+ "name": "orange",
+ "clear": "FF5722",
+ "night": "802C12",
+ "text": "E65100"
+ },
+ {
+ "name": "orange_light",
+ "clear": "FF8A65",
+ "night": "804633",
+ "text": "E65100"
+ },
+ {
+ "name": "amber_dark",
+ "clear": "EF6C00",
+ "night": "703400",
+ "text": "FF6F00"
+ },
+ {
+ "name": "amber",
+ "clear": "FF9800",
+ "night": "804D00",
+ "text": "FF6F00"
+ },
+ {
+ "name": "yellow_dark",
+ "clear": "E69B22",
+ "night": "744E12",
+ "text": "F57F17"
+ },
+ {
+ "name": "yellow",
+ "clear": "FFCC09",
+ "night": "8F7F06",
+ "text": "F57F17"
+ },
+ {
+ "name": "lime_dark",
+ "clear": "827717",
+ "night": "423C0C",
+ "text": "827717"
+ },
+ {
+ "name": "lime",
+ "clear": "33C73B",
+ "night": "34691B",
+ "text": "827717"
+ },
+ {
+ "name": "lime_light",
+ "clear": "B2D636",
+ "night": "4D661A",
+ "text": "827717"
+ },
+ {
+ "name": "green_dark",
+ "clear": "1B5E20",
+ "night": "0E3011",
+ "text": "1B5E20"
+ },
+ {
+ "name": "green",
+ "clear": "009A2C",
+ "night": "004D1A",
+ "text": "1B5E20"
+ },
+ {
+ "name": "green_light",
+ "clear": "81C784",
+ "night": "416443",
+ "text": "1B5E20"
+ },
+ {
+ "name": "teal_dark",
+ "clear": "00695C",
+ "night": "00352F",
+ "text": "004D40"
+ },
+ {
+ "name": "teal",
+ "clear": "00BFA5",
+ "night": "005441",
+ "text": "004D40"
+ },
+ {
+ "name": "teal_light",
+ "clear": "80CBC4",
+ "night": "34524F",
+ "text": "004D40"
+ },
+ {
+ "name": "blue_dark",
+ "clear": "02729C",
+ "night": "023A4F",
+ "text": "01579B"
+ },
+ {
+ "name": "blue",
+ "clear": "03A9F4",
+ "night": "02557B",
+ "text": "01579B"
+ },
+ {
+ "name": "blue_light",
+ "clear": "90CAF9",
+ "night": "466178",
+ "text": "01579B"
+ },
+ {
+ "name": "navy_dark",
+ "clear": "1A357D",
+ "night": "0F1B42",
+ "text": "1A357D"
+ },
+ {
+ "name": "navy",
+ "clear": "0068AD",
+ "night": "003557",
+ "text": "1A357D"
+ },
+ {
+ "name": "navy_light",
+ "clear": "7A96CC",
+ "night": "3D4866",
+ "text": "1A357D"
+ },
+ {
+ "name": "indigo",
+ "clear": "4824B5",
+ "night": "25135B",
+ "text": "4A148C"
+ },
+ {
+ "name": "purple_dark",
+ "clear": "4A148C",
+ "night": "360E66",
+ "text": "4A148C"
+ },
+ {
+ "name": "purple",
+ "clear": "BF00AF",
+ "night": "600058",
+ "text": "4A148C"
+ },
+ {
+ "name": "purple_light",
+ "clear": "CE93D8",
+ "night": "684A6D",
+ "text": "4A148C"
+ },
+ {
+ "name": "pink_dark",
+ "clear": "880E4F",
+ "night": "660A3B",
+ "text": "880E4F"
+ },
+ {
+ "name": "pink",
+ "clear": "F50057",
+ "night": "7B002C",
+ "text": "880E4F"
+ },
+ {
+ "name": "pink_light",
+ "clear": "F48FB1",
+ "night": "7B4859",
+ "text": "880E4F"
}
]
}
diff --git a/tools/python/transit/transit_color_palette.py b/tools/python/transit/transit_color_palette.py
index a107a064c4..a395e51f75 100644
--- a/tools/python/transit/transit_color_palette.py
+++ b/tools/python/transit/transit_color_palette.py
@@ -7,18 +7,17 @@ def to_rgb(color_str):
return (r, g, b)
-def to_rgba(rgb):
- return rgb[0] << 24 | rgb[1] << 16 | rgb[2] << 8 | 255
-
-
class Palette:
def __init__(self, colors):
self.colors = []
for color in colors['colors']:
- color_info = {'clear': to_rgb(color['clear']),
- 'night': to_rgb(color['night'])}
+ color_info = {'name': color['name'],
+ 'clear': to_rgb(color['clear'])}
self.colors.append(color_info)
+ def get_default_color(self):
+ return self.colors[0]['name']
+
def get_nearest_color(self, color_str):
"""Returns the nearest color from the palette."""
nearest_color_info = None
@@ -32,5 +31,4 @@ class Palette:
if min_diff is None or diff < min_diff:
min_diff = diff
nearest_color_info = color_info
- return {'clear': to_rgba(nearest_color_info['clear']),
- 'night': to_rgba(nearest_color_info['night'])}
+ return nearest_color_info['name']
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': []}