diff --git a/examples/mm.html b/examples/mm.html
deleted file mode 100644
index 2fd524dbbe..0000000000
--- a/examples/mm.html
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
-
-
-
- MultiMap
-
-
-
-
-
-
-
-
-
-
-
-
-
- MultiMap Example
-
- MultiMap, basic, cleanup
-
-
- An example of using the Layer.MultiMap class.
-
-
- click to add the marker to the map
- click to remove the marker from the map
-
-
diff --git a/examples/multimap-mercator.html b/examples/multimap-mercator.html
deleted file mode 100644
index 48b2dd9ec2..0000000000
--- a/examples/multimap-mercator.html
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-
-
-
-
- MultiMap SphericalMercator
-
-
-
-
-
-
-
-
-
-
-
-
-
- MultiMap Mercator Example
-
- MultiMap, basic, cleanup
-
-
- This sphericalMercator example using multimap demonstrates that the
- multimap layer does not fully support the sphericalMercator projection at
- this time.
-
-
-
-
diff --git a/examples/ve-novibrate.html b/examples/ve-novibrate.html
deleted file mode 100644
index 6be2943b16..0000000000
--- a/examples/ve-novibrate.html
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
-
-
-
- OpenLayers Virtual Earth Example
-
-
-
-
-
-
-
-
- Virtual Earth Example
-
-
- panning, virtual earth, panzoom, panmethod, panduration
-
-
-
- When using the PanZoom buttons with VirtualEarth, some 'drift' is
- possible in markers. This page demonstrates how to use the
- panMethod and panDuration properties to change the OpenLayers
- settings to match VirtualEarth.
-
-
-
-
-
-
-
diff --git a/examples/ve.html b/examples/ve.html
deleted file mode 100644
index 7b9bad8105..0000000000
--- a/examples/ve.html
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-
-
-
-
- OpenLayers Virtual Earth Example
-
-
-
-
-
-
-
-
- Virtual Earth Example
-
-
- virtual earth, marker
-
-
-
- Demonstrates the use of a Virtual Earth base layer.
-
-
-
-
-
- This example demonstrates the ability to add VirtualEarth and the and remove markers.
-
-
-
-
diff --git a/lib/OpenLayers.js b/lib/OpenLayers.js
index 933407c4ec..9a844176f1 100644
--- a/lib/OpenLayers.js
+++ b/lib/OpenLayers.js
@@ -122,14 +122,12 @@
"OpenLayers/Tile.js",
"OpenLayers/Tile/Image.js",
"OpenLayers/Tile/Image/IFrame.js",
- "OpenLayers/Tile/WFS.js",
"OpenLayers/Layer/Image.js",
"OpenLayers/Layer/SphericalMercator.js",
"OpenLayers/Layer/EventPane.js",
"OpenLayers/Layer/FixedZoomLevels.js",
"OpenLayers/Layer/Google.js",
"OpenLayers/Layer/Google/v3.js",
- "OpenLayers/Layer/VirtualEarth.js",
"OpenLayers/Layer/Yahoo.js",
"OpenLayers/Layer/HTTPRequest.js",
"OpenLayers/Layer/Grid.js",
@@ -137,7 +135,6 @@
"OpenLayers/Layer/MapServer.js",
"OpenLayers/Layer/KaMap.js",
"OpenLayers/Layer/KaMapCache.js",
- "OpenLayers/Layer/MultiMap.js",
"OpenLayers/Layer/Markers.js",
"OpenLayers/Layer/Text.js",
"OpenLayers/Layer/WorldWind.js",
@@ -159,7 +156,6 @@
"OpenLayers/Popup/FramedCloud.js",
"OpenLayers/Feature.js",
"OpenLayers/Feature/Vector.js",
- "OpenLayers/Feature/WFS.js",
"OpenLayers/Handler.js",
"OpenLayers/Handler/Click.js",
"OpenLayers/Handler/Hover.js",
@@ -337,7 +333,6 @@
"OpenLayers/Format/XLS/v1.js",
"OpenLayers/Format/XLS/v1_1_0.js",
"OpenLayers/Format/OGCExceptionReport.js",
- "OpenLayers/Layer/WFS.js",
"OpenLayers/Control/GetFeature.js",
"OpenLayers/Control/NavToolbar.js",
"OpenLayers/Control/PanPanel.js",
diff --git a/lib/OpenLayers/BaseTypes.js b/lib/OpenLayers/BaseTypes.js
index 88d645a4e9..05b06b8d3d 100644
--- a/lib/OpenLayers/BaseTypes.js
+++ b/lib/OpenLayers/BaseTypes.js
@@ -3,11 +3,6 @@
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the
* full text of the license. */
-/**
- * @requires OpenLayers/Lang.js
- * @requires OpenLayers/Console.js
- */
-
/**
* Header: OpenLayers Base Types
* OpenLayers custom string, number and function functions are described here.
diff --git a/lib/OpenLayers/Events.js b/lib/OpenLayers/Events.js
index 48aaeae7eb..d9715eba7e 100644
--- a/lib/OpenLayers/Events.js
+++ b/lib/OpenLayers/Events.js
@@ -376,14 +376,6 @@ OpenLayers.Event = {
/* prevent memory leaks in IE */
OpenLayers.Event.observe(window, 'unload', OpenLayers.Event.unloadCache, false);
-// FIXME: Remove this in 3.0. In 3.0, Event.stop will no longer be provided
-// by OpenLayers.
-if (window.Event) {
- OpenLayers.Util.applyDefaults(window.Event, OpenLayers.Event);
-} else {
- var Event = OpenLayers.Event;
-}
-
/**
* Class: OpenLayers.Events
*/
diff --git a/lib/OpenLayers/Feature/WFS.js b/lib/OpenLayers/Feature/WFS.js
deleted file mode 100644
index 7234e4fd5a..0000000000
--- a/lib/OpenLayers/Feature/WFS.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the Clear BSD license.
- * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Feature.js
- */
-
-/**
- * Class: OpenLayers.Feature.WFS
- * WFS handling class, for use as a featureClass on the WFS layer for handling
- * 'point' WFS types. Good for subclassing when creating a custom WFS like
- * XML application.
- *
- * Inherits from:
- * -
- */
-OpenLayers.Feature.WFS = OpenLayers.Class(OpenLayers.Feature, {
-
- /**
- * Constructor: OpenLayers.Feature.WFS
- * Create a WFS feature.
- *
- * Parameters:
- * layer - {}
- * xmlNode - {XMLNode}
- */
- initialize: function(layer, xmlNode) {
- var newArguments = arguments;
- var data = this.processXMLNode(xmlNode);
- newArguments = new Array(layer, data.lonlat, data);
- OpenLayers.Feature.prototype.initialize.apply(this, newArguments);
- this.createMarker();
- this.layer.addMarker(this.marker);
- },
-
- /**
- * Method: destroy
- * nullify references to prevent circular references and memory leaks
- */
- destroy: function() {
- if (this.marker != null) {
- this.layer.removeMarker(this.marker);
- }
- OpenLayers.Feature.prototype.destroy.apply(this, arguments);
- },
-
- /**
- * Method: processXMLNode
- * When passed an xmlNode, parses it for a GML point, and passes
- * back an object describing that point.
- *
- * For subclasses of Feature.WFS, this is the feature to change.
- *
- * Parameters:
- * xmlNode - {XMLNode}
- *
- * Returns:
- * {Object} Data Object with 'id', 'lonlat', and private properties set
- */
- processXMLNode: function(xmlNode) {
- //this should be overridden by subclasses
- // must return an Object with 'id' and 'lonlat' values set
- var point = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode, "http://www.opengis.net/gml", "gml", "Point");
- var text = OpenLayers.Util.getXmlNodeValue(OpenLayers.Ajax.getElementsByTagNameNS(point[0], "http://www.opengis.net/gml","gml", "coordinates")[0]);
- var floats = text.split(",");
- return {lonlat: new OpenLayers.LonLat(parseFloat(floats[0]),
- parseFloat(floats[1])),
- id: null};
-
- },
-
- CLASS_NAME: "OpenLayers.Feature.WFS"
-});
-
-
-
-
-
diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js
index ce6332a3c9..495f657aa9 100644
--- a/lib/OpenLayers/Layer/Grid.js
+++ b/lib/OpenLayers/Layer/Grid.js
@@ -6,7 +6,6 @@
/**
* @requires OpenLayers/Layer/HTTPRequest.js
- * @requires OpenLayers/Console.js
* @requires OpenLayers/Tile/Image.js
*/
@@ -559,23 +558,6 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
}
OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this, [size]);
},
-
- /**
- * Method: getGridBounds
- * Deprecated. This function will be removed in 3.0. Please use
- * getTilesBounds() instead.
- *
- * Returns:
- * {} A Bounds object representing the bounds of all the
- * currently loaded tiles (including those partially or not at all seen
- * onscreen)
- */
- getGridBounds: function() {
- var msg = "The getGridBounds() function is deprecated. It will be " +
- "removed in 3.0. Please use getTilesBounds() instead.";
- OpenLayers.Console.warn(msg);
- return this.getTilesBounds();
- },
/**
* APIMethod: getTilesBounds
diff --git a/lib/OpenLayers/Layer/MultiMap.js b/lib/OpenLayers/Layer/MultiMap.js
deleted file mode 100644
index 3052b829b3..0000000000
--- a/lib/OpenLayers/Layer/MultiMap.js
+++ /dev/null
@@ -1,286 +0,0 @@
-/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the Clear BSD license.
- * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Layer/EventPane.js
- * @requires OpenLayers/Layer/FixedZoomLevels.js
- * @requires OpenLayers/Lang.js
- */
-
-/**
- * Class: OpenLayers.Layer.MultiMap
- * Note that MultiMap does not fully support the sphericalMercator
- * option. See Ticket #953 for more details.
- * *Deprecated*. Use OpenLayers.Layer.Bing instead. See #3063
- *
- * Inherits from:
- * -
- * -
- */
-OpenLayers.Layer.MultiMap = OpenLayers.Class(
- OpenLayers.Layer.EventPane, OpenLayers.Layer.FixedZoomLevels, {
-
- /**
- * Constant: MIN_ZOOM_LEVEL
- * {Integer} 1
- */
- MIN_ZOOM_LEVEL: 1,
-
- /**
- * Constant: MAX_ZOOM_LEVEL
- * {Integer} 17
- */
- MAX_ZOOM_LEVEL: 17,
-
- /**
- * 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
- ],
-
- /**
- * APIProperty: type
- * {?}
- */
- type: null,
-
- /**
- * Constructor: OpenLayers.Layer.MultiMap
- *
- * Parameters:
- * name - {String}
- * options - {Object}
- */
- initialize: function(name, options) {
- OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
- OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,
- arguments);
- if (this.sphericalMercator) {
- OpenLayers.Util.extend(this, OpenLayers.Layer.SphericalMercator);
- this.initMercatorParameters();
- this.RESOLUTIONS.unshift(10);
- }
- },
-
- /**
- * Method: loadMapObject
- */
- loadMapObject:function() {
- try { //crash proofing
- this.mapObject = new MultimapViewer(this.div);
- } catch (e) { }
- },
-
- /**
- * APIMethod: getWarningHTML
- *
- * Returns:
- * {String} String with information on why layer is broken, how to get
- * it working.
- */
- getWarningHTML:function() {
- return OpenLayers.i18n(
- "getLayerWarning", {'layerType':"MM", 'layerLib':"MultiMap"}
- );
- },
-
-
-
- /************************************
- * *
- * MapObject Interface Controls *
- * *
- ************************************/
-
-
- // Get&Set Center, Zoom
-
- /**
- * APIMethod: setMapObjectCenter
- * Set the mapObject to the specified center and zoom
- *
- * Parameters:
- * center - {Object} MapObject LonLat format
- * zoom - {int} MapObject zoom format
- */
- setMapObjectCenter: function(center, zoom) {
- this.mapObject.goToPosition(center, zoom);
- },
-
- /**
- * APIMethod: getMapObjectCenter
- *
- * Returns:
- * {Object} The mapObject's current center in Map Object format
- */
- getMapObjectCenter: function() {
- return this.mapObject.getCurrentPosition();
- },
-
- /**
- * APIMethod: getMapObjectZoom
- *
- * Returns:
- * {Integer} The mapObject's current zoom, in Map Object format
- */
- getMapObjectZoom: function() {
- return this.mapObject.getZoomFactor();
- },
-
-
- // LonLat - Pixel Translation
-
- /**
- * APIMethod: getMapObjectLonLatFromMapObjectPixel
- *
- * Parameters:
- * moPixel - {Object} MapObject Pixel format
- *
- * Returns:
- * {Object} MapObject LonLat translated from MapObject Pixel
- */
- getMapObjectLonLatFromMapObjectPixel: function(moPixel) {
- moPixel.x = moPixel.x - (this.map.getSize().w/2);
- moPixel.y = moPixel.y - (this.map.getSize().h/2);
- return this.mapObject.getMapPositionAt(moPixel);
- },
-
- /**
- * APIMethod: getMapObjectPixelFromMapObjectLonLat
- *
- * Parameters:
- * moLonLat - {Object} MapObject LonLat format
- *
- * Returns:
- * {Object} MapObject Pixel transtlated from MapObject LonLat
- */
- getMapObjectPixelFromMapObjectLonLat: function(moLonLat) {
- return this.mapObject.geoPosToContainerPixels(moLonLat);
- },
-
-
- /************************************
- * *
- * MapObject Primitives *
- * *
- ************************************/
-
-
- // LonLat
-
- /**
- * APIMethod: getLongitudeFromMapObjectLonLat
- *
- * Parameters:
- * moLonLat - {Object} MapObject LonLat format
- *
- * Returns:
- * {Float} Longitude of the given MapObject LonLat
- */
- getLongitudeFromMapObjectLonLat: function(moLonLat) {
- return this.sphericalMercator ?
- this.forwardMercator(moLonLat.lon, moLonLat.lat).lon :
- moLonLat.lon;
- },
-
- /**
- * APIMethod: getLatitudeFromMapObjectLonLat
- *
- * Parameters:
- * moLonLat - {Object} MapObject LonLat format
- *
- * Returns:
- * {Float} Latitude of the given MapObject LonLat
- */
- getLatitudeFromMapObjectLonLat: function(moLonLat) {
- return this.sphericalMercator ?
- this.forwardMercator(moLonLat.lon, moLonLat.lat).lat :
- moLonLat.lat;
- },
-
- /**
- * APIMethod: getMapObjectLonLatFromLonLat
- *
- * Parameters:
- * lon - {Float}
- * lat - {Float}
- *
- * Returns:
- * {Object} MapObject LonLat built from lon and lat params
- */
- getMapObjectLonLatFromLonLat: function(lon, lat) {
- var mmLatLon;
- if(this.sphericalMercator) {
- var lonlat = this.inverseMercator(lon, lat);
- mmLatLon = new MMLatLon(lonlat.lat, lonlat.lon);
- } else {
- mmLatLon = new MMLatLon(lat, lon);
- }
- return mmLatLon;
- },
-
- // Pixel
-
- /**
- * APIMethod: getXFromMapObjectPixel
- *
- * Parameters:
- * moPixel - {Object} MapObject Pixel format
- *
- * Returns:
- * {Integer} X value of the MapObject Pixel
- */
- getXFromMapObjectPixel: function(moPixel) {
- return moPixel.x;
- },
-
- /**
- * APIMethod: getYFromMapObjectPixel
- *
- * Parameters:
- * moPixel - {Object} MapObject Pixel format
- *
- * Returns:
- * {Integer} Y value of the MapObject Pixel
- */
- getYFromMapObjectPixel: function(moPixel) {
- return moPixel.y;
- },
-
- /**
- * APIMethod: getMapObjectPixelFromXY
- *
- * Parameters:
- * x - {Integer}
- * y - {Integer}
- *
- * Returns:
- * {Object} MapObject Pixel from x and y parameters
- */
- getMapObjectPixelFromXY: function(x, y) {
- return new MMPoint(x, y);
- },
-
- CLASS_NAME: "OpenLayers.Layer.MultiMap"
-});
diff --git a/lib/OpenLayers/Layer/VirtualEarth.js b/lib/OpenLayers/Layer/VirtualEarth.js
deleted file mode 100644
index 6de97c54be..0000000000
--- a/lib/OpenLayers/Layer/VirtualEarth.js
+++ /dev/null
@@ -1,391 +0,0 @@
-/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the Clear BSD license.
- * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
- * full text of the license. */
-
-
-/**
- * @requires OpenLayers/Layer/SphericalMercator.js
- * @requires OpenLayers/Layer/EventPane.js
- * @requires OpenLayers/Layer/FixedZoomLevels.js
- * @requires OpenLayers/Lang.js
- */
-
-/**
- * Class: OpenLayers.Layer.VirtualEarth
- * *Deprecated*. Use instead.
- *
- * Instances of OpenLayers.Layer.VirtualEarth are used to display the data from
- * the Bing Maps AJAX Control (see e.g.
- * http://msdn.microsoft.com/library/bb429619.aspx). Create a VirtualEarth
- * layer with the constructor.
- *
- * Inherits from:
- * -
- * -
- */
-OpenLayers.Layer.VirtualEarth = OpenLayers.Class(
- OpenLayers.Layer.EventPane,
- OpenLayers.Layer.FixedZoomLevels, {
-
- /**
- * Constant: MIN_ZOOM_LEVEL
- * {Integer} 1
- */
- MIN_ZOOM_LEVEL: 1,
-
- /**
- * Constant: MAX_ZOOM_LEVEL
- * {Integer} 19
- */
- MAX_ZOOM_LEVEL: 19,
-
- /**
- * 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,
- 0.00002145767211914062,
- 0.00001072883605957031,
- 0.00000536441802978515
- ],
-
- /**
- * APIProperty: type
- * {VEMapType}
- */
- type: null,
-
- /**
- * APIProperty: wrapDateLine
- * {Boolean} Allow user to pan forever east/west. Default is true.
- * Setting this to false only restricts panning if
- * is true.
- */
- wrapDateLine: true,
-
- /**
- * APIProperty: sphericalMercator
- * {Boolean} Should the map act as a mercator-projected map? This will
- * cause all interactions with the map to be in the actual map
- * projection, which allows support for vector drawing, overlaying
- * other maps, etc.
- */
- sphericalMercator: false,
-
- /**
- * APIProperty: animationEnabled
- * {Boolean} If set to true, the transition between zoom levels will be
- * animated. Set to false to match the zooming experience of other
- * layer types. Default is true.
- */
- animationEnabled: true,
-
- /**
- * Constructor: OpenLayers.Layer.VirtualEarth
- * Creates a new instance of a OpenLayers.Layer.VirtualEarth. If you use an
- * instance of OpenLayers.Layer.VirtualEarth in you map, you should set
- * the option restrictedExtent to a meaningful value,
- * e.g.:
- * (code)
- * var map = new OpenLayers.Map( 'map', {
- * // other map options
- * restrictedExtent : OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508)
- * } );
- *
- * var veLayer = new OpenLayers.Layer.VirtualEarth (
- * "Virtual Earth Layer"
- * );
- *
- * map.addLayer( veLayer );
- * (end)
- *
- * Parameters:
- * name - {String}
- * options - {Object}
- */
- initialize: function(name, options) {
- OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
- OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,
- arguments);
- if(this.sphericalMercator) {
- OpenLayers.Util.extend(this, OpenLayers.Layer.SphericalMercator);
- this.initMercatorParameters();
- }
- },
-
- /**
- * Method: loadMapObject
- */
- loadMapObject:function() {
-
- // create div and set to same size as map
- var veDiv = OpenLayers.Util.createDiv(this.name);
- var sz = this.map.getSize();
- veDiv.style.width = sz.w + "px";
- veDiv.style.height = sz.h + "px";
- this.div.appendChild(veDiv);
-
- try { // crash prevention
- this.mapObject = new VEMap(this.name);
- } catch (e) { }
-
- if (this.mapObject != null) {
- try { // this is to catch a Mozilla bug without falling apart
-
- // The fourth argument is whether the map is 'fixed' -- not
- // draggable. See:
- // http://blogs.msdn.com/virtualearth/archive/2007/09/28/locking-a-virtual-earth-map.aspx
- //
- this.mapObject.LoadMap(null, null, this.type, true);
- this.mapObject.AttachEvent("onmousedown", OpenLayers.Function.True);
-
- } catch (e) { }
- this.mapObject.HideDashboard();
- if(typeof this.mapObject.SetAnimationEnabled == "function") {
- this.mapObject.SetAnimationEnabled(this.animationEnabled);
- }
- }
-
- //can we do smooth panning? this is an unpublished method, so we need
- // to be careful
- if ( !this.mapObject ||
- !this.mapObject.vemapcontrol ||
- !this.mapObject.vemapcontrol.PanMap ||
- (typeof this.mapObject.vemapcontrol.PanMap != "function")) {
-
- this.dragPanMapObject = null;
- }
-
- },
-
- /**
- * Method: onMapResize
- */
- onMapResize: function() {
- this.mapObject.Resize(this.map.size.w, this.map.size.h);
- },
-
- /**
- * APIMethod: getWarningHTML
- *
- * Returns:
- * {String} String with information on why layer is broken, how to get
- * it working.
- */
- getWarningHTML:function() {
- return OpenLayers.i18n(
- "getLayerWarning", {'layerType':'VE', 'layerLib':'VirtualEarth'}
- );
- },
-
-
-
- /************************************
- * *
- * MapObject Interface Controls *
- * *
- ************************************/
-
-
- // Get&Set Center, Zoom
-
- /**
- * APIMethod: setMapObjectCenter
- * Set the mapObject to the specified center and zoom
- *
- * Parameters:
- * center - {Object} MapObject LonLat format
- * zoom - {int} MapObject zoom format
- */
- setMapObjectCenter: function(center, zoom) {
- this.mapObject.SetCenterAndZoom(center, zoom);
- },
-
- /**
- * APIMethod: getMapObjectCenter
- *
- * Returns:
- * {Object} The mapObject's current center in Map Object format
- */
- getMapObjectCenter: function() {
- return this.mapObject.GetCenter();
- },
-
- /**
- * APIMethod: dragPanMapObject
- *
- * Parameters:
- * dX - {Integer}
- * dY - {Integer}
- */
- dragPanMapObject: function(dX, dY) {
- this.mapObject.vemapcontrol.PanMap(dX, -dY);
- },
-
- /**
- * APIMethod: getMapObjectZoom
- *
- * Returns:
- * {Integer} The mapObject's current zoom, in Map Object format
- */
- getMapObjectZoom: function() {
- return this.mapObject.GetZoomLevel();
- },
-
-
- // LonLat - Pixel Translation
-
- /**
- * APIMethod: getMapObjectLonLatFromMapObjectPixel
- *
- * Parameters:
- * moPixel - {Object} MapObject Pixel format
- *
- * Returns:
- * {Object} MapObject LonLat translated from MapObject Pixel
- */
- getMapObjectLonLatFromMapObjectPixel: function(moPixel) {
- //the conditional here is to test if we are running the v6 of VE
- return (typeof VEPixel != 'undefined')
- ? this.mapObject.PixelToLatLong(moPixel)
- : this.mapObject.PixelToLatLong(moPixel.x, moPixel.y);
- },
-
- /**
- * APIMethod: getMapObjectPixelFromMapObjectLonLat
- *
- * Parameters:
- * moLonLat - {Object} MapObject LonLat format
- *
- * Returns:
- * {Object} MapObject Pixel transtlated from MapObject LonLat
- */
- getMapObjectPixelFromMapObjectLonLat: function(moLonLat) {
- return this.mapObject.LatLongToPixel(moLonLat);
- },
-
-
- /************************************
- * *
- * MapObject Primitives *
- * *
- ************************************/
-
-
- // LonLat
-
- /**
- * APIMethod: getLongitudeFromMapObjectLonLat
- *
- * Parameters:
- * moLonLat - {Object} MapObject LonLat format
- *
- * Returns:
- * {Float} Longitude of the given MapObject LonLat
- */
- getLongitudeFromMapObjectLonLat: function(moLonLat) {
- return this.sphericalMercator ?
- this.forwardMercator(moLonLat.Longitude, moLonLat.Latitude).lon :
- moLonLat.Longitude;
- },
-
- /**
- * APIMethod: getLatitudeFromMapObjectLonLat
- *
- * Parameters:
- * moLonLat - {Object} MapObject LonLat format
- *
- * Returns:
- * {Float} Latitude of the given MapObject LonLat
- */
- getLatitudeFromMapObjectLonLat: function(moLonLat) {
- return this.sphericalMercator ?
- this.forwardMercator(moLonLat.Longitude, moLonLat.Latitude).lat :
- moLonLat.Latitude;
- },
-
- /**
- * APIMethod: getMapObjectLonLatFromLonLat
- *
- * Parameters:
- * lon - {Float}
- * lat - {Float}
- *
- * Returns:
- * {Object} MapObject LonLat built from lon and lat params
- */
- getMapObjectLonLatFromLonLat: function(lon, lat) {
- var veLatLong;
- if(this.sphericalMercator) {
- var lonlat = this.inverseMercator(lon, lat);
- veLatLong = new VELatLong(lonlat.lat, lonlat.lon);
- } else {
- veLatLong = new VELatLong(lat, lon);
- }
- return veLatLong;
- },
-
- // Pixel
-
- /**
- * APIMethod: getXFromMapObjectPixel
- *
- * Parameters:
- * moPixel - {Object} MapObject Pixel format
- *
- * Returns:
- * {Integer} X value of the MapObject Pixel
- */
- getXFromMapObjectPixel: function(moPixel) {
- return moPixel.x;
- },
-
- /**
- * APIMethod: getYFromMapObjectPixel
- *
- * Parameters:
- * moPixel - {Object} MapObject Pixel format
- *
- * Returns:
- * {Integer} Y value of the MapObject Pixel
- */
- getYFromMapObjectPixel: function(moPixel) {
- return moPixel.y;
- },
-
- /**
- * APIMethod: getMapObjectPixelFromXY
- *
- * Parameters:
- * x - {Integer}
- * y - {Integer}
- *
- * Returns:
- * {Object} MapObject Pixel from x and y parameters
- */
- getMapObjectPixelFromXY: function(x, y) {
- //the conditional here is to test if we are running the v6 of VE
- return (typeof VEPixel != 'undefined') ? new VEPixel(x, y)
- : new Msn.VE.Pixel(x, y);
- },
-
- CLASS_NAME: "OpenLayers.Layer.VirtualEarth"
-});
diff --git a/lib/OpenLayers/Layer/WFS.js b/lib/OpenLayers/Layer/WFS.js
deleted file mode 100644
index af9ef0376b..0000000000
--- a/lib/OpenLayers/Layer/WFS.js
+++ /dev/null
@@ -1,610 +0,0 @@
-/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the Clear BSD license.
- * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
- * full text of the license. */
-
-
-/**
- * @requires OpenLayers/Tile/WFS.js
- * @requires OpenLayers/Layer/Vector.js
- * @requires OpenLayers/Layer/Markers.js
- * @requires OpenLayers/Console.js
- * @requires OpenLayers/Lang.js
- */
-
-/**
- * Class: OpenLayers.Layer.WFS
- * *Deprecated*. To be removed in 3.0. Instead use OpenLayers.Layer.Vector
- * with a Protocol.WFS and one or more Strategies.
- *
- * Inherits from:
- * -
- * -
- */
-OpenLayers.Layer.WFS = OpenLayers.Class(
- OpenLayers.Layer.Vector, OpenLayers.Layer.Markers, {
-
- /**
- * APIProperty: isBaseLayer
- * {Boolean} WFS layer is not a base layer by default.
- */
- isBaseLayer: false,
-
- /**
- * Property: tile
- * {}
- */
- tile: null,
-
- /**
- * APIProperty: ratio
- * {Float} The ratio property determines the size of the serverside query
- * relative to the map viewport size. By default, we load an area twice
- * as big as the map, to allow for panning without immediately reload.
- * Setting this to 1 will cause the area of the WFS request to match
- * the map area exactly. It is recommended to set this to some number
- * at least slightly larger than 1, otherwise accidental clicks can
- * cause a data reload, by moving the map only 1 pixel.
- */
- ratio: 2,
-
- /**
- * Property: DEFAULT_PARAMS
- * {Object} Hashtable of default key/value parameters
- */
- DEFAULT_PARAMS: { service: "WFS",
- version: "1.0.0",
- request: "GetFeature"
- },
-
- /**
- * APIProperty: featureClass
- * {} 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,
-
- /**
- * APIProperty: format
- * {} The format you want the data to be parsed with.
- * Must be passed in the constructor. Should be a class, not an instance.
- * This option can only be used if no featureClass is passed / vectorMode
- * is false: if a featureClass is passed, then this parameter is ignored.
- */
- format: null,
-
- /**
- * Property: formatObject
- * {} Internally created/managed format object, used by
- * the Tile to parse data.
- */
- formatObject: null,
-
- /**
- * APIProperty: formatOptions
- * {Object} Hash of options which should be passed to the format when it is
- * created. Must be passed in the constructor.
- */
- formatOptions: null,
-
- /**
- * Property: vectorMode
- * {Boolean} Should be calculated automatically. Determines whether the
- * layer is in vector mode or marker mode.
- */
- vectorMode: true,
-
- /**
- * APIProperty: encodeBBOX
- * {Boolean} Should the BBOX commas be encoded? The WMS spec says 'no',
- * but some services want it that way. Default false.
- */
- encodeBBOX: false,
-
- /**
- * APIProperty: extractAttributes
- * {Boolean} Should the WFS layer parse attributes from the retrieved
- * GML? Defaults to false. If enabled, parsing is slower, but
- * attributes are available in the attributes property of
- * layer features.
- */
- extractAttributes: false,
-
- /**
- * Constructor: OpenLayers.Layer.WFS
- *
- * 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 = {}; }
-
- if (options.featureClass ||
- !OpenLayers.Layer.Vector ||
- !OpenLayers.Feature.Vector) {
- this.vectorMode = false;
- }
-
- // Uppercase params
- params = OpenLayers.Util.upperCaseObject(params);
-
- // Turn off error reporting, browsers like Safari may work
- // depending on the setup, and we don't want an unneccesary alert.
- OpenLayers.Util.extend(options, {'reportError': false});
- var newArguments = [];
- newArguments.push(name, options);
- OpenLayers.Layer.Vector.prototype.initialize.apply(this, newArguments);
- if (!this.renderer || !this.vectorMode) {
- this.vectorMode = false;
- if (!options.featureClass) {
- options.featureClass = OpenLayers.Feature.WFS;
- }
- OpenLayers.Layer.Markers.prototype.initialize.apply(this,
- newArguments);
- }
-
- if (this.params && this.params.typename && !this.options.typename) {
- this.options.typename = this.params.typename;
- }
-
- if (!this.options.geometry_column) {
- this.options.geometry_column = "the_geom";
- }
-
- this.params = OpenLayers.Util.applyDefaults(
- params,
- OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS)
- );
- this.url = url;
- },
-
-
- /**
- * APIMethod: destroy
- */
- destroy: function() {
- if (this.vectorMode) {
- OpenLayers.Layer.Vector.prototype.destroy.apply(this, arguments);
- } else {
- OpenLayers.Layer.Markers.prototype.destroy.apply(this, arguments);
- }
- if (this.tile) {
- this.tile.destroy();
- }
- this.tile = null;
-
- this.ratio = null;
- this.featureClass = null;
- this.format = null;
-
- if (this.formatObject && this.formatObject.destroy) {
- this.formatObject.destroy();
- }
- this.formatObject = null;
-
- this.formatOptions = null;
- this.vectorMode = null;
- this.encodeBBOX = null;
- this.extractAttributes = null;
- },
-
- /**
- * Method: setMap
- *
- * Parameters:
- * map - {}
- */
- setMap: function(map) {
- if (this.vectorMode) {
- OpenLayers.Layer.Vector.prototype.setMap.apply(this, arguments);
-
- var options = {
- 'extractAttributes': this.extractAttributes
- };
-
- OpenLayers.Util.extend(options, this.formatOptions);
- if (this.map && !this.projection.equals(this.map.getProjectionObject())) {
- options.externalProjection = this.projection;
- options.internalProjection = this.map.getProjectionObject();
- }
-
- this.formatObject = this.format ? new this.format(options) : new OpenLayers.Format.GML(options);
- } else {
- OpenLayers.Layer.Markers.prototype.setMap.apply(this, arguments);
- }
- },
-
- /**
- * Method: moveTo
- *
- * Parameters:
- * bounds - {}
- * zoomChanged - {Boolean}
- * dragging - {Boolean}
- */
- moveTo:function(bounds, zoomChanged, dragging) {
- if (this.vectorMode) {
- OpenLayers.Layer.Vector.prototype.moveTo.apply(this, arguments);
- } else {
- OpenLayers.Layer.Markers.prototype.moveTo.apply(this, arguments);
- }
-
- // don't load wfs features while dragging, wait for drag end
- if (dragging) {
- // TBD try to hide the vector layer while dragging
- // this.setVisibility(false);
- // this will probably help for panning performances
- return false;
- }
-
- if ( zoomChanged ) {
- if (this.vectorMode) {
- this.renderer.clear();
- }
- }
-
- //DEPRECATED - REMOVE IN 3.0
- // don't load data if current zoom level doesn't match
- if (this.options.minZoomLevel) {
- OpenLayers.Console.warn(OpenLayers.i18n('minZoomLevelError'));
-
- if (this.map.getZoom() < this.options.minZoomLevel) {
- return null;
- }
- }
-
- if (bounds == null) {
- bounds = this.map.getExtent();
- }
-
- var firstRendering = (this.tile == null);
-
- //does the new bounds to which we need to move fall outside of the
- // current tile's bounds?
- var outOfBounds = (!firstRendering &&
- !this.tile.bounds.containsBounds(bounds));
-
- if (zoomChanged || firstRendering || (!dragging && outOfBounds)) {
- //determine new tile bounds
- var center = bounds.getCenterLonLat();
- var tileWidth = bounds.getWidth() * this.ratio;
- var tileHeight = bounds.getHeight() * this.ratio;
- var tileBounds =
- new OpenLayers.Bounds(center.lon - (tileWidth / 2),
- center.lat - (tileHeight / 2),
- center.lon + (tileWidth / 2),
- center.lat + (tileHeight / 2));
-
- //determine new tile size
- var tileSize = this.map.getSize();
- tileSize.w = tileSize.w * this.ratio;
- tileSize.h = tileSize.h * this.ratio;
-
- //determine new position (upper left corner of new bounds)
- var ul = new OpenLayers.LonLat(tileBounds.left, tileBounds.top);
- var pos = this.map.getLayerPxFromLonLat(ul);
-
- //formulate request url string
- var url = this.getFullRequestString();
-
- var params = null;
-
- // Cant combine "filter" and "BBOX". This is a cheap hack to help
- // people out who can't migrate to the WFS protocol immediately.
- var filter = this.params.filter || this.params.FILTER;
- if (filter) {
- params = {FILTER: filter};
- }
- else {
- params = {BBOX: this.encodeBBOX ? tileBounds.toBBOX()
- : tileBounds.toArray()};
- }
-
- if (this.map && !this.projection.equals(this.map.getProjectionObject())) {
- var projectedBounds = tileBounds.clone();
- projectedBounds.transform(this.map.getProjectionObject(),
- this.projection);
- if (!filter){
- params.BBOX = this.encodeBBOX ? projectedBounds.toBBOX()
- : projectedBounds.toArray();
- }
- }
-
- url += "&" + OpenLayers.Util.getParameterString(params);
-
- if (!this.tile) {
- this.tile = new OpenLayers.Tile.WFS(this, pos, tileBounds,
- url, tileSize);
- this.addTileMonitoringHooks(this.tile);
- this.tile.draw();
- } else {
- if (this.vectorMode) {
- this.destroyFeatures();
- this.renderer.clear();
- } else {
- this.clearMarkers();
- }
- this.removeTileMonitoringHooks(this.tile);
- this.tile.destroy();
-
- this.tile = null;
- this.tile = new OpenLayers.Tile.WFS(this, pos, tileBounds,
- url, tileSize);
- this.addTileMonitoringHooks(this.tile);
- this.tile.draw();
- }
- }
- },
-
- /**
- * Method: addTileMonitoringHooks
- * This function takes a tile as input and adds the appropriate hooks to
- * the tile so that the layer can keep track of the loading tile
- * (making sure to check that the tile is always the layer's current
- * tile before taking any action).
- *
- * Parameters:
- * tile - {}
- */
- addTileMonitoringHooks: function(tile) {
- tile.onLoadStart = function() {
- //if this is the the layer's current tile, then trigger
- // a 'loadstart'
- if (this == this.layer.tile) {
- this.layer.events.triggerEvent("loadstart");
- }
- };
- tile.events.register("loadstart", tile, tile.onLoadStart);
-
- tile.onLoadEnd = function() {
- //if this is the the layer's current tile, then trigger
- // a 'tileloaded' and 'loadend'
- if (this == this.layer.tile) {
- this.layer.events.triggerEvent("tileloaded");
- this.layer.events.triggerEvent("loadend");
- }
- };
- tile.events.register("loadend", tile, tile.onLoadEnd);
- tile.events.register("unload", tile, tile.onLoadEnd);
- },
-
- /**
- * Method: removeTileMonitoringHooks
- * This function takes a tile as input and removes the tile hooks
- * that were added in addTileMonitoringHooks()
- *
- * Parameters:
- * tile - {}
- */
- removeTileMonitoringHooks: function(tile) {
- tile.unload();
- tile.events.un({
- "loadstart": tile.onLoadStart,
- "loadend": tile.onLoadEnd,
- "unload": tile.onLoadEnd,
- scope: tile
- });
- },
-
- /**
- * Method: onMapResize
- * Call the onMapResize method of the appropriate parent class.
- */
- onMapResize: function() {
- if(this.vectorMode) {
- OpenLayers.Layer.Vector.prototype.onMapResize.apply(this,
- arguments);
- } else {
- OpenLayers.Layer.Markers.prototype.onMapResize.apply(this,
- arguments);
- }
- },
-
- /**
- * Method: display
- * Call the display method of the appropriate parent class.
- */
- display: function() {
- if(this.vectorMode) {
- OpenLayers.Layer.Vector.prototype.display.apply(this,
- arguments);
- } else {
- OpenLayers.Layer.Markers.prototype.display.apply(this,
- arguments);
- }
- },
-
- /**
- * APIMethod: mergeNewParams
- * Modify parameters for the layer and redraw.
- *
- * Parameters:
- * newParams - {Object}
- */
- mergeNewParams:function(newParams) {
- var upperParams = OpenLayers.Util.upperCaseObject(newParams);
- var newArguments = [upperParams];
- return OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this,
- newArguments);
- },
-
- /**
- * APIMethod: clone
- *
- * Parameters:
- * obj - {Object}
- *
- * Returns:
- * {} An exact clone of this OpenLayers.Layer.WFS
- */
- clone: function (obj) {
-
- if (obj == null) {
- obj = new OpenLayers.Layer.WFS(this.name,
- this.url,
- this.params,
- this.getOptions());
- }
-
- //get all additions from superclasses
- if (this.vectorMode) {
- obj = OpenLayers.Layer.Vector.prototype.clone.apply(this, [obj]);
- } else {
- obj = OpenLayers.Layer.Markers.prototype.clone.apply(this, [obj]);
- }
-
- // copy/set any non-init, non-simple values here
-
- return obj;
- },
-
- /**
- * 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}
- * altUrl - {String} Use this as the url instead of the layer's url
- */
- getFullRequestString:function(newParams, altUrl) {
- var projectionCode = this.projection.getCode() || this.map.getProjection();
- this.params.SRS = (projectionCode == "none") ? null : projectionCode;
-
- return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(
- this, arguments);
- },
-
- /**
- * APIMethod: commit
- * Write out the data to a WFS server.
- */
- commit: function() {
- if (!this.writer) {
- var options = {};
- if (this.map && !this.projection.equals(this.map.getProjectionObject())) {
- options.externalProjection = this.projection;
- options.internalProjection = this.map.getProjectionObject();
- }
-
- this.writer = new OpenLayers.Format.WFS(options,this);
- }
-
- var data = this.writer.write(this.features);
-
- OpenLayers.Request.POST({
- url: this.url,
- data: data,
- success: this.commitSuccess,
- failure: this.commitFailure,
- scope: this
- });
- },
-
- /**
- * Method: commitSuccess
- * Called when the Ajax request returns a response
- *
- * Parameters:
- * response - {XmlNode} from server
- */
- commitSuccess: function(request) {
- var response = request.responseText;
- if (response.indexOf('SUCCESS') != -1) {
- this.commitReport(OpenLayers.i18n("commitSuccess", {'response':response}));
-
- for(var i = 0; i < this.features.length; i++) {
- this.features[i].state = null;
- }
- // TBD redraw the layer or reset the state of features
- // foreach features: set state to null
- } else if (response.indexOf('FAILED') != -1 ||
- response.indexOf('Exception') != -1) {
- this.commitReport(OpenLayers.i18n("commitFailed", {'response':response}));
- }
- },
-
- /**
- * Method: commitFailure
- * Called when the Ajax request fails
- *
- * 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 request text as a second parameter.
- * Override this function to provide custom transaction reporting.
- *
- * string - {String} reporting string
- * response - {String} full XML response
- */
- commitReport: function(string, response) {
- OpenLayers.Console.userError(string);
- },
-
-
- /**
- * APIMethod: refresh
- * Refreshes all the features of the layer
- */
- refresh: function() {
- if (this.tile) {
- if (this.vectorMode) {
- this.renderer.clear();
- this.features.length = 0;
- } else {
- this.clearMarkers();
- this.markers.length = 0;
- }
- this.tile.draw();
- }
- },
-
- /**
- * APIMethod: getDataExtent
- * Calculates the max extent which includes all of the layer data.
- *
- * Returns:
- * {}
- */
- getDataExtent: function () {
- var extent;
- //get all additions from superclasses
- if (this.vectorMode) {
- extent = OpenLayers.Layer.Vector.prototype.getDataExtent.apply(this);
- } else {
- extent = OpenLayers.Layer.Markers.prototype.getDataExtent.apply(this);
- }
-
- return extent;
- },
-
- /**
- * APIMethod: setOpacity
- * Call the setOpacity method of the appropriate parent class to set the
- * opacity.
- *
- * Parameter:
- * opacity - {Float}
- */
- setOpacity: function (opacity) {
- if (this.vectorMode) {
- OpenLayers.Layer.Vector.prototype.setOpacity.apply(this, [opacity]);
- } else {
- OpenLayers.Layer.Markers.prototype.setOpacity.apply(this, [opacity]);
- }
- },
-
- CLASS_NAME: "OpenLayers.Layer.WFS"
-});
diff --git a/lib/OpenLayers/Tile/WFS.js b/lib/OpenLayers/Tile/WFS.js
deleted file mode 100644
index d892a08f99..0000000000
--- a/lib/OpenLayers/Tile/WFS.js
+++ /dev/null
@@ -1,192 +0,0 @@
-/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the Clear BSD license.
- * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
- * full text of the license. */
-
-
-/**
- * @requires OpenLayers/Tile.js
- * @requires OpenLayers/Request/XMLHttpRequest.js
- */
-
-/**
- * Class: OpenLayers.Tile.WFS
- * Instances of OpenLayers.Tile.WFS are used to manage the image tiles
- * used by various layers. Create a new image tile with the
- * constructor.
- *
- * Inherits from:
- * -
- */
-OpenLayers.Tile.WFS = OpenLayers.Class(OpenLayers.Tile, {
-
- /**
- * Property: features
- * {Array()} list of features in this tile
- */
- features: null,
-
- /**
- * Property: url
- * {String}
- */
- url: null,
-
- /**
- * Property: request
- * {}
- */
- request: null,
-
- /** TBD 3.0 - reorder the parameters to the init function to put URL
- * as last, so we can continue to call tile.initialize()
- * without changing the arguments.
- *
- * Constructor: OpenLayers.Tile.WFS
- * Constructor for a new instance.
- *
- * Parameters:
- * layer - {} layer that the tile will go in.
- * position - {}
- * bounds - {}
- * url - {}
- * size - {}
- */
- initialize: function(layer, position, bounds, url, size) {
- OpenLayers.Tile.prototype.initialize.apply(this, arguments);
- this.url = url;
- this.features = [];
- },
-
- /**
- * APIMethod: destroy
- * nullify references to prevent circular references and memory leaks
- */
- destroy: function() {
- OpenLayers.Tile.prototype.destroy.apply(this, arguments);
- this.destroyAllFeatures();
- this.features = null;
- this.url = null;
- if(this.request) {
- this.request.abort();
- //this.request.destroy();
- this.request = null;
- }
- },
-
- /**
- * Method: clear
- * Clear the tile of any bounds/position-related data so that it can
- * be reused in a new location.
- */
- clear: function() {
- this.destroyAllFeatures();
- },
-
- /**
- * Method: draw
- * Check that a tile should be drawn, and load features for it.
- */
- draw:function() {
- if (OpenLayers.Tile.prototype.draw.apply(this, arguments)) {
- if (this.isLoading) {
- //if already loading, send 'reload' instead of 'loadstart'.
- this.events.triggerEvent("reload");
- } else {
- this.isLoading = true;
- this.events.triggerEvent("loadstart");
- }
- this.loadFeaturesForRegion(this.requestSuccess);
- }
- },
-
- /**
- * Method: loadFeaturesForRegion
- * Abort any pending requests and issue another request for data.
- *
- * Input are function pointers for what to do on success and failure.
- *
- * Parameters:
- * success - {function}
- * failure - {function}
- */
- loadFeaturesForRegion:function(success, failure) {
- if(this.request) {
- this.request.abort();
- }
- this.request = OpenLayers.Request.GET({
- url: this.url,
- success: success,
- failure: failure,
- scope: this
- });
- },
-
- /**
- * Method: requestSuccess
- * Called on return from request succcess. Adds results via
- * layer.addFeatures in vector mode, addResults otherwise.
- *
- * Parameters:
- * request - {}
- */
- requestSuccess:function(request) {
- if (this.features) {
- var doc = request.responseXML;
- if (!doc || !doc.documentElement) {
- doc = request.responseText;
- }
- if (this.layer.vectorMode) {
- this.layer.addFeatures(this.layer.formatObject.read(doc));
- } else {
- var xml = new OpenLayers.Format.XML();
- if (typeof doc == "string") {
- doc = xml.read(doc);
- }
- var resultFeatures = xml.getElementsByTagNameNS(
- doc, "http://www.opengis.net/gml", "featureMember"
- );
- this.addResults(resultFeatures);
- }
- }
- if (this.events) {
- this.events.triggerEvent("loadend");
- }
-
- //request produced with success, we can delete the request object.
- //this.request.destroy();
- this.request = null;
- },
-
- /**
- * Method: addResults
- * Construct new feature via layer featureClass constructor, and add to
- * this.features.
- *
- * Parameters:
- * results - {Object}
- */
- addResults: function(results) {
- for (var i=0; i < results.length; i++) {
- var feature = new this.layer.featureClass(this.layer,
- results[i]);
- this.features.push(feature);
- }
- },
-
-
- /**
- * Method: destroyAllFeatures
- * Iterate through and call destroy() on each feature, removing it from
- * the local array
- */
- destroyAllFeatures: function() {
- while(this.features.length > 0) {
- var feature = this.features.shift();
- feature.destroy();
- }
- },
-
- CLASS_NAME: "OpenLayers.Tile.WFS"
- }
-);
diff --git a/lib/OpenLayers/Util.js b/lib/OpenLayers/Util.js
index 729bbce20d..a907e03023 100644
--- a/lib/OpenLayers/Util.js
+++ b/lib/OpenLayers/Util.js
@@ -10,7 +10,6 @@
* @requires OpenLayers/BaseTypes/LonLat.js
* @requires OpenLayers/BaseTypes/Pixel.js
* @requires OpenLayers/BaseTypes/Size.js
- * @requires OpenLayers/Console.js
* @requires OpenLayers/Lang.js
*/
@@ -103,23 +102,6 @@ OpenLayers.Util.removeItem = function(array, item) {
return array;
};
-/**
- * Function: clearArray
- * *Deprecated*. This function will disappear in 3.0.
- * Please use "array.length = 0" instead.
- *
- * Parameters:
- * array - {Array}
- */
-OpenLayers.Util.clearArray = function(array) {
- OpenLayers.Console.warn(
- OpenLayers.i18n(
- "methodDeprecated", {'newMethod': 'array = []'}
- )
- );
- array.length = 0;
-};
-
/**
* Function: indexOf
* Seems to exist already in FF, but not in MOZ.
@@ -299,27 +281,6 @@ OpenLayers.Util.createImage = function(id, px, sz, imgURL, position, border,
return image;
};
-/**
- * Function: setOpacity
- * *Deprecated*. This function has been deprecated. Instead, please use
- *
- * or
- *
- *
- * Set the opacity of a DOM Element
- * Note that for this function to work in IE, elements must "have layout"
- * according to:
- * http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/haslayout.asp
- *
- * Parameters:
- * element - {DOMElement} Set the opacity on this DOM element
- * opacity - {Float} Opacity value (0.0 - 1.0)
- */
-OpenLayers.Util.setOpacity = function(element, opacity) {
- OpenLayers.Util.modifyDOMElement(element, null, null, null,
- null, null, null, opacity);
-};
-
/**
* Property: IMAGE_RELOAD_ATTEMPTS
* {Integer} How many times should we try to reload an image before giving up?
@@ -930,27 +891,6 @@ OpenLayers.Util.getParameters = function(url) {
return parameters;
};
-/**
- * Function: getArgs
- * *Deprecated*. Will be removed in 3.0. Please use instead
- *
- *
- * Parameters:
- * url - {String} Optional url used to extract the query string.
- * If null, query string is taken from page location.
- *
- * Returns:
- * {Object} An object of key/value pairs from the query string.
- */
-OpenLayers.Util.getArgs = function(url) {
- OpenLayers.Console.warn(
- OpenLayers.i18n(
- "methodDeprecated", {'newMethod': 'OpenLayers.Util.getParameters'}
- )
- );
- return OpenLayers.Util.getParameters(url);
-};
-
/**
* Property: lastSeqID
* {Integer} The ever-incrementing count variable.
@@ -1155,22 +1095,6 @@ OpenLayers.Util.getScaleFromResolution = function (resolution, units) {
return scale;
};
-/**
- * Function: safeStopPropagation
- * *Deprecated*. This function has been deprecated. Please use directly
- * passing 'true' as the 2nd
- * argument (preventDefault)
- *
- * Safely stop the propagation of an event *without* preventing
- * the default browser action from occurring.
- *
- * Parameter:
- * evt - {Event}
- */
-OpenLayers.Util.safeStopPropagation = function(evt) {
- OpenLayers.Event.stop(evt, true);
-};
-
/**
* Function: pagePosition
* Calculates the position of an element on the page (see
diff --git a/lib/deprecated.js b/lib/deprecated.js
index 11a80ed00c..3a844da75d 100644
--- a/lib/deprecated.js
+++ b/lib/deprecated.js
@@ -6,6 +6,16 @@
* @requires OpenLayers/Request.js
* @requires OpenLayers/Layer/WMS.js
* @requires OpenLayers/Layer/MapServer.js
+ * @requires OpenLayers/Tile.js
+ * @requires OpenLayers/Request/XMLHttpRequest.js
+ * @requires OpenLayers/Layer/Vector.js
+ * @requires OpenLayers/Layer/Markers.js
+ * @requires OpenLayers/Console.js
+ * @requires OpenLayers/Lang.js
+ * @requires OpenLayers/Feature.js
+ * @requires OpenLayers/Layer/EventPane.js
+ * @requires OpenLayers/Layer/FixedZoomLevels.js
+ * @requires OpenLayers/Layer/SphericalMercator.js
*/
/**
@@ -54,6 +64,89 @@ OpenLayers.Class.inherit = function (P) {
return C.prototype;
};
+/**
+ * Namespace: OpenLayers.Util
+ */
+
+/**
+ * Function: clearArray
+ * *Deprecated*. This function will disappear in 3.0.
+ * Please use "array.length = 0" instead.
+ *
+ * Parameters:
+ * array - {Array}
+ */
+OpenLayers.Util.clearArray = function(array) {
+ OpenLayers.Console.warn(
+ OpenLayers.i18n(
+ "methodDeprecated", {'newMethod': 'array = []'}
+ )
+ );
+ array.length = 0;
+};
+
+/**
+ * Function: setOpacity
+ * *Deprecated*. This function has been deprecated. Instead, please use
+ *
+ * or
+ *
+ *
+ * Set the opacity of a DOM Element
+ * Note that for this function to work in IE, elements must "have layout"
+ * according to:
+ * http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/haslayout.asp
+ *
+ * Parameters:
+ * element - {DOMElement} Set the opacity on this DOM element
+ * opacity - {Float} Opacity value (0.0 - 1.0)
+ */
+OpenLayers.Util.setOpacity = function(element, opacity) {
+ OpenLayers.Util.modifyDOMElement(element, null, null, null,
+ null, null, null, opacity);
+};
+
+/**
+ * Function: safeStopPropagation
+ * *Deprecated*. This function has been deprecated. Please use directly
+ * passing 'true' as the 2nd
+ * argument (preventDefault)
+ *
+ * Safely stop the propagation of an event *without* preventing
+ * the default browser action from occurring.
+ *
+ * Parameter:
+ * evt - {Event}
+ */
+OpenLayers.Util.safeStopPropagation = function(evt) {
+ OpenLayers.Event.stop(evt, true);
+};
+
+/**
+ * Function: getArgs
+ * *Deprecated*. Will be removed in 3.0. Please use instead
+ *
+ *
+ * Parameters:
+ * url - {String} Optional url used to extract the query string.
+ * If null, query string is taken from page location.
+ *
+ * Returns:
+ * {Object} An object of key/value pairs from the query string.
+ */
+OpenLayers.Util.getArgs = function(url) {
+ OpenLayers.Console.warn(
+ OpenLayers.i18n(
+ "methodDeprecated", {'newMethod': 'OpenLayers.Util.getParameters'}
+ )
+ );
+ return OpenLayers.Util.getParameters(url);
+};
+
+/**
+ * Namespace: OpenLayers.Ajax
+ */
+
/**
* Function: OpenLayers.nullHandler
* @param {} request
@@ -145,10 +238,6 @@ OpenLayers.parseXMLString = function(text) {
return ajaxResponse;
};
-
-/**
- * Namespace: OpenLayers.Ajax
- */
OpenLayers.Ajax = {
/**
@@ -956,15 +1045,20 @@ if (!Function.prototype.bindAsEventListener) {
};
}
+// FIXME: Remove this in 3.0. In 3.0, Event.stop will no longer be provided
+// by OpenLayers.
+if (window.Event) {
+ OpenLayers.Util.applyDefaults(window.Event, OpenLayers.Event);
+} else {
+ var Event = OpenLayers.Event;
+}
+
/**
* Class: OpenLayers.Control.MouseDefaults
* This class is DEPRECATED in 2.4 and will be removed by 3.0.
* If you need this functionality, use
* instead!!!
*
- * This class is DEPRECATED in 2.4 and will be removed by 3.0.
- * If you need this functionality, use Control.Navigation instead!!!
- *
* Inherits from:
* -
*/
@@ -1712,6 +1806,30 @@ OpenLayers.Control.MouseToolbar = OpenLayers.Class(
OpenLayers.Control.MouseToolbar.X = 6;
OpenLayers.Control.MouseToolbar.Y = 300;
+/**
+ * Class: OpenLayers.Layer.Grid
+ */
+
+OpenLayers.Util.extend(OpenLayers.Layer.Grid.prototype, {
+
+ /**
+ * Method: getGridBounds
+ * Deprecated. This function will be removed in 3.0. Please use
+ * getTilesBounds() instead.
+ *
+ * Returns:
+ * {} A Bounds object representing the bounds of all the
+ * currently loaded tiles (including those partially or not at all seen
+ * onscreen)
+ */
+ getGridBounds: function() {
+ var msg = "The getGridBounds() function is deprecated. It will be " +
+ "removed in 3.0. Please use getTilesBounds() instead.";
+ OpenLayers.Console.warn(msg);
+ return this.getTilesBounds();
+ }
+});
+
/**
* Class: OpenLayers.Format.XML
*/
@@ -1969,3 +2087,1505 @@ OpenLayers.Layer.MapServer.Untiled = OpenLayers.Class(OpenLayers.Layer.MapServer
CLASS_NAME: "OpenLayers.Layer.MapServer.Untiled"
});
+
+/**
+ * Class: OpenLayers.Tile.WFS
+ * Instances of OpenLayers.Tile.WFS are used to manage the image tiles
+ * used by various layers. Create a new image tile with the
+ * constructor.
+ *
+ * Inherits from:
+ * -
+ */
+OpenLayers.Tile.WFS = OpenLayers.Class(OpenLayers.Tile, {
+
+ /**
+ * Property: features
+ * {Array()} list of features in this tile
+ */
+ features: null,
+
+ /**
+ * Property: url
+ * {String}
+ */
+ url: null,
+
+ /**
+ * Property: request
+ * {}
+ */
+ request: null,
+
+ /** TBD 3.0 - reorder the parameters to the init function to put URL
+ * as last, so we can continue to call tile.initialize()
+ * without changing the arguments.
+ *
+ * Constructor: OpenLayers.Tile.WFS
+ * Constructor for a new instance.
+ *
+ * Parameters:
+ * layer - {} layer that the tile will go in.
+ * position - {}
+ * bounds - {}
+ * url - {}
+ * size - {}
+ */
+ initialize: function(layer, position, bounds, url, size) {
+ OpenLayers.Tile.prototype.initialize.apply(this, arguments);
+ this.url = url;
+ this.features = [];
+ },
+
+ /**
+ * APIMethod: destroy
+ * nullify references to prevent circular references and memory leaks
+ */
+ destroy: function() {
+ OpenLayers.Tile.prototype.destroy.apply(this, arguments);
+ this.destroyAllFeatures();
+ this.features = null;
+ this.url = null;
+ if(this.request) {
+ this.request.abort();
+ //this.request.destroy();
+ this.request = null;
+ }
+ },
+
+ /**
+ * Method: clear
+ * Clear the tile of any bounds/position-related data so that it can
+ * be reused in a new location.
+ */
+ clear: function() {
+ this.destroyAllFeatures();
+ },
+
+ /**
+ * Method: draw
+ * Check that a tile should be drawn, and load features for it.
+ */
+ draw:function() {
+ if (OpenLayers.Tile.prototype.draw.apply(this, arguments)) {
+ if (this.isLoading) {
+ //if already loading, send 'reload' instead of 'loadstart'.
+ this.events.triggerEvent("reload");
+ } else {
+ this.isLoading = true;
+ this.events.triggerEvent("loadstart");
+ }
+ this.loadFeaturesForRegion(this.requestSuccess);
+ }
+ },
+
+ /**
+ * Method: loadFeaturesForRegion
+ * Abort any pending requests and issue another request for data.
+ *
+ * Input are function pointers for what to do on success and failure.
+ *
+ * Parameters:
+ * success - {function}
+ * failure - {function}
+ */
+ loadFeaturesForRegion:function(success, failure) {
+ if(this.request) {
+ this.request.abort();
+ }
+ this.request = OpenLayers.Request.GET({
+ url: this.url,
+ success: success,
+ failure: failure,
+ scope: this
+ });
+ },
+
+ /**
+ * Method: requestSuccess
+ * Called on return from request succcess. Adds results via
+ * layer.addFeatures in vector mode, addResults otherwise.
+ *
+ * Parameters:
+ * request - {}
+ */
+ requestSuccess:function(request) {
+ if (this.features) {
+ var doc = request.responseXML;
+ if (!doc || !doc.documentElement) {
+ doc = request.responseText;
+ }
+ if (this.layer.vectorMode) {
+ this.layer.addFeatures(this.layer.formatObject.read(doc));
+ } else {
+ var xml = new OpenLayers.Format.XML();
+ if (typeof doc == "string") {
+ doc = xml.read(doc);
+ }
+ var resultFeatures = xml.getElementsByTagNameNS(
+ doc, "http://www.opengis.net/gml", "featureMember"
+ );
+ this.addResults(resultFeatures);
+ }
+ }
+ if (this.events) {
+ this.events.triggerEvent("loadend");
+ }
+
+ //request produced with success, we can delete the request object.
+ //this.request.destroy();
+ this.request = null;
+ },
+
+ /**
+ * Method: addResults
+ * Construct new feature via layer featureClass constructor, and add to
+ * this.features.
+ *
+ * Parameters:
+ * results - {Object}
+ */
+ addResults: function(results) {
+ for (var i=0; i < results.length; i++) {
+ var feature = new this.layer.featureClass(this.layer,
+ results[i]);
+ this.features.push(feature);
+ }
+ },
+
+
+ /**
+ * Method: destroyAllFeatures
+ * Iterate through and call destroy() on each feature, removing it from
+ * the local array
+ */
+ destroyAllFeatures: function() {
+ while(this.features.length > 0) {
+ var feature = this.features.shift();
+ feature.destroy();
+ }
+ },
+
+ CLASS_NAME: "OpenLayers.Tile.WFS"
+ }
+);
+
+/**
+ * Class: OpenLayers.Feature.WFS
+ * WFS handling class, for use as a featureClass on the WFS layer for handling
+ * 'point' WFS types. Good for subclassing when creating a custom WFS like
+ * XML application.
+ *
+ * Inherits from:
+ * -
+ */
+OpenLayers.Feature.WFS = OpenLayers.Class(OpenLayers.Feature, {
+
+ /**
+ * Constructor: OpenLayers.Feature.WFS
+ * Create a WFS feature.
+ *
+ * Parameters:
+ * layer - {}
+ * xmlNode - {XMLNode}
+ */
+ initialize: function(layer, xmlNode) {
+ var newArguments = arguments;
+ var data = this.processXMLNode(xmlNode);
+ newArguments = new Array(layer, data.lonlat, data);
+ OpenLayers.Feature.prototype.initialize.apply(this, newArguments);
+ this.createMarker();
+ this.layer.addMarker(this.marker);
+ },
+
+ /**
+ * Method: destroy
+ * nullify references to prevent circular references and memory leaks
+ */
+ destroy: function() {
+ if (this.marker != null) {
+ this.layer.removeMarker(this.marker);
+ }
+ OpenLayers.Feature.prototype.destroy.apply(this, arguments);
+ },
+
+ /**
+ * Method: processXMLNode
+ * When passed an xmlNode, parses it for a GML point, and passes
+ * back an object describing that point.
+ *
+ * For subclasses of Feature.WFS, this is the feature to change.
+ *
+ * Parameters:
+ * xmlNode - {XMLNode}
+ *
+ * Returns:
+ * {Object} Data Object with 'id', 'lonlat', and private properties set
+ */
+ processXMLNode: function(xmlNode) {
+ //this should be overridden by subclasses
+ // must return an Object with 'id' and 'lonlat' values set
+ var point = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode, "http://www.opengis.net/gml", "gml", "Point");
+ var text = OpenLayers.Util.getXmlNodeValue(OpenLayers.Ajax.getElementsByTagNameNS(point[0], "http://www.opengis.net/gml","gml", "coordinates")[0]);
+ var floats = text.split(",");
+ return {lonlat: new OpenLayers.LonLat(parseFloat(floats[0]),
+ parseFloat(floats[1])),
+ id: null};
+
+ },
+
+ CLASS_NAME: "OpenLayers.Feature.WFS"
+});
+
+
+/**
+ * Class: OpenLayers.Layer.WFS
+ * *Deprecated*. To be removed in 3.0. Instead use OpenLayers.Layer.Vector
+ * with a Protocol.WFS and one or more Strategies.
+ *
+ * Inherits from:
+ * -
+ * -
+ */
+OpenLayers.Layer.WFS = OpenLayers.Class(
+ OpenLayers.Layer.Vector, OpenLayers.Layer.Markers, {
+
+ /**
+ * APIProperty: isBaseLayer
+ * {Boolean} WFS layer is not a base layer by default.
+ */
+ isBaseLayer: false,
+
+ /**
+ * Property: tile
+ * {}
+ */
+ tile: null,
+
+ /**
+ * APIProperty: ratio
+ * {Float} The ratio property determines the size of the serverside query
+ * relative to the map viewport size. By default, we load an area twice
+ * as big as the map, to allow for panning without immediately reload.
+ * Setting this to 1 will cause the area of the WFS request to match
+ * the map area exactly. It is recommended to set this to some number
+ * at least slightly larger than 1, otherwise accidental clicks can
+ * cause a data reload, by moving the map only 1 pixel.
+ */
+ ratio: 2,
+
+ /**
+ * Property: DEFAULT_PARAMS
+ * {Object} Hashtable of default key/value parameters
+ */
+ DEFAULT_PARAMS: { service: "WFS",
+ version: "1.0.0",
+ request: "GetFeature"
+ },
+
+ /**
+ * APIProperty: featureClass
+ * {} 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,
+
+ /**
+ * APIProperty: format
+ * {} The format you want the data to be parsed with.
+ * Must be passed in the constructor. Should be a class, not an instance.
+ * This option can only be used if no featureClass is passed / vectorMode
+ * is false: if a featureClass is passed, then this parameter is ignored.
+ */
+ format: null,
+
+ /**
+ * Property: formatObject
+ * {} Internally created/managed format object, used by
+ * the Tile to parse data.
+ */
+ formatObject: null,
+
+ /**
+ * APIProperty: formatOptions
+ * {Object} Hash of options which should be passed to the format when it is
+ * created. Must be passed in the constructor.
+ */
+ formatOptions: null,
+
+ /**
+ * Property: vectorMode
+ * {Boolean} Should be calculated automatically. Determines whether the
+ * layer is in vector mode or marker mode.
+ */
+ vectorMode: true,
+
+ /**
+ * APIProperty: encodeBBOX
+ * {Boolean} Should the BBOX commas be encoded? The WMS spec says 'no',
+ * but some services want it that way. Default false.
+ */
+ encodeBBOX: false,
+
+ /**
+ * APIProperty: extractAttributes
+ * {Boolean} Should the WFS layer parse attributes from the retrieved
+ * GML? Defaults to false. If enabled, parsing is slower, but
+ * attributes are available in the attributes property of
+ * layer features.
+ */
+ extractAttributes: false,
+
+ /**
+ * Constructor: OpenLayers.Layer.WFS
+ *
+ * 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 = {}; }
+
+ if (options.featureClass ||
+ !OpenLayers.Layer.Vector ||
+ !OpenLayers.Feature.Vector) {
+ this.vectorMode = false;
+ }
+
+ // Uppercase params
+ params = OpenLayers.Util.upperCaseObject(params);
+
+ // Turn off error reporting, browsers like Safari may work
+ // depending on the setup, and we don't want an unneccesary alert.
+ OpenLayers.Util.extend(options, {'reportError': false});
+ var newArguments = [];
+ newArguments.push(name, options);
+ OpenLayers.Layer.Vector.prototype.initialize.apply(this, newArguments);
+ if (!this.renderer || !this.vectorMode) {
+ this.vectorMode = false;
+ if (!options.featureClass) {
+ options.featureClass = OpenLayers.Feature.WFS;
+ }
+ OpenLayers.Layer.Markers.prototype.initialize.apply(this,
+ newArguments);
+ }
+
+ if (this.params && this.params.typename && !this.options.typename) {
+ this.options.typename = this.params.typename;
+ }
+
+ if (!this.options.geometry_column) {
+ this.options.geometry_column = "the_geom";
+ }
+
+ this.params = OpenLayers.Util.applyDefaults(
+ params,
+ OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS)
+ );
+ this.url = url;
+ },
+
+
+ /**
+ * APIMethod: destroy
+ */
+ destroy: function() {
+ if (this.vectorMode) {
+ OpenLayers.Layer.Vector.prototype.destroy.apply(this, arguments);
+ } else {
+ OpenLayers.Layer.Markers.prototype.destroy.apply(this, arguments);
+ }
+ if (this.tile) {
+ this.tile.destroy();
+ }
+ this.tile = null;
+
+ this.ratio = null;
+ this.featureClass = null;
+ this.format = null;
+
+ if (this.formatObject && this.formatObject.destroy) {
+ this.formatObject.destroy();
+ }
+ this.formatObject = null;
+
+ this.formatOptions = null;
+ this.vectorMode = null;
+ this.encodeBBOX = null;
+ this.extractAttributes = null;
+ },
+
+ /**
+ * Method: setMap
+ *
+ * Parameters:
+ * map - {}
+ */
+ setMap: function(map) {
+ if (this.vectorMode) {
+ OpenLayers.Layer.Vector.prototype.setMap.apply(this, arguments);
+
+ var options = {
+ 'extractAttributes': this.extractAttributes
+ };
+
+ OpenLayers.Util.extend(options, this.formatOptions);
+ if (this.map && !this.projection.equals(this.map.getProjectionObject())) {
+ options.externalProjection = this.projection;
+ options.internalProjection = this.map.getProjectionObject();
+ }
+
+ this.formatObject = this.format ? new this.format(options) : new OpenLayers.Format.GML(options);
+ } else {
+ OpenLayers.Layer.Markers.prototype.setMap.apply(this, arguments);
+ }
+ },
+
+ /**
+ * Method: moveTo
+ *
+ * Parameters:
+ * bounds - {}
+ * zoomChanged - {Boolean}
+ * dragging - {Boolean}
+ */
+ moveTo:function(bounds, zoomChanged, dragging) {
+ if (this.vectorMode) {
+ OpenLayers.Layer.Vector.prototype.moveTo.apply(this, arguments);
+ } else {
+ OpenLayers.Layer.Markers.prototype.moveTo.apply(this, arguments);
+ }
+
+ // don't load wfs features while dragging, wait for drag end
+ if (dragging) {
+ // TBD try to hide the vector layer while dragging
+ // this.setVisibility(false);
+ // this will probably help for panning performances
+ return false;
+ }
+
+ if ( zoomChanged ) {
+ if (this.vectorMode) {
+ this.renderer.clear();
+ }
+ }
+
+ //DEPRECATED - REMOVE IN 3.0
+ // don't load data if current zoom level doesn't match
+ if (this.options.minZoomLevel) {
+ OpenLayers.Console.warn(OpenLayers.i18n('minZoomLevelError'));
+
+ if (this.map.getZoom() < this.options.minZoomLevel) {
+ return null;
+ }
+ }
+
+ if (bounds == null) {
+ bounds = this.map.getExtent();
+ }
+
+ var firstRendering = (this.tile == null);
+
+ //does the new bounds to which we need to move fall outside of the
+ // current tile's bounds?
+ var outOfBounds = (!firstRendering &&
+ !this.tile.bounds.containsBounds(bounds));
+
+ if (zoomChanged || firstRendering || (!dragging && outOfBounds)) {
+ //determine new tile bounds
+ var center = bounds.getCenterLonLat();
+ var tileWidth = bounds.getWidth() * this.ratio;
+ var tileHeight = bounds.getHeight() * this.ratio;
+ var tileBounds =
+ new OpenLayers.Bounds(center.lon - (tileWidth / 2),
+ center.lat - (tileHeight / 2),
+ center.lon + (tileWidth / 2),
+ center.lat + (tileHeight / 2));
+
+ //determine new tile size
+ var tileSize = this.map.getSize();
+ tileSize.w = tileSize.w * this.ratio;
+ tileSize.h = tileSize.h * this.ratio;
+
+ //determine new position (upper left corner of new bounds)
+ var ul = new OpenLayers.LonLat(tileBounds.left, tileBounds.top);
+ var pos = this.map.getLayerPxFromLonLat(ul);
+
+ //formulate request url string
+ var url = this.getFullRequestString();
+
+ var params = null;
+
+ // Cant combine "filter" and "BBOX". This is a cheap hack to help
+ // people out who can't migrate to the WFS protocol immediately.
+ var filter = this.params.filter || this.params.FILTER;
+ if (filter) {
+ params = {FILTER: filter};
+ }
+ else {
+ params = {BBOX: this.encodeBBOX ? tileBounds.toBBOX()
+ : tileBounds.toArray()};
+ }
+
+ if (this.map && !this.projection.equals(this.map.getProjectionObject())) {
+ var projectedBounds = tileBounds.clone();
+ projectedBounds.transform(this.map.getProjectionObject(),
+ this.projection);
+ if (!filter){
+ params.BBOX = this.encodeBBOX ? projectedBounds.toBBOX()
+ : projectedBounds.toArray();
+ }
+ }
+
+ url += "&" + OpenLayers.Util.getParameterString(params);
+
+ if (!this.tile) {
+ this.tile = new OpenLayers.Tile.WFS(this, pos, tileBounds,
+ url, tileSize);
+ this.addTileMonitoringHooks(this.tile);
+ this.tile.draw();
+ } else {
+ if (this.vectorMode) {
+ this.destroyFeatures();
+ this.renderer.clear();
+ } else {
+ this.clearMarkers();
+ }
+ this.removeTileMonitoringHooks(this.tile);
+ this.tile.destroy();
+
+ this.tile = null;
+ this.tile = new OpenLayers.Tile.WFS(this, pos, tileBounds,
+ url, tileSize);
+ this.addTileMonitoringHooks(this.tile);
+ this.tile.draw();
+ }
+ }
+ },
+
+ /**
+ * Method: addTileMonitoringHooks
+ * This function takes a tile as input and adds the appropriate hooks to
+ * the tile so that the layer can keep track of the loading tile
+ * (making sure to check that the tile is always the layer's current
+ * tile before taking any action).
+ *
+ * Parameters:
+ * tile - {}
+ */
+ addTileMonitoringHooks: function(tile) {
+ tile.onLoadStart = function() {
+ //if this is the the layer's current tile, then trigger
+ // a 'loadstart'
+ if (this == this.layer.tile) {
+ this.layer.events.triggerEvent("loadstart");
+ }
+ };
+ tile.events.register("loadstart", tile, tile.onLoadStart);
+
+ tile.onLoadEnd = function() {
+ //if this is the the layer's current tile, then trigger
+ // a 'tileloaded' and 'loadend'
+ if (this == this.layer.tile) {
+ this.layer.events.triggerEvent("tileloaded");
+ this.layer.events.triggerEvent("loadend");
+ }
+ };
+ tile.events.register("loadend", tile, tile.onLoadEnd);
+ tile.events.register("unload", tile, tile.onLoadEnd);
+ },
+
+ /**
+ * Method: removeTileMonitoringHooks
+ * This function takes a tile as input and removes the tile hooks
+ * that were added in addTileMonitoringHooks()
+ *
+ * Parameters:
+ * tile - {}
+ */
+ removeTileMonitoringHooks: function(tile) {
+ tile.unload();
+ tile.events.un({
+ "loadstart": tile.onLoadStart,
+ "loadend": tile.onLoadEnd,
+ "unload": tile.onLoadEnd,
+ scope: tile
+ });
+ },
+
+ /**
+ * Method: onMapResize
+ * Call the onMapResize method of the appropriate parent class.
+ */
+ onMapResize: function() {
+ if(this.vectorMode) {
+ OpenLayers.Layer.Vector.prototype.onMapResize.apply(this,
+ arguments);
+ } else {
+ OpenLayers.Layer.Markers.prototype.onMapResize.apply(this,
+ arguments);
+ }
+ },
+
+ /**
+ * Method: display
+ * Call the display method of the appropriate parent class.
+ */
+ display: function() {
+ if(this.vectorMode) {
+ OpenLayers.Layer.Vector.prototype.display.apply(this,
+ arguments);
+ } else {
+ OpenLayers.Layer.Markers.prototype.display.apply(this,
+ arguments);
+ }
+ },
+
+ /**
+ * APIMethod: mergeNewParams
+ * Modify parameters for the layer and redraw.
+ *
+ * Parameters:
+ * newParams - {Object}
+ */
+ mergeNewParams:function(newParams) {
+ var upperParams = OpenLayers.Util.upperCaseObject(newParams);
+ var newArguments = [upperParams];
+ return OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this,
+ newArguments);
+ },
+
+ /**
+ * APIMethod: clone
+ *
+ * Parameters:
+ * obj - {Object}
+ *
+ * Returns:
+ * {} An exact clone of this OpenLayers.Layer.WFS
+ */
+ clone: function (obj) {
+
+ if (obj == null) {
+ obj = new OpenLayers.Layer.WFS(this.name,
+ this.url,
+ this.params,
+ this.getOptions());
+ }
+
+ //get all additions from superclasses
+ if (this.vectorMode) {
+ obj = OpenLayers.Layer.Vector.prototype.clone.apply(this, [obj]);
+ } else {
+ obj = OpenLayers.Layer.Markers.prototype.clone.apply(this, [obj]);
+ }
+
+ // copy/set any non-init, non-simple values here
+
+ return obj;
+ },
+
+ /**
+ * 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}
+ * altUrl - {String} Use this as the url instead of the layer's url
+ */
+ getFullRequestString:function(newParams, altUrl) {
+ var projectionCode = this.projection.getCode() || this.map.getProjection();
+ this.params.SRS = (projectionCode == "none") ? null : projectionCode;
+
+ return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(
+ this, arguments);
+ },
+
+ /**
+ * APIMethod: commit
+ * Write out the data to a WFS server.
+ */
+ commit: function() {
+ if (!this.writer) {
+ var options = {};
+ if (this.map && !this.projection.equals(this.map.getProjectionObject())) {
+ options.externalProjection = this.projection;
+ options.internalProjection = this.map.getProjectionObject();
+ }
+
+ this.writer = new OpenLayers.Format.WFS(options,this);
+ }
+
+ var data = this.writer.write(this.features);
+
+ OpenLayers.Request.POST({
+ url: this.url,
+ data: data,
+ success: this.commitSuccess,
+ failure: this.commitFailure,
+ scope: this
+ });
+ },
+
+ /**
+ * Method: commitSuccess
+ * Called when the Ajax request returns a response
+ *
+ * Parameters:
+ * response - {XmlNode} from server
+ */
+ commitSuccess: function(request) {
+ var response = request.responseText;
+ if (response.indexOf('SUCCESS') != -1) {
+ this.commitReport(OpenLayers.i18n("commitSuccess", {'response':response}));
+
+ for(var i = 0; i < this.features.length; i++) {
+ this.features[i].state = null;
+ }
+ // TBD redraw the layer or reset the state of features
+ // foreach features: set state to null
+ } else if (response.indexOf('FAILED') != -1 ||
+ response.indexOf('Exception') != -1) {
+ this.commitReport(OpenLayers.i18n("commitFailed", {'response':response}));
+ }
+ },
+
+ /**
+ * Method: commitFailure
+ * Called when the Ajax request fails
+ *
+ * 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 request text as a second parameter.
+ * Override this function to provide custom transaction reporting.
+ *
+ * string - {String} reporting string
+ * response - {String} full XML response
+ */
+ commitReport: function(string, response) {
+ OpenLayers.Console.userError(string);
+ },
+
+
+ /**
+ * APIMethod: refresh
+ * Refreshes all the features of the layer
+ */
+ refresh: function() {
+ if (this.tile) {
+ if (this.vectorMode) {
+ this.renderer.clear();
+ this.features.length = 0;
+ } else {
+ this.clearMarkers();
+ this.markers.length = 0;
+ }
+ this.tile.draw();
+ }
+ },
+
+ /**
+ * APIMethod: getDataExtent
+ * Calculates the max extent which includes all of the layer data.
+ *
+ * Returns:
+ * {}
+ */
+ getDataExtent: function () {
+ var extent;
+ //get all additions from superclasses
+ if (this.vectorMode) {
+ extent = OpenLayers.Layer.Vector.prototype.getDataExtent.apply(this);
+ } else {
+ extent = OpenLayers.Layer.Markers.prototype.getDataExtent.apply(this);
+ }
+
+ return extent;
+ },
+
+ /**
+ * APIMethod: setOpacity
+ * Call the setOpacity method of the appropriate parent class to set the
+ * opacity.
+ *
+ * Parameter:
+ * opacity - {Float}
+ */
+ setOpacity: function (opacity) {
+ if (this.vectorMode) {
+ OpenLayers.Layer.Vector.prototype.setOpacity.apply(this, [opacity]);
+ } else {
+ OpenLayers.Layer.Markers.prototype.setOpacity.apply(this, [opacity]);
+ }
+ },
+
+ CLASS_NAME: "OpenLayers.Layer.WFS"
+});
+
+/**
+ * Class: OpenLayers.Layer.MultiMap
+ * Note that MultiMap does not fully support the sphericalMercator
+ * option. See Ticket #953 for more details.
+ * *Deprecated*. Use OpenLayers.Layer.Bing instead. See #3063
+ *
+ * Inherits from:
+ * -
+ * -
+ */
+OpenLayers.Layer.MultiMap = OpenLayers.Class(
+ OpenLayers.Layer.EventPane, OpenLayers.Layer.FixedZoomLevels, {
+
+ /**
+ * Constant: MIN_ZOOM_LEVEL
+ * {Integer} 1
+ */
+ MIN_ZOOM_LEVEL: 1,
+
+ /**
+ * Constant: MAX_ZOOM_LEVEL
+ * {Integer} 17
+ */
+ MAX_ZOOM_LEVEL: 17,
+
+ /**
+ * 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
+ ],
+
+ /**
+ * APIProperty: type
+ * {?}
+ */
+ type: null,
+
+ /**
+ * Constructor: OpenLayers.Layer.MultiMap
+ *
+ * Parameters:
+ * name - {String}
+ * options - {Object}
+ */
+ initialize: function(name, options) {
+ OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
+ OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,
+ arguments);
+ if (this.sphericalMercator) {
+ OpenLayers.Util.extend(this, OpenLayers.Layer.SphericalMercator);
+ this.initMercatorParameters();
+ this.RESOLUTIONS.unshift(10);
+ }
+ },
+
+ /**
+ * Method: loadMapObject
+ */
+ loadMapObject:function() {
+ try { //crash proofing
+ this.mapObject = new MultimapViewer(this.div);
+ } catch (e) { }
+ },
+
+ /**
+ * APIMethod: getWarningHTML
+ *
+ * Returns:
+ * {String} String with information on why layer is broken, how to get
+ * it working.
+ */
+ getWarningHTML:function() {
+ return OpenLayers.i18n(
+ "getLayerWarning", {'layerType':"MM", 'layerLib':"MultiMap"}
+ );
+ },
+
+
+
+ /************************************
+ * *
+ * MapObject Interface Controls *
+ * *
+ ************************************/
+
+
+ // Get&Set Center, Zoom
+
+ /**
+ * APIMethod: setMapObjectCenter
+ * Set the mapObject to the specified center and zoom
+ *
+ * Parameters:
+ * center - {Object} MapObject LonLat format
+ * zoom - {int} MapObject zoom format
+ */
+ setMapObjectCenter: function(center, zoom) {
+ this.mapObject.goToPosition(center, zoom);
+ },
+
+ /**
+ * APIMethod: getMapObjectCenter
+ *
+ * Returns:
+ * {Object} The mapObject's current center in Map Object format
+ */
+ getMapObjectCenter: function() {
+ return this.mapObject.getCurrentPosition();
+ },
+
+ /**
+ * APIMethod: getMapObjectZoom
+ *
+ * Returns:
+ * {Integer} The mapObject's current zoom, in Map Object format
+ */
+ getMapObjectZoom: function() {
+ return this.mapObject.getZoomFactor();
+ },
+
+
+ // LonLat - Pixel Translation
+
+ /**
+ * APIMethod: getMapObjectLonLatFromMapObjectPixel
+ *
+ * Parameters:
+ * moPixel - {Object} MapObject Pixel format
+ *
+ * Returns:
+ * {Object} MapObject LonLat translated from MapObject Pixel
+ */
+ getMapObjectLonLatFromMapObjectPixel: function(moPixel) {
+ moPixel.x = moPixel.x - (this.map.getSize().w/2);
+ moPixel.y = moPixel.y - (this.map.getSize().h/2);
+ return this.mapObject.getMapPositionAt(moPixel);
+ },
+
+ /**
+ * APIMethod: getMapObjectPixelFromMapObjectLonLat
+ *
+ * Parameters:
+ * moLonLat - {Object} MapObject LonLat format
+ *
+ * Returns:
+ * {Object} MapObject Pixel transtlated from MapObject LonLat
+ */
+ getMapObjectPixelFromMapObjectLonLat: function(moLonLat) {
+ return this.mapObject.geoPosToContainerPixels(moLonLat);
+ },
+
+
+ /************************************
+ * *
+ * MapObject Primitives *
+ * *
+ ************************************/
+
+
+ // LonLat
+
+ /**
+ * APIMethod: getLongitudeFromMapObjectLonLat
+ *
+ * Parameters:
+ * moLonLat - {Object} MapObject LonLat format
+ *
+ * Returns:
+ * {Float} Longitude of the given MapObject LonLat
+ */
+ getLongitudeFromMapObjectLonLat: function(moLonLat) {
+ return this.sphericalMercator ?
+ this.forwardMercator(moLonLat.lon, moLonLat.lat).lon :
+ moLonLat.lon;
+ },
+
+ /**
+ * APIMethod: getLatitudeFromMapObjectLonLat
+ *
+ * Parameters:
+ * moLonLat - {Object} MapObject LonLat format
+ *
+ * Returns:
+ * {Float} Latitude of the given MapObject LonLat
+ */
+ getLatitudeFromMapObjectLonLat: function(moLonLat) {
+ return this.sphericalMercator ?
+ this.forwardMercator(moLonLat.lon, moLonLat.lat).lat :
+ moLonLat.lat;
+ },
+
+ /**
+ * APIMethod: getMapObjectLonLatFromLonLat
+ *
+ * Parameters:
+ * lon - {Float}
+ * lat - {Float}
+ *
+ * Returns:
+ * {Object} MapObject LonLat built from lon and lat params
+ */
+ getMapObjectLonLatFromLonLat: function(lon, lat) {
+ var mmLatLon;
+ if(this.sphericalMercator) {
+ var lonlat = this.inverseMercator(lon, lat);
+ mmLatLon = new MMLatLon(lonlat.lat, lonlat.lon);
+ } else {
+ mmLatLon = new MMLatLon(lat, lon);
+ }
+ return mmLatLon;
+ },
+
+ // Pixel
+
+ /**
+ * APIMethod: getXFromMapObjectPixel
+ *
+ * Parameters:
+ * moPixel - {Object} MapObject Pixel format
+ *
+ * Returns:
+ * {Integer} X value of the MapObject Pixel
+ */
+ getXFromMapObjectPixel: function(moPixel) {
+ return moPixel.x;
+ },
+
+ /**
+ * APIMethod: getYFromMapObjectPixel
+ *
+ * Parameters:
+ * moPixel - {Object} MapObject Pixel format
+ *
+ * Returns:
+ * {Integer} Y value of the MapObject Pixel
+ */
+ getYFromMapObjectPixel: function(moPixel) {
+ return moPixel.y;
+ },
+
+ /**
+ * APIMethod: getMapObjectPixelFromXY
+ *
+ * Parameters:
+ * x - {Integer}
+ * y - {Integer}
+ *
+ * Returns:
+ * {Object} MapObject Pixel from x and y parameters
+ */
+ getMapObjectPixelFromXY: function(x, y) {
+ return new MMPoint(x, y);
+ },
+
+ CLASS_NAME: "OpenLayers.Layer.MultiMap"
+});
+
+/**
+ * Class: OpenLayers.Layer.VirtualEarth
+ * *Deprecated*. Use instead.
+ *
+ * Instances of OpenLayers.Layer.VirtualEarth are used to display the data from
+ * the Bing Maps AJAX Control (see e.g.
+ * http://msdn.microsoft.com/library/bb429619.aspx). Create a VirtualEarth
+ * layer with the constructor.
+ *
+ * Inherits from:
+ * -
+ * -
+ */
+OpenLayers.Layer.VirtualEarth = OpenLayers.Class(
+ OpenLayers.Layer.EventPane,
+ OpenLayers.Layer.FixedZoomLevels, {
+
+ /**
+ * Constant: MIN_ZOOM_LEVEL
+ * {Integer} 1
+ */
+ MIN_ZOOM_LEVEL: 1,
+
+ /**
+ * Constant: MAX_ZOOM_LEVEL
+ * {Integer} 19
+ */
+ MAX_ZOOM_LEVEL: 19,
+
+ /**
+ * 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,
+ 0.00002145767211914062,
+ 0.00001072883605957031,
+ 0.00000536441802978515
+ ],
+
+ /**
+ * APIProperty: type
+ * {VEMapType}
+ */
+ type: null,
+
+ /**
+ * APIProperty: wrapDateLine
+ * {Boolean} Allow user to pan forever east/west. Default is true.
+ * Setting this to false only restricts panning if
+ * is true.
+ */
+ wrapDateLine: true,
+
+ /**
+ * APIProperty: sphericalMercator
+ * {Boolean} Should the map act as a mercator-projected map? This will
+ * cause all interactions with the map to be in the actual map
+ * projection, which allows support for vector drawing, overlaying
+ * other maps, etc.
+ */
+ sphericalMercator: false,
+
+ /**
+ * APIProperty: animationEnabled
+ * {Boolean} If set to true, the transition between zoom levels will be
+ * animated. Set to false to match the zooming experience of other
+ * layer types. Default is true.
+ */
+ animationEnabled: true,
+
+ /**
+ * Constructor: OpenLayers.Layer.VirtualEarth
+ * Creates a new instance of a OpenLayers.Layer.VirtualEarth. If you use an
+ * instance of OpenLayers.Layer.VirtualEarth in you map, you should set
+ * the option restrictedExtent to a meaningful value,
+ * e.g.:
+ * (code)
+ * var map = new OpenLayers.Map( 'map', {
+ * // other map options
+ * restrictedExtent : OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508)
+ * } );
+ *
+ * var veLayer = new OpenLayers.Layer.VirtualEarth (
+ * "Virtual Earth Layer"
+ * );
+ *
+ * map.addLayer( veLayer );
+ * (end)
+ *
+ * Parameters:
+ * name - {String}
+ * options - {Object}
+ */
+ initialize: function(name, options) {
+ OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
+ OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,
+ arguments);
+ if(this.sphericalMercator) {
+ OpenLayers.Util.extend(this, OpenLayers.Layer.SphericalMercator);
+ this.initMercatorParameters();
+ }
+ },
+
+ /**
+ * Method: loadMapObject
+ */
+ loadMapObject:function() {
+
+ // create div and set to same size as map
+ var veDiv = OpenLayers.Util.createDiv(this.name);
+ var sz = this.map.getSize();
+ veDiv.style.width = sz.w + "px";
+ veDiv.style.height = sz.h + "px";
+ this.div.appendChild(veDiv);
+
+ try { // crash prevention
+ this.mapObject = new VEMap(this.name);
+ } catch (e) { }
+
+ if (this.mapObject != null) {
+ try { // this is to catch a Mozilla bug without falling apart
+
+ // The fourth argument is whether the map is 'fixed' -- not
+ // draggable. See:
+ // http://blogs.msdn.com/virtualearth/archive/2007/09/28/locking-a-virtual-earth-map.aspx
+ //
+ this.mapObject.LoadMap(null, null, this.type, true);
+ this.mapObject.AttachEvent("onmousedown", OpenLayers.Function.True);
+
+ } catch (e) { }
+ this.mapObject.HideDashboard();
+ if(typeof this.mapObject.SetAnimationEnabled == "function") {
+ this.mapObject.SetAnimationEnabled(this.animationEnabled);
+ }
+ }
+
+ //can we do smooth panning? this is an unpublished method, so we need
+ // to be careful
+ if ( !this.mapObject ||
+ !this.mapObject.vemapcontrol ||
+ !this.mapObject.vemapcontrol.PanMap ||
+ (typeof this.mapObject.vemapcontrol.PanMap != "function")) {
+
+ this.dragPanMapObject = null;
+ }
+
+ },
+
+ /**
+ * Method: onMapResize
+ */
+ onMapResize: function() {
+ this.mapObject.Resize(this.map.size.w, this.map.size.h);
+ },
+
+ /**
+ * APIMethod: getWarningHTML
+ *
+ * Returns:
+ * {String} String with information on why layer is broken, how to get
+ * it working.
+ */
+ getWarningHTML:function() {
+ return OpenLayers.i18n(
+ "getLayerWarning", {'layerType':'VE', 'layerLib':'VirtualEarth'}
+ );
+ },
+
+
+
+ /************************************
+ * *
+ * MapObject Interface Controls *
+ * *
+ ************************************/
+
+
+ // Get&Set Center, Zoom
+
+ /**
+ * APIMethod: setMapObjectCenter
+ * Set the mapObject to the specified center and zoom
+ *
+ * Parameters:
+ * center - {Object} MapObject LonLat format
+ * zoom - {int} MapObject zoom format
+ */
+ setMapObjectCenter: function(center, zoom) {
+ this.mapObject.SetCenterAndZoom(center, zoom);
+ },
+
+ /**
+ * APIMethod: getMapObjectCenter
+ *
+ * Returns:
+ * {Object} The mapObject's current center in Map Object format
+ */
+ getMapObjectCenter: function() {
+ return this.mapObject.GetCenter();
+ },
+
+ /**
+ * APIMethod: dragPanMapObject
+ *
+ * Parameters:
+ * dX - {Integer}
+ * dY - {Integer}
+ */
+ dragPanMapObject: function(dX, dY) {
+ this.mapObject.vemapcontrol.PanMap(dX, -dY);
+ },
+
+ /**
+ * APIMethod: getMapObjectZoom
+ *
+ * Returns:
+ * {Integer} The mapObject's current zoom, in Map Object format
+ */
+ getMapObjectZoom: function() {
+ return this.mapObject.GetZoomLevel();
+ },
+
+
+ // LonLat - Pixel Translation
+
+ /**
+ * APIMethod: getMapObjectLonLatFromMapObjectPixel
+ *
+ * Parameters:
+ * moPixel - {Object} MapObject Pixel format
+ *
+ * Returns:
+ * {Object} MapObject LonLat translated from MapObject Pixel
+ */
+ getMapObjectLonLatFromMapObjectPixel: function(moPixel) {
+ //the conditional here is to test if we are running the v6 of VE
+ return (typeof VEPixel != 'undefined')
+ ? this.mapObject.PixelToLatLong(moPixel)
+ : this.mapObject.PixelToLatLong(moPixel.x, moPixel.y);
+ },
+
+ /**
+ * APIMethod: getMapObjectPixelFromMapObjectLonLat
+ *
+ * Parameters:
+ * moLonLat - {Object} MapObject LonLat format
+ *
+ * Returns:
+ * {Object} MapObject Pixel transtlated from MapObject LonLat
+ */
+ getMapObjectPixelFromMapObjectLonLat: function(moLonLat) {
+ return this.mapObject.LatLongToPixel(moLonLat);
+ },
+
+
+ /************************************
+ * *
+ * MapObject Primitives *
+ * *
+ ************************************/
+
+
+ // LonLat
+
+ /**
+ * APIMethod: getLongitudeFromMapObjectLonLat
+ *
+ * Parameters:
+ * moLonLat - {Object} MapObject LonLat format
+ *
+ * Returns:
+ * {Float} Longitude of the given MapObject LonLat
+ */
+ getLongitudeFromMapObjectLonLat: function(moLonLat) {
+ return this.sphericalMercator ?
+ this.forwardMercator(moLonLat.Longitude, moLonLat.Latitude).lon :
+ moLonLat.Longitude;
+ },
+
+ /**
+ * APIMethod: getLatitudeFromMapObjectLonLat
+ *
+ * Parameters:
+ * moLonLat - {Object} MapObject LonLat format
+ *
+ * Returns:
+ * {Float} Latitude of the given MapObject LonLat
+ */
+ getLatitudeFromMapObjectLonLat: function(moLonLat) {
+ return this.sphericalMercator ?
+ this.forwardMercator(moLonLat.Longitude, moLonLat.Latitude).lat :
+ moLonLat.Latitude;
+ },
+
+ /**
+ * APIMethod: getMapObjectLonLatFromLonLat
+ *
+ * Parameters:
+ * lon - {Float}
+ * lat - {Float}
+ *
+ * Returns:
+ * {Object} MapObject LonLat built from lon and lat params
+ */
+ getMapObjectLonLatFromLonLat: function(lon, lat) {
+ var veLatLong;
+ if(this.sphericalMercator) {
+ var lonlat = this.inverseMercator(lon, lat);
+ veLatLong = new VELatLong(lonlat.lat, lonlat.lon);
+ } else {
+ veLatLong = new VELatLong(lat, lon);
+ }
+ return veLatLong;
+ },
+
+ // Pixel
+
+ /**
+ * APIMethod: getXFromMapObjectPixel
+ *
+ * Parameters:
+ * moPixel - {Object} MapObject Pixel format
+ *
+ * Returns:
+ * {Integer} X value of the MapObject Pixel
+ */
+ getXFromMapObjectPixel: function(moPixel) {
+ return moPixel.x;
+ },
+
+ /**
+ * APIMethod: getYFromMapObjectPixel
+ *
+ * Parameters:
+ * moPixel - {Object} MapObject Pixel format
+ *
+ * Returns:
+ * {Integer} Y value of the MapObject Pixel
+ */
+ getYFromMapObjectPixel: function(moPixel) {
+ return moPixel.y;
+ },
+
+ /**
+ * APIMethod: getMapObjectPixelFromXY
+ *
+ * Parameters:
+ * x - {Integer}
+ * y - {Integer}
+ *
+ * Returns:
+ * {Object} MapObject Pixel from x and y parameters
+ */
+ getMapObjectPixelFromXY: function(x, y) {
+ //the conditional here is to test if we are running the v6 of VE
+ return (typeof VEPixel != 'undefined') ? new VEPixel(x, y)
+ : new Msn.VE.Pixel(x, y);
+ },
+
+ CLASS_NAME: "OpenLayers.Layer.VirtualEarth"
+});
diff --git a/tests/Events.html b/tests/Events.html
index 185ba0f351..e15e8488ff 100644
--- a/tests/Events.html
+++ b/tests/Events.html
@@ -409,13 +409,6 @@
}
- /** HACK HACK HACK Deprecated This test should be removed in 3.0 **/
- function test_Events_globalEventObject(t) {
- t.plan(1);
- t.ok(Event.stop, "a stop() function exists on the global JS Event object, if indeed it exists. This is legacy deprecated and will be gone in 3.0");
- }
-
-
diff --git a/tests/Layer/Grid.html b/tests/Layer/Grid.html
index afeb1ec850..cd773bb268 100644
--- a/tests/Layer/Grid.html
+++ b/tests/Layer/Grid.html
@@ -94,7 +94,7 @@
function test_Layer_Grid_getTilesBounds(t) {
- t.plan( 4 );
+ t.plan(3);
layer = new OpenLayers.Layer.WMS(name, url, params);
@@ -110,10 +110,6 @@
t.ok( bounds.equals(testBounds), "getTilesBounds() returns correct bounds");
- var bounds = layer.getGridBounds();
-
- t.ok( bounds.equals(testBounds), "getGridBounds() wrapper works the same as getTilesBounds.");
-
//no tiles
layer.grid = [];
bounds = layer.getTilesBounds();
diff --git a/tests/Util.html b/tests/Util.html
index d6dcc93def..51eabd244a 100644
--- a/tests/Util.html
+++ b/tests/Util.html
@@ -1019,33 +1019,6 @@
}
- function test_Util_getArgs(t) {
- //DEPRECATED -- to be removed in 3.0
- t.plan(3);
-
- OpenLayers.Lang.setCode(OpenLayers.Lang.defaultCode);
-
- var temp = OpenLayers.Console.warn;
- OpenLayers.Console.warn = function(err) {
- t.ok(err != null, "warning is fired on use of getArgs()");
- }
-
- var temp2 = OpenLayers.Util.getParameters;
- OpenLayers.Util.getParameters = function(url) {
- t.eq(url, g_Url, "correct url passed to getParameters()");
- return g_Params;
- }
-
- g_Params = {};
- g_Url = {};
-
- var ret = OpenLayers.Util.getArgs(g_Url);
- t.ok( ret == g_Params, "correctly returns value from getParameters");
-
- OpenLayers.Console.warn = temp;
- OpenLayers.Util.getParameters = temp2;
- }
-
function tests_Util_extend(t) {
t.plan(7);
diff --git a/tests/Layer/MultiMap.html b/tests/deprecated/Layer/MultiMap.html
similarity index 97%
rename from tests/Layer/MultiMap.html
rename to tests/deprecated/Layer/MultiMap.html
index 8ae07d2adc..1ab3234565 100644
--- a/tests/Layer/MultiMap.html
+++ b/tests/deprecated/Layer/MultiMap.html
@@ -2,7 +2,8 @@
-
+
+
+
+
+
+
-
-
-
-
-
- VE Opacity
- The overlay should have an opacity of 40%.
-
-
-