|
@@ -2,36 +2,44 @@ widths = [12, 13, 13, 13, 13, 13, 13, 13];
|
2
|
2
|
opas = [0.8, 0.6, 0.5, 0.5, 0.4];
|
3
|
3
|
mwidths = [1, 1, 1, 1.5, 2, 3, 5, 6, 6, 4, 3, 2];
|
4
|
4
|
|
5
|
|
-function $(id) { return document.getElementById(id); }
|
|
5
|
+function $(id) {
|
|
6
|
+ return document.getElementById(id);
|
|
7
|
+}
|
6
|
8
|
|
7
|
9
|
function marker(stat, z) {
|
8
|
10
|
if (z > 15) {
|
9
|
11
|
return L.circle(
|
10
|
|
- [stat.lat, stat.lon],
|
11
|
|
- {
|
|
12
|
+ [stat.lat, stat.lon], {
|
12
|
13
|
color: 'black',
|
13
|
|
- fillColor: stat.attrerrs ? 'red' : stat.su ? '#0000c3' : '#78f378',
|
|
14
|
+ fillColor: stat.attrerrs ? 'red' : stat.su ? '#0000c3' : '#78f378',
|
14
|
15
|
radius: mwidths[23 - z],
|
15
|
|
- fillOpacity : 1,
|
16
|
|
- weight : 1,
|
17
|
|
- id : stat.id
|
|
16
|
+ fillOpacity: 1,
|
|
17
|
+ weight: 1,
|
|
18
|
+ id: stat.id
|
18
|
19
|
}
|
19
|
20
|
);
|
20
|
21
|
} else {
|
21
|
22
|
return L.polyline(
|
22
|
|
- [[stat.lat, stat.lon], [stat.lat, stat.lon]],
|
23
|
|
- {
|
|
23
|
+ [
|
|
24
|
+ [stat.lat, stat.lon],
|
|
25
|
+ [stat.lat, stat.lon]
|
|
26
|
+ ], {
|
24
|
27
|
color: stat.attrerrs ? 'red' : stat.su ? '#0000c3' : '#78f378',
|
25
|
28
|
weight: widths[15 - z],
|
26
|
29
|
opacity: opas[15 - z],
|
27
|
|
- id : stat.id
|
|
30
|
+ id: stat.id
|
28
|
31
|
}
|
29
|
32
|
);
|
30
|
33
|
}
|
31
|
34
|
}
|
32
|
35
|
|
33
|
36
|
function poly(group, z) {
|
34
|
|
- var style = {color: "#85f385", smoothFactor : 0.4, fillOpacity: 0.2, id : group.id};
|
|
37
|
+ var style = {
|
|
38
|
+ color: "#85f385",
|
|
39
|
+ smoothFactor: 0.4,
|
|
40
|
+ fillOpacity: 0.2,
|
|
41
|
+ id: group.id
|
|
42
|
+ };
|
35
|
43
|
if (group.new) {
|
36
|
44
|
style.color = "#0000c3";
|
37
|
45
|
}
|
|
@@ -44,27 +52,36 @@ function poly(group, z) {
|
44
|
52
|
}
|
45
|
53
|
|
46
|
54
|
function sugArr(sug, z) {
|
47
|
|
- return L.polyline(sug.arrow, {id : sug.id, color: '#0000c3', smoothFactor : 0.1, weight: 4, opacity:0.5});
|
|
55
|
+ return L.polyline(sug.arrow, {
|
|
56
|
+ id: sug.id,
|
|
57
|
+ color: '#0000c3',
|
|
58
|
+ smoothFactor: 0.1,
|
|
59
|
+ weight: 4,
|
|
60
|
+ opacity: 0.5
|
|
61
|
+ });
|
48
|
62
|
}
|
49
|
63
|
|
50
|
64
|
function renderStat(stat) {
|
51
|
65
|
var attrrows = {};
|
52
|
|
- var ll = {lat: stat.lat, lon: stat.lon};
|
|
66
|
+ var ll = {
|
|
67
|
+ lat: stat.lat,
|
|
68
|
+ lon: stat.lon
|
|
69
|
+ };
|
53
|
70
|
|
54
|
71
|
var content = document.createElement('div');
|
55
|
72
|
content.setAttribute("id", "nav")
|
56
|
73
|
var attrTbl = document.createElement('table');
|
57
|
|
- attrTbl.setAttribute("id", "attr-tbl")
|
|
74
|
+ attrTbl.setAttribute("id", "attr-tbl")
|
58
|
75
|
var suggD = document.createElement('div');
|
59
|
76
|
suggD.setAttribute("id", "sugg")
|
60
|
77
|
|
61
|
|
- if (stat.attrs.name) {
|
|
78
|
+ if (stat.attrs.name) {
|
62
|
79
|
content.innerHTML = "Node <a onmouseover='nodeHl( " + stat.id + ")' onmouseout='nodeUnHl( " + stat.id + ")' target='_blank' href='https://www.openstreetmap.org/node/" + stat.osmid + "'>" + stat.osmid + "</a> (<b>\"" + stat.attrs.name + "\"</b>)";
|
63
|
80
|
} else {
|
64
|
81
|
content.innerHTML = "Node <a onmouseover='nodeHl( " + stat.id + ")' onmouseout='nodeUnHl( " + stat.id + ")' target='_blank' href='https://www.openstreetmap.org/node/" + stat.osmid + "'>" + stat.osmid + "</a>";
|
65
|
82
|
}
|
66
|
83
|
|
67
|
|
- content.appendChild(attrTbl);
|
|
84
|
+ content.appendChild(attrTbl);
|
68
|
85
|
content.appendChild(suggD);
|
69
|
86
|
|
70
|
87
|
var tbody = document.createElement('tbody');
|
|
@@ -78,7 +95,7 @@ function renderStat(stat) {
|
78
|
95
|
row.appendChild(col1);
|
79
|
96
|
row.appendChild(col2);
|
80
|
97
|
col1.innerHTML = "<a href=\"https://wiki.openstreetmap.org/wiki/Key:" + key + "\" target=\"_blank\"><tt>" + key + "</tt></a>";
|
81
|
|
- for (var i = 0; i < stat.attrs[key].length; i++) col2.innerHTML += "<span class='attrval'>" + stat.attrs[key][i] + "</span>"+ "<br>";
|
|
98
|
+ for (var i = 0; i < stat.attrs[key].length; i++) col2.innerHTML += "<span class='attrval'>" + stat.attrs[key][i] + "</span>" + "<br>";
|
82
|
99
|
attrrows[key] = row;
|
83
|
100
|
}
|
84
|
101
|
|
|
@@ -100,8 +117,8 @@ function renderStat(stat) {
|
100
|
117
|
|
101
|
118
|
var suggList = document.createElement('ul');
|
102
|
119
|
|
103
|
|
- if (stat.su.length) {
|
104
|
|
- var a = document.createElement('span');
|
|
120
|
+ if (stat.su.length) {
|
|
121
|
+ var a = document.createElement('span');
|
105
|
122
|
a.className = "sugtit";
|
106
|
123
|
a.innerHTML = "Suggestions";
|
107
|
124
|
suggD.appendChild(a);
|
|
@@ -113,7 +130,7 @@ function renderStat(stat) {
|
113
|
130
|
var sugg = stat.su[i];
|
114
|
131
|
|
115
|
132
|
var suggDiv = document.createElement('li');
|
116
|
|
-
|
|
133
|
+
|
117
|
134
|
if (sugg.type == 1) {
|
118
|
135
|
suggDiv.innerHTML = "Move node into a <span class='grouplink' onmouseover='groupHl( " + sugg.target_gid + ")' onmouseout='groupUnHl( " + sugg.target_gid + ")'>new relation</span> <tt>public_transport=stop_area</tt>";
|
119
|
136
|
} else if (sugg.type == 2) {
|
|
@@ -132,10 +149,14 @@ function renderStat(stat) {
|
132
|
149
|
}
|
133
|
150
|
|
134
|
151
|
if (map.getZoom() < 18) {
|
135
|
|
- map.setView(ll, 18, {animate: true});
|
|
152
|
+ map.setView(ll, 18, {
|
|
153
|
+ animate: true
|
|
154
|
+ });
|
136
|
155
|
}
|
137
|
156
|
|
138
|
|
- L.popup({opacity: 0.8})
|
|
157
|
+ L.popup({
|
|
158
|
+ opacity: 0.8
|
|
159
|
+ })
|
139
|
160
|
.setLatLng(ll)
|
140
|
161
|
.setContent(content)
|
141
|
162
|
.openOn(map);
|
|
@@ -181,7 +202,7 @@ function renderGroup(grp, ll) {
|
181
|
202
|
var stat = grp.stations[key];
|
182
|
203
|
var row = document.createElement('div');
|
183
|
204
|
|
184
|
|
- if (stat.attrs.name) {
|
|
205
|
+ if (stat.attrs.name) {
|
185
|
206
|
row.innerHTML = "Node <a onmouseover='nodeHl( " + stat.id + ")' onmouseout='nodeUnHl( " + stat.id + ")' target='_blank' href='https://www.openstreetmap.org/node/" + stat.osmid + "'>" + stat.osmid + "</a> (<b>\"" + stat.attrs.name + "\"</b>)";
|
186
|
207
|
} else {
|
187
|
208
|
row.innerHTML = "Node <a onmouseover='nodeHl( " + stat.id + ")' onmouseout='nodeUnHl( " + stat.id + ")' target='_blank' href='https://www.openstreetmap.org/node/" + stat.osmid + "'>" + stat.osmid + "</a>";
|
|
@@ -197,10 +218,14 @@ function renderGroup(grp, ll) {
|
197
|
218
|
}
|
198
|
219
|
|
199
|
220
|
if (map.getZoom() < 18) {
|
200
|
|
- map.setView(ll, 18, {animate: true});
|
|
221
|
+ map.setView(ll, 18, {
|
|
222
|
+ animate: true
|
|
223
|
+ });
|
201
|
224
|
}
|
202
|
225
|
|
203
|
|
- L.popup({opacity: 0.8})
|
|
226
|
+ L.popup({
|
|
227
|
+ opacity: 0.8
|
|
228
|
+ })
|
204
|
229
|
.setLatLng(ll)
|
205
|
230
|
.setContent(content)
|
206
|
231
|
.openOn(map);
|
|
@@ -223,43 +248,43 @@ function groupHl(id) {
|
223
|
248
|
if (!document.groupIdx[id]) return;
|
224
|
249
|
document.groupIdx[id].setStyle({
|
225
|
250
|
'weight': 6,
|
226
|
|
- 'fillOpacity':0.5
|
227
|
|
-});
|
|
251
|
+ 'fillOpacity': 0.5
|
|
252
|
+ });
|
228
|
253
|
}
|
229
|
254
|
|
230
|
255
|
function groupUnHl(id) {
|
231
|
256
|
if (!document.groupIdx[id]) return;
|
232
|
|
- document.groupIdx[id].setStyle({
|
|
257
|
+ document.groupIdx[id].setStyle({
|
233
|
258
|
'weight': 3,
|
234
|
|
- 'fillOpacity':0.2
|
235
|
|
-});
|
|
259
|
+ 'fillOpacity': 0.2
|
|
260
|
+ });
|
236
|
261
|
}
|
237
|
262
|
|
238
|
263
|
function nodeHl(id) {
|
239
|
264
|
if (!document.nodeIdx[id]) return;
|
240
|
265
|
document.nodeIdx[id].setStyle({
|
241
|
266
|
'weight': 5,
|
242
|
|
- 'color' : "#eecc00"
|
243
|
|
-});
|
|
267
|
+ 'color': "#eecc00"
|
|
268
|
+ });
|
244
|
269
|
}
|
245
|
270
|
|
246
|
271
|
function nodeUnHl(id) {
|
247
|
272
|
if (!document.nodeIdx[id]) return;
|
248
|
|
- document.nodeIdx[id].setStyle({
|
|
273
|
+ document.nodeIdx[id].setStyle({
|
249
|
274
|
'weight': 1,
|
250
|
|
- 'color' : "black"
|
251
|
|
-});
|
|
275
|
+ 'color': "black"
|
|
276
|
+ });
|
252
|
277
|
}
|
253
|
278
|
|
254
|
279
|
var map = L.map('map', {
|
255
|
|
- renderer: L.canvas(),
|
256
|
|
- attributionControl: false,
|
|
280
|
+ renderer: L.canvas(),
|
|
281
|
+ attributionControl: false,
|
257
|
282
|
}).setView([47.9965, 7.8469], 13);
|
258
|
283
|
|
259
|
284
|
map.addControl(L.control.attribution({
|
260
|
|
- position: 'bottomright',
|
261
|
|
- prefix: '© <a href="http://ad.cs.uni-freiburg.de">University of Freiburg, Chair of Algorithms and Data Structures</a>'
|
262
|
|
- }));
|
|
285
|
+ position: 'bottomright',
|
|
286
|
+ prefix: '© <a href="http://ad.cs.uni-freiburg.de">University of Freiburg, Chair of Algorithms and Data Structures</a>'
|
|
287
|
+}));
|
263
|
288
|
|
264
|
289
|
L.tileLayer('https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png', {
|
265
|
290
|
maxZoom: 23,
|
|
@@ -270,7 +295,7 @@ L.tileLayer('https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x
|
270
|
295
|
var layer = L.featureGroup().addTo(map);
|
271
|
296
|
var labelLayer = L.featureGroup().addTo(map);
|
272
|
297
|
|
273
|
|
-map.on("moveend", function () {
|
|
298
|
+map.on("moveend", function() {
|
274
|
299
|
render();
|
275
|
300
|
});
|
276
|
301
|
|
|
@@ -288,10 +313,41 @@ function render() {
|
288
|
313
|
var blur = 22 - map.getZoom();
|
289
|
314
|
var rad = 25 - map.getZoom();
|
290
|
315
|
|
291
|
|
- layer.addLayer(L.heatLayer(content.ok, {max: 500, gradient: {0: '#cbf7cb', 0.5: '#78f378', 1: '#29c329'}, minOpacity: 0.65, blur: blur, radius: rad}));
|
292
|
|
- layer.addLayer(L.heatLayer(content.sugg, {max: 500, gradient: {0: '#7f7fbd', 0.5: '#4444b3', 1: '#0606c1'}, minOpacity: 0.65, blur: blur-3, radius: Math.min(12, rad-3)}));
|
293
|
|
-
|
294
|
|
- layer.addLayer(L.heatLayer(content.err, {max: 500, gradient: {0: '#f39191', 0.5: '#ff5656', 1: '#ff0000'}, minOpacity: 0.75, blur: blur-3, radius: Math.min(10, rad-3), maxZoom: 15}));
|
|
316
|
+ layer.addLayer(L.heatLayer(content.ok, {
|
|
317
|
+ max: 500,
|
|
318
|
+ gradient: {
|
|
319
|
+ 0: '#cbf7cb',
|
|
320
|
+ 0.5: '#78f378',
|
|
321
|
+ 1: '#29c329'
|
|
322
|
+ },
|
|
323
|
+ minOpacity: 0.65,
|
|
324
|
+ blur: blur,
|
|
325
|
+ radius: rad
|
|
326
|
+ }));
|
|
327
|
+ layer.addLayer(L.heatLayer(content.sugg, {
|
|
328
|
+ max: 500,
|
|
329
|
+ gradient: {
|
|
330
|
+ 0: '#7f7fbd',
|
|
331
|
+ 0.5: '#4444b3',
|
|
332
|
+ 1: '#0606c1'
|
|
333
|
+ },
|
|
334
|
+ minOpacity: 0.65,
|
|
335
|
+ blur: blur - 3,
|
|
336
|
+ radius: Math.min(12, rad - 3)
|
|
337
|
+ }));
|
|
338
|
+
|
|
339
|
+ layer.addLayer(L.heatLayer(content.err, {
|
|
340
|
+ max: 500,
|
|
341
|
+ gradient: {
|
|
342
|
+ 0: '#f39191',
|
|
343
|
+ 0.5: '#ff5656',
|
|
344
|
+ 1: '#ff0000'
|
|
345
|
+ },
|
|
346
|
+ minOpacity: 0.75,
|
|
347
|
+ blur: blur - 3,
|
|
348
|
+ radius: Math.min(10, rad - 3),
|
|
349
|
+ maxZoom: 15
|
|
350
|
+ }));
|
295
|
351
|
}
|
296
|
352
|
};
|
297
|
353
|
|
|
@@ -304,7 +360,7 @@ function render() {
|
304
|
360
|
|
305
|
361
|
layer.clearLayers();
|
306
|
362
|
labelLayer.clearLayers();
|
307
|
|
- document.groupIdx = {};
|
|
363
|
+ document.groupIdx = {};
|
308
|
364
|
document.nodeIdx = {};
|
309
|
365
|
|
310
|
366
|
var stations = [];
|
|
@@ -332,17 +388,22 @@ function render() {
|
332
|
388
|
}
|
333
|
389
|
|
334
|
390
|
if (map.getZoom() > 15) {
|
335
|
|
- labelLayer.addLayer(L.featureGroup(labels));
|
336
|
|
- layer.addLayer(L.featureGroup(suggs).on('click', function(a) { openStat(a.layer.options.id); }));
|
|
391
|
+ labelLayer.addLayer(L.featureGroup(labels));
|
|
392
|
+ layer.addLayer(L.featureGroup(suggs).on('click', function(a) {
|
|
393
|
+ openStat(a.layer.options.id);
|
|
394
|
+ }));
|
337
|
395
|
}
|
338
|
396
|
|
339
|
397
|
if (map.getZoom() > 13) {
|
340
|
|
- layer.addLayer(L.featureGroup(groups).on('click', function(a) { openGroup(a.layer.options.id, a.layer.getBounds().getCenter());}));
|
|
398
|
+ layer.addLayer(L.featureGroup(groups).on('click', function(a) {
|
|
399
|
+ openGroup(a.layer.options.id, a.layer.getBounds().getCenter());
|
|
400
|
+ }));
|
341
|
401
|
}
|
342
|
402
|
|
343
|
403
|
|
344
|
404
|
layer.addLayer(L.featureGroup(stations).on('click', function(a) {
|
345
|
|
- openStat(a.layer.options.id);}));
|
|
405
|
+ openStat(a.layer.options.id);
|
|
406
|
+ }));
|
346
|
407
|
}
|
347
|
408
|
};
|
348
|
409
|
|