Fix EOL-style on all remaining files.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2090 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -1,161 +1,161 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fileoverview Image Layer
|
* @fileoverview Image Layer
|
||||||
* @author Tim Schaub
|
* @author Tim Schaub
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
*
|
*
|
||||||
* @requires OpenLayers/Layer.js
|
* @requires OpenLayers/Layer.js
|
||||||
*/
|
*/
|
||||||
OpenLayers.Layer.Image = OpenLayers.Class.create();
|
OpenLayers.Layer.Image = OpenLayers.Class.create();
|
||||||
OpenLayers.Layer.Image.prototype =
|
OpenLayers.Layer.Image.prototype =
|
||||||
OpenLayers.Class.inherit(OpenLayers.Layer, {
|
OpenLayers.Class.inherit(OpenLayers.Layer, {
|
||||||
|
|
||||||
/** By default, Layer.Image will be a baselayer
|
/** By default, Layer.Image will be a baselayer
|
||||||
*
|
*
|
||||||
* @type Boolean */
|
* @type Boolean */
|
||||||
isBaseLayer: true,
|
isBaseLayer: true,
|
||||||
|
|
||||||
/** @type String */
|
/** @type String */
|
||||||
url: null,
|
url: null,
|
||||||
|
|
||||||
/** @type OpenLayers.Bounds */
|
/** @type OpenLayers.Bounds */
|
||||||
extent: null,
|
extent: null,
|
||||||
|
|
||||||
/** @type OpenLayers.Size */
|
/** @type OpenLayers.Size */
|
||||||
size: null,
|
size: null,
|
||||||
|
|
||||||
/** @type OpenLayers.Tile.Image */
|
/** @type OpenLayers.Tile.Image */
|
||||||
tile: null,
|
tile: null,
|
||||||
|
|
||||||
/** The ratio of height/width represented by a single pixel in the graphic
|
/** The ratio of height/width represented by a single pixel in the graphic
|
||||||
*
|
*
|
||||||
* @type Float */
|
* @type Float */
|
||||||
aspectRatio: null,
|
aspectRatio: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
*
|
*
|
||||||
* @param {String} name
|
* @param {String} name
|
||||||
* @param {String} url Relative or absolute path to the image
|
* @param {String} url Relative or absolute path to the image
|
||||||
* @param {OpenLayers.Bounds} extent The extent represented by the image
|
* @param {OpenLayers.Bounds} extent The extent represented by the image
|
||||||
* @param {OpenLayers.Size} size The size (in pixels) of the image
|
* @param {OpenLayers.Size} size The size (in pixels) of the image
|
||||||
* @param {Object} options Hashtable of extra options to tag onto the layer
|
* @param {Object} options Hashtable of extra options to tag onto the layer
|
||||||
*/
|
*/
|
||||||
initialize: function(name, url, extent, size, options) {
|
initialize: function(name, url, extent, size, options) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.extent = extent;
|
this.extent = extent;
|
||||||
this.size = size;
|
this.size = size;
|
||||||
OpenLayers.Layer.prototype.initialize.apply(this, [name, options]);
|
OpenLayers.Layer.prototype.initialize.apply(this, [name, options]);
|
||||||
|
|
||||||
this.aspectRatio = (this.extent.getHeight() / this.size.h) /
|
this.aspectRatio = (this.extent.getHeight() / this.size.h) /
|
||||||
(this.extent.getWidth() / this.size.w);
|
(this.extent.getWidth() / this.size.w);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
this.tile.destroy();
|
this.tile.destroy();
|
||||||
this.tile = null;
|
this.tile = null;
|
||||||
OpenLayers.Layer.prototype.destroy.apply(this, arguments);
|
OpenLayers.Layer.prototype.destroy.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} obj
|
* @param {Object} obj
|
||||||
*
|
*
|
||||||
* @returns An exact clone of this OpenLayers.Layer.Image
|
* @returns An exact clone of this OpenLayers.Layer.Image
|
||||||
* @type OpenLayers.Layer.Image
|
* @type OpenLayers.Layer.Image
|
||||||
*/
|
*/
|
||||||
clone: function(obj) {
|
clone: function(obj) {
|
||||||
|
|
||||||
if(obj == null) {
|
if(obj == null) {
|
||||||
obj = new OpenLayers.Layer.Image(this.name,
|
obj = new OpenLayers.Layer.Image(this.name,
|
||||||
this.url,
|
this.url,
|
||||||
this.extent,
|
this.extent,
|
||||||
this.size,
|
this.size,
|
||||||
this.options);
|
this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
//get all additions from superclasses
|
//get all additions from superclasses
|
||||||
obj = OpenLayers.Layer.prototype.clone.apply(this, [obj]);
|
obj = OpenLayers.Layer.prototype.clone.apply(this, [obj]);
|
||||||
|
|
||||||
// copy/set any non-init, non-simple values here
|
// copy/set any non-init, non-simple values here
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {OpenLayers.Map} map
|
* @param {OpenLayers.Map} map
|
||||||
*/
|
*/
|
||||||
setMap: function(map) {
|
setMap: function(map) {
|
||||||
// If nothing to do with resolutions has been set, assume a single
|
// If nothing to do with resolutions has been set, assume a single
|
||||||
// resolution determined by extent/size
|
// resolution determined by extent/size
|
||||||
if( this.options.maxResolution == null ) {
|
if( this.options.maxResolution == null ) {
|
||||||
this.options.maxResolution = this.extent.getWidth() / this.size.w;
|
this.options.maxResolution = this.extent.getWidth() / this.size.w;
|
||||||
}
|
}
|
||||||
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
|
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Create the tile for the image or resize it for the new resolution
|
/** Create the tile for the image or resize it for the new resolution
|
||||||
*
|
*
|
||||||
* @param {OpenLayers.Bounds} bounds
|
* @param {OpenLayers.Bounds} bounds
|
||||||
* @param {Boolean} zoomChanged
|
* @param {Boolean} zoomChanged
|
||||||
* @param {Boolean} dragging
|
* @param {Boolean} dragging
|
||||||
*/
|
*/
|
||||||
moveTo:function(bounds, zoomChanged, dragging) {
|
moveTo:function(bounds, zoomChanged, dragging) {
|
||||||
OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
|
OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
|
||||||
|
|
||||||
var firstRendering = (this.tile == null);
|
var firstRendering = (this.tile == null);
|
||||||
|
|
||||||
if(zoomChanged || firstRendering) {
|
if(zoomChanged || firstRendering) {
|
||||||
|
|
||||||
//determine new tile size
|
//determine new tile size
|
||||||
var tileWidth = this.extent.getWidth() / this.map.getResolution();
|
var tileWidth = this.extent.getWidth() / this.map.getResolution();
|
||||||
var tileHeight = this.extent.getHeight() /
|
var tileHeight = this.extent.getHeight() /
|
||||||
(this.map.getResolution() * this.aspectRatio);
|
(this.map.getResolution() * this.aspectRatio);
|
||||||
var tileSize = new OpenLayers.Size(tileWidth, tileHeight);
|
var tileSize = new OpenLayers.Size(tileWidth, tileHeight);
|
||||||
|
|
||||||
//determine new position (upper left corner of new bounds)
|
//determine new position (upper left corner of new bounds)
|
||||||
var ul = new OpenLayers.LonLat(this.extent.left, this.extent.top);
|
var ul = new OpenLayers.LonLat(this.extent.left, this.extent.top);
|
||||||
var ulPx = this.map.getLayerPxFromLonLat(ul);
|
var ulPx = this.map.getLayerPxFromLonLat(ul);
|
||||||
|
|
||||||
if(firstRendering) {
|
if(firstRendering) {
|
||||||
//create the new tile
|
//create the new tile
|
||||||
this.tile = new OpenLayers.Tile.Image(this, ulPx, this.extent,
|
this.tile = new OpenLayers.Tile.Image(this, ulPx, this.extent,
|
||||||
this.url, tileSize);
|
this.url, tileSize);
|
||||||
} else {
|
} else {
|
||||||
//just resize the tile and set it's new position
|
//just resize the tile and set it's new position
|
||||||
this.tile.size = tileSize.clone();
|
this.tile.size = tileSize.clone();
|
||||||
this.tile.position = ulPx.clone();
|
this.tile.position = ulPx.clone();
|
||||||
}
|
}
|
||||||
this.tile.draw();
|
this.tile.draw();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} newUrl
|
* @param {String} newUrl
|
||||||
*/
|
*/
|
||||||
setUrl: function(newUrl) {
|
setUrl: function(newUrl) {
|
||||||
this.url = newUrl;
|
this.url = newUrl;
|
||||||
this.draw();
|
this.draw();
|
||||||
},
|
},
|
||||||
|
|
||||||
/** The url we return is always the same (the image itself never changes)
|
/** The url we return is always the same (the image itself never changes)
|
||||||
* so we can ignore the bounds parameter (it will always be the same,
|
* so we can ignore the bounds parameter (it will always be the same,
|
||||||
* anyways)
|
* anyways)
|
||||||
*
|
*
|
||||||
* @param {OpenLayers.Bounds} bounds
|
* @param {OpenLayers.Bounds} bounds
|
||||||
*/
|
*/
|
||||||
getURL: function(bounds) {
|
getURL: function(bounds) {
|
||||||
return this.url;
|
return this.url;
|
||||||
},
|
},
|
||||||
|
|
||||||
/** @final @type String */
|
/** @final @type String */
|
||||||
CLASS_NAME: "OpenLayers.Layer.Image"
|
CLASS_NAME: "OpenLayers.Layer.Image"
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,101 +1,101 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* for the full text of the license. */
|
* for the full text of the license. */
|
||||||
// @requires OpenLayers/Layer/Grid.js
|
// @requires OpenLayers/Layer/Grid.js
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
*/
|
*/
|
||||||
OpenLayers.Layer.MapServer = OpenLayers.Class.create();
|
OpenLayers.Layer.MapServer = OpenLayers.Class.create();
|
||||||
OpenLayers.Layer.MapServer.prototype =
|
OpenLayers.Layer.MapServer.prototype =
|
||||||
OpenLayers.Class.inherit( OpenLayers.Layer.Grid, {
|
OpenLayers.Class.inherit( OpenLayers.Layer.Grid, {
|
||||||
|
|
||||||
/** @final @type hash */
|
/** @final @type hash */
|
||||||
DEFAULT_PARAMS: {
|
DEFAULT_PARAMS: {
|
||||||
mode: "map",
|
mode: "map",
|
||||||
map_imagetype: "png"
|
map_imagetype: "png"
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
*
|
*
|
||||||
* @param {str} name
|
* @param {str} name
|
||||||
* @param {str} url
|
* @param {str} url
|
||||||
* @param {hash} params
|
* @param {hash} params
|
||||||
*/
|
*/
|
||||||
initialize: function(name, url, params) {
|
initialize: function(name, url, params) {
|
||||||
var newArguments = new Array();
|
var newArguments = new Array();
|
||||||
//uppercase params
|
//uppercase params
|
||||||
params = OpenLayers.Util.upperCaseObject(params);
|
params = OpenLayers.Util.upperCaseObject(params);
|
||||||
newArguments.push(name, url, params);
|
newArguments.push(name, url, params);
|
||||||
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
|
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
|
||||||
|
|
||||||
if (arguments.length > 0) {
|
if (arguments.length > 0) {
|
||||||
OpenLayers.Util.applyDefaults(
|
OpenLayers.Util.applyDefaults(
|
||||||
this.params,
|
this.params,
|
||||||
OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS)
|
OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type Boolean
|
* @type Boolean
|
||||||
*/
|
*/
|
||||||
isBaseLayer: function() {
|
isBaseLayer: function() {
|
||||||
return (this.params.TRANSPARENT != 'true');
|
return (this.params.TRANSPARENT != 'true');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} name
|
* @param {String} name
|
||||||
* @param {hash} params
|
* @param {hash} params
|
||||||
*
|
*
|
||||||
* @returns A clone of this OpenLayers.Layer.MapServer, with the passed-in
|
* @returns A clone of this OpenLayers.Layer.MapServer, with the passed-in
|
||||||
* parameters merged in.
|
* parameters merged in.
|
||||||
* @type OpenLayers.Layer.MapServer
|
* @type OpenLayers.Layer.MapServer
|
||||||
*/
|
*/
|
||||||
clone: function (name, params) {
|
clone: function (name, params) {
|
||||||
var mergedParams = {};
|
var mergedParams = {};
|
||||||
OpenLayers.Util.extend(mergedParams, this.params);
|
OpenLayers.Util.extend(mergedParams, this.params);
|
||||||
OpenLayers.Util.extend(mergedParams, params);
|
OpenLayers.Util.extend(mergedParams, params);
|
||||||
var obj = new OpenLayers.Layer.MapServer(name, this.url, mergedParams);
|
var obj = new OpenLayers.Layer.MapServer(name, this.url, mergedParams);
|
||||||
obj.setTileSize(this.tileSize);
|
obj.setTileSize(this.tileSize);
|
||||||
return obj;
|
return obj;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* addTile creates a tile, initializes it (via 'draw' in this case), and
|
* addTile creates a tile, initializes it (via 'draw' in this case), and
|
||||||
* adds it to the layer div.
|
* adds it to the layer div.
|
||||||
*
|
*
|
||||||
* @param {OpenLayers.Bounds} bounds
|
* @param {OpenLayers.Bounds} bounds
|
||||||
*
|
*
|
||||||
* @returns The added OpenLayers.Tile.Image
|
* @returns The added OpenLayers.Tile.Image
|
||||||
* @type OpenLayers.Tile.Image
|
* @type OpenLayers.Tile.Image
|
||||||
*/
|
*/
|
||||||
addTile:function(bounds,position) {
|
addTile:function(bounds,position) {
|
||||||
var url = this.getURL(bounds);
|
var url = this.getURL(bounds);
|
||||||
return new OpenLayers.Tile.Image(this, position, bounds, url, this.tileSize);
|
return new OpenLayers.Tile.Image(this, position, bounds, url, this.tileSize);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {OpenLayers.Bounds} bounds
|
* @param {OpenLayers.Bounds} bounds
|
||||||
*
|
*
|
||||||
* @returns A string with the layer's url and parameters and also the
|
* @returns A string with the layer's url and parameters and also the
|
||||||
* passed-in bounds and appropriate tile size specified as
|
* passed-in bounds and appropriate tile size specified as
|
||||||
* parameters
|
* parameters
|
||||||
* @type String
|
* @type String
|
||||||
*/
|
*/
|
||||||
getURL: function (bounds) {
|
getURL: function (bounds) {
|
||||||
|
|
||||||
var url = this.getFullRequestString(
|
var url = this.getFullRequestString(
|
||||||
{mapext:bounds.toBBOX().replace(/,/g,"+"),
|
{mapext:bounds.toBBOX().replace(/,/g,"+"),
|
||||||
imgext:bounds.toBBOX().replace(/,/g,"+"),
|
imgext:bounds.toBBOX().replace(/,/g,"+"),
|
||||||
map_size:this.tileSize.w+'+'+this.tileSize.h,
|
map_size:this.tileSize.w+'+'+this.tileSize.h,
|
||||||
imgx: this.tileSize.w/2,
|
imgx: this.tileSize.w/2,
|
||||||
imgy: this.tileSize.h/2,
|
imgy: this.tileSize.h/2,
|
||||||
imgxy: this.tileSize.w+"+"+this.tileSize.h
|
imgxy: this.tileSize.w+"+"+this.tileSize.h
|
||||||
});
|
});
|
||||||
return url;
|
return url;
|
||||||
},
|
},
|
||||||
/** @final @type String */
|
/** @final @type String */
|
||||||
CLASS_NAME: "OpenLayers.Layer.MapServer"
|
CLASS_NAME: "OpenLayers.Layer.MapServer"
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user