+++ /dev/null
-/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
- * See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
- * text of the license. */
-// @require: OpenLayers/Layer.js\r
-\r
-// load VE map control script\r
-document.write("<script src='http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js'></script>");\r
-\r
-\r
-/**\r
- * @class \r
- */\r
-OpenLayers.Layer.VirtualEarth = Class.create();\r
-OpenLayers.Layer.VirtualEarth.prototype = \r
- Object.extend( new OpenLayers.Layer(), {\r
-\r
- /** @type Boolean */\r
- viewPortLayer: true,\r
-\r
- /** @type VEMap */\r
- vemap: null,\r
- \r
- /**\r
- * @constructor\r
- * \r
- * @param {str} name\r
- */\r
- initialize:function(name) {\r
- OpenLayers.Layer.prototype.initialize.apply(this, arguments);\r
- },\r
-\r
- /** \r
- * @param {OpenLayers.Map} map\r
- */\r
- setMap:function(map) {\r
- OpenLayers.Layer.prototype.setMap.apply(this, arguments);\r
-\r
- // once our layer has been added to the map, we can create the vemap\r
- this.map.events.register("addlayer", this, this.loadVEMap);\r
- },\r
-\r
- /** Virtual Earth layer is always a base class. \r
- * @type Boolean\r
- */\r
- isBaseLayer: function() {\r
- return true;\r
- },\r
-\r
- /** \r
- * @param {OpenLayers.Bounds} bounds\r
- * @param {int} zoomChanged\r
- */\r
- moveTo:function(bounds,zoomChanged) {\r
-\r
- if (this.vemap != null) {\r
- var olCenter = this.map.getCenter();\r
- var olZoom = this.map.getZoom();\r
- \r
- this.vemap.SetCenterAndZoom(new VELatLong(olCenter.lat, olCenter.lon),\r
- olZoom + 1);\r
- }\r
- },\r
-\r
-\r
- /**\r
- * \r
- */\r
- loadVEMap:function() {\r
- // create div and set to same size as map\r
- var veDiv = OpenLayers.Util.createDiv(this.name);\r
- var sz = this.map.getSize();\r
- veDiv.style.width = sz.w;\r
- veDiv.style.height = sz.h;\r
- this.div.appendChild(veDiv);\r
-\r
- // create VEMap, hide nav controls\r
- this.vemap = new VEMap(this.name);\r
- this.vemap.LoadMap();\r
- this.vemap.HideDashboard();\r
-\r
- // catch pans and zooms from VE Map\r
- this.vemap.AttachEvent("onendcontinuouspan", \r
- this.catchPanZoom.bindAsEventListener(this)); \r
- this.vemap.AttachEvent("onendzoom", \r
- this.catchPanZoom.bindAsEventListener(this)); \r
- \r
-\r
- },\r
-\r
- /**\r
- * @param {event} e\r
- */\r
- catchPanZoom: function(e) { \r
- var veCenter = this.vemap.GetCenter();\r
- var veZoom = this.vemap.GetZoomLevel();\r
- \r
- var olCenter = new OpenLayers.LonLat(veCenter.Longitude,\r
- veCenter.Latitude);\r
- \r
- this.map.setCenter(olCenter, veZoom - 1);\r
- \r
- },\r
-\r
-\r
- /** @final @type String */\r
- CLASS_NAME: "OpenLayers.Layer.VirtualEarth"\r
-});
\ No newline at end of file