mapstraction-rails 2.0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. data/Gemfile +4 -0
  2. data/Gemfile.lock +14 -0
  3. data/LICENSE +22 -0
  4. data/README.md +32 -0
  5. data/Rakefile +2 -0
  6. data/lib/mapstraction/engine.rb +4 -0
  7. data/lib/mapstraction/version.rb +3 -0
  8. data/lib/mapstraction.rb +5 -0
  9. data/mapstraction/.gitignore +17 -0
  10. data/mapstraction.gemspec +17 -0
  11. data/vendor/.DS_Store +0 -0
  12. data/vendor/assets/.DS_Store +0 -0
  13. data/vendor/assets/javascripts/mxn-min.js +15 -0
  14. data/vendor/assets/javascripts/mxn.cartociudad.geocoder-min.js +15 -0
  15. data/vendor/assets/javascripts/mxn.cartociudad.geocoder.js +46 -0
  16. data/vendor/assets/javascripts/mxn.cloudmade.core-min.js +15 -0
  17. data/vendor/assets/javascripts/mxn.cloudmade.core.js +383 -0
  18. data/vendor/assets/javascripts/mxn.core-min.js +15 -0
  19. data/vendor/assets/javascripts/mxn.core.js +1892 -0
  20. data/vendor/assets/javascripts/mxn.geocoder-min.js +15 -0
  21. data/vendor/assets/javascripts/mxn.geocoder.js +74 -0
  22. data/vendor/assets/javascripts/mxn.geocommons.core-min.js +15 -0
  23. data/vendor/assets/javascripts/mxn.geocommons.core.js +343 -0
  24. data/vendor/assets/javascripts/mxn.google.core-min.js +15 -0
  25. data/vendor/assets/javascripts/mxn.google.core.js +536 -0
  26. data/vendor/assets/javascripts/mxn.google.geocoder-min.js +15 -0
  27. data/vendor/assets/javascripts/mxn.google.geocoder.js +87 -0
  28. data/vendor/assets/javascripts/mxn.googleearth.core-min.js +15 -0
  29. data/vendor/assets/javascripts/mxn.googleearth.core.js +350 -0
  30. data/vendor/assets/javascripts/mxn.googlev3.core-min.js +15 -0
  31. data/vendor/assets/javascripts/mxn.googlev3.core.js +630 -0
  32. data/vendor/assets/javascripts/mxn.googlev3.geocoder-min.js +15 -0
  33. data/vendor/assets/javascripts/mxn.googlev3.geocoder.js +101 -0
  34. data/vendor/assets/javascripts/mxn.js +581 -0
  35. data/vendor/assets/javascripts/mxn.leaflet.core-min.js +15 -0
  36. data/vendor/assets/javascripts/mxn.leaflet.core.js +398 -0
  37. data/vendor/assets/javascripts/mxn.mapquest.geocoder-min.js +15 -0
  38. data/vendor/assets/javascripts/mxn.mapquest.geocoder.js +63 -0
  39. data/vendor/assets/javascripts/mxn.microsoft.core-min.js +15 -0
  40. data/vendor/assets/javascripts/mxn.microsoft.core.js +429 -0
  41. data/vendor/assets/javascripts/mxn.microsoft7.core-min.js +15 -0
  42. data/vendor/assets/javascripts/mxn.microsoft7.core.js +458 -0
  43. data/vendor/assets/javascripts/mxn.microsoft7.geocoder-min.js +15 -0
  44. data/vendor/assets/javascripts/mxn.microsoft7.geocoder.js +66 -0
  45. data/vendor/assets/javascripts/mxn.multimap.core-min.js +15 -0
  46. data/vendor/assets/javascripts/mxn.multimap.core.js +473 -0
  47. data/vendor/assets/javascripts/mxn.openlayers.core-min.js +15 -0
  48. data/vendor/assets/javascripts/mxn.openlayers.core.js +630 -0
  49. data/vendor/assets/javascripts/mxn.openlayers.geocoder-min.js +15 -0
  50. data/vendor/assets/javascripts/mxn.openlayers.geocoder.js +106 -0
  51. data/vendor/assets/javascripts/mxn.openmq.core-min.js +15 -0
  52. data/vendor/assets/javascripts/mxn.openmq.core.js +364 -0
  53. data/vendor/assets/javascripts/mxn.openspace.core-min.js +15 -0
  54. data/vendor/assets/javascripts/mxn.openspace.core.js +460 -0
  55. data/vendor/assets/javascripts/mxn.ovi.core-min.js +15 -0
  56. data/vendor/assets/javascripts/mxn.ovi.core.js +508 -0
  57. data/vendor/assets/javascripts/mxn.ovi.geocoder-min.js +15 -0
  58. data/vendor/assets/javascripts/mxn.ovi.geocoder.js +129 -0
  59. data/vendor/assets/javascripts/mxn.yahoo.core-min.js +15 -0
  60. data/vendor/assets/javascripts/mxn.yahoo.core.js +406 -0
  61. data/vendor/assets/javascripts/mxn.yandex.core-min.js +15 -0
  62. data/vendor/assets/javascripts/mxn.yandex.core.js +527 -0
  63. data/vendor/assets/javascripts/mxn.yandex.geocoder-min.js +15 -0
  64. data/vendor/assets/javascripts/mxn.yandex.geocoder.js +66 -0
  65. metadata +110 -0
