xref: /plugin/openlayersmap/script.js (revision 8a442ab1a002c46ffc63f3f5a9910e281edd55f0)
1/*
2 * Copyright (c) 2008-2013 Mark C. Prins <mprins@users.sf.net>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17/**
18 * @fileoverview Javascript voor OpenLayers plugin.
19 *
20 * @requires {lib/OpenLayers.js} or a full openlayers build
21 * @author Mark C. Prins <mprins@users.sf.net>
22 *
23 */
24
25/**
26 * Openlayers selectcontrol.
27 *
28 * @type {OpenLayers.Control.SelectFeature}
29 * @private
30 */
31var selectControl;
32
33/**
34 * handle feature select event.
35 *
36 * @param {OpenLayers.Feature.Vector}
37 *            feature the selected feature
38 */
39function onFeatureSelect(feature) {
40	var selectedFeature = feature;
41	// 'this' is selectFeature control
42	var pPos = selectedFeature.geometry.getBounds().getCenterLonLat();
43	// != OpenLayers.Geometry.Point
44	if (selectedFeature.geometry.CLASS_NAME === "OpenLayers.Geometry.LineString") {
45		try {
46			// for lines make the popup show at the cursor position
47			pPos = feature.layer.map.getLonLatFromViewPortPx(this.handlers.feature.evt.xy);
48		} catch (anErr) {
49			OpenLayers.Console.warn("unable to get event position; reverting to boundingbox center.");
50			pPos = selectedFeature.geometry.getBounds().getCenterLonLat();
51		}
52	}
53
54	var pContent = '<div class="spacer">&nbsp;</div>';
55	if (feature.data.rowId !== undefined) {
56		pContent += '<span class="rowId">' + feature.data.rowId + ': </span>';
57	}
58	if (feature.data.name !== undefined) {
59		pContent += '<span class="txt">' + feature.data.name + '</span>';
60	}
61	if (feature.data.ele !== undefined) {
62		pContent += '<div class="ele">elevation: ' + feature.data.ele + '</div>';
63	}
64	if (feature.data.type !== undefined) {
65		pContent += '<div>' + feature.data.type + '</div>';
66	}
67	if (feature.data.time !== undefined) {
68		pContent += '<div class="time">time: ' + feature.data.time + '</div>';
69	}
70	if (feature.data.description !== undefined) {
71		pContent += '<div class="desc">' + feature.data.description + '</div>';
72	}
73
74	if (pContent.length > 0) {
75		// only show when there is something to show...
76		var popup = new OpenLayers.Popup.FramedCloud("olPopup", pPos, null, pContent, null, true, function() {
77			selectControl.unselect(selectedFeature);
78		});
79		feature.popup = popup;
80		feature.layer.map.addPopup(popup);
81	}
82}
83
84/**
85 * handle feature unselect event. remove & destroy the popup.
86 *
87 * @param {OpenLayers.Feature.Vector}
88 *            feature the un-selected feature
89 */
90function onFeatureUnselect(feature) {
91	if (feature.popup !== null) {
92		feature.layer.map.removePopup(feature.popup);
93		feature.popup.destroy();
94		feature.popup = null;
95	}
96}
97/**
98 * Test for css support in the browser by sniffing for a css class we added
99 * using javascript added by the action plugin; this is an edge case because
100 * browsers that support javascript generally support css as well.
101 *
102 * @returns {Boolean} true when the browser supports css (and implicitly
103 *          javascript)
104 */
105function olTestCSSsupport() {
106	return (jQuery('.olCSSsupported').length > 0);
107}
108
109/**
110 * Creates a DocumentFragment to insert into the dom.
111 *
112 * @param mapid
113 *            id for the map div
114 * @param width
115 *            width for the map div
116 * @param height
117 *            height for the map div
118 * @returns a {DocumentFragment} element that can be injected into the dom
119 */
120function olCreateMaptag(mapid, width, height) {
121	var mEl = '<div id="' + mapid + '-olContainer" class="olContainer olWebOnly">'
122			+ '<div id="' + mapid + '" tabindex="0" style="width:' + width + ';height:' + height + ';" class="olMap">'
123			+ '<a class="olAccesskey" href="" accesskey="1" onclick="document.getElementById(&quot;' + mapid
124			+ '&quot;).focus(); return false;" title="' + OpenLayers.i18n("activate_map") + '">'
125			+ OpenLayers.i18n("activate_map") + '</a>' + '</div>' + '<div id="' + mapid + '-olStatusBar" style="width:'
126			+ width + ';"class="olStatusBarContainer">' + '<div id="' + mapid
127			+ '-statusbar-scale" class="olStatusBar olStatusBarScale">scale</div>'
128			// + '<div id="' + mapid + '-statusbar-link" class="olStatusBar
129			// olStatusBarPermalink">' + '<a href="" id="' + mapid +
130			// '-statusbar-link-ref">link</a></div>'
131			+ '<div id="' + mapid + '-statusbar-mouseposition" class="olStatusBar olStatusBarMouseposition"></div>'
132			+ '<div id="' + mapid + '-statusbar-projection" class="olStatusBar olStatusBarProjection">proj</div>'
133			+ '<div id="' + mapid + '-statusbar-text" class="olStatusBar olStatusBarText">txt</div>' + '</div></div>',
134	// fragment
135	frag = document.createDocumentFragment(),
136	// temp node
137	temp = document.createElement('div');
138	temp.innerHTML = mEl;
139	while (temp.firstChild) {
140		frag.appendChild(temp.firstChild);
141	}
142	return frag;
143}
144
145/**
146 * Create the map based on the params given.
147 *
148 * @param {Object}
149 *            mapOpts MapOptions hash {id:'olmap', width:500px, height:500px,
150 *            lat:6710200, lon:506500, zoom:13, statusbar:1,
151 *            controls:1, poihoverstyle:1, baselyr:'', kmlfile:'', gpxfile:'',
152 *            geojsonfile, summary:''}
153 * @param {Array}
154 *            OLmapPOI array with POI's [ {lat:6710300,lon:506000,txt:'instap
155 *            punt',angle:180,opacity:.9,img:'', rowId:n},... ]);
156 *
157 * @return {OpenLayers.Map} the created map
158 */
159function createMap(mapOpts, OLmapPOI) {
160	if (!olEnable) {
161		return;
162	}
163	if (!olTestCSSsupport()) {
164		olEnable = false;
165		return;
166	}
167
168	var DocBase = DOKU_BASE;
169
170	OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
171	// OpenLayers.Layer.Vector.prototype.renderers = ["SVG", "VML"];
172
173	// find map element location
174	var cleartag = document.getElementById(mapOpts.id + '-clearer');
175	if (cleartag === null) {
176		return;
177	}
178	// create map element and add to document
179	var fragment = olCreateMaptag(mapOpts.id, mapOpts.width, mapOpts.height);
180	cleartag.parentNode.insertBefore(fragment, cleartag);
181
182	/** dynamic map extent. */
183	var extent = new OpenLayers.Bounds(),
184
185	/** map. */
186	m = new OpenLayers.Map({
187		div : mapOpts.id,
188		projection : 'EPSG:900913',
189		displayProjection : new OpenLayers.Projection("EPSG:4326"),
190		numZoomLevels : 22,
191		controls : [],
192		theme : null
193	});
194
195	if (osmEnable) {
196		/* add OSM map layers */
197		m.addLayer(new OpenLayers.Layer.OSM());
198
199		m.addLayer(new OpenLayersMap.Layer.OCM());
200		/* open cycle map */
201		m.addLayer(new OpenLayersMap.Layer.OCM("transport", [
202				"http://a.tile2.opencyclemap.org/transport/${z}/${x}/${y}.png",
203				"http://b.tile2.opencyclemap.org/transport/${z}/${x}/${y}.png",
204				"http://c.tile2.opencyclemap.org/transport/${z}/${x}/${y}.png" ], {
205			visibility : mapOpts.baselyr === "transport"
206		}));
207		m.addLayer(new OpenLayersMap.Layer.OCM("landscape", [
208				"http://a.tile3.opencyclemap.org/landscape/${z}/${x}/${y}.png",
209				"http://b.tile3.opencyclemap.org/landscape/${z}/${x}/${y}.png",
210				"http://c.tile3.opencyclemap.org/landscape/${z}/${x}/${y}.png" ], {
211			visibility : mapOpts.baselyr === "landscape"
212		}));
213
214		m.addLayer(new OpenLayersMap.Layer.CloudMade());
215		m.addLayer(new OpenLayersMap.Layer.CloudMade("cloudmade fresh", [
216				"http://a.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/${z}/${x}/${y}.png",
217				"http://b.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/${z}/${x}/${y}.png",
218				"http://c.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/${z}/${x}/${y}.png" ], {
219			visibility : mapOpts.baselyr === "cloudmade fresh"
220		}));
221
222		m.addLayer(new OpenLayers.Layer.OSM(
223				"hike and bike map", "http://toolserver.org/tiles/hikebike/${z}/${x}/${y}.png", {
224					visibility : mapOpts.baselyr === "hike and bike map",
225					tileOptions : {
226						crossOriginKeyword : null
227					}
228				}));
229	}
230	/*
231	 * add MapQuest map layers, see:
232	 * http://developer.mapquest.com/web/products/open/map
233	 */
234	if (mqEnable) {
235		m.addLayer(new OpenLayersMap.Layer.MapQuest());
236		m.addLayer(new OpenLayersMap.Layer.MapQuest("mapquest sat", [
237				"http://otile1.mqcdn.com/tiles/1.0.0/sat/${z}/${x}/${y}.jpg",
238				"http://otile2.mqcdn.com/tiles/1.0.0/sat/${z}/${x}/${y}.jpg",
239				"http://otile3.mqcdn.com/tiles/1.0.0/sat/${z}/${x}/${y}.jpg",
240				"http://otile4.mqcdn.com/tiles/1.0.0/sat/${z}/${x}/${y}.jpg" ], {
241			// note that global coverage is provided at zoom levels 0-11. Zoom
242			// Levels 12+ are provided only in the United States (lower 48).
243			numZoomLevels : 12,
244			visibility : mapOpts.baselyr === "mapquest sat"
245		}));
246
247	}
248
249	if (gEnable) {
250		/* load google maps */
251		try {
252			m.addLayer(new OpenLayers.Layer.Google("google relief", {
253				type : google.maps.MapTypeId.TERRAIN,
254				numZoomLevels : 16,
255				animationEnabled : true,
256				visibility : mapOpts.baselyr === "google relief"
257			}));
258			m.addLayer(new OpenLayers.Layer.Google("google sat", {
259				type : google.maps.MapTypeId.SATELLITE,
260				animationEnabled : true,
261				visibility : mapOpts.baselyr === "google sat"
262			}));
263			m.addLayer(new OpenLayers.Layer.Google("google hybrid", {
264				type : google.maps.MapTypeId.HYBRID,
265				animationEnabled : true,
266				visibility : mapOpts.baselyr === "google hybrid"
267			}));
268			m.addLayer(new OpenLayers.Layer.Google("google road", {
269				animationEnabled : true,
270				visibility : mapOpts.baselyr === "google road"
271			}));
272		} catch (ol_err1) {
273			Openlayers.Console.userError('Error loading Google maps' + ol_err1);
274		}
275	}
276
277	if (bEnable && bApiKey !== '') {
278		try {
279			/* add Bing tiles */
280			m.addLayer(new OpenLayers.Layer.Bing({
281				key : bApiKey,
282				type : "Road",
283				name : "bing road",
284				visibility : mapOpts.baselyr === "bing road",
285				wrapDateLine : true,
286				attributionTemplate : '<a target="_blank" href="http://www.bing.com/maps/">'
287						+ 'Bing™</a><img src="http://www.bing.com/favicon.ico" alt="Bing logo"/> ${copyrights}'
288						+ '<a target="_blank" href="http://www.microsoft.com/maps/product/terms.html">Terms of Use</a>'
289			}));
290			m.addLayer(new OpenLayers.Layer.Bing({
291				key : bApiKey,
292				type : "Aerial",
293				name : "bing sat",
294				visibility : mapOpts.baselyr === "bing sat",
295				wrapDateLine : true,
296				attributionTemplate : '<a target="_blank" href="http://www.bing.com/maps/">'
297						+ 'Bing™</a><img src="http://www.bing.com/favicon.ico" alt="Bing logo"/> ${copyrights}'
298						+ '<a target="_blank" href="http://www.microsoft.com/maps/product/terms.html">Terms of Use</a>'
299			}));
300			m.addLayer(new OpenLayers.Layer.Bing({
301				key : bApiKey,
302				type : "AerialWithLabels",
303				name : "bing hybrid",
304				visibility : mapOpts.baselyr === "bing hybrid",
305				wrapDateLine : true,
306				attributionTemplate : '<a target="_blank" href="http://www.bing.com/maps/">'
307						+ 'Bing™</a><img src="http://www.bing.com/favicon.ico" alt="Bing logo"/> ${copyrights}'
308						+ '<a target="_blank" href="http://www.microsoft.com/maps/product/terms.html">Terms of Use</a>'
309			}));
310		} catch (ol_errBing) {
311			Openlayers.Console.userError('Error loading Bing maps: ' + ol_errBing);
312		}
313	}
314
315	m.setCenter(new OpenLayers.LonLat(mapOpts.lon, mapOpts.lat).transform(m.displayProjection, m.projection),
316			mapOpts.zoom);
317	extent.extend(m.getExtent());
318
319	// change/set alternative baselyr
320	try {
321		m.setBaseLayer(((m.getLayersByName(mapOpts.baselyr))[0]));
322	} catch (ol_err4) {
323		m.setBaseLayer(m.layers[0]);
324	}
325
326	m.addControls([ new OpenLayers.Control.ScaleLine({
327		geodesic : true
328	}), new OpenLayers.Control.KeyboardDefaults({
329		observeElement : mapOpts.id
330	}), new OpenLayers.Control.Navigation() ]);
331
332	if (mapOpts.controls === 1) {
333		/* add base controls to map */
334		m.addControls([ new OpenLayers.Control.LayerSwitcher(), new OpenLayers.Control.Graticule({
335			visible : false
336		}), new OpenLayersMap.Control.OverviewMap(), new OpenLayersMap.Control.Zoom() ]);
337
338		// add hillshade, since this is off by default only add when we have a
339		// layerswitcher
340		m.addLayer(new OpenLayers.Layer.OSM("Hillshade", "http://toolserver.org/~cmarqu/hill/${z}/${x}/${y}.png", {
341			isBaseLayer : false,
342			transparent : true,
343			visibility : false,
344			displayOutsideMaxExtent : true,
345			attribution : '',
346			tileOptions : {
347				crossOriginKeyword : null
348			}
349		}));
350	}
351
352	if (mapOpts.statusbar === 1) {
353		// statusbar control: permalink
354		// m.addControl(new OpenLayers.Control.Permalink(mapOpts.id +
355		// '-statusbar-link-ref'));
356
357		// statusbar control: mouse pos.
358		m.addControl(new OpenLayers.Control.MousePosition({
359			'div' : OpenLayers.Util.getElement(mapOpts.id + '-statusbar-mouseposition')
360		}));
361		// statusbar control: scale
362		m.addControl(new OpenLayers.Control.Scale(mapOpts.id + '-statusbar-scale'));
363		// statusbar control: attribution
364		m.addControl(new OpenLayers.Control.Attribution({
365			'div' : OpenLayers.Util.getElement(mapOpts.id + '-statusbar-text')
366		}));
367		// statusbar control: projection
368		OpenLayers.Util.getElement(mapOpts.id + '-statusbar-projection').innerHTML = m.displayProjection;
369	} else {
370		OpenLayers.Util.getElement(mapOpts.id + '-olStatusBar').display = 'none';
371	}
372
373	if (OLmapPOI.length > 0) {
374		var markers = new OpenLayers.Layer.Vector("POI", {
375			styleMap : new OpenLayers.StyleMap({
376				"default" : {
377					externalGraphic : "${img}",
378					graphicHeight : 16,
379					graphicWidth : 16,
380					graphicXOffset : 0,
381					graphicYOffset : -8,
382					graphicOpacity : "${opacity}",
383					rotation : "${angle}",
384					backgroundGraphic : DocBase + "lib/plugins/openlayersmap/icons/marker_shadow.png",
385					backgroundXOffset : 0,
386					backgroundYOffset : -4,
387					backgroundRotation : "${angle}",
388					pointRadius : 10,
389					labelXOffset : 8,
390					labelYOffset : 8,
391					labelAlign : "lb",
392					label : "${label}",
393					// fontColor : "",
394					fontFamily : "monospace",
395					fontSize : "12px",
396					fontWeight : "bold"
397				},
398				"select" : {
399					cursor : "crosshair",
400					externalGraphic : DocBase + "lib/plugins/openlayersmap/icons/marker-red.png",
401					graphicHeight : 16,
402					graphicWidth : 16,
403					graphicXOffset : 0,
404					graphicYOffset : -8,
405					graphicOpacity : 1.0,
406					rotation : "${angle}"
407				}
408			}),
409			isBaseLayer : false,
410			rendererOptions : {
411				yOrdering : true
412			}
413		});
414		m.addLayer(markers);
415		var features = [];
416		for ( var j = 0; j < OLmapPOI.length; j++) {
417			var feat = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(OLmapPOI[j].lon, OLmapPOI[j].lat)
418					.transform(m.displayProjection, m.projection), {
419				angle : OLmapPOI[j].angle,
420				opacity : OLmapPOI[j].opacity,
421				img : DocBase + "lib/plugins/openlayersmap/icons/" + OLmapPOI[j].img,
422				label : OLmapPOI[j].rowId
423			});
424			feat.data = {
425				name : OLmapPOI[j].txt,
426				rowId : OLmapPOI[j].rowId
427			};
428			features.push(feat);
429		}
430		markers.addFeatures(features);
431		extent.extend(markers.getDataExtent());
432		m.zoomToExtent(extent);
433	}
434
435	/* GPX layer */
436	if (mapOpts.gpxfile.length > 0) {
437		var layerGPX = new OpenLayers.Layer.Vector("GPS route", {
438			protocol : new OpenLayers.Protocol.HTTP({
439				url : DocBase + "lib/exe/fetch.php?media=" + mapOpts.gpxfile,
440				format : new OpenLayers.Format.GPX({
441					extractWaypoints : true,
442					extractTracks : true,
443					extractStyles : true,
444					extractAttributes : true,
445					handleHeight : true,
446					maxDepth : 3
447				})
448			}),
449			style : {
450				strokeColor : "#0000FF",
451				strokeWidth : 3,
452				strokeOpacity : 0.7,
453				pointRadius : 4,
454				fillColor : "#0099FF",
455				fillOpacity : 0.7
456			// , label:"${name}"
457			},
458			projection : new OpenLayers.Projection("EPSG:4326"),
459			strategies : [ new OpenLayers.Strategy.Fixed() ]
460		});
461		m.addLayer(layerGPX);
462		layerGPX.events.register('loadend', m, function() {
463			extent.extend(layerGPX.getDataExtent());
464			m.zoomToExtent(extent);
465		});
466	}
467
468	/* GeoJSON layer */
469	if (mapOpts.geojsonfile.length > 0) {
470		var layerGJS = new OpenLayers.Layer.Vector("json data", {
471			protocol : new OpenLayers.Protocol.HTTP({
472				url : DocBase + "lib/exe/fetch.php?media=" + mapOpts.geojsonfile,
473				format : new OpenLayers.Format.GeoJSON({
474					ignoreExtraDims : true
475				})
476			}),
477			style : {
478				strokeColor : "#FF00FF",
479				strokeWidth : 3,
480				strokeOpacity : 0.7,
481				pointRadius : 4,
482				fillColor : "#FF99FF",
483				fillOpacity : 0.7
484			// , label:"${name}"
485			},
486			projection : new OpenLayers.Projection("EPSG:4326"),
487			strategies : [ new OpenLayers.Strategy.Fixed() ]
488		});
489		m.addLayer(layerGJS);
490		layerGJS.events.register('loadend', m, function() {
491			extent.extend(layerGJS.getDataExtent());
492			m.zoomToExtent(extent);
493		});
494	}
495
496	/* KML layer */
497	if (mapOpts.kmlfile.length > 0) {
498		var layerKML = new OpenLayers.Layer.Vector("KML file", {
499			protocol : new OpenLayers.Protocol.HTTP({
500				url : DocBase + "lib/exe/fetch.php?media=" + mapOpts.kmlfile,
501				format : new OpenLayers.Format.KML({
502					extractStyles : true,
503					extractAttributes : true,
504					maxDepth : 3
505				})
506			}),
507			style : {
508				label : "${name}"
509			},
510			projection : new OpenLayers.Projection("EPSG:4326"),
511			strategies : [ new OpenLayers.Strategy.Fixed() ]
512		});
513		m.addLayer(layerKML);
514		layerKML.events.register('loadend', m, function() {
515			extent.extend(layerKML.getDataExtent());
516			m.zoomToExtent(extent);
517		});
518	}
519
520	// selectcontrol for layers
521	if ((m.getLayersByClass('OpenLayers.Layer.GML').length > 0)
522			|| m.getLayersByClass('OpenLayers.Layer.Vector').length > 0) {
523		selectControl = new OpenLayers.Control.SelectFeature((m.getLayersByClass('OpenLayers.Layer.Vector')).concat(m
524				.getLayersByClass('OpenLayers.Layer.GML')), {
525			hover : mapOpts.poihoverstyle,
526			onSelect : onFeatureSelect,
527			onUnselect : onFeatureUnselect
528		});
529		m.addControl(selectControl);
530		selectControl.activate();
531	}
532	return m;
533}
534
535// var olTimerId = -1;
536
537/** init. */
538function olInit() {
539	// TODO: check is this is still needed now that we have jQuery
540	// if (navigator.userAgent.indexOf('MSIE') !== -1) {
541	// if (olTimerId === -1) {
542	// olTimerId = setTimeout("olInit()", 3000);
543	// olEnable = false;
544	// } else {
545	// clearTimeout(olTimerId);
546	// olEnable = true;
547	// }
548	// }
549
550	if (olEnable) {
551		var _i = 0;
552		// create the maps in the page
553		for (_i = 0; _i < olMapData.length; _i++) {
554			olMaps[olMapData[_i].mapOpts.id] = createMap(olMapData[_i].mapOpts, olMapData[_i].poi);
555		}
556		// hide the table(s) with POI by giving it a print-only style
557		var tbls = jQuery('.olPOItableSpan');
558		for (_i = 0; _i < tbls.length; _i++) {
559			tbls[_i].className += ' olPrintOnly';
560		}
561		// hide the static map image(s) by giving it a print only style
562		var statImgs = jQuery('.olStaticMap');
563		for (_i = 0; _i < statImgs.length; _i++) {
564			statImgs[_i].className += ' olPrintOnly';
565		}
566	}
567}
568
569/**
570 * ol api flag.
571 *
572 * @type {Boolean}
573 */
574var olEnable = false,
575/**
576 * An array with data for each map in the page.
577 *
578 * @type {Array}
579 */
580olMapData = [],
581/**
582 * Holds a reference to all of the maps on this page with the map's id as key.
583 * Can be used as an extension point.
584 *
585 * @type {Object}
586 */
587olMaps = new Object(),
588/**
589 * MapQuest tiles flag.
590 *
591 * @type {Boolean}
592 */
593mqEnable = false,
594/**
595 * google map api flag.
596 *
597 * @type {Boolean}
598 */
599gEnable = false,
600/**
601 * Bing tiles flag.
602 *
603 * @type {Boolean}
604 */
605bEnable = false,
606/**
607 * Bing API key.
608 *
609 * @type {String}
610 */
611bApiKey = '',
612/**
613 * OSM tiles flag.
614 *
615 * @type {Boolean}
616 */
617osmEnable = true,
618/**
619 * CSS support flag.
620 *
621 * @type {Boolean}
622 */
623olCSSEnable = true;
624/**
625 * yahoo map api flag.
626 *
627 * @type {Boolean}
628 */
629// yEnable = false;
630/* register olInit to run with onload event. */
631jQuery(olInit);
632