[OpenLayers-Commits] r12101 - in sandbox/tschaub/editing: . lib/OpenLayers lib/OpenLayers/Control lib/OpenLayers/Format lib/OpenLayers/Format/CSWGetDomain lib/OpenLayers/Format/CSWGetRecords lib/OpenLayers/Format/GML lib/OpenLayers/Format/OWSContext lib/OpenLayers/Format/SLD lib/OpenLayers/Format/WMC lib/OpenLayers/Format/WMSCapabilities lib/OpenLayers/Format/XLS lib/OpenLayers/Geometry lib/OpenLayers/Layer lib/OpenLayers/Protocol lib/OpenLayers/Protocol/SQL lib/OpenLayers/Renderer lib/OpenLayers/Tile tests tests/Format

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Fri Jun 17 14:36:56 EDT 2011


Author: tschaub
Date: 2011-06-17 11:36:55 -0700 (Fri, 17 Jun 2011)
New Revision: 12101

Modified:
   sandbox/tschaub/editing/
   sandbox/tschaub/editing/lib/OpenLayers/Control/GetFeature.js
   sandbox/tschaub/editing/lib/OpenLayers/Control/ModifyFeature.js
   sandbox/tschaub/editing/lib/OpenLayers/Control/Panel.js
   sandbox/tschaub/editing/lib/OpenLayers/Control/SelectFeature.js
   sandbox/tschaub/editing/lib/OpenLayers/Control/WMSGetFeatureInfo.js
   sandbox/tschaub/editing/lib/OpenLayers/Control/WMTSGetFeatureInfo.js
   sandbox/tschaub/editing/lib/OpenLayers/Format/ArcXML.js
   sandbox/tschaub/editing/lib/OpenLayers/Format/Atom.js
   sandbox/tschaub/editing/lib/OpenLayers/Format/CSWGetDomain/v2_0_2.js
   sandbox/tschaub/editing/lib/OpenLayers/Format/CSWGetRecords/v2_0_2.js
   sandbox/tschaub/editing/lib/OpenLayers/Format/GML.js
   sandbox/tschaub/editing/lib/OpenLayers/Format/GML/Base.js
   sandbox/tschaub/editing/lib/OpenLayers/Format/GML/v2.js
   sandbox/tschaub/editing/lib/OpenLayers/Format/GML/v3.js
   sandbox/tschaub/editing/lib/OpenLayers/Format/GeoJSON.js
   sandbox/tschaub/editing/lib/OpenLayers/Format/GeoRSS.js
   sandbox/tschaub/editing/lib/OpenLayers/Format/KML.js
   sandbox/tschaub/editing/lib/OpenLayers/Format/OSM.js
   sandbox/tschaub/editing/lib/OpenLayers/Format/OWSContext/v0_3_1.js
   sandbox/tschaub/editing/lib/OpenLayers/Format/SLD/v1.js
   sandbox/tschaub/editing/lib/OpenLayers/Format/WKT.js
   sandbox/tschaub/editing/lib/OpenLayers/Format/WMC.js
   sandbox/tschaub/editing/lib/OpenLayers/Format/WMC/v1.js
   sandbox/tschaub/editing/lib/OpenLayers/Format/WMSCapabilities/v1.js
   sandbox/tschaub/editing/lib/OpenLayers/Format/XLS/v1.js
   sandbox/tschaub/editing/lib/OpenLayers/Geometry.js
   sandbox/tschaub/editing/lib/OpenLayers/Geometry/Collection.js
   sandbox/tschaub/editing/lib/OpenLayers/Layer/ArcGISCache.js
   sandbox/tschaub/editing/lib/OpenLayers/Layer/HTTPRequest.js
   sandbox/tschaub/editing/lib/OpenLayers/Layer/KaMapCache.js
   sandbox/tschaub/editing/lib/OpenLayers/Layer/MapServer.js
   sandbox/tschaub/editing/lib/OpenLayers/Layer/TMS.js
   sandbox/tschaub/editing/lib/OpenLayers/Layer/TileCache.js
   sandbox/tschaub/editing/lib/OpenLayers/Layer/Vector.js
   sandbox/tschaub/editing/lib/OpenLayers/Layer/WMTS.js
   sandbox/tschaub/editing/lib/OpenLayers/Layer/XYZ.js
   sandbox/tschaub/editing/lib/OpenLayers/Layer/Zoomify.js
   sandbox/tschaub/editing/lib/OpenLayers/Protocol/SQL/Gears.js
   sandbox/tschaub/editing/lib/OpenLayers/Protocol/WFS.js
   sandbox/tschaub/editing/lib/OpenLayers/Renderer.js
   sandbox/tschaub/editing/lib/OpenLayers/Renderer/Canvas.js
   sandbox/tschaub/editing/lib/OpenLayers/Tile/Image.js
   sandbox/tschaub/editing/lib/OpenLayers/Util.js
   sandbox/tschaub/editing/tests/Format/WKT.html
   sandbox/tschaub/editing/tests/Util.html
