source: src/django_gheat/website/static/OpenStreetMap.js@ 9316

Last change on this file since 9316 was 9302, checked in by dennisw, 13 years ago

Added/changed/clarified some comments in code.

File size: 6.4 KB
Line 
1/**
2 * Namespace: Util.OSM
3 */
4OpenLayers.Util.OSM = {};
5
6/**
7 * Constant: MISSING_TILE_URL
8 * {String} URL of image to display for missing tiles
9 */
10OpenLayers.Util.OSM.MISSING_TILE_URL = "http://openstreetmap.org/openlayers/img/404.png";
11
12/**
13 * Property: originalOnImageLoadError
14 * {Function} Original onImageLoadError function.
15 */
16OpenLayers.Util.OSM.originalOnImageLoadError = OpenLayers.Util.onImageLoadError;
17
18/**
19 * Function: onImageLoadError
20 */
21OpenLayers.Util.onImageLoadError = function() {
22 if (this.src.match(/^http:\/\/[abc]\.[a-z]+\.openstreetmap\.org\//)) {
23 this.src = OpenLayers.Util.OSM.MISSING_TILE_URL;
24 } else if (this.src.match(/^http:\/\/[def]\.tah\.openstreetmap\.org\//)) {
25 // do nothing - this layer is transparent
26 } else {
27 OpenLayers.Util.OSM.originalOnImageLoadError;
28 }
29};
30
31/**
32 * Class: OpenLayers.Layer.OSM.Mapnik
33 *
34 * Inherits from:
35 * - <OpenLayers.Layer.OSM>
36 */
37OpenLayers.Layer.OSM.Mapnik = OpenLayers.Class(OpenLayers.Layer.OSM, {
38 /**
39 * Constructor: OpenLayers.Layer.OSM.Mapnik
40 *
41 * Parameters:
42 * name - {String}
43 * options - {Object} Hashtable of extra options to tag onto the layer
44 */
45 initialize: function(name, options) {
46 var url = [
47 "/website/osm-proxy/${z}/${x},${y}.png",
48 ];
49 options = OpenLayers.Util.extend({ numZoomLevels: 19 }, options);
50 var newArguments = [name, url, options];
51 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
52 },
53
54 CLASS_NAME: "OpenLayers.Layer.OSM.Mapnik"
55});
56
57/**
58 * Class: OpenLayers.Layer.OSM.Osmarender
59 *
60 * Inherits from:
61 * - <OpenLayers.Layer.OSM>
62 */
63OpenLayers.Layer.OSM.Osmarender = OpenLayers.Class(OpenLayers.Layer.OSM, {
64 /**
65 * Constructor: OpenLayers.Layer.OSM.Osmarender
66 *
67 * Parameters:
68 * name - {String}
69 * options - {Object} Hashtable of extra options to tag onto the layer
70 */
71 initialize: function(name, options) {
72 var url = [
73 "http://a.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png",
74 "http://b.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png",
75 "http://c.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png"
76 ];
77 options = OpenLayers.Util.extend({ numZoomLevels: 18 }, options);
78 var newArguments = [name, url, options];
79 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
80 },
81
82 CLASS_NAME: "OpenLayers.Layer.OSM.Osmarender"
83});
84
85/**
86 * Class: OpenLayers.Layer.OSM.CycleMap
87 *
88 * Inherits from:
89 * - <OpenLayers.Layer.OSM>
90 */
91OpenLayers.Layer.OSM.CycleMap = OpenLayers.Class(OpenLayers.Layer.OSM, {
92 /**
93 * Constructor: OpenLayers.Layer.OSM.CycleMap
94 *
95 * Parameters:
96 * name - {String}
97 * options - {Object} Hashtable of extra options to tag onto the layer
98 */
99 initialize: function(name, options) {
100 var url = [
101 "http://a.andy.sandbox.cloudmade.com/tiles/cycle/${z}/${x}/${y}.png",
102 "http://b.andy.sandbox.cloudmade.com/tiles/cycle/${z}/${x}/${y}.png",
103 "http://c.andy.sandbox.cloudmade.com/tiles/cycle/${z}/${x}/${y}.png"
104 ];
105 options = OpenLayers.Util.extend({ numZoomLevels: 19 }, options);
106 var newArguments = [name, url, options];
107 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
108 },
109
110 CLASS_NAME: "OpenLayers.Layer.OSM.CycleMap"
111});
112
113/**
114 * Class: OpenLayers.Layer.OSM.Maplint
115 *
116 * Inherits from:
117 * - <OpenLayers.Layer.OSM>
118 */
119OpenLayers.Layer.OSM.Maplint = OpenLayers.Class(OpenLayers.Layer.OSM, {
120 /**
121 * Constructor: OpenLayers.Layer.OSM.Maplint
122 *
123 * Parameters:
124 * name - {String}
125 * options - {Object} Hashtable of extra options to tag onto the layer
126 */
127 initialize: function(name, options) {
128 var url = [
129 "http://d.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png",
130 "http://e.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png",
131 "http://f.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png"
132 ];
133 options = OpenLayers.Util.extend({ numZoomLevels: 21, isBaseLayer: false, visibility: false }, options);
134 var newArguments = [name, url, options];
135 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
136 },
137
138 CLASS_NAME: "OpenLayers.Layer.OSM.Maplint"
139});
140
141/**
142 * Gheat layer
143 */
144OpenLayers.Layer.OSM.Overlay1 = OpenLayers.Class(OpenLayers.Layer.OSM, {
145 initialize: function(name, options) {
146 var url = [
147 "/gheat/classic/${z}/${x},${y}.png"
148 ];
149 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
150 var newArguments = [name, url, options];
151 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
152 },
153 colour: "0,0,0",
154 CLASS_NAME: "OpenLayers.Layer.Overlay"
155});
156
157/**
158 * All accespoints
159 */
160OpenLayers.Layer.OSM.Overlay2 = OpenLayers.Class(OpenLayers.Layer.OSM, {
161 initialize: function(name, options) {
162 var url = [
163 "/website/tile/${z}/${x},${y}.png?colour=90,90,90"
164 ];
165 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
166 var newArguments = [name, url, options];
167 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
168 },
169 colour: "90,90,90",
170 CLASS_NAME: "OpenLayers.Layer.Overlay"
171});
172
173/**
174 * Wireless Leiden nodes
175 */
176OpenLayers.Layer.OSM.Overlay3 = OpenLayers.Class(OpenLayers.Layer.OSM, {
177 initialize: function(name, options) {
178 var url = [
179 "/website/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__ssid__icontains=WirelessLeiden"
180 ];
181 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
182 var newArguments = [name, url, options];
183 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
184 },
185 colour: "255,0,0",
186 CLASS_NAME: "OpenLayers.Layer.Overlay"
187});
188
189/**
190 * Signal strength
191 */
192OpenLayers.Layer.OSM.Overlay4 = OpenLayers.Class(OpenLayers.Layer.OSM, {
193 initialize: function(name, options) {
194 var url = [
195 "/website/tile/${z}/${x},${y}.png?colour=250,250,0&signaal__gte=0&signaal__lte=100"
196 ];
197 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
198 var newArguments = [name, url, options];
199 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
200 },
201 colour: "250,250,0",
202 CLASS_NAME: "OpenLayers.Layer.Overlay"
203});
Note: See TracBrowser for help on using the repository browser.