From 0b39d32031836af30078a5e21448f1f916c18523 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Mon, 14 Nov 2011 17:49:41 +0100 Subject: [PATCH 1/5] Don't let wrapDateLine maps be wider than one world width. --- lib/OpenLayers/Map.js | 27 +++++++++++++++++++++++++++ tests/Layer/WrapDateLine.html | 6 +++--- tests/Map.html | 17 +++++++++++++++++ 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 33daa3a66c..20bc652465 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -1701,6 +1701,30 @@ OpenLayers.Map = OpenLayers.Class({ this.events.triggerEvent("move"); } }, + + /** + * Method: adjustZoom + * + * Parameters: + * zoom - {Number} The zoom level to adjust + * + * Returns: + * {Integer} Adjusted zoom level that shows a map not wider than its + * 's maxExtent. + */ + adjustZoom: function(zoom) { + var resolution, resolutions = this.baseLayer.resolutions, + maxResolution = this.getMaxExtent().getWidth() / this.getSize().w; + if (this.getResolutionForZoom(zoom) > maxResolution) { + for (var i=zoom|0, ii=resolutions.length; i From cc3c89eb2a1abd800d57d84f77c008db677f6a84 Mon Sep 17 00:00:00 2001 From: fredj Date: Tue, 15 Nov 2011 09:09:55 +0100 Subject: [PATCH 2/5] Don't use deprecated Layer.Grid.getGridBounds function in tests --- tests/Layer/TileCache.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Layer/TileCache.html b/tests/Layer/TileCache.html index 6ae2bc1c86..1a70200901 100644 --- a/tests/Layer/TileCache.html +++ b/tests/Layer/TileCache.html @@ -71,7 +71,7 @@ layer.grid = [ [6, tr], [bl, 7]]; - var bounds = layer.getGridBounds(); + var bounds = layer.getTilesBounds(); var testBounds = new OpenLayers.Bounds(1,2,3,4); From a04df3e35980be1d9c782a6ed9f84a1b72093895 Mon Sep 17 00:00:00 2001 From: fredj Date: Wed, 16 Nov 2011 12:52:55 +0100 Subject: [PATCH 3/5] doc typo --- lib/OpenLayers/Control.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OpenLayers/Control.js b/lib/OpenLayers/Control.js index 0ca4627c29..5fb8c5e5ce 100644 --- a/lib/OpenLayers/Control.js +++ b/lib/OpenLayers/Control.js @@ -85,7 +85,7 @@ OpenLayers.Control = OpenLayers.Class({ /** * Property: allowSelection - * {Boolean} By deafault, controls do not allow selection, because + * {Boolean} By default, controls do not allow selection, because * it may interfere with map dragging. If this is true, OpenLayers * will not prevent selection of the control. * Default is false. From 9f836cd2640c742fc581e29c6431c6752d1d6be1 Mon Sep 17 00:00:00 2001 From: fredj Date: Fri, 18 Nov 2011 11:07:47 +0100 Subject: [PATCH 4/5] Stop using deprecated Layer.GML in tests --- tests/manual/big-georss.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/manual/big-georss.html b/tests/manual/big-georss.html index 6be290c46b..7e2f2b50f0 100644 --- a/tests/manual/big-georss.html +++ b/tests/manual/big-georss.html @@ -16,7 +16,13 @@ "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} ); map.addLayer(layer); map.zoomToExtent(new OpenLayers.Bounds(-94.617035,33.010025,-89.645401,36.492752)); - map.addLayer(new OpenLayers.Layer.GML("GML", "arkansas.rss", {format: OpenLayers.Format.GeoRSS})); + map.addLayer(new OpenLayers.Layer.Vector("arkansas", { + protocol: new OpenLayers.Protocol.HTTP({ + url: "arkansas.rss", + format: new OpenLayers.Format.GeoRSS() + }), + strategies: [new OpenLayers.Strategy.Fixed()] + })); } From 7f7f946c2947d1e681d5b832fcea78be7f56d508 Mon Sep 17 00:00:00 2001 From: fredj Date: Fri, 18 Nov 2011 11:24:33 +0100 Subject: [PATCH 5/5] Stop using deprecated Layer.GML in examples --- examples/georss-flickr.html | 29 ++++++++++++++--------------- examples/gml-layer.html | 8 +++++++- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/examples/georss-flickr.html b/examples/georss-flickr.html index 94da9949f8..5591b0ccb0 100644 --- a/examples/georss-flickr.html +++ b/examples/georss-flickr.html @@ -50,21 +50,20 @@ style.addRules([rule, elseRule]); - // Create a GML layer with GeoRSS format and a style map. - markerLayer = new OpenLayers.Layer.GML("Some images from Flickr", - "xml/georss-flickr.xml", { - format: OpenLayers.Format.GeoRSS, - formatOptions: { - // adds the thumbnail attribute to the feature - createFeatureFromItem: function(item) { - var feature = OpenLayers.Format.GeoRSS.prototype - .createFeatureFromItem.apply(this, arguments); - feature.attributes.thumbnail = - this.getElementsByTagNameNS( - item, "*", "thumbnail")[0].getAttribute("url"); - return feature; - } - }, + // Create a Vector layer with GeoRSS format and a style map. + markerLayer = new OpenLayers.Layer.Vector("Some images from Flickr", { + protocol: new OpenLayers.Protocol.HTTP({ + url: "xml/georss-flickr.xml", + format: new OpenLayers.Format.GeoRSS({ + // adds the thumbnail attribute to the feature + createFeatureFromItem: function(item) { + var feature = OpenLayers.Format.GeoRSS.prototype.createFeatureFromItem.apply(this, arguments); + feature.attributes.thumbnail = this.getElementsByTagNameNS(item, "*", "thumbnail")[0].getAttribute("url"); + return feature; + } + }) + }), + strategies: [new OpenLayers.Strategy.Fixed()], // Giving the style map keys for "default" and "select" // rendering intent, to make the image larger when selected styleMap: new OpenLayers.StyleMap({ diff --git a/examples/gml-layer.html b/examples/gml-layer.html index eea465dcec..a87a5f333e 100644 --- a/examples/gml-layer.html +++ b/examples/gml-layer.html @@ -20,7 +20,13 @@ "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'} ); map.addLayer(layer); map.zoomToExtent(new OpenLayers.Bounds(-3.922119,44.335327,4.866943,49.553833)); - map.addLayer(new OpenLayers.Layer.GML("GML", "gml/polygon.xml")); + map.addLayer(new OpenLayers.Layer.Vector("GML", { + protocol: new OpenLayers.Protocol.HTTP({ + url: "gml/polygon.xml", + format: new OpenLayers.Format.GML() + }), + strategies: [new OpenLayers.Strategy.Fixed()] + })); }