-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjj.js
305 lines (272 loc) · 7.96 KB
/
jj.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
var map = OpenLayers.map('mapid', {zoomControl: false}).setView([46.0517515, 14.5076515], 13);
var baselayers = {
"Voyager": OpenLayers.tileLayer('https://basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, © <a href="https://carto.com/attribution">CARTO</a>'
}),
"Svetli zemljevid": OpenLayers.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, © <a href="https://carto.com/attribution">CARTO</a>'
}),
"Temni zemljevid": OpenLayers.tileLayer('https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, © <a href="https://carto.com/attribution">CARTO</a>'
}),
"OpenStreetMap": OpenLayers.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
maxZoom: 23,
crossOrigin: 'anonymous',
id: 'osm'
}),
"Novi temni zemljevid": OpenLayers.tileLayer('https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, © <a href="https://carto.com/attributions">CARTO</a>',
maxZoom: 23,
crossOrigin: 'anonymous',
id: 'darkMatter'
})
};
var overlays = {};
// BICIKELJ ICONS
// ACTIVE ICON
// Has free bikes
var activeBicikeljStation = OpenLayers.icon({
iconUrl: 'img/ico/bicikeljStation.png',
shadowUrl: '',
className: 'startEndStopIcon',
iconSize: [20, 23],
iconAnchor: [10, 12],
popupAnchor: [0, 0],
tooltipAnchor: [0, 0]
});
// INACTIVE ICON
// Does not have free bikes
var inactiveBicikeljStation = OpenLayers.icon({
iconUrl: 'img/ico/bicikeljStationInactive.png',
shadowUrl: '',
className: 'startEndStopIcon',
iconSize: [20, 23],
iconAnchor: [10, 12],
popupAnchor: [0, 0],
tooltipAnchor: [0, 0]
});
// LPP ICONS
// ACTIVE ICON
// Buses which have line data
let ANCHOR_X = 0;
let ANCHOR_Y = 0;
var szIcon = OpenLayers.divIcon({
className: 'szIcon',
iconSize: [120, 39],
iconAnchor: [60, 19],
popupAnchor: [0, 0],
tooltipAnchor: [ANCHOR_X, ANCHOR_Y]
})
var activeIcon = OpenLayers.icon({
iconUrl: 'img/ico/markerActive.png',
shadowUrl: '',
className: 'activeBusIcon',
iconSize: [25, 25],
iconAnchor: [13, 13],
popupAnchor: [0, 0],
tooltipAnchor: [ANCHOR_X, ANCHOR_Y]
});
// HIDDEN ICON
// Buses which do not have line data, but have electric (and/or engine) on
var hiddenIcon = OpenLayers.icon({
iconUrl: 'img/ico/markerHidden.png',
shadowUrl: '',
className: 'hiddenBusIcon',
iconSize: [25, 25],
iconAnchor: [13, 13],
popupAnchor: [0, 0],
tooltipAnchor: [ANCHOR_X, ANCHOR_Y]
});
// INACTIVE ICON
// Buses which are inactive
var inactiveIcon = OpenLayers.icon({
iconUrl: 'img/ico/markerInactive.png',
shadowUrl: '',
className: 'inactiveBusIcon',
iconSize: [25, 25],
iconAnchor: [13, 13],
popupAnchor: [0, 0],
tooltipAnchor: [ANCHOR_X, ANCHOR_Y]
});
// SELECTED ICON
// Bus which is selected
var selectedIcon = OpenLayers.icon({
iconUrl: 'img/ico/markerSelect.png',
shadowUrl: '',
className: 'inactiveBusIcon',
iconSize: [25, 25],
iconAnchor: [13, 13],
popupAnchor: [0, 0],
tooltipAnchor: [ANCHOR_X, ANCHOR_Y]
});
// ACTIVE STATION
// ACTIVE END/START STATION
// INACTIVE STATION
// INACTIVE START STATION
var startEndStopIcon = OpenLayers.icon({
iconUrl: 'img/ico/endStation.png',
shadowUrl: '',
className: 'startEndStopIcon',
iconSize: [20, 23],
iconAnchor: [10, 12],
popupAnchor: [0, 0],
tooltipAnchor: [0, 0]
});
var middleStopIcon = OpenLayers.icon({
iconUrl: 'img/ico/midStation.png',
shadowUrl: '',
className: 'middleStopIcon',
iconSize: [20, 23],
iconAnchor: [10, 12],
popupAnchor: [0, 0],
tooltipAnchor: [0, 0]
});
var endStopIconPassed = OpenLayers.icon({
iconUrl: 'img/ico/endStationPassed.png',
shadowUrl: '',
className: 'endStopIconPassed',
iconSize: [20, 23],
iconAnchor: [10, 12],
popupAnchor: [0, 0],
tooltipAnchor: [0, 0]
});
var middleStopIconPassed = OpenLayers.icon({
iconUrl: 'img/ico/midStationPassed.png',
shadowUrl: '',
className: 'middleStopIconPassed',
iconSize: [20, 23],
iconAnchor: [10, 12],
popupAnchor: [0, 0],
tooltipAnchor: [0, 0]
});
//P+R ICON
var pprIcon = OpenLayers.icon({
iconUrl: 'img/ico/parkPlusRide.png',
shadowUrl: '',
className: 'middleStopIconPassed',
iconSize: [20, 23],
iconAnchor: [10, 12],
popupAnchor: [0, 0],
tooltipAnchor: [0, 0]
});
var inactivePprIcon = OpenLayers.icon({
iconUrl: 'img/ico/parkPlusRideInactive.png',
shadowUrl: '',
className: 'middleStopIconPassed',
iconSize: [20, 23],
iconAnchor: [10, 12],
popupAnchor: [0, 0],
tooltipAnchor: [0, 0]
});
//AVANT2GO ICON
var avantIcon = OpenLayers.icon({
iconUrl: 'img/ico/avant2Go.png',
shadowUrl: '',
className: 'middleStopIconPassed',
iconSize: [20, 23],
iconAnchor: [10, 12],
popupAnchor: [0, 0],
tooltipAnchor: [0, 0]
});
var inactiveAvantIcon = OpenLayers.icon({
iconUrl: 'img/ico/avant2GoInactive.png',
shadowUrl: '',
className: 'middleStopIconPassed',
iconSize: [20, 23],
iconAnchor: [10, 12],
popupAnchor: [0, 0],
tooltipAnchor: [0, 0]
});
//ELECTRIC CHARGER ICON
var chargerIcon = OpenLayers.icon({
iconUrl: 'img/ico/electricCharger.png',
shadowUrl: '',
className: 'middleStopIconPassed',
iconSize: [20, 23],
iconAnchor: [10, 12],
popupAnchor: [0, 0],
tooltipAnchor: [0, 0]
});
var inactiveChargerIcon = OpenLayers.icon({
iconUrl: 'img/ico/electricChargerInactive.png',
shadowUrl: '',
className: 'middleStopIconPassed',
iconSize: [20, 23],
iconAnchor: [10, 12],
popupAnchor: [0, 0],
tooltipAnchor: [0, 0]
});
//URBANOMAT ICON
var urbanomatIcon = OpenLayers.icon({
iconUrl: 'img/ico/urbanomat.png',
shadowUrl: '',
className: 'middleStopIconPassed',
iconSize: [20, 23],
iconAnchor: [10, 12],
popupAnchor: [0, 0],
tooltipAnchor: [0, 0]
});
//PARKING ICON
var parkingIcon = OpenLayers.icon({
iconUrl: 'img/ico/parking.png',
shadowUrl: '',
className: 'middleStopIconPassed',
iconSize: [20, 23],
iconAnchor: [10, 12],
popupAnchor: [0, 0],
tooltipAnchor: [0, 0]
});
var inactiveParkingIcon = OpenLayers.icon({
iconUrl: 'img/ico/parkingInactive.png',
shadowUrl: '',
className: 'middleStopIconPassed',
iconSize: [20, 23],
iconAnchor: [10, 12],
popupAnchor: [0, 0],
tooltipAnchor: [0, 0]
});
var parkingGarageIcon = OpenLayers.icon({
iconUrl: 'img/ico/parkingGarage.png',
shadowUrl: '',
className: 'middleStopIconPassed',
iconSize: [20, 23],
iconAnchor: [10, 12],
popupAnchor: [0, 0],
tooltipAnchor: [0, 0]
});
var inactiveParkingGarageIcon = OpenLayers.icon({
iconUrl: 'img/ico/parkingGarageInactive.png',
shadowUrl: '',
className: 'middleStopIconPassed',
iconSize: [20, 23],
iconAnchor: [10, 12],
popupAnchor: [0, 0],
tooltipAnchor: [0, 0]
});
//RAILWAY ICON
var szStation = OpenLayers.icon({
iconUrl: 'img/ico/sz.png',
shadowUrl: '',
className: 'middleStopIconPassed',
iconSize: [20, 23],
iconAnchor: [20, 12],
popupAnchor: [0, 0],
tooltipAnchor: [0, 0]
});
// layers
baselayers["Voyager"].addTo(map);
OpenLayers.control.zoom({
position:'topright'
}).addTo(map);
OpenLayers.control.layers(baselayers, overlays, {position: 'topright', class: 'labelstyle'}).addTo(map);
var popup = OpenLayers.popup();
if (navigator.userAgent.includes("Android") || navigator.userAgent.includes("iPhone") || navigator.userAgent.includes("iPad")) {
var k = OpenLayers.control.locate({position: 'topright'}).addTo(map);
}
map.on('zoomend', function() {
updateMapInformation();
})
map.on('dragend', function() {
updateMapInformation();
})