diff --git a/examples/kml-layer-linestring.html b/examples/kml-layer-linestring.html
deleted file mode 100644
index 8b55185338..0000000000
--- a/examples/kml-layer-linestring.html
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/kml-layer.html b/examples/kml-layer.html
index 2e91865a6b..da99f9c184 100644
--- a/examples/kml-layer.html
+++ b/examples/kml-layer.html
@@ -19,8 +19,8 @@
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
map.addLayer(layer);
- map.addLayer(new OpenLayers.Layer.GML("KML", "kml/mc-search.kml", {format: OpenLayers.Format.KML}));
- map.zoomToMaxExtent();
+ map.addLayer(new OpenLayers.Layer.GML("KML", "kml/lines.kml", {format: OpenLayers.Format.KML}));
+ map.zoomToExtent(new OpenLayers.Bounds(-112.306698,36.017792,-112.03204,36.18087));
}
diff --git a/lib/OpenLayers/Control/MousePosition.js b/lib/OpenLayers/Control/MousePosition.js
index d7e310f0ec..e51fa2da1d 100644
--- a/lib/OpenLayers/Control/MousePosition.js
+++ b/lib/OpenLayers/Control/MousePosition.js
@@ -61,6 +61,16 @@ OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, {
OpenLayers.Control.prototype.initialize.apply(this, arguments);
},
+ /**
+ * Method: destroy
+ */
+ destroy: function() {
+ if (this.map) {
+ this.map.events.unregister('mousemove', this, this.redraw);
+ }
+ OpenLayers.Control.prototype.destroy.apply(this, arguments);
+ },
+
/**
* Method: draw
* {DOMElement}
diff --git a/lib/OpenLayers/Format/GML.js b/lib/OpenLayers/Format/GML.js
index 033536120e..efe1f9ef31 100644
--- a/lib/OpenLayers/Format/GML.js
+++ b/lib/OpenLayers/Format/GML.js
@@ -295,7 +295,7 @@ OpenLayers.Format.GML = OpenLayers.Class(OpenLayers.Format.XML, {
// look for
nodeList = this.getElementsByTagNameNS(node, this.gmlns, "posList");
if(nodeList.length > 0) {
- coordString = nodeList[0].firstChild.nodeValue;
+ coordString = this.concatChildValues(nodeList[0]);
coordString = coordString.replace(this.regExes.trimSpace, "");
coords = coordString.split(this.regExes.splitSpace);
var dim = parseInt(nodeList[0].getAttribute("dimension"));
@@ -314,7 +314,7 @@ OpenLayers.Format.GML = OpenLayers.Class(OpenLayers.Format.XML, {
nodeList = this.getElementsByTagNameNS(node, this.gmlns,
"coordinates");
if(nodeList.length > 0) {
- coordString = nodeList[0].firstChild.nodeValue;
+ coordString = this.concatChildValues(nodeList[0]);
coordString = coordString.replace(this.regExes.trimSpace,
"");
coordString = coordString.replace(this.regExes.trimComma,
@@ -453,7 +453,8 @@ OpenLayers.Format.GML = OpenLayers.Class(OpenLayers.Format.XML, {
grandchildren = child.childNodes;
if(grandchildren.length == 1) {
grandchild = grandchildren[0];
- if(grandchild.nodeType == 3) {
+ if(grandchild.nodeType == 3 ||
+ grandchild.nodeType == 4) {
name = (child.prefix) ?
child.nodeName.split(":")[1] :
child.nodeName;
diff --git a/lib/OpenLayers/Format/KML.js b/lib/OpenLayers/Format/KML.js
index 3dd4db14b5..2f64c23b3b 100644
--- a/lib/OpenLayers/Format/KML.js
+++ b/lib/OpenLayers/Format/KML.js
@@ -326,7 +326,7 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
grandchildren = child.childNodes;
if(grandchildren.length == 1) {
grandchild = grandchildren[0];
- if(grandchild.nodeType == 3) {
+ if(grandchild.nodeType == 3 || grandchild.nodeType == 4) {
name = (child.prefix) ?
child.nodeName.split(":")[1] :
child.nodeName;
@@ -638,4 +638,4 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
},
CLASS_NAME: "OpenLayers.Format.KML"
-});
\ No newline at end of file
+});
diff --git a/lib/OpenLayers/Format/XML.js b/lib/OpenLayers/Format/XML.js
index 44920e06a8..15afffa1a5 100644
--- a/lib/OpenLayers/Format/XML.js
+++ b/lib/OpenLayers/Format/XML.js
@@ -256,6 +256,62 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, {
}
return attributeValue;
},
+
+ /**
+ * APIMethod: getChildValue
+ * Get the value of the first child node if it exists, or return an
+ * optional default string. Returns an empty string if no first child
+ * exists and no default value is supplied.
+ *
+ * Parameters:
+ * node - {DOMElement} The element used to look for a first child value.
+ * def - {String} Optional string to return in the event that no
+ * first child value exists.
+ *
+ * Returns:
+ * {String} The value of the first child of the given node.
+ */
+ getChildValue: function(node, def) {
+ var value;
+ try {
+ value = node.firstChild.nodeValue;
+ } catch(e) {
+ value = (def != undefined) ? def : "";
+ }
+ return value;
+ },
+
+ /**
+ * APIMethod: concatChildValues
+ * Concatenate the value of all child nodes if any exist, or return an
+ * optional default string. Returns an empty string if no children
+ * exist and no default value is supplied. Not optimized for large
+ * numbers of child nodes.
+ *
+ * Parameters:
+ * node - {DOMElement} The element used to look for child values.
+ * def - {String} Optional string to return in the event that no
+ * child exist.
+ *
+ * Returns:
+ * {String} The concatenated value of all child nodes of the given node.
+ */
+ concatChildValues: function(node, def) {
+ var value = "";
+ var child = node.firstChild;
+ var childValue;
+ while(child) {
+ childValue = child.nodeValue;
+ if(childValue) {
+ value += childValue;
+ }
+ child = child.nextSibling;
+ }
+ if(value == "" && def != undefined) {
+ value = def;
+ }
+ return value;
+ },
/**
* APIMethod: hasAttributeNS
diff --git a/lib/OpenLayers/Handler/Drag.js b/lib/OpenLayers/Handler/Drag.js
index 0a49ed911e..4dc74911a6 100644
--- a/lib/OpenLayers/Handler/Drag.js
+++ b/lib/OpenLayers/Handler/Drag.js
@@ -143,9 +143,10 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
* {Boolean} Let the event propagate.
*/
mousedown: function (evt) {
+ var propagate = true;
+ this.dragging = false;
if (this.checkModifiers(evt) && OpenLayers.Event.isLeftClick(evt)) {
this.started = true;
- this.dragging = false;
this.start = evt.xy;
this.last = evt.xy;
// TBD replace with CSS classes
@@ -159,9 +160,13 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
document.onselectstart = function() {return false;}
}
- return false;
+ propagate = false;
+ } else {
+ this.started = false;
+ this.start = null;
+ this.last = null;
}
- return true;
+ return propagate;
},
/**
diff --git a/tests/Control/test_MousePosition.html b/tests/Control/test_MousePosition.html
new file mode 100644
index 0000000000..20b470914e
--- /dev/null
+++ b/tests/Control/test_MousePosition.html
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
diff --git a/tests/Format/test_GML.html b/tests/Format/test_GML.html
index f142d01e96..601e9c7dc7 100644
--- a/tests/Format/test_GML.html
+++ b/tests/Format/test_GML.html
@@ -147,13 +147,14 @@
t.eq(data[0].geometry.components.length, 2, "rings length correct");
}
function test_Format_GML_read_attributes(t) {
- t.plan(1);
+ t.plan(2);
var parser = new OpenLayers.Format.GML();
data = parser.read(test_content[0]);
t.eq(data[0].attributes['NAME'], "WY", "Simple Attribute data is read correctly.");
+ t.eq(data[0].attributes['LONGNAME'], "Wyoming", "Attribute data is read from CDATA node correctly.");
}
- var test_content = ['\n\n \n \n -1254041.389711702250906.9515983529\n -634517.1199908922762236.2940800377\n \n \n \n \n -634517.11999089224,691849.77929356066,0 -653761.64509297756,471181.53429472551,0 -673343.60852865304,250906.9515983529,0 -1088825.734430399,299284.85108220269,0 -1254041.3897117018,324729.27754874947,0 -1235750.4212498858,434167.33911316615,0 -1190777.7803201093,704392.96327195223,0 -1181607.835811228,762236.29408003774,0 -634517.11999089224,691849.77929356066,0\n WY\n \n \n\n',
+ var test_content = ['\n\n \n \n -1254041.389711702250906.9515983529\n -634517.1199908922762236.2940800377\n \n \n \n \n -634517.11999089224,691849.77929356066,0 -653761.64509297756,471181.53429472551,0 -673343.60852865304,250906.9515983529,0 -1088825.734430399,299284.85108220269,0 -1254041.3897117018,324729.27754874947,0 -1235750.4212498858,434167.33911316615,0 -1190777.7803201093,704392.96327195223,0 -1181607.835811228,762236.29408003774,0 -634517.11999089224,691849.77929356066,0\n WY\n \n \n \n\n',
'Control/test_OverviewMap.html
Control/test_NavToolbar.html
Control/test_MouseToolbar.html
+ Control/test_MousePosition.html
Control/test_LayerSwitcher.html
Control/test_Panel.html
Control/test_PanZoom.html