@@ -0,0 +1,508 @@
1
+ /*
2
+ MAPSTRACTION v2.0.18 http://www.mapstraction.com
3
+
4
+ Copyright (c) 2012 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler, Gary Gale
5
+ All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11
+ * Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
+ */
15
+ mxn.register('ovi', {
16
+
17
+ Mapstraction: {
18
+
19
+ init: function(element, api) {
20
+ var me = this;
21
+ var ovi_map;
22
+ var mapLoaded = false;
23
+
24
+ var eventStates = {
25
+ "center": false,
26
+ "zoom": false,
27
+ "mapsize": false
28
+ };
29
+
30
+ if (ovi.mapsapi) {
31
+ ovi_map = new ovi.mapsapi.map.Display (element);
32
+ ovi_map.addComponent(new ovi.mapsapi.map.component.InfoBubbles());
33
+ ovi_map.addComponent(new ovi.mapsapi.map.component.Behavior());
34
+
35
+ // Handle click event
36
+ ovi_map.addListener('click', function(event){
37
+ coords = ovi_map.pixelToGeo(event.targetX, event.targetY);
38
+ me.click.fire({'location': new mxn.LatLonPoint(coords.latitude, coords.longitude)});
39
+ });
40
+
41
+ // Handle endPan (via centre change) and zoom events
42
+ // the Ovi Maps API doesn't have a discrete event for each of these events
43
+ // instead it uses a start/update/end sequence of events, where update may happen
44
+ // multiple times or not at all, so we need to keep track of which Ovi events have
45
+ // fired during a start(/update) event sequence and then fire the relevent Mapstraction
46
+ // events upon receiving the Ovi end event
47
+ ovi_map.addListener('mapviewchangestart', function(event){
48
+ if (event.data & event.MAPVIEWCHANGE_CENTER) {
49
+ eventStates.center = true;
50
+ }
51
+ if (event.data & event.MAPVIEWCHANGE_ZOOM) {
52
+ eventStates.zoom = true;
53
+ }
54
+ if (event.data & event.MAPVIEWCHANGE_SIZE) {
55
+ eventStates.mapsize = true;
56
+ }
57
+ });
58
+
59
+ ovi_map.addListener('mapviewchangeupdate', function(event){
60
+ if (event.data & event.MAPVIEWCHANGE_CENTER) {
61
+ eventStates.center = true;
62
+ }
63
+ if (event.data & event.MAPVIEWCHANGE_ZOOM) {
64
+ eventStates.zoom = true;
65
+ }
66
+ if (event.data & event.MAPVIEWCHANGE_SIZE) {
67
+ eventStates.mapsize = true;
68
+ }
69
+ });
70
+
71
+ ovi_map.addListener('mapviewchangeend', function(event){
72
+ // The Ovi Maps API doesn't support a "map loaded" event, but both a
73
+ // "centre" and "size" mapviewchangestart/mapviewchangeupdate/mapviewchangeend
74
+ // event sequence will be fired as part of the initial loading so we can trap
75
+ // this and fire the MXN "load" event.
76
+
77
+ if (!mapLoaded) {
78
+ if (eventStates.center && eventStates.mapsize) {
79
+ mapLoaded = true;
80
+ eventStates.mapsize = false;
81
+ me.load.fire();
82
+ }
83
+ }
84
+ else {
85
+ if (eventStates.center) {
86
+ eventStates.center = false;
87
+ me.moveendHandler(me);
88
+ me.endPan.fire();
89
+ }
90
+ }
91
+
92
+ if (eventStates.zoom) {
93
+ eventStates.zoom = false;
94
+ me.changeZoom.fire();
95
+ }
96
+ });
97
+
98
+ this.maps[api] = ovi_map;
99
+ this.loaded[api] = true;
100
+ }
101
+
102
+ else {
103
+ alert(api + ' map script not imported');
104
+ }
105
+ },
106
+
107
+ applyOptions: function() {
108
+ var map = this.maps[this.api];
109
+
110
+ if (this.options.enableScrollWheelZoom) {
111
+ map.addComponent(new ovi.mapsapi.map.component.zoom.MouseWheel());
112
+ }
113
+ else {
114
+ var mousewheel = map.getComponentById('zoom.MouseWheel');
115
+ if (mousewheel) {
116
+ map.removeComponent(mousewheel);
117
+ }
118
+ }
119
+ },
120
+
121
+ resizeTo: function(width, height) {
122
+ this.currentElement.style.width = width;
123
+ this.currentElement.style.height = height;
124
+ },
125
+
126
+ addControls: function(args) {
127
+ /* args = {
128
+ * pan: true,
129
+ * zoom: 'large' || 'small',
130
+ * overview: true,
131
+ * scale: true,
132
+ * map_type: true,
133
+ * }
134
+ */
135
+
136
+ var map = this.maps[this.api];
137
+
138
+ if (args.pan) {
139
+ map.addComponent(new ovi.mapsapi.map.component.Behavior());
140
+ }
141
+
142
+ // TODO: The Ovi Maps API doesn't currently differentiate between large and small
143
+ // style of Zoom controls so, for now, make them functionally equivalent
144
+ if (args.zoom == 'large' || args.zoom == 'small') {
145
+ map.addComponent(new ovi.mapsapi.map.component.ZoomBar());
146
+ }
147
+
148
+ if (args.overview) {
149
+ map.addComponent(new ovi.mapsapi.map.component.Overview());
150
+ }
151
+
152
+ if (args.scale) {
153
+ map.addComponent(new ovi.mapsapi.map.component.ScaleBar ());
154
+ }
155
+
156
+ if (args.map_type) {
157
+ map.addComponent(new ovi.mapsapi.map.component.TypeSelector ());
158
+ }
159
+ },
160
+
161
+ // TODO: The Ovi Maps API doesn't currently differentiate between large and small
162
+ // style of Zoom controls so, for now, make them functionally equivalent
163
+ addSmallControls: function() {
164
+ var map = this.maps[this.api];
165
+ map.addComponent(new ovi.mapsapi.map.component.ZoomBar());
166
+ },
167
+
168
+ addLargeControls: function() {
169
+ var map = this.maps[this.api];
170
+ map.addComponent(new ovi.mapsapi.map.component.ZoomBar());
171
+ },
172
+
173
+ addMapTypeControls: function() {
174
+ var map = this.maps[this.api];
175
+
176
+ map.addComponent(new ovi.mapsapi.map.component.TypeSelector ());
177
+ },
178
+
179
+ setCenterAndZoom: function(point, zoom) {
180
+ var map = this.maps[this.api];
181
+ var pt = point.toProprietary(this.api);
182
+
183
+ map.setCenter(pt);
184
+ map.setZoomLevel(zoom);
185
+ },
186
+
187
+ addMarker: function(marker, old) {
188
+ var map = this.maps[this.api];
189
+ var ovi_marker = marker.toProprietary(this.api);
190
+
191
+ map.objects.add(ovi_marker);
192
+ return ovi_marker;
193
+ },
194
+
195
+ removeMarker: function(marker) {
196
+ var map = this.maps[this.api];
197
+
198
+ map.objects.remove(marker.proprietary_marker);
199
+ },
200
+
201
+ declutterMarkers: function(opts) {
202
+ throw 'Not supported';
203
+ },
204
+
205
+ addPolyline: function(polyline, old) {
206
+ var map = this.maps[this.api];
207
+ var ovi_polyline = polyline.toProprietary(this.api);
208
+
209
+ map.objects.add(ovi_polyline);
210
+ return ovi_polyline;
211
+ },
212
+
213
+ removePolyline: function(polyline) {
214
+ var map = this.maps[this.api];
215
+
216
+ map.objects.remove(polyline.proprietary_polyline);
217
+ },
218
+
219
+ getCenter: function() {
220
+ var map = this.maps[this.api];
221
+
222
+ return new mxn.LatLonPoint(map.center.latitude, map.center.longitude);
223
+ },
224
+
225
+ setCenter: function(point, options) {
226
+ var map = this.maps[this.api];
227
+ var pt = point.toProprietary(this.api);
228
+
229
+ map.setCentre(pt);
230
+ },
231
+
232
+ setZoom: function(zoom) {
233
+ var map = this.maps[this.api];
234
+
235
+ map.setZoomLevel(zoom);
236
+ },
237
+
238
+ getZoom: function() {
239
+ var map = this.maps[this.api];
240
+
241
+ return map.zoomLevel;
242
+ },
243
+
244
+ getZoomLevelForBoundingBox: function(bbox) {
245
+ var map = this.maps[this.api];
246
+ var sw = bbox.getSouthWest().toProprietary(this.api);
247
+ var ne = bbox.getNorthEast().toProprietary(this.api);
248
+ var ovi_bb = new ovi.mapsapi.geo.BoundingBox(sw, ne);
249
+
250
+ return map.getBestZoomLevel(ovi_bb);
251
+ },
252
+
253
+ setMapType: function(type) {
254
+ var map = this.maps[this.api];
255
+
256
+ switch (type) {
257
+ case mxn.Mapstraction.ROAD:
258
+ map.set("baseMapType", map.NORMAL);
259
+ break;
260
+ case mxn.Mapstraction.PHYSICAL:
261
+ map.set("baseMapType", map.TERRAIN);
262
+ break;
263
+ case mxn.Mapstraction.HYBRID:
264
+ throw 'Not implemented';
265
+ case mxn.Mapstraction.SATELLITE:
266
+ map.set("baseMapType", map.SATELLITE);
267
+ break;
268
+ default:
269
+ map.set("baseMapType", map.NORMAL);
270
+ break;
271
+ } // end-switch ()
272
+ },
273
+
274
+ getMapType: function() {
275
+ var map = this.maps[this.api];
276
+ var type = map.baseMapType;
277
+
278
+ switch(type) {
279
+ case map.NORMAL:
280
+ return mxn.Mapstraction.ROAD;
281
+ case map.TERRAIN:
282
+ return mxn.Mapstraction.PHYSICAL;
283
+ case map.SATELLITE:
284
+ return mxn.Mapstraction.SATELLITE;
285
+ default:
286
+ return null;
287
+ } // end-switch ()
288
+ },
289
+
290
+ getBounds: function() {
291
+ var map = this.maps[this.api];
292
+ var bbox = map.getViewBounds();
293
+ var nw = bbox.topLeft;
294
+ var se = bbox.bottomRight;
295
+
296
+ return new mxn.BoundingBox(se.latitude, nw.longitude, nw.latitude, se.longitude);
297
+ },
298
+
299
+ setBounds: function(bounds) {
300
+ var map = this.maps[this.api];
301
+
302
+ var sw = bounds.getSouthWest();
303
+ var ne = bounds.getNorthEast();
304
+
305
+ var nw = new mxn.LatLonPoint(ne.lat, sw.lon).toProprietary(this.api);
306
+ var se = new mxn.LatLonPoint(sw.lat, ne.lon).toProprietary(this.api);
307
+ var ovi_bb = new ovi.mapsapi.geo.BoundingBox(nw, se);
308
+ var keepCentre = false;
309
+ map.zoomTo(ovi_bb, keepCentre);
310
+ },
311
+
312
+ addImageOverlay: function(id, src, opacity, west, south, east, north, oContext) {
313
+ throw 'Not implemented';
314
+ },
315
+
316
+ setImagePosition: function(id, oContext) {
317
+ throw 'Not implemented';
318
+ },
319
+
320
+ addOverlay: function(url, autoCenterAndZoom) {
321
+ throw 'Not implemented';
322
+ },
323
+
324
+ addTileLayer: function(tile_url, opacity, copyright_text, min_zoom, max_zoom, map_type) {
325
+ throw 'Not implemented';
326
+ },
327
+
328
+ toggleTileLayer: function(tile_url) {
329
+ throw 'Not implemented';
330
+ },
331
+
332
+ getPixelRatio: function() {
333
+ throw 'Not implemented';
334
+ },
335
+
336
+ mousePosition: function(element) {
337
+ var map = this.maps[this.api];
338
+ var locDisp = document.getElementById(element);
339
+ var coords;
340
+
341
+ if (locDisp !== null) {
342
+ map.addListener('mousemove', function(event){
343
+ coords = map.pixelToGeo(event.targetX, event.targetY);
344
+ locDisp.innerHTML = coords.latitude.toFixed(4) + ' / ' + coords.longitude.toFixed(4);
345
+ });
346
+ locDisp.innerHTML = '0.0000 / 0.0000';
347
+ }
348
+ }
349
+ },
350
+
351
+ LatLonPoint: {
352
+
353
+ toProprietary: function() {
354
+ return new ovi.mapsapi.geo.Coordinate(this.lat, this.lon);
355
+ },
356
+
357
+ fromProprietary: function(oviCoordinate) {
358
+ this.lat = oviCoordinate.latitude;
359
+ this.lon = oviCoordinate.longitude;
360
+ }
361
+ },
362
+
363
+ Marker: {
364
+
365
+ toProprietary: function() {
366
+ var properties = [];
367
+ var self = this;
368
+
369
+ if (this.iconAnchor) {
370
+ properties.anchor = [this.iconAnchor[0], this.iconAnchor[1]];
371
+ }
372
+ if (this.iconUrl) {
373
+ properties.icon = this.iconUrl;
374
+ }
375
+
376
+ this.proprietary_infobubble = null;
377
+
378
+ var prop_marker = new ovi.mapsapi.map.Marker(
379
+ self.location.toProprietary('ovi'),
380
+ properties);
381
+
382
+ if (this.infoBubble) {
383
+ var event_action = "click";
384
+ if (this.hover) {
385
+ event_action = "mouseover";
386
+ }
387
+ prop_marker.addListener(event_action, function() {
388
+ self.openBubble();
389
+ });
390
+ }
391
+
392
+ if (this.draggable) {
393
+ prop_marker.enableDrag();
394
+
395
+ prop_marker.addListener("dragstart", function(event){
396
+ var bc = self.map.getComponentById("InfoBubbles");
397
+
398
+ if (bc.bubbleExists(self.proprietary_infobubble)) {
399
+ self.closeBubble();
400
+ prop_marker.set("restore_infobubble", true);
401
+ }
402
+ }, false);
403
+
404
+ prop_marker.addListener("dragend", function(event){
405
+ var xy = event.dataTransfer.getData("application/map-drag-object-offset");
406
+ var new_coords = self.map.pixelToGeo(
407
+ event.displayX - xy.x + prop_marker.anchor.x,
408
+ event.displayY - xy.y + prop_marker.anchor.y
409
+ );
410
+ var bb = self.map.getBoundingBox();
411
+
412
+ if (bb.contains(new_coords)) {
413
+ self.location.lat = new_coords.latitude;
414
+ self.location.lon = new_coords.longitude;
415
+ }
416
+
417
+ if (prop_marker.get("restore_infobubble")) {
418
+ prop_marker.set("restore_infobubble", false);
419
+ self.openBubble();
420
+ }
421
+ }, false);
422
+ }
423
+
424
+ return prop_marker;
425
+ },
426
+
427
+ openBubble: function() {
428
+ if (!this.map) {
429
+ throw 'This marker must be added to a map in order to manage a Bubble';
430
+ }
431
+ this.proprietary_infobubble = this.map.getComponentById("InfoBubbles").addBubble(this.infoBubble, this.location.toProprietary('ovi'));
432
+ },
433
+
434
+ closeBubble: function() {
435
+ if (!this.map) {
436
+ throw 'This marker must be added to a map in order to manage a Bubble';
437
+ }
438
+
439
+ if (this.map.getComponentById("InfoBubbles").bubbleExists(this.proprietary_infobubble)) {
440
+ this.map.getComponentById("InfoBubbles").removeBubble(this.proprietary_infobubble);
441
+ }
442
+ this.proprietary_infobubble = null;
443
+ },
444
+
445
+ hide: function() {
446
+ this.proprietary_marker.set('visibility', false);
447
+ },
448
+
449
+ show: function() {
450
+ this.proprietary_marker.set('visibility', true);
451
+ },
452
+
453
+ update: function() {
454
+ throw 'Not implemented';
455
+ }
456
+
457
+ },
458
+
459
+ Polyline: {
460
+
461
+ toProprietary: function() {
462
+ var coords = [];
463
+
464
+ for (var i=0, length=this.points.length; i<length; i++) {
465
+ coords.push(this.points[i].toProprietary('ovi'));
466
+ }
467
+
468
+ if (this.closed || coords[0].equals(coords[length-1])) {
469
+ var polycolor = new mxn.util.Color();
470
+
471
+ polycolor.setHexColor(this.color || "#5462E3");
472
+
473
+ var polycolor_rgba = "rgba(" + polycolor.red + "," + polycolor.green + "," +
474
+ polycolor.blue + "," + (this.opacity || 1.0) + ")";
475
+ var polygon_options = {
476
+ 'visibility' : true,
477
+ 'fillColor' : polycolor_rgba,
478
+ 'color' : this.color || "#5462E3",
479
+ 'stroke' : 'solid',
480
+ 'width' : this.width || 1
481
+ };
482
+ this.proprietary_polyline = new ovi.mapsapi.map.Polygon (coords, polygon_options);
483
+ }
484
+
485
+ else {
486
+ var polyline_options = {
487
+ 'visibility' : true,
488
+ 'color' : this.color || "#5462E3",
489
+ 'stroke' : 'solid',
490
+ 'width' : this.width || 1
491
+ };
492
+ this.proprietary_polyline = new ovi.mapsapi.map.Polyline (coords, polyline_options);
493
+ }
494
+
495
+ return this.proprietary_polyline;
496
+ },
497
+
498
+ show: function() {
499
+ this.proprietary_polyline.set('visibility', true);
500
+ },
501
+
502
+ hide: function() {
503
+ this.proprietary_polyline.set('visibility', false);
504
+ }
505
+
506
+ }
507
+
508
+ });
@@ -0,0 +1,15 @@
1
+ /*
2
+ MAPSTRACTION v2.0.18 http://www.mapstraction.com
3
+
4
+ Copyright (c) 2012 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler, Gary Gale
5
+ All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11
+ * Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
+ */
15
+ mxn.register("ovi",{Geocoder:{init:function(){var b=this;var a;if(ovi.mapsapi){a=new ovi.mapsapi.search.Manager();a.addObserver("state",function(d,c,e){if(e=="finished"||e=="failed"){b.geocode_callback(d.locations,e)}});this.geocoders[this.api]=a}else{alert(api+" map script not imported")}},geocode:function(b){var a=this.geocoders[this.api];a.geocode(b)},geocode_callback:function(c,d){var b=this.geocoders[this.api];if(d=="failed"){var j=b.getErrorCause();var k="";if(j.type){k=j.type;if(j.subtype){k+=", "+j.subtype}if(j.message){k+=", "+j.message}}else{k="Geocoding failure"}this.error_callback(k)}else{if(d=="finished"){var g={};var e=[];var a=[];var f=[];g.street="";g.locality="";g.postcode="";g.region="";g.country="";if(c.length>0){var i=c[0].address;var h=c[0].displayPosition;if(i.street){e.push(i.street)}if(i.houseNumber){e.unshift(i.houseNumber)}if(i.city){a.push(i.city)}if(i.district){a.unshift(i.district)}if(i.postalCode){g.postcode=i.postalCode}if(i.state){f.unshift(i.state)}if(i.county){f.push(i.county)}if(i.country){g.country=i.country}if(g.street===""&&e.length>0){g.street=e.join(" ")}if(g.locality===""&&a.length>0){g.locality=a.join(", ")}if(g.region===""&&f.length>0){g.region=f.join(", ")}g.point=new mxn.LatLonPoint(h.latitude,h.longitude);this.callback(g)}}}}}});
@@ -0,0 +1,129 @@
1
+ /*
2
+ MAPSTRACTION v2.0.18 http://www.mapstraction.com
3
+
4
+ Copyright (c) 2012 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler, Gary Gale
5
+ All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11
+ * Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
+ */
15
+ mxn.register('ovi', {
16
+
17
+ Geocoder: {
18
+
19
+ init: function() {
20
+ var me = this;
21
+ var ovi_geocoder;
22
+
23
+ if (ovi.mapsapi) {
24
+ ovi_geocoder = new ovi.mapsapi.search.Manager();
25
+ ovi_geocoder.addObserver("state", function (manager, key, value){
26
+ if (value == "finished" || value == "failed") {
27
+ me.geocode_callback (manager.locations, value);
28
+ }
29
+ });
30
+ this.geocoders[this.api] = ovi_geocoder;
31
+ }
32
+
33
+ else {
34
+ alert(api + ' map script not imported');
35
+ }
36
+ },
37
+
38
+ geocode: function(address){
39
+ var ovi_geocoder = this.geocoders[this.api];
40
+
41
+ ovi_geocoder.geocode(address);
42
+ },
43
+
44
+ geocode_callback: function(response, status){
45
+ var ovi_geocoder = this.geocoders[this.api];
46
+
47
+ if (status == "failed") {
48
+ var error_cause = ovi_geocoder.getErrorCause();
49
+ var error_status = "";
50
+
51
+ if (error_cause.type) {
52
+ error_status = error_cause.type;
53
+ if (error_cause.subtype) {
54
+ error_status += ", " + error_cause.subtype;
55
+ }
56
+ if (error_cause.message) {
57
+ error_status += ", " + error_cause.message;
58
+ }
59
+ }
60
+
61
+ else {
62
+ error_status = "Geocoding failure";
63
+ }
64
+
65
+ this.error_callback(error_status);
66
+ }
67
+
68
+ else if (status == "finished") {
69
+ var return_location = {};
70
+ var street_components = [];
71
+ var locality_components = [];
72
+ var region_components = [];
73
+
74
+ return_location.street = '';
75
+ return_location.locality = '';
76
+ return_location.postcode = '';
77
+ return_location.region = '';
78
+ return_location.country = '';
79
+
80
+ if (response.length > 0) {
81
+ var address = response[0].address;
82
+ var coords = response[0].displayPosition;
83
+
84
+ if (address.street) {
85
+ street_components.push(address.street);
86
+ }
87
+ if (address.houseNumber) {
88
+ street_components.unshift(address.houseNumber);
89
+ }
90
+
91
+ if (address.city) {
92
+ locality_components.push(address.city);
93
+ }
94
+ if (address.district) {
95
+ locality_components.unshift(address.district);
96
+ }
97
+
98
+ if (address.postalCode) {
99
+ return_location.postcode = address.postalCode;
100
+ }
101
+
102
+ if (address.state) {
103
+ region_components.unshift(address.state);
104
+ }
105
+ if (address.county) {
106
+ region_components.push(address.county);
107
+ }
108
+
109
+ if (address.country) {
110
+ return_location.country = address.country;
111
+ }
112
+
113
+ if (return_location.street === '' && street_components.length > 0) {
114
+ return_location.street = street_components.join(' ');
115
+ }
116
+ if (return_location.locality === '' && locality_components.length > 0) {
117
+ return_location.locality = locality_components.join(', ');
118
+ }
119
+ if (return_location.region === '' && region_components.length > 0) {
120
+ return_location.region = region_components.join(', ');
121
+ }
122
+
123
+ return_location.point = new mxn.LatLonPoint(coords.latitude, coords.longitude);
124
+ this.callback(return_location);
125
+ }
126
+ }
127
+ }
128
+ }
129
+ });
@@ -0,0 +1,15 @@
1
+ /*
2
+ MAPSTRACTION v2.0.18 http://www.mapstraction.com
3
+
4
+ Copyright (c) 2012 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler, Gary Gale
5
+ All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11
+ * Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
+ */
15
+ mxn.register("yahoo",{Mapstraction:{init:function(a,b){var c=this;if(YMap){this.maps[b]=new YMap(a);YEvent.Capture(this.maps[b],EventsList.MouseClick,function(e,d){c.clickHandler(d.Lat,d.Lon,d,c);c.click.fire({location:new mxn.LatLonPoint(d.Lat,d.Lon)})});YEvent.Capture(this.maps[b],EventsList.changeZoom,function(){c.moveendHandler(c);c.changeZoom.fire()});YEvent.Capture(this.maps[b],EventsList.endPan,function(){c.moveendHandler(c);c.endPan.fire()});YEvent.Capture(this.maps[b],EventsList.endAutoPan,function(){c.endPan.fire()});this.loaded[b]=true;c.load.fire()}else{alert(b+" map script not imported")}},applyOptions:function(){},resizeTo:function(b,a){this.maps[this.api].resizeTo(new YSize(b,a))},addControls:function(a){var b=this.maps[this.api];if(a.pan){b.addPanControl()}else{b.addPanControl();b.removePanControl()}if(a.zoom=="large"){b.addZoomLong()}else{if(a.zoom=="small"){b.addZoomShort()}else{b.removeZoomScale()}}},addSmallControls:function(){var a=this.maps[this.api];a.addPanControl();a.addZoomShort();this.addControlsArgs.pan=true;this.addControlsArgs.zoom="small"},addLargeControls:function(){var a=this.maps[this.api];a.addPanControl();a.addZoomLong();this.addControlsArgs.pan=true;this.addControlsArgs.zoom="large"},addMapTypeControls:function(){var a=this.maps[this.api];a.addTypeControl()},dragging:function(a){var b=this.maps[this.api];if(a){b.enableDragMap()}else{b.disableDragMap()}},setCenterAndZoom:function(a,c){var e=this.maps[this.api];var d=a.toProprietary(this.api);var b=18-c;e.drawZoomAndCenter(d,b)},addMarker:function(b,a){var d=this.maps[this.api];var c=b.toProprietary(this.api);d.addOverlay(c);YEvent.Capture(c,EventsList.MouseClick,function(){b.click.fire()});YEvent.Capture(c,EventsList.openSmartWindow,function(){b.openInfoBubble.fire()});YEvent.Capture(c,EventsList.closeSmartWindow,function(){b.closeInfoBubble.fire()});return c},removeMarker:function(a){var b=this.maps[this.api];b.removeOverlay(a.proprietary_marker)},declutterMarkers:function(a){throw"Not supported"},addPolyline:function(b,a){var d=this.maps[this.api];var c=b.toProprietary(this.api);d.addOverlay(c);return c},removePolyline:function(a){var b=this.maps[this.api];b.removeOverlay(a.proprietary_polyline)},getCenter:function(){var c=this.maps[this.api];var b=c.getCenterLatLon();var a=new mxn.LatLonPoint(b.Lat,b.Lon);return a},setCenter:function(a,b){var d=this.maps[this.api];var c=a.toProprietary(this.api);d.panToLatLon(c)},setZoom:function(b){var c=this.maps[this.api];var a=18-b;c.setZoomLevel(a)},getZoom:function(){var a=this.maps[this.api];return 18-a.getZoomLevel()},getZoomLevelForBoundingBox:function(a){throw"Not implemented"},setMapType:function(a){var b=this.maps[this.api];switch(a){case mxn.Mapstraction.ROAD:b.setMapType(YAHOO_MAP_REG);break;case mxn.Mapstraction.SATELLITE:b.setMapType(YAHOO_MAP_SAT);break;case mxn.Mapstraction.HYBRID:b.setMapType(YAHOO_MAP_HYB);break;default:b.setMapType(YAHOO_MAP_REG)}},getMapType:function(){var b=this.maps[this.api];var a=b.getCurrentMapType();switch(a){case YAHOO_MAP_REG:return mxn.Mapstraction.ROAD;case YAHOO_MAP_SAT:return mxn.Mapstraction.SATELLITE;case YAHOO_MAP_HYB:return mxn.Mapstraction.HYBRID;default:return null}},getBounds:function(){var b=this.maps[this.api];var a=b.getBoundsLatLon();return new mxn.BoundingBox(a.LatMin,a.LonMin,a.LatMax,a.LonMax)},setBounds:function(a){var c=this.maps[this.api];var h=a.getSouthWest();var e=a.getNorthEast();if(h.lon>e.lon){h.lon-=360}var b=new YGeoPoint((h.lat+e.lat)/2,(e.lon+h.lon)/2);var d=c.getContainerSize();for(var i=1;i<=17;i++){var f=mxn.util.convertLatLonXY_Yahoo(h,i);var g=mxn.util.convertLatLonXY_Yahoo(e,i);if(f.x>g.x){f.x-=(1<<(26-i))}if(Math.abs(g.x-f.x)<=d.width&&Math.abs(g.y-f.y)<=d.height){c.drawZoomAndCenter(b,i);break}}},addImageOverlay:function(h,g,b,a,e,d,f,c){throw"Not implemented"},setImagePosition:function(a){throw"Not implemented"},addOverlay:function(a,b){var c=this.maps[this.api];c.addOverlay(new YGeoRSS(a))},addTileLayer:function(e,a,b,c,d){throw"Not implemented"},toggleTileLayer:function(a){throw"Not implemented"},getPixelRatio:function(){throw"Not implemented"},mousePosition:function(a){throw"Not implemented"}},LatLonPoint:{toProprietary:function(){return new YGeoPoint(this.lat,this.lon)},fromProprietary:function(a){this.lat=a.Lat;this.lon=a.Lon}},Marker:{toProprietary:function(){var b,d;var f,c,a,e;if(this.iconSize){d=new YSize(this.iconSize[0],this.iconSize[1])}if(this.iconUrl){if(this.iconSize){b=new YMarker(this.location.toProprietary("yahoo"),new YImage(this.iconUrl,d))}else{b=new YMarker(this.location.toProprietary("yahoo"),new YImage(this.iconUrl))}}else{if(this.iconSize){b=new YMarker(this.location.toProprietary("yahoo"),null,d)}else{b=new YMarker(this.location.toProprietary("yahoo"))}}if(this.labelText){b.addLabel(this.labelText)}if(this.infoBubble){f=this.infoBubble;if(this.hover){c=EventsList.MouseOver}else{c=EventsList.MouseClick}YEvent.Capture(b,c,function(){b.openSmartWindow(f)})}if(this.infoDiv){a=this.infoDiv;e=this.div;if(this.hover){c=EventsList.MouseOver}else{c=EventsList.MouseClick}YEvent.Capture(b,c,function(){document.getElementById(e).innerHTML=a})}return b},openBubble:function(){var a=this.proprietary_marker;a.openSmartWindow(this.infoBubble)},closeBubble:function(){var a=this.proprietary_marker;a.closeSmartWindow()},hide:function(){this.proprietary_marker.hide()},show:function(){this.proprietary_marker.unhide()},update:function(){throw"Not implemented"}},Polyline:{toProprietary:function(){var d;var c=[];for(var a=0,b=this.points.length;a<b;a++){c.push(this.points[a].toProprietary("yahoo"))}d=new YPolyline(c,this.color,this.width,this.opacity);return d},show:function(){throw"Not implemented"},hide:function(){throw"Not implemented"}}});