Merge all changes from the naturaldocs sandbox. This brings all the work that
has been done in the NaturalDocs branch back to trunk. Thanks to everyone who helped out in making this happen. (I could list people, but the list would be long, and I'm already mentally on vacation.) git-svn-id: http://svn.openlayers.org/trunk/openlayers@3545 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -4,31 +4,37 @@
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer.js
|
||||
* @requires OpenLayers/Layer/Markers.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.Boxes
|
||||
* Draw divs as 'boes' on the layer.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Layer.Markers>
|
||||
*/
|
||||
OpenLayers.Layer.Boxes = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.Boxes.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer.Markers, {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Layer.Boxes
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {Object} options Hashtable of extra options to tag onto the layer
|
||||
* Parameters:
|
||||
* name - {String}
|
||||
* options - {Object} Hashtable of extra options to tag onto the layer
|
||||
*/
|
||||
initialize: function (name, options) {
|
||||
OpenLayers.Layer.Markers.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
|
||||
/** Calculate the pixel location for the marker, create it, and
|
||||
/**
|
||||
* Method: drawMarker
|
||||
* Calculate the pixel location for the marker, create it, and
|
||||
* add it to the layer's div
|
||||
*
|
||||
* @private
|
||||
*
|
||||
* @param {OpenLayers.Marker.Box} marker
|
||||
* Parameters:
|
||||
* marker - {<OpenLayers.Marker.Box>}
|
||||
*/
|
||||
drawMarker: function(marker) {
|
||||
var bounds = marker.bounds;
|
||||
@@ -51,9 +57,11 @@ OpenLayers.Layer.Boxes.prototype =
|
||||
},
|
||||
|
||||
|
||||
/** OVERRIDDEN
|
||||
/**
|
||||
* APIMethod: removeMarker
|
||||
*
|
||||
* @param {OpenLayers.Marker} marker
|
||||
* Parameters:
|
||||
* marker - {<OpenLayers.Marker.Box>}
|
||||
*/
|
||||
removeMarker: function(marker) {
|
||||
OpenLayers.Util.removeItem(this.markers, marker);
|
||||
|
||||
@@ -4,42 +4,55 @@
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer.js
|
||||
* @requires OpenLayers/Util.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.EventPane
|
||||
* Base class for 3rd party layers. Create a new event pane layer with the
|
||||
* <OpenLayers.Layer.EventPane> constructor.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Layer>
|
||||
*/
|
||||
OpenLayers.Layer.EventPane = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.EventPane.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer, {
|
||||
|
||||
/** EventPaned layers are always base layers, by necessity.
|
||||
*
|
||||
* @type Boolean */
|
||||
/**
|
||||
* Property: isBaseLayer
|
||||
* {Boolean} EventPaned layers are always base layers, by necessity.
|
||||
*/
|
||||
isBaseLayer: true,
|
||||
|
||||
/** EventPaned layers are fixed by default.
|
||||
*
|
||||
* @type Boolean */
|
||||
/**
|
||||
* APIProperty: isFixed
|
||||
* {Boolean} EventPaned layers are fixed by default.
|
||||
*/
|
||||
isFixed: true,
|
||||
|
||||
/** @type DOMElement */
|
||||
/**
|
||||
* Property: pane
|
||||
* {DOMElement} A reference to the element that controls the events.
|
||||
*/
|
||||
pane: null,
|
||||
|
||||
|
||||
/** This is the object which will be used to load the 3rd party library
|
||||
* in the case of the google layer, this will be of type GMap,
|
||||
* in the case of the ve layer, this will be of type VEMap
|
||||
*
|
||||
* @type Object */
|
||||
/**
|
||||
* Property: mapObject
|
||||
* {Object} This is the object which will be used to load the 3rd party library
|
||||
* in the case of the google layer, this will be of type GMap,
|
||||
* in the case of the ve layer, this will be of type VEMap
|
||||
*/
|
||||
mapObject: null,
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {Object} options Hashtable of extra options to tag onto the layer
|
||||
* Constructor: OpenLayers.Layer.EventPane
|
||||
* Create a new event pane layer
|
||||
*
|
||||
* Parameters:
|
||||
* name - {String}
|
||||
* options - {Object} Hashtable of extra options to tag onto the layer
|
||||
*/
|
||||
initialize: function(name, options) {
|
||||
OpenLayers.Layer.prototype.initialize.apply(this, arguments);
|
||||
@@ -49,7 +62,8 @@ OpenLayers.Layer.EventPane.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* APIMethod: destroy
|
||||
* Deconstruct this layer.
|
||||
*/
|
||||
destroy: function() {
|
||||
this.mapObject = null;
|
||||
@@ -57,11 +71,14 @@ OpenLayers.Layer.EventPane.prototype =
|
||||
},
|
||||
|
||||
|
||||
/** Set the map property for the layer. This is done through an accessor
|
||||
* so that subclasses can override this and take special action once
|
||||
* they have their map variable set.
|
||||
*
|
||||
* @param {OpenLayers.Map} map
|
||||
/**
|
||||
* Method: setMap
|
||||
* Set the map property for the layer. This is done through an accessor
|
||||
* so that subclasses can override this and take special action once
|
||||
* they have their map variable set.
|
||||
*
|
||||
* Parameters:
|
||||
* map - {<OpenLayers.Map>}
|
||||
*/
|
||||
setMap: function(map) {
|
||||
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
|
||||
@@ -90,11 +107,10 @@ OpenLayers.Layer.EventPane.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
/** If we can't load the GMap, then display an error message to the
|
||||
* user and tell them where to go for help.
|
||||
*
|
||||
* @private
|
||||
*
|
||||
/**
|
||||
* Method: loadWarningMessage
|
||||
* If we can't load the map lib, then display an error message to the
|
||||
* user and tell them where to go for help.
|
||||
*/
|
||||
loadWarningMessage:function() {
|
||||
|
||||
@@ -126,8 +142,12 @@ OpenLayers.Layer.EventPane.prototype =
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* @param {Boolean} display
|
||||
/**
|
||||
* Method: display
|
||||
* Set the display on the pane
|
||||
*
|
||||
* Parameters:
|
||||
* display - {Boolean}
|
||||
*/
|
||||
display: function(display) {
|
||||
OpenLayers.Layer.prototype.display.apply(this, arguments);
|
||||
@@ -135,17 +155,25 @@ OpenLayers.Layer.EventPane.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {int} zIndex
|
||||
* Method: setZIndex
|
||||
* Set the z-index order for the pane.
|
||||
*
|
||||
* Parameters:
|
||||
* zIndex - {int}
|
||||
*/
|
||||
setZIndex: function (zIndex) {
|
||||
OpenLayers.Layer.prototype.setZIndex.apply(this, arguments);
|
||||
this.pane.style.zIndex = parseInt(this.div.style.zIndex) + 1;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
* @param {Boolean} zoomChanged
|
||||
* @param {Boolean} dragging
|
||||
/**
|
||||
* Method: moveTo
|
||||
* Handle calls to move the layer.
|
||||
*
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
* zoomChanged - {Boolean}
|
||||
* dragging - {Boolean}
|
||||
*/
|
||||
moveTo:function(bounds, zoomChanged, dragging) {
|
||||
OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
|
||||
@@ -182,12 +210,16 @@ OpenLayers.Layer.EventPane.prototype =
|
||||
/********************************************************/
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Pixel} viewPortPx
|
||||
* Method: getLonLatFromViewPortPx
|
||||
* Get a map location from a pixel location
|
||||
*
|
||||
* Parameters:
|
||||
* viewPortPx - {<OpenLayers.Pixel>}
|
||||
*
|
||||
* @returns An OpenLayers.LonLat which is the passed-in view port
|
||||
* OpenLayers.Pixel, translated into lon/lat by GMAPS
|
||||
* If gmap is not loaded or not centered, returns null
|
||||
* @type OpenLayers.LonLat
|
||||
* Return:
|
||||
* {<OpenLayers.LonLat>} An OpenLayers.LonLat which is the passed-in view
|
||||
* port OpenLayers.Pixel, translated into lon/lat by map lib
|
||||
* If the map lib is not loaded or not centered, returns null
|
||||
*/
|
||||
getLonLatFromViewPortPx: function (viewPortPx) {
|
||||
var lonlat = null;
|
||||
@@ -202,12 +234,16 @@ OpenLayers.Layer.EventPane.prototype =
|
||||
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.LonLat} lonlat
|
||||
* Method: getViewPortPxFromLonLat
|
||||
* Get a pixel location from a map location
|
||||
*
|
||||
* @returns An OpenLayers.Pixel which is the passed-in OpenLayers.LonLat,
|
||||
* translated into view port pixels BY GMAPS
|
||||
* If gmap is not loaded or not centered, returns null
|
||||
* @type OpenLayers.Pixel
|
||||
* Parameters:
|
||||
* lonlat - {<OpenLayers.LonLat>}
|
||||
*
|
||||
* Return:
|
||||
* {<OpenLayers.Pixel>} An OpenLayers.Pixel which is the passed-in
|
||||
* OpenLayers.LonLat, translated into view port pixels by map lib
|
||||
* If map lib is not loaded or not centered, returns null
|
||||
*/
|
||||
getViewPortPxFromLonLat: function (lonlat) {
|
||||
var viewPortPx = null;
|
||||
@@ -236,12 +272,16 @@ OpenLayers.Layer.EventPane.prototype =
|
||||
//
|
||||
|
||||
/**
|
||||
* @param {Object} moLonLat
|
||||
* Method: getOLLonLatFromMapObjectLonLat
|
||||
* Get an OL style map location from a 3rd party style map location
|
||||
*
|
||||
* Parameters
|
||||
* moLonLat - {Object}
|
||||
*
|
||||
* @returns An OpenLayers.LonLat, translated from the passed in
|
||||
* Return:
|
||||
* {<OpenLayers.LonLat>} An OpenLayers.LonLat, translated from the passed in
|
||||
* MapObject LonLat
|
||||
* Returns null if null value is passed in
|
||||
* @type OpenLayers.LonLat
|
||||
*/
|
||||
getOLLonLatFromMapObjectLonLat: function(moLonLat) {
|
||||
var olLonLat = null;
|
||||
@@ -254,12 +294,16 @@ OpenLayers.Layer.EventPane.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.LonLat} olLonLat
|
||||
* Method: getMapObjectLonLatFromOLLonLat
|
||||
* Get a 3rd party map location from an OL map location.
|
||||
*
|
||||
* Parameters:
|
||||
* olLonLat - {<OpenLayers.LonLat>}
|
||||
*
|
||||
* @returns A MapObject LonLat, translated from the passed in
|
||||
* Return:
|
||||
* {Object} A MapObject LonLat, translated from the passed in
|
||||
* OpenLayers.LonLat
|
||||
* Returns null if null value is passed in
|
||||
* @type Object
|
||||
*/
|
||||
getMapObjectLonLatFromOLLonLat: function(olLonLat) {
|
||||
var moLatLng = null;
|
||||
@@ -276,12 +320,16 @@ OpenLayers.Layer.EventPane.prototype =
|
||||
//
|
||||
|
||||
/**
|
||||
* @param {Object} moPixel
|
||||
* Method: getOLPixelFromMapObjectPixel
|
||||
* Get an OL pixel location from a 3rd party pixel location.
|
||||
*
|
||||
* Parameters:
|
||||
* moPixel - {Object}
|
||||
*
|
||||
* @returns An OpenLayers.Pixel, translated from the passed in
|
||||
* Return:
|
||||
* {<OpenLayers.Pixel>} An OpenLayers.Pixel, translated from the passed in
|
||||
* MapObject Pixel
|
||||
* Returns null if null value is passed in
|
||||
* @type OpenLayers.Pixel
|
||||
*/
|
||||
getOLPixelFromMapObjectPixel: function(moPixel) {
|
||||
var olPixel = null;
|
||||
@@ -294,12 +342,16 @@ OpenLayers.Layer.EventPane.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Pixel} olPixel
|
||||
* Method: getMapObjectPixelFromOLPixel
|
||||
* Get a 3rd party pixel location from an OL pixel location
|
||||
*
|
||||
* Parameters:
|
||||
* olPixel - {<OpenLayers.Pixel>}
|
||||
*
|
||||
* @returns A MapObject Pixel, translated from the passed in
|
||||
* Return:
|
||||
* {Object} A MapObject Pixel, translated from the passed in
|
||||
* OpenLayers.Pixel
|
||||
* Returns null if null value is passed in
|
||||
* @type Object
|
||||
*/
|
||||
getMapObjectPixelFromOLPixel: function(olPixel) {
|
||||
var moPixel = null;
|
||||
@@ -309,6 +361,9 @@ OpenLayers.Layer.EventPane.prototype =
|
||||
return moPixel;
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
/**
|
||||
* Constant: CLASS_NAME
|
||||
* {String} Name of this class
|
||||
*/
|
||||
CLASS_NAME: "OpenLayers.Layer.EventPane"
|
||||
});
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @requires OpenLayers/Layer.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.FixedZoomLevels
|
||||
* Some Layers will already have established zoom levels (like google
|
||||
* or ve). Instead of trying to determine them and populate a resolutions[]
|
||||
* Array with those values, we will hijack the resolution functionality
|
||||
@@ -37,15 +37,13 @@
|
||||
* Whenever you implement a layer using OpenLayers.Layer.FixedZoomLevels,
|
||||
* it is your responsibility to provide the following three functions:
|
||||
*
|
||||
* - getLonLatFromViewPortPx()
|
||||
* - getViewPortPxFromLonLat()
|
||||
* - getZoomForExtent()
|
||||
* - getLonLatFromViewPortPx
|
||||
* - getViewPortPxFromLonLat
|
||||
* - getZoomForExtent
|
||||
*
|
||||
* ...those three functions should generally be provided by any reasonable
|
||||
* API that you might be working from.
|
||||
*
|
||||
* @requires OpenLayers/Layer.js
|
||||
* @class
|
||||
*
|
||||
*/
|
||||
OpenLayers.Layer.FixedZoomLevels = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.FixedZoomLevels.prototype = {
|
||||
@@ -60,7 +58,8 @@ OpenLayers.Layer.FixedZoomLevels.prototype = {
|
||||
/********************************************************/
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Layer.FixedZoomLevels
|
||||
* Create a new fixed zoom levels layer.
|
||||
*/
|
||||
initialize: function() {
|
||||
//this class is only just to add the following functions...
|
||||
@@ -71,7 +70,8 @@ OpenLayers.Layer.FixedZoomLevels.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* Method: initResolutions
|
||||
* Populate the resolutions array
|
||||
*/
|
||||
initResolutions: function() {
|
||||
|
||||
@@ -112,9 +112,12 @@ OpenLayers.Layer.FixedZoomLevels.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns Degrees per Pixel
|
||||
* @type float
|
||||
/**
|
||||
* APIMethod: getResolution
|
||||
* Get the current map resolution
|
||||
*
|
||||
* Return:
|
||||
* {Float} Map units per Pixel
|
||||
*/
|
||||
getResolution: function() {
|
||||
|
||||
@@ -134,12 +137,14 @@ OpenLayers.Layer.FixedZoomLevels.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
/** Calculates using px-> lonlat translation functions on tl and br
|
||||
* corners of viewport
|
||||
/**
|
||||
* APIMethod: getExtent
|
||||
* Calculates using px-> lonlat translation functions on tl and br
|
||||
* corners of viewport
|
||||
*
|
||||
* @returns A Bounds object which represents the lon/lat bounds of the
|
||||
* current viewPort.
|
||||
* @type OpenLayers.Bounds
|
||||
* Return:
|
||||
* {<OpenLayers.Bounds>} A Bounds object which represents the lon/lat
|
||||
* bounds of the current viewPort.
|
||||
*/
|
||||
getExtent: function () {
|
||||
var extent = null;
|
||||
@@ -164,11 +169,15 @@ OpenLayers.Layer.FixedZoomLevels.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {float} resolution
|
||||
* Method: getZoomForResolution
|
||||
* Get the zoom level for a given resolution
|
||||
*
|
||||
* @returns A suitable zoom level for the specified resolution.
|
||||
* If no baselayer is set, returns null.
|
||||
* @type int
|
||||
* Parameters:
|
||||
* resolution - {Float}
|
||||
*
|
||||
* Return:
|
||||
* {Integer} A suitable zoom level for the specified resolution.
|
||||
* If no baselayer is set, returns null.
|
||||
*/
|
||||
getZoomForResolution: function(resolution) {
|
||||
|
||||
@@ -185,26 +194,30 @@ OpenLayers.Layer.FixedZoomLevels.prototype = {
|
||||
|
||||
|
||||
|
||||
/********************************************************/
|
||||
/* */
|
||||
/* Translation Functions */
|
||||
/* */
|
||||
/* The following functions translate GMaps and OL */
|
||||
/* formats for Pixel, LonLat, Bounds, and Zoom */
|
||||
/* */
|
||||
/********************************************************/
|
||||
|
||||
|
||||
//
|
||||
// TRANSLATION: MapObject Zoom <-> OpenLayers Zoom
|
||||
//
|
||||
/********************************************************/
|
||||
/* */
|
||||
/* Translation Functions */
|
||||
/* */
|
||||
/* The following functions translate GMaps and OL */
|
||||
/* formats for Pixel, LonLat, Bounds, and Zoom */
|
||||
/* */
|
||||
/********************************************************/
|
||||
|
||||
|
||||
//
|
||||
// TRANSLATION: MapObject Zoom <-> OpenLayers Zoom
|
||||
//
|
||||
|
||||
/**
|
||||
* @param {int} gZoom
|
||||
* Method: getOLZoomFromMapObjectZoom
|
||||
* Get the OL zoom index from the map object zoom level
|
||||
*
|
||||
* Parameters:
|
||||
* moZoom - {Integer}
|
||||
*
|
||||
* @returns An OpenLayers Zoom level, translated from the passed in gZoom
|
||||
* Returns null if null value is passed in
|
||||
* @type int
|
||||
* Return:
|
||||
* {Integer} An OpenLayers Zoom level, translated from the passed in zoom
|
||||
* Returns null if null value is passed in
|
||||
*/
|
||||
getOLZoomFromMapObjectZoom: function(moZoom) {
|
||||
var zoom = null;
|
||||
@@ -215,11 +228,15 @@ OpenLayers.Layer.FixedZoomLevels.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {int} olZoom
|
||||
* Method: getMapObjectZoomFromOLZoom
|
||||
* Get the map object zoom level from the OL zoom level
|
||||
*
|
||||
* Parameters:
|
||||
* olZoom - {Integer}
|
||||
*
|
||||
* @returns A MapObject level, translated from the passed in olZoom
|
||||
* Returns null if null value is passed in
|
||||
* @type int
|
||||
* Return:
|
||||
* {Integer} A MapObject level, translated from the passed in olZoom
|
||||
* Returns null if null value is passed in
|
||||
*/
|
||||
getMapObjectZoomFromOLZoom: function(olZoom) {
|
||||
var zoom = null;
|
||||
|
||||
+42
-21
@@ -3,32 +3,41 @@
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* Create a vector layer by parsing a GML file. The GML file is
|
||||
* passed in as a parameter.
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer/Vector.js
|
||||
* @requires OpenLayers/Ajax.js
|
||||
|
||||
* Class: OpenLayers.Layer.GML
|
||||
* Create a vector layer by parsing a GML file. The GML file is
|
||||
* passed in as a parameter.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Layer.Vector>
|
||||
*/
|
||||
OpenLayers.Layer.GML = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.GML.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer.Vector, {
|
||||
|
||||
/**
|
||||
* Flag for whether the GML data has been loaded yet.
|
||||
* @type Boolean
|
||||
* Property: loaded
|
||||
* {Boolean} Flag for whether the GML data has been loaded yet.
|
||||
*/
|
||||
loaded: false,
|
||||
|
||||
/**
|
||||
* APIProperty: format
|
||||
* {<OpenLayers.Format>} The format you want the data to be parsed with.
|
||||
*/
|
||||
format: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} url URL of a GML file.
|
||||
* @param {Object} options Hashtable of extra options to tag onto the layer.
|
||||
* Options renderer {Object}: Typically SvgRenderer or VmlRenderer.
|
||||
* Constructor: OpenLayers.Layer.GML
|
||||
* Load and parse a single file on the web, according to the format
|
||||
* provided via the 'format' option, defaulting to GML.
|
||||
*
|
||||
* Parameters:
|
||||
* name - {String}
|
||||
* url - {String} URL of a GML file.
|
||||
* options - {Object} Hashtable of extra options to tag onto the layer.
|
||||
*/
|
||||
initialize: function(name, url, options) {
|
||||
var newArguments = new Array()
|
||||
@@ -38,14 +47,16 @@ OpenLayers.Layer.GML.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: setVisibility
|
||||
* Set the visibility flag for the layer and hide/show&redraw accordingly.
|
||||
* Fire event unless otherwise specified
|
||||
* GML will be loaded if the layer is being made visible for the first
|
||||
* time.
|
||||
*
|
||||
* @param {Boolean} visible Whether or not to display the layer
|
||||
* Parameters:
|
||||
* visible - {Boolean} Whether or not to display the layer
|
||||
* (if in range)
|
||||
* @param {Boolean} noEvent
|
||||
* noEvent - {Boolean}
|
||||
*/
|
||||
setVisibility: function(visibility, noEvent) {
|
||||
OpenLayers.Layer.Vector.prototype.setVisibility.apply(this, arguments);
|
||||
@@ -56,11 +67,14 @@ OpenLayers.Layer.GML.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: moveTo
|
||||
* If layer is visible and GML has not been loaded, load GML, then load GML
|
||||
* and call OpenLayers.Layer.Vector.moveTo() to redraw at the new location.
|
||||
* @param {Object} bounds
|
||||
* @param {Object} zoomChanged
|
||||
* @param {Object} minor
|
||||
*
|
||||
* Parameters:
|
||||
* bounds - {Object}
|
||||
* zoomChanged - {Object}
|
||||
* minor - {Object}
|
||||
*/
|
||||
moveTo:function(bounds, zoomChanged, minor) {
|
||||
OpenLayers.Layer.Vector.prototype.moveTo.apply(this, arguments);
|
||||
@@ -73,6 +87,9 @@ OpenLayers.Layer.GML.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: loadGML
|
||||
*/
|
||||
loadGML: function() {
|
||||
if (!this.loaded) {
|
||||
var results = OpenLayers.loadURL(this.url, null, this, this.requestSuccess, this.requestFailure);
|
||||
@@ -82,10 +99,12 @@ OpenLayers.Layer.GML.prototype =
|
||||
|
||||
|
||||
/**
|
||||
* Method: requestSuccess
|
||||
* Process GML after it has been loaded.
|
||||
* Called by initialise() and loadUrl() after the GML has been loaded.
|
||||
* @private
|
||||
* @param {String} request
|
||||
*
|
||||
* Parameters:
|
||||
* request - {String}
|
||||
*/
|
||||
requestSuccess:function(request) {
|
||||
var doc = request.responseXML;
|
||||
@@ -99,10 +118,12 @@ OpenLayers.Layer.GML.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: requestFailure
|
||||
* Process a failed loading of GML.
|
||||
* Called by initialise() and loadUrl() if there was a problem loading GML.
|
||||
* @private
|
||||
* @param {String} request
|
||||
*
|
||||
* Parameters:
|
||||
* request - {String}
|
||||
*/
|
||||
requestFailure: function(request) {
|
||||
alert("Error in loading GML file "+this.url);
|
||||
|
||||
@@ -4,33 +4,52 @@
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer/Markers.js
|
||||
* @requires OpenLayers/Ajax.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.GeoRSS
|
||||
* Add GeoRSS Point features to your map.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Layer.Markers>
|
||||
* - <OpenLayers.Layer>
|
||||
*/
|
||||
OpenLayers.Layer.GeoRSS = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.GeoRSS.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer.Markers, {
|
||||
|
||||
/** store url of text file
|
||||
* @type str */
|
||||
location:null,
|
||||
/**
|
||||
* Property: location
|
||||
* {String} store url of text file
|
||||
*/
|
||||
location: null,
|
||||
|
||||
/** @type Array(OpenLayers.Feature) */
|
||||
features: null,
|
||||
/**
|
||||
* Property: features
|
||||
* Array({<OpenLayers.Feature>})
|
||||
*/
|
||||
features: null,
|
||||
|
||||
/** @type OpenLayers.Feature */
|
||||
selectedFeature: null,
|
||||
/**
|
||||
* Property: selectedFeature
|
||||
* {<OpenLayers.Feature>}
|
||||
*/
|
||||
selectedFeature: null,
|
||||
|
||||
/**@type OpenLayers.Icon */
|
||||
/**
|
||||
* Property: icon
|
||||
* {<OpenLayers.Icon>}
|
||||
*/
|
||||
icon: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Layer.GeoRSS
|
||||
* Create a GeoRSS Layer.
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} location
|
||||
* Parameters:
|
||||
* name - {String}
|
||||
* location - {String}
|
||||
* options - {Object}
|
||||
*/
|
||||
initialize: function(name, location, options) {
|
||||
OpenLayers.Layer.Markers.prototype.initialize.apply(this, [name, options]);
|
||||
@@ -40,7 +59,7 @@ OpenLayers.Layer.GeoRSS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* Method: destroy
|
||||
*/
|
||||
destroy: function() {
|
||||
this.clearFeatures();
|
||||
@@ -49,7 +68,11 @@ OpenLayers.Layer.GeoRSS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {XMLHttpRequest} ajaxRequest
|
||||
* Method: parseData
|
||||
* Parse the data returned from the Events call.
|
||||
*
|
||||
* Parameters:
|
||||
* ajaxRequest - {XMLHttpRequest}
|
||||
*/
|
||||
parseData: function(ajaxRequest) {
|
||||
var doc = ajaxRequest.responseXML;
|
||||
@@ -171,7 +194,10 @@ OpenLayers.Layer.GeoRSS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Event} evt
|
||||
* Method: markerClick
|
||||
*
|
||||
* Parameters:
|
||||
* evt - {Event}
|
||||
*/
|
||||
markerClick: function(evt) {
|
||||
sameMarkerClicked = (this == this.layer.selectedFeature);
|
||||
@@ -193,7 +219,8 @@ OpenLayers.Layer.GeoRSS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* Method: clearFeatures
|
||||
* Destroy all features in this layer.
|
||||
*/
|
||||
clearFeatures: function() {
|
||||
if (this.features != null) {
|
||||
@@ -208,5 +235,3 @@ OpenLayers.Layer.GeoRSS.prototype =
|
||||
/** @final @type String */
|
||||
CLASS_NAME: "OpenLayers.Layer.GeoRSS"
|
||||
});
|
||||
|
||||
|
||||
|
||||
+157
-87
@@ -4,35 +4,51 @@
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer/EventPane.js
|
||||
* @requires OpenLayers/Layer/FixedZoomLevels.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.Gooogle
|
||||
*
|
||||
* Inherits:
|
||||
* - <OpenLayers.Layer.EventPane>
|
||||
* - <OpenLayers.Layer.FixedZoomLevels>
|
||||
*/
|
||||
OpenLayers.Layer.Google = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.Google.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer.EventPane,
|
||||
OpenLayers.Layer.FixedZoomLevels, {
|
||||
|
||||
/** @final @type int */
|
||||
/**
|
||||
* Constant: MIN_ZOOM_LEVEL
|
||||
* {Integer} 0
|
||||
*/
|
||||
MIN_ZOOM_LEVEL: 0,
|
||||
|
||||
/** @final @type int */
|
||||
/**
|
||||
* Constant: MAX_ZOOM_LEVEL
|
||||
* {Integer} 19
|
||||
*/
|
||||
MAX_ZOOM_LEVEL: 19,
|
||||
|
||||
/** Hardcode these resolutions so that they are more closely
|
||||
* tied with the standard wms projection
|
||||
*
|
||||
* @final @type Array(float) */
|
||||
/**
|
||||
* Constant: RESOLUTIONS
|
||||
* {Array(Float)} Hardcode these resolutions so that they are more closely
|
||||
* tied with the standard wms projection
|
||||
*/
|
||||
RESOLUTIONS: [1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,.00002145767211914062,.00001072883605957031,.00000536441802978515,.00000268220901489257],
|
||||
|
||||
/** @type GMapType */
|
||||
/**
|
||||
* APIProperty: type
|
||||
* {GMapType}
|
||||
*/
|
||||
type: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Layer.Google
|
||||
*
|
||||
* @param {String} name
|
||||
* Parameters:
|
||||
* name - {String}
|
||||
* options - {Object}
|
||||
*/
|
||||
initialize: function(name, options) {
|
||||
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
|
||||
@@ -41,10 +57,10 @@ OpenLayers.Layer.Google.prototype =
|
||||
this.addContainerPxFunction();
|
||||
},
|
||||
|
||||
/** Load the GMap and register appropriate event listeners. If we can't
|
||||
* load GMap2, then display a warning message.
|
||||
*
|
||||
* @private
|
||||
/**
|
||||
* Method: loadMapObject
|
||||
* Load the GMap and register appropriate event listeners. If we can't
|
||||
* load GMap2, then display a warning message.
|
||||
*/
|
||||
loadMapObject:function() {
|
||||
|
||||
@@ -75,12 +91,15 @@ OpenLayers.Layer.Google.prototype =
|
||||
|
||||
},
|
||||
|
||||
/** Overridden from EventPane because if a map type has been specified,
|
||||
* we need to attach a listener for the first moveend -- this is how
|
||||
* we will know that the map has been centered. Only once the map has
|
||||
* been centered is it safe to change the gmap object's map type.
|
||||
/**
|
||||
* APIMethod: setMap
|
||||
* Overridden from EventPane because if a map type has been specified,
|
||||
* we need to attach a listener for the first moveend -- this is how
|
||||
* we will know that the map has been centered. Only once the map has
|
||||
* been centered is it safe to change the gmap object's map type.
|
||||
*
|
||||
* @param {OpenLayers.Map} map
|
||||
* Parameters:
|
||||
* map - {<OpenLayers.Map>}
|
||||
*/
|
||||
setMap: function(map) {
|
||||
OpenLayers.Layer.EventPane.prototype.setMap.apply(this, arguments);
|
||||
@@ -90,11 +109,11 @@ OpenLayers.Layer.Google.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
/** The map has been centered, and a map type was specified, so we
|
||||
* set the map type on the gmap object, then unregister the listener
|
||||
* so that we dont keep doing this every time the map moves.
|
||||
*
|
||||
* @private
|
||||
/**
|
||||
* Method: setMapType
|
||||
* The map has been centered, and a map type was specified, so we
|
||||
* set the map type on the gmap object, then unregister the listener
|
||||
* so that we dont keep doing this every time the map moves.
|
||||
*/
|
||||
setMapType: function() {
|
||||
if (this.mapObject.getCenter() != null) {
|
||||
@@ -104,7 +123,10 @@ OpenLayers.Layer.Google.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Event} evt
|
||||
* APIMethod: onMapResize
|
||||
*
|
||||
* Parameters:
|
||||
* evt - {Event}
|
||||
*/
|
||||
onMapResize: function() {
|
||||
this.mapObject.checkResize();
|
||||
@@ -112,11 +134,14 @@ OpenLayers.Layer.Google.prototype =
|
||||
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
*
|
||||
* @returns Corresponding zoom level for a specified Bounds.
|
||||
* If mapObject is not loaded or not centered, returns null
|
||||
* @type int
|
||||
* APIMethod: getZoomForExtent
|
||||
*
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
*
|
||||
* Return:
|
||||
* {Integer} Corresponding zoom level for a specified Bounds.
|
||||
* If mapObject is not loaded or not centered, returns null
|
||||
*
|
||||
getZoomForExtent: function (bounds) {
|
||||
var zoom = null;
|
||||
@@ -140,12 +165,15 @@ OpenLayers.Layer.Google.prototype =
|
||||
//
|
||||
|
||||
/**
|
||||
* @param {Object} moBounds
|
||||
* APIMethod: getOLBoundsFromMapObjectBounds
|
||||
*
|
||||
* @returns An OpenLayers.Bounds, translated from the passed-in
|
||||
* MapObject Bounds
|
||||
* Returns null if null value is passed in
|
||||
* @type OpenLayers.Bounds
|
||||
* Parameters:
|
||||
* moBounds - {Object}
|
||||
*
|
||||
* Return:
|
||||
* {<OpenLayers.Bounds>} An <OpenLayers.Bounds>, translated from the
|
||||
* passed-in MapObject Bounds.
|
||||
* Returns null if null value is passed in.
|
||||
*/
|
||||
getOLBoundsFromMapObjectBounds: function(moBounds) {
|
||||
var olBounds = null;
|
||||
@@ -161,11 +189,14 @@ OpenLayers.Layer.Google.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Bounds} olBounds
|
||||
* APIMethod: getMapObjectBoundsFromOLBounds
|
||||
*
|
||||
* @returns A MapObject Bounds, translated from olBounds
|
||||
* Parameters:
|
||||
* olBounds - {<OpenLayers.Bounds>}
|
||||
*
|
||||
* Return:
|
||||
* {Object} A MapObject Bounds, translated from olBounds
|
||||
* Returns null if null value is passed in
|
||||
* @type Object
|
||||
*/
|
||||
getMapObjectBoundsFromOLBounds: function(olBounds) {
|
||||
var moBounds = null;
|
||||
@@ -181,12 +212,15 @@ OpenLayers.Layer.Google.prototype =
|
||||
|
||||
|
||||
|
||||
/** Hack-on function because GMAPS does not give it to us
|
||||
/**
|
||||
* Method: addContainerPxFunction
|
||||
* Hack-on function because GMAPS does not give it to us
|
||||
*
|
||||
* @param {GLatLng} gLatLng
|
||||
*
|
||||
* @returns A GPoint specifying gLatLng translated into "Container" coords
|
||||
* @type GPoint
|
||||
* Parameters:
|
||||
* gLatLng - {GLatLng}
|
||||
*
|
||||
* Return:
|
||||
* {GPoint} A GPoint specifying gLatLng translated into "Container" coords
|
||||
*/
|
||||
addContainerPxFunction: function() {
|
||||
if (typeof GMap2 != "undefined" && !GMap2.fromLatLngToContainerPixel) {
|
||||
@@ -210,9 +244,11 @@ OpenLayers.Layer.Google.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @return String with information on why layer is broken, how to get
|
||||
* APIMethod: getWarningHTML
|
||||
*
|
||||
* Return:
|
||||
* {String} String with information on why layer is broken, how to get
|
||||
* it working.
|
||||
* @type String
|
||||
*/
|
||||
getWarningHTML:function() {
|
||||
|
||||
@@ -245,26 +281,33 @@ OpenLayers.Layer.Google.prototype =
|
||||
|
||||
// Get&Set Center, Zoom
|
||||
|
||||
/** Set the mapObject to the specified center and zoom
|
||||
/**
|
||||
* APIMethod: setMapObjectCenter
|
||||
* Set the mapObject to the specified center and zoom
|
||||
*
|
||||
* @param {Object} center MapObject LonLat format
|
||||
* @param {int} zoom MapObject zoom format
|
||||
* Parameters:
|
||||
* center - {Object} MapObject LonLat format
|
||||
* zoom - {int} MapObject zoom format
|
||||
*/
|
||||
setMapObjectCenter: function(center, zoom) {
|
||||
this.mapObject.setCenter(center, zoom);
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns the mapObject's current center in Map Object format
|
||||
* @type Object
|
||||
* APIMethod: getMapObjectCenter
|
||||
*
|
||||
* Return:
|
||||
* {Object} The mapObject's current center in Map Object format
|
||||
*/
|
||||
getMapObjectCenter: function() {
|
||||
return this.mapObject.getCenter();
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns the mapObject's current zoom, in Map Object format
|
||||
* @type int
|
||||
* APIMethod: getMapObjectZoom
|
||||
*
|
||||
* Return:
|
||||
* {Integer} The mapObject's current zoom, in Map Object format
|
||||
*/
|
||||
getMapObjectZoom: function() {
|
||||
return this.mapObject.getZoom();
|
||||
@@ -273,21 +316,27 @@ OpenLayers.Layer.Google.prototype =
|
||||
|
||||
// LonLat - Pixel Translation
|
||||
|
||||
/**
|
||||
* @param {Object} moPixel MapObject Pixel format
|
||||
/**
|
||||
* APIMethod: getMapObjectLonLatFromMapObjectPixel
|
||||
*
|
||||
* @returns MapObject LonLat translated from MapObject Pixel
|
||||
* @type Object
|
||||
* Parameters:
|
||||
* moPixel - {Object} MapObject Pixel format
|
||||
*
|
||||
* Return:
|
||||
* {Object} MapObject LonLat translated from MapObject Pixel
|
||||
*/
|
||||
getMapObjectLonLatFromMapObjectPixel: function(moPixel) {
|
||||
return this.mapObject.fromContainerPixelToLatLng(moPixel);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} moPixel MapObject Pixel format
|
||||
/**
|
||||
* APIMethod: getMapObjectPixelFromMapObjectLonLat
|
||||
*
|
||||
* @returns MapObject Pixel translated from MapObject LonLat
|
||||
* @type Object
|
||||
* Parameters:
|
||||
* moLonLat - {Object} MapObject LonLat format
|
||||
*
|
||||
* Return:
|
||||
* {Object} MapObject Pixel transtlated from MapObject LonLat
|
||||
*/
|
||||
getMapObjectPixelFromMapObjectLonLat: function(moLonLat) {
|
||||
return this.mapObject.fromLatLngToContainerPixel(moLonLat);
|
||||
@@ -297,10 +346,13 @@ OpenLayers.Layer.Google.prototype =
|
||||
// Bounds
|
||||
|
||||
/**
|
||||
* @param {Object} moBounds MapObject Bounds format
|
||||
* APIMethod: getMapObjectZoomFromMapObjectBounds
|
||||
*
|
||||
* @returns MapObject Zoom for specified MapObject Bounds
|
||||
* @type Object
|
||||
* Parameters:
|
||||
* moBounds - {Object} MapObject Bounds format
|
||||
*
|
||||
* Return:
|
||||
* {Object} MapObject Zoom for specified MapObject Bounds
|
||||
*/
|
||||
getMapObjectZoomFromMapObjectBounds: function(moBounds) {
|
||||
return this.mapObject.getBoundsZoomLevel(moBounds);
|
||||
@@ -316,31 +368,40 @@ OpenLayers.Layer.Google.prototype =
|
||||
// LonLat
|
||||
|
||||
/**
|
||||
* @param {Object} moLonLat MapObject LonLat format
|
||||
* APIMethod: getLongitudeFromMapObjectLonLat
|
||||
*
|
||||
* @returns Longitude of the given MapObject LonLat
|
||||
* @type float
|
||||
* Parameters:
|
||||
* moLonLat - {Object} MapObject LonLat format
|
||||
*
|
||||
* Return:
|
||||
* {Float} Longitude of the given MapObject LonLat
|
||||
*/
|
||||
getLongitudeFromMapObjectLonLat: function(moLonLat) {
|
||||
return moLonLat.lng();
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} moLonLat MapObject LonLat format
|
||||
* APIMethod: getLatitudeFromMapObjectLonLat
|
||||
*
|
||||
* @returns Latitude of the given MapObject LonLat
|
||||
* @type float
|
||||
* Parameters:
|
||||
* moLonLat - {Object} MapObject LonLat format
|
||||
*
|
||||
* Return:
|
||||
* {Float} Latitude of the given MapObject LonLat
|
||||
*/
|
||||
getLatitudeFromMapObjectLonLat: function(moLonLat) {
|
||||
return moLonLat.lat();
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {int} lon float
|
||||
* @param {int} lat float
|
||||
* APIMethod: getMapObjectLonLatFromLonLat
|
||||
*
|
||||
* @returns MapObject LonLat built from lon and lat params
|
||||
* @type Object
|
||||
* Parameters:
|
||||
* lon - {Float}
|
||||
* lat - {Float}
|
||||
*
|
||||
* Return:
|
||||
* {Object} MapObject LonLat built from lon and lat params
|
||||
*/
|
||||
getMapObjectLonLatFromLonLat: function(lon, lat) {
|
||||
return new GLatLng(lat, lon);
|
||||
@@ -348,32 +409,41 @@ OpenLayers.Layer.Google.prototype =
|
||||
|
||||
// Pixel
|
||||
|
||||
/**
|
||||
* @param {Object} moPixel MapObject Pixel format
|
||||
/**
|
||||
* APIMethod: getXFromMapObjectPixel
|
||||
*
|
||||
* @returns X value of the MapObject Pixel
|
||||
* @type int
|
||||
* Parameters:
|
||||
* moPixel - {Object} MapObject Pixel format
|
||||
*
|
||||
* Return:
|
||||
* {Integer} X value of the MapObject Pixel
|
||||
*/
|
||||
getXFromMapObjectPixel: function(moPixel) {
|
||||
return moPixel.x;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} moPixel MapObject Pixel format
|
||||
/**
|
||||
* APIMethod: getYFromMapObjectPixel
|
||||
*
|
||||
* @returns Y value of the MapObject Pixel
|
||||
* @type int
|
||||
* Parameters:
|
||||
* moPixel - {Object} MapObject Pixel format
|
||||
*
|
||||
* Return:
|
||||
* {Integer} Y value of the MapObject Pixel
|
||||
*/
|
||||
getYFromMapObjectPixel: function(moPixel) {
|
||||
return moPixel.y;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {int} x
|
||||
* @param {int} y
|
||||
/**
|
||||
* APIMethod: getMapObjectPixelFromXY
|
||||
*
|
||||
* @returns MapObject Pixel from x and y parameters
|
||||
* @type Object
|
||||
* Parameters:
|
||||
* x - {Integer}
|
||||
* y - {Integer}
|
||||
*
|
||||
* Return:
|
||||
* {Object} MapObject Pixel from x and y parameters
|
||||
*/
|
||||
getMapObjectPixelFromXY: function(x, y) {
|
||||
return new GPoint(x, y);
|
||||
|
||||
@@ -4,32 +4,46 @@
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer/HTTPRequest.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.Grid
|
||||
* Base class for layers that use a lattice of tiles. Create a new grid
|
||||
* layer with the <OpenLayers.Layer.Grid> constructor.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Layer.HTTPRequest>
|
||||
*/
|
||||
OpenLayers.Layer.Grid = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.Grid.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer.HTTPRequest, {
|
||||
|
||||
/** @type OpenLayers.Size */
|
||||
/**
|
||||
* APIProperty: tileSize
|
||||
* {<OpenLayers.Size>}
|
||||
*/
|
||||
tileSize: null,
|
||||
|
||||
/** this is an array of rows, each row is an array of tiles
|
||||
*
|
||||
* @type Array(Array) */
|
||||
/**
|
||||
* Property: grid
|
||||
* {Array} This is an array of rows, each row is an array of tiles
|
||||
*/
|
||||
grid: null,
|
||||
|
||||
/** @type Integer */
|
||||
/**
|
||||
* APIProperty: buffer
|
||||
* {Integer}
|
||||
*/
|
||||
buffer: 2,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} url
|
||||
* @param {Object} params
|
||||
* @param {Object} options Hashtable of extra options to tag onto the layer
|
||||
* Constructor: OpenLayers.Layer.Grid
|
||||
* Create a new grid layer
|
||||
*
|
||||
* Parameters:
|
||||
* name - {String}
|
||||
* url - {String}
|
||||
* params - {Object}
|
||||
* options - {Object} Hashtable of extra options to tag onto the layer
|
||||
*/
|
||||
initialize: function(name, url, params, options) {
|
||||
OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,
|
||||
@@ -37,8 +51,9 @@ OpenLayers.Layer.Grid.prototype =
|
||||
this.grid = new Array();
|
||||
},
|
||||
|
||||
/** on destroy, clear the grid.
|
||||
*
|
||||
/**
|
||||
* APIMethod: destroy
|
||||
* Deconstruct the layer and clear the grid.
|
||||
*/
|
||||
destroy: function() {
|
||||
this.clearGrid();
|
||||
@@ -47,10 +62,10 @@ OpenLayers.Layer.Grid.prototype =
|
||||
OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this, arguments);
|
||||
},
|
||||
|
||||
/** go through and remove all tiles from the grid, calling
|
||||
/**
|
||||
* Method: clearGrid
|
||||
* Go through and remove all tiles from the grid, calling
|
||||
* destroy() on each of them to kill circular references
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
clearGrid:function() {
|
||||
if (this.grid) {
|
||||
@@ -65,10 +80,14 @@ OpenLayers.Layer.Grid.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} obj
|
||||
* APIMethod: clone
|
||||
* Create a clone of this layer
|
||||
*
|
||||
* Parameters:
|
||||
* obj - {Object} Is this ever used?
|
||||
*
|
||||
* @returns An exact clone of this OpenLayers.Layer.Grid
|
||||
* @type OpenLayers.Layer.Grid
|
||||
* Return:
|
||||
* {<OpenLayers.Layer.Grid>} An exact clone of this OpenLayers.Layer.Grid
|
||||
*/
|
||||
clone: function (obj) {
|
||||
|
||||
@@ -93,10 +112,13 @@ OpenLayers.Layer.Grid.prototype =
|
||||
return obj;
|
||||
},
|
||||
|
||||
/** When the layer is added to a map, then we can ask the map for
|
||||
/**
|
||||
* Method: setMap
|
||||
* When the layer is added to a map, then we can ask the map for
|
||||
* its default tile size
|
||||
*
|
||||
* @param {OpenLayers.Map} map
|
||||
*
|
||||
* Parameters:
|
||||
* map - {<OpenLayers.Map>}
|
||||
*/
|
||||
setMap: function(map) {
|
||||
OpenLayers.Layer.HTTPRequest.prototype.setMap.apply(this, arguments);
|
||||
@@ -105,13 +127,16 @@ OpenLayers.Layer.Grid.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
/** This function is called whenever the map is moved. All the moving
|
||||
/**
|
||||
* Method: moveTo
|
||||
* This function is called whenever the map is moved. All the moving
|
||||
* of actual 'tiles' is done by the map, but moveTo's role is to accept
|
||||
* a bounds and make sure the data that that bounds requires is pre-loaded.
|
||||
*
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
* @param {Boolean} zoomChanged
|
||||
* @param {Boolean} dragging
|
||||
*
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
* zoomChanged - {Boolean}
|
||||
* dragging - {Boolean}
|
||||
*/
|
||||
moveTo:function(bounds, zoomChanged, dragging) {
|
||||
OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this, arguments);
|
||||
@@ -157,12 +182,13 @@ OpenLayers.Layer.Grid.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
* Method: getGridBounds
|
||||
* Get the bounds of the grid
|
||||
*
|
||||
* @returns A Bounds object representing the bounds of all the currently
|
||||
* loaded tiles (including those partially or not at all seen
|
||||
* onscreen)
|
||||
* @type OpenLayers.Bounds
|
||||
* Return:
|
||||
* {<OpenLayers.Bounds>} A Bounds object representing the bounds of all the
|
||||
* currently loaded tiles (including those partially or not at all seen
|
||||
* onscreen)
|
||||
*/
|
||||
getGridBounds:function() {
|
||||
|
||||
@@ -179,7 +205,8 @@ OpenLayers.Layer.Grid.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
* Method: _initTiles
|
||||
* Initialize the tiles
|
||||
*/
|
||||
_initTiles:function() {
|
||||
|
||||
@@ -280,9 +307,8 @@ OpenLayers.Layer.Grid.prototype =
|
||||
this.spiralTileLoad();
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
/**
|
||||
* Method: spiralTileLoad
|
||||
* Starts at the top right corner of the grid and proceeds in a spiral
|
||||
* towards the center, adding tiles one at a time to the beginning of a
|
||||
* queue.
|
||||
@@ -355,23 +381,27 @@ OpenLayers.Layer.Grid.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* addTile gives subclasses of Grid the opportunity to create an
|
||||
* APIMethod: addTile
|
||||
* Gives subclasses of Grid the opportunity to create an
|
||||
* OpenLayer.Tile of their choosing. The implementer should initialize
|
||||
* the new tile and take whatever steps necessary to display it.
|
||||
*
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
* Parameters
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
*
|
||||
* @returns The added OpenLayers.Tile
|
||||
* @type OpenLayers.Tile
|
||||
* Return:
|
||||
* {<OpenLayers.Tile>} The added OpenLayers.Tile
|
||||
*/
|
||||
addTile:function(bounds, position) {
|
||||
// Should be implemented by subclasses
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: mergeNewParams
|
||||
* Once params have been changed, we will need to re-init our tiles
|
||||
*
|
||||
* @param {Object} newParams Hashtable of new params to use
|
||||
* Parameters:
|
||||
* newParams - {Object} Hashtable of new params to use
|
||||
*/
|
||||
mergeNewParams:function(newArguments) {
|
||||
OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this,
|
||||
@@ -384,9 +414,11 @@ OpenLayers.Layer.Grid.prototype =
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
* @param {Boolean} prepend if true, prepend to beginning.
|
||||
* Method: shiftRow
|
||||
* Shifty grid work
|
||||
*
|
||||
* Parameters:
|
||||
* prepend - {Boolean} if true, prepend to beginning.
|
||||
* if false, then append to end
|
||||
*/
|
||||
shiftRow:function(prepend) {
|
||||
@@ -417,9 +449,11 @@ OpenLayers.Layer.Grid.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
* @param {Boolean} prepend if true, prepend to beginning.
|
||||
* Method: shiftColumn
|
||||
* Shift grid work in the other dimension
|
||||
*
|
||||
* Parameters:
|
||||
* prepend - {Boolean} if true, prepend to beginning.
|
||||
* if false, then append to end
|
||||
*/
|
||||
shiftColumn: function(prepend) {
|
||||
@@ -448,6 +482,9 @@ OpenLayers.Layer.Grid.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
/**
|
||||
* Constant: CLASS_NAME
|
||||
* {String} Name of this class
|
||||
*/
|
||||
CLASS_NAME: "OpenLayers.Layer.Grid"
|
||||
});
|
||||
|
||||
@@ -4,47 +4,54 @@
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.HTTPRequest
|
||||
*
|
||||
* Inherits:
|
||||
* - OpenLayers.Layer
|
||||
*/
|
||||
OpenLayers.Layer.HTTPRequest = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.HTTPRequest.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer, {
|
||||
|
||||
/** Used to hash URL param strings for multi-WMS server selection.
|
||||
* Set to the Golden Ratio per Knuth's recommendation.
|
||||
*
|
||||
* @final @type Numeric
|
||||
/**
|
||||
* Constant: URL_HASH_FACTOR
|
||||
* {Float} Used to hash URL param strings for multi-WMS server selection.
|
||||
* Set to the Golden Ratio per Knuth's recommendation.
|
||||
*/
|
||||
URL_HASH_FACTOR: (Math.sqrt(5) - 1) / 2,
|
||||
|
||||
/** This is either an array of url strings or a single url string.
|
||||
*
|
||||
* @type Array(String) or String */
|
||||
/**
|
||||
* Property: url
|
||||
* {Array(String) or String} This is either an array of url strings or
|
||||
* a single url string.
|
||||
*/
|
||||
url: null,
|
||||
|
||||
/** Hashtable of key/value parameters
|
||||
*
|
||||
* @type Object */
|
||||
/**
|
||||
* Property: params
|
||||
* {Object} Hashtable of key/value parameters
|
||||
*/
|
||||
params: null,
|
||||
|
||||
/** Whether layer should reproject itself based on base layer locations.
|
||||
* This allows reprojection onto commercial layers. Default is false:
|
||||
* Most layers can't reproject, but layers which can create non-square
|
||||
* geographic pixels can, like WMS.
|
||||
*
|
||||
* @type Boolean
|
||||
/**
|
||||
* APIProperty: reproject
|
||||
* {Boolean} Whether layer should reproject itself based on base layer
|
||||
* locations. This allows reprojection onto commercial layers.
|
||||
* Default is false: Most layers can't reproject, but layers
|
||||
* which can create non-square geographic pixels can, like WMS.
|
||||
*/
|
||||
reproject: false,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Layer.HTTPRequest
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {Array(String) or String} url
|
||||
* @param {Object} params
|
||||
* @param {Object} options Hashtable of extra options to tag onto the layer
|
||||
* Parameters:
|
||||
* name - {String}
|
||||
* url - {Array(String) or String}
|
||||
* params - {Object}
|
||||
* options - {Object} Hashtable of extra options to tag onto the layer
|
||||
*/
|
||||
initialize: function(name, url, params, options) {
|
||||
var newArguments = arguments;
|
||||
@@ -55,7 +62,7 @@ OpenLayers.Layer.HTTPRequest.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* APIMethod: destroy
|
||||
*/
|
||||
destroy: function() {
|
||||
this.url = null;
|
||||
@@ -64,10 +71,14 @@ OpenLayers.Layer.HTTPRequest.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} obj
|
||||
* APIMethod: clone
|
||||
*
|
||||
* @returns An exact clone of this OpenLayers.Layer.HTTPRequest
|
||||
* @type OpenLayers.Layer.HTTPRequest
|
||||
* Parameters:
|
||||
* obj - {Object}
|
||||
*
|
||||
* Return:
|
||||
* {<OpenLayers.Layer.HTTPRequest>} An exact clone of this
|
||||
* <OpenLayers.Layer.HTTPRequest>
|
||||
*/
|
||||
clone: function (obj) {
|
||||
|
||||
@@ -87,33 +98,40 @@ OpenLayers.Layer.HTTPRequest.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {String} newUrl
|
||||
* APIMethod: setUrl
|
||||
*
|
||||
* Parameters:
|
||||
* newUrl - {String}
|
||||
*/
|
||||
setUrl: function(newUrl) {
|
||||
this.url = newUrl;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} newParams
|
||||
* APIMethod: mergeNewParams
|
||||
*
|
||||
* Parameters:
|
||||
* newParams - {Object}
|
||||
*/
|
||||
mergeNewParams:function(newParams) {
|
||||
this.params = OpenLayers.Util.extend(this.params, newParams);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: selectUrl
|
||||
* selectUrl() implements the standard floating-point multiplicative
|
||||
* hash function described by Knuth, and hashes the contents of the
|
||||
* given param string into a float between 0 and 1. This float is then
|
||||
* scaled to the size of the provided urls array, and used to select
|
||||
* a URL.
|
||||
* hash function described by Knuth, and hashes the contents of the
|
||||
* given param string into a float between 0 and 1. This float is then
|
||||
* scaled to the size of the provided urls array, and used to select
|
||||
* a URL.
|
||||
*
|
||||
* @param {String} paramString
|
||||
* @param {Array(String)} urls
|
||||
*
|
||||
* @returns An entry from the urls array, deterministically selected based
|
||||
* on the paramString.
|
||||
* @type String
|
||||
* Parameters:
|
||||
* paramString - {String}
|
||||
* urls - {Array(String)}
|
||||
*
|
||||
* Return:
|
||||
* {String} An entry from the urls array, deterministically selected based
|
||||
* on the paramString.
|
||||
*/
|
||||
selectUrl: function(paramString, urls) {
|
||||
var product = 1;
|
||||
@@ -124,7 +142,9 @@ OpenLayers.Layer.HTTPRequest.prototype =
|
||||
return urls[Math.floor(product * urls.length)];
|
||||
},
|
||||
|
||||
/** combine url with layer's params and these newParams.
|
||||
/**
|
||||
* Method: getFullRequestString
|
||||
* Combine url with layer's params and these newParams.
|
||||
*
|
||||
* does checking on the serverPath variable, allowing for cases when it
|
||||
* is supplied with trailing ? or &, as well as cases where not.
|
||||
@@ -134,11 +154,12 @@ OpenLayers.Layer.HTTPRequest.prototype =
|
||||
*
|
||||
* WARNING: The altUrl parameter is deprecated and will be removed in 3.0.
|
||||
*
|
||||
* @param {Object} newParams
|
||||
* @param {String} altUrl Use this as the url instead of the layer's url
|
||||
* Parameters:
|
||||
* newParams - {Object}
|
||||
* altUrl - {String} Use this as the url instead of the layer's url
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
* Return:
|
||||
* {String}
|
||||
*/
|
||||
getFullRequestString:function(newParams, altUrl) {
|
||||
|
||||
|
||||
@@ -3,57 +3,67 @@
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* @fileoverview Image Layer
|
||||
* @author Tim Schaub
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer.js
|
||||
* @requires OpenLayers/Tile/Image.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.Image
|
||||
* Instances of OpenLayers.Layer.Image are used to display data from a web
|
||||
* accessible image as a map layer. Create a new image layer with the
|
||||
* <OpenLayers.Layer.Image> constructor. Inherits from <OpenLayers.Layer>.
|
||||
*/
|
||||
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 */
|
||||
/**
|
||||
* Property: isBaseLayer
|
||||
* {Boolean} The layer is a base layer. Default is true. Set this property
|
||||
* in the layer options
|
||||
*/
|
||||
isBaseLayer: true,
|
||||
|
||||
/** @type String */
|
||||
/**
|
||||
* Property: url
|
||||
* {String} URL of the image to use
|
||||
*/
|
||||
url: null,
|
||||
|
||||
/**
|
||||
* The image bounds in map units
|
||||
* @type OpenLayers.Bounds
|
||||
* Property: extent
|
||||
* {<OpenLayers.Bounds>} The image bounds in map units
|
||||
*/
|
||||
extent: null,
|
||||
|
||||
/**
|
||||
* The image size in pixels
|
||||
* @type OpenLayers.Size
|
||||
* Property: size
|
||||
* {<OpenLayers.Size>} The image size in pixels
|
||||
*/
|
||||
size: null,
|
||||
|
||||
/** @type OpenLayers.Tile.Image */
|
||||
/**
|
||||
* Property: tile
|
||||
* {<OpenLayers.Tile.Image>}
|
||||
*/
|
||||
tile: null,
|
||||
|
||||
/**
|
||||
* The ratio of height/width represented by a single pixel in the graphic
|
||||
* @type Float */
|
||||
* Property: aspectRatio
|
||||
* {Float} The ratio of height/width represented by a single pixel in the
|
||||
* graphic
|
||||
*/
|
||||
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
|
||||
*/
|
||||
* Constructor: OpenLayers.Layer.Image
|
||||
* Create a new image layer
|
||||
*
|
||||
* Parameters:
|
||||
* name - {String} A name for the layer.
|
||||
* url - {String} Relative or absolute path to the image
|
||||
* extent - {<OpenLayers.Bounds>} The extent represented by the image
|
||||
* size - {<OpenLayers.Size>} The size (in pixels) of the image
|
||||
* options - {Object} Hashtable of extra options to tag onto the layer
|
||||
*/
|
||||
initialize: function(name, url, extent, size, options) {
|
||||
this.url = url;
|
||||
this.extent = extent;
|
||||
@@ -65,7 +75,8 @@ OpenLayers.Layer.Image.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* Method: destroy
|
||||
* Destroy this layer
|
||||
*/
|
||||
destroy: function() {
|
||||
if (this.tile) {
|
||||
@@ -76,10 +87,14 @@ OpenLayers.Layer.Image.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} obj
|
||||
*
|
||||
* @returns An exact clone of this OpenLayers.Layer.Image
|
||||
* @type OpenLayers.Layer.Image
|
||||
* Method: clone
|
||||
* Create a clone of this layer
|
||||
*
|
||||
* Paramters:
|
||||
* obj - {Object} An optional layer (is this ever used?)
|
||||
*
|
||||
* Return:
|
||||
* {<OpenLayers.Layer.Image>} An exact copy of this layer
|
||||
*/
|
||||
clone: function(obj) {
|
||||
|
||||
@@ -100,7 +115,10 @@ OpenLayers.Layer.Image.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Map} map
|
||||
* APIMethod: setMap
|
||||
*
|
||||
* Parameters:
|
||||
* map - {<OpenLayers.Map>}
|
||||
*/
|
||||
setMap: function(map) {
|
||||
/**
|
||||
@@ -117,11 +135,14 @@ OpenLayers.Layer.Image.prototype =
|
||||
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
|
||||
},
|
||||
|
||||
/** Create the tile for the image or resize it for the new resolution
|
||||
/**
|
||||
* Method: moveTo
|
||||
* Create the tile for the image or resize it for the new resolution
|
||||
*
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
* @param {Boolean} zoomChanged
|
||||
* @param {Boolean} dragging
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
* zoomChanged - {Boolean}
|
||||
* dragging - {Boolean}
|
||||
*/
|
||||
moveTo:function(bounds, zoomChanged, dragging) {
|
||||
OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
|
||||
@@ -163,23 +184,32 @@ OpenLayers.Layer.Image.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {String} newUrl
|
||||
* APIMethod: setUrl
|
||||
*
|
||||
* Parameters:
|
||||
* newUrl - {String}
|
||||
*/
|
||||
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)
|
||||
/**
|
||||
* APIMethod: getURL
|
||||
* 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
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
*/
|
||||
getURL: function(bounds) {
|
||||
return this.url;
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
/**
|
||||
* Constant: CLASS_NAME
|
||||
* {String} OpenLayers.Layer.Image
|
||||
*/
|
||||
CLASS_NAME: "OpenLayers.Layer.Image"
|
||||
});
|
||||
|
||||
@@ -4,29 +4,53 @@
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer/Grid.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.KaMap
|
||||
*
|
||||
* Inherits:
|
||||
* - <OpenLayers.Layer.Grid>
|
||||
*/
|
||||
OpenLayers.Layer.KaMap = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.KaMap.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer.Grid, {
|
||||
|
||||
/** KaMap Layer is always a base layer
|
||||
*
|
||||
* @type Boolean
|
||||
/**
|
||||
* APIProperty: isBaseLayer
|
||||
* {Boolean} KaMap Layer is always a base layer
|
||||
*/
|
||||
isBaseLayer: true,
|
||||
|
||||
|
||||
/**
|
||||
* APIProperty: units
|
||||
* {?}
|
||||
*/
|
||||
units: null,
|
||||
|
||||
/**
|
||||
* APIProperty: resolution
|
||||
* {Float}
|
||||
*/
|
||||
resolution: OpenLayers.DOTS_PER_INCH,
|
||||
|
||||
/**
|
||||
* Constant: DEFAULT_PARAMS
|
||||
* {Object}
|
||||
*/
|
||||
DEFAULT_PARAMS: {
|
||||
i: 'jpeg',
|
||||
map: ''
|
||||
},
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Layer.KaMap
|
||||
*
|
||||
* Parameters:
|
||||
* name - {String}
|
||||
* url - {String}
|
||||
* params - {Object}
|
||||
* options - {Object}
|
||||
*/
|
||||
initialize: function(name, url, params, options) {
|
||||
var newArguments = new Array();
|
||||
newArguments.push(name, url, params, options);
|
||||
@@ -41,12 +65,15 @@ OpenLayers.Layer.KaMap.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
* Method: getURL
|
||||
*
|
||||
* @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
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
*
|
||||
* Return:
|
||||
* {String} A string with the layer's url and parameters and also the
|
||||
* passed-in bounds and appropriate tile size specified as
|
||||
* parameters
|
||||
*/
|
||||
getURL: function (bounds) {
|
||||
bounds = this.adjustBounds(bounds);
|
||||
@@ -60,13 +87,26 @@ OpenLayers.Layer.KaMap.prototype =
|
||||
s: scale
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Method: addTile
|
||||
*
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
* position - {<OpenLayers.Pixel>}
|
||||
*
|
||||
* Return:
|
||||
* {<OpenLayers.Tile.Image>}
|
||||
*/
|
||||
addTile:function(bounds,position) {
|
||||
var url = this.getURL(bounds);
|
||||
return new OpenLayers.Tile.Image(this, position, bounds,
|
||||
url, this.tileSize);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Method: _initTiles
|
||||
*/
|
||||
_initTiles:function() {
|
||||
|
||||
var viewSize = this.map.getSize();
|
||||
@@ -148,10 +188,13 @@ OpenLayers.Layer.KaMap.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} obj
|
||||
* APIMethod: clone
|
||||
*
|
||||
* @returns An exact clone of this OpenLayers.Layer.Grid
|
||||
* @type OpenLayers.Layer.Grid
|
||||
* Parameters:
|
||||
* obj - {Object}
|
||||
*
|
||||
* Return:
|
||||
* {<OpenLayers.Layer.Kamap>} An exact clone of this OpenLayers.Layer.KaMap
|
||||
*/
|
||||
clone: function (obj) {
|
||||
|
||||
@@ -176,7 +219,6 @@ OpenLayers.Layer.KaMap.prototype =
|
||||
return obj;
|
||||
},
|
||||
|
||||
|
||||
/** @final @type String */
|
||||
CLASS_NAME: "OpenLayers.Layer.KaMap"
|
||||
});
|
||||
|
||||
@@ -3,26 +3,50 @@
|
||||
* for the full text of the license. */
|
||||
// @requires OpenLayers/Layer/Grid.js
|
||||
/**
|
||||
* @class
|
||||
* @requires OpenLayers/Layer/Grid.js
|
||||
*/
|
||||
*
|
||||
* Class: OpenLayers.Layer.MapServer
|
||||
* Instances of OpenLayers.Layer.MapServer are used to display
|
||||
* data from a MapServer CGI instance.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Layer.Grid>
|
||||
*/
|
||||
OpenLayers.Layer.MapServer = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.MapServer.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer.Grid, {
|
||||
|
||||
/** @final @type hash */
|
||||
/**
|
||||
* Constant: DEFAULT_PARAMS
|
||||
* {Object} Hashtable of default parameter key/value pairs
|
||||
*/
|
||||
DEFAULT_PARAMS: {
|
||||
mode: "map",
|
||||
map_imagetype: "png"
|
||||
},
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {str} name
|
||||
* @param {str} url
|
||||
* @param {hash} params
|
||||
*/
|
||||
/**
|
||||
* Constructor: OpenLayers.Layer.MapServer
|
||||
* Create a new MapServer layer object
|
||||
*
|
||||
* Example:
|
||||
* (code)
|
||||
* layer = new OpenLayers.Layer.MapServer( "OpenLayers WMS",
|
||||
* "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'},
|
||||
* {gutter: 15});
|
||||
* (end)
|
||||
*
|
||||
* Parameters:
|
||||
* name - {String} A name for the layer
|
||||
* url - {String} Base url for the MapServer CGI
|
||||
* (e.g. http://www2.dmsolutions.ca/cgi-bin/mapserv)
|
||||
* params - {Object} An object with key/value pairs representing the
|
||||
* GetMap query string parameters and parameter values.
|
||||
* options - {Ojbect} Hashtable of extra options to tag onto the layer
|
||||
*
|
||||
* Return:
|
||||
* A new OpenLayers.Layer.MapServer instance
|
||||
*/
|
||||
initialize: function(name, url, params, options) {
|
||||
var newArguments = new Array();
|
||||
newArguments.push(name, url, params, options);
|
||||
@@ -44,11 +68,12 @@ OpenLayers.Layer.MapServer.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} obj
|
||||
*
|
||||
* @returns A clone of this OpenLayers.Layer.MapServer
|
||||
* @type OpenLayers.Layer.MapServer
|
||||
*/
|
||||
* Method: clone
|
||||
* Create a clone of this layer
|
||||
*
|
||||
* Return:
|
||||
* {<OpenLayers.Layer.MapServer>} An exact clone of this layer
|
||||
*/
|
||||
clone: function (obj) {
|
||||
if (obj == null) {
|
||||
obj = new OpenLayers.Layer.MapServer(this.name,
|
||||
@@ -65,10 +90,10 @@ OpenLayers.Layer.MapServer.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* addTile creates a tile, initializes it (via 'draw' in this case), and
|
||||
* adds it to the layer div.
|
||||
* addTile creates a tile, initializes it, and
|
||||
* adds it to the layer div.
|
||||
*
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
* @param {<OpenLayers.Bounds>} bounds
|
||||
*
|
||||
* @returns The added OpenLayers.Tile.Image
|
||||
* @type OpenLayers.Tile.Image
|
||||
@@ -79,12 +104,16 @@ OpenLayers.Layer.MapServer.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @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
|
||||
* Method: getURL
|
||||
* Return a query string for this layer
|
||||
*
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>} A bounds representing the bbox for the
|
||||
* request
|
||||
*
|
||||
* Return:
|
||||
* {String} A string with the layer's url and parameters and also the
|
||||
* passed-in bounds and appropriate tile size specified as parameters
|
||||
*/
|
||||
getURL: function (bounds) {
|
||||
bounds = this.adjustBounds(bounds);
|
||||
@@ -105,17 +134,20 @@ OpenLayers.Layer.MapServer.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* getFullRequestString on MapServer layers is special, because we
|
||||
* do a regular expression replace on ',' in parameters to '+'.
|
||||
* This is why it is subclassed here.
|
||||
*
|
||||
* @param {Object} newParams Parameters to add to the default parameters
|
||||
* for the layer.
|
||||
* @param {String} altUrl Alternative base URL to use.
|
||||
*/
|
||||
* Method: getFullRequestString
|
||||
* combine the layer's url with its params and these newParams.
|
||||
*
|
||||
* Parameter: {Object} newParams
|
||||
* new parameters that should be added to the request string.
|
||||
*
|
||||
* Parameter: {String} altUrl
|
||||
* optional, replace the URL in the full request string with the
|
||||
* provided URL.
|
||||
*
|
||||
* Return: {String}
|
||||
* A string with the layer's url and parameters embedded in it.
|
||||
*/
|
||||
getFullRequestString:function(newParams, altUrl) {
|
||||
|
||||
|
||||
// use layer's url unless altUrl passed in
|
||||
var url = (altUrl == null) ? this.url : altUrl;
|
||||
|
||||
@@ -166,6 +198,9 @@ OpenLayers.Layer.MapServer.prototype =
|
||||
}
|
||||
return requestString;
|
||||
},
|
||||
/** @final @type String */
|
||||
/**
|
||||
* Constant: CLASS_NAME
|
||||
* {String} OpenLayers.Layer.MapServer
|
||||
*/
|
||||
CLASS_NAME: "OpenLayers.Layer.MapServer"
|
||||
});
|
||||
|
||||
@@ -2,44 +2,60 @@
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
/* Derived from the WMS/Untiled.js script by Stephen Woodbridge, 2007 */
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer/HTTPRequest.js
|
||||
* @requires OpenLayers/Layer/MapServer.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.MapServer.Untiled
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Layer.HTTPRequest>
|
||||
*/
|
||||
OpenLayers.Layer.MapServer.Untiled = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.MapServer.Untiled.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer.HTTPRequest, {
|
||||
|
||||
/** Hashtable of default parameter key/value pairs
|
||||
* @final @type Object */
|
||||
/**
|
||||
* Constant: default_params
|
||||
* Hashtable of default parameter key/value pairs
|
||||
*/
|
||||
default_params: {
|
||||
mode: "map",
|
||||
map_imagetype: "png"
|
||||
},
|
||||
|
||||
/**
|
||||
* APIProperty: reproject
|
||||
* {Boolean} 'stretch' tiles according to base layer.
|
||||
*/
|
||||
reproject: true,
|
||||
|
||||
/** the ratio of image/tile size to map size (this is the untiled buffer)
|
||||
* @type int */
|
||||
/**
|
||||
* APIProperty: ratio
|
||||
* {Float} the ratio of image/tile size to map size (this is the untiled
|
||||
* buffer)
|
||||
*/
|
||||
ratio: 1,
|
||||
|
||||
/** @type OpenLayers.Tile.Image */
|
||||
/**
|
||||
* Property: tile
|
||||
* {<OpenLayers.Tile.Image>}
|
||||
*/
|
||||
tile: null,
|
||||
|
||||
/** did the image finish loading before a new draw was initiated?
|
||||
* @type Boolean */
|
||||
/**
|
||||
* Propety: doneLoading
|
||||
* {Boolean} did the image finish loading before a new draw was initiated?
|
||||
*/
|
||||
doneLoading: false,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Layer.MapServer.Untiled
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} url
|
||||
* @param {Object} params
|
||||
* Parameters:
|
||||
* name - {String}
|
||||
* url - {String}
|
||||
* params - {Object}
|
||||
*/
|
||||
initialize: function(name, url, params, options) {
|
||||
var newArguments = [];
|
||||
@@ -60,7 +76,7 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* APIMethod: destroy
|
||||
*/
|
||||
destroy: function() {
|
||||
if (this.tile) {
|
||||
@@ -71,10 +87,12 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} obj
|
||||
* APIMethod: clone
|
||||
* obj - {Object}
|
||||
*
|
||||
* @returns An exact clone of this OpenLayers.Layer.MapServer.Untiled
|
||||
* @type OpenLayers.Layer.MapServer.Untiled
|
||||
* Returns:
|
||||
* {<OpenLayers.Layer.MapServer.Untiled>} An exact clone of this
|
||||
* OpenLayers.Layer.MapServer.Untiled
|
||||
*/
|
||||
clone: function (obj) {
|
||||
|
||||
@@ -94,15 +112,19 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
|
||||
},
|
||||
|
||||
|
||||
/** Once HTTPRequest has set the map, we can load the image div
|
||||
/**
|
||||
* Method: setMap
|
||||
* Once HTTPRequest has set the map, we can load the image div
|
||||
*
|
||||
* @param {OpenLayers.Map} map
|
||||
* Parameters:
|
||||
* map - {<OpenLayers.Map>}
|
||||
*/
|
||||
setMap: function(map) {
|
||||
OpenLayers.Layer.HTTPRequest.prototype.setMap.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: setTileSize
|
||||
* Set the tile size based on the map size. This also sets layer.imageSize
|
||||
* and layer.imageOffset for use by Tile.Image.
|
||||
*/
|
||||
@@ -115,12 +137,15 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
|
||||
this.imageOffset = new OpenLayers.Pixel(0, 0);
|
||||
},
|
||||
|
||||
/** When it is not a dragging move (ie when done dragging)
|
||||
/**
|
||||
* Method: moveTo
|
||||
* When it is not a dragging move (ie when done dragging)
|
||||
* reload and recenter the div.
|
||||
*
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
* @param {Boolean} zoomChanged
|
||||
* @param {Boolean} dragging
|
||||
*
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
* zoomChanged - {Boolean}
|
||||
* dragging - {Boolean}
|
||||
*/
|
||||
moveTo:function(bounds, zoomChanged, dragging) {
|
||||
if (!this.doneLoading) {
|
||||
@@ -190,7 +215,13 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Method: getURL
|
||||
*
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
*/
|
||||
getURL: function(bounds) {
|
||||
var url = this.getFullRequestString(
|
||||
{mapext:bounds.toBBOX().replace(/,/g," "),
|
||||
@@ -204,16 +235,24 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
|
||||
},
|
||||
|
||||
|
||||
/** Once HTTPRequest has updated the url, reload the image div
|
||||
* @param {String} newUrl
|
||||
/**
|
||||
* APIMehod: setUrl
|
||||
* Once HTTPRequest has updated the url, reload the image div
|
||||
*
|
||||
* Parameters:
|
||||
* newUrl - {String}
|
||||
*/
|
||||
setUrl: function(newUrl) {
|
||||
OpenLayers.Layer.HTTPRequest.prototype.setUrl.apply(this, arguments);
|
||||
this.moveTo();
|
||||
},
|
||||
|
||||
/** Once HTTPRequest has updated new params, reload the image div
|
||||
* @param {Object} newParams
|
||||
/**
|
||||
* APIMethod: mergeNewParams
|
||||
* Once HTTPRequest has updated new params, reload the image div
|
||||
*
|
||||
* Parameters:
|
||||
* newParams - {Object}
|
||||
*/
|
||||
mergeNewParams:function(newParams) {
|
||||
OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this,
|
||||
@@ -222,15 +261,16 @@ OpenLayers.Layer.MapServer.Untiled.prototype =
|
||||
this.moveTo(null, true);
|
||||
},
|
||||
|
||||
/** combine the layer's url with its params and these newParams.
|
||||
/**
|
||||
* APIMethod: getFullRequestString
|
||||
* combine the layer's url with its params and these newParams.
|
||||
*
|
||||
* Add the SRS parameter from 'projection' -- this is probably
|
||||
* more eloquently done via a setProjection() method, but this
|
||||
* works for now and always.
|
||||
*
|
||||
* @param {Object} newParams
|
||||
*
|
||||
* @type String
|
||||
*
|
||||
* Parameters:
|
||||
* newParams - {Object}
|
||||
*/
|
||||
getFullRequestString:function(newParams) {
|
||||
var projection = this.map.getProjection();
|
||||
|
||||
@@ -4,38 +4,43 @@
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer.js
|
||||
* Class: OpenLayers.Layer.Markers
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Layer>
|
||||
*/
|
||||
OpenLayers.Layer.Markers = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.Markers.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer, {
|
||||
|
||||
/** Markers layer is never a base layer.
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
isBaseLayer: false,
|
||||
/**
|
||||
* Property: isBaseLayer
|
||||
* {Boolean} Markers layer is never a base layer.
|
||||
*/
|
||||
isBaseLayer: false,
|
||||
|
||||
/** internal marker list
|
||||
* @type Array(OpenLayers.Marker) */
|
||||
markers: null,
|
||||
/**
|
||||
* Property: markers
|
||||
* Array({<OpenLayers.Marker>}) internal marker list
|
||||
*/
|
||||
markers: null,
|
||||
|
||||
|
||||
/** internal state of drawing. This is a workaround for the fact
|
||||
* that the map does not call moveTo with a zoomChanged when the
|
||||
* map is first starting up. This lets us catch the case where we
|
||||
* have *never* drawn the layer, and draw it even if the zoom hasn't
|
||||
* changed.
|
||||
* @type Boolean */
|
||||
drawn: false,
|
||||
/**
|
||||
* Property: drawn
|
||||
* {Boolean} internal state of drawing. This is a workaround for the fact
|
||||
* that the map does not call moveTo with a zoomChanged when the map is
|
||||
* first starting up. This lets us catch the case where we have *never*
|
||||
* drawn the layer, and draw it even if the zoom hasn't changed.
|
||||
*/
|
||||
drawn: false,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Layer.Markers
|
||||
* Create a Markers layer.
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {Object} options Hashtable of extra options to tag onto the layer
|
||||
* Parameters:
|
||||
* name - {String}
|
||||
* options - {Object} Hashtable of extra options to tag onto the layer
|
||||
*/
|
||||
initialize: function(name, options) {
|
||||
OpenLayers.Layer.prototype.initialize.apply(this, arguments);
|
||||
@@ -43,7 +48,7 @@ OpenLayers.Layer.Markers.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* Method: destroy
|
||||
*/
|
||||
destroy: function() {
|
||||
this.clearMarkers();
|
||||
@@ -53,9 +58,12 @@ OpenLayers.Layer.Markers.prototype =
|
||||
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
* @param {Boolean} zoomChanged
|
||||
* @param {Boolean} dragging
|
||||
* Method: moveTo
|
||||
*
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
* zoomChanged - {Boolean}
|
||||
* dragging - {Boolean}
|
||||
*/
|
||||
moveTo:function(bounds, zoomChanged, dragging) {
|
||||
OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
|
||||
@@ -67,7 +75,10 @@ OpenLayers.Layer.Markers.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Marker} marker
|
||||
* Method: addMarker
|
||||
*
|
||||
* Parameters:
|
||||
* marker - {<OpenLayers.Marker>}
|
||||
*/
|
||||
addMarker: function(marker) {
|
||||
this.markers.push(marker);
|
||||
@@ -78,7 +89,10 @@ OpenLayers.Layer.Markers.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Marker} marker
|
||||
* Method: removeMarker
|
||||
*
|
||||
* Parameters:
|
||||
* marker - {<OpenLayers.Marker>}
|
||||
*/
|
||||
removeMarker: function(marker) {
|
||||
OpenLayers.Util.removeItem(this.markers, marker);
|
||||
@@ -89,7 +103,7 @@ OpenLayers.Layer.Markers.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* Method: clearMarkers
|
||||
*/
|
||||
clearMarkers: function() {
|
||||
if (this.markers != null) {
|
||||
@@ -99,7 +113,9 @@ OpenLayers.Layer.Markers.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
/** clear all the marker div's from the layer and then redraw all of them.
|
||||
/**
|
||||
* Method: redraw
|
||||
* clear all the marker div's from the layer and then redraw all of them.
|
||||
* Use the map to recalculate new placement of markers.
|
||||
*/
|
||||
redraw: function() {
|
||||
@@ -108,12 +124,13 @@ OpenLayers.Layer.Markers.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
/** Calculate the pixel location for the marker, create it, and
|
||||
/**
|
||||
* Method: drawMarker
|
||||
* *Private*. Calculate the pixel location for the marker, create it, and
|
||||
* add it to the layer's div
|
||||
*
|
||||
* @private
|
||||
*
|
||||
* @param {OpenLayers.Marker} marker
|
||||
*
|
||||
* Parameters:
|
||||
* marker - {<OpenLayers.Marker>}
|
||||
*/
|
||||
drawMarker: function(marker) {
|
||||
var px = this.map.getLayerPxFromLonLat(marker.lonlat);
|
||||
|
||||
@@ -3,35 +3,51 @@
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer/EventPane.js
|
||||
* @requires OpenLayers/Layer/FixedZoomLevels.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.MultiMap
|
||||
*
|
||||
* Inherits:
|
||||
* - <OpenLayers.Layers.EventPane>
|
||||
* - <OpenLayers.Layers.FixedZoomLevels>
|
||||
*/
|
||||
OpenLayers.Layer.MultiMap = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.MultiMap.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer.EventPane,
|
||||
OpenLayers.Layer.FixedZoomLevels, {
|
||||
|
||||
/** @final @type int */
|
||||
/**
|
||||
* Constant: MIN_ZOOM_LEVEL
|
||||
* {Integer} 1
|
||||
*/
|
||||
MIN_ZOOM_LEVEL: 1,
|
||||
|
||||
/** @final @type int */
|
||||
/**
|
||||
* Constant: MAX_ZOOM_LEVEL
|
||||
* {Integer} 17
|
||||
*/
|
||||
MAX_ZOOM_LEVEL: 17,
|
||||
|
||||
/** Hardcode these resolutions so that they are more closely
|
||||
* tied with the standard wms projection
|
||||
*
|
||||
* @final @type Array(float) */
|
||||
/**
|
||||
* Constant: RESOLUTIONS
|
||||
* {Array(Float)} Hardcode these resolutions so that they are more closely
|
||||
* tied with the standard wms projection
|
||||
*/
|
||||
RESOLUTIONS: [9, 1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125],
|
||||
|
||||
/** @type VEMapType */
|
||||
/**
|
||||
* APIProperty: type
|
||||
* {?}
|
||||
*/
|
||||
type: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Layer.MultiMap
|
||||
*
|
||||
* @param {String} name
|
||||
* Parameters:
|
||||
* name - {String}
|
||||
* options - {Object}
|
||||
*/
|
||||
initialize: function(name, options) {
|
||||
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
|
||||
@@ -40,7 +56,7 @@ OpenLayers.Layer.MultiMap.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* Method: loadMapObject
|
||||
*/
|
||||
loadMapObject:function() {
|
||||
try { //crash proofing
|
||||
@@ -49,9 +65,11 @@ OpenLayers.Layer.MultiMap.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @return String with information on why layer is broken, how to get
|
||||
* APIMethod: getWarningHTML
|
||||
*
|
||||
* Return:
|
||||
* {String} String with information on why layer is broken, how to get
|
||||
* it working.
|
||||
* @type String
|
||||
*/
|
||||
getWarningHTML:function() {
|
||||
|
||||
@@ -84,26 +102,33 @@ OpenLayers.Layer.MultiMap.prototype =
|
||||
|
||||
// Get&Set Center, Zoom
|
||||
|
||||
/** Set the mapObject to the specified center and zoom
|
||||
/**
|
||||
* APIMethod: setMapObjectCenter
|
||||
* Set the mapObject to the specified center and zoom
|
||||
*
|
||||
* @param {Object} center MapObject LonLat format
|
||||
* @param {int} zoom MapObject zoom format
|
||||
* Parameters:
|
||||
* center - {Object} MapObject LonLat format
|
||||
* zoom - {int} MapObject zoom format
|
||||
*/
|
||||
setMapObjectCenter: function(center, zoom) {
|
||||
this.mapObject.goToPosition(center, zoom);
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns the mapObject's current center in Map Object format
|
||||
* @type Object
|
||||
* APIMethod: getMapObjectCenter
|
||||
*
|
||||
* Return:
|
||||
* {Object} The mapObject's current center in Map Object format
|
||||
*/
|
||||
getMapObjectCenter: function() {
|
||||
return this.mapObject.getCurrentPosition();
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns the mapObject's current zoom, in Map Object format
|
||||
* @type int
|
||||
* APIMethod: getMapObjectZoom
|
||||
*
|
||||
* Return:
|
||||
* {Integer} The mapObject's current zoom, in Map Object format
|
||||
*/
|
||||
getMapObjectZoom: function() {
|
||||
return this.mapObject.getZoomFactor();
|
||||
@@ -112,11 +137,14 @@ OpenLayers.Layer.MultiMap.prototype =
|
||||
|
||||
// LonLat - Pixel Translation
|
||||
|
||||
/**
|
||||
* @param {Object} moPixel MapObject Pixel format
|
||||
/**
|
||||
* APIMethod: getMapObjectLonLatFromMapObjectPixel
|
||||
*
|
||||
* @returns MapObject LonLat translated from MapObject Pixel
|
||||
* @type Object
|
||||
* Parameters:
|
||||
* moPixel - {Object} MapObject Pixel format
|
||||
*
|
||||
* Return:
|
||||
* {Object} MapObject LonLat translated from MapObject Pixel
|
||||
*/
|
||||
getMapObjectLonLatFromMapObjectPixel: function(moPixel) {
|
||||
moPixel.x = moPixel.x - (this.map.getSize().w/2);
|
||||
@@ -124,11 +152,14 @@ OpenLayers.Layer.MultiMap.prototype =
|
||||
return this.mapObject.getMapPositionAt(moPixel);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} moPixel MapObject Pixel format
|
||||
/**
|
||||
* APIMethod: getMapObjectPixelFromMapObjectLonLat
|
||||
*
|
||||
* @returns MapObject Pixel translated from MapObject LonLat
|
||||
* @type Object
|
||||
* Parameters:
|
||||
* moLonLat - {Object} MapObject LonLat format
|
||||
*
|
||||
* Return:
|
||||
* {Object} MapObject Pixel transtlated from MapObject LonLat
|
||||
*/
|
||||
getMapObjectPixelFromMapObjectLonLat: function(moLonLat) {
|
||||
return this.mapObject.geoPosToContainerPixels(moLonLat);
|
||||
@@ -145,31 +176,40 @@ OpenLayers.Layer.MultiMap.prototype =
|
||||
// LonLat
|
||||
|
||||
/**
|
||||
* @param {Object} moLonLat MapObject LonLat format
|
||||
* APIMethod: getLongitudeFromMapObjectLonLat
|
||||
*
|
||||
* @returns Longitude of the given MapObject LonLat
|
||||
* @type float
|
||||
* Parameters:
|
||||
* moLonLat - {Object} MapObject LonLat format
|
||||
*
|
||||
* Return:
|
||||
* {Float} Longitude of the given MapObject LonLat
|
||||
*/
|
||||
getLongitudeFromMapObjectLonLat: function(moLonLat) {
|
||||
return moLonLat.lon;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} moLonLat MapObject LonLat format
|
||||
* APIMethod: getLatitudeFromMapObjectLonLat
|
||||
*
|
||||
* @returns Latitude of the given MapObject LonLat
|
||||
* @type float
|
||||
* Parameters:
|
||||
* moLonLat - {Object} MapObject LonLat format
|
||||
*
|
||||
* Return:
|
||||
* {Float} Latitude of the given MapObject LonLat
|
||||
*/
|
||||
getLatitudeFromMapObjectLonLat: function(moLonLat) {
|
||||
return moLonLat.lat;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {int} lon float
|
||||
* @param {int} lat float
|
||||
* APIMethod: getMapObjectLonLatFromLonLat
|
||||
*
|
||||
* @returns MapObject LonLat built from lon and lat params
|
||||
* @type Object
|
||||
* Parameters:
|
||||
* lon - {Float}
|
||||
* lat - {Float}
|
||||
*
|
||||
* Return:
|
||||
* {Object} MapObject LonLat built from lon and lat params
|
||||
*/
|
||||
getMapObjectLonLatFromLonLat: function(lon, lat) {
|
||||
return new MMLatLon(lat, lon);
|
||||
@@ -177,38 +217,46 @@ OpenLayers.Layer.MultiMap.prototype =
|
||||
|
||||
// Pixel
|
||||
|
||||
/**
|
||||
* @param {Object} moPixel MapObject Pixel format
|
||||
/**
|
||||
* APIMethod: getXFromMapObjectPixel
|
||||
*
|
||||
* @returns X value of the MapObject Pixel
|
||||
* @type int
|
||||
* Parameters:
|
||||
* moPixel - {Object} MapObject Pixel format
|
||||
*
|
||||
* Return:
|
||||
* {Integer} X value of the MapObject Pixel
|
||||
*/
|
||||
getXFromMapObjectPixel: function(moPixel) {
|
||||
return moPixel.x;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} moPixel MapObject Pixel format
|
||||
/**
|
||||
* APIMethod: getYFromMapObjectPixel
|
||||
*
|
||||
* @returns Y value of the MapObject Pixel
|
||||
* @type int
|
||||
* Parameters:
|
||||
* moPixel - {Object} MapObject Pixel format
|
||||
*
|
||||
* Return:
|
||||
* {Integer} Y value of the MapObject Pixel
|
||||
*/
|
||||
getYFromMapObjectPixel: function(moPixel) {
|
||||
return moPixel.y;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {int} x
|
||||
* @param {int} y
|
||||
/**
|
||||
* APIMethod: getMapObjectPixelFromXY
|
||||
*
|
||||
* @returns MapObject Pixel from x and y parameters
|
||||
* @type Object
|
||||
* Parameters:
|
||||
* x - {Integer}
|
||||
* y - {Integer}
|
||||
*
|
||||
* Return:
|
||||
* {Object} MapObject Pixel from x and y parameters
|
||||
*/
|
||||
getMapObjectPixelFromXY: function(x, y) {
|
||||
return new MMPoint(x, y);
|
||||
},
|
||||
|
||||
|
||||
/** @final @type String */
|
||||
CLASS_NAME: "OpenLayers.Layer.MultiMap"
|
||||
});
|
||||
|
||||
+57
-31
@@ -4,27 +4,44 @@
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer/Grid.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.TMS
|
||||
*
|
||||
* Inherits:
|
||||
* - <OpenLayers.Layer.Grid>
|
||||
*/
|
||||
OpenLayers.Layer.TMS = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.TMS.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer.Grid, {
|
||||
|
||||
|
||||
/**
|
||||
* APIProperty: reproject
|
||||
* {Boolean}
|
||||
*/
|
||||
reproject: false,
|
||||
|
||||
/**
|
||||
* APIProperty: isBaseLayer
|
||||
* {Boolean}
|
||||
*/
|
||||
isBaseLayer: true,
|
||||
|
||||
/**
|
||||
* APIProperty: tileOrigin
|
||||
* {<OpenLayers.Pixel>}
|
||||
*/
|
||||
tileOrigin: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} url
|
||||
* @param {Object} params
|
||||
* @param {Object} options Hashtable of extra options to tag onto the layer
|
||||
*/
|
||||
* Constructor: OpenLayers.Layer.TMS
|
||||
*
|
||||
* Parameters:
|
||||
* name - {String}
|
||||
* url - {String}
|
||||
* params - {Object}
|
||||
* options - {Object} Hashtable of extra options to tag onto the layer
|
||||
*/
|
||||
initialize: function(name, url, options) {
|
||||
var newArguments = new Array();
|
||||
newArguments.push(name, url, {}, options);
|
||||
@@ -32,7 +49,7 @@ OpenLayers.Layer.TMS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* APIMethod:destroy
|
||||
*/
|
||||
destroy: function() {
|
||||
// for now, nothing special to do here.
|
||||
@@ -41,10 +58,13 @@ OpenLayers.Layer.TMS.prototype =
|
||||
|
||||
|
||||
/**
|
||||
* @param {Object} obj
|
||||
* APIMethod: clone
|
||||
*
|
||||
* @returns An exact clone of this OpenLayers.Layer.TMS
|
||||
* @type OpenLayers.Layer.TMS
|
||||
* Parameters:
|
||||
* obj - {Object}
|
||||
*
|
||||
* Return:
|
||||
* {<OpenLayers.Layer.TMS>} An exact clone of this <OpenLayers.Layer.TMS>
|
||||
*/
|
||||
clone: function (obj) {
|
||||
|
||||
@@ -63,12 +83,15 @@ OpenLayers.Layer.TMS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
* Method: getUrl
|
||||
*
|
||||
* @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
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
*
|
||||
* Return:
|
||||
* {String} A string with the layer's url and parameters and also the
|
||||
* passed-in bounds and appropriate tile size specified as
|
||||
* parameters
|
||||
*/
|
||||
getURL: function (bounds) {
|
||||
bounds = this.adjustBounds(bounds);
|
||||
@@ -85,24 +108,28 @@ OpenLayers.Layer.TMS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* addTile creates a tile, initializes it, and
|
||||
* adds it to the layer div.
|
||||
*
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
*
|
||||
* @returns The added OpenLayers.Tile.Image
|
||||
* @type OpenLayers.Tile.Image
|
||||
*/
|
||||
* Method: addTile
|
||||
* addTile creates a tile, initializes it, and adds it to the layer div.
|
||||
*
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
*
|
||||
* Return:
|
||||
* {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
|
||||
*/
|
||||
addTile:function(bounds,position) {
|
||||
var url = this.getURL(bounds);
|
||||
return new OpenLayers.Tile.Image(this, position, bounds,
|
||||
url, this.tileSize);
|
||||
},
|
||||
|
||||
/** When the layer is added to a map, then we can fetch our origin
|
||||
* (if we don't have one.)
|
||||
/**
|
||||
* APIMethod: setMap
|
||||
* When the layer is added to a map, then we can fetch our origin
|
||||
* (if we don't have one.)
|
||||
*
|
||||
* @param {OpenLayers.Map} map
|
||||
* Parameters:
|
||||
* map - {<OpenLayers.Map>}
|
||||
*/
|
||||
setMap: function(map) {
|
||||
OpenLayers.Layer.Grid.prototype.setMap.apply(this, arguments);
|
||||
@@ -112,7 +139,6 @@ OpenLayers.Layer.TMS.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/** @final @type String */
|
||||
CLASS_NAME: "OpenLayers.Layer.TMS"
|
||||
});
|
||||
|
||||
@@ -4,31 +4,45 @@
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer/Markers.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.Text
|
||||
* Tab seperated values file parsing code which creates a markers layer.
|
||||
*
|
||||
* Inherits from;
|
||||
* - <OpenLayers.Layer.Markers>
|
||||
*/
|
||||
OpenLayers.Layer.Text = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.Text.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer.Markers, {
|
||||
|
||||
/** store url of text file - this should be specified in the
|
||||
* "options" hashtable
|
||||
* @type str */
|
||||
/**
|
||||
* APIProperty: location
|
||||
* {String} store url of text file - this should be specified in the
|
||||
* "options" hashtable. Can not be changed once passed in.
|
||||
*/
|
||||
location:null,
|
||||
|
||||
/** @type Array(OpenLayers.Feature) */
|
||||
/**
|
||||
* Property: features
|
||||
* Array({<OpenLayers.Feature>})
|
||||
*/
|
||||
features: null,
|
||||
|
||||
/** @type OpenLayers.Feature */
|
||||
/**
|
||||
* Property: selectedFeature
|
||||
* {<OpenLayers.Feature>}
|
||||
*/
|
||||
selectedFeature: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} location
|
||||
* @param {Object} options Hashtable of extra options to tag onto the layer
|
||||
* Constructor: OpenLayers.Layer.Text
|
||||
* Create a text layer.
|
||||
*
|
||||
* Parameters:
|
||||
* name - {String}
|
||||
* options - {Object} Hashtable of extra options to tag onto
|
||||
* the layer. Must include "location" property.
|
||||
*/
|
||||
initialize: function(name, options) {
|
||||
OpenLayers.Layer.Markers.prototype.initialize.apply(this, arguments);
|
||||
@@ -39,7 +53,7 @@ OpenLayers.Layer.Text.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* APIMethod: destroy
|
||||
*/
|
||||
destroy: function() {
|
||||
this.clearFeatures();
|
||||
@@ -49,7 +63,10 @@ OpenLayers.Layer.Text.prototype =
|
||||
|
||||
|
||||
/**
|
||||
* @param {XMLHttpRequest} ajaxRequest
|
||||
* Method: parseData
|
||||
*
|
||||
* Parameters:
|
||||
* ajaxRequest - {XMLHttpRequest}
|
||||
*/
|
||||
parseData: function(ajaxRequest) {
|
||||
var text = ajaxRequest.responseText;
|
||||
@@ -137,7 +154,10 @@ OpenLayers.Layer.Text.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Event} evt
|
||||
* Property: markerClick
|
||||
*
|
||||
* Parameters:
|
||||
* evt - {Event}
|
||||
*/
|
||||
markerClick: function(evt) {
|
||||
sameMarkerClicked = (this == this.layer.selectedFeature);
|
||||
@@ -152,7 +172,7 @@ OpenLayers.Layer.Text.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* Method: clearFeatures
|
||||
*/
|
||||
clearFeatures: function() {
|
||||
if (this.features != null) {
|
||||
|
||||
+129
-61
@@ -3,71 +3,107 @@
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer.js
|
||||
* @requires OpenLayers/Renderer.js
|
||||
* @requires OpenLayers/Feature/Vector.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.Vector
|
||||
* Instances of OpenLayers.Layer.Vector are used to render vector data from
|
||||
* a variety of sources. Create a new image layer with the
|
||||
* <OpenLayers.Layer.Vector> constructor.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Layer>
|
||||
*/
|
||||
OpenLayers.Layer.Vector = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.Vector.prototype =
|
||||
OpenLayers.Class.inherit(OpenLayers.Layer, {
|
||||
|
||||
/** @type Boolean */
|
||||
/**
|
||||
* APIProperty: isBaseLayer
|
||||
* {Boolean} The layer is a base layer. Default is true. Set this property
|
||||
* in the layer options
|
||||
*/
|
||||
isBaseLayer: false,
|
||||
|
||||
/** @type Boolean */
|
||||
/**
|
||||
* APIProperty: isFixed
|
||||
* {Boolean} Whether the layer remains in one place while dragging the
|
||||
* map.
|
||||
*/
|
||||
isFixed: false,
|
||||
|
||||
/** @type Boolean */
|
||||
/**
|
||||
* APIProperty: isVector
|
||||
* {Boolean} Whether the layer is a vector layer.
|
||||
*/
|
||||
isVector: true,
|
||||
|
||||
/** @type Array(OpenLayer.Feature.Vector) */
|
||||
/**
|
||||
* APIProperty: features
|
||||
* Array({<OpenLayers.Feature.Vector>})
|
||||
*/
|
||||
features: null,
|
||||
|
||||
/** @type Array(OpenLayers.Feature.Vector) */
|
||||
/**
|
||||
* Property: selectedFeatures
|
||||
* Array({<OpenLayers.Feature.Vector>})
|
||||
*/
|
||||
selectedFeatures: null,
|
||||
|
||||
/** @type {Boolean} */
|
||||
/**
|
||||
* APIProperty: reportError
|
||||
* {Boolean} report error message via alert() when loading of renderers
|
||||
* fails.
|
||||
*/
|
||||
reportError: true,
|
||||
|
||||
/** @type {Object} */
|
||||
/**
|
||||
* APIProperty: style
|
||||
* {Object} Default style for the layer
|
||||
*/
|
||||
style: null,
|
||||
|
||||
/**
|
||||
* List of supported Renderer classes. Add to this list to
|
||||
* Property: renderers
|
||||
* Array({String}) List of supported Renderer classes. Add to this list to
|
||||
* add support for additional renderers. This list is ordered:
|
||||
* the first renderer which returns true for the 'supported()'
|
||||
* method will be used, if not defined in the 'renderer' option.
|
||||
*
|
||||
* @type {Array(String)}
|
||||
*/
|
||||
renderers: ['SVG', 'VML'],
|
||||
|
||||
/** @type OpenLayers.Renderer */
|
||||
/**
|
||||
* Property: renderer
|
||||
* {<OpenLayers.Renderer>}
|
||||
*/
|
||||
renderer: null,
|
||||
|
||||
/**
|
||||
* geometryType allows you to limit the types of geometries this
|
||||
* layer supports. This should be set to something like
|
||||
* APIProperty: geometryType
|
||||
* {String} geometryType allows you to limit the types of geometries this
|
||||
* layer supports. This should be set to something like
|
||||
* "OpenLayers.Geometry.Point" to limit types.
|
||||
*
|
||||
* @type string
|
||||
*/
|
||||
geometryType: null,
|
||||
|
||||
/** Whether the Vector Layer features have been drawn yet.
|
||||
*
|
||||
* @type boolean
|
||||
/**
|
||||
* Property: drawn
|
||||
* {Boolean} Whether the Vector Layer features have been drawn yet.
|
||||
*/
|
||||
drawn: false,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Layer.Vector
|
||||
* Create a new vector layer
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {Object} options Hashtable of extra options to tag onto the layer.
|
||||
* Options renderer {Object}: Typically SVGRenderer or VMLRenderer.
|
||||
* Parameters:
|
||||
* name - {String} A name for the layer
|
||||
* options - {Object} options Object with non-default properties to set on
|
||||
* the layer.
|
||||
*
|
||||
* Return:
|
||||
* {<OpenLayers.Layer.Vector>} A new vector layer
|
||||
*/
|
||||
initialize: function(name, options) {
|
||||
|
||||
@@ -92,7 +128,8 @@ OpenLayers.Layer.Vector.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* APIMethod: destroy
|
||||
* Destroy this layer
|
||||
*/
|
||||
destroy: function() {
|
||||
OpenLayers.Layer.prototype.destroy.apply(this, arguments);
|
||||
@@ -108,11 +145,10 @@ OpenLayers.Layer.Vector.prototype =
|
||||
this.drawn = null;
|
||||
},
|
||||
|
||||
/** Iterates through the available renderer implementations and selects
|
||||
* and assigns the first one whose "supported()" function returns true.
|
||||
*
|
||||
* @private
|
||||
*
|
||||
/**
|
||||
* Method: assignRenderer
|
||||
* Iterates through the available renderer implementations and selects
|
||||
* and assigns the first one whose "supported()" function returns true.
|
||||
*/
|
||||
assignRenderer: function() {
|
||||
for (var i = 0; i < this.renderers.length; i++) {
|
||||
@@ -125,10 +161,8 @@ OpenLayers.Layer.Vector.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: displayError
|
||||
* Let the user know their browser isn't supported.
|
||||
*
|
||||
* @private
|
||||
*
|
||||
*/
|
||||
displayError: function() {
|
||||
if (this.reportError) {
|
||||
@@ -139,12 +173,15 @@ OpenLayers.Layer.Vector.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
/** The layer has been added to the map.
|
||||
/**
|
||||
* Method: setMap
|
||||
* The layer has been added to the map.
|
||||
*
|
||||
* If there is no renderer set, the layer can't be used. Remove it.
|
||||
* Otherwise, give the renderer a reference to the map and set its size.
|
||||
* If there is no renderer set, the layer can't be used. Remove it.
|
||||
* Otherwise, give the renderer a reference to the map and set its size.
|
||||
*
|
||||
* @param {OpenLayers.Map} map
|
||||
* Parameters:
|
||||
* map - {<OpenLayers.Map>}
|
||||
*/
|
||||
setMap: function(map) {
|
||||
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
|
||||
@@ -157,7 +194,9 @@ OpenLayers.Layer.Vector.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
/** Notify the renderer of the change in size.
|
||||
/**
|
||||
* Method: onMapResize
|
||||
* Notify the renderer of the change in size.
|
||||
*
|
||||
*/
|
||||
onMapResize: function() {
|
||||
@@ -165,7 +204,9 @@ OpenLayers.Layer.Vector.prototype =
|
||||
this.renderer.setSize(this.map.getSize());
|
||||
},
|
||||
|
||||
/** Reset the vector layer's div so that it once again is lined up with
|
||||
/**
|
||||
* Method: moveTo
|
||||
* Reset the vector layer's div so that it once again is lined up with
|
||||
* the map. Notify the renderer of the change of extent, and in the
|
||||
* case of a change of zoom level (resolution), have the
|
||||
* renderer redraw features.
|
||||
@@ -173,9 +214,10 @@ OpenLayers.Layer.Vector.prototype =
|
||||
* If the layer has not yet been drawn, cycle through the layer's
|
||||
* features and draw each one.
|
||||
*
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
* @param {Boolean} zoomChanged
|
||||
* @param {Boolean} dragging
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
* zoomChanged - {Boolean}
|
||||
* dragging - {Boolean}
|
||||
*/
|
||||
moveTo: function(bounds, zoomChanged, dragging) {
|
||||
OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
|
||||
@@ -197,7 +239,11 @@ OpenLayers.Layer.Vector.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Array(OpenLayers.Feature.Vector} features
|
||||
* APIMethod: addFeatures
|
||||
* Add Features to the layer.
|
||||
*
|
||||
* Parameters:
|
||||
* features - {Array(<OpenLayers.Feature.Vector>)}
|
||||
*/
|
||||
addFeatures: function(features) {
|
||||
if (!(features instanceof Array)) {
|
||||
@@ -235,7 +281,10 @@ OpenLayers.Layer.Vector.prototype =
|
||||
|
||||
|
||||
/**
|
||||
* @param {Array(OpenLayers.Feature.Vector} features
|
||||
* APIMethod: removeFeatures
|
||||
*
|
||||
* Parameters:
|
||||
* features - {Array(<OpenLayers.Feature.Vector>)}
|
||||
*/
|
||||
removeFeatures: function(features) {
|
||||
if (!(features instanceof Array)) {
|
||||
@@ -259,6 +308,7 @@ OpenLayers.Layer.Vector.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: destroyFeatures
|
||||
* Destroy all features on the layer and empty the selected features array.
|
||||
*/
|
||||
destroyFeatures: function () {
|
||||
@@ -269,13 +319,15 @@ OpenLayers.Layer.Vector.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: drawFeature
|
||||
* Draw (or redraw) a feature on the layer. If the optional style argument
|
||||
* is included, this style will be used. If no style is included, the
|
||||
* feature's style will be used. If the feature doesn't have a style,
|
||||
* the layer's style will be used.
|
||||
*
|
||||
* @param {OpenLayers.Feature.Vector} feature
|
||||
* @param {Object} style
|
||||
* Parameters:
|
||||
* feature - {<OpenLayers.Feature.Vector>}
|
||||
* style - {Object}
|
||||
*/
|
||||
drawFeature: function(feature, style) {
|
||||
if(style == null) {
|
||||
@@ -289,21 +341,26 @@ OpenLayers.Layer.Vector.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: eraseFeatures
|
||||
* Erase features from the layer.
|
||||
*
|
||||
* @param {Array(OpenLayers.Feature.Vector)} features
|
||||
*
|
||||
* Parameters:
|
||||
* features - {Array(OpenLayers.Feature.Vector)}
|
||||
*/
|
||||
eraseFeatures: function(features) {
|
||||
this.renderer.eraseFeatures(features);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: getFeatureFromEvent
|
||||
* Given an event, return a feature if the event occurred over one.
|
||||
* Otherwise, return null.
|
||||
*
|
||||
* @param {Event}
|
||||
* @type OpenLayers.Feature.Vector
|
||||
* @return A feature if one was under the event
|
||||
* Parameters:
|
||||
* evt - {Event}
|
||||
*
|
||||
* Returns:
|
||||
* {<OpenLayers.Feature.Vector>} A feature if one was under the event.
|
||||
*/
|
||||
getFeatureFromEvent: function(evt) {
|
||||
var featureId = this.renderer.getFeatureIdFromEvent(evt);
|
||||
@@ -311,11 +368,15 @@ OpenLayers.Layer.Vector.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: getFeatureById
|
||||
* Given a feature id, return the feature if it exists in the features array
|
||||
*
|
||||
* @param {String} featureId
|
||||
* @type OpenLayers.Feature.Vector
|
||||
* @return A feature corresponding to the given featureId
|
||||
*
|
||||
* Parameters:
|
||||
* featureId - {String}
|
||||
*
|
||||
* Returns:
|
||||
* {<OpenLayers.Feature.Vector>} A feature corresponding to the given
|
||||
* featureId
|
||||
*/
|
||||
getFeatureById: function(featureId) {
|
||||
//TBD - would it be more efficient to use a hash for this.features?
|
||||
@@ -346,26 +407,33 @@ OpenLayers.Layer.Vector.prototype =
|
||||
|
||||
|
||||
/**
|
||||
* method called when a feature is inserted.
|
||||
* APIMethod: onFeatureInsert
|
||||
* method called after a feature is inserted.
|
||||
* Does nothing by default. Override this if you
|
||||
* need to do something on feature updates.
|
||||
*
|
||||
* @param {OpenLayers.Feature.Vector} feature
|
||||
*
|
||||
* Paarameters:
|
||||
* feature - {<OpenLayers.Feature.Vector>}
|
||||
*/
|
||||
onFeatureInsert: function(feature) {
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: preFeatureInsert
|
||||
* method called before a feature is inserted.
|
||||
* Does nothing by default. Override this if you
|
||||
* need to do something when features are first added to the
|
||||
* layer, but before they are drawn, such as adjust the style.
|
||||
*
|
||||
* @param {OpenLayers.Feature.Vector} feature
|
||||
*
|
||||
* Parameters:
|
||||
* feature - {<OpenLayers.Feature.Vector>}
|
||||
*/
|
||||
preFeatureInsert: function(feature) {
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
/**
|
||||
* Constant: CLASS_NAME
|
||||
* {String} 'OpenLayers.Layer.Vector'
|
||||
*/
|
||||
CLASS_NAME: "OpenLayers.Layer.Vector"
|
||||
});
|
||||
|
||||
@@ -4,35 +4,51 @@
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer/EventPane.js
|
||||
* @requires OpenLayers/Layer/FixedZoomLevels.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.VirtualEarth
|
||||
*
|
||||
* Inherits:
|
||||
* - <OpenLayers.Layer.EventPane>
|
||||
* - <OpenLayers.Layer.FixedZoomLevels>
|
||||
*/
|
||||
OpenLayers.Layer.VirtualEarth = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.VirtualEarth.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer.EventPane,
|
||||
OpenLayers.Layer.FixedZoomLevels, {
|
||||
|
||||
/** @final @type int */
|
||||
/**
|
||||
* Constant: MIN_ZOOM_LEVEL
|
||||
* {Integer} 1
|
||||
*/
|
||||
MIN_ZOOM_LEVEL: 1,
|
||||
|
||||
/** @final @type int */
|
||||
/**
|
||||
* Constant: MAX_ZOOM_LEVEL
|
||||
* {Integer} 17
|
||||
*/
|
||||
MAX_ZOOM_LEVEL: 17,
|
||||
|
||||
/** Hardcode these resolutions so that they are more closely
|
||||
* tied with the standard wms projection
|
||||
*
|
||||
* @final @type Array(float) */
|
||||
/**
|
||||
* Constant: RESOLUTIONS
|
||||
* {Array(Float)} Hardcode these resolutions so that they are more closely
|
||||
* tied with the standard wms projection
|
||||
*/
|
||||
RESOLUTIONS: [1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125],
|
||||
|
||||
/** @type VEMapType */
|
||||
/**
|
||||
* APIProperty: type
|
||||
* {VEMapType}
|
||||
*/
|
||||
type: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Layer.VirtualEarth
|
||||
*
|
||||
* @param {String} name
|
||||
* Parameters:
|
||||
* name - {String}
|
||||
* options - {Object}
|
||||
*/
|
||||
initialize: function(name, options) {
|
||||
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
|
||||
@@ -41,7 +57,7 @@ OpenLayers.Layer.VirtualEarth.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* Method: loadMapObject
|
||||
*/
|
||||
loadMapObject:function() {
|
||||
|
||||
@@ -65,9 +81,11 @@ OpenLayers.Layer.VirtualEarth.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @return String with information on why layer is broken, how to get
|
||||
* APIMethod: getWarningHTML
|
||||
*
|
||||
* Return:
|
||||
* {String} String with information on why layer is broken, how to get
|
||||
* it working.
|
||||
* @type String
|
||||
*/
|
||||
getWarningHTML:function() {
|
||||
|
||||
@@ -100,26 +118,33 @@ OpenLayers.Layer.VirtualEarth.prototype =
|
||||
|
||||
// Get&Set Center, Zoom
|
||||
|
||||
/** Set the mapObject to the specified center and zoom
|
||||
/**
|
||||
* APIMethod: setMapObjectCenter
|
||||
* Set the mapObject to the specified center and zoom
|
||||
*
|
||||
* @param {Object} center MapObject LonLat format
|
||||
* @param {int} zoom MapObject zoom format
|
||||
* Parameters:
|
||||
* center - {Object} MapObject LonLat format
|
||||
* zoom - {int} MapObject zoom format
|
||||
*/
|
||||
setMapObjectCenter: function(center, zoom) {
|
||||
this.mapObject.SetCenterAndZoom(center, zoom);
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns the mapObject's current center in Map Object format
|
||||
* @type Object
|
||||
* APIMethod: getMapObjectCenter
|
||||
*
|
||||
* Return:
|
||||
* {Object} The mapObject's current center in Map Object format
|
||||
*/
|
||||
getMapObjectCenter: function() {
|
||||
return this.mapObject.GetCenter();
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns the mapObject's current zoom, in Map Object format
|
||||
* @type int
|
||||
* APIMethod: getMapObjectZoom
|
||||
*
|
||||
* Return:
|
||||
* {Integer} The mapObject's current zoom, in Map Object format
|
||||
*/
|
||||
getMapObjectZoom: function() {
|
||||
return this.mapObject.GetZoomLevel();
|
||||
@@ -128,21 +153,27 @@ OpenLayers.Layer.VirtualEarth.prototype =
|
||||
|
||||
// LonLat - Pixel Translation
|
||||
|
||||
/**
|
||||
* @param {Object} moPixel MapObject Pixel format
|
||||
/**
|
||||
* APIMethod: getMapObjectLonLatFromMapObjectPixel
|
||||
*
|
||||
* @returns MapObject LonLat translated from MapObject Pixel
|
||||
* @type Object
|
||||
* Parameters:
|
||||
* moPixel - {Object} MapObject Pixel format
|
||||
*
|
||||
* Return:
|
||||
* {Object} MapObject LonLat translated from MapObject Pixel
|
||||
*/
|
||||
getMapObjectLonLatFromMapObjectPixel: function(moPixel) {
|
||||
return this.mapObject.PixelToLatLong(moPixel.x, moPixel.y);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} moPixel MapObject Pixel format
|
||||
/**
|
||||
* APIMethod: getMapObjectPixelFromMapObjectLonLat
|
||||
*
|
||||
* @returns MapObject Pixel translated from MapObject LonLat
|
||||
* @type Object
|
||||
* Parameters:
|
||||
* moLonLat - {Object} MapObject LonLat format
|
||||
*
|
||||
* Return:
|
||||
* {Object} MapObject Pixel transtlated from MapObject LonLat
|
||||
*/
|
||||
getMapObjectPixelFromMapObjectLonLat: function(moLonLat) {
|
||||
return this.mapObject.LatLongToPixel(moLonLat);
|
||||
@@ -159,31 +190,40 @@ OpenLayers.Layer.VirtualEarth.prototype =
|
||||
// LonLat
|
||||
|
||||
/**
|
||||
* @param {Object} moLonLat MapObject LonLat format
|
||||
* APIMethod: getLongitudeFromMapObjectLonLat
|
||||
*
|
||||
* @returns Longitude of the given MapObject LonLat
|
||||
* @type float
|
||||
* Parameters:
|
||||
* moLonLat - {Object} MapObject LonLat format
|
||||
*
|
||||
* Return:
|
||||
* {Float} Longitude of the given MapObject LonLat
|
||||
*/
|
||||
getLongitudeFromMapObjectLonLat: function(moLonLat) {
|
||||
return moLonLat.Longitude;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} moLonLat MapObject LonLat format
|
||||
* APIMethod: getLatitudeFromMapObjectLonLat
|
||||
*
|
||||
* @returns Latitude of the given MapObject LonLat
|
||||
* @type float
|
||||
* Parameters:
|
||||
* moLonLat - {Object} MapObject LonLat format
|
||||
*
|
||||
* Return:
|
||||
* {Float} Latitude of the given MapObject LonLat
|
||||
*/
|
||||
getLatitudeFromMapObjectLonLat: function(moLonLat) {
|
||||
return moLonLat.Latitude;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {int} lon float
|
||||
* @param {int} lat float
|
||||
* APIMethod: getMapObjectLonLatFromLonLat
|
||||
*
|
||||
* @returns MapObject LonLat built from lon and lat params
|
||||
* @type Object
|
||||
* Parameters:
|
||||
* lon - {Float}
|
||||
* lat - {Float}
|
||||
*
|
||||
* Return:
|
||||
* {Object} MapObject LonLat built from lon and lat params
|
||||
*/
|
||||
getMapObjectLonLatFromLonLat: function(lon, lat) {
|
||||
return new VELatLong(lat, lon);
|
||||
@@ -191,38 +231,46 @@ OpenLayers.Layer.VirtualEarth.prototype =
|
||||
|
||||
// Pixel
|
||||
|
||||
/**
|
||||
* @param {Object} moPixel MapObject Pixel format
|
||||
/**
|
||||
* APIMethod: getXFromMapObjectPixel
|
||||
*
|
||||
* @returns X value of the MapObject Pixel
|
||||
* @type int
|
||||
* Parameters:
|
||||
* moPixel - {Object} MapObject Pixel format
|
||||
*
|
||||
* Return:
|
||||
* {Integer} X value of the MapObject Pixel
|
||||
*/
|
||||
getXFromMapObjectPixel: function(moPixel) {
|
||||
return moPixel.x;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} moPixel MapObject Pixel format
|
||||
/**
|
||||
* APIMethod: getYFromMapObjectPixel
|
||||
*
|
||||
* @returns Y value of the MapObject Pixel
|
||||
* @type int
|
||||
* Parameters:
|
||||
* moPixel - {Object} MapObject Pixel format
|
||||
*
|
||||
* Return:
|
||||
* {Integer} Y value of the MapObject Pixel
|
||||
*/
|
||||
getYFromMapObjectPixel: function(moPixel) {
|
||||
return moPixel.y;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {int} x
|
||||
* @param {int} y
|
||||
/**
|
||||
* APIMethod: getMapObjectPixelFromXY
|
||||
*
|
||||
* @returns MapObject Pixel from x and y parameters
|
||||
* @type Object
|
||||
* Parameters:
|
||||
* x - {Integer}
|
||||
* y - {Integer}
|
||||
*
|
||||
* Return:
|
||||
* {Object} MapObject Pixel from x and y parameters
|
||||
*/
|
||||
getMapObjectPixelFromXY: function(x, y) {
|
||||
pObjectPixelFromXY: function(x, y) {
|
||||
return new Msn.VE.Pixel(x, y);
|
||||
},
|
||||
|
||||
|
||||
/** @final @type String */
|
||||
CLASS_NAME: "OpenLayers.Layer.VirtualEarth"
|
||||
});
|
||||
|
||||
+76
-46
@@ -4,55 +4,63 @@
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer/Vector.js
|
||||
* @requires OpenLayers/Layer/Markers.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.WFS
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Layer.Vector>
|
||||
* - <OpenLayers.Layer.Markers>
|
||||
*/
|
||||
OpenLayers.Layer.WFS = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.WFS.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer.Vector, OpenLayers.Layer.Markers, {
|
||||
|
||||
/** WFS layer is never a base layer.
|
||||
*
|
||||
* @type Boolean
|
||||
/**
|
||||
* APIProperty: isBaseLayer
|
||||
* {Boolean} WFS layer is not a base layer by default.
|
||||
*/
|
||||
isBaseLayer: false,
|
||||
|
||||
/** the ratio of image/tile size to map size (this is the untiled buffer)
|
||||
* @type int */
|
||||
/**
|
||||
* APIProperty: ratio
|
||||
* {Float} the ratio of image/tile size to map size (this is the untiled
|
||||
* buffer)
|
||||
*/
|
||||
ratio: 2,
|
||||
|
||||
/** Hashtable of default key/value parameters
|
||||
* @final @type Object */
|
||||
/**
|
||||
* Property: DEFAULT_PARAMS
|
||||
* {Object} Hashtable of default key/value parameters
|
||||
*/
|
||||
DEFAULT_PARAMS: { service: "WFS",
|
||||
version: "1.0.0",
|
||||
request: "GetFeature"
|
||||
},
|
||||
|
||||
/**
|
||||
* If featureClass is defined, an old-style markers based
|
||||
* WFS layer is created instead of a new-style vector layer.
|
||||
* If sent, this should be a subclass of OpenLayers.Feature
|
||||
*
|
||||
* @type OpenLayers.Feature
|
||||
* APIProperty: featureClass
|
||||
* {<OpenLayers.Feature>} If featureClass is defined, an old-style markers
|
||||
* based WFS layer is created instead of a new-style vector layer. If
|
||||
* sent, this should be a subclass of OpenLayers.Feature
|
||||
*/
|
||||
featureClass: null,
|
||||
|
||||
/**
|
||||
* Should be calculated automatically.
|
||||
*
|
||||
* @type Boolean
|
||||
* Property: vectorMode
|
||||
* {Boolean} Should be calculated automatically.
|
||||
*/
|
||||
vectorMode: true,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Layer.WFS
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} url
|
||||
* @param {Object} params
|
||||
* @param {Object} options Hashtable of extra options to tag onto the layer
|
||||
* Parameters:
|
||||
* name - {String}
|
||||
* url - {String}
|
||||
* params - {Object}
|
||||
* options - {Object} Hashtable of extra options to tag onto the layer
|
||||
*/
|
||||
initialize: function(name, url, params, options) {
|
||||
if (options == undefined) { options = {}; }
|
||||
@@ -93,7 +101,7 @@ OpenLayers.Layer.WFS.prototype =
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* APIMethod: destroy
|
||||
*/
|
||||
destroy: function() {
|
||||
if (this.vectorMode) {
|
||||
@@ -104,7 +112,10 @@ OpenLayers.Layer.WFS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Map} map
|
||||
* Method: setMap
|
||||
*
|
||||
* Parameters:
|
||||
* map - {<OpenLayers.Map>}
|
||||
*/
|
||||
setMap: function(map) {
|
||||
if (this.vectorMode) {
|
||||
@@ -115,9 +126,12 @@ OpenLayers.Layer.WFS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
* @param {Boolean} zoomChanged
|
||||
* @param {Boolean} dragging
|
||||
* Method: moveTo
|
||||
*
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
* zoomChanged - {Boolean}
|
||||
* dragging - {Boolean}
|
||||
*/
|
||||
moveTo:function(bounds, zoomChanged, dragging) {
|
||||
if (this.vectorMode) {
|
||||
@@ -204,6 +218,7 @@ OpenLayers.Layer.WFS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: onMapResize
|
||||
* Call the onMapResize method of the appropriate parent class.
|
||||
*/
|
||||
onMapResize: function() {
|
||||
@@ -215,10 +230,13 @@ OpenLayers.Layer.WFS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} obj
|
||||
* APIMethod: clone
|
||||
*
|
||||
* Parameters:
|
||||
* obj - {Object}
|
||||
*
|
||||
* @returns An exact clone of this OpenLayers.Layer.WMS
|
||||
* @type OpenLayers.Layer.WMS
|
||||
* Returns:
|
||||
* {<OpenLayers.Layer.WFS>} LAn exact clone of this OpenLayers.Layer.WFS
|
||||
*/
|
||||
clone: function (obj) {
|
||||
|
||||
@@ -241,16 +259,17 @@ OpenLayers.Layer.WFS.prototype =
|
||||
return obj;
|
||||
},
|
||||
|
||||
/** combine the layer's url with its params and these newParams.
|
||||
*
|
||||
* Add the SRS parameter from 'projection' -- this is probably
|
||||
* more eloquently done via a setProjection() method, but this
|
||||
* works for now and always.
|
||||
*
|
||||
* @param {Object} newParams
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
/**
|
||||
* APIMethod: getFullRequestString
|
||||
* combine the layer's url with its params and these newParams.
|
||||
*
|
||||
* Add the SRS parameter from 'projection' -- this is probably
|
||||
* more eloquently done via a setProjection() method, but this
|
||||
* works for now and always.
|
||||
*
|
||||
* Parameters:
|
||||
* newParams - {Object}
|
||||
*/
|
||||
getFullRequestString:function(newParams) {
|
||||
var projection = this.map.getProjection();
|
||||
this.params.SRS = (projection == "none") ? null : projection;
|
||||
@@ -258,7 +277,11 @@ OpenLayers.Layer.WFS.prototype =
|
||||
return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(
|
||||
this, arguments);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* APIMethod: commit
|
||||
* Write out the data to a WFS server.
|
||||
*/
|
||||
commit: function() {
|
||||
if (!this.writer) {
|
||||
this.writer = new OpenLayers.Format.WFS({},this);
|
||||
@@ -288,9 +311,11 @@ OpenLayers.Layer.WFS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: commitSuccess
|
||||
* Called when the Ajax request returns a response
|
||||
*
|
||||
* @param {XmlNode} response from server
|
||||
* Parameters:
|
||||
* response - {XmlNode} from server
|
||||
*/
|
||||
commitSuccess: function(request) {
|
||||
var response = request.responseText;
|
||||
@@ -309,18 +334,22 @@ OpenLayers.Layer.WFS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: commitFailure
|
||||
* Called when the Ajax request fails
|
||||
*
|
||||
* @param {XmlNode} response from server
|
||||
* Parameters:
|
||||
* response - {XmlNode} from server
|
||||
*/
|
||||
commitFailure: function(request) {},
|
||||
|
||||
/**
|
||||
* APIMethod: commitReport
|
||||
* Called with a 'success' message if the commit succeeded, otherwise
|
||||
* a failure message, and the full text as a second parameter.
|
||||
* a failure message, and the full request text as a second parameter.
|
||||
* Override this function to provide custom transaction reporting.
|
||||
*
|
||||
* @param {String} string reporting string
|
||||
* @param {String} response full XML response
|
||||
* string - {String} reporting string
|
||||
* response - {String} full XML response
|
||||
*/
|
||||
commitReport: function(string, response) {
|
||||
alert(string);
|
||||
@@ -328,6 +357,7 @@ OpenLayers.Layer.WFS.prototype =
|
||||
|
||||
|
||||
/**
|
||||
* APIMethod: refresh
|
||||
* Refreshes all the features of the layer
|
||||
*/
|
||||
refresh: function() {
|
||||
|
||||
+83
-43
@@ -4,17 +4,25 @@
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer/Grid.js
|
||||
* @requires OpenLayers/Tile/Image.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.WMS
|
||||
* Instances of OpenLayers.Layer.WMS are used to display data from OGC Web
|
||||
* Mapping Services. Create a new WMS layer with the <OpenLayers.Layer.WMS>
|
||||
* constructor.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Layer.Grid>
|
||||
*/
|
||||
OpenLayers.Layer.WMS = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.WMS.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer.Grid, {
|
||||
|
||||
/** Hashtable of default parameter key/value pairs
|
||||
* @final @type Object */
|
||||
/**
|
||||
* Constant: DEFAULT_PARAMS
|
||||
* {Object} Hashtable of default parameter key/value pairs
|
||||
*/
|
||||
DEFAULT_PARAMS: { service: "WMS",
|
||||
version: "1.1.1",
|
||||
request: "GetMap",
|
||||
@@ -23,16 +31,34 @@ OpenLayers.Layer.WMS.prototype =
|
||||
format: "image/jpeg"
|
||||
},
|
||||
|
||||
/**
|
||||
* Property: reproject
|
||||
* {Boolean} Try to reproject this layer if its coordinate reference system
|
||||
* is different than that of the base layer. Default is true.
|
||||
* Set this in the layer options. Should be set to false in
|
||||
* most cases.
|
||||
*/
|
||||
reproject: true,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} url
|
||||
* @param {Object} params
|
||||
* @param {Object} options Hashtable of extra options to tag onto the layer
|
||||
*/
|
||||
* Constructor: OpenLayers.Layer.WMS
|
||||
* Create a new WMS layer object
|
||||
*
|
||||
* Example:
|
||||
* (code)
|
||||
* var wms = new OpenLayers.Layer.WMS("NASA Global Mosaic",
|
||||
* "http://wms.jpl.nasa.gov/wms.cgi",
|
||||
* {layers: "modis,global_mosaic"});
|
||||
* (end)
|
||||
*
|
||||
* Parameters:
|
||||
* name - {String} A name for the layer
|
||||
* url - {String} Base url for the WMS
|
||||
* (e.g. http://wms.jpl.nasa.gov/wms.cgi)
|
||||
* params - {Object} An object with key/value pairs representing the
|
||||
* GetMap query string parameters and parameter values.
|
||||
* options - {Ojbect} Hashtable of extra options to tag onto the layer
|
||||
*/
|
||||
initialize: function(name, url, params, options) {
|
||||
var newArguments = new Array();
|
||||
//uppercase params
|
||||
@@ -54,7 +80,8 @@ OpenLayers.Layer.WMS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* Method: destroy
|
||||
* Destroy this layer
|
||||
*/
|
||||
destroy: function() {
|
||||
// for now, nothing special to do here.
|
||||
@@ -63,10 +90,11 @@ OpenLayers.Layer.WMS.prototype =
|
||||
|
||||
|
||||
/**
|
||||
* @param {Object} obj
|
||||
*
|
||||
* @returns An exact clone of this OpenLayers.Layer.WMS
|
||||
* @type OpenLayers.Layer.WMS
|
||||
* Method: clone
|
||||
* Create a clone of this layer
|
||||
*
|
||||
* Return:
|
||||
* {<OpenLayers.Layer.WMS>} An exact clone of this layer
|
||||
*/
|
||||
clone: function (obj) {
|
||||
|
||||
@@ -86,12 +114,17 @@ OpenLayers.Layer.WMS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @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
|
||||
* Method: getURL
|
||||
* Return a GetMap query string for this layer
|
||||
*
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>} A bounds representing the bbox for the
|
||||
* request.
|
||||
*
|
||||
* Return:
|
||||
* {String} A string with the layer's url and parameters and also the
|
||||
* passed-in bounds and appropriate tile size specified as
|
||||
* parameters.
|
||||
*/
|
||||
getURL: function (bounds) {
|
||||
bounds = this.adjustBounds(bounds);
|
||||
@@ -102,14 +135,15 @@ OpenLayers.Layer.WMS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* addTile creates a tile, initializes it, and
|
||||
* adds it to the layer div.
|
||||
*
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
*
|
||||
* @returns The added OpenLayers.Tile.Image
|
||||
* @type OpenLayers.Tile.Image
|
||||
*/
|
||||
* Method: addTile
|
||||
* addTile creates a tile, initializes it, and adds it to the layer div.
|
||||
*
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
*
|
||||
* Return:
|
||||
* {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
|
||||
*/
|
||||
addTile:function(bounds,position) {
|
||||
var url = this.getURL(bounds);
|
||||
return new OpenLayers.Tile.Image(this, position, bounds,
|
||||
@@ -117,12 +151,14 @@ OpenLayers.Layer.WMS.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: mergeNewParams
|
||||
* Catch changeParams and uppercase the new params to be merged in
|
||||
* before calling changeParams on the super class.
|
||||
* before calling changeParams on the super class.
|
||||
*
|
||||
* Once params have been changed, we will need to re-init our tiles
|
||||
* Once params have been changed, we will need to re-init our tiles.
|
||||
*
|
||||
* @param {Object} newParams Hashtable of new params to use
|
||||
* Parameters:
|
||||
* newParams - {Object} Hashtable of new params to use
|
||||
*/
|
||||
mergeNewParams:function(newParams) {
|
||||
var upperParams = OpenLayers.Util.upperCaseObject(newParams);
|
||||
@@ -131,16 +167,20 @@ OpenLayers.Layer.WMS.prototype =
|
||||
newArguments);
|
||||
},
|
||||
|
||||
/** combine the layer's url with its params and these newParams.
|
||||
*
|
||||
* Add the SRS parameter from projection -- this is probably
|
||||
* more eloquently done via a setProjection() method, but this
|
||||
* works for now and always.
|
||||
*
|
||||
* @param {Object} newParams
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
/**
|
||||
* Method: getFullRequestString
|
||||
* Combine the layer's url with its params and these newParams.
|
||||
*
|
||||
* Add the SRS parameter from projection -- this is probably
|
||||
* more eloquently done via a setProjection() method, but this
|
||||
* works for now and always.
|
||||
*
|
||||
* Parameters:
|
||||
* newParams - {Object}
|
||||
*
|
||||
* Return:
|
||||
* {String}
|
||||
*/
|
||||
getFullRequestString:function(newParams) {
|
||||
var projection = this.map.getProjection();
|
||||
this.params.SRS = (projection == "none") ? null : projection;
|
||||
|
||||
@@ -4,17 +4,22 @@
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer/HTTPRequest.js
|
||||
* @requires OpenLayers/Layer/WMS.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.WMS
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Layer.HTTPRequest>
|
||||
*/
|
||||
OpenLayers.Layer.WMS.Untiled = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.WMS.Untiled.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer.HTTPRequest, {
|
||||
|
||||
/** Hashtable of default parameter key/value pairs
|
||||
* @final @type Object */
|
||||
/**
|
||||
* Property: DEFAULT_PARAMS
|
||||
* Hashtable of default parameter key/value pairs
|
||||
*/
|
||||
DEFAULT_PARAMS: { service: "WMS",
|
||||
version: "1.1.1",
|
||||
request: "GetMap",
|
||||
@@ -22,25 +27,40 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
||||
exceptions: "application/vnd.ogc.se_inimage",
|
||||
format: "image/jpeg"
|
||||
},
|
||||
/**
|
||||
* APIProperty: reproject
|
||||
* Whether or not to use the base layer as a basis for 'staking' the corners
|
||||
* of the image geographically.
|
||||
*/
|
||||
reproject: true,
|
||||
|
||||
/** the ratio of image/tile size to map size (this is the untiled buffer)
|
||||
* @type int */
|
||||
/**
|
||||
* APIProperty: ratio
|
||||
* {Float} the ratio of image/tile size to map size (this is the untiled
|
||||
* buffer)
|
||||
*/
|
||||
ratio: 2,
|
||||
|
||||
/** @type OpenLayers.Tile.Image */
|
||||
/**
|
||||
* Property: tile
|
||||
* {<OpenLayers.Tile.Image>}
|
||||
*/
|
||||
tile: null,
|
||||
|
||||
/** did the image finish loading before a new draw was initiated?
|
||||
* @type Boolean */
|
||||
/**
|
||||
* Property: doneLoading
|
||||
* {Boolean} did the image finish loading before a new draw was initiated?
|
||||
*/
|
||||
doneLoading: false,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Layer.WMS.Untiled
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} url
|
||||
* @param {Object} params
|
||||
* Parameters:
|
||||
* name - {String}
|
||||
* url - {String}
|
||||
* params - {Object}
|
||||
* options - {Object}
|
||||
*/
|
||||
initialize: function(name, url, params, options) {
|
||||
var newArguments = new Array();
|
||||
@@ -64,7 +84,7 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* APIMethod: destroy
|
||||
*/
|
||||
destroy: function() {
|
||||
if (this.tile) {
|
||||
@@ -75,10 +95,14 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} obj
|
||||
* APIMethod: clone
|
||||
* Makes an exact clone of this OpenLayers.Layer.WMS.Untiled
|
||||
*
|
||||
* @returns An exact clone of this OpenLayers.Layer.WMS.Untiled
|
||||
* @type OpenLayers.Layer.WMS.Untiled
|
||||
* Parameters:
|
||||
* obj - {Object}
|
||||
*
|
||||
* Returns:
|
||||
* {<OpenLayers.Layer.WMS.Untiled>}
|
||||
*/
|
||||
clone: function (obj) {
|
||||
|
||||
@@ -100,15 +124,19 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
||||
},
|
||||
|
||||
|
||||
/** Once HTTPRequest has set the map, we can load the image div
|
||||
/**
|
||||
* Method: setMap
|
||||
* Once HTTPRequest has set the map, we can load the image div
|
||||
*
|
||||
* @param {OpenLayers.Map} map
|
||||
* Parameters:
|
||||
* map - {<OpenLayers.Map>}
|
||||
*/
|
||||
setMap: function(map) {
|
||||
OpenLayers.Layer.HTTPRequest.prototype.setMap.apply(this, arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: setTileSize
|
||||
* Set the tile size based on the map size. This also sets layer.imageSize
|
||||
* and layer.imageOffset for use by Tile.Image.
|
||||
*/
|
||||
@@ -121,12 +149,15 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
||||
this.imageOffset = new OpenLayers.Pixel(0, 0);
|
||||
},
|
||||
|
||||
/** When it is not a dragging move (ie when done dragging)
|
||||
/**
|
||||
* Method: moveTo
|
||||
* When it is not a dragging move (ie when done dragging)
|
||||
* reload and recenter the div.
|
||||
*
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
* @param {Boolean} zoomChanged
|
||||
* @param {Boolean} dragging
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
* zoomChanged - {Boolean}
|
||||
* dragging - {Boolean}
|
||||
*/
|
||||
moveTo:function(bounds, zoomChanged, dragging) {
|
||||
if (!this.doneLoading) {
|
||||
@@ -197,6 +228,12 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: getURL
|
||||
*
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
*/
|
||||
getURL: function(bounds) {
|
||||
return this.getFullRequestString( {'BBOX': bounds.toBBOX(),
|
||||
'WIDTH': this.tileSize.w,
|
||||
@@ -204,16 +241,24 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
||||
},
|
||||
|
||||
|
||||
/** Once HTTPRequest has updated the url, reload the image div
|
||||
* @param {String} newUrl
|
||||
/**
|
||||
* Method: setURL
|
||||
* Once HTTPRequest has updated the url, reload the image div
|
||||
*
|
||||
* Parameters:
|
||||
* newUrl - {String}
|
||||
*/
|
||||
setUrl: function(newUrl) {
|
||||
OpenLayers.Layer.HTTPRequest.prototype.setUrl.apply(this, arguments);
|
||||
this.moveTo();
|
||||
},
|
||||
|
||||
/** Once HTTPRequest has updated new params, reload the image div
|
||||
* @param {Object} newParams
|
||||
/**
|
||||
* APIMethod: mergeNewParams
|
||||
* Once HTTPRequest has updated new params, reload the image div
|
||||
*
|
||||
* Parameters:
|
||||
* newParams - {Object}
|
||||
*/
|
||||
mergeNewParams:function(newParams) {
|
||||
var upperParams = OpenLayers.Util.upperCaseObject(newParams);
|
||||
@@ -224,15 +269,16 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
||||
this.moveTo(null, true);
|
||||
},
|
||||
|
||||
/** combine the layer's url with its params and these newParams.
|
||||
/**
|
||||
* APIMethod: getFullRequestString
|
||||
* combine the layer's url with its params and these newParams.
|
||||
*
|
||||
* Add the SRS parameter from 'projection' -- this is probably
|
||||
* more eloquently done via a setProjection() method, but this
|
||||
* works for now and always.
|
||||
*
|
||||
* @param {Object} newParams
|
||||
*
|
||||
* @type String
|
||||
* Parameters:
|
||||
* newParams - {Object}
|
||||
*/
|
||||
getFullRequestString:function(newParams) {
|
||||
var projection = this.map.getProjection();
|
||||
|
||||
@@ -4,9 +4,12 @@
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer/Grid.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.WorldWind
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Layer.Grid>
|
||||
*/
|
||||
OpenLayers.Layer.WorldWind = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.WorldWind.prototype =
|
||||
@@ -15,17 +18,36 @@ OpenLayers.Layer.WorldWind.prototype =
|
||||
DEFAULT_PARAMS: {
|
||||
},
|
||||
|
||||
/** WorldWind layer is always a base layer
|
||||
*
|
||||
* @type Boolean
|
||||
/**
|
||||
* APIProperty: isBaseLayer
|
||||
* WorldWind layer is a base layer by default.
|
||||
*/
|
||||
isBaseLayer: true,
|
||||
|
||||
// LevelZeroTileSizeDegrees
|
||||
|
||||
/**
|
||||
* APIProperty: lzd
|
||||
* LevelZeroTileSizeDegrees
|
||||
*/
|
||||
lzd: null,
|
||||
|
||||
/**
|
||||
* APIProperty: zoomLevels
|
||||
* Number of zoom levels.
|
||||
*/
|
||||
zoomLevels: null,
|
||||
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Layer.WorldWind
|
||||
*
|
||||
* Parameters:
|
||||
* name - {String} Name of Layer
|
||||
* url - {String} Base URL
|
||||
* lzd - {Float} Level zero tile size degrees
|
||||
* zoomLevels - {Int} number of zoom levels
|
||||
* params - {Object} additional parameters
|
||||
* options - {Object} additional options
|
||||
*/
|
||||
initialize: function(name, url, lzd, zoomLevels, params, options) {
|
||||
this.lzd = lzd;
|
||||
this.zoomLevels = zoomLevels;
|
||||
@@ -40,6 +62,9 @@ OpenLayers.Layer.WorldWind.prototype =
|
||||
);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Method: addTile
|
||||
*/
|
||||
addTile:function(bounds,position) {
|
||||
if (this.map.getResolution() <= (this.lzd/512)
|
||||
&& this.getZoom() <= this.zoomLevels) {
|
||||
@@ -53,6 +78,10 @@ OpenLayers.Layer.WorldWind.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: getZoom
|
||||
* Convert map zoom to WW zoom.
|
||||
*/
|
||||
getZoom: function () {
|
||||
var zoom = this.map.getZoom();
|
||||
var extent = this.map.getMaxExtent();
|
||||
@@ -61,12 +90,15 @@ OpenLayers.Layer.WorldWind.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Bounds} bounds
|
||||
*
|
||||
* @returns A string with the layer's url and parameters and also the
|
||||
* Method: getURL
|
||||
*
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>}
|
||||
*
|
||||
* Returns:
|
||||
* {String} 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) {
|
||||
bounds = this.adjustBounds(bounds);
|
||||
|
||||
+126
-69
@@ -4,35 +4,51 @@
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Layer/EventPane.js
|
||||
* @requires OpenLayers/Layer/FixedZoomLevels.js
|
||||
*
|
||||
* Class: OpenLayers.Layer.Yahoo
|
||||
*
|
||||
* Inherits:
|
||||
* - <OpenLayers.Layer.EventPane>
|
||||
* - <OpenLayers.Layer.FixedZoomLevels>v
|
||||
*/
|
||||
OpenLayers.Layer.Yahoo = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.Yahoo.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer.EventPane,
|
||||
OpenLayers.Layer.FixedZoomLevels, {
|
||||
|
||||
/** @final @type int */
|
||||
/**
|
||||
* Constant: MIN_ZOOM_LEVEL
|
||||
* {Integer} 0
|
||||
*/
|
||||
MIN_ZOOM_LEVEL: 0,
|
||||
|
||||
/** @final @type int */
|
||||
/**
|
||||
* Constant: MAX_ZOOM_LEVEL
|
||||
* {Integer} 15
|
||||
*/
|
||||
MAX_ZOOM_LEVEL: 15,
|
||||
|
||||
/** Hardcode these resolutions so that they are more closely
|
||||
* tied with the standard wms projection
|
||||
*
|
||||
* @final @type Array(float) */
|
||||
/**
|
||||
* Constant: RESOLUTIONS
|
||||
* {Array(Float)} Hardcode these resolutions so that they are more closely
|
||||
* tied with the standard wms projection
|
||||
*/
|
||||
RESOLUTIONS: [1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125],
|
||||
|
||||
/** @type YahooMapType */
|
||||
/**
|
||||
* APIProperty: type
|
||||
* {YahooMapType}
|
||||
*/
|
||||
type: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Layer.Yahoo
|
||||
*
|
||||
* @param {String} name
|
||||
* Parameters:
|
||||
* name - {String}
|
||||
* options - {Object}
|
||||
*/
|
||||
initialize: function(name, options) {
|
||||
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
|
||||
@@ -41,7 +57,7 @@ OpenLayers.Layer.Yahoo.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* Method: loadMapObject
|
||||
*/
|
||||
loadMapObject:function() {
|
||||
try { //do not crash!
|
||||
@@ -50,11 +66,14 @@ OpenLayers.Layer.Yahoo.prototype =
|
||||
},
|
||||
|
||||
|
||||
/** Overridden from EventPane because we need to remove this yahoo event
|
||||
* pane which prohibits our drag and drop, and we can only do this
|
||||
* once the map has been loaded and centered.
|
||||
/**
|
||||
* APIMethod: setMap
|
||||
* Overridden from EventPane because we need to remove this yahoo event
|
||||
* pane which prohibits our drag and drop, and we can only do this
|
||||
* once the map has been loaded and centered.
|
||||
*
|
||||
* @param {OpenLayers.Map} map
|
||||
* Parameters:
|
||||
* map - {<OpenLayers.Map>}
|
||||
*/
|
||||
setMap: function(map) {
|
||||
OpenLayers.Layer.EventPane.prototype.setMap.apply(this, arguments);
|
||||
@@ -62,10 +81,10 @@ OpenLayers.Layer.Yahoo.prototype =
|
||||
this.map.events.register("moveend", this, this.fixYahooEventPane);
|
||||
},
|
||||
|
||||
/** The map has been centered, so the mysterious yahoo eventpane has been
|
||||
* added. we remove it so that it doesnt mess with *our* event pane.
|
||||
*
|
||||
* @private
|
||||
/**
|
||||
* Method: fixYahooEventPane
|
||||
* The map has been centered, so the mysterious yahoo eventpane has been
|
||||
* added. we remove it so that it doesnt mess with *our* event pane.
|
||||
*/
|
||||
fixYahooEventPane: function() {
|
||||
var yahooEventPane = OpenLayers.Util.getElement("ygddfdiv");
|
||||
@@ -79,9 +98,11 @@ OpenLayers.Layer.Yahoo.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @return String with information on why layer is broken, how to get
|
||||
* APIMethod: getWarningHTML
|
||||
*
|
||||
* Return:
|
||||
* {String} String with information on why layer is broken, how to get
|
||||
* it working.
|
||||
* @type String
|
||||
*/
|
||||
getWarningHTML:function() {
|
||||
|
||||
@@ -118,11 +139,14 @@ OpenLayers.Layer.Yahoo.prototype =
|
||||
//
|
||||
|
||||
/**
|
||||
* @param {int} gZoom
|
||||
* APIMethod: getOLZoomFromMapObjectZoom
|
||||
*
|
||||
* @returns An OpenLayers Zoom level, translated from the passed in gZoom
|
||||
* Returns null if null value is passed in
|
||||
* @type int
|
||||
* Parameters:
|
||||
* gZoom - {Integer}
|
||||
*
|
||||
* Return:
|
||||
* {Integer} An OpenLayers Zoom level, translated from the passed in gZoom
|
||||
* Returns null if null value is passed in.
|
||||
*/
|
||||
getOLZoomFromMapObjectZoom: function(moZoom) {
|
||||
var zoom = null;
|
||||
@@ -134,11 +158,14 @@ OpenLayers.Layer.Yahoo.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {int} olZoom
|
||||
* APIMethod: getMapObjectZoomFromOLZoom
|
||||
*
|
||||
* @returns A MapObject level, translated from the passed in olZoom
|
||||
* Returns null if null value is passed in
|
||||
* @type int
|
||||
* Parameters:
|
||||
* olZoom - {Integer}
|
||||
*
|
||||
* Return:
|
||||
* {Integer} A MapObject level, translated from the passed in olZoom
|
||||
* Returns null if null value is passed in
|
||||
*/
|
||||
getMapObjectZoomFromOLZoom: function(olZoom) {
|
||||
var zoom = null;
|
||||
@@ -158,26 +185,33 @@ OpenLayers.Layer.Yahoo.prototype =
|
||||
|
||||
// Get&Set Center, Zoom
|
||||
|
||||
/** Set the mapObject to the specified center and zoom
|
||||
/**
|
||||
* APIMethod: setMapObjectCenter
|
||||
* Set the mapObject to the specified center and zoom
|
||||
*
|
||||
* @param {Object} center MapObject LonLat format
|
||||
* @param {int} zoom MapObject zoom format
|
||||
* Parameters:
|
||||
* center - {Object} MapObject LonLat format
|
||||
* zoom - {int} MapObject zoom format
|
||||
*/
|
||||
setMapObjectCenter: function(center, zoom) {
|
||||
this.mapObject.drawZoomAndCenter(center, zoom);
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns the mapObject's current center in Map Object format
|
||||
* @type Object
|
||||
* APIMethod: getMapObjectCenter
|
||||
*
|
||||
* Return:
|
||||
* {Object} The mapObject's current center in Map Object format
|
||||
*/
|
||||
getMapObjectCenter: function() {
|
||||
return this.mapObject.getCenterLatLon();
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns the mapObject's current zoom, in Map Object format
|
||||
* @type int
|
||||
* APIMethod: getMapObjectZoom
|
||||
*
|
||||
* Return:
|
||||
* {Integer} The mapObject's current zoom, in Map Object format
|
||||
*/
|
||||
getMapObjectZoom: function() {
|
||||
return this.mapObject.getZoomLevel();
|
||||
@@ -186,21 +220,27 @@ OpenLayers.Layer.Yahoo.prototype =
|
||||
|
||||
// LonLat - Pixel Translation
|
||||
|
||||
/**
|
||||
* @param {Object} moPixel MapObject Pixel format
|
||||
/**
|
||||
* APIMethod: getMapObjectLonLatFromMapObjectPixel
|
||||
*
|
||||
* @returns MapObject LonLat translated from MapObject Pixel
|
||||
* @type Object
|
||||
* Parameters:
|
||||
* moPixel - {Object} MapObject Pixel format
|
||||
*
|
||||
* Return:
|
||||
* {Object} MapObject LonLat translated from MapObject Pixel
|
||||
*/
|
||||
getMapObjectLonLatFromMapObjectPixel: function(moPixel) {
|
||||
return this.mapObject.convertXYLatLon(moPixel);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} moPixel MapObject Pixel format
|
||||
/**
|
||||
* APIMethod: getMapObjectPixelFromMapObjectLonLat
|
||||
*
|
||||
* @returns MapObject Pixel translated from MapObject LonLat
|
||||
* @type Object
|
||||
* Parameters:
|
||||
* moLonLat - {Object} MapObject LonLat format
|
||||
*
|
||||
* Return:
|
||||
* {Object} MapObject Pixel transtlated from MapObject LonLat
|
||||
*/
|
||||
getMapObjectPixelFromMapObjectLonLat: function(moLonLat) {
|
||||
return this.mapObject.convertLatLonXY(moLonLat);
|
||||
@@ -217,31 +257,40 @@ OpenLayers.Layer.Yahoo.prototype =
|
||||
// LonLat
|
||||
|
||||
/**
|
||||
* @param {Object} moLonLat MapObject LonLat format
|
||||
* APIMethod: getLongitudeFromMapObjectLonLat
|
||||
*
|
||||
* @returns Longitude of the given MapObject LonLat
|
||||
* @type float
|
||||
* Parameters:
|
||||
* moLonLat - {Object} MapObject LonLat format
|
||||
*
|
||||
* Return:
|
||||
* {Float} Longitude of the given MapObject LonLat
|
||||
*/
|
||||
getLongitudeFromMapObjectLonLat: function(moLonLat) {
|
||||
return moLonLat.Lon;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} moLonLat MapObject LonLat format
|
||||
* APIMethod: getLatitudeFromMapObjectLonLat
|
||||
*
|
||||
* @returns Latitude of the given MapObject LonLat
|
||||
* @type float
|
||||
* Parameters:
|
||||
* moLonLat - {Object} MapObject LonLat format
|
||||
*
|
||||
* Return:
|
||||
* {Float} Latitude of the given MapObject LonLat
|
||||
*/
|
||||
getLatitudeFromMapObjectLonLat: function(moLonLat) {
|
||||
return moLonLat.Lat;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {int} lon float
|
||||
* @param {int} lat float
|
||||
* APIMethod: getMapObjectLonLatFromLonLat
|
||||
*
|
||||
* @returns MapObject LonLat built from lon and lat params
|
||||
* @type Object
|
||||
* Parameters:
|
||||
* lon - {Float}
|
||||
* lat - {Float}
|
||||
*
|
||||
* Return:
|
||||
* {Object} MapObject LonLat built from lon and lat params
|
||||
*/
|
||||
getMapObjectLonLatFromLonLat: function(lon, lat) {
|
||||
return new YGeoPoint(lat, lon);
|
||||
@@ -249,38 +298,46 @@ OpenLayers.Layer.Yahoo.prototype =
|
||||
|
||||
// Pixel
|
||||
|
||||
/**
|
||||
* @param {Object} moPixel MapObject Pixel format
|
||||
/**
|
||||
* APIMethod: getXFromMapObjectPixel
|
||||
*
|
||||
* @returns X value of the MapObject Pixel
|
||||
* @type int
|
||||
* Parameters:
|
||||
* moPixel - {Object} MapObject Pixel format
|
||||
*
|
||||
* Return:
|
||||
* {Integer} X value of the MapObject Pixel
|
||||
*/
|
||||
getXFromMapObjectPixel: function(moPixel) {
|
||||
return moPixel.x;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} moPixel MapObject Pixel format
|
||||
/**
|
||||
* APIMethod: getYFromMapObjectPixel
|
||||
*
|
||||
* @returns Y value of the MapObject Pixel
|
||||
* @type int
|
||||
* Parameters:
|
||||
* moPixel - {Object} MapObject Pixel format
|
||||
*
|
||||
* Return:
|
||||
* {Integer} Y value of the MapObject Pixel
|
||||
*/
|
||||
getYFromMapObjectPixel: function(moPixel) {
|
||||
return moPixel.y;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {int} x
|
||||
* @param {int} y
|
||||
/**
|
||||
* APIMethod: getMapObjectPixelFromXY
|
||||
*
|
||||
* @returns MapObject Pixel from x and y parameters
|
||||
* @type Object
|
||||
* Parameters:
|
||||
* x - {Integer}
|
||||
* y - {Integer}
|
||||
*
|
||||
* Return:
|
||||
* {Object} MapObject Pixel from x and y parameters
|
||||
*/
|
||||
getMapObjectPixelFromXY: function(x, y) {
|
||||
return new YCoordPoint(x, y);
|
||||
},
|
||||
|
||||
|
||||
/** @final @type String */
|
||||
CLASS_NAME: "OpenLayers.Layer.Yahoo"
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user