source: src/django_gheat/wlheatmap/templates/js/LayerBase.js@ 9583

Last change on this file since 9583 was 9579, checked in by rick, 13 years ago

Map a SSID to an organization to play nice with differnt SSIDs.

File size: 6.8 KB
RevLine 
[9139]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
[9382]31function get_balanced_urls(prefix, balancers, suffix) {
32 var urls = [];
[9544]33 for (var i=0; i < balancers.length; i++) {
[9382]34 urls.push(prefix + balancers[i] + suffix);
35 };
36 return urls;
37};
38
39
[9544]40
[9139]41/**
42 * Class: OpenLayers.Layer.OSM.Mapnik
43 *
44 * Inherits from:
45 * - <OpenLayers.Layer.OSM>
46 */
47OpenLayers.Layer.OSM.Mapnik = OpenLayers.Class(OpenLayers.Layer.OSM, {
48 /**
49 * Constructor: OpenLayers.Layer.OSM.Mapnik
50 *
51 * Parameters:
52 * name - {String}
53 * options - {Object} Hashtable of extra options to tag onto the layer
54 */
55 initialize: function(name, options) {
[9549]56 var url = get_balanced_urls('http://', {{ settings.OSM_PROXY_CDN_DOMAINS|safe }}, '{{ settings.OSM_PREFIX }}/${z}/${x}/${y}.png');
[9139]57 options = OpenLayers.Util.extend({ numZoomLevels: 19 }, options);
58 var newArguments = [name, url, options];
59 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
60 },
61
62 CLASS_NAME: "OpenLayers.Layer.OSM.Mapnik"
63});
64
65/**
66 * Class: OpenLayers.Layer.OSM.Osmarender
67 *
68 * Inherits from:
69 * - <OpenLayers.Layer.OSM>
70 */
71OpenLayers.Layer.OSM.Osmarender = OpenLayers.Class(OpenLayers.Layer.OSM, {
72 /**
73 * Constructor: OpenLayers.Layer.OSM.Osmarender
74 *
75 * Parameters:
76 * name - {String}
77 * options - {Object} Hashtable of extra options to tag onto the layer
78 */
79 initialize: function(name, options) {
80 var url = [
81 "http://a.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png",
82 "http://b.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png",
83 "http://c.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png"
84 ];
85 options = OpenLayers.Util.extend({ numZoomLevels: 18 }, options);
86 var newArguments = [name, url, options];
87 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
88 },
89
90 CLASS_NAME: "OpenLayers.Layer.OSM.Osmarender"
91});
92
93/**
94 * Class: OpenLayers.Layer.OSM.CycleMap
95 *
96 * Inherits from:
97 * - <OpenLayers.Layer.OSM>
98 */
99OpenLayers.Layer.OSM.CycleMap = OpenLayers.Class(OpenLayers.Layer.OSM, {
100 /**
101 * Constructor: OpenLayers.Layer.OSM.CycleMap
102 *
103 * Parameters:
104 * name - {String}
105 * options - {Object} Hashtable of extra options to tag onto the layer
106 */
107 initialize: function(name, options) {
108 var url = [
109 "http://a.andy.sandbox.cloudmade.com/tiles/cycle/${z}/${x}/${y}.png",
110 "http://b.andy.sandbox.cloudmade.com/tiles/cycle/${z}/${x}/${y}.png",
111 "http://c.andy.sandbox.cloudmade.com/tiles/cycle/${z}/${x}/${y}.png"
112 ];
113 options = OpenLayers.Util.extend({ numZoomLevels: 19 }, options);
114 var newArguments = [name, url, options];
115 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
116 },
117
118 CLASS_NAME: "OpenLayers.Layer.OSM.CycleMap"
119});
120
121/**
122 * Class: OpenLayers.Layer.OSM.Maplint
123 *
124 * Inherits from:
125 * - <OpenLayers.Layer.OSM>
126 */
127OpenLayers.Layer.OSM.Maplint = OpenLayers.Class(OpenLayers.Layer.OSM, {
128 /**
129 * Constructor: OpenLayers.Layer.OSM.Maplint
130 *
131 * Parameters:
132 * name - {String}
133 * options - {Object} Hashtable of extra options to tag onto the layer
134 */
135 initialize: function(name, options) {
136 var url = [
137 "http://d.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png",
138 "http://e.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png",
139 "http://f.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png"
140 ];
141 options = OpenLayers.Util.extend({ numZoomLevels: 21, isBaseLayer: false, visibility: false }, options);
142 var newArguments = [name, url, options];
143 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
144 },
145
146 CLASS_NAME: "OpenLayers.Layer.OSM.Maplint"
147});
148
[9302]149/**
150 * Gheat layer
151 */
[9139]152OpenLayers.Layer.OSM.Overlay1 = OpenLayers.Class(OpenLayers.Layer.OSM, {
153 initialize: function(name, options) {
154 var url = [
155 "/gheat/classic/${z}/${x},${y}.png"
156 ];
157 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
158 var newArguments = [name, url, options];
159 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
160 },
[9274]161 colour: "0,0,0",
[9271]162 CLASS_NAME: "OpenLayers.Layer.Overlay"
[9139]163});
[9147]164
[9302]165/**
166 * All accespoints
167 */
[9147]168OpenLayers.Layer.OSM.Overlay2 = OpenLayers.Class(OpenLayers.Layer.OSM, {
169 initialize: function(name, options) {
[9579]170 var url = get_balanced_urls('http://', {{ settings.DJANGO_CDN_DOMAINS|safe }},
171 '{{ settings.DJANGO_PREFIX }}/wlheatmap/tile/${z}/${x},${y}.png?colour=90,90,90');
[9147]172 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
173 var newArguments = [name, url, options];
174 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
175 },
[9274]176 colour: "90,90,90",
[9271]177 CLASS_NAME: "OpenLayers.Layer.Overlay"
[9147]178});
[9166]179
[9302]180/**
181 * Wireless Leiden nodes
182 */
[9166]183OpenLayers.Layer.OSM.Overlay3 = OpenLayers.Class(OpenLayers.Layer.OSM, {
184 initialize: function(name, options) {
[9579]185 var url = get_balanced_urls('http://', {{ settings.DJANGO_CDN_DOMAINS|safe }},
186 '{{ settings.DJANGO_PREFIX }}/wlheatmap/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__organization=WirelessLeiden');
[9166]187 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
188 var newArguments = [name, url, options];
189 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
190 },
[9274]191 colour: "255,0,0",
[9271]192 CLASS_NAME: "OpenLayers.Layer.Overlay"
[9166]193});
[9275]194
[9302]195/**
196 * Signal strength
197 */
[9275]198OpenLayers.Layer.OSM.Overlay4 = OpenLayers.Class(OpenLayers.Layer.OSM, {
199 initialize: function(name, options) {
[9579]200 var url = get_balanced_urls('http://', {{ settings.DJANGO_CDN_DOMAINS|safe }},
201 '{{ settings.DJANGO_PREFIX }}/wlheatmap/tile/${z}/${x},${y}.png?colour=50,150,50&signaal__gte=0&signaal__lte=100');
[9275]202 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
203 var newArguments = [name, url, options];
204 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
205 },
[9401]206 colour: "50,150,50",
[9275]207 CLASS_NAME: "OpenLayers.Layer.Overlay"
208});
Note: See TracBrowser for help on using the repository browser.