r65434 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65433‎ | r65434 | r65435 >
Date:19:32, 22 April 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.6 - moved a bunch of directories to get a more logic structure
Modified paths:
  • /trunk/extensions/Maps/Services/OpenLayers/OSM (added) (history)
  • /trunk/extensions/Maps/Services/OpenLayers/OSM/OpenStreetMap.js (added) (history)
  • /trunk/extensions/Maps/Services/OpenLayers/OpenLayers (added) (history)

Diff [purge]

Index: trunk/extensions/Maps/Services/OpenLayers/OSM/OpenStreetMap.js
@@ -0,0 +1,141 @@
 2+/**
 3+ * Namespace: Util.OSM
 4+ */
 5+OpenLayers.Util.OSM = {};
 6+
 7+/**
 8+ * Constant: MISSING_TILE_URL
 9+ * {String} URL of image to display for missing tiles
 10+ */
 11+OpenLayers.Util.OSM.MISSING_TILE_URL = "http://openstreetmap.org/openlayers/img/404.png";
 12+
 13+/**
 14+ * Property: originalOnImageLoadError
 15+ * {Function} Original onImageLoadError function.
 16+ */
 17+OpenLayers.Util.OSM.originalOnImageLoadError = OpenLayers.Util.onImageLoadError;
 18+
 19+/**
 20+ * Function: onImageLoadError
 21+ */
 22+OpenLayers.Util.onImageLoadError = function() {
 23+ if (this.src.match(/^http:\/\/[abc]\.[a-z]+\.openstreetmap\.org\//)) {
 24+ this.src = OpenLayers.Util.OSM.MISSING_TILE_URL;
 25+ } else if (this.src.match(/^http:\/\/[def]\.tah\.openstreetmap\.org\//)) {
 26+ // do nothing - this layer is transparent
 27+ } else {
 28+ OpenLayers.Util.OSM.originalOnImageLoadError;
 29+ }
 30+};
 31+
 32+/**
 33+ * Class: OpenLayers.Layer.OSM.Mapnik
 34+ *
 35+ * Inherits from:
 36+ * - <OpenLayers.Layer.OSM>
 37+ */
 38+OpenLayers.Layer.OSM.Mapnik = OpenLayers.Class(OpenLayers.Layer.OSM, {
 39+ /**
 40+ * Constructor: OpenLayers.Layer.OSM.Mapnik
 41+ *
 42+ * Parameters:
 43+ * name - {String}
 44+ * options - {Object} Hashtable of extra options to tag onto the layer
 45+ */
 46+ initialize: function(name, options) {
 47+ var url = [
 48+ "http://a.tile.openstreetmap.org/${z}/${x}/${y}.png",
 49+ "http://b.tile.openstreetmap.org/${z}/${x}/${y}.png",
 50+ "http://c.tile.openstreetmap.org/${z}/${x}/${y}.png"
 51+ ];
 52+ options = OpenLayers.Util.extend({ numZoomLevels: 19 }, options);
 53+ var newArguments = [name, url, options];
 54+ OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
 55+ },
 56+
 57+ CLASS_NAME: "OpenLayers.Layer.OSM.Mapnik"
 58+});
 59+
 60+/**
 61+ * Class: OpenLayers.Layer.OSM.Osmarender
 62+ *
 63+ * Inherits from:
 64+ * - <OpenLayers.Layer.OSM>
 65+ */
 66+OpenLayers.Layer.OSM.Osmarender = OpenLayers.Class(OpenLayers.Layer.OSM, {
 67+ /**
 68+ * Constructor: OpenLayers.Layer.OSM.Osmarender
 69+ *
 70+ * Parameters:
 71+ * name - {String}
 72+ * options - {Object} Hashtable of extra options to tag onto the layer
 73+ */
 74+ initialize: function(name, options) {
 75+ var url = [
 76+ "http://a.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png",
 77+ "http://b.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png",
 78+ "http://c.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png"
 79+ ];
 80+ options = OpenLayers.Util.extend({ numZoomLevels: 18 }, options);
 81+ var newArguments = [name, url, options];
 82+ OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
 83+ },
 84+
 85+ CLASS_NAME: "OpenLayers.Layer.OSM.Osmarender"
 86+});
 87+
 88+/**
 89+ * Class: OpenLayers.Layer.OSM.CycleMap
 90+ *
 91+ * Inherits from:
 92+ * - <OpenLayers.Layer.OSM>
 93+ */
 94+OpenLayers.Layer.OSM.CycleMap = OpenLayers.Class(OpenLayers.Layer.OSM, {
 95+ /**
 96+ * Constructor: OpenLayers.Layer.OSM.CycleMap
 97+ *
 98+ * Parameters:
 99+ * name - {String}
 100+ * options - {Object} Hashtable of extra options to tag onto the layer
 101+ */
 102+ initialize: function(name, options) {
 103+ var url = [
 104+ "http://a.andy.sandbox.cloudmade.com/tiles/cycle/${z}/${x}/${y}.png",
 105+ "http://b.andy.sandbox.cloudmade.com/tiles/cycle/${z}/${x}/${y}.png",
 106+ "http://c.andy.sandbox.cloudmade.com/tiles/cycle/${z}/${x}/${y}.png"
 107+ ];
 108+ options = OpenLayers.Util.extend({ numZoomLevels: 19 }, options);
 109+ var newArguments = [name, url, options];
 110+ OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
 111+ },
 112+
 113+ CLASS_NAME: "OpenLayers.Layer.OSM.CycleMap"
 114+});
 115+
 116+/**
 117+ * Class: OpenLayers.Layer.OSM.Maplint
 118+ *
 119+ * Inherits from:
 120+ * - <OpenLayers.Layer.OSM>
 121+ */
 122+OpenLayers.Layer.OSM.Maplint = OpenLayers.Class(OpenLayers.Layer.OSM, {
 123+ /**
 124+ * Constructor: OpenLayers.Layer.OSM.Maplint
 125+ *
 126+ * Parameters:
 127+ * name - {String}
 128+ * options - {Object} Hashtable of extra options to tag onto the layer
 129+ */
 130+ initialize: function(name, options) {
 131+ var url = [
 132+ "http://d.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png",
 133+ "http://e.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png",
 134+ "http://f.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png"
 135+ ];
 136+ options = OpenLayers.Util.extend({ numZoomLevels: 18, isBaseLayer: false, visibility: false }, options);
 137+ var newArguments = [name, url, options];
 138+ OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
 139+ },
 140+
 141+ CLASS_NAME: "OpenLayers.Layer.OSM.Maplint"
 142+});

Status & tagging log