diff --git a/apidoc_config/Menu.txt b/apidoc_config/Menu.txt index 9d23a1a7aa..16dd487956 100644 --- a/apidoc_config/Menu.txt +++ b/apidoc_config/Menu.txt @@ -362,6 +362,7 @@ Group: OpenLayers { File: MapServer.Untiled (no auto-title, OpenLayers/Layer/MapServer/Untiled.js) File: Markers (no auto-title, OpenLayers/Layer/Markers.js) File: MultiMap (no auto-title, OpenLayers/Layer/MultiMap.js) + File: OSM (no auto-title, OpenLayers/Layer/OSM.js) File: PointGrid (no auto-title, OpenLayers/Layer/PointGrid.js) File: PointTrack (no auto-title, OpenLayers/Layer/PointTrack.js) File: SphericalMercator (no auto-title, OpenLayers/Layer/SphericalMercator.js) diff --git a/lib/OpenLayers.js b/lib/OpenLayers.js index ff302535e4..040570e13c 100644 --- a/lib/OpenLayers.js +++ b/lib/OpenLayers.js @@ -144,6 +144,7 @@ "OpenLayers/Layer/GeoRSS.js", "OpenLayers/Layer/Boxes.js", "OpenLayers/Layer/XYZ.js", + "OpenLayers/Layer/OSM.js", "OpenLayers/Layer/Bing.js", "OpenLayers/Layer/TMS.js", "OpenLayers/Layer/TileCache.js", diff --git a/lib/OpenLayers/Layer/OSM.js b/lib/OpenLayers/Layer/OSM.js new file mode 100644 index 0000000000..0531a9a7a8 --- /dev/null +++ b/lib/OpenLayers/Layer/OSM.js @@ -0,0 +1,41 @@ +/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for + * full list of contributors). Published under the Clear BSD license. + * See http://svn.openlayers.org/trunk/openlayers/license.txt for the + * full text of the license. */ + +/** + * @requires OpenLayers/Layer/XYZ.js + */ + +/** + * Class: OpenLayers.Layer.OSM + * A class to access OpenStreetMap tiles. By default, uses the OpenStreetMap + * hosted tile.openstreetmap.org 'Mapnik' tileset. If you wish to use + * tiles@home / osmarender layer instead, you can pass a layer like: + * + * (code) + * new OpenLayers.Layer.OSM("t@h", + * "http://tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png"); + * (end) + * + * This layer defaults to Spherical Mercator. + * + * Inherits from: + * - + */ +OpenLayers.Layer.OSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { + name: "OpenStreetMap", + attribution: "Data CC-By-SA by OpenStreetMap", + sphericalMercator: true, + url: 'http://tile.openstreetmap.org/${z}/${x}/${y}.png', + clone: function(obj) { + if (obj == null) { + obj = new OpenLayers.Layer.OSM( + this.name, this.url, this.getOptions()); + } + obj = OpenLayers.Layer.XYZ.prototype.clone.apply(this, [obj]); + return obj; + }, + wrapDateLine: true, + CLASS_NAME: "OpenLayers.Layer.OSM" +}); diff --git a/lib/OpenLayers/Layer/XYZ.js b/lib/OpenLayers/Layer/XYZ.js index 84855f95be..7977a3255f 100644 --- a/lib/OpenLayers/Layer/XYZ.js +++ b/lib/OpenLayers/Layer/XYZ.js @@ -183,37 +183,3 @@ OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, { CLASS_NAME: "OpenLayers.Layer.XYZ" }); - - -/** - * Class: OpenLayers.Layer.OSM - * A class to access OpenStreetMap tiles. By default, uses the OpenStreetMap - * hosted tile.openstreetmap.org 'Mapnik' tileset. If you wish to use - * tiles@home / osmarender layer instead, you can pass a layer like: - * - * (code) - * new OpenLayers.Layer.OSM("t@h", - * "http://tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png"); - * (end) - * - * This layer defaults to Spherical Mercator. - * - * Inherits from: - * - - */ -OpenLayers.Layer.OSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { - name: "OpenStreetMap", - attribution: "Data CC-By-SA by OpenStreetMap", - sphericalMercator: true, - url: 'http://tile.openstreetmap.org/${z}/${x}/${y}.png', - clone: function(obj) { - if (obj == null) { - obj = new OpenLayers.Layer.OSM( - this.name, this.url, this.getOptions()); - } - obj = OpenLayers.Layer.XYZ.prototype.clone.apply(this, [obj]); - return obj; - }, - wrapDateLine: true, - CLASS_NAME: "OpenLayers.Layer.OSM" -}); diff --git a/notes/2.12.md b/notes/2.12.md index d57ce08859..6fa1f42310 100644 --- a/notes/2.12.md +++ b/notes/2.12.md @@ -50,6 +50,10 @@ The base `OpenLayers.Geometry` class no longer depends on `OpenLayers.Format.WKT Without the WKT format included (by default), the `OpenLayers.Geometry::toString` method now returns "[object Object]." Previously, it returned the Well-Known Text representation of the geometry. To maintain the previous behavior, include the OpenLayers/Format/WKT.js file in your build. +## OSM Layer + +`Layer.OSM` is now defined in its own script file, namely `OpenLayers/Layer/OSM.js`. So people using `Layer.OSM` should now include `OpenLayers/Layer/OSM.js`, as opposed to `OpenLayers/Layer/XYZ.js`, in their OpenLayers builds. (See https://github.com/openlayers/openlayers/issues/138) + ## Deprecated Components A number of properties, methods, and constructors have been marked as deprecated for multiple releases in the 2.x series. For the 2.12 release this deprecated functionality has been moved to a separate deprecated.js file. If you use any of the constructors or methods below, you will have to explicitly include the deprecated.js file in your build (or add it in a separate ` + + + +
+ + diff --git a/tests/Layer/XYZ.html b/tests/Layer/XYZ.html index d6685c05b5..8b8a7cbf31 100644 --- a/tests/Layer/XYZ.html +++ b/tests/Layer/XYZ.html @@ -251,17 +251,11 @@ } function test_clone(t) { - t.plan(2); - - var clone; + t.plan(1); layer = new OpenLayers.Layer.XYZ(name, url, options); - clone = layer.clone(); + var clone = layer.clone(); t.ok(clone instanceof OpenLayers.Layer.XYZ, "clone is a Layer.XYZ instance"); - - layer = new OpenLayers.Layer.OSM(); - clone = layer.clone(); - t.ok(clone instanceof OpenLayers.Layer.OSM, "clone is a Layer.OSM instance"); } diff --git a/tests/list-tests.html b/tests/list-tests.html index a3a3023463..7daa933355 100644 --- a/tests/list-tests.html +++ b/tests/list-tests.html @@ -167,6 +167,7 @@
  • Layer/WMTS.html
  • Layer/WrapDateLine.html
  • Layer/XYZ.html
  • +
  • Layer/OSM.html
  • Map.html
  • Marker.html
  • Marker/Box.html