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
path: root/tools
diff options
context:
space:
mode:
authorRokuz <r.kuznetsow@gmail.com>2017-11-21 17:52:41 +0300
committerDaria Volvenkova <d.volvenkova@corp.mail.ru>2017-11-22 11:53:38 +0300
commit1aaf9f4f8ccb80b0768db36c2af2e821442e5546 (patch)
tree90fd8e96fddaed48107fc83048efed208715058b /tools
parenta2a40f21021e58b5cf50f82e6812a16d5b353189 (diff)
Added exporting of transits colors to colors.txt
Diffstat (limited to 'tools')
-rw-r--r--tools/python/transit/transit_color_palette.py5
-rwxr-xr-xtools/python/transit/transit_colors_export.py34
-rwxr-xr-xtools/unix/generate_drules.sh4
3 files changed, 41 insertions, 2 deletions
diff --git a/tools/python/transit/transit_color_palette.py b/tools/python/transit/transit_color_palette.py
index df44ce69bf..29c4ba6657 100644
--- a/tools/python/transit/transit_color_palette.py
+++ b/tools/python/transit/transit_color_palette.py
@@ -112,8 +112,9 @@ class Palette:
bluish = is_bluish(color)
for name, palette_color in self.colors.iteritems():
- if name in excluded_names:
- continue
+ # Uncomment if you want to exclude duplicates.
+ #if name in excluded_names:
+ # continue
if bluish:
diff = lum_distance(palette_color, color)
else:
diff --git a/tools/python/transit/transit_colors_export.py b/tools/python/transit/transit_colors_export.py
new file mode 100755
index 0000000000..333cf28bd0
--- /dev/null
+++ b/tools/python/transit/transit_colors_export.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python2.7
+# It exports all transits colors to colors.txt file.
+import argparse
+import json
+import os.path
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+ default_colors_path = os.path.dirname(os.path.abspath(__file__)) + '/../../../data/colors.txt'
+ parser.add_argument('in_out_file', nargs='?', type=str, default=default_colors_path,
+ help='path to colors.txt file')
+ default_transits_colors_path = os.path.dirname(os.path.abspath(__file__)) + '/../../../data/transit_colors.txt'
+ parser.add_argument('-c', '--colors', nargs='?', type=str, default=default_transits_colors_path,
+ help='path to transit_colors.txt file')
+
+ args = parser.parse_args()
+
+ colors = set()
+ with open(args.in_out_file, 'r') as in_file:
+ lines = in_file.readlines()
+ for l in lines:
+ colors.add(int(l))
+
+ fields = ['clear', 'night', 'text', 'text_night']
+ with open(args.colors, 'r') as colors_file:
+ tr_colors = json.load(colors_file)
+ for name, color_info in tr_colors['colors'].iteritems():
+ for field in fields:
+ if field in color_info:
+ colors.add(int(color_info[field], 16))
+
+ with open(args.in_out_file, 'w') as out_file:
+ for c in sorted(colors):
+ out_file.write(str(c) + os.linesep)
diff --git a/tools/unix/generate_drules.sh b/tools/unix/generate_drules.sh
index 766b524bdb..1ffd7ae13c 100755
--- a/tools/unix/generate_drules.sh
+++ b/tools/unix/generate_drules.sh
@@ -36,6 +36,10 @@ BuildDrawingRules vehicle night _vehicle_dark
# In designer mode we use drules_proto_design file instead of standard ones
cp $OMIM_PATH/data/drules_proto_clear.bin $OMIM_PATH/data/drules_proto_design.bin
+echo "Exporting transit colors"
+python "$OMIM_PATH/tools/python/transit/transit_colors_export.py" \
+ "$DATA_PATH/colors.txt" > /dev/null
+
echo "Merging default and vehicle styles"
python "$OMIM_PATH/tools/python/stylesheet/drules_merge.py" \
"$DATA_PATH/drules_proto_clear.bin" "$DATA_PATH/drules_proto_vehicle_clear.bin" \