|
@@ -34,6 +34,8 @@ def _write_styles(f):
|
|
|
hexvalue = '0' + hexvalue
|
|
hexvalue = '0' + hexvalue
|
|
|
f.write('<Style id="color-%i"><IconStyle><color>ff%s%sff</color></IconStyle></Style>\n' % (i, hexvalue, hexvalue))
|
|
f.write('<Style id="color-%i"><IconStyle><color>ff%s%sff</color></IconStyle></Style>\n' % (i, hexvalue, hexvalue))
|
|
|
|
|
|
|
|
|
|
+ f.write('<Style id="color-green"><IconStyle><color>ff00ff00</color></IconStyle></Style>\n')
|
|
|
|
|
+
|
|
|
def _write_commutes(f, commutes):
|
|
def _write_commutes(f, commutes):
|
|
|
f.write('<Folder><name>Commutes</name><visibility>0</visibility>\n')
|
|
f.write('<Folder><name>Commutes</name><visibility>0</visibility>\n')
|
|
|
max_duration = min(4000, max([x['duration'] for x in commutes.values()]))
|
|
max_duration = min(4000, max([x['duration'] for x in commutes.values()]))
|
|
@@ -60,9 +62,13 @@ def _write_properties(f, properties_dict, tmp_ids):
|
|
|
min_max_delta = max_score - min_score
|
|
min_max_delta = max_score - min_score
|
|
|
|
|
|
|
|
for pid, data in properties_list:
|
|
for pid, data in properties_list:
|
|
|
- value = ((data['score'] - min_score) / min_max_delta) if min_max_delta else 1
|
|
|
|
|
- value = min(1, value)
|
|
|
|
|
- color = 20 + value * 235
|
|
|
|
|
|
|
+ color = None
|
|
|
|
|
+ if data['favourite']:
|
|
|
|
|
+ color = 'green'
|
|
|
|
|
+ else:
|
|
|
|
|
+ value = ((data['score'] - min_score) / min_max_delta) if min_max_delta else 1
|
|
|
|
|
+ value = min(1, value)
|
|
|
|
|
+ color = int(20 + value * 235)
|
|
|
|
|
|
|
|
title = '%.0f-%.0f-%s-%i' % (data['price'], data['size'], data.get('ber', ''), tmp_ids[pid])
|
|
title = '%.0f-%.0f-%s-%i' % (data['price'], data['size'], data.get('ber', ''), tmp_ids[pid])
|
|
|
|
|
|
|
@@ -85,7 +91,7 @@ def _write_properties(f, properties_dict, tmp_ids):
|
|
|
|
|
|
|
|
f.write('''<Placemark>
|
|
f.write('''<Placemark>
|
|
|
<Point><coordinates>%f,%f</coordinates></Point>
|
|
<Point><coordinates>%f,%f</coordinates></Point>
|
|
|
- <styleUrl>#color-%i</styleUrl>
|
|
|
|
|
|
|
+ <styleUrl>#color-%s</styleUrl>
|
|
|
<name>%s</name>
|
|
<name>%s</name>
|
|
|
<description><![CDATA[ %s ]]></description>
|
|
<description><![CDATA[ %s ]]></description>
|
|
|
</Placemark>\n''' % (data['loc'][1], data['loc'][0], color, title, description))
|
|
</Placemark>\n''' % (data['loc'][1], data['loc'][0], color, title, description))
|