The OpenLayers server threw a disk, and clobbered another, resulting in a loss
of data up to our last backup. In the previous subversion repository, this was r1694->r1777. I'm sorry to all those of you who might have checked out that code, as this will surely cause problems for you. We're currently working to figure out what went wrong, and how to prevent it in the future. git-svn-id: http://svn.openlayers.org/trunk/openlayers@1695 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -67,9 +67,46 @@ OpenLayers.Layer.FixedZoomLevels.prototype = {
|
||||
// do want to put some functionality or state in here.
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
initResolutions: function() {
|
||||
// resolutions are set automatically in the black-box. this is the
|
||||
// definition of a fixed-zoom-levels layer
|
||||
|
||||
var props = new Array('minZoomLevel', 'maxZoomLevel', 'numZoomLevels');
|
||||
|
||||
for(var i=0; i < props.length; i++) {
|
||||
var property = props[i];
|
||||
this[property] = (this.options[property] != null)
|
||||
? this.options[property]
|
||||
: this.map[property];
|
||||
}
|
||||
|
||||
if ( (this.minZoomLevel == null) ||
|
||||
(this.minZoomLevel < this.MIN_ZOOM_LEVEL) ){
|
||||
this.minZoomLevel = this.MIN_ZOOM_LEVEL;
|
||||
}
|
||||
|
||||
var limitZoomLevels = this.MAX_ZOOM_LEVEL - this.minZoomLevel + 1;
|
||||
if (this.numZoomLevels != null) {
|
||||
this.numZoomLevels = Math.min(this.numZoomLevels, limitZoomLevels);
|
||||
} else {
|
||||
if (this.maxZoomLevel != null) {
|
||||
var zoomDiff = this.maxZoomLevel - this.minZoomLevel + 1;
|
||||
this.numZoomLevels = Math.min(zoomDiff, limitZoomLevels);
|
||||
} else {
|
||||
this.numZoomLevels = limitZoomLevels;
|
||||
}
|
||||
}
|
||||
|
||||
this.maxZoomLevel = this.minZoomLevel + this.numZoomLevels - 1;
|
||||
|
||||
if (this.RESOLUTIONS != null) {
|
||||
var resolutionsIndex = 0;
|
||||
this.resolutions = [];
|
||||
for(var i= this.minZoomLevel; i < this.numZoomLevels; i++) {
|
||||
this.resolutions[resolutionsIndex++] = this.RESOLUTIONS[i];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -77,16 +114,21 @@ OpenLayers.Layer.FixedZoomLevels.prototype = {
|
||||
* @type float
|
||||
*/
|
||||
getResolution: function() {
|
||||
var resolution = null;
|
||||
|
||||
var viewSize = this.map.getSize();
|
||||
var extent = this.getExtent();
|
||||
|
||||
if ((viewSize != null) && (extent != null)) {
|
||||
resolution = Math.max( extent.getWidth() / viewSize.w,
|
||||
extent.getHeight() / viewSize.h );
|
||||
|
||||
if (this.resolutions != null) {
|
||||
return OpenLayers.Layer.prototype.getResolution.apply(this, arguments);
|
||||
} else {
|
||||
var resolution = null;
|
||||
|
||||
var viewSize = this.map.getSize();
|
||||
var extent = this.getExtent();
|
||||
|
||||
if ((viewSize != null) && (extent != null)) {
|
||||
resolution = Math.max( extent.getWidth() / viewSize.w,
|
||||
extent.getHeight() / viewSize.h );
|
||||
}
|
||||
return resolution;
|
||||
}
|
||||
return resolution;
|
||||
},
|
||||
|
||||
/** Calculates using px-> lonlat translation functions on tl and br
|
||||
@@ -127,12 +169,64 @@ OpenLayers.Layer.FixedZoomLevels.prototype = {
|
||||
*/
|
||||
getZoomForResolution: function(resolution) {
|
||||
|
||||
var extent = OpenLayers.Layer.prototype.getExtent.apply(this,
|
||||
[resolution]);
|
||||
|
||||
return this.getZoomForExtent(extent);
|
||||
if (this.resolutions != null) {
|
||||
return OpenLayers.Layer.prototype.getZoomForResolution.apply(this, arguments);
|
||||
} else {
|
||||
var extent = OpenLayers.Layer.prototype.getExtent.apply(this,
|
||||
[resolution]);
|
||||
|
||||
return this.getZoomForExtent(extent);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/********************************************************/
|
||||
/* */
|
||||
/* Translation Functions */
|
||||
/* */
|
||||
/* The following functions translate GMaps and OL */
|
||||
/* formats for Pixel, LonLat, Bounds, and Zoom */
|
||||
/* */
|
||||
/********************************************************/
|
||||
|
||||
|
||||
//
|
||||
// TRANSLATION: MapObject Zoom <-> OpenLayers Zoom
|
||||
//
|
||||
|
||||
/**
|
||||
* @param {int} gZoom
|
||||
*
|
||||
* @returns An OpenLayers Zoom level, translated from the passed in gZoom
|
||||
* Returns null if null value is passed in
|
||||
* @type int
|
||||
*/
|
||||
getOLZoomFromMapObjectZoom: function(moZoom) {
|
||||
var zoom = null;
|
||||
if (moZoom != null) {
|
||||
zoom = moZoom - this.minZoomLevel;
|
||||
}
|
||||
return zoom;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {int} olZoom
|
||||
*
|
||||
* @returns A MapObject level, translated from the passed in olZoom
|
||||
* Returns null if null value is passed in
|
||||
* @type int
|
||||
*/
|
||||
getMapObjectZoomFromOLZoom: function(olZoom) {
|
||||
var zoom = null;
|
||||
if (olZoom != null) {
|
||||
zoom = olZoom + this.minZoomLevel;
|
||||
}
|
||||
return zoom;
|
||||
},
|
||||
|
||||
|
||||
/** @final @type String */
|
||||
CLASS_NAME: "FixedZoomLevels.js"
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user