Closes #256 - add getMinZoom getMaxZoom

This commit is contained in:
Andy Gup 2014-10-03 10:28:06 -06:00
parent 03cfea6305
commit 153abce68b
3 changed files with 34 additions and 22 deletions

View File

@ -30,6 +30,9 @@ Methods | Returns | Description
`loadFromFile(filename, callback)` | `callback( boolean, error)` | Reads a csv file into local tile cache.
`estimateTileSize(callback)` | `callback(number)` | Retrieves one tile from a layer and then returns its size.
`prepareForOffline(` `minLevel, maxLevel, extent, ` `reportProgress)` | `callback(number)` | Retrieves tiles and stores them in the local cache. See the "How To Use" section below to learn more about customizing the use of this method.
`getMinZoom(callback)` | `callback(number)` | Returns the minimum zoom level of the layer. This is the zoom level farther away from the earth.
`getMaxZoom(callback)` | `callback(number)` | Returns the maximum zoom level of the layer. This is the zoom level closest to the earth.
###Properties
Property | Description

View File

@ -190,17 +190,7 @@ define([
getMaxZoom: function(callback){
if(this._maxZoom == null){
var lods = this.tileInfo.lods;
var length = this.tileInfo.lods.length;
var tempArr = [];
for(var i=0; i < length; i++){
tempArr.push(lods[i].level);
if(i == length -1){
tempArr.sortNumber();
this._maxZoom = tempArr[i];
callback(tempArr[i]);
}
}
this._maxZoom = this.tileInfo.lods[0].level;
}
else{
callback(this._maxZoom);
@ -215,17 +205,7 @@ define([
getMinZoom: function(callback){
if(this._minZoom == null){
var lods = this.tileInfo.lods;
var length = this.tileInfo.lods.length;
var tempArr = [];
for(var i=0; i < length; i++){
tempArr.push(lods[i].level);
if(i == length -1){
tempArr.sortNumber();
this._minZoom = tempArr[0];
callback(tempArr[0]);
}
}
this._minZoom = this.tileInfo.lods[basemapLayer.tileInfo.lods.length-1].level;
}
else{
callback(this._minZoom);

View File

@ -239,6 +239,35 @@ define([
layer._tilesCore._loadFromFile(file,this.offline.store,callback);
};
/**
* Returns the maximum zoom level for this layer
* @param callback number
*/
layer.getMaxZoom = function(callback){
if(this._maxZoom == null){
this._maxZoom = layer.tileInfo.lods[0].level;
}
else{
callback(this._maxZoom);
}
},
/**
* Returns the minimum zoom level for this layer
* @param callback number
*/
layer.getMinZoom = function(callback){
if(this._minZoom == null){
this._minZoom = layer.tileInfo.lods[basemapLayer.tileInfo.lods.length-1].level;
}
else{
callback(this._minZoom);
}
},
/* internal methods */
/**