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,458 @@
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('microsoft7', {
16
+
17
+ Mapstraction: {
18
+ init: function(element, api) {
19
+ var me = this;
20
+
21
+ if (!Microsoft || !Microsoft.Maps) {
22
+ throw api + ' map script not imported';
23
+ }
24
+ this.maps[api] = new Microsoft.Maps.Map(element, { credentials: microsoft_key } );
25
+ //Add Click Event
26
+ element.addEventListener('contextmenu', function(evt) { evt.preventDefault(); });
27
+ Microsoft.Maps.Events.addHandler(this.maps[api], 'rightclick', function(event) {
28
+ var map = me.maps[me.api];
29
+ var _x = event.getX();
30
+ var _y = event.getY();
31
+ var pixel = new Microsoft.Maps.Point(_x, _y);
32
+ var ll = map.tryPixelToLocation(pixel);
33
+ var _event = {
34
+ 'location': new mxn.LatLonPoint(ll.latitude, ll.longitude),
35
+ 'position': {x:_x, y:_y},
36
+ 'button': 'right'
37
+ };
38
+ me.click.fire(_event);
39
+ });
40
+ Microsoft.Maps.Events.addHandler(this.maps[api], 'click', function(event){
41
+ var map = me.maps[me.api];
42
+ event.originalEvent.preventDefault();
43
+ if (event.targetType == 'pushpin') {
44
+ event.target.mapstraction_marker.click.fire();
45
+ }
46
+ else {
47
+ var _x = event.getX();
48
+ var _y = event.getY();
49
+ var pixel = new Microsoft.Maps.Point(_x, _y);
50
+ var ll = map.tryPixelToLocation(pixel);
51
+ var _event = {
52
+ 'location': new mxn.LatLonPoint(ll.latitude, ll.longitude),
53
+ 'position': {x:_x, y:_y},
54
+ 'button': event.isSecondary ? 'right' : 'left'
55
+ };
56
+ me.click.fire(_event);
57
+ }
58
+ });
59
+ Microsoft.Maps.Events.addHandler(this.maps[api], 'viewchangeend', function(event){
60
+ me.changeZoom.fire();
61
+ });
62
+ Microsoft.Maps.Events.addHandler(this.maps[api], 'viewchangeend', function(event){
63
+ me.endPan.fire();
64
+ });
65
+ Microsoft.Maps.Events.addHandler(this.maps[api], 'viewchange', function(event){
66
+ me.endPan.fire();
67
+ });
68
+ },
69
+
70
+ applyOptions: function(){
71
+ var map = this.maps[this.api];
72
+
73
+ var myOptions = [];
74
+ if (!this.options.enableDragging) {
75
+ myOptions.disablePanning = true;
76
+ }
77
+ if (!this.options.enableScrollWheelZoom) {
78
+ myOptions.disableZooming = true;
79
+ }
80
+ // map.setOptions(myOptions);
81
+ // TODO: Add provider code
82
+ },
83
+
84
+ resizeTo: function(width, height){
85
+ var map = this.maps[this.api];
86
+ map.setOptions(height,width);
87
+ },
88
+
89
+ addControls: function( args ) {
90
+ var map = this.maps[this.api];
91
+
92
+ // TODO: Add provider code
93
+ },
94
+
95
+ addSmallControls: function() {
96
+ var map = this.maps[this.api];
97
+
98
+ // TODO: Add provider code
99
+ },
100
+
101
+ addLargeControls: function() {
102
+ var map = this.maps[this.api];
103
+
104
+ // TODO: Add provider code
105
+ },
106
+
107
+ addMapTypeControls: function() {
108
+ var map = this.maps[this.api];
109
+
110
+ // TODO: Add provider code
111
+ },
112
+
113
+ setCenterAndZoom: function(point, zoom) {
114
+ var map = this.maps[this.api];
115
+ var pt = point.toProprietary(this.api);
116
+
117
+ // Get the existing options.
118
+ var options = {};
119
+ options.zoom = zoom;
120
+ options.center = pt;
121
+
122
+ map.setView(options);
123
+ },
124
+
125
+ addMarker: function(marker, old) {
126
+ var map = this.maps[this.api];
127
+ var pin = marker.toProprietary(this.api);
128
+
129
+ map.entities.push(pin);
130
+
131
+
132
+ return pin;
133
+ },
134
+
135
+ removeMarker: function(marker) {
136
+ var map = this.maps[this.api];
137
+ if (marker.proprietary_marker) {
138
+ map.entities.remove(marker.proprietary_marker);
139
+ }
140
+ },
141
+
142
+ declutterMarkers: function(opts) {
143
+ var map = this.maps[this.api];
144
+
145
+ // TODO: Add provider code
146
+ },
147
+
148
+ addPolyline: function(polyline, old) {
149
+ var map = this.maps[this.api];
150
+ var pl = polyline.toProprietary(this.api);
151
+
152
+ map.entities.push(pl);
153
+
154
+ return pl;
155
+ },
156
+
157
+ removePolyline: function(polyline) {
158
+ var map = this.maps[this.api];
159
+
160
+ if (polyline.proprietary_polyline) {
161
+ map.entities.remove(polyline.proprietary_polyline);
162
+ }
163
+ },
164
+
165
+ getCenter: function() {
166
+ var point;
167
+ var map = this.maps[this.api];
168
+ // Get the existing options.
169
+ var options = map.getOptions();
170
+ point = new mxn.LatLonPoint(options.center.latitude,options.center.longitude);
171
+
172
+ return point;
173
+ },
174
+
175
+ setCenter: function(point, options) {
176
+ var map = this.maps[this.api];
177
+ var pt = point.toProprietary(this.api);
178
+
179
+ // Get the existing options.
180
+ var msOptions = map.getOptions();
181
+ msOptions.center = pt;
182
+ msOptions.bounds = null;
183
+ map.setView(msOptions);
184
+ },
185
+
186
+ setZoom: function(zoom) {
187
+ var map = this.maps[this.api];
188
+ // Get the existing options.
189
+ var options = map.getOptions();
190
+ options.zoom = zoom;
191
+ map.setView(options);
192
+
193
+ },
194
+
195
+ getZoom: function() {
196
+ var map = this.maps[this.api];
197
+ var zoom;
198
+
199
+ var options = map.getOptions();
200
+ zoom = options.zoom;
201
+ // TODO: Add provider code
202
+
203
+ return zoom;
204
+ },
205
+
206
+ getZoomLevelForBoundingBox: function( bbox ) {
207
+ var map = this.maps[this.api];
208
+ // NE and SW points from the bounding box.
209
+ var ne = bbox.getNorthEast();
210
+ var sw = bbox.getSouthWest();
211
+ var zoom;
212
+
213
+ // TODO: Add provider code
214
+
215
+ return zoom;
216
+ },
217
+
218
+ setMapType: function(type) {
219
+ var map = this.maps[this.api];
220
+ var options = map.getOptions();
221
+
222
+ switch (type) {
223
+ case mxn.Mapstraction.ROAD:
224
+ options.mapTypeId = Microsoft.Maps.MapTypeId.road;
225
+
226
+ break;
227
+ case mxn.Mapstraction.SATELLITE:
228
+ options.mapTypeId = Microsoft.Maps.MapTypeId.aerial;
229
+ break;
230
+ case mxn.Mapstraction.HYBRID:
231
+ options.mapTypeId = Microsoft.Maps.MapTypeId.birdseye;
232
+ break;
233
+ default:
234
+ options.mapTypeId = Microsoft.Maps.MapTypeId.road;
235
+ }
236
+
237
+ map.setView(options);
238
+ },
239
+
240
+ getMapType: function() {
241
+ var map = this.maps[this.api];
242
+ var options = map.getOptions();
243
+ switch (options.mapTypeId) {
244
+ case Microsoft.Maps.MapTypeId.road:
245
+ return mxn.Mapstraction.ROAD;
246
+ case Microsoft.Maps.MapTypeId.aerial:
247
+ return mxn.Mapstraction.SATELLITE;
248
+ case Microsoft.Maps.MapTypeId.birdseye:
249
+ return mxn.Mapstraction.HYBRID;
250
+ default:
251
+ return mxn.Mapstraction.ROAD;
252
+ }
253
+
254
+ },
255
+
256
+ getBounds: function () {
257
+ var map = this.maps[this.api];
258
+ var options = map.getOptions();
259
+ // TODO: Add provider code
260
+ var nw = options.bounds.getNorthwest;
261
+ var se = options.bounds.getSoutheast;
262
+ return new mxn.BoundingBox(se.latitude,nw.longitude ,nw.latitude , se.longitude );
263
+ },
264
+
265
+ setBounds: function(bounds){
266
+ var map = this.maps[this.api];
267
+ var sw = bounds.getSouthWest();
268
+ var ne = bounds.getNorthEast();
269
+ var viewRect = Microsoft.Maps.LocationRect.fromCorners(new Microsoft.Maps.Location(sw.lat,ne.lon), new Microsoft.Maps.Location(ne.at,sw.lon));
270
+ var options = map.getOptions();
271
+ options.bounds = viewRect;
272
+ options.center = null;
273
+ map.setView(options);
274
+
275
+ },
276
+
277
+ addImageOverlay: function(id, src, opacity, west, south, east, north, oContext) {
278
+ var map = this.maps[this.api];
279
+
280
+ // TODO: Add provider code
281
+ },
282
+
283
+ setImagePosition: function(id, oContext) {
284
+ var map = this.maps[this.api];
285
+ var topLeftPoint; var bottomRightPoint;
286
+
287
+ // TODO: Add provider code
288
+
289
+ //oContext.pixels.top = ...;
290
+ //oContext.pixels.left = ...;
291
+ //oContext.pixels.bottom = ...;
292
+ //oContext.pixels.right = ...;
293
+ },
294
+
295
+ addOverlay: function(url, autoCenterAndZoom) {
296
+ var map = this.maps[this.api];
297
+
298
+ // TODO: Add provider code
299
+
300
+ },
301
+
302
+ addTileLayer: function(tile_url, opacity, copyright_text, min_zoom, max_zoom, map_type) {
303
+ var map = this.maps[this.api];
304
+
305
+ // TODO: Add provider code
306
+ },
307
+
308
+ toggleTileLayer: function(tile_url) {
309
+ var map = this.maps[this.api];
310
+
311
+ // TODO: Add provider code
312
+ },
313
+
314
+ getPixelRatio: function() {
315
+ var map = this.maps[this.api];
316
+
317
+ // TODO: Add provider code
318
+ },
319
+
320
+ mousePosition: function(element) {
321
+ var map = this.maps[this.api];
322
+
323
+ // TODO: Add provider code
324
+ }
325
+ },
326
+
327
+ LatLonPoint: {
328
+
329
+ toProprietary: function() {
330
+ return new Microsoft.Maps.Location(this.lat, this.lon);
331
+ },
332
+
333
+ fromProprietary: function(mPoint) {
334
+ this.lat = mPoint.latitude;
335
+ this.lon = mPoint.longitude;
336
+ }
337
+
338
+ },
339
+
340
+ Marker: {
341
+
342
+ toProprietary: function() {
343
+ var options = {};
344
+ if (this.draggable)
345
+ {
346
+ options.draggable = true;
347
+ }
348
+ var ax = 0; // anchor x
349
+ var ay = 0; // anchor y
350
+
351
+ if (this.iconAnchor) {
352
+ ax = this.iconAnchor[0];
353
+ ay = this.iconAnchor[1];
354
+ }
355
+ var mAnchorPoint = new Microsoft.Maps.Point(ax,ay);
356
+ if (this.iconUrl) {
357
+ options.icon = this.iconUrl;
358
+ options.height = this.iconSize[1];
359
+ options.width = this.iconSize[0];
360
+ options.anchor = mAnchorPoint;
361
+ }
362
+ if (this.label)
363
+ {
364
+ options.text = this.label;
365
+ }
366
+ var mmarker = new Microsoft.Maps.Pushpin(this.location.toProprietary('microsoft7'), options);
367
+
368
+ if (this.infoBubble){
369
+ var event_action = "click";
370
+ if (this.hover) {
371
+ event_action = "mouseover";
372
+ }
373
+ Microsoft.Maps.Events.addHandler(mmarker, event_action, function() {
374
+ mmarker.mapstraction_marker.openBubble();
375
+ });
376
+ Microsoft.Maps.Events.addHandler(map, 'viewchange', function () {
377
+ mmarker.mapstraction_marker.closeBubble();
378
+ });
379
+ }
380
+ return mmarker;
381
+ },
382
+
383
+ openBubble: function() {
384
+ var infowindow = new Microsoft.Maps.InfoBox({
385
+ description: this.infoBubble
386
+ });
387
+
388
+ this.events.openInfoBubble.fire({'marker': this});
389
+ this.map.entities.push(infowindow);
390
+ infowindow.setOptions({visible: true});
391
+ this.proprietary_infowindow = infowindow; // Save so we can close it later
392
+ },
393
+ closeBubble: function() {
394
+ if (!this.map) {
395
+ throw 'Marker must be added to map in order to display infobox';
396
+ }
397
+ if (!this.proprietary_infowindow) {
398
+ return;
399
+ }
400
+ this.proprietary_infowindow.setOptions({visible:false});
401
+ this.map.entities.remove(this.proprietary_infowindow);
402
+ },
403
+ hide: function() {
404
+ this.proprietary_marker.setOptions({visible: false});
405
+ },
406
+
407
+ show: function() {
408
+ this.proprietary_marker.setOptions({visible: true});
409
+ },
410
+
411
+ update: function() {
412
+ var loc = this.proprietary_marker.getLocation();
413
+ var point = new mxn.LatLonPoint(loc.latitude, loc.longitude);
414
+ this.location = point;
415
+ }
416
+
417
+ },
418
+
419
+ Polyline: {
420
+
421
+ toProprietary: function() {
422
+ var points = [];
423
+ for (var i = 0, length = this.points.length; i < length; i++) {
424
+ points.push(this.points[i].toProprietary(this.api));
425
+ }
426
+
427
+ var strokeColor = Microsoft.Maps.Color.fromHex(this.color);
428
+ strokeColor.a = this.opacity * 255;
429
+ var fillColor = Microsoft.Maps.Color.fromHex(this.fillColor);
430
+ fillColor.a = this.fillOpacity * 255;
431
+
432
+ var polyOptions = {
433
+ strokeColor: _strokeColor,
434
+ strokeThickness: this.width
435
+ };
436
+
437
+ if (this.closed) {
438
+ polyOptions.fillColor = _fillColor;
439
+ points.push(this.points[0].toProprietary(this.api));
440
+ return new Microsoft.Maps.Polygon(points, polyOptions);
441
+ }
442
+ else {
443
+ console.log("Rendering PolyLine");
444
+ return new Microsoft.Maps.Polyline(points, polyOptions);
445
+ }
446
+
447
+ },
448
+
449
+ show: function() {
450
+ this.proprietary_polyline.setOptions({visible:true});
451
+ },
452
+
453
+ hide: function() {
454
+ this.proprietary_polyline.setOptions({visible:false});
455
+ }
456
+ }
457
+
458
+ });
@@ -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("microsoft7",{Geocoder:{init:function(){},geocode:function(c){var a=this;var f="";var d=false;if(typeof(c)=="object"){if(c.hasOwnProperty("lat")&&c.hasOwnProperty("lon")){f=c.lat+","+c.lon}else{f=[c.street,c.locality,c.region,c.country].join(", ")}}else{f=c}jsonp_callback_context=this;var b="http://dev.virtualearth.net/REST/v1/Locations/"+f+"?output=json&jsonp=jsonp_callback_context.geocode_callback&key="+microsoft_key;var e=document.createElement("script");e.type="text/javascript";e.src=b;document.body.appendChild(e)},geocode_callback:function(b){if(b.statusDescription!="OK"){this.error_callback(b.statusDescription)}else{var c=b.resourceSets[0].resources[0];var a={street:c.address.addressLine,locality:c.address.locality,postcode:c.address.postalCode,region:c.address.adminDistrict,country:c.address.countryRegion,point:new mxn.LatLonPoint(c.point.coordinates[0],c.point.coordinates[1])};this.callback(a)}}}});
@@ -0,0 +1,66 @@
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('microsoft7', {
16
+ Geocoder: {
17
+
18
+ init: function(){
19
+
20
+ },
21
+
22
+ geocode: function(query){
23
+ var self = this;
24
+ var _address = '';
25
+ var is_reverse = false;
26
+ if (typeof(query) == 'object') {
27
+ // query is a LatLonPoint object (reverse geocode)
28
+ if (query.hasOwnProperty('lat') && query.hasOwnProperty('lon')) {
29
+ _address = query.lat + ',' + query.lon;
30
+ }
31
+ // query is an address object
32
+ else {
33
+ _address = [ query.street, query.locality, query.region, query.country ].join(', ');
34
+ }
35
+ }
36
+ // query is an address string
37
+ else{
38
+ _address = query;
39
+ }
40
+ jsonp_callback_context = this;
41
+ var searchRequest = 'http://dev.virtualearth.net/REST/v1/Locations/' + _address + '?output=json&jsonp=jsonp_callback_context.geocode_callback&key=' + microsoft_key;
42
+ var mapscript = document.createElement('script');
43
+ mapscript.type = 'text/javascript';
44
+ mapscript.src = searchRequest;
45
+ document.body.appendChild(mapscript);
46
+ },
47
+
48
+ geocode_callback: function(results){
49
+ if (results.statusDescription != 'OK') {
50
+ this.error_callback(results.statusDescription);
51
+ }
52
+ else {
53
+ var topResult = results.resourceSets[0].resources[0];
54
+ var return_location = {
55
+ street: topResult.address.addressLine,
56
+ locality: topResult.address.locality,
57
+ postcode: topResult.address.postalCode,
58
+ region: topResult.address.adminDistrict,
59
+ country: topResult.address.countryRegion,
60
+ point: new mxn.LatLonPoint(topResult.point.coordinates[0], topResult.point.coordinates[1])
61
+ };
62
+ this.callback(return_location);
63
+ }
64
+ }
65
+ }
66
+ });
@@ -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("multimap",{Mapstraction:{init:function(a,b){var c=this;if(MultimapViewer){if(this.debug){window.print_debug=function(f){var e=document.getElementById("debug");if(e){e.innerHTML+="<p>MUlTIMAP: "+f+"</p>"}else{alert(f)}}}var d=new MultimapViewer(a);d.addEventHandler("click",function(h,i,g,f,e){if(g){c.clickHandler(g.lat,g.lon,c);c.click.fire({location:new mxn.LatLonPoint(g.lat,g.lon)})}});d.addEventHandler("changeZoom",function(h,i,g,f,e){c.moveendHandler(c);c.changeZoom.fire()});d.addEventHandler("endPan",function(h,i,g,f,e){c.moveendHandler(c);c.endPan.fire()});d.addEventHandler("openInfoBox",function(h,i,g,f,e){if(g.mapstraction_marker){g.mapstraction_marker.openInfoBubble.fire()}});d.addEventHandler("closeInfoBox",function(h,i,g,f,e){if(g.mapstraction_marker){marker.closeInfoBubble.fire()}});this.maps[b]=d;this.loaded[b]=true}else{alert(b+" map script not imported")}},applyOptions:function(){var a=this.maps[this.api];if(this.options.enableScrollWheelZoom){a.setOptions({"mousewheel:wheelup":"zoomin","mousewheel:wheeldown":"zoomout"})}if(this.options.enableDragging){a.setOption("drag","dragmap")}else{a.setOption("drag","")}},resizeTo:function(b,a){this.currentElement.style.width=b;this.currentElement.style.height=a;this.maps[this.api].resize()},addControls:function(args){var map=this.maps[this.api];var pan_zoom_widget="MM";if(args.zoom&&args.zoom=="small"){pan_zoom_widget=pan_zoom_widget+"Small"}if(args.pan){pan_zoom_widget=pan_zoom_widget+"Pan"}if(args.zoom){pan_zoom_widget=pan_zoom_widget+"Zoom"}pan_zoom_widget=pan_zoom_widget+"Widget";if(pan_zoom_widget!="MMWidget"){eval(" map.addWidget( new "+pan_zoom_widget+"() );")}if(args.map_type){map.addWidget(new MMMapTypeWidget())}if(args.overview){map.addWidget(new MMOverviewWidget())}},addSmallControls:function(){var a=this.maps[this.api];smallPanzoomWidget=new MMSmallPanZoomWidget();a.addWidget(smallPanzoomWidget);this.addControlsArgs.pan=true;this.addControlsArgs.zoom="small"},addLargeControls:function(){var a=this.maps[this.api];panzoomWidget=new MMPanZoomWidget();a.addWidget(panzoomWidget);this.addControlsArgs.pan=true;this.addControlsArgs.zoom="large"},addMapTypeControls:function(){var a=this.maps[this.api];a.addWidget(new MMMapTypeWidget())},setCenterAndZoom:function(a,b){var d=this.maps[this.api];var c=a.toProprietary(this.api);d.goToPosition(new MMLatLon(a.lat,a.lng),b)},addMarker:function(b,a){var d=this.maps[this.api];var c=b.toProprietary(this.api);d.addOverlay(c);return c},removeMarker:function(a){var b=this.maps[this.api];b.removeOverlay(a.proprietary_marker)},declutterMarkers:function(a){var b=this.maps[this.api];b.declutterGroup(a.groupName)},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];a.proprietary_polyline.remove()},getCenter:function(){var a;var c=this.maps[this.api];var b=c.getCurrentPosition();a=new mxn.LatLonPoint();a.fromProprietary(this.api,b);return a},setCenter:function(a,b){var d=this.maps[this.api];var c=a.toProprietary(this.api);if(b&&b.pan){d.panToPosition(c)}else{d.goToPosition(c)}},setZoom:function(a){var b=this.maps[this.api];b.setZoomFactor(a)},getZoom:function(){var b=this.maps[this.api];var a;a=b.getZoomFactor();return a},getZoomLevelForBoundingBox:function(f){var e=this.maps[this.api];var d=f.getNorthEast();var a=f.getSouthWest();var c;var b=e.getAutoScaleLocation([a.toProprietary(this.api),d.toProprietary(this.api)]);c=b.zoom_factor;return c},setMapType:function(c){var d=this.maps[this.api];var g=null;var e=null;var f=null;switch(c){case mxn.Mapstraction.ROAD:e=MM_WORLD_MAP;break;case mxn.Mapstraction.SATELLITE:e=MM_WORLD_AERIAL;break;case mxn.Mapstraction.HYBRID:e=MM_WORLD_HYBRID;break}var b=d.getAvailableMapTypes();for(var a=0;a<b.length;a++){if(e&&b[a]==e){f=e;break}if(b[a]==MM_WORLD_MAP){g=MM_WORLD_MAP}}f=f||g;if(f!==null){d.setMapType(f)}},getMapType:function(){var a=this.maps[this.api];type=a.getMapType();switch(type){case MM_WORLD_MAP:return mxn.Mapstraction.ROAD;case MM_WORLD_AERIAL:return mxn.Mapstraction.SATELLITE;case MM_WORLD_HYBRID:return mxn.Mapstraction.HYBRID;default:return null}},getBounds:function(){var b=this.maps[this.api];var a=b.getMapBounds();sw=a.getSouthWest();ne=a.getNorthEast();return new mxn.BoundingBox(sw.lat,sw.lon,ne.lat,ne.lon)},setBounds:function(c){var e=this.maps[this.api];var a=c.getSouthWest();var d=c.getNorthEast();var b=e.getAutoScaleLocation([a.toProprietary(this.api),d.toProprietary(this.api)]);e.goToPosition(b.coords,b.zoom_factor)},addImageOverlay:function(c,a,e,j,f,h,d,i){var b=this.maps[this.api];b.getContainer().appendChild(i.imgElm);this.setImageOpacity(c,e);this.setImagePosition(c);var g=this;b.addEventHandler("changeZoom",function(n,o,m,l,k){g.setImagePosition(c)});b.addEventHandler("drag",function(n,o,m,l,k){g.setImagePosition(c)});b.addEventHandler("endPan",function(n,o,m,l,k){g.setImagePosition(c)})},setImagePosition:function(e,b){var d=this.maps[this.api];var c;var a;c=d.geoPosToContainerPixels(new MMLatLon(b.latLng.top,b.latLng.left));a=d.geoPosToContainerPixels(new MMLatLon(b.latLng.bottom,b.latLng.right));b.pixels.top=c.y;b.pixels.left=c.x;b.pixels.bottom=a.y;b.pixels.right=a.x}},LatLonPoint:{toProprietary:function(){return new MMLatLon(this.lat,this.lon)},fromProprietary:function(a){this.lat=a.lat;this.lon=a.lon}},Marker:{toProprietary:function(){var a={};if(this.iconUrl){a.icon=new MMIcon(this.iconUrl);if(this.iconSize){a.icon.iconSize=new MMDimensions(this.iconSize[0],this.iconSize[1])}else{}if(this.iconAnchor){a.icon.iconAnchor=new MMPoint(this.iconAnchor[0],this.iconAnchor[1])}if(this.groupName){a.icon.groupName=this.groupName}}if(this.labelText){a.label=this.labelText}var c=new MMMarkerOverlay(this.location.toProprietary("multimap"),a);if(this.infoBubble){c.setInfoBoxContent(this.infoBubble)}if(this.infoDiv){}for(var b in this.attributes){if(this.attributes.hasOwnProperty(b)){c.setAttribute(b,this.attributes[b])}}return c},openBubble:function(){this.proprietary_marker.openInfoBox()},hide:function(){this.proprietary_marker.setVisibility(false)},show:function(){this.proprietary_marker.setVisibility(true)}},Polyline:{toProprietary:function(){var b;var d=[];for(var a=0,c=this.points.length;a<c;a++){d.push(this.points[a].toProprietary("multimap"))}b=new MMPolyLineOverlay(d,this.color,this.opacity,this.width,this.closed,this.fillColor);return b}}});