Skip to content

Commit 41c568c

Browse files
committed
update styles of multimodal routes features
1 parent d76d3d8 commit 41c568c

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

pymmrouting/routingresult.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,19 @@
5959
# s-station, tram-station or bus-station
6060
'kiss_and_ride': ''
6161
}
62+
63+
SWITCH_SYMBOL_COLOR = {
64+
'car_parking': '#646464',
65+
'geo_connection': '#646464',
66+
'park_and_ride': '#646464',
67+
'underground_station': '#0067ad',
68+
'suburban_station': '#4e8e40',
69+
'tram_station': '#cc0000',
70+
'bus_station': '#006677',
71+
# FIXME There should be sub-types under kiss_and_ride, i.e. u-station,
72+
# s-station, tram-station or bus-station
73+
'kiss_and_ride': '#646464'
74+
}
6275
# TODO: This mapping should not be place here in the source code. It should be
6376
# somewhere else in the persistant container like database
6477
TMP_DIR = "tmp/"
@@ -305,6 +318,7 @@ def _get_switch_point_poi_info(self, from_mode, to_mode,
305318
sp_info['properties'].update({
306319
"switch_type": "car_parking",
307320
"marker-symbol": SWITCH_SYMBOL['car_parking'],
321+
"marker-color": SWITCH_SYMBOL_COLOR['car_parking'],
308322
"title": poi.name
309323
})
310324
elif switch_type_id == SWITCH_TYPES['geo_connection']:
@@ -314,6 +328,7 @@ def _get_switch_point_poi_info(self, from_mode, to_mode,
314328
sp_info['properties'].update({
315329
"switch_type": "geo_connection",
316330
"marker-symbol": SWITCH_SYMBOL['geo_connection'],
331+
"marker-color": SWITCH_SYMBOL_COLOR['geo_connection'],
317332
"title": ""
318333
})
319334
elif switch_type_id == SWITCH_TYPES['park_and_ride']:
@@ -323,6 +338,7 @@ def _get_switch_point_poi_info(self, from_mode, to_mode,
323338
sp_info['properties'].update({
324339
"switch_type": "park_and_ride",
325340
"marker-symbol": SWITCH_SYMBOL['park_and_ride'],
341+
"marker-color": SWITCH_SYMBOL_COLOR['park_and_ride'],
326342
"title": poi.um_name
327343
})
328344
elif (switch_type_id == SWITCH_TYPES['underground_station']) or \
@@ -334,6 +350,7 @@ def _get_switch_point_poi_info(self, from_mode, to_mode,
334350
sp_info['properties'].update({
335351
"switch_type": "underground_station",
336352
"marker-symbol": SWITCH_SYMBOL['underground_station'],
353+
"marker-color": SWITCH_SYMBOL_COLOR['underground_station'],
337354
"title": poi.station,
338355
"line": poi.line_name,
339356
"platform": poi.pf_name
@@ -348,6 +365,7 @@ def _get_switch_point_poi_info(self, from_mode, to_mode,
348365
sp_info['properties'].update({
349366
"switch_type": "suburban_station",
350367
"marker-symbol": SWITCH_SYMBOL['suburban_station'],
368+
"marker-color": SWITCH_SYMBOL_COLOR['suburban_station'],
351369
"title": poi.um_name,
352370
"line": '',
353371
"platform": ''
@@ -361,6 +379,7 @@ def _get_switch_point_poi_info(self, from_mode, to_mode,
361379
sp_info['properties'].update({
362380
"switch_type": "tram_station",
363381
"marker-symbol": SWITCH_SYMBOL['tram_station'],
382+
"marker-color": SWITCH_SYMBOL_COLOR['tram_station'],
364383
"title": poi.um_name,
365384
"line": '',
366385
"platform": ''
@@ -406,8 +425,8 @@ def to_dict(self):
406425
for i, mp in enumerate(self.mode_paths):
407426
line_style = {
408427
"stroke": DEFAULT_MODE_COLORS[INV_MODES[mp.mode]],
409-
"stroke-opacity": 0.7,
410-
"stroke-width": 4
428+
"stroke-opacity": 0.78,
429+
"stroke-width": 5
411430
}
412431
line_feature = {
413432
"type": "Feature",
@@ -439,9 +458,9 @@ def to_dict(self):
439458
line_feature['properties']['mode'] + ' line'
440459
rd["geojson"]["features"].append(line_feature)
441460
if (i < len(self.mode_paths) - 1):
442-
self.switch_points[i]['properties']['marker-size'] = 'medium'
443-
self.switch_points[i]['properties']['marker-symbol'] = \
444-
SWITCH_SYMBOL[self.switch_points[i]["properties"]["switch_type"]]
461+
#self.switch_points[i]['properties']['marker-size'] = 'medium'
462+
#self.switch_points[i]['properties']['marker-symbol'] = \
463+
#SWITCH_SYMBOL[self.switch_points[i]["properties"]["switch_type"]]
445464
rd["geojson"]["features"].append(self.switch_points[i])
446465
return rd
447466

0 commit comments

Comments
 (0)