diff --git a/lib/OpenLayers/Control/ModifyFeature.js b/lib/OpenLayers/Control/ModifyFeature.js index 31d968cbb5..3982cb1c9b 100644 --- a/lib/OpenLayers/Control/ModifyFeature.js +++ b/lib/OpenLayers/Control/ModifyFeature.js @@ -633,6 +633,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, { this.layer.drawFeature(this.feature, this.standalone ? undefined : this.selectControl.renderIntent); + this.modified = true; this.resetVertices(); this.setFeatureState(); this.onModification(this.feature); diff --git a/lib/OpenLayers/Format/WPSDescribeProcess.js b/lib/OpenLayers/Format/WPSDescribeProcess.js index 885b0ee7b1..2a3157363d 100644 --- a/lib/OpenLayers/Format/WPSDescribeProcess.js +++ b/lib/OpenLayers/Format/WPSDescribeProcess.js @@ -5,6 +5,7 @@ /** * @requires OpenLayers/Format/XML.js + * @requires OpenLayers/Format/OWSCommon/v1_1_0.js */ /** diff --git a/lib/OpenLayers/Layer/ArcGISCache.js b/lib/OpenLayers/Layer/ArcGISCache.js index 377a3132c6..30563da276 100644 --- a/lib/OpenLayers/Layer/ArcGISCache.js +++ b/lib/OpenLayers/Layer/ArcGISCache.js @@ -172,21 +172,23 @@ OpenLayers.Layer.ArcGISCache = OpenLayers.Class(OpenLayers.Layer.XYZ, { this.lods = []; for(var key in info.tileInfo.lods) { - var lod = info.tileInfo.lods[key]; - if (this.useScales) { - this.scales.push(lod.scale); - } else { - this.resolutions.push(lod.resolution); + if (info.tileInfo.lods.hasOwnProperty(key)) { + var lod = info.tileInfo.lods[key]; + if (this.useScales) { + this.scales.push(lod.scale); + } else { + this.resolutions.push(lod.resolution); + } + + var start = this.getContainingTileCoords(upperLeft, lod.resolution); + lod.startTileCol = start.x; + lod.startTileRow = start.y; + + var end = this.getContainingTileCoords(bottomRight, lod.resolution); + lod.endTileCol = end.x; + lod.endTileRow = end.y; + this.lods.push(lod); } - - var start = this.getContainingTileCoords(upperLeft, lod.resolution); - lod.startTileCol = start.x; - lod.startTileRow = start.y; - - var end = this.getContainingTileCoords(bottomRight, lod.resolution); - lod.endTileCol = end.x; - lod.endTileRow = end.y; - this.lods.push(lod); } this.maxExtent = this.calculateMaxExtentWithLOD(this.lods[0]); diff --git a/lib/OpenLayers/Layer/HTTPRequest.js b/lib/OpenLayers/Layer/HTTPRequest.js index 3b7a154fcd..ddf3d51073 100644 --- a/lib/OpenLayers/Layer/HTTPRequest.js +++ b/lib/OpenLayers/Layer/HTTPRequest.js @@ -58,9 +58,7 @@ OpenLayers.Layer.HTTPRequest = OpenLayers.Class(OpenLayers.Layer, { * options - {Object} Hashtable of extra options to tag onto the layer */ initialize: function(name, url, params, options) { - var newArguments = arguments; - newArguments = [name, options]; - OpenLayers.Layer.prototype.initialize.apply(this, newArguments); + OpenLayers.Layer.prototype.initialize.apply(this, [name, options]); this.url = url; this.params = OpenLayers.Util.extend( {}, params); }, diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 3f2ded4e95..285ae0c60c 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -1722,7 +1722,8 @@ OpenLayers.Map = OpenLayers.Class({ var layer, i, len; for (i=0, len=this.layers.length; i= 0 && tile.y >= 0), 'layer should not generate negative tile ranges for level of detail'); } + /* + * Test that messing up the Array.prototype does not mess up the lods of the layer. + * This messes up zooming when resolutions are very small/scales are very large/zoomed way in. + */ + function test_Layer_ARCGISCACHE_lods (t) { + t.plan( 2 ); + var layerInfo = capabilitiesObject; + + lods = layerInfo.tileInfo.lods.length; + + // mess up the Array prototype + Array.prototype.foo = function() { }; + + t.ok( lods == layerInfo.tileInfo.lods.length, 'proper number of "Levels of Detail" before initialization' ); + + // initialize the layer using the JSON object from an arcgis server + // see: ArcGISCache.json + var layer = new OpenLayers.Layer.ArcGISCache(name, url, { + layerInfo: layerInfo + }); + + t.ok( lods == layer.lods.length, 'proper number of "Levels of Detail" after initialization.' ); + // restore the Array prototype + delete Array.prototype.foo; + } + diff --git a/tests/Map.html b/tests/Map.html index 356331225e..39da1928e9 100644 --- a/tests/Map.html +++ b/tests/Map.html @@ -1790,36 +1790,76 @@ } function test_moveByPx(t) { - t.plan(8); + t.plan(16); + + var moved; + var Layer = OpenLayers.Class(OpenLayers.Layer, { + moveByPx: function(dx, dy) { + moved[this.name] = true; + } + }); var map = new OpenLayers.Map({ div: 'map', maxExtent: new OpenLayers.Bounds(-50, -50, 50, 50), restrictedExtent: new OpenLayers.Bounds(-10, -10, 10, 10), layers: [ - new OpenLayers.Layer('name', {isBaseLayer: true}) + new Layer('base', + {isBaseLayer: true}), + new Layer('outofrange', + {isBaseLayer: false, minResolution:2}) ] }); + + moved = {}; map.zoomToExtent(new OpenLayers.Bounds(-1, -1, 1, 1)); // check initial state - t.eq(map.layerContainerDiv.style.left, '0px', 'layer container left correct'); - t.eq(map.layerContainerDiv.style.top, '0px', 'layer container top correct'); + t.eq(map.layerContainerDiv.style.left, '0px', + '[initial state] layer container left correct'); + t.eq(map.layerContainerDiv.style.top, '0px', + '[initial state] layer container top correct'); + t.eq(moved['base'], undefined, + '[initial state] base layer not moved'); + t.eq(moved['outofrange'], undefined, + '[initial state] out-of-range layer not moved'); // move to a valid position + moved = {}; map.moveByPx(-455, 455); - t.eq(map.layerContainerDiv.style.left, '455px', 'layer container left correct'); - t.eq(map.layerContainerDiv.style.top, '-455px', 'layer container top correct'); + t.eq(map.layerContainerDiv.style.left, '455px', + '[valid position] layer container left correct'); + t.eq(map.layerContainerDiv.style.top, '-455px', + '[valid position] layer container top correct'); + t.eq(moved['base'], true, + '[valid position] base layer moved'); + t.eq(moved['outofrange'], undefined, + '[valid position] out-of-range layer not moved'); // move outside the max extent + moved = {}; map.moveByPx(-4500, 4500); - t.eq(map.layerContainerDiv.style.left, '455px', 'layer container left correct'); - t.eq(map.layerContainerDiv.style.top, '-455px', 'layer container top correct'); + t.eq(map.layerContainerDiv.style.left, '455px', + '[outside max extent] layer container left correct'); + t.eq(map.layerContainerDiv.style.top, '-455px', + '[outside max extent] layer container top correct'); + t.eq(moved['base'], undefined, + '[outside max extent] base layer not moved'); + t.eq(moved['outofrange'], undefined, + '[outside max extent] out-of-range layer not moved'); // move outside the restricted extent + moved = {}; map.moveByPx(-500, 500); - t.eq(map.layerContainerDiv.style.left, '455px', 'layer container left correct'); - t.eq(map.layerContainerDiv.style.top, '-455px', 'layer container top correct'); + t.eq(map.layerContainerDiv.style.left, '455px', + '[outside restricted extent] layer container left correct'); + t.eq(map.layerContainerDiv.style.top, '-455px', + '[outside restricted extent] layer container top correct'); + t.eq(moved['base'], undefined, + '[outside restricted extent] base layer not moved'); + t.eq(moved['outofrange'], undefined, + '[outside restricted extent] out-of-range layer not moved'); + map.destroy(); } diff --git a/tests/Protocol/Script.html b/tests/Protocol/Script.html index 8eaa6e803a..a676e61821 100644 --- a/tests/Protocol/Script.html +++ b/tests/Protocol/Script.html @@ -150,7 +150,7 @@ t.eq(script.type, 'text/javascript', 'created script has a correct type'); - t.eq(script.src, 'http://bar_url/?k=bar_param&cb_key=cb_prefix%3AOpenLayers.Protocol.Script.getCallback(bar)', + t.eq(script.src, 'http://bar_url/?k=bar_param&cb_key=cb_prefix%3AOpenLayers.Protocol.Script.registry%5Bbar%5D', 'created script has a correct url'); t.eq(script.id, 'OpenLayers_Protocol_Script_bar', 'created script has a correct id'); diff --git a/tools/closure.py b/tools/closure.py index 07bb1b5616..ab60be7eb0 100644 --- a/tools/closure.py +++ b/tools/closure.py @@ -2,20 +2,21 @@ import sys import os import tempfile -path = os.path.abspath(os.path.join(os.path.dirname(__file__), "closure-compiler.jar")) +path = "../tools/closure-compiler.jar" if not os.path.exists(path): raise Exception("No closure-compiler.jar at %s; read README.txt!" % path) def minimize(code): - ntf = tempfile.NamedTemporaryFile() + ntf = tempfile.NamedTemporaryFile(delete=False) ntf.write(code) ntf.flush() - ntf2 = tempfile.NamedTemporaryFile() - - os.system("java -jar %s --js %s --js_output_file %s" % (path, ntf.name, ntf2.name)) - ntf2.seek(0) - data = ntf2.read() + ntf2 = tempfile.NamedTemporaryFile(delete=False) ntf.close() ntf2.close() + + os.system("java -jar %s --js %s --js_output_file %s" % (path, ntf.name, ntf2.name)) + data = open(ntf2.name).read() + os.unlink(ntf.name) + os.unlink(ntf2.name) return data