Total Complexity | 46 |
Complexity/F | 3.29 |
Lines of Code | 533 |
Function Count | 14 |
Duplicated Lines | 203 |
Ratio | 38.09 % |
Changes | 0 |
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like script.js often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
1 | /* |
||
26 | function olTestCSSsupport() { |
||
27 | return (jQuery('.olCSSsupported').length > 0); |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * Creates a DocumentFragment to insert into the dom. |
||
32 | * |
||
33 | * @param mapid |
||
34 | * id for the map div |
||
35 | * @param width |
||
36 | * width for the map div |
||
37 | * @param height |
||
38 | * height for the map div |
||
39 | * @returns a {DocumentFragment} element that can be injected into the dom |
||
40 | */ |
||
41 | function olCreateMaptag(mapid, width, height) { |
||
42 | var mEl = '<div id="' + mapid + '-olContainer" class="olContainer olWebOnly">' |
||
43 | // map |
||
44 | + '<div id="' + mapid + '" tabindex="0" style="width:' + width + ';height:' + height + ';" class="olMap"></div>' |
||
45 | + '</div>', |
||
46 | // fragment |
||
47 | frag = document.createDocumentFragment(), |
||
48 | // temp node |
||
49 | temp = document.createElement('div'); |
||
50 | temp.innerHTML = mEl; |
||
51 | while (temp.firstChild) { |
||
52 | frag.appendChild(temp.firstChild); |
||
53 | } |
||
54 | return frag; |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * Create the map based on the params given. |
||
59 | * |
||
60 | * @param {Object} |
||
61 | * mapOpts MapOptions hash {id:'olmap', width:500px, height:500px, |
||
62 | * lat:6710200, lon:506500, zoom:13, statusbar:1, controls:1, |
||
63 | * poihoverstyle:1, baselyr:'', kmlfile:'', gpxfile:'', geojsonfile, |
||
64 | * summary:''} |
||
65 | * @param {Array} |
||
66 | * OLmapPOI array with POI's [ {lat:6710300,lon:506000,txt:'instap |
||
67 | * punt',angle:180,opacity:.9,img:'', rowId:n},... ]); |
||
68 | * |
||
69 | * @return {OpenLayers.Map} the created map |
||
70 | */ |
||
71 | function createMap(mapOpts, poi) { |
||
72 | |||
73 | // const mapOpts = olMapData[0].mapOpts; |
||
74 | // const poi = olMapData[0].poi; |
||
75 | |||
76 | if (!olEnable) { |
||
|
|||
77 | return; |
||
78 | } |
||
79 | if (!olTestCSSsupport()) { |
||
80 | olEnable = false; |
||
81 | return; |
||
82 | } |
||
83 | |||
84 | // find map element location |
||
85 | var cleartag = document.getElementById(mapOpts.id + '-clearer'); |
||
86 | if (cleartag === null) { |
||
87 | return; |
||
88 | } |
||
89 | // create map element and add to document |
||
90 | var fragment = olCreateMaptag(mapOpts.id, mapOpts.width, mapOpts.height); |
||
91 | cleartag.parentNode.insertBefore(fragment, cleartag); |
||
92 | |||
93 | /** dynamic map extent. */ |
||
94 | let extent = ol.extent.createEmpty(); |
||
95 | overlayGroup = new ol.layer.Group({title: 'Overlays', fold: 'open', layers: []}); |
||
96 | const baseLyrGroup = new ol.layer.Group({'title': 'Base maps', layers: []}); |
||
97 | |||
98 | const map = new ol.Map({ |
||
99 | target: document.getElementById(mapOpts.id), |
||
100 | layers: [baseLyrGroup, overlayGroup], |
||
101 | view: new ol.View({ |
||
102 | center: ol.proj.transform([mapOpts.lon, mapOpts.lat], 'EPSG:4326', 'EPSG:3857'), |
||
103 | zoom: mapOpts.zoom, |
||
104 | projection: 'EPSG:3857' |
||
105 | }) |
||
106 | }); |
||
107 | |||
108 | View Code Duplication | if (osmEnable) { |
|
109 | baseLyrGroup.getLayers().push( |
||
110 | new ol.layer.Tile({ |
||
111 | visible: true, |
||
112 | title: 'OSM', |
||
113 | type: 'base', |
||
114 | source: new ol.source.OSM() |
||
115 | })); |
||
116 | |||
117 | baseLyrGroup.getLayers().push( |
||
118 | new ol.layer.Tile({ |
||
119 | visible: mapOpts.baselyr === "cycle map", |
||
120 | title: 'cycle map', |
||
121 | type: 'base', |
||
122 | source: new ol.source.OSM({ |
||
123 | url: 'https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + tfApiKey, |
||
124 | attributions: 'Data ©ODbL <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>, ' |
||
125 | + 'Tiles ©<a href="https://www.thunderforest.com/" target="_blank">Thunderforest</a>' |
||
126 | + '<img src="https://www.thunderforest.com/favicon.ico" alt="Thunderforest logo"/>' |
||
127 | }) |
||
128 | })); |
||
129 | |||
130 | baseLyrGroup.getLayers().push( |
||
131 | new ol.layer.Tile({ |
||
132 | visible: mapOpts.baselyr === "transport", |
||
133 | title: 'transport', |
||
134 | type: 'base', |
||
135 | source: new ol.source.OSM({ |
||
136 | url: 'https://{a-c}.tile.thunderforest.com/transport/{z}/{x}/{y}.png?apikey=' + tfApiKey, |
||
137 | attributions: 'Data ©ODbL <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>, ' |
||
138 | + 'Tiles ©<a href="https://www.thunderforest.com/" target="_blank">Thunderforest</a>' |
||
139 | + '<img src="https://www.thunderforest.com/favicon.ico" alt="Thunderforest logo"/>' |
||
140 | }) |
||
141 | })); |
||
142 | |||
143 | baseLyrGroup.getLayers().push( |
||
144 | new ol.layer.Tile({ |
||
145 | visible: mapOpts.baselyr === "landscape", |
||
146 | title: 'landscape', |
||
147 | type: 'base', |
||
148 | source: new ol.source.OSM({ |
||
149 | url: 'https://{a-c}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + tfApiKey, |
||
150 | attributions: 'Data ©ODbL <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>, ' |
||
151 | + 'Tiles ©<a href="https://www.thunderforest.com/" target="_blank">Thunderforest</a>' |
||
152 | + '<img src="https://www.thunderforest.com/favicon.ico" alt="Thunderforest logo"/>' |
||
153 | }) |
||
154 | })); |
||
155 | |||
156 | baseLyrGroup.getLayers().push( |
||
157 | new ol.layer.Tile({ |
||
158 | visible: mapOpts.baselyr === "outdoors", |
||
159 | title: 'outdoors', |
||
160 | type: 'base', |
||
161 | source: new ol.source.OSM({ |
||
162 | url: 'https://{a-c}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + tfApiKey, |
||
163 | attributions: 'Data ©ODbL <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>, ' |
||
164 | + 'Tiles ©<a href="https://www.thunderforest.com/" target="_blank">Thunderforest</a>' |
||
165 | + '<img src="https://www.thunderforest.com/favicon.ico" alt="Thunderforest logo"/>' |
||
166 | }) |
||
167 | })); |
||
168 | } |
||
169 | |||
170 | View Code Duplication | if (bEnable && bApiKey !== '') { |
|
171 | baseLyrGroup.getLayers().push( |
||
172 | new ol.layer.Tile({ |
||
173 | visible: mapOpts.baselyr === "bing road", |
||
174 | title: 'bing road', |
||
175 | type: 'base', |
||
176 | source: new ol.source.BingMaps({ |
||
177 | key: bApiKey, |
||
178 | imagerySet: 'Road' |
||
179 | }) |
||
180 | })); |
||
181 | |||
182 | baseLyrGroup.getLayers().push( |
||
183 | new ol.layer.Tile({ |
||
184 | visible: mapOpts.baselyr === "bing sat", |
||
185 | title: 'bing sat', |
||
186 | type: 'base', |
||
187 | source: new ol.source.BingMaps({ |
||
188 | key: bApiKey, |
||
189 | imagerySet: 'Aerial' |
||
190 | }) |
||
191 | })); |
||
192 | |||
193 | baseLyrGroup.getLayers().push( |
||
194 | new ol.layer.Tile({ |
||
195 | visible: mapOpts.baselyr === "bing hybrid", |
||
196 | title: 'bing hybrid', |
||
197 | type: 'base', |
||
198 | source: new ol.source.BingMaps({ |
||
199 | key: bApiKey, |
||
200 | imagerySet: 'AerialWithLabels' |
||
201 | }) |
||
202 | })); |
||
203 | } |
||
204 | |||
205 | if (stamenEnable) { |
||
206 | baseLyrGroup.getLayers().push( |
||
207 | new ol.layer.Tile({ |
||
208 | visible: false, |
||
209 | type: 'base', |
||
210 | title: 'toner', |
||
211 | source: new ol.source.Stamen({layer: 'toner'}) |
||
212 | }) |
||
213 | ); |
||
214 | baseLyrGroup.getLayers().push( |
||
215 | new ol.layer.Tile({ |
||
216 | visible: false, |
||
217 | type: 'base', |
||
218 | title: 'terrain', |
||
219 | source: new ol.source.Stamen({layer: 'terrain'}) |
||
220 | }) |
||
221 | ); |
||
222 | } |
||
223 | |||
224 | map.addControl(new ol.control.ScaleLine({bar: true, text: true})); |
||
225 | map.addControl(new ol.control.MousePosition({ |
||
226 | coordinateFormat: ol.coordinate.createStringXY(4), projection: 'EPSG:4326', |
||
227 | })); |
||
228 | map.addControl(new ol.control.FullScreen()); |
||
229 | map.addControl(new ol.control.OverviewMap()); |
||
230 | map.addControl(new ol.control.LayerSwitcher()); |
||
231 | extent = ol.extent.extend(extent, map.getView().calculateExtent()); |
||
232 | |||
233 | const iconScale = 1.0; |
||
234 | const vectorSource = new ol.source.Vector(); |
||
235 | View Code Duplication | poi.forEach((p) => { |
|
236 | const f = new ol.Feature({ |
||
237 | geometry: new ol.geom.Point(ol.proj.fromLonLat([p.lon, p.lat])), |
||
238 | description: p.txt, |
||
239 | img: p.img, |
||
240 | rowId: p.rowId, |
||
241 | lat: p.lat, |
||
242 | lon: p.lon, |
||
243 | angle: p.angle, |
||
244 | alt: p.img.substring(0, p.img.lastIndexOf(".")) |
||
245 | }); |
||
246 | f.setId(p.rowId); |
||
247 | f.setStyle(new ol.style.Style({ |
||
248 | text: new ol.style.Text({ |
||
249 | text: "" + p.rowId, |
||
250 | textAlign: 'left', |
||
251 | textBaseline: 'bottom', |
||
252 | offsetX: 8, |
||
253 | offsetY: -8, |
||
254 | scale: iconScale, |
||
255 | fill: new ol.style.Fill({color: 'rgb(0,0,0)'}), |
||
256 | font: '12px monospace bold', |
||
257 | backgroundFill: new ol.style.Fill({color: 'rgba(255,255,255,.4)'}) |
||
258 | }), image: new ol.style.Icon({ |
||
259 | src: DOKU_BASE + "lib/plugins/openlayersmap/icons/" + p.img, |
||
260 | crossOrigin: '', |
||
261 | opacity: p.opacity, |
||
262 | scale: iconScale, |
||
263 | rotation: p.angle * Math.PI / 180, |
||
264 | }), |
||
265 | })); |
||
266 | vectorSource.addFeature(f); |
||
267 | }); |
||
268 | |||
269 | const vectorLayer = new ol.layer.Vector({title: 'POI', visible: true, source: vectorSource}); |
||
270 | overlayGroup.getLayers().push(vectorLayer); |
||
271 | if (mapOpts.autozoom) { |
||
272 | extent = ol.extent.extend(extent, vectorSource.getExtent()); |
||
273 | map.getView().fit(extent); |
||
274 | } |
||
275 | |||
276 | if (mapOpts.kmlfile.length > 0) { |
||
277 | try { |
||
278 | const kmlSource = new ol.source.Vector({ |
||
279 | url: DOKU_BASE + "lib/exe/fetch.php?media=" + mapOpts.kmlfile, |
||
280 | format: new ol.format.KML(), |
||
281 | }); |
||
282 | overlayGroup.getLayers().push(new ol.layer.Vector({title: 'KML file', visible: true, source: kmlSource})); |
||
283 | |||
284 | if (mapOpts.autozoom) { |
||
285 | kmlSource.once('change', function () { |
||
286 | extent = ol.extent.extend(extent, kmlSource.getExtent()); |
||
287 | map.getView().fit(extent); |
||
288 | }); |
||
289 | } |
||
290 | } catch (e) { |
||
291 | console.error(e); |
||
292 | } |
||
293 | } |
||
294 | |||
295 | if (mapOpts.geojsonfile.length > 0) { |
||
296 | try { |
||
297 | const geoJsonSource = new ol.source.Vector({ |
||
298 | url: DOKU_BASE + "lib/exe/fetch.php?media=" + mapOpts.geojsonfile, |
||
299 | format: new ol.format.GeoJSON(), |
||
300 | }); |
||
301 | overlayGroup.getLayers().push(new ol.layer.Vector({ |
||
302 | title: 'GeoJSON file', visible: true, source: geoJsonSource, |
||
303 | // TODO |
||
304 | // style: { |
||
305 | // strokeColor: "#FF00FF", |
||
306 | // strokeWidth: 3, |
||
307 | // strokeOpacity: 0.7, |
||
308 | // pointRadius: 4, |
||
309 | // fillColor: "#FF99FF", |
||
310 | // fillOpacity: 0.7 |
||
311 | // } |
||
312 | })); |
||
313 | |||
314 | if (mapOpts.autozoom) { |
||
315 | geoJsonSource.once('change', function () { |
||
316 | extent = ol.extent.extend(extent, geoJsonSource.getExtent()); |
||
317 | map.getView().fit(extent); |
||
318 | }); |
||
319 | } |
||
320 | } catch (e) { |
||
321 | console.error(e); |
||
322 | } |
||
323 | } |
||
324 | |||
325 | if (mapOpts.gpxfile.length > 0) { |
||
326 | try { |
||
327 | const gpxSource = new ol.source.Vector({ |
||
328 | url: DOKU_BASE + "lib/exe/fetch.php?media=" + mapOpts.gpxfile, |
||
329 | format: new ol.format.GPX(), |
||
330 | }); |
||
331 | overlayGroup.getLayers().push(new ol.layer.Vector({ |
||
332 | title: 'GPS track', visible: true, source: gpxSource, |
||
333 | // TODO |
||
334 | // style: { |
||
335 | // strokeColor: "#0000FF", |
||
336 | // strokeWidth: 3, |
||
337 | // strokeOpacity: 0.7, |
||
338 | // pointRadius: 4, |
||
339 | // fillColor: "#0099FF", |
||
340 | // fillOpacity: 0.7 |
||
341 | // } |
||
342 | })); |
||
343 | |||
344 | if (mapOpts.autozoom) { |
||
345 | gpxSource.once('change', function () { |
||
346 | extent = ol.extent.extend(extent, gpxSource.getExtent()); |
||
347 | map.getView().fit(extent); |
||
348 | }); |
||
349 | } |
||
350 | } catch (e) { |
||
351 | console.error(e); |
||
352 | } |
||
353 | } |
||
354 | |||
355 | const container = document.getElementById('popup'); |
||
356 | const content = document.getElementById('popup-content'); |
||
357 | const closer = document.getElementById('popup-closer'); |
||
358 | |||
359 | const overlay = new ol.Overlay({ |
||
360 | element: container, autoPan: true, autoPanAnimation: { |
||
361 | duration: 250, |
||
362 | }, //stopEvent: false, |
||
363 | }); |
||
364 | map.addOverlay(overlay); |
||
365 | |||
366 | /** |
||
367 | * Add a click handler to hide the popup. |
||
368 | * @return {boolean} Don't follow the href. |
||
369 | */ |
||
370 | closer.onclick = function () { |
||
371 | overlay.setPosition(undefined); |
||
372 | closer.blur(); |
||
373 | return false; |
||
374 | }; |
||
375 | |||
376 | // display popup on click |
||
377 | View Code Duplication | map.on('singleclick', function (evt) { |
|
378 | const selFeature = map.forEachFeatureAtPixel(evt.pixel, function (feature) { |
||
379 | return feature; |
||
380 | }); |
||
381 | if (selFeature) { |
||
382 | overlay.setPosition(evt.coordinate); |
||
383 | |||
384 | let pContent = '<div class="spacer"> </div>'; |
||
385 | let locDesc = ''; |
||
386 | |||
387 | if (selFeature.get('rowId') !== undefined) { |
||
388 | pContent += '<span class="rowId">' + selFeature.get('rowId') + ': </span>'; |
||
389 | } |
||
390 | if (selFeature.get('name') !== undefined) { |
||
391 | pContent += '<span class="txt">' + selFeature.get('name') + '</span>'; |
||
392 | locDesc = selFeature.get('name'); |
||
393 | // TODO strip <p> tag from locDesc |
||
394 | // locDesc = selFeature.get('name').split(/\s+/).slice(0,2).join('+'); |
||
395 | } |
||
396 | if (selFeature.get('ele') !== undefined) { |
||
397 | pContent += '<div class="ele">elevation: ' + selFeature.get('ele') + '</div>'; |
||
398 | } |
||
399 | if (selFeature.get('type') !== undefined) { |
||
400 | pContent += '<div>' + selFeature.get('type') + '</div>'; |
||
401 | } |
||
402 | if (selFeature.get('time') !== undefined) { |
||
403 | pContent += '<div class="time">time: ' + selFeature.get('time') + '</div>'; |
||
404 | } |
||
405 | if (selFeature.get('description') !== undefined) { |
||
406 | pContent += '<div class="desc">' + selFeature.get('description') + '</div>'; |
||
407 | } |
||
408 | if (selFeature.get('img') !== undefined) { |
||
409 | pContent += '<div class="coord" title="lat;lon">' + |
||
410 | '<img src="' + DOKU_BASE + 'lib/plugins/openlayersmap/icons/' + selFeature.get('img') + |
||
411 | '" width="16" height="16" ' + 'style="transform:rotate(' + selFeature.get('angle') + 'deg)" /> ' + |
||
412 | '<a href="geo:' + selFeature.get('lat') + ',' + selFeature.get('lon') + '?q=' + selFeature.get('lat') + |
||
413 | ',' + selFeature.get('lon') + '(' + selFeature.get('alt') + ')" title="Open in navigation app">' + |
||
414 | ol.coordinate.format([selFeature.get('lon'), selFeature.get('lat')], '{x}º; {y}º', 4) + '</a></div>'; |
||
415 | } |
||
416 | content.innerHTML = pContent; |
||
417 | } else { |
||
418 | // do nothing... |
||
419 | } |
||
420 | }); |
||
421 | |||
422 | // change mouse cursor when over marker |
||
423 | map.on('pointermove', function (e) { |
||
424 | const pixel = map.getEventPixel(e.originalEvent); |
||
425 | const hit = map.hasFeatureAtPixel(pixel); |
||
426 | map.getTarget().style.cursor = hit ? 'pointer' : ''; |
||
427 | }); |
||
428 | |||
429 | return map; |
||
430 | } |
||
431 | |||
432 | |||
433 | /** init. */ |
||
434 | function olInit() { |
||
435 | if (olEnable) { |
||
436 | // add info window to DOM |
||
437 | const frag = document.createDocumentFragment(), |
||
438 | temp = document.createElement('div'); |
||
439 | temp.innerHTML = '<div id="popup" class="olPopup"><a href="#" id="popup-closer" class="olPopupCloseBox"></a><div id="popup-content"></div></div>'; |
||
440 | while (temp.firstChild) { |
||
441 | frag.appendChild(temp.firstChild); |
||
442 | } |
||
443 | const b = document.body.appendChild(frag); |
||
444 | |||
445 | let _i = 0; |
||
446 | // create the maps in the page |
||
447 | View Code Duplication | for (_i = 0; _i < olMapData.length; _i++) { |
|
448 | var _id = olMapData[_i].mapOpts.id; |
||
449 | olMaps[_id] = createMap(olMapData[_i].mapOpts, olMapData[_i].poi); |
||
450 | |||
451 | // set max-width on help pop-over |
||
452 | jQuery('#' + _id).parent().parent().find('.olMapHelp').css('max-width', olMapData[_i].mapOpts.width); |
||
453 | |||
454 | // shrink the map width to fit inside page container |
||
455 | var _w = jQuery('#' + _id + '-olContainer').parent().innerWidth(); |
||
456 | if (parseInt(olMapData[_i].mapOpts.width) > _w) { |
||
457 | jQuery('#' + _id).width(_w); |
||
458 | jQuery('#' + _id + '-olStatusBar').width(_w); |
||
459 | jQuery('#' + _id).parent().parent().find('.olMapHelp').width(_w); |
||
460 | olMaps[_id].updateSize(); |
||
461 | } |
||
462 | } |
||
463 | |||
464 | let resizeTimer; |
||
465 | View Code Duplication | jQuery(window).on('resize', function (e) { |
|
466 | clearTimeout(resizeTimer); |
||
467 | resizeTimer = setTimeout(function () { |
||
468 | for (_i = 0; _i < olMapData.length; _i++) { |
||
469 | var _id = olMapData[_i].mapOpts.id; |
||
470 | var _w = jQuery('#' + _id + '-olContainer').parent().innerWidth(); |
||
471 | if (parseInt(olMapData[_i].mapOpts.width) > _w) { |
||
472 | jQuery('#' + _id).width(_w); |
||
473 | jQuery('#' + _id + '-olStatusBar').width(_w); |
||
474 | jQuery('#' + _id).parent().parent().find('.olMapHelp').width(_w); |
||
475 | olMaps[_id].updateSize(); |
||
476 | } |
||
477 | } |
||
478 | }, 250); |
||
479 | }); |
||
480 | |||
481 | // hide the table(s) with POI by giving it a print-only style |
||
482 | jQuery('.olPOItableSpan').addClass('olPrintOnly'); |
||
483 | // hide the static map image(s) by giving it a print only style |
||
484 | jQuery('.olStaticMap').addClass('olPrintOnly'); |
||
485 | // add help button with toggle. |
||
486 | jQuery('.olWebOnly > .olMap') |
||
487 | .prepend( |
||
488 | '<div class="olMapHelpButtonDiv">' |
||
489 | + '<button onclick="jQuery(\'.olMapHelp\').toggle(500);" class="olMapHelpButton olHasTooltip"><span>' |
||
490 | + 'Show or hide help</span>?</button></div>'); |
||
491 | // toggle to switch dynamic vs. static map |
||
492 | jQuery('.olMapHelp').before( |
||
493 | '<div class="a11y"><button onclick="jQuery(\'.olPrintOnly\').toggle();jQuery(\'.olWebOnly\').toggle();">' |
||
494 | + 'Hide or show the dynamic map</button></div>'); |
||
495 | } |
||
496 | } |
||
497 | |||
498 | |||
499 | /** |
||
500 | * ol api flag. |
||
501 | * |
||
502 | * @type {Boolean} |
||
503 | */ |
||
504 | let olEnable = false; |
||
505 | /** |
||
506 | * An array with data for each map in the page. |
||
507 | * |
||
508 | * @type {Array} |
||
509 | */ |
||
510 | const olMapData = []; |
||
511 | /** |
||
512 | * Holds a reference to all of the maps on this page with the map's id as key. |
||
513 | * Can be used as an extension point. |
||
514 | * |
||
515 | * @type {Object} |
||
516 | */ |
||
517 | let olMaps = {}; |
||
518 | /** |
||
519 | * Stamen tiles flag. |
||
520 | * |
||
521 | * @type {Boolean} |
||
522 | */ |
||
523 | let stamenEnable = false; |
||
524 | |||
525 | /** |
||
526 | * Bing tiles flag. |
||
527 | * |
||
528 | * @type {Boolean} |
||
529 | */ |
||
530 | let bEnable = false; |
||
531 | /** |
||
532 | * Bing API key. |
||
533 | * |
||
534 | * @type {String} |
||
535 | */ |
||
536 | let bApiKey = ''; |
||
537 | |||
538 | /** |
||
539 | * Thunderforest API key. |
||
540 | * |
||
541 | * @type {String} |
||
542 | */ |
||
543 | let tfApiKey = '' |
||
544 | /** |
||
545 | * OSM tiles flag. |
||
546 | * |
||
547 | * @type {Boolean} |
||
548 | */ |
||
549 | let osmEnable = true; |
||
550 | /** |
||
551 | * CSS support flag. |
||
552 | * |
||
553 | * @type {Boolean} |
||
554 | */ |
||
555 | let olCSSEnable = true; |
||
556 | |||
557 | /* register olInit to run with onload event. */ |
||
558 | jQuery(olInit); |
||
559 |