This example shows how to switch between different projections,
+ maintaining the center and resolution.
+
Click the buttons above to try it, and see
+ polar-projections.js for the
+ source code.
+
+
+
diff --git a/examples/polar-projections.js b/examples/polar-projections.js
new file mode 100644
index 0000000000..ac717fbd97
--- /dev/null
+++ b/examples/polar-projections.js
@@ -0,0 +1,84 @@
+var map, layer, overlay;
+
+var projectionOptions = {
+ 'EPSG:3574': {
+ projection: new OpenLayers.Projection('EPSG:3574'),
+ units: 'm',
+ maxExtent: new OpenLayers.Bounds(-5505054, -5505054, 5505054, 5505054),
+ maxResolution: 5505054 / 128,
+ numZoomLevels: 18
+ },
+ 'EPSG:3576': {
+ projection: new OpenLayers.Projection('EPSG:3576'),
+ units: 'm',
+ maxExtent: new OpenLayers.Bounds(-5505054, -5505054, 5505054, 5505054),
+ maxResolution: 5505054 / 128,
+ numZoomLevels: 18
+ },
+ 'EPSG:3571': {
+ projection: new OpenLayers.Projection('EPSG:3571'),
+ units: 'm',
+ maxExtent: new OpenLayers.Bounds(-5505054, -5505054, 5505054, 5505054),
+ maxResolution: 5505054 / 128,
+ numZoomLevels: 18
+ },
+ 'EPSG:3573': {
+ projection: new OpenLayers.Projection('EPSG:3573'),
+ units: 'm',
+ maxExtent: new OpenLayers.Bounds(-5505054, -5505054, 5505054, 5505054),
+ maxResolution: 5505054 / 128,
+ numZoomLevels: 18
+ }
+};
+
+function setProjection() {
+ projCode = this.innerHTML;
+ var oldExtent = map.getExtent();
+ var oldCenter = map.getCenter();
+ var oldProjection = map.getProjectionObject();
+
+ // map projection is controlled by the base layer
+ map.baseLayer.addOptions(projectionOptions[projCode]);
+
+ // with the base layer updated, the map has the new projection now
+ var newProjection = map.getProjectionObject();
+
+ // transform the center of the old projection, not the extent
+ map.setCenter(
+ oldCenter.transform(oldProjection, newProjection,
+ map.getZoomForExtent(oldExtent.transform(oldProjection, newProjection))
+ ));
+
+ for (var i=map.layers.length-1; i>=0; --i) {
+ // update grid settings
+ map.layers[i].addOptions(projectionOptions[projCode]);
+ // redraw layer - just in case center and zoom are the same in old and
+ // new projection
+ map.layers[i].redraw();
+ }
+}
+
+function init() {
+ map = new OpenLayers.Map('map');
+ layer = new OpenLayers.Layer.WMS(
+ 'world',
+ 'http://v2.suite.opengeo.org/geoserver/wms',
+ {layers: 'world', version: '1.1.1'},
+ projectionOptions['EPSG:3574']
+ );
+ overlay = new OpenLayers.Layer.WMS(
+ 'world',
+ 'http://v2.suite.opengeo.org/geoserver/wms',
+ {transparent: 'true', layers: 'world:borders', styles: 'line'},
+ projectionOptions['EPSG:3574']
+ );
+ overlay.isBaseLayer = false;
+ map.addLayers([layer, overlay]);
+ map.zoomToMaxExtent();
+
+ // add behaviour to dom elements
+ document.getElementById('epsg3574').onclick = setProjection;
+ document.getElementById('epsg3576').onclick = setProjection;
+ document.getElementById('epsg3571').onclick = setProjection;
+ document.getElementById('epsg3573').onclick = setProjection;
+}
diff --git a/lib/OpenLayers.js b/lib/OpenLayers.js
index 05dc3fa7fb..11176dd459 100644
--- a/lib/OpenLayers.js
+++ b/lib/OpenLayers.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
@@ -144,8 +144,6 @@
"OpenLayers/Console.js",
"OpenLayers/Tween.js",
"OpenLayers/Kinetic.js",
- "Rico/Corner.js",
- "Rico/Color.js",
"OpenLayers/Events.js",
"OpenLayers/Events/buttonclick.js",
"OpenLayers/Request.js",
@@ -191,7 +189,6 @@
"OpenLayers/Layer/Zoomify.js",
"OpenLayers/Layer/ArcGISCache.js",
"OpenLayers/Popup/Anchored.js",
- "OpenLayers/Popup/AnchoredBubble.js",
"OpenLayers/Popup/Framed.js",
"OpenLayers/Popup/FramedCloud.js",
"OpenLayers/Feature.js",
diff --git a/lib/OpenLayers/Animation.js b/lib/OpenLayers/Animation.js
index 7123d6549b..7b47a088a2 100644
--- a/lib/OpenLayers/Animation.js
+++ b/lib/OpenLayers/Animation.js
@@ -1,9 +1,9 @@
-/**
- * Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
- * full text of the license.
- *
+ * full text of the license. */
+
+/**
* @requires OpenLayers/SingleFile.js
* @requires OpenLayers/Util/vendorPrefix.js
*/
diff --git a/lib/OpenLayers/BaseTypes.js b/lib/OpenLayers/BaseTypes.js
index ce664dfa0b..d416b8fdea 100644
--- a/lib/OpenLayers/BaseTypes.js
+++ b/lib/OpenLayers/BaseTypes.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
@@ -127,7 +127,9 @@ OpenLayers.String = {
if (i == 0) {
replacement = context;
}
-
+ if (replacement === undefined) {
+ break;
+ }
replacement = replacement[subs[i]];
}
@@ -295,7 +297,25 @@ OpenLayers.Number = {
str = integer + dsep + rem;
}
return str;
- }
+ },
+
+ /**
+ * Method: zeroPad
+ * Create a zero padded string optionally with a radix for casting numbers.
+ *
+ * Parameters:
+ * num - {Number} The number to be zero padded.
+ * len - {Number} The length of the string to be returned.
+ * radix - {Number} An integer between 2 and 36 specifying the base to use
+ * for representing numeric values.
+ */
+ zeroPad: function(num, len, radix) {
+ var str = num.toString(radix || 10);
+ while (str.length < len) {
+ str = "0" + str;
+ }
+ return str;
+ }
};
/**
diff --git a/lib/OpenLayers/BaseTypes/Bounds.js b/lib/OpenLayers/BaseTypes/Bounds.js
index cb83a3922d..a828eb0cc2 100644
--- a/lib/OpenLayers/BaseTypes/Bounds.js
+++ b/lib/OpenLayers/BaseTypes/Bounds.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
@@ -63,7 +63,7 @@ OpenLayers.Bounds = OpenLayers.Class({
* left - {Number} The left bounds of the box. Note that for width
* calculations, this is assumed to be less than the right value.
* bottom - {Number} The bottom bounds of the box. Note that for height
- * calculations, this is assumed to be more than the top value.
+ * calculations, this is assumed to be less than the top value.
* right - {Number} The right bounds.
* top - {Number} The top bounds.
*
@@ -355,39 +355,59 @@ OpenLayers.Bounds = OpenLayers.Class({
* object.
*/
extend:function(object) {
- var bounds = null;
if (object) {
- // clear cached center location
switch(object.CLASS_NAME) {
- case "OpenLayers.LonLat":
- bounds = new OpenLayers.Bounds(object.lon, object.lat,
- object.lon, object.lat);
+ case "OpenLayers.LonLat":
+ this.extendXY(object.lon, object.lat);
break;
case "OpenLayers.Geometry.Point":
- bounds = new OpenLayers.Bounds(object.x, object.y,
- object.x, object.y);
+ this.extendXY(object.x, object.y);
break;
-
- case "OpenLayers.Bounds":
- bounds = object;
+
+ case "OpenLayers.Bounds":
+ // clear cached center location
+ this.centerLonLat = null;
+
+ if ( (this.left == null) || (object.left < this.left)) {
+ this.left = object.left;
+ }
+ if ( (this.bottom == null) || (object.bottom < this.bottom) ) {
+ this.bottom = object.bottom;
+ }
+ if ( (this.right == null) || (object.right > this.right) ) {
+ this.right = object.right;
+ }
+ if ( (this.top == null) || (object.top > this.top) ) {
+ this.top = object.top;
+ }
break;
}
-
- if (bounds) {
- this.centerLonLat = null;
- if ( (this.left == null) || (bounds.left < this.left)) {
- this.left = bounds.left;
- }
- if ( (this.bottom == null) || (bounds.bottom < this.bottom) ) {
- this.bottom = bounds.bottom;
- }
- if ( (this.right == null) || (bounds.right > this.right) ) {
- this.right = bounds.right;
- }
- if ( (this.top == null) || (bounds.top > this.top) ) {
- this.top = bounds.top;
- }
- }
+ }
+ },
+
+ /**
+ * APIMethod: extendXY
+ * Extend the bounds to include the XY coordinate specified.
+ *
+ * Parameters:
+ * x - {number} The X part of the the coordinate.
+ * y - {number} The Y part of the the coordinate.
+ */
+ extendXY:function(x, y) {
+ // clear cached center location
+ this.centerLonLat = null;
+
+ if ((this.left == null) || (x < this.left)) {
+ this.left = x;
+ }
+ if ((this.bottom == null) || (y < this.bottom)) {
+ this.bottom = y;
+ }
+ if ((this.right == null) || (x > this.right)) {
+ this.right = x;
+ }
+ if ((this.top == null) || (y > this.top)) {
+ this.top = y;
}
},
diff --git a/lib/OpenLayers/BaseTypes/Class.js b/lib/OpenLayers/BaseTypes/Class.js
index 1bbceeaef8..2be7212994 100644
--- a/lib/OpenLayers/BaseTypes/Class.js
+++ b/lib/OpenLayers/BaseTypes/Class.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/BaseTypes/Date.js b/lib/OpenLayers/BaseTypes/Date.js
index 30fcf20337..2646f2472f 100644
--- a/lib/OpenLayers/BaseTypes/Date.js
+++ b/lib/OpenLayers/BaseTypes/Date.js
@@ -49,13 +49,6 @@ OpenLayers.Date = {
return date.toISOString();
};
} else {
- function pad(num, len) {
- var str = num + "";
- while (str.length < len) {
- str = "0" + str;
- }
- return str;
- }
return function(date) {
var str;
if (isNaN(date.getTime())) {
@@ -65,12 +58,12 @@ OpenLayers.Date = {
} else {
str =
date.getUTCFullYear() + "-" +
- pad(date.getUTCMonth() + 1, 2) + "-" +
- pad(date.getUTCDate(), 2) + "T" +
- pad(date.getUTCHours(), 2) + ":" +
- pad(date.getUTCMinutes(), 2) + ":" +
- pad(date.getUTCSeconds(), 2) + "." +
- pad(date.getUTCMilliseconds(), 3) + "Z";
+ OpenLayers.Number.zeroPad(date.getUTCMonth() + 1, 2) + "-" +
+ OpenLayers.Number.zeroPad(date.getUTCDate(), 2) + "T" +
+ OpenLayers.Number.zeroPad(date.getUTCHours(), 2) + ":" +
+ OpenLayers.Number.zeroPad(date.getUTCMinutes(), 2) + ":" +
+ OpenLayers.Number.zeroPad(date.getUTCSeconds(), 2) + "." +
+ OpenLayers.Number.zeroPad(date.getUTCMilliseconds(), 3) + "Z";
}
return str;
};
diff --git a/lib/OpenLayers/BaseTypes/Element.js b/lib/OpenLayers/BaseTypes/Element.js
index ccb9976a27..dc71b5c8ef 100644
--- a/lib/OpenLayers/BaseTypes/Element.js
+++ b/lib/OpenLayers/BaseTypes/Element.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/BaseTypes/LonLat.js b/lib/OpenLayers/BaseTypes/LonLat.js
index f06a88f8b5..0780dc339d 100644
--- a/lib/OpenLayers/BaseTypes/LonLat.js
+++ b/lib/OpenLayers/BaseTypes/LonLat.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/BaseTypes/Pixel.js b/lib/OpenLayers/BaseTypes/Pixel.js
index 08753090f4..d6ac60abff 100644
--- a/lib/OpenLayers/BaseTypes/Pixel.js
+++ b/lib/OpenLayers/BaseTypes/Pixel.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/BaseTypes/Size.js b/lib/OpenLayers/BaseTypes/Size.js
index ef5ae2740e..34c7a6c80b 100644
--- a/lib/OpenLayers/BaseTypes/Size.js
+++ b/lib/OpenLayers/BaseTypes/Size.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Console.js b/lib/OpenLayers/Console.js
index c0be882b16..ef5029aa40 100644
--- a/lib/OpenLayers/Console.js
+++ b/lib/OpenLayers/Console.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control.js b/lib/OpenLayers/Control.js
index 9fd154ad59..472a4e6e44 100644
--- a/lib/OpenLayers/Control.js
+++ b/lib/OpenLayers/Control.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/ArgParser.js b/lib/OpenLayers/Control/ArgParser.js
index 3008532089..6b076f5736 100644
--- a/lib/OpenLayers/Control/ArgParser.js
+++ b/lib/OpenLayers/Control/ArgParser.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/Attribution.js b/lib/OpenLayers/Control/Attribution.js
index 713e00680b..e5ea1ce6fb 100644
--- a/lib/OpenLayers/Control/Attribution.js
+++ b/lib/OpenLayers/Control/Attribution.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/Button.js b/lib/OpenLayers/Control/Button.js
index 3d1536388c..830df6d69f 100644
--- a/lib/OpenLayers/Control/Button.js
+++ b/lib/OpenLayers/Control/Button.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/CacheRead.js b/lib/OpenLayers/Control/CacheRead.js
index 6b639f81f8..7768bce2db 100644
--- a/lib/OpenLayers/Control/CacheRead.js
+++ b/lib/OpenLayers/Control/CacheRead.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/CacheWrite.js b/lib/OpenLayers/Control/CacheWrite.js
index c937520baf..3d4ecf5156 100644
--- a/lib/OpenLayers/Control/CacheWrite.js
+++ b/lib/OpenLayers/Control/CacheWrite.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/DragFeature.js b/lib/OpenLayers/Control/DragFeature.js
index c634cde82e..d8fb15f9ea 100644
--- a/lib/OpenLayers/Control/DragFeature.js
+++ b/lib/OpenLayers/Control/DragFeature.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/DragPan.js b/lib/OpenLayers/Control/DragPan.js
index 62d6059e3c..2e2146f2cd 100644
--- a/lib/OpenLayers/Control/DragPan.js
+++ b/lib/OpenLayers/Control/DragPan.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
@@ -56,11 +56,11 @@ OpenLayers.Control.DragPan = OpenLayers.Class(OpenLayers.Control, {
* {Boolean} Set this option to enable "kinetic dragging". Can be
* set to true or to an object. If set to an object this
* object will be passed to the {}
- * constructor. Defaults to false.
- * If you set this property, you should ensure that
- * OpenLayers/Kinetic.js is included in your build config
+ * constructor. Defaults to true.
+ * To get kinetic dragging, ensure that OpenLayers/Kinetic.js is
+ * included in your build config.
*/
- enableKinetic: false,
+ enableKinetic: true,
/**
* APIProperty: kineticInterval
@@ -77,7 +77,7 @@ OpenLayers.Control.DragPan = OpenLayers.Class(OpenLayers.Control, {
* as callbacks.
*/
draw: function() {
- if(this.enableKinetic) {
+ if (this.enableKinetic && OpenLayers.Kinetic) {
var config = {interval: this.kineticInterval};
if(typeof this.enableKinetic === "object") {
config = OpenLayers.Util.extend(config, this.enableKinetic);
diff --git a/lib/OpenLayers/Control/DrawFeature.js b/lib/OpenLayers/Control/DrawFeature.js
index 5afe2f8e13..b0afc71ac4 100644
--- a/lib/OpenLayers/Control/DrawFeature.js
+++ b/lib/OpenLayers/Control/DrawFeature.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/EditingToolbar.js b/lib/OpenLayers/Control/EditingToolbar.js
index 89575e3fb7..ba7ca40109 100644
--- a/lib/OpenLayers/Control/EditingToolbar.js
+++ b/lib/OpenLayers/Control/EditingToolbar.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/Geolocate.js b/lib/OpenLayers/Control/Geolocate.js
index f2fcb91910..4b5b43958e 100644
--- a/lib/OpenLayers/Control/Geolocate.js
+++ b/lib/OpenLayers/Control/Geolocate.js
@@ -45,8 +45,15 @@ OpenLayers.Control.Geolocate = OpenLayers.Class(OpenLayers.Control, {
/**
* Property: geolocation
* {Object} The geolocation engine, as a property to be possibly mocked.
+ * This is set lazily to avoid a memory leak in IE9.
*/
- geolocation: navigator.geolocation,
+ geolocation: null,
+
+ /**
+ * Property: available
+ * {Boolean} The navigator.geolocation object is available.
+ */
+ available: ('geolocation' in navigator),
/**
* APIProperty: bind
@@ -90,6 +97,10 @@ OpenLayers.Control.Geolocate = OpenLayers.Class(OpenLayers.Control, {
* {Boolean} The control was effectively activated.
*/
activate: function () {
+ if (this.available && !this.geolocation) {
+ // set lazily to avoid IE9 memory leak
+ this.geolocation = navigator.geolocation;
+ }
if (!this.geolocation) {
this.events.triggerEvent("locationuncapable");
return false;
diff --git a/lib/OpenLayers/Control/GetFeature.js b/lib/OpenLayers/Control/GetFeature.js
index eea7a65512..144e87fc80 100644
--- a/lib/OpenLayers/Control/GetFeature.js
+++ b/lib/OpenLayers/Control/GetFeature.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/Graticule.js b/lib/OpenLayers/Control/Graticule.js
index a5a908a803..2fce50d4e7 100644
--- a/lib/OpenLayers/Control/Graticule.js
+++ b/lib/OpenLayers/Control/Graticule.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/KeyboardDefaults.js b/lib/OpenLayers/Control/KeyboardDefaults.js
index aab664e9e9..3af88317f0 100644
--- a/lib/OpenLayers/Control/KeyboardDefaults.js
+++ b/lib/OpenLayers/Control/KeyboardDefaults.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/LayerSwitcher.js b/lib/OpenLayers/Control/LayerSwitcher.js
index 6f5ab78ed6..668f5c349b 100644
--- a/lib/OpenLayers/Control/LayerSwitcher.js
+++ b/lib/OpenLayers/Control/LayerSwitcher.js
@@ -1,49 +1,30 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
-/**
+/**
* @requires OpenLayers/Control.js
* @requires OpenLayers/Lang.js
- * @requires OpenLayers/Console.js
+ * @requires OpenLayers/Util.js
* @requires OpenLayers/Events/buttonclick.js
*/
/**
* Class: OpenLayers.Control.LayerSwitcher
- * The LayerSwitcher control displays a table of contents for the map. This
+ * The LayerSwitcher control displays a table of contents for the map. This
* allows the user interface to switch between BaseLasyers and to show or hide
- * Overlays. By default the switcher is shown minimized on the right edge of
+ * Overlays. By default the switcher is shown minimized on the right edge of
* the map, the user may expand it by clicking on the handle.
*
- * To create the LayerSwitcher outside of the map, pass the Id of a html div
+ * To create the LayerSwitcher outside of the map, pass the Id of a html div
* as the first argument to the constructor.
- *
+ *
* Inherits from:
* -
*/
-OpenLayers.Control.LayerSwitcher =
- OpenLayers.Class(OpenLayers.Control, {
+OpenLayers.Control.LayerSwitcher = OpenLayers.Class(OpenLayers.Control, {
- /**
- * APIProperty: roundedCorner
- * {Boolean} If true the Rico library is used for rounding the corners
- * of the layer switcher div, defaults to false. *Deprecated*. Use
- * CSS3's border-radius instead. If this option is set to true the
- * Rico/Corner.js script must be loaded in the page, and therefore
- * listed in the build profile.
- *
- */
- roundedCorner: false,
-
- /**
- * APIProperty: roundedCornerColor
- * {String} The color of the rounded corners, only applies if roundedCorner
- * is true, defaults to "darkblue".
- */
- roundedCornerColor: "darkblue",
-
/**
* Property: layerStates
* {Array(Object)} Basically a copy of the "state" of the map's layers
@@ -51,90 +32,85 @@ OpenLayers.Control.LayerSwitcher =
* unnecessarily redrawing the control.
*/
layerStates: null,
-
// DOM Elements
-
+
/**
* Property: layersDiv
- * {DOMElement}
+ * {DOMElement}
*/
layersDiv: null,
-
- /**
+
+ /**
* Property: baseLayersDiv
* {DOMElement}
*/
baseLayersDiv: null,
- /**
+ /**
* Property: baseLayers
* {Array(Object)}
*/
baseLayers: null,
-
-
- /**
+
+
+ /**
* Property: dataLbl
- * {DOMElement}
+ * {DOMElement}
*/
dataLbl: null,
-
- /**
+
+ /**
* Property: dataLayersDiv
- * {DOMElement}
+ * {DOMElement}
*/
dataLayersDiv: null,
- /**
+ /**
* Property: dataLayers
- * {Array(Object)}
+ * {Array(Object)}
*/
dataLayers: null,
- /**
+ /**
* Property: minimizeDiv
- * {DOMElement}
+ * {DOMElement}
*/
minimizeDiv: null,
- /**
+ /**
* Property: maximizeDiv
- * {DOMElement}
+ * {DOMElement}
*/
maximizeDiv: null,
-
+
/**
* APIProperty: ascending
- * {Boolean}
+ * {Boolean}
*/
ascending: true,
-
+
/**
* Constructor: OpenLayers.Control.LayerSwitcher
- *
+ *
* Parameters:
* options - {Object}
*/
initialize: function(options) {
OpenLayers.Control.prototype.initialize.apply(this, arguments);
this.layerStates = [];
-
- if(this.roundedCorner) {
- OpenLayers.Console.warn('roundedCorner option is deprecated');
- }
},
/**
- * APIMethod: destroy
- */
+ * APIMethod: destroy
+ */
destroy: function() {
-
- //clear out layers info and unregister their events
+
+ //clear out layers info and unregister their events
this.clearLayersArray("base");
this.clearLayersArray("data");
-
+
this.map.events.un({
buttonclick: this.onButtonClick,
addlayer: this.redraw,
@@ -144,15 +120,15 @@ OpenLayers.Control.LayerSwitcher =
scope: this
});
this.events.unregister("buttonclick", this, this.onButtonClick);
-
+
OpenLayers.Control.prototype.destroy.apply(this, arguments);
},
- /**
+ /**
* Method: setMap
*
* Properties:
- * map - {}
+ * map - {}
*/
setMap: function(map) {
OpenLayers.Control.prototype.setMap.apply(this, arguments);
@@ -176,9 +152,9 @@ OpenLayers.Control.LayerSwitcher =
* Method: draw
*
* Returns:
- * {DOMElement} A reference to the DIV DOMElement containing the
+ * {DOMElement} A reference to the DIV DOMElement containing the
* switcher tabs.
- */
+ */
draw: function() {
OpenLayers.Control.prototype.draw.apply(this);
@@ -191,7 +167,7 @@ OpenLayers.Control.LayerSwitcher =
}
// populate div with current info
- this.redraw();
+ this.redraw();
return this.div;
},
@@ -224,13 +200,13 @@ OpenLayers.Control.LayerSwitcher =
}
},
- /**
+ /**
* Method: clearLayersArray
* User specifies either "base" or "data". we then clear all the
* corresponding listeners, the div, and reinitialize a new array.
- *
+ *
* Parameters:
- * layersType - {String}
+ * layersType - {String}
*/
clearLayersArray: function(layersType) {
this[layersType + "LayersDiv"].innerHTML = "";
@@ -241,54 +217,53 @@ OpenLayers.Control.LayerSwitcher =
/**
* Method: checkRedraw
* Checks if the layer state has changed since the last redraw() call.
- *
+ *
* Returns:
- * {Boolean} The layer state changed since the last redraw() call.
+ * {Boolean} The layer state changed since the last redraw() call.
*/
checkRedraw: function() {
- var redraw = false;
if ( !this.layerStates.length ||
(this.map.layers.length != this.layerStates.length) ) {
- redraw = true;
- } else {
- for (var i=0, len=this.layerStates.length; i
labelSpan["for"] = inputElem.id;
OpenLayers.Element.addClass(labelSpan, "labelSpan olButton");
labelSpan._layer = layer.id;
@@ -350,12 +333,12 @@ OpenLayers.Control.LayerSwitcher =
labelSpan.style.color = "gray";
}
labelSpan.innerHTML = layer.name;
- labelSpan.style.verticalAlign = (baseLayer) ? "bottom"
+ labelSpan.style.verticalAlign = (baseLayer) ? "bottom"
: "baseline";
// create line break
var br = document.createElement("br");
-
-
+
+
var groupArray = (baseLayer) ? this.baseLayers
: this.dataLayers;
groupArray.push({
@@ -363,8 +346,8 @@ OpenLayers.Control.LayerSwitcher =
'inputElem': inputElem,
'labelSpan': labelSpan
});
-
-
+
+
var groupDiv = (baseLayer) ? this.baseLayersDiv
: this.dataLayersDiv;
groupDiv.appendChild(inputElem);
@@ -374,24 +357,24 @@ OpenLayers.Control.LayerSwitcher =
}
// if no overlays, dont display the overlay label
- this.dataLbl.style.display = (containsOverlays) ? "" : "none";
-
+ this.dataLbl.style.display = (containsOverlays) ? "" : "none";
+
// if no baselayers, dont display the baselayer label
- this.baseLbl.style.display = (containsBaseLayers) ? "" : "none";
+ this.baseLbl.style.display = (containsBaseLayers) ? "" : "none";
return this.div;
},
- /**
+ /**
* Method: updateMap
* Cycles through the loaded data and base layer input arrays and makes
- * the necessary calls to the Map object such that that the map's
- * visual state corresponds to what the user has selected in
+ * the necessary calls to the Map object such that that the map's
+ * visual state corresponds to what the user has selected in
* the control.
*/
updateMap: function() {
- // set the newly selected base layer
+ // set the newly selected base layer
for(var i=0, len=this.baseLayers.length; i} Events instance for listeners and triggering
* control specific events.
@@ -41,28 +41,28 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
* APIProperty: handlerOptions
* {Object} Used to set non-default properties on the control's handler
*/
-
+
/**
* Property: callbacks
* {Object} The functions that are sent to the handler for callback
*/
callbacks: null,
-
+
/**
- * Property: displaySystem
+ * APIProperty: displaySystem
* {String} Display system for output measurements. Supported values
* are 'english', 'metric', and 'geographic'. Default is 'metric'.
*/
displaySystem: 'metric',
-
+
/**
- * Property: geodesic
+ * APIProperty: geodesic
* {Boolean} Calculate geodesic metrics instead of planar metrics. This
* requires that geometries can be transformed into Geographic/WGS84
* (if that is not already the map projection). Default is false.
*/
geodesic: false,
-
+
/**
* Property: displaySystemUnits
* {Object} Units for various measurement systems. Values are arrays
@@ -111,10 +111,10 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
/**
* Constructor: OpenLayers.Control.Measure
- *
+ *
* Parameters:
- * handler - {}
- * options - {Object}
+ * handler - {}
+ * options - {Object}
*/
initialize: function(handler, options) {
OpenLayers.Control.prototype.initialize.apply(this, [options]);
@@ -125,14 +125,14 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
}
this.callbacks = OpenLayers.Util.extend(callbacks, this.callbacks);
- // let the handler options override, so old code that passes 'persist'
+ // let the handler options override, so old code that passes 'persist'
// directly to the handler does not need an update
this.handlerOptions = OpenLayers.Util.extend(
{persist: this.persist}, this.handlerOptions
);
this.handler = new handler(this, this.callbacks, this.handlerOptions);
},
-
+
/**
* APIMethod: deactivate
*/
@@ -164,7 +164,7 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
delete this.callbacks.modify;
}
},
-
+
/**
* Method: updateHandler
*
@@ -194,7 +194,7 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
this.cancelDelay();
this.measure(geometry, "measure");
},
-
+
/**
* Method: measurePartial
* Called each time a new point is added to the measurement sketch.
@@ -225,9 +225,11 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
/**
* Method: measureImmediate
* Called each time the measurement sketch is modified.
- *
- * Parameters: point - {} The point at the
- * mouseposition. feature - {} The sketch feature.
+ *
+ * Parameters:
+ * point - {} The point at the mouse position.
+ * feature - {} The sketch feature.
+ * drawing - {Boolean} Indicates whether we're currently drawing.
*/
measureImmediate : function(point, feature, drawing) {
if (drawing && !this.handler.freehandMode(this.handler.evt)) {
@@ -270,7 +272,7 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
geometry: geometry
});
},
-
+
/**
* Method: getBestArea
* Based on the returns the area of a geometry.
@@ -294,7 +296,7 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
}
return [area, unit];
},
-
+
/**
* Method: getArea
*
@@ -321,7 +323,7 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
}
return area;
},
-
+
/**
* Method: getBestLength
* Based on the returns the length of a geometry.
diff --git a/lib/OpenLayers/Control/ModifyFeature.js b/lib/OpenLayers/Control/ModifyFeature.js
index ecda73a088..1f619a3918 100644
--- a/lib/OpenLayers/Control/ModifyFeature.js
+++ b/lib/OpenLayers/Control/ModifyFeature.js
@@ -1,11 +1,10 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
/**
- * @requires OpenLayers/Control/DragFeature.js
- * @requires OpenLayers/Control/SelectFeature.js
+ * @requires OpenLayers/Handler/Drag.js
* @requires OpenLayers/Handler/Keyboard.js
*/
@@ -50,7 +49,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
* Default is true.
*/
toggle: true,
-
+
/**
* APIProperty: standalone
* {Boolean} Set to true to create a control without SelectFeature
@@ -67,20 +66,26 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
* {}
*/
layer: null,
-
+
/**
* Property: feature
* {} Feature currently available for modification.
*/
feature: null,
-
+
+ /**
+ * Property: vertex
+ * {} Vertex currently being modified.
+ */
+ vertex: null,
+
/**
* Property: vertices
* {Array()} Verticies currently available
* for dragging.
*/
vertices: null,
-
+
/**
* Property: virtualVertices
* {Array()} Virtual vertices in the middle
@@ -88,24 +93,12 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
*/
virtualVertices: null,
- /**
- * Property: selectControl
- * {}
- */
- selectControl: null,
-
- /**
- * Property: dragControl
- * {}
- */
- dragControl: null,
-
/**
* Property: handlers
* {Object}
*/
handlers: null,
-
+
/**
* APIProperty: deleteCodes
* {Array(Integer)} Keycodes for deleting verticies. Set to null to disable
@@ -120,7 +113,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
* {Object} A symbolizer to be used for virtual vertices.
*/
virtualStyle: null,
-
+
/**
* APIProperty: vertexRenderIntent
* {String} The renderIntent to use for vertices. If no is
@@ -232,64 +225,50 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
if(!(OpenLayers.Util.isArray(this.deleteCodes))) {
this.deleteCodes = [this.deleteCodes];
}
- var control = this;
-
- // configure the select control
- var selectOptions = {
- geometryTypes: this.geometryTypes,
- clickout: this.clickout,
- toggle: this.toggle,
- onBeforeSelect: this.beforeSelectFeature,
- onSelect: this.selectFeature,
- onUnselect: this.unselectFeature,
- scope: this
- };
- if(this.standalone === false) {
- this.selectControl = new OpenLayers.Control.SelectFeature(
- layer, selectOptions
- );
- }
-
- // configure the drag control
- var dragOptions = {
- documentDrag: this.documentDrag,
- geometryTypes: ["OpenLayers.Geometry.Point"],
- onStart: function(feature, pixel) {
- control.dragStart.apply(control, [feature, pixel]);
+
+ // configure the drag handler
+ var dragCallbacks = {
+ down: function(pixel) {
+ this.vertex = null;
+ var feature = this.layer.getFeatureFromEvent(
+ this.handlers.drag.evt);
+ if (feature) {
+ this.dragStart(feature);
+ } else if (this.feature && this.clickout) {
+ this.unselectFeature(this.feature);
+ }
},
- onDrag: function(feature, pixel) {
- control.dragVertex.apply(control, [feature, pixel]);
+ move: function(pixel) {
+ delete this._unselect;
+ if (this.vertex) {
+ this.dragVertex(this.vertex, pixel);
+ }
},
- onComplete: function(feature) {
- control.dragComplete.apply(control, [feature]);
+ up: function() {
+ this.handlers.drag.stopDown = false;
+ if (this._unselect) {
+ this.unselectFeature(this._unselect);
+ delete this._unselect;
+ }
},
- featureCallbacks: {
- over: function(feature) {
- /**
- * In normal mode, the feature handler is set up to allow
- * dragging of all points. In standalone mode, we only
- * want to allow dragging of sketch vertices and virtual
- * vertices - or, in the case of a modifiable point, the
- * point itself.
- */
- if(control.standalone !== true || feature._sketch ||
- control.feature === feature) {
- control.dragControl.overFeature.apply(
- control.dragControl, [feature]);
- }
+ done: function(pixel) {
+ if (this.vertex) {
+ this.dragComplete(this.vertex);
}
}
};
- this.dragControl = new OpenLayers.Control.DragFeature(
- layer, dragOptions
- );
+ var dragOptions = {
+ documentDrag: this.documentDrag,
+ stopDown: false
+ };
// configure the keyboard handler
var keyboardOptions = {
keydown: this.handleKeypress
};
this.handlers = {
- keyboard: new OpenLayers.Handler.Keyboard(this, keyboardOptions)
+ keyboard: new OpenLayers.Handler.Keyboard(this, keyboardOptions),
+ drag: new OpenLayers.Handler.Drag(this, dragCallbacks, dragOptions)
};
},
@@ -298,9 +277,14 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
* Take care of things that are not handled in superclass.
*/
destroy: function() {
+ if (this.map) {
+ this.map.events.un({
+ "removelayer": this.handleMapEvents,
+ "changelayer": this.handleMapEvents,
+ scope: this
+ });
+ }
this.layer = null;
- this.standalone || this.selectControl.destroy();
- this.dragControl.destroy();
OpenLayers.Control.prototype.destroy.apply(this, []);
},
@@ -312,8 +296,14 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
* {Boolean} Successfully activated the control.
*/
activate: function() {
- return ((this.standalone || this.selectControl.activate()) &&
- this.handlers.keyboard.activate() &&
+ this.moveLayerToTop();
+ this.map.events.on({
+ "removelayer": this.handleMapEvents,
+ "changelayer": this.handleMapEvents,
+ scope: this
+ });
+ return (this.handlers.keyboard.activate() &&
+ this.handlers.drag.activate() &&
OpenLayers.Control.prototype.activate.apply(this, arguments));
},
@@ -328,29 +318,26 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
var deactivated = false;
// the return from the controls is unimportant in this case
if(OpenLayers.Control.prototype.deactivate.apply(this, arguments)) {
+ this.moveLayerBack();
+ this.map.events.un({
+ "removelayer": this.handleMapEvents,
+ "changelayer": this.handleMapEvents,
+ scope: this
+ });
this.layer.removeFeatures(this.vertices, {silent: true});
this.layer.removeFeatures(this.virtualVertices, {silent: true});
this.vertices = [];
- this.dragControl.deactivate();
- var feature = this.feature;
- var valid = feature && feature.geometry && feature.layer;
- if(this.standalone === false) {
- if(valid) {
- this.selectControl.unselect.apply(this.selectControl,
- [feature]);
- }
- this.selectControl.deactivate();
- } else {
- if(valid) {
- this.unselectFeature(feature);
- }
- }
+ this.handlers.drag.deactivate();
this.handlers.keyboard.deactivate();
+ var feature = this.feature;
+ if (feature && feature.geometry && feature.layer) {
+ this.unselectFeature(feature);
+ }
deactivated = true;
}
return deactivated;
},
-
+
/**
* Method: beforeSelectFeature
* Called before a feature is selected.
@@ -367,19 +354,27 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
/**
* APIMethod: selectFeature
* Select a feature for modification in standalone mode. In non-standalone
- * mode, this method is called when the select feature control selects a
- * feature. Register a listener to the beforefeaturemodified event and
- * return false to prevent feature modification.
+ * mode, this method is called when a feature is selected by clicking.
+ * Register a listener to the beforefeaturemodified event and return false
+ * to prevent feature modification.
*
* Parameters:
* feature - {} the selected feature.
*/
selectFeature: function(feature) {
- if (!this.standalone || this.beforeSelectFeature(feature) !== false) {
+ if (this.geometryTypes && OpenLayers.Util.indexOf(this.geometryTypes,
+ feature.geometry.CLASS_NAME) == -1) {
+ return;
+ }
+ if (this.beforeSelectFeature(feature) !== false) {
+ if (this.feature) {
+ this.unselectFeature(this.feature);
+ }
this.feature = feature;
+ this.layer.selectedFeatures.push(feature);
+ this.layer.drawFeature(feature, 'select');
this.modified = false;
this.resetVertices();
- this.dragControl.activate();
this.onModificationStart(this.feature);
}
// keep track of geometry modifications
@@ -409,8 +404,9 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
this.layer.destroyFeatures([this.radiusHandle], {silent: true});
delete this.radiusHandle;
}
+ this.layer.drawFeature(this.feature, 'default');
this.feature = null;
- this.dragControl.deactivate();
+ OpenLayers.Util.removeItem(this.layer.selectedFeatures, feature);
this.onModificationEnd(feature);
this.layer.events.triggerEvent("afterfeaturemodified", {
feature: feature,
@@ -418,64 +414,48 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
});
this.modified = false;
},
-
+
+
/**
* Method: dragStart
- * Called by the drag feature control with before a feature is dragged.
- * This method is used to differentiate between points and vertices
- * of higher order geometries. This respects the
- * property and forces a select of points when the drag control is
- * already active (and stops events from propagating to the select
- * control).
+ * Called by the drag handler before a feature is dragged. This method is
+ * used to differentiate between points and vertices
+ * of higher order geometries.
*
* Parameters:
* feature - {} The point or vertex about to be
* dragged.
- * pixel - {} Pixel location of the mouse event.
*/
- dragStart: function(feature, pixel) {
- // only change behavior if the feature is not in the vertices array
- if(feature != this.feature && !feature.geometry.parent &&
- feature != this.dragHandle && feature != this.radiusHandle) {
- if(this.standalone === false && this.feature) {
- // unselect the currently selected feature
- this.selectControl.clickFeature.apply(this.selectControl,
- [this.feature]);
- }
- // check any constraints on the geometry type
- if(this.geometryTypes == null ||
- OpenLayers.Util.indexOf(this.geometryTypes,
- feature.geometry.CLASS_NAME) != -1) {
- // select the point
- this.standalone || this.selectControl.clickFeature.apply(
- this.selectControl, [feature]);
- /**
- * TBD: These lines improve workflow by letting the user
- * immediately start dragging after the mouse down.
- * However, it is very ugly to be messing with controls
- * and their handlers in this way. I'd like a better
- * solution if the workflow change is necessary.
- */
- // prepare the point for dragging
- this.dragControl.overFeature.apply(this.dragControl,
- [feature]);
- this.dragControl.lastPixel = pixel;
- this.dragControl.handlers.drag.started = true;
- this.dragControl.handlers.drag.start = pixel;
- this.dragControl.handlers.drag.last = pixel;
+ dragStart: function(feature) {
+ var isPoint = feature.geometry.CLASS_NAME ==
+ 'OpenLayers.Geometry.Point';
+ if (!this.standalone &&
+ ((!feature._sketch && isPoint) || !feature._sketch)) {
+ if (this.toggle && this.feature === feature) {
+ // mark feature for unselection
+ this._unselect = feature;
}
+ this.selectFeature(feature);
+ }
+ if (feature._sketch || isPoint) {
+ // feature is a drag or virtual handle or point
+ this.vertex = feature;
+ this.handlers.drag.stopDown = true;
}
},
-
+
/**
* Method: dragVertex
- * Called by the drag feature control with each drag move of a vertex.
+ * Called by the drag handler with each drag move of a vertex.
*
* Parameters:
* vertex - {} The vertex being dragged.
* pixel - {} Pixel location of the mouse event.
*/
dragVertex: function(vertex, pixel) {
+ var pos = this.map.getLonLatFromViewPortPx(pixel);
+ var geom = vertex.geometry;
+ geom.move(pos.lon - geom.x, pos.lat - geom.y);
this.modified = true;
/**
* Five cases:
@@ -487,9 +467,6 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
*/
if(this.feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
// dragging a simple point
- if(this.feature != vertex) {
- this.feature = vertex;
- }
this.layer.events.triggerEvent("vertexmodified", {
vertex: vertex.geometry,
feature: this.feature,
@@ -526,7 +503,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
this.virtualVertices = [];
}
this.layer.drawFeature(this.feature, this.standalone ? undefined :
- this.selectControl.renderIntent);
+ 'select');
}
// keep the vertex on top so it gets the mouseout after dragging
// this should be removed in favor of an option to draw under or
@@ -536,7 +513,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
/**
* Method: dragComplete
- * Called by the drag feature control when the feature dragging is complete.
+ * Called by the drag handler when the feature dragging is complete.
*
* Parameters:
* vertex - {} The vertex being dragged.
@@ -572,16 +549,6 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
* Method: resetVertices
*/
resetVertices: function() {
- // if coming from a drag complete we're about to destroy the vertex
- // that was just dragged. For that reason, the drag feature control
- // will never detect a mouse-out on that vertex, meaning that the drag
- // handler won't be deactivated. This can cause errors because the drag
- // feature control still has a feature to drag but that feature is
- // destroyed. To prevent this, we call outFeature on the drag feature
- // control if the control actually has a feature to drag.
- if(this.dragControl.feature) {
- this.dragControl.outFeature(this.dragControl.feature);
- }
if(this.vertices.length > 0) {
this.layer.removeFeatures(this.vertices, {silent: true});
this.vertices = [];
@@ -632,11 +599,10 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
// check for delete key
if(this.feature &&
OpenLayers.Util.indexOf(this.deleteCodes, code) != -1) {
- var vertex = this.dragControl.feature;
- if(vertex &&
- OpenLayers.Util.indexOf(this.vertices, vertex) != -1 &&
- !this.dragControl.handlers.drag.dragging &&
- vertex.geometry.parent) {
+ var vertex = this.layer.getFeatureFromEvent(this.handlers.drag.evt);
+ if (vertex &&
+ OpenLayers.Util.indexOf(this.vertices, vertex) != -1 &&
+ !this.handlers.drag.dragging && vertex.geometry.parent) {
// remove the vertex
vertex.geometry.parent.removeComponent(vertex.geometry);
this.layer.events.triggerEvent("vertexremoved", {
@@ -645,8 +611,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
pixel: evt.xy
});
this.layer.drawFeature(this.feature, this.standalone ?
- undefined :
- this.selectControl.renderIntent);
+ undefined : 'select');
this.modified = true;
this.resetVertices();
this.setFeatureState();
@@ -800,11 +765,49 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
* map - {} The control's map.
*/
setMap: function(map) {
- this.standalone || this.selectControl.setMap(map);
- this.dragControl.setMap(map);
+ this.handlers.drag.setMap(map);
OpenLayers.Control.prototype.setMap.apply(this, arguments);
},
+ /**
+ * Method: handleMapEvents
+ *
+ * Parameters:
+ * evt - {Object}
+ */
+ handleMapEvents: function(evt) {
+ if (evt.type == "removelayer" || evt.property == "order") {
+ this.moveLayerToTop();
+ }
+ },
+
+ /**
+ * Method: moveLayerToTop
+ * Moves the layer for this handler to the top, so mouse events can reach
+ * it.
+ */
+ moveLayerToTop: function() {
+ var index = Math.max(this.map.Z_INDEX_BASE['Feature'] - 1,
+ this.layer.getZIndex()) + 1;
+ this.layer.setZIndex(index);
+
+ },
+
+ /**
+ * Method: moveLayerBack
+ * Moves the layer back to the position determined by the map's layers
+ * array.
+ */
+ moveLayerBack: function() {
+ var index = this.layer.getZIndex() - 1;
+ if (index >= this.map.Z_INDEX_BASE['Feature']) {
+ this.layer.setZIndex(index);
+ } else {
+ this.map.setLayerZIndex(this.layer,
+ this.map.getLayerIndex(this.layer));
+ }
+ },
+
CLASS_NAME: "OpenLayers.Control.ModifyFeature"
});
diff --git a/lib/OpenLayers/Control/NavToolbar.js b/lib/OpenLayers/Control/NavToolbar.js
index 626b616476..b6bc2aa464 100644
--- a/lib/OpenLayers/Control/NavToolbar.js
+++ b/lib/OpenLayers/Control/NavToolbar.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/Navigation.js b/lib/OpenLayers/Control/Navigation.js
index 8c838dddb9..d50e131204 100644
--- a/lib/OpenLayers/Control/Navigation.js
+++ b/lib/OpenLayers/Control/Navigation.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
@@ -77,7 +77,9 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
/**
* Property: mouseWheelOptions
* {Object} Options passed to the MouseWheel control (only useful if
- * is set to true)
+ * is set to true). Default is no options for maps
+ * with fractionalZoom set to true, otherwise
+ * {cumulative: false, interval: 50, maxDelta: 6}
*/
mouseWheelOptions: null,
@@ -208,10 +210,15 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
{map: this.map, keyMask: this.zoomBoxKeyMask});
this.dragPan.draw();
this.zoomBox.draw();
+ var wheelOptions = this.map.fractionalZoom ? {} : {
+ cumulative: false,
+ interval: 50,
+ maxDelta: 6
+ };
this.handlers.wheel = new OpenLayers.Handler.MouseWheel(
- this, {"up" : this.wheelUp,
- "down": this.wheelDown},
- this.mouseWheelOptions );
+ this, {up : this.wheelUp, down: this.wheelDown},
+ OpenLayers.Util.extend(wheelOptions, this.mouseWheelOptions)
+ );
if (OpenLayers.Control.PinchZoom) {
this.pinchZoom = new OpenLayers.Control.PinchZoom(
OpenLayers.Util.extend(
@@ -238,8 +245,7 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
* evt - {Event}
*/
defaultDblClick: function (evt) {
- var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );
- this.map.setCenter(newCenter, this.map.zoom + 1);
+ this.map.zoomTo(this.map.zoom + 1, evt.xy);
},
/**
@@ -249,8 +255,7 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
* evt - {Event}
*/
defaultDblRightClick: function (evt) {
- var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );
- this.map.setCenter(newCenter, this.map.zoom - 1);
+ this.map.zoomTo(this.map.zoom - 1, evt.xy);
},
/**
@@ -264,22 +269,14 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
if (!this.map.fractionalZoom) {
deltaZ = Math.round(deltaZ);
}
- var currentZoom = this.map.getZoom();
- var newZoom = this.map.getZoom() + deltaZ;
+ var currentZoom = this.map.getZoom(),
+ newZoom = currentZoom + deltaZ;
newZoom = Math.max(newZoom, 0);
newZoom = Math.min(newZoom, this.map.getNumZoomLevels());
if (newZoom === currentZoom) {
return;
}
- var size = this.map.getSize();
- var deltaX = size.w/2 - evt.xy.x;
- var deltaY = evt.xy.y - size.h/2;
- var newRes = this.map.baseLayer.getResolutionForZoom(newZoom);
- var zoomPoint = this.map.getLonLatFromPixel(evt.xy);
- var newCenter = new OpenLayers.LonLat(
- zoomPoint.lon + deltaX * newRes,
- zoomPoint.lat + deltaY * newRes );
- this.map.setCenter( newCenter, newZoom );
+ this.map.zoomTo(newZoom, evt.xy);
},
/**
diff --git a/lib/OpenLayers/Control/NavigationHistory.js b/lib/OpenLayers/Control/NavigationHistory.js
index 22aa72168d..bf2f95afa3 100644
--- a/lib/OpenLayers/Control/NavigationHistory.js
+++ b/lib/OpenLayers/Control/NavigationHistory.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/OverviewMap.js b/lib/OpenLayers/Control/OverviewMap.js
index 142cfaaae1..50b9300f05 100644
--- a/lib/OpenLayers/Control/OverviewMap.js
+++ b/lib/OpenLayers/Control/OverviewMap.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/Pan.js b/lib/OpenLayers/Control/Pan.js
index bc3d5759ed..d7fcc07c01 100644
--- a/lib/OpenLayers/Control/Pan.js
+++ b/lib/OpenLayers/Control/Pan.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/PanPanel.js b/lib/OpenLayers/Control/PanPanel.js
index b79f472c64..eeedbd0bce 100644
--- a/lib/OpenLayers/Control/PanPanel.js
+++ b/lib/OpenLayers/Control/PanPanel.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/PanZoom.js b/lib/OpenLayers/Control/PanZoom.js
index 4635384b56..dd007cf43b 100644
--- a/lib/OpenLayers/Control/PanZoom.js
+++ b/lib/OpenLayers/Control/PanZoom.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/PanZoomBar.js b/lib/OpenLayers/Control/PanZoomBar.js
index 86ed201bf0..ebf29647b6 100644
--- a/lib/OpenLayers/Control/PanZoomBar.js
+++ b/lib/OpenLayers/Control/PanZoomBar.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/Panel.js b/lib/OpenLayers/Control/Panel.js
index 51b47b3905..150afa7063 100644
--- a/lib/OpenLayers/Control/Panel.js
+++ b/lib/OpenLayers/Control/Panel.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/Permalink.js b/lib/OpenLayers/Control/Permalink.js
index 7ef003a81e..3d5d7a284d 100644
--- a/lib/OpenLayers/Control/Permalink.js
+++ b/lib/OpenLayers/Control/Permalink.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/PinchZoom.js b/lib/OpenLayers/Control/PinchZoom.js
index c510834527..13c1104958 100644
--- a/lib/OpenLayers/Control/PinchZoom.js
+++ b/lib/OpenLayers/Control/PinchZoom.js
@@ -4,7 +4,6 @@
* full text of the license. */
/**
- * @requires OpenLayers/Util/vendorPrefix.js
* @requires OpenLayers/Handler/Pinch.js
*/
@@ -105,27 +104,13 @@ OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
var current = (this.preserveCenter) ?
this.map.getPixelFromLonLat(this.map.getCenter()) : evt.xy;
- var dx = Math.round((current.x - pinchOrigin.x) + (scale - 1) * (containerOrigin.x - pinchOrigin.x));
- var dy = Math.round((current.y - pinchOrigin.y) + (scale - 1) * (containerOrigin.y - pinchOrigin.y));
+ var dx = Math.round((containerOrigin.x + current.x - pinchOrigin.x) + (scale - 1) * (containerOrigin.x - pinchOrigin.x));
+ var dy = Math.round((containerOrigin.y + current.y - pinchOrigin.y) + (scale - 1) * (containerOrigin.y - pinchOrigin.y));
- this.applyTransform(
- "translate(" + dx + "px, " + dy + "px) scale(" + scale + ")"
- );
+ this.map.applyTransform(dx, dy, scale);
this.currentCenter = current;
},
-
- /**
- * Method: applyTransform
- * Applies the given transform to layers.
- */
- applyTransform: function(transform) {
- var style = this.map.layerContainerDiv.style;
- var transformProperty = OpenLayers.Util.vendorPrefix.style("transform");
- if (transformProperty) {
- style[transformProperty] = transform;
- }
- },
-
+
/**
* Method: pinchDone
*
@@ -137,7 +122,7 @@ OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
* of the pinch gesture. This give us the final scale of the pinch.
*/
pinchDone: function(evt, start, last) {
- this.applyTransform("");
+ this.map.applyTransform();
var zoom = this.map.getZoomForResolution(this.map.getResolution() / last.scale, true);
if (zoom !== this.map.getZoom() || !this.currentCenter.equals(this.pinchOrigin)) {
var resolution = this.map.getResolutionForZoom(zoom);
diff --git a/lib/OpenLayers/Control/SLDSelect.js b/lib/OpenLayers/Control/SLDSelect.js
index 56f5d3892a..cd348a79f9 100644
--- a/lib/OpenLayers/Control/SLDSelect.js
+++ b/lib/OpenLayers/Control/SLDSelect.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/Scale.js b/lib/OpenLayers/Control/Scale.js
index 7e83075c93..c9f2d2b9f4 100644
--- a/lib/OpenLayers/Control/Scale.js
+++ b/lib/OpenLayers/Control/Scale.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/ScaleLine.js b/lib/OpenLayers/Control/ScaleLine.js
index 984be3ec9f..926241425e 100644
--- a/lib/OpenLayers/Control/ScaleLine.js
+++ b/lib/OpenLayers/Control/ScaleLine.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/SelectFeature.js b/lib/OpenLayers/Control/SelectFeature.js
index b2d8f60594..5467267174 100644
--- a/lib/OpenLayers/Control/SelectFeature.js
+++ b/lib/OpenLayers/Control/SelectFeature.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/Snapping.js b/lib/OpenLayers/Control/Snapping.js
index 2abec96ef3..217311479e 100644
--- a/lib/OpenLayers/Control/Snapping.js
+++ b/lib/OpenLayers/Control/Snapping.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/Split.js b/lib/OpenLayers/Control/Split.js
index e32b144db0..de19eb7ce6 100644
--- a/lib/OpenLayers/Control/Split.js
+++ b/lib/OpenLayers/Control/Split.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/TouchNavigation.js b/lib/OpenLayers/Control/TouchNavigation.js
index c436694b1e..cd5f9264b7 100644
--- a/lib/OpenLayers/Control/TouchNavigation.js
+++ b/lib/OpenLayers/Control/TouchNavigation.js
@@ -175,8 +175,7 @@ OpenLayers.Control.TouchNavigation = OpenLayers.Class(OpenLayers.Control, {
* evt - {Event}
*/
defaultDblClick: function (evt) {
- var newCenter = this.map.getLonLatFromViewPortPx(evt.xy);
- this.map.setCenter(newCenter, this.map.zoom + 1);
+ this.map.zoomTo(this.map.zoom + 1, evt.xy);
},
CLASS_NAME: "OpenLayers.Control.TouchNavigation"
diff --git a/lib/OpenLayers/Control/TransformFeature.js b/lib/OpenLayers/Control/TransformFeature.js
index 52d18be8fa..8c2145649e 100644
--- a/lib/OpenLayers/Control/TransformFeature.js
+++ b/lib/OpenLayers/Control/TransformFeature.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/UTFGrid.js b/lib/OpenLayers/Control/UTFGrid.js
index b5ec004d5a..799320110f 100644
--- a/lib/OpenLayers/Control/UTFGrid.js
+++ b/lib/OpenLayers/Control/UTFGrid.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/WMSGetFeatureInfo.js b/lib/OpenLayers/Control/WMSGetFeatureInfo.js
index acdce6a459..c9242f65f2 100644
--- a/lib/OpenLayers/Control/WMSGetFeatureInfo.js
+++ b/lib/OpenLayers/Control/WMSGetFeatureInfo.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
@@ -15,10 +15,10 @@
/**
* Class: OpenLayers.Control.WMSGetFeatureInfo
* The WMSGetFeatureInfo control uses a WMS query to get information about a point on the map. The
- * information may be in a display-friendly format such as HTML, or a machine-friendly format such
- * as GML, depending on the server's capabilities and the client's configuration. This control
- * handles click or hover events, attempts to parse the results using an OpenLayers.Format, and
- * fires a 'getfeatureinfo' event with the click position, the raw body of the response, and an
+ * information may be in a display-friendly format such as HTML, or a machine-friendly format such
+ * as GML, depending on the server's capabilities and the client's configuration. This control
+ * handles click or hover events, attempts to parse the results using an OpenLayers.Format, and
+ * fires a 'getfeatureinfo' event with the click position, the raw body of the response, and an
* array of features if it successfully read the response.
*
* Inherits from:
@@ -49,23 +49,25 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
*/
maxFeatures: 10,
- /** APIProperty: clickCallback
- * {String} The click callback to register in the
- * {} object created when the hover
- * option is set to false. Default is "click".
+ /**
+ * APIProperty: clickCallback
+ * {String} The click callback to register in the
+ * {} object created when the hover
+ * option is set to false. Default is "click".
*/
clickCallback: "click",
-
- /** APIProperty: output
- * {String} Either "features" or "object". When triggering a
- * getfeatureinfo request should we pass on an array of features
- * or an object with with a "features" property and other properties
- * (such as the url of the WMS). Default is "features".
+
+ /**
+ * APIProperty: output
+ * {String} Either "features" or "object". When triggering a getfeatureinfo
+ * request should we pass on an array of features or an object with with
+ * a "features" property and other properties (such as the url of the
+ * WMS). Default is "features".
*/
output: "features",
-
+
/**
- * Property: layers
+ * APIProperty: layers
* {Array()} The layers to query for feature info.
* If omitted, all map WMS layers with a url that matches this or
* will be considered.
@@ -73,21 +75,21 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
layers: null,
/**
- * Property: queryVisible
+ * APIProperty: queryVisible
* {Boolean} If true, filter out hidden layers when searching the map for
* layers to query. Default is false.
*/
queryVisible: false,
/**
- * Property: url
+ * APIProperty: url
* {String} The URL of the WMS service to use. If not provided, the url
* of the first eligible layer will be used.
*/
url: null,
-
+
/**
- * Property: layerUrls
+ * APIProperty: layerUrls
* {Array(String)} Optional list of urls for layers that should be queried.
* This can be used when the layer url differs from the url used for
* making GetFeatureInfo requests (in the case of a layer using cached
@@ -96,18 +98,18 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
layerUrls: null,
/**
- * Property: infoFormat
- * {String} The mimetype to request from the server. If you are using
- * drillDown mode and have multiple servers that do not share a common
- * infoFormat, you can override the control's infoFormat by providing an
- * INFO_FORMAT parameter in your instance(s).
+ * APIProperty: infoFormat
+ * {String} The mimetype to request from the server. If you are using
+ * drillDown mode and have multiple servers that do not share a common
+ * infoFormat, you can override the control's infoFormat by providing an
+ * INFO_FORMAT parameter in your instance(s).
*/
infoFormat: 'text/html',
-
+
/**
- * Property: vendorParams
+ * APIProperty: vendorParams
* {Object} Additional parameters that will be added to the request, for
- * WMS implementations that support them. This could e.g. look like
+ * WMS implementations that support them. This could e.g. look like
* (start code)
* {
* radius: 5
@@ -115,16 +117,16 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
* (end)
*/
vendorParams: {},
-
+
/**
- * Property: format
+ * APIProperty: format
* {} A format for parsing GetFeatureInfo responses.
* Default is .
*/
format: null,
-
+
/**
- * Property: formatOptions
+ * APIProperty: formatOptions
* {Object} Optional properties to set on the format (if one is not provided
* in the property.
*/
@@ -140,21 +142,21 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
* }
* (end)
*/
-
+
/**
* Property: handler
* {Object} Reference to the for this control
*/
handler: null,
-
+
/**
* Property: hoverRequest
* {} contains the currently running hover request
* (if any).
*/
hoverRequest: null,
-
- /**
+
+ /**
* APIProperty: events
* {} Events instance for listeners and triggering
* control specific events.
@@ -166,7 +168,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
*
* Supported event types (in addition to those from ):
* beforegetfeatureinfo - Triggered before the request is sent.
- * The event object has an *xy* property with the position of the
+ * The event object has an *xy* property with the position of the
* mouse click or hover event that triggers the request.
* nogetfeatureinfo - no queryable layers were found.
* getfeatureinfo - Triggered when a GetFeatureInfo response is received.
@@ -184,20 +186,20 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
* Constructor:
*
* Parameters:
- * options - {Object}
+ * options - {Object}
*/
initialize: function(options) {
options = options || {};
options.handlerOptions = options.handlerOptions || {};
OpenLayers.Control.prototype.initialize.apply(this, [options]);
-
+
if(!this.format) {
this.format = new OpenLayers.Format.WMSGetFeatureInfo(
options.formatOptions
);
}
-
+
if(this.drillDown === true) {
this.hover = false;
}
@@ -220,11 +222,11 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
},
/**
- * Method: getInfoForClick
+ * Method: getInfoForClick
* Called on click
*
* Parameters:
- * evt - {}
+ * evt - {}
*/
getInfoForClick: function(evt) {
this.events.triggerEvent("beforegetfeatureinfo", {xy: evt.xy});
@@ -233,7 +235,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
OpenLayers.Element.addClass(this.map.viewPortDiv, "olCursorWait");
this.request(evt.xy, {});
},
-
+
/**
* Method: getInfoForHover
* Pause callback for the hover handler
@@ -284,7 +286,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
}
return layers;
},
-
+
/**
* Method: urlMatches
* Test to see if the provided url matches either the control or one
@@ -383,7 +385,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
* Method: getStyleNames
* Gets the STYLES parameter for the layer. Make sure the STYLES parameter
* matches the LAYERS parameter
- *
+ *
* Parameters:
* layer - {}
*
@@ -411,12 +413,12 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
/**
* Method: request
* Sends a GetFeatureInfo request to the WMS
- *
+ *
* Parameters:
* clickPosition - {} The position on the map where the
* mouse event occurred.
* options - {Object} additional options for this method.
- *
+ *
* Valid options:
* - *hover* {Boolean} true if we do the request for the hover handler
*/
@@ -428,13 +430,13 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait");
return;
}
-
+
options = options || {};
if(this.drillDown === false) {
var wmsOptions = this.buildWMSOptions(this.url, layers,
- clickPosition, layers[0].params.FORMAT);
+ clickPosition, layers[0].params.FORMAT);
var request = OpenLayers.Request.GET(wmsOptions);
-
+
if (options.hover === true) {
this.hoverRequest = request;
}
@@ -458,9 +460,9 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
var layers;
for (var url in services) {
layers = services[url];
- var wmsOptions = this.buildWMSOptions(url, layers,
+ var wmsOptions = this.buildWMSOptions(url, layers,
clickPosition, layers[0].params.FORMAT);
- OpenLayers.Request.GET(wmsOptions);
+ OpenLayers.Request.GET(wmsOptions);
}
}
},
@@ -488,11 +490,11 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
// Reset the cursor.
OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait");
},
-
+
/**
* Method: handleResponse
* Handler for the GetFeatureInfo response.
- *
+ *
* Parameters:
* xy - {} The position on the map where the
* mouse event occurred.
@@ -500,7 +502,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
* url - {String} The url which was used for this request.
*/
handleResponse: function(xy, request, url) {
-
+
var doc = request.responseXML;
if(!doc || !doc.documentElement) {
doc = request.responseText;
@@ -518,7 +520,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
this._features = (this._features || []).concat(features);
}
if (this._requestCount === this._numRequests) {
- this.triggerGetFeatureInfo(request, xy, this._features.concat());
+ this.triggerGetFeatureInfo(request, xy, this._features.concat());
delete this._features;
delete this._requestCount;
delete this._numRequests;
diff --git a/lib/OpenLayers/Control/WMTSGetFeatureInfo.js b/lib/OpenLayers/Control/WMTSGetFeatureInfo.js
index cd73342319..c26f8f36ba 100644
--- a/lib/OpenLayers/Control/WMTSGetFeatureInfo.js
+++ b/lib/OpenLayers/Control/WMTSGetFeatureInfo.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/Zoom.js b/lib/OpenLayers/Control/Zoom.js
index 9680f0a398..70140f46de 100644
--- a/lib/OpenLayers/Control/Zoom.js
+++ b/lib/OpenLayers/Control/Zoom.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/ZoomBox.js b/lib/OpenLayers/Control/ZoomBox.js
index ff4db5c5ad..f8cea39bed 100644
--- a/lib/OpenLayers/Control/ZoomBox.js
+++ b/lib/OpenLayers/Control/ZoomBox.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
@@ -69,7 +69,8 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
*/
zoomBox: function (position) {
if (position instanceof OpenLayers.Bounds) {
- var bounds;
+ var bounds,
+ targetCenterPx = position.getCenterPixel();
if (!this.out) {
var minXY = this.map.getLonLatFromPixel({
x: position.left,
@@ -82,13 +83,12 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat,
maxXY.lon, maxXY.lat);
} else {
- var pixWidth = Math.abs(position.right-position.left);
- var pixHeight = Math.abs(position.top-position.bottom);
+ var pixWidth = position.right - position.left;
+ var pixHeight = position.bottom - position.top;
var zoomFactor = Math.min((this.map.size.h / pixHeight),
(this.map.size.w / pixWidth));
var extent = this.map.getExtent();
- var center = this.map.getLonLatFromPixel(
- position.getCenterPixel());
+ var center = this.map.getLonLatFromPixel(targetCenterPx);
var xmin = center.lon - (extent.getWidth()/2)*zoomFactor;
var xmax = center.lon + (extent.getWidth()/2)*zoomFactor;
var ymin = center.lat - (extent.getHeight()/2)*zoomFactor;
@@ -96,18 +96,27 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
bounds = new OpenLayers.Bounds(xmin, ymin, xmax, ymax);
}
// always zoom in/out
- var lastZoom = this.map.getZoom();
- this.map.zoomToExtent(bounds);
+ var lastZoom = this.map.getZoom(),
+ size = this.map.getSize(),
+ centerPx = {x: size.w / 2, y: size.h / 2},
+ zoom = this.map.getZoomForExtent(bounds),
+ oldRes = this.map.getResolution(),
+ newRes = this.map.getResolutionForZoom(zoom),
+ zoomOriginPx = {
+ x: (oldRes * targetCenterPx.x - newRes * centerPx.x) /
+ (oldRes - newRes),
+ y: (oldRes * targetCenterPx.y - newRes * centerPx.y) /
+ (oldRes - newRes)
+ };
+ this.map.zoomTo(zoom, zoomOriginPx);
if (lastZoom == this.map.getZoom() && this.alwaysZoom == true){
this.map.zoomTo(lastZoom + (this.out ? -1 : 1));
}
} else if (this.zoomOnClick) { // it's a pixel
if (!this.out) {
- this.map.setCenter(this.map.getLonLatFromPixel(position),
- this.map.getZoom() + 1);
+ this.map.zoomTo(this.map.getZoom() + 1, position);
} else {
- this.map.setCenter(this.map.getLonLatFromPixel(position),
- this.map.getZoom() - 1);
+ this.map.zoomTo(this.map.getZoom() - 1, position);
}
}
},
diff --git a/lib/OpenLayers/Control/ZoomIn.js b/lib/OpenLayers/Control/ZoomIn.js
index 735367d61f..8da1e1cf21 100644
--- a/lib/OpenLayers/Control/ZoomIn.js
+++ b/lib/OpenLayers/Control/ZoomIn.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/ZoomOut.js b/lib/OpenLayers/Control/ZoomOut.js
index d0a570a90a..72a657b335 100644
--- a/lib/OpenLayers/Control/ZoomOut.js
+++ b/lib/OpenLayers/Control/ZoomOut.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/ZoomPanel.js b/lib/OpenLayers/Control/ZoomPanel.js
index 22f7756ea2..147f6cb188 100644
--- a/lib/OpenLayers/Control/ZoomPanel.js
+++ b/lib/OpenLayers/Control/ZoomPanel.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Control/ZoomToMaxExtent.js b/lib/OpenLayers/Control/ZoomToMaxExtent.js
index 5553060969..bc2e75464a 100644
--- a/lib/OpenLayers/Control/ZoomToMaxExtent.js
+++ b/lib/OpenLayers/Control/ZoomToMaxExtent.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Events.js b/lib/OpenLayers/Events.js
index 74692a8775..6a4a129c11 100644
--- a/lib/OpenLayers/Events.js
+++ b/lib/OpenLayers/Events.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
@@ -566,6 +566,7 @@ OpenLayers.Events = OpenLayers.Class({
this.listeners = {};
this.extensions = {};
this.extensionCount = {};
+ this._msTouches = [];
// if a dom element is specified, add a listeners list
// for browser events on the element and register them
@@ -632,11 +633,16 @@ OpenLayers.Events = OpenLayers.Class({
);
}
this.element = element;
+ var msTouch = !!window.navigator.msMaxTouchPoints;
+ var type;
for (var i = 0, len = this.BROWSER_EVENTS.length; i < len; i++) {
+ type = this.BROWSER_EVENTS[i];
// register the event cross-browser
- OpenLayers.Event.observe(
- element, this.BROWSER_EVENTS[i], this.eventHandler
+ OpenLayers.Event.observe(element, type, this.eventHandler
);
+ if (msTouch && type.indexOf('touch') === 0) {
+ this.addMsTouchListener(element, type, this.eventHandler);
+ }
}
// disable dragstart in IE so that mousedown/move/up works normally
OpenLayers.Event.observe(element, "dragstart", OpenLayers.Event.stop);
@@ -1014,5 +1020,151 @@ OpenLayers.Events = OpenLayers.Class({
);
},
+ /**
+ * Method: addMsTouchListener
+ *
+ * Parameters:
+ * element - {DOMElement} The DOM element to register the listener on
+ * type - {String} The event type
+ * handler - {Function} the handler
+ */
+ addMsTouchListener: function (element, type, handler) {
+ var eventHandler = this.eventHandler;
+ var touches = this._msTouches;
+
+ function msHandler(evt) {
+ handler(OpenLayers.Util.applyDefaults({
+ stopPropagation: function() {
+ for (var i=touches.length-1; i>=0; --i) {
+ touches[i].stopPropagation();
+ }
+ },
+ preventDefault: function() {
+ for (var i=touches.length-1; i>=0; --i) {
+ touches[i].preventDefault();
+ }
+ },
+ type: type
+ }, evt));
+ }
+
+ switch (type) {
+ case 'touchstart':
+ return this.addMsTouchListenerStart(element, type, msHandler);
+ case 'touchend':
+ return this.addMsTouchListenerEnd(element, type, msHandler);
+ case 'touchmove':
+ return this.addMsTouchListenerMove(element, type, msHandler);
+ default:
+ throw 'Unknown touch event type';
+ }
+ },
+
+ /**
+ * Method: addMsTouchListenerStart
+ *
+ * Parameters:
+ * element - {DOMElement} The DOM element to register the listener on
+ * type - {String} The event type
+ * handler - {Function} the handler
+ */
+ addMsTouchListenerStart: function(element, type, handler) {
+ var touches = this._msTouches;
+
+ var cb = function(e) {
+
+ var alreadyInArray = false;
+ for (var i=0, ii=touches.length; i= 0x20);
-
- point[dim] += ((result & 1) ? ~(result >> 1) : (result >> 1));
+ point.push(flatPoints[i++])
}
- points.push(point.slice(0));
+ points.push(point);
}
return points;
@@ -163,16 +153,16 @@ OpenLayers.Format.EncodedPolyline = OpenLayers.Class(OpenLayers.Format, {
else
return null;
- var points = new Array();
- for (var i in pointGeometries) {
+ var flatPoints = [];
+
+ var pointGeometriesLength = pointGeometries.length;
+ for (var i = 0; i < pointGeometriesLength; ++i) {
var pointGeometry = pointGeometries[i];
- var point = [Math.round(pointGeometry.y * 1e5),
- Math.round(pointGeometry.x * 1e5)];
- points.push(point);
+ flatPoints.push(pointGeometry.y);
+ flatPoints.push(pointGeometry.x);
}
- var result = this.encode(points, 2);
- return result;
+ return this.encodeDeltas(flatPoints, 2);
},
/**
@@ -188,66 +178,377 @@ OpenLayers.Format.EncodedPolyline = OpenLayers.Class(OpenLayers.Format, {
* {String} An encoded string
*/
encode: function (points, dims) {
- var encoded_points = "";
+ var flatPoints = [];
- var lastPoint = new Array(dims);
- for (var i = 0; i < lastPoint.length; ++i)
- lastPoint[i] = 0;
-
- for (var i = 0; i < points.length; i++) {
+ var pointsLength = points.length;
+ for (var i = 0; i < pointsLength; ++i) {
var point = points[i];
- for (var dim = 0; dim < lastPoint.length; ++dim) {
- var delta = point[dim] - lastPoint[dim];
- encoded_points += this.encodeSignedNumber(delta);
+ for (var dim = 0; dim < dims; ++dim) {
+ flatPoints.push(point[dim]);
}
-
- lastPoint = point;
}
- return encoded_points;
+
+ return this.encodeDeltas(flatPoints, dims, 1);
},
/**
- * Method: encodeSignedNumber
+ * APIMethod: encodeDeltas
+ * Encode a list of n-dimensional points and return an encoded string
+ *
+ * Attention: This function will modify the passed array!
+ *
+ * Parameters:
+ * numbers - {Array.} A list of n-dimensional points.
+ * dimension - {number} The dimension of the points in the list.
+ * opt_factor - {number=} The factor by which the numbers will be
+ * multiplied. The remaining decimal places will get rounded away.
+ *
+ * Returns:
+ * {string} The encoded string.
+ */
+ encodeDeltas: function(numbers, dimension, opt_factor) {
+ var factor = opt_factor || 1e5;
+ var d;
+
+ var lastNumbers = new Array(dimension);
+ for (d = 0; d < dimension; ++d) {
+ lastNumbers[d] = 0;
+ }
+
+ var numbersLength = numbers.length;
+ for (var i = 0; i < numbersLength;) {
+ for (d = 0; d < dimension; ++d, ++i) {
+ var num = numbers[i];
+ var delta = num - lastNumbers[d];
+ lastNumbers[d] = num;
+
+ numbers[i] = delta;
+ }
+ }
+
+ return this.encodeFloats(numbers, factor);
+ },
+
+
+ /**
+ * APIMethod: decodeDeltas
+ * Decode a list of n-dimensional points from an encoded string
+ *
+ * Parameters:
+ * encoded - {string} An encoded string.
+ * dimension - {number} The dimension of the points in the encoded string.
+ * opt_factor - {number=} The factor by which the resulting numbers will
+ * be divided.
+ *
+ * Returns:
+ * {Array.} A list of n-dimensional points.
+ */
+ decodeDeltas: function(encoded, dimension, opt_factor) {
+ var factor = opt_factor || 1e5;
+ var d;
+
+ var lastNumbers = new Array(dimension);
+ for (d = 0; d < dimension; ++d) {
+ lastNumbers[d] = 0;
+ }
+
+ var numbers = this.decodeFloats(encoded, factor);
+
+ var numbersLength = numbers.length;
+ for (var i = 0; i < numbersLength;) {
+ for (d = 0; d < dimension; ++d, ++i) {
+ lastNumbers[d] += numbers[i];
+
+ numbers[i] = lastNumbers[d];
+ }
+ }
+
+ return numbers;
+ },
+
+
+ /**
+ * APIMethod: encodeFloats
+ * Encode a list of floating point numbers and return an encoded string
+ *
+ * Attention: This function will modify the passed array!
+ *
+ * Parameters:
+ * numbers - {Array.} A list of floating point numbers.
+ * opt_factor - {number=} The factor by which the numbers will be
+ * multiplied. The remaining decimal places will get rounded away.
+ *
+ * Returns:
+ * {string} The encoded string.
+ */
+ encodeFloats: function(numbers, opt_factor) {
+ var factor = opt_factor || 1e5;
+
+ var numbersLength = numbers.length;
+ for (var i = 0; i < numbersLength; ++i) {
+ numbers[i] = Math.round(numbers[i] * factor);
+ }
+
+ return this.encodeSignedIntegers(numbers);
+ },
+
+
+ /**
+ * APIMethod: decodeFloats
+ * Decode a list of floating point numbers from an encoded string
+ *
+ * Parameters:
+ * encoded - {string} An encoded string.
+ * opt_factor - {number=} The factor by which the result will be divided.
+ *
+ * Returns:
+ * {Array.} A list of floating point numbers.
+ */
+ decodeFloats: function(encoded, opt_factor) {
+ var factor = opt_factor || 1e5;
+
+ var numbers = this.decodeSignedIntegers(encoded);
+
+ var numbersLength = numbers.length;
+ for (var i = 0; i < numbersLength; ++i) {
+ numbers[i] /= factor;
+ }
+
+ return numbers;
+ },
+
+
+ /**
+ * APIMethod: encodeSignedIntegers
+ * Encode a list of signed integers and return an encoded string
+ *
+ * Attention: This function will modify the passed array!
+ *
+ * Parameters:
+ * numbers - {Array.} A list of signed integers.
+ *
+ * Returns:
+ * {string} The encoded string.
+ */
+ encodeSignedIntegers: function(numbers) {
+ var numbersLength = numbers.length;
+ for (var i = 0; i < numbersLength; ++i) {
+ var num = numbers[i];
+
+ var signedNum = num << 1;
+ if (num < 0) {
+ signedNum = ~(signedNum);
+ }
+
+ numbers[i] = signedNum;
+ }
+
+ return this.encodeUnsignedIntegers(numbers);
+ },
+
+
+ /**
+ * APIMethod: decodeSignedIntegers
+ * Decode a list of signed integers from an encoded string
+ *
+ * Parameters:
+ * encoded - {string} An encoded string.
+ *
+ * Returns:
+ * {Array.} A list of signed integers.
+ */
+ decodeSignedIntegers: function(encoded) {
+ var numbers = this.decodeUnsignedIntegers(encoded);
+
+ var numbersLength = numbers.length;
+ for (var i = 0; i < numbersLength; ++i) {
+ var num = numbers[i];
+ numbers[i] = (num & 1) ? ~(num >> 1) : (num >> 1);
+ }
+
+ return numbers;
+ },
+
+
+ /**
+ * APIMethod: encodeUnsignedIntegers
+ * Encode a list of unsigned integers and return an encoded string
+ *
+ * Parameters:
+ * numbers - {Array.} A list of unsigned integers.
+ *
+ * Returns:
+ * {string} The encoded string.
+ */
+ encodeUnsignedIntegers: function(numbers) {
+ var encoded = '';
+
+ var numbersLength = numbers.length;
+ for (var i = 0; i < numbersLength; ++i) {
+ encoded += this.encodeUnsignedInteger(numbers[i]);
+ }
+
+ return encoded;
+ },
+
+
+ /**
+ * APIMethod: decodeUnsignedIntegers
+ * Decode a list of unsigned integers from an encoded string
+ *
+ * Parameters:
+ * encoded - {string} An encoded string.
+ *
+ * Returns:
+ * {Array.} A list of unsigned integers.
+ */
+ decodeUnsignedIntegers: function(encoded) {
+ var numbers = [];
+
+ var current = 0;
+ var shift = 0;
+
+ var encodedLength = encoded.length;
+ for (var i = 0; i < encodedLength; ++i) {
+ var b = encoded.charCodeAt(i) - 63;
+
+ current |= (b & 0x1f) << shift;
+
+ if (b < 0x20) {
+ numbers.push(current);
+ current = 0;
+ shift = 0;
+ } else {
+ shift += 5;
+ }
+ }
+
+ return numbers;
+ },
+
+
+ /**
+ * Method: encodeFloat
+ * Encode one single floating point number and return an encoded string
+ *
+ * Parameters:
+ * num - {number} Floating point number that should be encoded.
+ * opt_factor - {number=} The factor by which num will be multiplied.
+ * The remaining decimal places will get rounded away.
+ *
+ * Returns:
+ * {string} The encoded string.
+ */
+ encodeFloat: function(num, opt_factor) {
+ num = Math.round(num * (opt_factor || 1e5));
+ return this.encodeSignedInteger(num);
+ },
+
+
+ /**
+ * Method: decodeFloat
+ * Decode one single floating point number from an encoded string
+ *
+ * Parameters:
+ * encoded - {string} An encoded string.
+ * opt_factor - {number=} The factor by which the result will be divided.
+ *
+ * Returns:
+ * {number} The decoded floating point number.
+ */
+ decodeFloat: function(encoded, opt_factor) {
+ var result = this.decodeSignedInteger(encoded);
+ return result / (opt_factor || 1e5);
+ },
+
+
+ /**
+ * Method: encodeSignedInteger
* Encode one single signed integer and return an encoded string
*
* Parameters:
- * num - {int} A signed integer that should be encoded
+ * num - {number} Signed integer that should be encoded.
*
* Returns:
- * {String} An encoded string
+ * {string} The encoded string.
*/
- encodeSignedNumber: function (num) {
- var sgn_num = num << 1;
- if (num < 0)
- sgn_num = ~(sgn_num);
+ encodeSignedInteger: function(num) {
+ var signedNum = num << 1;
+ if (num < 0) {
+ signedNum = ~(signedNum);
+ }
- return this.encodeNumber(sgn_num);
+ return this.encodeUnsignedInteger(signedNum);
},
+
/**
- * Method: encodeNumber
- * Encode one single unsigned integer and return an encoded string
- *
- * encodeSignedNumber should be used instead of using this method directly!
+ * Method: decodeSignedInteger
+ * Decode one single signed integer from an encoded string
*
* Parameters:
- * num - {int} An unsigned integer that should be encoded
+ * encoded - {string} An encoded string.
*
* Returns:
- * {String} An encoded string
+ * {number} The decoded signed integer.
*/
- encodeNumber: function (num) {
- var encodeString = "";
- var value;
- while (num >= 0x20) {
- value = (0x20 | (num & 0x1f)) + 63;
- encodeString += (String.fromCharCode(value));
- num >>= 5;
- }
- value = num + 63;
- encodeString += (String.fromCharCode(value));
- return encodeString;
+ decodeSignedInteger: function(encoded) {
+ var result = this.decodeUnsignedInteger(encoded);
+ return ((result & 1) ? ~(result >> 1) : (result >> 1));
+ },
+
+
+ /**
+ * Method: encodeUnsignedInteger
+ * Encode one single unsigned integer and return an encoded string
+ *
+ * Parameters:
+ * num - {number} Unsigned integer that should be encoded.
+ *
+ * Returns:
+ * {string} The encoded string.
+ */
+ encodeUnsignedInteger: function(num) {
+ var value, encoded = '';
+ while (num >= 0x20) {
+ value = (0x20 | (num & 0x1f)) + 63;
+ encoded += (String.fromCharCode(value));
+ num >>= 5;
+ }
+ value = num + 63;
+ encoded += (String.fromCharCode(value));
+ return encoded;
+ },
+
+
+ /**
+ * Method: decodeUnsignedInteger
+ * Decode one single unsigned integer from an encoded string
+ *
+ * Parameters:
+ * encoded - {string} An encoded string.
+ *
+ * Returns:
+ * {number} The decoded unsigned integer.
+ */
+ decodeUnsignedInteger: function(encoded) {
+ var result = 0;
+ var shift = 0;
+
+ var encodedLength = encoded.length;
+ for (var i = 0; i < encodedLength; ++i) {
+ var b = encoded.charCodeAt(i) - 63;
+
+ result |= (b & 0x1f) << shift;
+
+ if (b < 0x20)
+ break;
+
+ shift += 5;
+ }
+
+ return result;
},
CLASS_NAME: "OpenLayers.Format.EncodedPolyline"
diff --git a/lib/OpenLayers/Format/Filter.js b/lib/OpenLayers/Format/Filter.js
index f3fc0b343b..59c06a8ed0 100644
--- a/lib/OpenLayers/Format/Filter.js
+++ b/lib/OpenLayers/Format/Filter.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/Filter/v1.js b/lib/OpenLayers/Format/Filter/v1.js
index 9cb89c847e..539ec0f488 100644
--- a/lib/OpenLayers/Format/Filter/v1.js
+++ b/lib/OpenLayers/Format/Filter/v1.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/Filter/v1_0_0.js b/lib/OpenLayers/Format/Filter/v1_0_0.js
index 5cf105e964..52e650e4b4 100644
--- a/lib/OpenLayers/Format/Filter/v1_0_0.js
+++ b/lib/OpenLayers/Format/Filter/v1_0_0.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/Filter/v1_1_0.js b/lib/OpenLayers/Format/Filter/v1_1_0.js
index 64a902b959..628c4890fd 100644
--- a/lib/OpenLayers/Format/Filter/v1_1_0.js
+++ b/lib/OpenLayers/Format/Filter/v1_1_0.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/GML.js b/lib/OpenLayers/Format/GML.js
index e26e01e44a..467f8758c0 100644
--- a/lib/OpenLayers/Format/GML.js
+++ b/lib/OpenLayers/Format/GML.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/GML/Base.js b/lib/OpenLayers/Format/GML/Base.js
index 1e6d5316b9..6c499694aa 100644
--- a/lib/OpenLayers/Format/GML/Base.js
+++ b/lib/OpenLayers/Format/GML/Base.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/GML/v2.js b/lib/OpenLayers/Format/GML/v2.js
index 8a489a045a..bd26b99995 100644
--- a/lib/OpenLayers/Format/GML/v2.js
+++ b/lib/OpenLayers/Format/GML/v2.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/GML/v3.js b/lib/OpenLayers/Format/GML/v3.js
index 16b141cece..82c7b1e498 100644
--- a/lib/OpenLayers/Format/GML/v3.js
+++ b/lib/OpenLayers/Format/GML/v3.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/GPX.js b/lib/OpenLayers/Format/GPX.js
index d6c3ffb058..16a8056bf9 100644
--- a/lib/OpenLayers/Format/GPX.js
+++ b/lib/OpenLayers/Format/GPX.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
@@ -250,11 +250,11 @@ OpenLayers.Format.GPX = OpenLayers.Class(OpenLayers.Format.XML, {
*/
buildMetadataNode: function(metadata) {
var types = ['name', 'desc', 'author'],
- node = this.createElementNSPlus('gpx:metadata');
+ node = this.createElementNS(this.namespaces.gpx, 'metadata');
for (var i=0; i < types.length; i++) {
var type = types[i];
if (metadata[type]) {
- var n = this.createElementNSPlus("gpx:" + type);
+ var n = this.createElementNS(this.namespaces.gpx, type);
n.appendChild(this.createTextNode(metadata[type]));
node.appendChild(n);
}
@@ -284,7 +284,7 @@ OpenLayers.Format.GPX = OpenLayers.Class(OpenLayers.Format.XML, {
this.appendAttributesNode(wpt, feature);
return wpt;
} else {
- var trkNode = this.createElementNSPlus("gpx:trk");
+ var trkNode = this.createElementNS(this.namespaces.gpx, "trk");
this.appendAttributesNode(trkNode, feature);
var trkSegNodes = this.buildTrkSegNode(geometry);
trkSegNodes = OpenLayers.Util.isArray(trkSegNodes) ?
@@ -312,7 +312,7 @@ OpenLayers.Format.GPX = OpenLayers.Class(OpenLayers.Format.XML, {
nodes;
if (geometry.CLASS_NAME == "OpenLayers.Geometry.LineString" ||
geometry.CLASS_NAME == "OpenLayers.Geometry.LinearRing") {
- node = this.createElementNSPlus("gpx:trkseg");
+ node = this.createElementNS(this.namespaces.gpx, "trkseg");
for (i = 0, len=geometry.components.length; i < len; i++) {
point = geometry.components[i];
node.appendChild(this.buildTrkPtNode(point));
@@ -338,7 +338,7 @@ OpenLayers.Format.GPX = OpenLayers.Class(OpenLayers.Format.XML, {
* {DOMElement} A trkpt node
*/
buildTrkPtNode: function(point) {
- var node = this.createElementNSPlus("gpx:trkpt");
+ var node = this.createElementNS(this.namespaces.gpx, "trkpt");
node.setAttribute("lon", point.x);
node.setAttribute("lat", point.y);
return node;
@@ -355,7 +355,7 @@ OpenLayers.Format.GPX = OpenLayers.Class(OpenLayers.Format.XML, {
* {DOMElement} A wpt node
*/
buildWptNode: function(geometry) {
- var node = this.createElementNSPlus("gpx:wpt");
+ var node = this.createElementNS(this.namespaces.gpx, "wpt");
node.setAttribute("lon", geometry.x);
node.setAttribute("lat", geometry.y);
return node;
@@ -370,11 +370,11 @@ OpenLayers.Format.GPX = OpenLayers.Class(OpenLayers.Format.XML, {
* feature - {}
*/
appendAttributesNode: function(node, feature) {
- var name = this.createElementNSPlus('gpx:name');
+ var name = this.createElementNS(this.namespaces.gpx, 'name');
name.appendChild(this.createTextNode(
feature.attributes.name || feature.id));
node.appendChild(name);
- var desc = this.createElementNSPlus('gpx:desc');
+ var desc = this.createElementNS(this.namespaces.gpx, 'desc');
desc.appendChild(this.createTextNode(
feature.attributes.description || this.defaultDesc));
node.appendChild(desc);
diff --git a/lib/OpenLayers/Format/GeoJSON.js b/lib/OpenLayers/Format/GeoJSON.js
index 962b3991d6..0e02377bd2 100644
--- a/lib/OpenLayers/Format/GeoJSON.js
+++ b/lib/OpenLayers/Format/GeoJSON.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/GeoRSS.js b/lib/OpenLayers/Format/GeoRSS.js
index 1bc782f614..cbbb4d897f 100644
--- a/lib/OpenLayers/Format/GeoRSS.js
+++ b/lib/OpenLayers/Format/GeoRSS.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/JSON.js b/lib/OpenLayers/Format/JSON.js
index f4ebff5b5e..5b25e6af67 100644
--- a/lib/OpenLayers/Format/JSON.js
+++ b/lib/OpenLayers/Format/JSON.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/KML.js b/lib/OpenLayers/Format/KML.js
index fa15c5806d..e10bce7b03 100644
--- a/lib/OpenLayers/Format/KML.js
+++ b/lib/OpenLayers/Format/KML.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/OGCExceptionReport.js b/lib/OpenLayers/Format/OGCExceptionReport.js
index 9fa293accd..61a9da5457 100644
--- a/lib/OpenLayers/Format/OGCExceptionReport.js
+++ b/lib/OpenLayers/Format/OGCExceptionReport.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/OSM.js b/lib/OpenLayers/Format/OSM.js
index 75a4f89418..7283348f1c 100644
--- a/lib/OpenLayers/Format/OSM.js
+++ b/lib/OpenLayers/Format/OSM.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/OWSCommon.js b/lib/OpenLayers/Format/OWSCommon.js
index 7decbf0f2b..fd71820659 100644
--- a/lib/OpenLayers/Format/OWSCommon.js
+++ b/lib/OpenLayers/Format/OWSCommon.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/OWSCommon/v1.js b/lib/OpenLayers/Format/OWSCommon/v1.js
index db317e6a00..57ae9d2576 100644
--- a/lib/OpenLayers/Format/OWSCommon/v1.js
+++ b/lib/OpenLayers/Format/OWSCommon/v1.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/OWSCommon/v1_0_0.js b/lib/OpenLayers/Format/OWSCommon/v1_0_0.js
index 0ba511a5a5..bc9852d76b 100644
--- a/lib/OpenLayers/Format/OWSCommon/v1_0_0.js
+++ b/lib/OpenLayers/Format/OWSCommon/v1_0_0.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/OWSCommon/v1_1_0.js b/lib/OpenLayers/Format/OWSCommon/v1_1_0.js
index aca42e8fcb..9da216c8e5 100644
--- a/lib/OpenLayers/Format/OWSCommon/v1_1_0.js
+++ b/lib/OpenLayers/Format/OWSCommon/v1_1_0.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/OWSContext.js b/lib/OpenLayers/Format/OWSContext.js
index 459ed14d45..ab38734fbd 100644
--- a/lib/OpenLayers/Format/OWSContext.js
+++ b/lib/OpenLayers/Format/OWSContext.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/OWSContext/v0_3_1.js b/lib/OpenLayers/Format/OWSContext/v0_3_1.js
index d7a38c39b5..d6487e8434 100644
--- a/lib/OpenLayers/Format/OWSContext/v0_3_1.js
+++ b/lib/OpenLayers/Format/OWSContext/v0_3_1.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/QueryStringFilter.js b/lib/OpenLayers/Format/QueryStringFilter.js
index dbef01930a..e33f7226ae 100644
--- a/lib/OpenLayers/Format/QueryStringFilter.js
+++ b/lib/OpenLayers/Format/QueryStringFilter.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/SLD.js b/lib/OpenLayers/Format/SLD.js
index 8bb1dc8c70..56e59d087d 100644
--- a/lib/OpenLayers/Format/SLD.js
+++ b/lib/OpenLayers/Format/SLD.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/SLD/v1.js b/lib/OpenLayers/Format/SLD/v1.js
index 7e765abd1e..c43bac4fe8 100644
--- a/lib/OpenLayers/Format/SLD/v1.js
+++ b/lib/OpenLayers/Format/SLD/v1.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/SLD/v1_0_0.js b/lib/OpenLayers/Format/SLD/v1_0_0.js
index f0ad738784..e920b502a3 100644
--- a/lib/OpenLayers/Format/SLD/v1_0_0.js
+++ b/lib/OpenLayers/Format/SLD/v1_0_0.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js b/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js
index a579784eb8..902da67a14 100644
--- a/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js
+++ b/lib/OpenLayers/Format/SLD/v1_0_0_GeoServer.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/SOSCapabilities.js b/lib/OpenLayers/Format/SOSCapabilities.js
index f4a2d7318e..1abb1c81db 100644
--- a/lib/OpenLayers/Format/SOSCapabilities.js
+++ b/lib/OpenLayers/Format/SOSCapabilities.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/SOSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/SOSCapabilities/v1_0_0.js
index 18d138d01c..89c0e914a7 100644
--- a/lib/OpenLayers/Format/SOSCapabilities/v1_0_0.js
+++ b/lib/OpenLayers/Format/SOSCapabilities/v1_0_0.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/SOSGetFeatureOfInterest.js b/lib/OpenLayers/Format/SOSGetFeatureOfInterest.js
index be8d162b00..aac2030d4c 100644
--- a/lib/OpenLayers/Format/SOSGetFeatureOfInterest.js
+++ b/lib/OpenLayers/Format/SOSGetFeatureOfInterest.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/SOSGetObservation.js b/lib/OpenLayers/Format/SOSGetObservation.js
index 9748b5a087..9a6e2d7383 100644
--- a/lib/OpenLayers/Format/SOSGetObservation.js
+++ b/lib/OpenLayers/Format/SOSGetObservation.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/Text.js b/lib/OpenLayers/Format/Text.js
index e4ec0f4225..bf9bcd557b 100644
--- a/lib/OpenLayers/Format/Text.js
+++ b/lib/OpenLayers/Format/Text.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WCSCapabilities.js b/lib/OpenLayers/Format/WCSCapabilities.js
index f73ee1b7d5..934aaa5d49 100644
--- a/lib/OpenLayers/Format/WCSCapabilities.js
+++ b/lib/OpenLayers/Format/WCSCapabilities.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1.js b/lib/OpenLayers/Format/WCSCapabilities/v1.js
index b4e433dc1f..bf8da3b181 100644
--- a/lib/OpenLayers/Format/WCSCapabilities/v1.js
+++ b/lib/OpenLayers/Format/WCSCapabilities/v1.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js
index 571e3fc1b9..4dfa0b8bde 100644
--- a/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js
+++ b/lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js
index 6efe1b1294..1753c51e83 100644
--- a/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js
+++ b/lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WCSGetCoverage.js b/lib/OpenLayers/Format/WCSGetCoverage.js
index e84af0674d..2817f2894a 100644
--- a/lib/OpenLayers/Format/WCSGetCoverage.js
+++ b/lib/OpenLayers/Format/WCSGetCoverage.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WFS.js b/lib/OpenLayers/Format/WFS.js
index 18628615ea..44b03a3af0 100644
--- a/lib/OpenLayers/Format/WFS.js
+++ b/lib/OpenLayers/Format/WFS.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WFSCapabilities.js b/lib/OpenLayers/Format/WFSCapabilities.js
index 690de3d536..61af08563a 100644
--- a/lib/OpenLayers/Format/WFSCapabilities.js
+++ b/lib/OpenLayers/Format/WFSCapabilities.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WFSCapabilities/v1.js b/lib/OpenLayers/Format/WFSCapabilities/v1.js
index 9f63c98e43..c4ec517042 100644
--- a/lib/OpenLayers/Format/WFSCapabilities/v1.js
+++ b/lib/OpenLayers/Format/WFSCapabilities/v1.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WFSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WFSCapabilities/v1_0_0.js
index 36457e67de..6b202c743f 100644
--- a/lib/OpenLayers/Format/WFSCapabilities/v1_0_0.js
+++ b/lib/OpenLayers/Format/WFSCapabilities/v1_0_0.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WFSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WFSCapabilities/v1_1_0.js
index 0f691cb90a..84f6b4bfcd 100644
--- a/lib/OpenLayers/Format/WFSCapabilities/v1_1_0.js
+++ b/lib/OpenLayers/Format/WFSCapabilities/v1_1_0.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WFSDescribeFeatureType.js b/lib/OpenLayers/Format/WFSDescribeFeatureType.js
index 44a5c1c936..416e845e24 100644
--- a/lib/OpenLayers/Format/WFSDescribeFeatureType.js
+++ b/lib/OpenLayers/Format/WFSDescribeFeatureType.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WFST.js b/lib/OpenLayers/Format/WFST.js
index ed101c3afc..eb3d9d9c77 100644
--- a/lib/OpenLayers/Format/WFST.js
+++ b/lib/OpenLayers/Format/WFST.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WFST/v1.js b/lib/OpenLayers/Format/WFST/v1.js
index d853ce7609..306ba6ff74 100644
--- a/lib/OpenLayers/Format/WFST/v1.js
+++ b/lib/OpenLayers/Format/WFST/v1.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WFST/v1_0_0.js b/lib/OpenLayers/Format/WFST/v1_0_0.js
index abdbc664b5..ed81a2d292 100644
--- a/lib/OpenLayers/Format/WFST/v1_0_0.js
+++ b/lib/OpenLayers/Format/WFST/v1_0_0.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WFST/v1_1_0.js b/lib/OpenLayers/Format/WFST/v1_1_0.js
index c145700f0b..ff2a88d3e0 100644
--- a/lib/OpenLayers/Format/WFST/v1_1_0.js
+++ b/lib/OpenLayers/Format/WFST/v1_1_0.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WKT.js b/lib/OpenLayers/Format/WKT.js
index d7dfbfaa51..a7a7b2ea1d 100644
--- a/lib/OpenLayers/Format/WKT.js
+++ b/lib/OpenLayers/Format/WKT.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
@@ -6,6 +6,12 @@
/**
* @requires OpenLayers/Format.js
* @requires OpenLayers/Feature/Vector.js
+ * @requires OpenLayers/Geometry/Point.js
+ * @requires OpenLayers/Geometry/MultiPoint.js
+ * @requires OpenLayers/Geometry/LineString.js
+ * @requires OpenLayers/Geometry/MultiLineString.js
+ * @requires OpenLayers/Geometry/Polygon.js
+ * @requires OpenLayers/Geometry/MultiPolygon.js
*/
/**
diff --git a/lib/OpenLayers/Format/WMC.js b/lib/OpenLayers/Format/WMC.js
index 185326a5c8..ded1b3a00e 100644
--- a/lib/OpenLayers/Format/WMC.js
+++ b/lib/OpenLayers/Format/WMC.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WMC/v1.js b/lib/OpenLayers/Format/WMC/v1.js
index 84ab222286..6c9a5c3d52 100644
--- a/lib/OpenLayers/Format/WMC/v1.js
+++ b/lib/OpenLayers/Format/WMC/v1.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WMC/v1_0_0.js b/lib/OpenLayers/Format/WMC/v1_0_0.js
index bacf64a794..ace0d95c7e 100644
--- a/lib/OpenLayers/Format/WMC/v1_0_0.js
+++ b/lib/OpenLayers/Format/WMC/v1_0_0.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WMC/v1_1_0.js b/lib/OpenLayers/Format/WMC/v1_1_0.js
index ffbd01c109..e5efc3e2fa 100644
--- a/lib/OpenLayers/Format/WMC/v1_1_0.js
+++ b/lib/OpenLayers/Format/WMC/v1_1_0.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WMSCapabilities.js b/lib/OpenLayers/Format/WMSCapabilities.js
index da3918464e..2bf3cef0c7 100644
--- a/lib/OpenLayers/Format/WMSCapabilities.js
+++ b/lib/OpenLayers/Format/WMSCapabilities.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WMSCapabilities/v1.js b/lib/OpenLayers/Format/WMSCapabilities/v1.js
index c6f0db14ff..ef5c133e2d 100644
--- a/lib/OpenLayers/Format/WMSCapabilities/v1.js
+++ b/lib/OpenLayers/Format/WMSCapabilities/v1.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WMSCapabilities/v1_1.js b/lib/OpenLayers/Format/WMSCapabilities/v1_1.js
index 469a0f751a..0e15d38088 100644
--- a/lib/OpenLayers/Format/WMSCapabilities/v1_1.js
+++ b/lib/OpenLayers/Format/WMSCapabilities/v1_1.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WMSCapabilities/v1_1_0.js b/lib/OpenLayers/Format/WMSCapabilities/v1_1_0.js
index c7c9793a0c..a1c6279136 100644
--- a/lib/OpenLayers/Format/WMSCapabilities/v1_1_0.js
+++ b/lib/OpenLayers/Format/WMSCapabilities/v1_1_0.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WMSCapabilities/v1_1_1.js b/lib/OpenLayers/Format/WMSCapabilities/v1_1_1.js
index 8e76b1842c..459572b6f4 100644
--- a/lib/OpenLayers/Format/WMSCapabilities/v1_1_1.js
+++ b/lib/OpenLayers/Format/WMSCapabilities/v1_1_1.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WMSCapabilities/v1_1_1_WMSC.js b/lib/OpenLayers/Format/WMSCapabilities/v1_1_1_WMSC.js
index e824114661..e58e4f755a 100644
--- a/lib/OpenLayers/Format/WMSCapabilities/v1_1_1_WMSC.js
+++ b/lib/OpenLayers/Format/WMSCapabilities/v1_1_1_WMSC.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WMSCapabilities/v1_3.js b/lib/OpenLayers/Format/WMSCapabilities/v1_3.js
index 46631de8b2..57aee1a0b8 100644
--- a/lib/OpenLayers/Format/WMSCapabilities/v1_3.js
+++ b/lib/OpenLayers/Format/WMSCapabilities/v1_3.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WMSCapabilities/v1_3_0.js b/lib/OpenLayers/Format/WMSCapabilities/v1_3_0.js
index 867a80377d..c2c4ca48b6 100644
--- a/lib/OpenLayers/Format/WMSCapabilities/v1_3_0.js
+++ b/lib/OpenLayers/Format/WMSCapabilities/v1_3_0.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WMSDescribeLayer.js b/lib/OpenLayers/Format/WMSDescribeLayer.js
index 397c2301fa..296262c42d 100644
--- a/lib/OpenLayers/Format/WMSDescribeLayer.js
+++ b/lib/OpenLayers/Format/WMSDescribeLayer.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WMSDescribeLayer/v1_1.js b/lib/OpenLayers/Format/WMSDescribeLayer/v1_1.js
index adda347467..3929d4b278 100644
--- a/lib/OpenLayers/Format/WMSDescribeLayer/v1_1.js
+++ b/lib/OpenLayers/Format/WMSDescribeLayer/v1_1.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WMSGetFeatureInfo.js b/lib/OpenLayers/Format/WMSGetFeatureInfo.js
index 97be9ba213..57eb219837 100644
--- a/lib/OpenLayers/Format/WMSGetFeatureInfo.js
+++ b/lib/OpenLayers/Format/WMSGetFeatureInfo.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WMTSCapabilities.js b/lib/OpenLayers/Format/WMTSCapabilities.js
index 985591202e..9cff69c80b 100644
--- a/lib/OpenLayers/Format/WMTSCapabilities.js
+++ b/lib/OpenLayers/Format/WMTSCapabilities.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WMTSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WMTSCapabilities/v1_0_0.js
index 3a201448eb..fda2584b6a 100644
--- a/lib/OpenLayers/Format/WMTSCapabilities/v1_0_0.js
+++ b/lib/OpenLayers/Format/WMTSCapabilities/v1_0_0.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WPSCapabilities.js b/lib/OpenLayers/Format/WPSCapabilities.js
index 96593d9ed4..f0d74dbd41 100644
--- a/lib/OpenLayers/Format/WPSCapabilities.js
+++ b/lib/OpenLayers/Format/WPSCapabilities.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WPSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WPSCapabilities/v1_0_0.js
index 7f6e872af9..e6762a9b32 100644
--- a/lib/OpenLayers/Format/WPSCapabilities/v1_0_0.js
+++ b/lib/OpenLayers/Format/WPSCapabilities/v1_0_0.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WPSDescribeProcess.js b/lib/OpenLayers/Format/WPSDescribeProcess.js
index e6cc47ae03..e8f96bb248 100644
--- a/lib/OpenLayers/Format/WPSDescribeProcess.js
+++ b/lib/OpenLayers/Format/WPSDescribeProcess.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/WPSExecute.js b/lib/OpenLayers/Format/WPSExecute.js
index f7dda5444d..0795b0d180 100644
--- a/lib/OpenLayers/Format/WPSExecute.js
+++ b/lib/OpenLayers/Format/WPSExecute.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/XLS.js b/lib/OpenLayers/Format/XLS.js
index c90dcd48d7..76f3f10ad5 100644
--- a/lib/OpenLayers/Format/XLS.js
+++ b/lib/OpenLayers/Format/XLS.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/XLS/v1.js b/lib/OpenLayers/Format/XLS/v1.js
index 413a74e2db..642474f0dd 100644
--- a/lib/OpenLayers/Format/XLS/v1.js
+++ b/lib/OpenLayers/Format/XLS/v1.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/XLS/v1_1_0.js b/lib/OpenLayers/Format/XLS/v1_1_0.js
index 89e9103b2f..7ffca26156 100644
--- a/lib/OpenLayers/Format/XLS/v1_1_0.js
+++ b/lib/OpenLayers/Format/XLS/v1_1_0.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/XML.js b/lib/OpenLayers/Format/XML.js
index 76341ca11e..56f587131b 100644
--- a/lib/OpenLayers/Format/XML.js
+++ b/lib/OpenLayers/Format/XML.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Format/XML/VersionedOGC.js b/lib/OpenLayers/Format/XML/VersionedOGC.js
index 381b9d6805..e68d9686d6 100644
--- a/lib/OpenLayers/Format/XML/VersionedOGC.js
+++ b/lib/OpenLayers/Format/XML/VersionedOGC.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Geometry.js b/lib/OpenLayers/Geometry.js
index 7737c261d5..e7b8e59dcf 100644
--- a/lib/OpenLayers/Geometry.js
+++ b/lib/OpenLayers/Geometry.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
@@ -438,12 +438,39 @@ OpenLayers.Geometry.segmentsIntersect = function(seg1, seg2, options) {
* representing endpoint coordinates.
*
* Returns:
- * {Object} An object with distance, x, and y properties. The distance
+ * {Object} An object with distance, along, x, and y properties. The distance
* will be the shortest distance between the input point and segment.
* The x and y properties represent the coordinates along the segment
- * where the shortest distance meets the segment.
+ * where the shortest distance meets the segment. The along attribute
+ * describes how far between the two segment points the given point is.
*/
OpenLayers.Geometry.distanceToSegment = function(point, segment) {
+ var result = OpenLayers.Geometry.distanceSquaredToSegment(point, segment);
+ result.distance = Math.sqrt(result.distance);
+ return result;
+};
+
+/**
+ * Function: OpenLayers.Geometry.distanceSquaredToSegment
+ *
+ * Usually the distanceToSegment function should be used. This variant however
+ * can be used for comparisons where the exact distance is not important.
+ *
+ * Parameters:
+ * point - {Object} An object with x and y properties representing the
+ * point coordinates.
+ * segment - {Object} An object with x1, y1, x2, and y2 properties
+ * representing endpoint coordinates.
+ *
+ * Returns:
+ * {Object} An object with squared distance, along, x, and y properties.
+ * The distance will be the shortest distance between the input point and
+ * segment. The x and y properties represent the coordinates along the
+ * segment where the shortest distance meets the segment. The along
+ * attribute describes how far between the two segment points the given
+ * point is.
+ */
+OpenLayers.Geometry.distanceSquaredToSegment = function(point, segment) {
var x0 = point.x;
var y0 = point.y;
var x1 = segment.x1;
@@ -466,7 +493,8 @@ OpenLayers.Geometry.distanceToSegment = function(point, segment) {
y = y1 + along * dy;
}
return {
- distance: Math.sqrt(Math.pow(x - x0, 2) + Math.pow(y - y0, 2)),
- x: x, y: y
+ distance: Math.pow(x - x0, 2) + Math.pow(y - y0, 2),
+ x: x, y: y,
+ along: along
};
};
diff --git a/lib/OpenLayers/Geometry/Collection.js b/lib/OpenLayers/Geometry/Collection.js
index 9d1793454d..f76cc85374 100644
--- a/lib/OpenLayers/Geometry/Collection.js
+++ b/lib/OpenLayers/Geometry/Collection.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Geometry/Curve.js b/lib/OpenLayers/Geometry/Curve.js
index 288367bf28..e663e0b57c 100644
--- a/lib/OpenLayers/Geometry/Curve.js
+++ b/lib/OpenLayers/Geometry/Curve.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Geometry/LineString.js b/lib/OpenLayers/Geometry/LineString.js
index e0db1e7d42..b7d7dac3a0 100644
--- a/lib/OpenLayers/Geometry/LineString.js
+++ b/lib/OpenLayers/Geometry/LineString.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Geometry/LinearRing.js b/lib/OpenLayers/Geometry/LinearRing.js
index b502572671..b0a694cb0d 100644
--- a/lib/OpenLayers/Geometry/LinearRing.js
+++ b/lib/OpenLayers/Geometry/LinearRing.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Geometry/MultiLineString.js b/lib/OpenLayers/Geometry/MultiLineString.js
index 2917fb6ce3..4e330b0e83 100644
--- a/lib/OpenLayers/Geometry/MultiLineString.js
+++ b/lib/OpenLayers/Geometry/MultiLineString.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Geometry/MultiPoint.js b/lib/OpenLayers/Geometry/MultiPoint.js
index a19f2aa766..ed8ff67f05 100644
--- a/lib/OpenLayers/Geometry/MultiPoint.js
+++ b/lib/OpenLayers/Geometry/MultiPoint.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Geometry/MultiPolygon.js b/lib/OpenLayers/Geometry/MultiPolygon.js
index aa94f965a9..d1e59dc020 100644
--- a/lib/OpenLayers/Geometry/MultiPolygon.js
+++ b/lib/OpenLayers/Geometry/MultiPolygon.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Geometry/Point.js b/lib/OpenLayers/Geometry/Point.js
index c2f6f55b13..456956f61a 100644
--- a/lib/OpenLayers/Geometry/Point.js
+++ b/lib/OpenLayers/Geometry/Point.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Geometry/Polygon.js b/lib/OpenLayers/Geometry/Polygon.js
index 7b9732a05a..6aaff1fb2d 100644
--- a/lib/OpenLayers/Geometry/Polygon.js
+++ b/lib/OpenLayers/Geometry/Polygon.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Handler.js b/lib/OpenLayers/Handler.js
index f929fe51c7..0fef88e537 100644
--- a/lib/OpenLayers/Handler.js
+++ b/lib/OpenLayers/Handler.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
@@ -85,6 +85,14 @@ OpenLayers.Handler = OpenLayers.Class({
* the OpenLayers code.
*/
evt: null,
+
+ /**
+ * Property: touch
+ * {Boolean} Indicates the support of touch events. When touch events are
+ * started touch will be true and all mouse related listeners will do
+ * nothing.
+ */
+ touch: false,
/**
* Constructor: OpenLayers.Handler
@@ -187,10 +195,32 @@ OpenLayers.Handler = OpenLayers.Class({
this.unregister(events[i], this[events[i]]);
}
}
+ this.touch = false;
this.active = false;
return true;
},
+ /**
+ * Method: startTouch
+ * Start touch events, this method must be called by subclasses in
+ * "touchstart" method. When touch events are started will be
+ * true and all mouse related listeners will do nothing.
+ */
+ startTouch: function() {
+ if (!this.touch) {
+ this.touch = true;
+ var events = [
+ "mousedown", "mouseup", "mousemove", "click", "dblclick",
+ "mouseout"
+ ];
+ for (var i=0, len=events.length; i.
*/
timerId: null,
-
- /**
- * Property: touch
- * {Boolean} When a touchstart event is fired, touch will be true and all
- * mouse related listeners will do nothing.
- */
- touch: false,
/**
* Property: down
@@ -155,10 +148,7 @@ OpenLayers.Handler.Click = OpenLayers.Class(OpenLayers.Handler, {
* {Boolean} Continue propagating this event.
*/
touchstart: function(evt) {
- if (!this.touch) {
- this.unregisterMouseListeners();
- this.touch = true;
- }
+ this.startTouch();
this.down = this.getEventInfo(evt);
this.last = this.getEventInfo(evt);
return true;
@@ -195,20 +185,6 @@ OpenLayers.Handler.Click = OpenLayers.Class(OpenLayers.Handler, {
}
return true;
},
-
- /**
- * Method: unregisterMouseListeners
- * In a touch environment, we don't want to handle mouse events.
- */
- unregisterMouseListeners: function() {
- this.map.events.un({
- mousedown: this.mousedown,
- mouseup: this.mouseup,
- click: this.click,
- dblclick: this.dblclick,
- scope: this
- });
- },
/**
* Method: mousedown
@@ -352,7 +328,7 @@ OpenLayers.Handler.Click = OpenLayers.Class(OpenLayers.Handler, {
// touch device, no dblclick event - this may be a double
if (this["double"]) {
// on Android don't let the browser zoom on the page
- OpenLayers.Event.stop(evt);
+ OpenLayers.Event.preventDefault(evt);
}
this.handleDouble(evt);
}
@@ -520,7 +496,6 @@ OpenLayers.Handler.Click = OpenLayers.Class(OpenLayers.Handler, {
this.down = null;
this.first = null;
this.last = null;
- this.touch = false;
deactivated = true;
}
return deactivated;
diff --git a/lib/OpenLayers/Handler/Drag.js b/lib/OpenLayers/Handler/Drag.js
index e3218d2181..8c3cb5587e 100644
--- a/lib/OpenLayers/Handler/Drag.js
+++ b/lib/OpenLayers/Handler/Drag.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
@@ -50,13 +50,6 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
*/
dragging: false,
- /**
- * Property: touch
- * {Boolean} When a touchstart event is fired, touch will be true and all
- * mouse related listeners will do nothing.
- */
- touch: false,
-
/**
* Property: last
* {} The last pixel location of the drag.
@@ -345,17 +338,7 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
* {Boolean} Let the event propagate.
*/
touchstart: function(evt) {
- if (!this.touch) {
- this.touch = true;
- // unregister mouse listeners
- this.map.events.un({
- mousedown: this.mousedown,
- mouseup: this.mouseup,
- mousemove: this.mousemove,
- click: this.click,
- scope: this
- });
- }
+ this.startTouch();
return this.dragstart(evt);
},
@@ -509,7 +492,6 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
deactivate: function() {
var deactivated = false;
if(OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
- this.touch = false;
this.started = false;
this.dragging = false;
this.start = null;
diff --git a/lib/OpenLayers/Handler/Feature.js b/lib/OpenLayers/Handler/Feature.js
index 373debb27c..d18b248dd1 100644
--- a/lib/OpenLayers/Handler/Feature.js
+++ b/lib/OpenLayers/Handler/Feature.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
@@ -59,13 +59,6 @@ OpenLayers.Handler.Feature = OpenLayers.Class(OpenLayers.Handler, {
* {} The location of the last mouseup.
*/
up: null,
-
- /**
- * Property: touch
- * {Boolean} When a touchstart event is fired, touch will be true and all
- * mouse related listeners will do nothing.
- */
- touch: false,
/**
* Property: clickTolerance
@@ -139,17 +132,7 @@ OpenLayers.Handler.Feature = OpenLayers.Class(OpenLayers.Handler, {
* {Boolean} Let the event propagate.
*/
touchstart: function(evt) {
- if(!this.touch) {
- this.touch = true;
- this.map.events.un({
- mousedown: this.mousedown,
- mouseup: this.mouseup,
- mousemove: this.mousemove,
- click: this.click,
- dblclick: this.dblclick,
- scope: this
- });
- }
+ this.startTouch();
return OpenLayers.Event.isMultiTouch(evt) ?
true : this.mousedown(evt);
},
@@ -351,6 +334,11 @@ OpenLayers.Handler.Feature = OpenLayers.Class(OpenLayers.Handler, {
if(dpx <= this.clickTolerance) {
this.callback(key, args);
}
+ // we're done with this set of events now: clear the cached
+ // positions so we can't trip over them later (this can occur
+ // if one of the up/down events gets eaten before it gets to us
+ // but we still get the click)
+ this.up = this.down = null;
} else {
this.callback(key, args);
}
@@ -393,7 +381,6 @@ OpenLayers.Handler.Feature = OpenLayers.Class(OpenLayers.Handler, {
this.lastFeature = null;
this.down = null;
this.up = null;
- this.touch = false;
this.map.events.un({
"removelayer": this.handleMapEvents,
"changelayer": this.handleMapEvents,
diff --git a/lib/OpenLayers/Handler/Hover.js b/lib/OpenLayers/Handler/Hover.js
index e0988ecab1..18b81f4145 100644
--- a/lib/OpenLayers/Handler/Hover.js
+++ b/lib/OpenLayers/Handler/Hover.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Handler/Keyboard.js b/lib/OpenLayers/Handler/Keyboard.js
index 2cbb4c1f1c..de7a464853 100644
--- a/lib/OpenLayers/Handler/Keyboard.js
+++ b/lib/OpenLayers/Handler/Keyboard.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Handler/MouseWheel.js b/lib/OpenLayers/Handler/MouseWheel.js
index ce73d08ef3..c69dff3480 100644
--- a/lib/OpenLayers/Handler/MouseWheel.js
+++ b/lib/OpenLayers/Handler/MouseWheel.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
@@ -31,6 +31,14 @@ OpenLayers.Handler.MouseWheel = OpenLayers.Class(OpenLayers.Handler, {
*/
interval: 0,
+ /**
+ * Property: maxDelta
+ * {Integer} Maximum delta to collect before breaking from the current
+ * interval. In cumulative mode, this also limits the maximum delta
+ * returned from the handler. Default is Number.POSITIVE_INFINITY.
+ */
+ maxDelta: Number.POSITIVE_INFINITY,
+
/**
* Property: delta
* {Integer} When interval is set, delta collects the mousewheel z-deltas
@@ -176,10 +184,10 @@ OpenLayers.Handler.MouseWheel = OpenLayers.Class(OpenLayers.Handler, {
// so force delta 1 / -1
delta = - (e.detail / Math.abs(e.detail));
}
- this.delta = this.delta + delta;
+ this.delta += delta;
- if(this.interval) {
- window.clearTimeout(this._timeoutId);
+ window.clearTimeout(this._timeoutId);
+ if(this.interval && Math.abs(this.delta) < this.maxDelta) {
// store e because window.event might change during delay
var evt = OpenLayers.Util.extend({}, e);
this._timeoutId = window.setTimeout(
@@ -211,9 +219,11 @@ OpenLayers.Handler.MouseWheel = OpenLayers.Class(OpenLayers.Handler, {
if (delta) {
e.xy = this.map.events.getMousePosition(e);
if (delta < 0) {
- this.callback("down", [e, this.cumulative ? delta : -1]);
+ this.callback("down",
+ [e, this.cumulative ? Math.max(-this.maxDelta, delta) : -1]);
} else {
- this.callback("up", [e, this.cumulative ? delta : 1]);
+ this.callback("up",
+ [e, this.cumulative ? Math.min(this.maxDelta, delta) : 1]);
}
}
},
diff --git a/lib/OpenLayers/Handler/Path.js b/lib/OpenLayers/Handler/Path.js
index 7bf254801e..28512a152e 100644
--- a/lib/OpenLayers/Handler/Path.js
+++ b/lib/OpenLayers/Handler/Path.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
@@ -271,6 +271,16 @@ OpenLayers.Handler.Path = OpenLayers.Class(OpenLayers.Handler.Point, {
var target = components[index];
var undone = geometry.removeComponent(target);
if (undone) {
+ // On touch devices, set the current ("mouse location") point to
+ // match the last digitized point.
+ if (this.touch && index > 0) {
+ components = geometry.components; // safety
+ var lastpt = components[index - 1];
+ var curptidx = this.getCurrentPointIndex();
+ var curpt = components[curptidx];
+ curpt.x = lastpt.x;
+ curpt.y = lastpt.y;
+ }
if (!this.redoStack) {
this.redoStack = [];
}
diff --git a/lib/OpenLayers/Handler/Point.js b/lib/OpenLayers/Handler/Point.js
index a32e02af1f..b4bb17c503 100644
--- a/lib/OpenLayers/Handler/Point.js
+++ b/lib/OpenLayers/Handler/Point.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
@@ -113,12 +113,6 @@ OpenLayers.Handler.Point = OpenLayers.Class(OpenLayers.Handler, {
*/
pixelTolerance: 5,
- /**
- * Property: touch
- * {Boolean} Indcates the support of touch events.
- */
- touch: false,
-
/**
* Property: lastTouchPx
* {} The last pixel used to know the distance between
@@ -216,7 +210,6 @@ OpenLayers.Handler.Point = OpenLayers.Class(OpenLayers.Handler, {
this.layer.destroy(false);
}
this.layer = null;
- this.touch = false;
return true;
},
@@ -383,18 +376,7 @@ OpenLayers.Handler.Point = OpenLayers.Class(OpenLayers.Handler, {
* {Boolean} Allow event propagation
*/
touchstart: function(evt) {
- if (!this.touch) {
- this.touch = true;
- // unregister mouse listeners
- this.map.events.un({
- mousedown: this.mousedown,
- mouseup: this.mouseup,
- mousemove: this.mousemove,
- click: this.click,
- dblclick: this.dblclick,
- scope: this
- });
- }
+ this.startTouch();
this.lastTouchPx = evt.xy;
return this.down(evt);
},
diff --git a/lib/OpenLayers/Handler/Polygon.js b/lib/OpenLayers/Handler/Polygon.js
index c9f8825ced..4f6dfd2888 100644
--- a/lib/OpenLayers/Handler/Polygon.js
+++ b/lib/OpenLayers/Handler/Polygon.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Handler/RegularPolygon.js b/lib/OpenLayers/Handler/RegularPolygon.js
index 556a57b020..bf4e2db973 100644
--- a/lib/OpenLayers/Handler/RegularPolygon.js
+++ b/lib/OpenLayers/Handler/RegularPolygon.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Icon.js b/lib/OpenLayers/Icon.js
index 65e93c99bb..2d8f967398 100644
--- a/lib/OpenLayers/Icon.js
+++ b/lib/OpenLayers/Icon.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Kinetic.js b/lib/OpenLayers/Kinetic.js
index 46b54d7cf1..1cd7886403 100644
--- a/lib/OpenLayers/Kinetic.js
+++ b/lib/OpenLayers/Kinetic.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Lang.js b/lib/OpenLayers/Lang.js
index bc2d9f9c0f..068562d341 100644
--- a/lib/OpenLayers/Lang.js
+++ b/lib/OpenLayers/Lang.js
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license. */
diff --git a/lib/OpenLayers/Lang/pt-BR.js b/lib/OpenLayers/Lang/pt-BR.js
index e7e75110eb..60e6779c81 100644
--- a/lib/OpenLayers/Lang/pt-BR.js
+++ b/lib/OpenLayers/Lang/pt-BR.js
@@ -13,7 +13,7 @@
* . Entry bodies are normal strings or
* strings formatted for use with calls.
*/
-OpenLayers.Lang["pt-br"] = OpenLayers.Util.applyDefaults({
+OpenLayers.Lang["pt-BR"] = OpenLayers.Util.applyDefaults({
'unhandledRequest': "A requisição retornou um erro não tratado: ${statusText}",
diff --git a/lib/OpenLayers/Lang/ro.js b/lib/OpenLayers/Lang/ro.js
new file mode 100644
index 0000000000..6e8a04f003
--- /dev/null
+++ b/lib/OpenLayers/Lang/ro.js
@@ -0,0 +1,69 @@
+/**
+ * @requires OpenLayers/Lang.js
+ */
+/**
+ * Namespace: OpenLayers.Lang["ro"]
+ * Dictionary for Romanian. Keys for entries are used in calls to
+ * . Entry bodies are normal strings or
+ * strings formatted for use with calls.
+*/
+OpenLayers.Lang.ro = {
+ 'unhandledRequest': "Cerere nesoluționată return ${statusText}",
+ 'Permalink': "Legatură permanentă",
+ 'Overlays': "Straturi vector",
+ 'Base Layer': "Straturi de bază",
+ 'noFID': "Nu pot actualiza un feature pentru care nu există FID.",
+ 'browserNotSupported':
+ "Browserul tău nu suportă afișarea vectorilor. Supoetul curent pentru randare:\n${renderers}",
+ // console message
+ 'minZoomLevelError':
+ "Proprietatea minZoomLevel este doar pentru a fi folosită " +
+ "cu straturile FixedZoomLevels-descendent. De aceea acest " +
+ "strat wfs verifică dacă minZoomLevel este o relicvă" +
+ ". Nu îl putem , oricum, înlătura fără " +
+ "a afecta aplicațiile Openlayers care depind de ea." +
+ " De aceea considerăm depreciat -- minZoomLevel " +
+ "și îl vom înlătura în 3.0. Folosește " +
+ "min/max resolution cum este descrisă aici: " +
+ "http://trac.openlayers.org/wiki/SettingZoomLevels",
+ 'commitSuccess': "Tranzacție WFS: SUCCES ${response}",
+ 'commitFailed': "Tranzacție WFS : EȘEC ${response}",
+ 'googleWarning':
+ "Stratul Google nu a putut fi încărcat corect.