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