1 /* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
2 * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
3 * full text of the license. */
7 * @requires OpenLayers/Layer/Grid.js
11 * Class: OpenLayers.Layer.WorldWind
14 * - <OpenLayers.Layer.Grid>
16 OpenLayers.Layer.WorldWind = OpenLayers.Class(OpenLayers.Layer.Grid, {
22 * APIProperty: isBaseLayer
23 * WorldWind layer is a base layer by default.
30 * LevelZeroTileSizeDegrees
35 * APIProperty: zoomLevels
36 * Number of zoom levels.
41 * Constructor: OpenLayers.Layer.WorldWind
44 * name - {String} Name of Layer
45 * url - {String} Base URL
46 * lzd - {Float} Level zero tile size degrees
47 * zoomLevels - {Int} number of zoom levels
48 * params - {Object} additional parameters
49 * options - {Object} additional options
51 initialize: function(name, url, lzd, zoomLevels, params, options) {
53 this.zoomLevels = zoomLevels;
54 var newArguments = [];
55 newArguments.push(name, url, params, options);
56 OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
57 this.params = OpenLayers.Util.applyDefaults(
58 this.params, this.DEFAULT_PARAMS
65 * bounds - {<OpenLayers.Bounds>}
66 * position - {<OpenLayers.Pixel>}
69 * {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
71 addTile:function(bounds,position) {
72 return new OpenLayers.Tile.Image(this, position, bounds,
78 * Convert map zoom to WW zoom.
80 getZoom: function () {
81 var zoom = this.map.getZoom();
82 var extent = this.map.getMaxExtent();
83 zoom = zoom - Math.log(this.maxResolution / (this.lzd/512))/Math.log(2);
91 * bounds - {<OpenLayers.Bounds>}
94 * {String} A string with the layer's url and parameters and also the
95 * passed-in bounds and appropriate tile size specified as
98 getURL: function (bounds) {
99 bounds = this.adjustBounds(bounds);
100 var zoom = this.getZoom();
101 var extent = this.map.getMaxExtent();
102 var deg = this.lzd/Math.pow(2,this.getZoom());
103 var x = Math.floor((bounds.left - extent.left)/deg);
104 var y = Math.floor((bounds.bottom - extent.bottom)/deg);
105 if (this.map.getResolution() <= (this.lzd/512)
106 && this.getZoom() <= this.zoomLevels) {
107 return this.getFullRequestString(
113 return OpenLayers.Util.getImagesLocation() + "blank.gif";
118 CLASS_NAME: "OpenLayers.Layer.WorldWind"