Log:
Merge -r12089:12100 from trunk.


Property changes on: sandbox/tschaub/editing
___________________________________________________________________
Modified: svn:mergeinfo
   - /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11940-12088
   + /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11940-12100

Modified: sandbox/tschaub/editing/lib/OpenLayers/Control/GetFeature.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Control/GetFeature.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Control/GetFeature.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -478,7 +478,7 @@
         if(!this.modifiers.multiple && !this.modifiers.toggle) {
             this.unselectAll();
         }
-        if(!(features instanceof Array)) {
+        if(!(OpenLayers.Util.isArray(features))) {
             features = [features];
         }
         

Modified: sandbox/tschaub/editing/lib/OpenLayers/Control/ModifyFeature.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Control/ModifyFeature.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Control/ModifyFeature.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -215,7 +215,7 @@
         this.deleteCodes = [46, 68];
         this.mode = OpenLayers.Control.ModifyFeature.RESHAPE;
         OpenLayers.Control.prototype.initialize.apply(this, [options]);
-        if(!(this.deleteCodes instanceof Array)) {
+        if(!(OpenLayers.Util.isArray(this.deleteCodes))) {
             this.deleteCodes = [this.deleteCodes];
         }
         var control = this;

Modified: sandbox/tschaub/editing/lib/OpenLayers/Control/Panel.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Control/Panel.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Control/Panel.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -232,7 +232,7 @@
      * controls - {<OpenLayers.Control>} Controls to add in the panel.
      */    
     addControls: function(controls) {
-        if (!(controls instanceof Array)) {
+        if (!(OpenLayers.Util.isArray(controls))) {
             controls = [controls];
         }
         this.controls = this.controls.concat(controls);

Modified: sandbox/tschaub/editing/lib/OpenLayers/Control/SelectFeature.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Control/SelectFeature.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Control/SelectFeature.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -218,7 +218,7 @@
      * layers - {<OpenLayers.Layer.Vector>}, or an array of vector layers.
      */
     initLayer: function(layers) {
-        if(layers instanceof Array) {
+        if(OpenLayers.Util.isArray(layers)) {
             this.layers = layers;
             this.layer = new OpenLayers.Layer.Vector.RootContainer(
                 this.id + "_container", {

Modified: sandbox/tschaub/editing/lib/OpenLayers/Control/WMSGetFeatureInfo.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Control/WMSGetFeatureInfo.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Control/WMSGetFeatureInfo.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -300,7 +300,7 @@
             layer = candidates[i];
             if(layer instanceof OpenLayers.Layer.WMS &&
                (!this.queryVisible || layer.getVisibility())) {
-                url = layer.url instanceof Array ? layer.url[0] : layer.url;
+                url = OpenLayers.Util.isArray(layer.url) ? layer.url[0] : layer.url;
                 // if the control was not configured with a url, set it
                 // to the first layer url
                 if(this.drillDown === false && !this.url) {
@@ -421,7 +421,7 @@
         if (layer.params.STYLES) {
             styleNames = layer.params.STYLES;
         } else {
-            if (layer.params.LAYERS instanceof Array) {
+            if (OpenLayers.Util.isArray(layer.params.LAYERS)) {
                 styleNames = new Array(layer.params.LAYERS.length);
             } else { // Assume it's a String
                 styleNames = layer.params.LAYERS.replace(/[^,]/g, "");
@@ -469,7 +469,7 @@
             for(var i=0, len=layers.length; i<len; i++) {
                 var layer = layers[i];
                 var service, found = false;
-                url = layer.url instanceof Array ? layer.url[0] : layer.url;
+                url = OpenLayers.Util.isArray(layer.url) ? layer.url[0] : layer.url;
                 if(url in services) {
                     services[url].push(layer);
                 } else {

Modified: sandbox/tschaub/editing/lib/OpenLayers/Control/WMTSGetFeatureInfo.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Control/WMTSGetFeatureInfo.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Control/WMTSGetFeatureInfo.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -299,7 +299,7 @@
         });
         OpenLayers.Util.applyDefaults(params, this.vendorParams);
         return {
-            url: layer.url instanceof Array ? layer.url[0] : layer.url,
+            url: OpenLayers.Util.isArray(layer.url) ? layer.url[0] : layer.url,
             params: OpenLayers.Util.upperCaseObject(params),
             callback: function(request) {
                 this.handleResponse(xy, request, layer);

Modified: sandbox/tschaub/editing/lib/OpenLayers/Format/ArcXML.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Format/ArcXML.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Format/ArcXML.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -496,7 +496,7 @@
     
     
     addRenderer: function(topRelem, renderer) {
-        if (renderer instanceof Array) {
+        if (OpenLayers.Util.isArray(renderer)) {
             this.addGroupRenderer(topRelem, renderer);
         } else {
             var renderElem = this.createElementNS("", renderer.type.toUpperCase() + "RENDERER");

Modified: sandbox/tschaub/editing/lib/OpenLayers/Format/Atom.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Format/Atom.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Format/Atom.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -99,7 +99,7 @@
      */
     write: function(features) {
         var doc;
-        if (features instanceof Array) {
+        if (OpenLayers.Util.isArray(features)) {
             doc = this.createElementNSPlus("atom:feed");
             doc.appendChild(
                 this.createElementNSPlus("atom:title", {
@@ -183,7 +183,7 @@
         
         // atom:author
         if (atomAttrib.authors) {
-            var authors = atomAttrib.authors instanceof Array ?
+            var authors = OpenLayers.Util.isArray(atomAttrib.authors) ?
                 atomAttrib.authors : [atomAttrib.authors];
             for (var i=0, ii=authors.length; i<ii; i++) {
                 entryNode.appendChild(
@@ -196,7 +196,7 @@
         
         // atom:category
         if (atomAttrib.categories) {
-            var categories = atomAttrib.categories instanceof Array ?
+            var categories = OpenLayers.Util.isArray(atomAttrib.categories) ?
                 atomAttrib.categories : [atomAttrib.categories];
             var category;
             for (var i=0, ii=categories.length; i<ii; i++) {
@@ -220,7 +220,7 @@
         
         // atom:contributor
         if (atomAttrib.contributors) {
-            var contributors = atomAttrib.contributors instanceof Array ?
+            var contributors = OpenLayers.Util.isArray(atomAttrib.contributors) ?
                 atomAttrib.contributors : [atomAttrib.contributors];
             for (var i=0, ii=contributors.length; i<ii; i++) {
                 entryNode.appendChild(
@@ -243,7 +243,7 @@
         
         // atom:link
         if (atomAttrib.links) {
-            var links = atomAttrib.links instanceof Array ?
+            var links = OpenLayers.Util.isArray(atomAttrib.links) ?
                 atomAttrib.links : [atomAttrib.links];
             var link;
             for (var i=0, ii=links.length; i<ii; i++) {

Modified: sandbox/tschaub/editing/lib/OpenLayers/Format/CSWGetDomain/v2_0_2.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Format/CSWGetDomain/v2_0_2.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Format/CSWGetDomain/v2_0_2.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -108,7 +108,7 @@
                 this.readChildNodes(node, obj);
             },
             "DomainValues": function(node, obj) {
-                if (!(obj.DomainValues instanceof Array)) {
+                if (!(OpenLayers.Util.isArray(obj.DomainValues))) {
                     obj.DomainValues = [];
                 }
                 var attrs = node.attributes;
@@ -126,7 +126,7 @@
                 obj.ParameterName = this.getChildValue(node);
             },
             "ListOfValues": function(node, obj) {
-                if (!(obj.ListOfValues instanceof Array)) {
+                if (!(OpenLayers.Util.isArray(obj.ListOfValues))) {
                     obj.ListOfValues = [];
                 }
                 this.readChildNodes(node, obj.ListOfValues);

Modified: sandbox/tschaub/editing/lib/OpenLayers/Format/CSWGetRecords/v2_0_2.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Format/CSWGetRecords/v2_0_2.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Format/CSWGetRecords/v2_0_2.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -253,7 +253,7 @@
             // rightsHolder, source, subject, title, type, URI
             "*": function(node, obj) {
                 var name = node.localName || node.nodeName.split(":").pop();
-                if (!(obj[name] instanceof Array)) {
+                if (!(OpenLayers.Util.isArray(obj[name]))) {
                     obj[name] = new Array();
                 }
                 var dc_element = {};
@@ -269,7 +269,7 @@
             // abstract, modified, spatial
             "*": function(node, obj) {
                 var name = node.localName || node.nodeName.split(":").pop();
-                if (!(obj[name] instanceof Array)) {
+                if (!(OpenLayers.Util.isArray(obj[name]))) {
                     obj[name] = new Array();
                 }
                 obj[name].push(this.getChildValue(node));
@@ -342,7 +342,7 @@
                     );
                 }
                 var ResponseHandler = options.ResponseHandler || this.ResponseHandler;
-                if (ResponseHandler instanceof Array && ResponseHandler.length > 0) {
+                if (OpenLayers.Util.isArray(ResponseHandler) && ResponseHandler.length > 0) {
                     // ResponseHandler must be a non-empty array
                     for(var i=0, len=ResponseHandler.length; i<len; i++) {
                         this.writeNode(
@@ -379,7 +379,7 @@
                     }
                 });
                 var ElementName = options.ElementName;
-                if (ElementName instanceof Array && ElementName.length > 0) {
+                if (OpenLayers.Util.isArray(ElementName) && ElementName.length > 0) {
                     // ElementName must be a non-empty array
                     for(var i=0, len=ElementName.length; i<len; i++) {
                         this.writeNode(

Modified: sandbox/tschaub/editing/lib/OpenLayers/Format/GML/Base.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Format/GML/Base.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Format/GML/Base.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -419,7 +419,7 @@
      */
     write: function(features) {
         var name;
-        if(features instanceof Array) {
+        if(OpenLayers.Util.isArray(features)) {
             name = "featureMembers";
         } else {
             name = "featureMember";

Modified: sandbox/tschaub/editing/lib/OpenLayers/Format/GML/v2.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Format/GML/v2.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Format/GML/v2.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -90,7 +90,7 @@
      */
     write: function(features) {
         var name;
-        if(features instanceof Array) {
+        if(OpenLayers.Util.isArray(features)) {
             // GML2 only has abstract feature collections
             // wfs provides a feature collection from a well-known schema
             name = "wfs:FeatureCollection";

Modified: sandbox/tschaub/editing/lib/OpenLayers/Format/GML/v3.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Format/GML/v3.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Format/GML/v3.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -250,7 +250,7 @@
      */
     write: function(features) {
         var name;
-        if(features instanceof Array) {
+        if(OpenLayers.Util.isArray(features)) {
             name = "featureMembers";
         } else {
             name = "featureMember";

Modified: sandbox/tschaub/editing/lib/OpenLayers/Format/GML.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Format/GML.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Format/GML.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -639,7 +639,7 @@
      * {String} A string representing the GML document.
      */
     write: function(features) {
-        if(!(features instanceof Array)) {
+        if(!(OpenLayers.Util.isArray(features))) {
             features = [features];
         }
         var gml = this.createElementNS("http://www.opengis.net/wfs",

Modified: sandbox/tschaub/editing/lib/OpenLayers/Format/GeoJSON.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Format/GeoJSON.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Format/GeoJSON.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -219,7 +219,7 @@
         }
         var geometry, collection = false;
         if(obj.type == "GeometryCollection") {
-            if(!(obj.geometries instanceof Array)) {
+            if(!(OpenLayers.Util.isArray(obj.geometries))) {
                 throw "GeometryCollection must have geometries array: " + obj;
             }
             var numGeom = obj.geometries.length;
@@ -232,7 +232,7 @@
             geometry = new OpenLayers.Geometry.Collection(components);
             collection = true;
         } else {
-            if(!(obj.coordinates instanceof Array)) {
+            if(!(OpenLayers.Util.isArray(obj.coordinates))) {
                 throw "Geometry must have coordinates array: " + obj;
             }
             if(!this.parseCoords[obj.type.toLowerCase()]) {
@@ -450,7 +450,7 @@
         var geojson = {
             "type": null
         };
-        if(obj instanceof Array) {
+        if(OpenLayers.Util.isArray(obj)) {
             geojson.type = "FeatureCollection";
             var numFeatures = obj.length;
             geojson.features = new Array(numFeatures);

Modified: sandbox/tschaub/editing/lib/OpenLayers/Format/GeoRSS.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Format/GeoRSS.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Format/GeoRSS.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -297,7 +297,7 @@
      */
     write: function(features) {
         var georss;
-        if(features instanceof Array) {
+        if(OpenLayers.Util.isArray(features)) {
             georss = this.createElementNS(this.rssns, "rss");
             for(var i=0, len=features.length; i<len; i++) {
                 georss.appendChild(this.createFeatureXML(features[i]));

Modified: sandbox/tschaub/editing/lib/OpenLayers/Format/KML.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Format/KML.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Format/KML.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -1131,7 +1131,7 @@
      * {String} A KML string.
      */
     write: function(features) {
-        if(!(features instanceof Array)) {
+        if(!(OpenLayers.Util.isArray(features))) {
             features = [features];
         }
         var kml = this.createElementNS(this.kmlns, "kml");

Modified: sandbox/tschaub/editing/lib/OpenLayers/Format/OSM.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Format/OSM.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Format/OSM.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -291,7 +291,7 @@
      * features - {Array(<OpenLayers.Feature.Vector>)}
      */
     write: function(features) { 
-        if (!(features instanceof Array)) {
+        if (!(OpenLayers.Util.isArray(features))) {
             features = [features];
         }
         

Modified: sandbox/tschaub/editing/lib/OpenLayers/Format/OWSContext/v0_3_1.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Format/OWSContext/v0_3_1.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Format/OWSContext/v0_3_1.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -178,7 +178,7 @@
      */
     decomposeNestingPath: function(nPath){
         var a = [];
-        if (nPath instanceof Array) {
+        if (OpenLayers.Util.isArray(nPath)) {
             var path = nPath.slice();
             while (path.length > 0) {
                 a.push(path.slice());

Modified: sandbox/tschaub/editing/lib/OpenLayers/Format/SLD/v1.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Format/SLD/v1.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Format/SLD/v1.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -147,7 +147,7 @@
                 for(var i=0, len=layer.userStyles.length; i<len; ++i) {
                     layer.userStyles[i].layerName = layer.name;
                 }
-                if(sld.namedLayers instanceof Array) {
+                if(OpenLayers.Util.isArray(sld.namedLayers)) {
                     sld.namedLayers.push(layer);                
                 } else {
                     sld.namedLayers[layer.name] = layer;
@@ -558,7 +558,7 @@
                 }
                 // add in named layers
                 // allow namedLayers to be an array
-                if(sld.namedLayers instanceof Array) {
+                if(OpenLayers.Util.isArray(sld.namedLayers)) {
                     for(var i=0, len=sld.namedLayers.length; i<len; ++i) {
                         this.writeNode("NamedLayer", sld.namedLayers[i], root);
                     }

Modified: sandbox/tschaub/editing/lib/OpenLayers/Format/WKT.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Format/WKT.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Format/WKT.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -56,6 +56,7 @@
      */
     read: function(wkt) {
         var features, type, str;
+        wkt = wkt.replace(/[\n\r]/g, " ");
         var matches = this.regExes.typeStr.exec(wkt);
         if(matches) {
             type = matches[1].toLowerCase();

Modified: sandbox/tschaub/editing/lib/OpenLayers/Format/WMC/v1.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Format/WMC/v1.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Format/WMC/v1.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -1154,7 +1154,7 @@
         var node = this.createElementDefaultNS("StyleList");
 
         var styles = layer.styles;
-        if (styles && styles instanceof Array) {
+        if (styles && OpenLayers.Util.isArray(styles)) {
             var sld;
             for (var i=0, len=styles.length; i<len; i++) {
                 var s = styles[i];

Modified: sandbox/tschaub/editing/lib/OpenLayers/Format/WMC.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Format/WMC.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Format/WMC.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -191,7 +191,7 @@
         }
 
         // let's convert layers into layersContext object (if any)
-        if (layers != undefined && layers instanceof Array) {
+        if (layers != undefined && OpenLayers.Util.isArray(layers)) {
             for (var i=0, len=layers.length; i<len; i++) {
                 var layer = layers[i];
                 if (layer instanceof OpenLayers.Layer.WMS) {

Modified: sandbox/tschaub/editing/lib/OpenLayers/Format/WMSCapabilities/v1.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Format/WMSCapabilities/v1.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Format/WMSCapabilities/v1.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -296,7 +296,7 @@
                 this.readChildNodes(node, obj.getcapabilities);
             },
             "Format": function(node, obj) {
-                if (obj.formats instanceof Array) {
+                if (OpenLayers.Util.isArray(obj.formats)) {
                     obj.formats.push(this.getChildValue(node));
                 } else {
                     obj.format = this.getChildValue(node);

Modified: sandbox/tschaub/editing/lib/OpenLayers/Format/XLS/v1.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Format/XLS/v1.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Format/XLS/v1.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -258,7 +258,7 @@
                     this.writeNode(node, "Building", address.building);
                 }
                 var street = address.street;
-                if (!(street instanceof Array)) {
+                if (!(OpenLayers.Util.isArray(street))) {
                     street = [street];
                 }
                 for (var i=0, len=street.length; i < len; i++) {

Modified: sandbox/tschaub/editing/lib/OpenLayers/Geometry/Collection.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Geometry/Collection.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Geometry/Collection.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -131,7 +131,7 @@
      * components - {Array(<OpenLayers.Geometry>)} An array of geometries to add
      */
     addComponents: function(components){
-        if(!(components instanceof Array)) {
+        if(!(OpenLayers.Util.isArray(components))) {
             components = [components];
         }
         for(var i=0, len=components.length; i<len; i++) {
@@ -190,7 +190,7 @@
     removeComponents: function(components) {
         var removed = false;
 
-        if(!(components instanceof Array)) {
+        if(!(OpenLayers.Util.isArray(components))) {
             components = [components];
         }
         for(var i=components.length-1; i>=0; --i) {
@@ -478,7 +478,7 @@
         if(!geometry || !geometry.CLASS_NAME ||
            (this.CLASS_NAME != geometry.CLASS_NAME)) {
             equivalent = false;
-        } else if(!(geometry.components instanceof Array) ||
+        } else if(!(OpenLayers.Util.isArray(geometry.components)) ||
                   (geometry.components.length != this.components.length)) {
             equivalent = false;
         } else {

Modified: sandbox/tschaub/editing/lib/OpenLayers/Geometry.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Geometry.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Geometry.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -274,7 +274,7 @@
     var result = format.read(wkt);
     if(result instanceof OpenLayers.Feature.Vector) {
         geom = result.geometry;
-    } else if(result instanceof Array) {
+    } else if(OpenLayers.Util.isArray(result)) {
         var len = result.length;
         var components = new Array(len);
         for(var i=0; i<len; ++i) {

Modified: sandbox/tschaub/editing/lib/OpenLayers/Layer/ArcGISCache.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Layer/ArcGISCache.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Layer/ArcGISCache.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -430,7 +430,7 @@
         var url = this.url;
         var s = '' + x + y + z;
 
-        if (url instanceof Array) {
+        if (OpenLayers.Util.isArray(url)) {
             url = this.selectUrl(s, url);
         }
 

Modified: sandbox/tschaub/editing/lib/OpenLayers/Layer/HTTPRequest.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Layer/HTTPRequest.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Layer/HTTPRequest.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -209,7 +209,7 @@
         // in which case we will deterministically select one of them in 
         // order to evenly distribute requests to different urls.
         //
-        if (url instanceof Array) {
+        if (OpenLayers.Util.isArray(url)) {
             url = this.selectUrl(paramsString, url);
         }   
  

Modified: sandbox/tschaub/editing/lib/OpenLayers/Layer/KaMapCache.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Layer/KaMapCache.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Layer/KaMapCache.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -117,7 +117,7 @@
         // order to evenly distribute requests to different urls.
         //
         var url = this.url;
-        if (url instanceof Array) {
+        if (OpenLayers.Util.isArray(url)) {
             url = this.selectUrl(paramsString, url);
         }  
     

Modified: sandbox/tschaub/editing/lib/OpenLayers/Layer/MapServer.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Layer/MapServer.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Layer/MapServer.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -136,7 +136,7 @@
         // if url is not a string, it should be an array of strings, 
         // in which case we will deterministically select one of them in 
         // order to evenly distribute requests to different urls.
-        if (url instanceof Array) {
+        if (OpenLayers.Util.isArray(url)) {
             url = this.selectUrl(paramsString, url);
         }   
         

Modified: sandbox/tschaub/editing/lib/OpenLayers/Layer/TMS.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Layer/TMS.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Layer/TMS.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -129,7 +129,7 @@
             this.map.getZoom() + this.zoomOffset;
         var path = this.serviceVersion + "/" + this.layername + "/" + z + "/" + x + "/" + y + "." + this.type; 
         var url = this.url;
-        if (url instanceof Array) {
+        if (OpenLayers.Util.isArray(url)) {
             url = this.selectUrl(path, url);
         }
         return url + path;

Modified: sandbox/tschaub/editing/lib/OpenLayers/Layer/TileCache.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Layer/TileCache.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Layer/TileCache.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -138,7 +138,7 @@
         ];
         var path = components.join('/'); 
         var url = this.url;
-        if (url instanceof Array) {
+        if (OpenLayers.Util.isArray(url)) {
             url = this.selectUrl(path, url);
         }
         url = (url.charAt(url.length - 1) == '/') ? url : url + '/';

Modified: sandbox/tschaub/editing/lib/OpenLayers/Layer/Vector.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Layer/Vector.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Layer/Vector.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -554,7 +554,7 @@
      * options - {Object}
      */
     addFeatures: function(features, options) {
-        if (!(features instanceof Array)) {
+        if (!(OpenLayers.Util.isArray(features))) {
             features = [features];
         }
         
@@ -643,7 +643,7 @@
         if (features === this.features) {
             return this.removeAllFeatures(options);
         }
-        if (!(features instanceof Array)) {
+        if (!(OpenLayers.Util.isArray(features))) {
             features = [features];
         }
         if (features === this.selectedFeatures) {

Modified: sandbox/tschaub/editing/lib/OpenLayers/Layer/WMTS.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Layer/WMTS.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Layer/WMTS.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -408,7 +408,7 @@
                 path = path + this.matrixSet + "/" + this.matrix.identifier + 
                     "/" + info.row + "/" + info.col + "." + this.formatSuffix;
                 
-                if (this.url instanceof Array) {
+                if (OpenLayers.Util.isArray(this.url)) {
                     url = this.selectUrl(path, this.url);
                 } else {
                     url = this.url;

Modified: sandbox/tschaub/editing/lib/OpenLayers/Layer/XYZ.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Layer/XYZ.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Layer/XYZ.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -120,7 +120,7 @@
     getURL: function (bounds) {
         var xyz = this.getXYZ(bounds);
         var url = this.url;
-        if (url instanceof Array) {
+        if (OpenLayers.Util.isArray(url)) {
             var s = '' + xyz.x + xyz.y + xyz.z;
             url = this.selectUrl(s, url);
         }

Modified: sandbox/tschaub/editing/lib/OpenLayers/Layer/Zoomify.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Layer/Zoomify.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Layer/Zoomify.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -211,7 +211,7 @@
         var path = "TileGroup" + Math.floor( (tileIndex) / 256 ) +
             "/" + z + "-" + x + "-" + y + ".jpg";
         var url = this.url;
-        if (url instanceof Array) {
+        if (OpenLayers.Util.isArray(url)) {
             url = this.selectUrl(path, url);
         }
         return url + path;

Modified: sandbox/tschaub/editing/lib/OpenLayers/Protocol/SQL/Gears.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Protocol/SQL/Gears.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Protocol/SQL/Gears.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -302,7 +302,7 @@
      *          object.
      */
     createOrUpdate: function(features) {
-        if (!(features instanceof Array)) {
+        if (!(OpenLayers.Util.isArray(features))) {
             features = [features];
         }
 
@@ -397,7 +397,7 @@
      *          object.
      */
     "delete": function(features, options) {
-        if (!(features instanceof Array)) {
+        if (!(OpenLayers.Util.isArray(features))) {
             features = [features];
         }
 

Modified: sandbox/tschaub/editing/lib/OpenLayers/Protocol/WFS.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Protocol/WFS.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Protocol/WFS.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -45,7 +45,7 @@
 OpenLayers.Protocol.WFS.fromWMSLayer = function(layer, options) {
     var typeName, featurePrefix;
     var param = layer.params["LAYERS"];
-    var parts = (param instanceof Array ? param[0] : param).split(":");
+    var parts = (OpenLayers.Util.isArray(param) ? param[0] : param).split(":");
     if(parts.length > 1) {
         featurePrefix = parts[0];
     }

Modified: sandbox/tschaub/editing/lib/OpenLayers/Renderer/Canvas.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Renderer/Canvas.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Renderer/Canvas.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -632,7 +632,7 @@
      * features - {Array(<OpenLayers.Feature.Vector>)} 
      */
     eraseFeatures: function(features) {
-        if(!(features instanceof Array)) {
+        if(!(OpenLayers.Util.isArray(features))) {
             features = [features];
         }
         for(var i=0; i<features.length; ++i) {

Modified: sandbox/tschaub/editing/lib/OpenLayers/Renderer.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Renderer.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Renderer.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -267,7 +267,7 @@
      * features - {Array(<OpenLayers.Feature.Vector>)} 
      */
     eraseFeatures: function(features) {
-        if(!(features instanceof Array)) {
+        if(!(OpenLayers.Util.isArray(features))) {
             features = [features];
         }
         for(var i=0, len=features.length; i<len; ++i) {

Modified: sandbox/tschaub/editing/lib/OpenLayers/Tile/Image.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Tile/Image.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Tile/Image.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -373,7 +373,7 @@
             }
 
             // needed for changing to a different server for onload error
-            if (this.layer.url instanceof Array) {
+            if (OpenLayers.Util.isArray(this.layer.url)) {
                 this.imgDiv.urls = this.layer.url.slice();
             }
       

Modified: sandbox/tschaub/editing/lib/OpenLayers/Util.js
===================================================================
--- sandbox/tschaub/editing/lib/OpenLayers/Util.js	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/lib/OpenLayers/Util.js	2011-06-17 18:36:55 UTC (rev 12101)
@@ -58,6 +58,22 @@
     return !!(o && o.nodeType === 1);
 };
 
+/**
+ * Function: isArray
+ * Tests that the provided object is an array.
+ * This test handles the cross-IFRAME case not caught
+ * by "a instanceof Array" and should be used instead.
+ * 
+ * Parameters:
+ * a - {Object} the object test.
+ * 
+ * Returns
+ * {Boolean} true if the object is an array.
+ */
+OpenLayers.Util.isArray = function(a) {
+	return (Object.prototype.toString.call(a) === '[object Array]');
+};
+
 /** 
  * Maintain existing definition of $.
  */
@@ -346,7 +362,7 @@
     this._attempts = (this._attempts) ? (this._attempts + 1) : 1;
     if (this._attempts <= OpenLayers.IMAGE_RELOAD_ATTEMPTS) {
         var urls = this.urls;
-        if (urls && urls instanceof Array && urls.length > 1){
+        if (urls && OpenLayers.Util.isArray(urls) && urls.length > 1){
             var src = this.src.toString();
             var current_url, k;
             for (k = 0; current_url = urls[k]; k++){

Modified: sandbox/tschaub/editing/tests/Format/WKT.html
===================================================================
--- sandbox/tschaub/editing/tests/Format/WKT.html	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/tests/Format/WKT.html	2011-06-17 18:36:55 UTC (rev 12101)
@@ -232,6 +232,16 @@
         t.geom_eq(got[1].geometry, linestrings[0].geometry, "second feature's geometry is the correct linestring");
  
     }
+    
+    function test_whitespace(t) {
+        t.plan(3);
+        var wkt = "LINESTRING(7.120068\t43.583917,\n7.120154 43.583652,\n7.120385\t43.582716,\r\n7.12039 43.582568, 7.120712 43.581511,7.120873\n43.580718)";
+        var format = new OpenLayers.Format.WKT();
+        var got = format.read(wkt);
+        t.ok(got instanceof OpenLayers.Feature.Vector, "read a feature");
+        t.ok(got.geometry instanceof OpenLayers.Geometry.LineString, "read a linestring");
+        t.ok(got.geometry.components.length, 6, "read a geometry with 6 components");
+    }
 
     function test_Format_WKT_read_projection(t) {
         t.plan(1);

Modified: sandbox/tschaub/editing/tests/Util.html
===================================================================
--- sandbox/tschaub/editing/tests/Util.html	2011-06-17 18:26:24 UTC (rev 12100)
+++ sandbox/tschaub/editing/tests/Util.html	2011-06-17 18:36:55 UTC (rev 12101)
@@ -41,6 +41,42 @@
              "isElement reports that object returned by getElement is an Element");
     }
     
+    function test_isArray(t) {
+        t.plan(5);
+        
+        var a;
+        
+        a = null;
+        t.eq(OpenLayers.Util.isArray(a), false, 
+             "isArray reports 'null' isn't an Array");
+        a = "Array";   
+        t.eq(OpenLayers.Util.isArray(a), false, 
+             "isArray reports \"Array\" isn't an Array");
+        a = {};
+        t.eq(OpenLayers.Util.isArray(a), false, 
+             "isArray reports {} isn't an Array");
+        a = [];
+        t.eq(OpenLayers.Util.isArray(a), true, 
+             "isArray reports [] is an Array");
+        a = new Array();
+        t.eq(OpenLayers.Util.isArray(a), true, 
+             "isArray reports new Array() is an Array");
+    }
+    
+    function test_iframe_isArray(t) {
+        t.plan(3);
+        // create an array in an iframe
+        var iframe = document.createElement("iframe");
+        document.body.appendChild(iframe);
+        frames[frames.length-1].document.write(
+            "<script>parent.testArray = [];<\/script>"
+        );
+        
+        t.ok(!!testArray, "testArray created");
+        t.ok(!(testArray instanceof Array), "instanceof check doesn't work");
+        t.eq(OpenLayers.Util.isArray(testArray), true, "isArray works");
+    }
+    
     function test_$(t) {
         t.plan(1);
         t.ok($ === custom$, "OpenLayers doesn't clobber existing definition of $.");



More information about the Commits mailing list