1/* 2 * Copyright (c) 2008-2011 Mark C. Prins <mc.prins@gmail.com> 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 other full openlayers build 21 * @author Mark C. Prins <mc.prins@gmail.com> 22 * 23 */ 24 25/** 26 * Openlayers selectcontrol. 27 * 28 * @type {OpenLayers.Control.SelectFeature} 29 * @private 30 */ 31var selectControl, 32/** 33 * Openlayers bounds used for managing the map extent. 34 * 35 * @type {OpenLayers.Bounds} 36 * @private 37 */ 38extent; 39 40/** 41 * handle feature select event. 42 * 43 * @param {OpenLayers.Feature.Vector} 44 * the selected feature 45 */ 46function onFeatureSelect(feature) { 47 var selectedFeature = feature; 48 // 'this' is selectFeature control 49 var pPos = selectedFeature.geometry.getBounds().getCenterLonLat(); 50 // != OpenLayers.Geometry.Point 51 if (selectedFeature.geometry.CLASS_NAME === "OpenLayers.Geometry.LineString") { 52 try { 53 // for lines make the popup show at the cursor position 54 pPos = feature.layer.map 55 .getLonLatFromViewPortPx(this.handlers.feature.evt.xy); 56 } catch (anErr) { 57 OpenLayers.Console 58 .warn("unable to get event position; reverting to boundingbox center."); 59 pPos = selectedFeature.geometry.getBounds().getCenterLonLat(); 60 } 61 } 62 63 var pContent = ""; 64 if (feature.data.rowId !== undefined) { 65 pContent += "<div style=''>" + feature.data.rowId + ": </div>"; 66 } 67 if (feature.data.name !== undefined) { 68 pContent += "<div style=''>" + feature.data.name + "</div>"; 69 } 70 if (feature.data.ele !== undefined) { 71 pContent += "<div style=''>elevation: " + feature.data.ele + "</div>"; 72 } 73 if (feature.data.type !== undefined) { 74 pContent += "<div style=''>" + feature.data.type + "></div>"; 75 } 76 if (feature.data.time !== undefined) { 77 pContent += "<div style=''>time: " + feature.data.time + "</div>"; 78 } 79 if (feature.data.description !== undefined) { 80 pContent += "<div style=''>" + feature.data.description + "</div>"; 81 } 82 83 if (pContent.length > 0) { 84 // only show when there is something to show... 85 var popup = new OpenLayers.Popup.FramedCloud("olPopup", pPos, null, 86 pContent, null, true, function() { 87 selectControl.unselect(selectedFeature); 88 }); 89 feature.popup = popup; 90 feature.layer.map.addPopup(popup); 91 } 92} 93 94/** 95 * handle feature unselect event. remove & destroy the popup. 96 * 97 * @param {OpenLayers.Feature.Vector} 98 * the un-selected feature 99 */ 100function onFeatureUnselect(feature) { 101 if (feature.popup !== null) { 102 feature.layer.map.removePopup(feature.popup); 103 feature.popup.destroy(); 104 feature.popup = null; 105 } 106} 107 108/** init. */ 109function olInit() { 110 var _i = 0; 111 // hide the table(s) with POI by giving it a print only style 112 var tbls = getElementsByClass('olPOItableSpan', null, null); 113 for (_i = 0; _i < tbls.length; _i++) { 114 // tbls[i].style.display = 'none'; 115 tbls[_i].className += ' olPrintOnly'; 116 } 117 // hide the static map image(s) by giving it a print only style 118 var statImgs = getElementsByClass('olStaticMap', null, null); 119 for (_i = 0; _i < statImgs.length; _i++) { 120 // statImgs[i].style.display = 'none'; 121 statImgs[_i].className += ' olPrintOnly'; 122 } 123} 124 125/** 126 * creates a DocumentFragment to insert into the dom. 127 * 128 * @param mapid 129 * id for the map div 130 * @param width 131 * width for the map div 132 * @param height 133 * height for the map div 134 * @returns a {DocumentFragment} element that can be injected into the dom 135 */ 136function olCreateMaptag(mapid, width, height) { 137 var mEl = '<div id="' 138 + mapid 139 + '-olContainer" class="olContainer olWebOnly">' 140 + '<div id="' 141 + mapid 142 + '-olToolbar" class="olToolbar"></div>' 143 + '<div class="clearer"></div>' 144 + '<div id="' 145 + mapid 146 + '" style="width:' 147 + width 148 + ';height:' 149 + height 150 + ';" class="olMap"></div>' 151 + '<div id="' 152 + mapid 153 + '-olStatusBar" class="olStatusBarContainer">' 154 + '<div id="' 155 + mapid 156 + '-statusbar-scale" class="olStatusBar olStatusBarScale">scale</div>' 157 + '<div id="' 158 + mapid 159 + '-statusbar-link" class="olStatusBar olStatusBarPermalink"><a href="" id="' 160 + mapid 161 + '-statusbar-link-ref">map link</a></div>' 162 + '<div id="' 163 + mapid 164 + '-statusbar-mouseposition" class="olStatusBar olStatusBarMouseposition"></div>' 165 + '<div id="' 166 + mapid 167 + '-statusbar-projection" class="olStatusBar olStatusBarProjection">proj</div>' 168 + '<div id="' + mapid 169 + '-statusbar-text" class="olStatusBar olStatusBarText">txt</div>' 170 + '</div>\n</div>', 171 // fragment 172 frag = document.createDocumentFragment(), 173 // temp node 174 temp = document.createElement('div'); 175 temp.innerHTML = mEl; 176 while (temp.firstChild) { 177 frag.appendChild(temp.firstChild); 178 } 179 return frag; 180} 181 182/** 183 * create the map based on the params given. 184 * 185 * @param {Object}mapOpts 186 * MapOptions hash {id:'olmap', width:500px, height:500px, 187 * lat:6710200, lon:506500, zoom:13, toolbar:1, statusbar:1, 188 * controls:1, poihoverstyle:1, baselyr:'', kmlfile:'', gpxfile:'', 189 * summary:''} 190 * @param {Array}OLmapPOI 191 * array with POI's [ {lat:6710300,lon:506000,txt:'instap 192 * punt',angle:180,opacity:.9,img:'', rowId:n},... ]); 193 * 194 */ 195function createMap(mapOpts, OLmapPOI) { 196 if (!olEnable) { 197 return; 198 } 199 var DocBase = DOKU_BASE; 200 201 OpenLayers.IMAGE_RELOAD_ATTEMPTS = 4; 202 OpenLayers.Util.onImageLoadErrorColor = 'pink'; 203 OpenLayers.Util.onImageLoadError = function() { 204 /* transparent gif */ 205 // IE 8 complains w/ stack overflow... this.src = 206 // "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="; 207 this.src = DocBase + "lib/plugins/openlayersmap/lib/img/blank.gif"; 208 }; 209 210 // OpenLayers.Layer.Vector.prototype.renderers = ["SVG2", "VML", "Canvas"]; 211 212 // find map element location 213 var cleartag = document.getElementById(mapOpts.id + '-clearer'); 214 if (cleartag === null) { 215 return; 216 } 217 // create map element and add to document 218 var fragment = olCreateMaptag(mapOpts.id, mapOpts.width, mapOpts.height); 219 cleartag.parentNode.insertBefore(fragment, cleartag); 220 221 /** dynamic map extent. */ 222 var extent = new OpenLayers.Bounds(), 223 224 /** map. */ 225 m = new OpenLayers.Map(mapOpts.id, { 226 projection : new OpenLayers.Projection('EPSG:900913'), 227 displayProjection : new OpenLayers.Projection('EPSG:4326'), 228 units : 'm', 229 maxResolution : 156543.0339, 230 maxExtent : new OpenLayers.Bounds(-20037508.34, -20037508.34, 231 20037508.34, 20037508.34), 232 numZoomLevels : 19, 233 // panDuration : 100, 234 controls : [ /* new OpenLayers.Control.LoadingPanel(), */ 235 new OpenLayers.Control.KeyboardDefaults(), 236 new OpenLayers.Control.Navigation({ 237 dragPanOptions : { 238 enableKinetic : true 239 } 240 }), new OpenLayers.Control.ScaleLine({ 241 geodesic : true 242 }) ], 243 theme : null 244 }); 245 if (osmEnable) { 246 /* add OSM map layers */ 247 m.addLayer(new OpenLayers.Layer.OSM("OpenStreetMap"), { 248 transitionEffect : 'resize', 249 visibility : false 250 }); 251 252 m 253 .addLayer( 254 new OpenLayers.Layer.OSM( 255 "t@h", 256 [ 257 "http://a.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png", 258 "http://b.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png", 259 "http://c.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png" ]), 260 { 261 transitionEffect : 'resize', 262 visibility : false 263 }); 264 265 m 266 .addLayer( 267 new OpenLayers.Layer.OSM( 268 "cycle map", 269 [ 270 // "http://andy.sandbox.cloudmade.com/tiles/cycle/${z}/${x}/${y}.png", 271 "http://a.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png", 272 "http://b.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png", 273 "http://c.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png" ]), 274 { 275 transitionEffect : 'resize', 276 attribution : 'Data CC-By-SA <a href="http://openstreetmap.org/" target="_blank">OpenStreetMap</a>, ' 277 + 'Tiles <a href="http://opencyclemap.org/" target="_blank">OpenCycleMap</a>' 278 + '<img src="http://opencyclemap.org/favicon.ico" heigth="16" width="16"/>', 279 visibility : false 280 }); 281 282 m 283 .addLayer(new OpenLayers.Layer.OSM( 284 "cloudmade map", 285 "http://tile.cloudmade.com/2f59745a6b525b4ebdb100891d5b6711/3/256/${z}/${x}/${y}.png", 286 { 287 transitionEffect : 'resize', 288 visibility : false 289 })); 290 291 m.addLayer(new OpenLayers.Layer.OSM("hike and bike map", 292 "http://toolserver.org/tiles/hikebike/${z}/${x}/${y}.png", { 293 transitionEffect : 'resize', 294 visibility : false 295 })); 296 } 297 /* 298 * add MapQuest map layers, see: 299 * http://developer.mapquest.com/web/products/open/map 300 */ 301 if (mqEnable) { 302 m 303 .addLayer(new OpenLayers.Layer.OSM( 304 "mapquest road", 305 [ 306 "http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png", 307 "http://otile2.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png", 308 "http://otile3.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png", 309 "http://otile4.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png" ], 310 { 311 transitionEffect : 'resize', 312 attribution : 'Data CC-By-SA <a href="http://openstreetmap.org/" target="_blank">OpenStreetMap</a>, ' 313 + 'Tiles <a href="http://www.mapquest.com/" target="_blank">MapQuest</a>' 314 + '<img src="http://developer.mapquest.com/content/osm/mq_logo.png" heigth="14" width="14" alt="logo"/>', 315 visibility : false 316 })); 317 // note that global coverage is provided at zoom levels 0-11. Zoom 318 // Levels 12+ are provided only in the United States (lower 48). 319 m 320 .addLayer(new OpenLayers.Layer.OSM( 321 "mapquest aerial", 322 [ 323 "http://oatile1.mqcdn.com/naip/${z}/${x}/${y}.jpg", 324 "http://oatile2.mqcdn.com/naip/${z}/${x}/${y}.jpg", 325 "http://oatile3.mqcdn.com/naip/${z}/${x}/${y}.jpg", 326 "http://oatile4.mqcdn.com/naip/${z}/${x}/${y}.jpg" ], 327 { 328 transitionEffect : 'resize', 329 attribution : 'Tiles Courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a>' 330 + '<img src="http://developer.mapquest.com/content/osm/mq_logo.png" heigth="16" width="16">', 331 visibility : false, 332 numZoomLevels : 12 333 })); 334 } 335 336 /* open aerial map layers */ 337 /* 338 * turn this off; project is asleep: 339 * https://sourceforge.net/tracker/?func=detail&aid=2897327&group_id=239475&atid=1110186 340 * m.addLayer(new OpenLayers.Layer.XYZ("OpenAerialMap", 341 * "http://tile.openaerialmap.org/tiles/1.0.0/openaerialmap-900913/${z}/${x}/${y}.jpg", 342 * {name: "OpenStreetMap", attribution: "Data CC-By by <a 343 * href='http://www.openaerialmap.org/licensing/'>OpenAerialMap</a>", 344 * sphericalMercator: true, transitionEffect: 'resize'} )); 345 */ 346 347 /* controle of google/yahoo/ve api's beschikbaar zijn.. */ 348 if (gEnable) { 349 try { 350 m.addLayer(new OpenLayers.Layer.Google("google relief", { 351 type : google.maps.MapTypeId.TERRAIN, 352 // transitionEffect : 'resize', 353 numZoomLevels : 16, 354 animationEnabled : true, 355 visibility : false 356 })); 357 m.addLayer(new OpenLayers.Layer.Google("google sat", { 358 type : google.maps.MapTypeId.SATELLITE, 359 // transitionEffect : 'resize', 360 // numZoomLevels : 22, 361 animationEnabled : true, 362 visibility : false 363 })); 364 m.addLayer(new OpenLayers.Layer.Google("google hybrid", { 365 type : google.maps.MapTypeId.HYBRID, 366 // transitionEffect : 'resize', 367 // numZoomLevels : 20, 368 animationEnabled : true, 369 visibility : false 370 })); 371 m.addLayer(new OpenLayers.Layer.Google("google normal", { 372 // transitionEffect : 'resize', 373 // numZoomLevels : 20, 374 animationEnabled : true, 375 visibility : false 376 })); 377 } catch (ol_err1) { 378 Openlayers.Console.userError('Error loading Google maps' + ol_err1); 379 } 380 } 381 382 // if (yEnable) { 383 // try { 384 // m.addLayer(new OpenLayers.Layer.Yahoo("yahoo", { 385 // 'type' : YAHOO_MAP_HYB, 386 // 'sphericalMercator' : true, 387 // transitionEffect : resize 388 // })); 389 // } catch (ol_err2) { 390 // } 391 // } 392 393 if (veEnable) { 394 try { 395 m.addLayer(new OpenLayers.Layer.VirtualEarth("ve", { 396 type : VEMapStyle.Hybrid, 397 sphericalMercator : true, 398 transitionEffect : 'resize', 399 visibility : false 400 })); 401 } catch (ol_err3) { 402 } 403 } 404 m.setCenter(new OpenLayers.LonLat(mapOpts.lon, mapOpts.lat).transform( 405 m.displayProjection, m.projection), mapOpts.zoom); 406 extent.extend(m.getExtent()); 407 408 // change/set alternative baselyr 409 try { 410 m.setBaseLayer(((m.getLayersByName(mapOpts.baselyr))[0])); 411 } catch (ol_err4) { 412 m.setBaseLayer(m.layers[0]); 413 } 414 415 if (mapOpts.controls === 1) { 416 /* add base controls to map */ 417 m.addControl(new OpenLayers.Control.LayerSwitcher({ 418 roundedCorner : false, 419 roundedCornerColor : null 420 })); 421 m.addControl(new OpenLayers.Control.PanZoomBar()); 422 m.addControl(new OpenLayers.Control.Graticule({ 423 visible : false 424 })); 425 426 // add hillshade, since this is off by default only add when we have a 427 // layerswitcher 428 m.addLayer(new OpenLayers.Layer.OSM("Hillshade", 429 "http://toolserver.org/~cmarqu/hill/${z}/${x}/${y}.png", { 430 transitionEffect : 'resize', 431 isBaseLayer : false, 432 transparent : true, 433 visibility : false, 434 displayOutsideMaxExtent : true, 435 attribution : '' 436 })); 437 438 m.addControl(new OpenLayers.Control.OverviewMap({ 439 size : new OpenLayers.Size(140, 140), 440 mapOptions : { 441 theme : null 442 }, 443 layers : [ m.baseLayer.clone() ], 444 minRectSize : 10 445 })); 446 } 447 448 if (mapOpts.statusbar === 1) { 449 // statusbar control: permalink 450 m.addControl(new OpenLayers.Control.Permalink(mapOpts.id 451 + '-statusbar-link-ref')); 452 // statusbar control: mouse pos. 453 // TODO kijken naar afronding met aNumber.toFixed(0) 454 m.addControl(new OpenLayers.Control.MousePosition({ 455 'div' : OpenLayers.Util.getElement(mapOpts.id 456 + '-statusbar-mouseposition') 457 })); 458 // statusbar control: scale 459 m.addControl(new OpenLayers.Control.Scale(mapOpts.id 460 + '-statusbar-scale')); 461 // statusbar control: attribution 462 m.addControl(new OpenLayers.Control.Attribution({ 463 'div' : OpenLayers.Util.getElement(mapOpts.id + '-statusbar-text') 464 })); 465 // statusbar control: projection 466 OpenLayers.Util.getElement(mapOpts.id + '-statusbar-projection').innerHTML = m.displayProjection; 467 } else { 468 OpenLayers.Util.getElement(mapOpts.id + '-olStatusBar').display = 'none'; 469 } 470 471 if (mapOpts.toolbar === 1) { 472 // add buttons + panel 473 var zoomin = new OpenLayers.Control.ZoomBox({ 474 title : "Zoom in" 475 }), /**/zoomout = new OpenLayers.Control.ZoomBox({ 476 out : true, 477 title : "Zoom uit", 478 displayClass : "olControlZoomOut" 479 }), /**/pan = new OpenLayers.Control.DragPan({ 480 title : "Verschuif" 481 }), /* do "nothing" button... */info = new OpenLayers.Control.Button({ 482 type : OpenLayers.Control.TYPE_TOOL, 483 displayClass : "olControlFeatureInfo" 484 /* , trigger : selectControl.activate() */ 485 }), /* navigation history */ 486 nav = new OpenLayers.Control.NavigationHistory(); 487 m.addControl(nav); 488 var panel = new OpenLayers.Control.Panel({ 489 defaultControl : pan, 490 displayClass : "olToolbar", 491 "div" : OpenLayers.Util.getElement(mapOpts.id + "-olToolbar") 492 }); 493 panel 494 .addControls([ zoomin, zoomout, pan, info, nav.next, 495 nav.previous ]); 496 // panel.addControls([ nav.next, nav.previous ]); 497 m.addControl(panel); 498 } else { 499 OpenLayers.Util.getElement(mapOpts.id + '-olToolbar').display = 'none'; 500 } 501 502 if (OLmapPOI.length > 0) { 503 var markers = new OpenLayers.Layer.Vector( 504 "POI", 505 { 506 styleMap : new OpenLayers.StyleMap( 507 { 508 "default" : { 509 externalGraphic : "${img}", 510 graphicHeight : 16, 511 graphicWidth : 16, 512 graphicXOffset : 0, 513 graphicYOffset : -8, 514 graphicOpacity : "${opacity}", 515 rotation : "${angle}", 516 backgroundGraphic : DocBase 517 + "lib/plugins/openlayersmap/icons/marker_shadow.png", 518 backgroundXOffset : 0, 519 backgroundYOffset : -4, 520 backgroundRotation : "${angle}", 521 pointRadius : 10, 522 labelXOffset : 8, 523 labelYOffset : 8, 524 labelAlign : "lb", 525 label : "${label}", 526 // fontColor : "", 527 fontFamily : "monospace", 528 fontSize : "12px", 529 fontWeight : "bold" 530 }, 531 "select" : { 532 cursor : "crosshair", 533 externalGraphic : DocBase 534 + "lib/plugins/openlayersmap/icons/marker-red.png", 535 graphicHeight : 16, 536 graphicWidth : 16, 537 graphicXOffset : 0, 538 graphicYOffset : -8, 539 graphicOpacity : 1.0, 540 rotation : "${angle}" 541 } 542 }), 543 isBaseLayer : false, 544 rendererOptions : { 545 yOrdering : true 546 } 547 }); 548 549 m.addLayer(markers); 550 var features = []; 551 var lonLat; 552 for ( var j = 0; j < OLmapPOI.length; j++) { 553 var feat = new OpenLayers.Feature.Vector( 554 new OpenLayers.Geometry.Point(OLmapPOI[j].lon, 555 OLmapPOI[j].lat).transform(m.displayProjection, 556 m.projection), { 557 angle : OLmapPOI[j].angle, 558 opacity : OLmapPOI[j].opacity, 559 img : DocBase + "lib/plugins/openlayersmap/icons/" 560 + OLmapPOI[j].img, 561 label : OLmapPOI[j].rowId 562 }); 563 feat.data = { 564 name : OLmapPOI[j].txt, 565 rowId : OLmapPOI[j].rowId 566 }; 567 features.push(feat); 568 } 569 markers.addFeatures(features); 570 extent.extend(markers.getDataExtent()); 571 m.zoomToExtent(extent); 572 } 573 574 /* GPX layer */ 575 if (mapOpts.gpxfile.length > 0) { 576 var layerGPX = new OpenLayers.Layer.GML("GPS route", DocBase 577 + "lib/exe/fetch.php?media=" + mapOpts.gpxfile, { 578 format : OpenLayers.Format.GPX, 579 formatOptions : { 580 extractWaypoints : true, 581 extractTracks : true, 582 extractStyles : true, 583 extractAttributes : true, 584 handleHeight : true, 585 maxDepth : 3 586 }, 587 style : { 588 strokeColor : "#0000FF", 589 strokeWidth : 3, 590 strokeOpacity : 0.7, 591 pointRadius : 4, 592 fillColor : "#0099FF", 593 fillOpacity : 0.7 594 /* 595 * , label:"${name}" 596 */}, 597 projection : new OpenLayers.Projection("EPSG:4326") 598 }); 599 m.addLayer(layerGPX); 600 layerGPX.events.register('loadend', m, function() { 601 extent.extend(layerGPX.getDataExtent()); 602 m.zoomToExtent(extent); 603 }); 604 605 } 606 607 /* KML layer */ 608 if (mapOpts.kmlfile.length > 0) { 609 var layerKML = new OpenLayers.Layer.GML("KML file", DocBase 610 + "lib/exe/fetch.php?media=" + mapOpts.kmlfile, { 611 format : OpenLayers.Format.KML, 612 formatOptions : { 613 extractStyles : true, 614 extractAttributes : true, 615 maxDepth : 3 616 }, 617 style : { 618 label : "${name}" 619 }, 620 projection : new OpenLayers.Projection("EPSG:4326") 621 }); 622 m.addLayer(layerKML); 623 layerKML.events.register('loadend', m, function() { 624 extent.extend(layerKML.getDataExtent()); 625 m.zoomToExtent(extent); 626 }); 627 } 628 629 // selectcontrol for layers 630 if ((m.getLayersByClass('OpenLayers.Layer.GML').length > 0) 631 || m.getLayersByClass('OpenLayers.Layer.Vector').length > 0) { 632 selectControl = new OpenLayers.Control.SelectFeature((m 633 .getLayersByClass('OpenLayers.Layer.Vector')).concat(m 634 .getLayersByClass('OpenLayers.Layer.GML')), { 635 hover : mapOpts.poihoverstyle, 636 onSelect : onFeatureSelect, 637 onUnselect : onFeatureUnselect 638 }); 639 m.addControl(selectControl); 640 selectControl.activate(); 641 } 642 643 return m; 644} 645 646/** 647 * ol api flag. 648 * 649 * @type {Boolean} 650 */ 651var olEnable = false, 652/** 653 * MapQuest tiles flag. 654 * 655 * @type {Boolean} 656 */ 657mqEnable = false, 658/** 659 * google map api flag. 660 * 661 * @type {Boolean} 662 */ 663gEnable = false, 664/** 665 * virtual earth map api flag. 666 * 667 * @type {Boolean} 668 */ 669veEnable = false, 670/** 671 * OSM tiles flag. 672 * 673 * @type {Boolean} 674 */ 675osmEnable = true; 676/** 677 * yahoo map api flag. 678 * 679 * @type {Boolean} 680 */ 681// yEnable = false; 682/* register olInit to run with onload event. */ 683addInitEvent(olInit); 684