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,429 @@
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('microsoft', {
16
+
17
+ Mapstraction: {
18
+
19
+ init: function(element, api) {
20
+ var me = this;
21
+ if (!VEMap) {
22
+ throw api + ' map script not imported';
23
+ }
24
+
25
+ this.maps[api] = new VEMap(element.id);
26
+ this.maps[api].AttachEvent('onclick', function(event){
27
+ me.clickHandler();
28
+ var map = me.maps[me.api];
29
+ var shape = map.GetShapeByID(event.elementID);
30
+ if (shape && shape.mapstraction_marker) {
31
+ shape.mapstraction_marker.click.fire();
32
+ }
33
+ else {
34
+ var x = event.mapX;
35
+ var y = event.mapY;
36
+ var pixel = new VEPixel(x, y);
37
+ var ll = map.PixelToLatLong(pixel);
38
+ var eventArg = {
39
+ 'location': new mxn.LatLonPoint(ll.Latitude, ll.Longitude),
40
+ 'position': { x: event.mapX, y: event.mapY },
41
+ 'button': event.rightMouseButton ? 'right' : 'left'
42
+ };
43
+
44
+ me.click.fire(eventArg);
45
+ }
46
+ });
47
+ this.maps[api].AttachEvent('onendzoom', function(event){
48
+ me.moveendHandler(me);
49
+ me.changeZoom.fire();
50
+ });
51
+ this.maps[api].AttachEvent('onendpan', function(event){
52
+ me.moveendHandler(me);
53
+ me.endPan.fire();
54
+ });
55
+ this.maps[api].AttachEvent('onchangeview', function(event){
56
+ me.endPan.fire();
57
+ });
58
+ this.maps[api].LoadMap();
59
+ document.getElementById("MSVE_obliqueNotification").style.visibility = "hidden";
60
+
61
+ //removes the bird's eye pop-up
62
+ this.loaded[api] = true;
63
+ me.load.fire();
64
+ },
65
+
66
+ applyOptions: function(){
67
+ var map = this.maps[this.api];
68
+ if(this.options.enableScrollWheelZoom){
69
+ map.enableContinuousZoom();
70
+ map.enableScrollWheelZoom();
71
+ }
72
+ },
73
+
74
+ resizeTo: function(width, height){
75
+ this.maps[this.api].Resize(width, height);
76
+ },
77
+
78
+ addControls: function( args ) {
79
+ var map = this.maps[this.api];
80
+
81
+ if (args.pan) {
82
+ map.SetDashboardSize(VEDashboardSize.Normal);
83
+ }
84
+ else {
85
+ map.SetDashboardSize(VEDashboardSize.Tiny);
86
+ }
87
+
88
+ if (args.zoom == 'large') {
89
+ map.SetDashboardSize(VEDashboardSize.Small);
90
+ }
91
+ else if ( args.zoom == 'small' ) {
92
+ map.SetDashboardSize(VEDashboardSize.Tiny);
93
+ }
94
+ else {
95
+ map.HideDashboard();
96
+ map.HideScalebar();
97
+ }
98
+ },
99
+
100
+ addSmallControls: function() {
101
+ var map = this.maps[this.api];
102
+ map.SetDashboardSize(VEDashboardSize.Tiny);
103
+ },
104
+
105
+ addLargeControls: function() {
106
+ var map = this.maps[this.api];
107
+ map.SetDashboardSize(VEDashboardSize.Normal);
108
+ this.addControlsArgs.pan = true;
109
+ this.addControlsArgs.zoom = 'large';
110
+ },
111
+
112
+ addMapTypeControls: function() {
113
+ var map = this.maps[this.api];
114
+ map.addTypeControl();
115
+
116
+ },
117
+
118
+ dragging: function(on) {
119
+ var map = this.maps[this.api];
120
+ if (on) {
121
+ map.enableDragMap();
122
+ }
123
+ else {
124
+ map.disableDragMap();
125
+ }
126
+ },
127
+
128
+ setCenterAndZoom: function(point, zoom) {
129
+ var map = this.maps[this.api];
130
+ var pt = point.toProprietary(this.api);
131
+ var vzoom = zoom;
132
+ map.SetCenterAndZoom(new VELatLong(point.lat,point.lon), vzoom);
133
+ },
134
+
135
+ addMarker: function(marker, old) {
136
+ var map = this.maps[this.api];
137
+ marker.pinID = "mspin-"+new Date().getTime()+'-'+(Math.floor(Math.random()*Math.pow(2,16)));
138
+ var pin = marker.toProprietary(this.api);
139
+
140
+ map.AddShape(pin);
141
+ //give onclick event
142
+ //give on double click event
143
+ //give on close window
144
+ //return the marker
145
+
146
+ return pin;
147
+ },
148
+
149
+ removeMarker: function(marker) {
150
+ var map = this.maps[this.api];
151
+ var id = marker.proprietary_marker.GetID();
152
+ var microsoftShape = map.GetShapeByID(id);
153
+ map.DeleteShape(microsoftShape);
154
+ },
155
+
156
+ declutterMarkers: function(opts) {
157
+ var map = this.maps[this.api];
158
+
159
+ // TODO: Add provider code
160
+ },
161
+
162
+ addPolyline: function(polyline, old) {
163
+ var map = this.maps[this.api];
164
+ var pl = polyline.toProprietary(this.api);
165
+ pl.HideIcon(); //hide the icon VE automatically displays
166
+ map.AddShape(pl);
167
+ return pl;
168
+ },
169
+
170
+ removePolyline: function(polyline) {
171
+ var map = this.maps[this.api];
172
+ var id = polyline.proprietary_polyline.GetID();
173
+ var microsoftShape = map.GetShapeByID(id);
174
+ map.DeleteShape(microsoftShape);
175
+ },
176
+
177
+ getCenter: function() {
178
+ var map = this.maps[this.api];
179
+ var LL = map.GetCenter();
180
+ var point = new mxn.LatLonPoint(LL.Latitude, LL.Longitude);
181
+ return point;
182
+ },
183
+
184
+ setCenter: function(point, options) {
185
+ var map = this.maps[this.api];
186
+ var pt = point.toProprietary(this.api);
187
+ map.SetCenter(new VELatLong(point.lat, point.lon));
188
+ },
189
+
190
+ setZoom: function(zoom) {
191
+ var map = this.maps[this.api];
192
+ map.SetZoomLevel(zoom);
193
+ },
194
+
195
+ getZoom: function() {
196
+ var map = this.maps[this.api];
197
+ var zoom = map.GetZoomLevel();
198
+ return zoom;
199
+ },
200
+
201
+ getZoomLevelForBoundingBox: function( bbox ) {
202
+ var map = this.maps[this.api];
203
+ // NE and SW points from the bounding box.
204
+ var ne = bbox.getNorthEast();
205
+ var sw = bbox.getSouthWest();
206
+ var zoom;
207
+
208
+ // TODO: Add provider code
209
+
210
+ return zoom;
211
+ },
212
+
213
+ setMapType: function(type) {
214
+ var map = this.maps[this.api];
215
+ switch(type) {
216
+ case mxn.Mapstraction.ROAD:
217
+ map.SetMapStyle(VEMapStyle.Road);
218
+ break;
219
+ case mxn.Mapstraction.SATELLITE:
220
+ map.SetMapStyle(VEMapStyle.Aerial);
221
+ break;
222
+ case mxn.Mapstraction.HYBRID:
223
+ map.SetMapStyle(VEMapStyle.Hybrid);
224
+ break;
225
+ default:
226
+ map.SetMapStyle(VEMapStyle.Road);
227
+ }
228
+ },
229
+
230
+ getMapType: function() {
231
+ var map = this.maps[this.api];
232
+ var mode = map.GetMapStyle();
233
+ switch(mode){
234
+ case VEMapStyle.Aerial:
235
+ return mxn.Mapstraction.SATELLITE;
236
+ case VEMapStyle.Road:
237
+ return mxn.Mapstraction.ROAD;
238
+ case VEMapStyle.Hybrid:
239
+ return mxn.Mapstraction.HYBRID;
240
+ default:
241
+ return null;
242
+ }
243
+ },
244
+
245
+ getBounds: function () {
246
+ var map = this.maps[this.api];
247
+ view = map.GetMapView();
248
+ var topleft = view.TopLeftLatLong;
249
+ var bottomright = view.BottomRightLatLong;
250
+
251
+ return new mxn.BoundingBox(bottomright.Latitude,topleft.Longitude,topleft.Latitude, bottomright.Longitude );
252
+ },
253
+
254
+ setBounds: function(bounds){
255
+ var map = this.maps[this.api];
256
+ var sw = bounds.getSouthWest();
257
+ var ne = bounds.getNorthEast();
258
+
259
+ var rec = new VELatLongRectangle(new VELatLong(ne.lat, ne.lon), new VELatLong(sw.lat, sw.lon));
260
+ map.SetMapView(rec);
261
+ },
262
+
263
+ addImageOverlay: function(id, src, opacity, west, south, east, north, oContext) {
264
+ var map = this.maps[this.api];
265
+
266
+ // TODO: Add provider code
267
+ },
268
+
269
+ setImagePosition: function(id, oContext) {
270
+ var map = this.maps[this.api];
271
+ var topLeftPoint; var bottomRightPoint;
272
+
273
+ // TODO: Add provider code
274
+
275
+ // oContext.pixels.top = ...;
276
+ // oContext.pixels.left = ...;
277
+ // oContext.pixels.bottom = ...;
278
+ // oContext.pixels.right = ...;
279
+ },
280
+
281
+ addOverlay: function(url, autoCenterAndZoom) {
282
+ var map = this.maps[this.api];
283
+ var layer = new VEShapeLayer();
284
+ var mlayerspec = new VEShapeSourceSpecification(VEDataType.GeoRSS, url, layer);
285
+ map.ImportShapeLayerData(mlayerspec);
286
+ },
287
+
288
+ addTileLayer: function(tile_url, opacity, copyright_text, min_zoom, max_zoom) {
289
+ throw 'Not implemented';
290
+ },
291
+
292
+ toggleTileLayer: function(tile_url) {
293
+ throw 'Not implemented';
294
+ },
295
+
296
+ getPixelRatio: function() {
297
+ throw 'Not implemented';
298
+ },
299
+
300
+ mousePosition: function(element) {
301
+ var locDisp = document.getElementById(element);
302
+ if (locDisp !== null) {
303
+ var map = this.maps[this.api];
304
+ map.AttachEvent("onmousemove", function(veEvent){
305
+ var latlon = map.PixelToLatLong(new VEPixel(veEvent.mapX, veEvent.mapY));
306
+ var loc = latlon.Latitude.toFixed(4) + " / " + latlon.Longitude.toFixed(4);
307
+ locDisp.innerHTML = loc;
308
+ });
309
+ locDisp.innerHTML = "0.0000 / 0.0000";
310
+ }
311
+ }
312
+ },
313
+
314
+ LatLonPoint: {
315
+
316
+ toProprietary: function() {
317
+ return new VELatLong(this.lat, this.lon);
318
+ },
319
+
320
+ fromProprietary: function(mpoint) {
321
+ this.lat = mpoint.Latitude;
322
+ this.lon = mpoint.Longitude;
323
+ }
324
+
325
+ },
326
+
327
+ Marker: {
328
+
329
+ toProprietary: function() {
330
+ var mmarker = new VEShape(VEShapeType.Pushpin, this.location.toProprietary('microsoft'));
331
+ mmarker.SetTitle(this.labelText);
332
+ mmarker.SetDescription(this.infoBubble);
333
+
334
+ if (this.iconUrl) {
335
+ var customIcon = new VECustomIconSpecification();
336
+ customIcon.Image = this.iconUrl;
337
+ // See this article on how to patch 6.2 to correctly render offsets.
338
+ // http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/thread/5ee2f15d-09bf-4158-955e-e3fa92f33cda?prof=required&ppud=4
339
+ if (this.iconAnchor) {
340
+ customIcon.ImageOffset = new VEPixel(-this.iconAnchor[0], -this.iconAnchor[1]);
341
+ }
342
+ else if (this.iconSize) {
343
+ customIcon.ImageOffset = new VEPixel(-this.iconSize[0]/2, -this.iconSize[1]/2);
344
+ }
345
+ mmarker.SetCustomIcon(customIcon);
346
+ }
347
+ if (this.draggable){
348
+ mmarker.Draggable = true;
349
+ }
350
+
351
+ return mmarker;
352
+ },
353
+
354
+ openBubble: function() {
355
+ if (!this.map) {
356
+ throw 'Marker must be added to map in order to display infobox';
357
+ }
358
+ this.map.ShowInfoBox(this.proprietary_marker);
359
+ },
360
+
361
+ closeBubble: function() {
362
+ if (!this.map) {
363
+ throw 'Marker must be added to map in order to display infobox';
364
+ }
365
+ this.map.HideInfoBox();
366
+ },
367
+
368
+ hide: function() {
369
+ this.proprietary_marker.Hide();
370
+ },
371
+
372
+ show: function() {
373
+ this.proprietary_marker.Show();
374
+ },
375
+
376
+ update: function() {
377
+ var point = new mxn.LatLonPoint(this.proprietary_marker.Latitude,this.proprietary_marker.Longitude);
378
+
379
+ this.location = point;
380
+ }
381
+
382
+ },
383
+
384
+ Polyline: {
385
+
386
+ toProprietary: function() {
387
+ var mpoints = [], mtype;
388
+
389
+ var colorToVEColor = function(color, opacity) {
390
+ var mxColor = new mxn.util.Color(color);
391
+ var mxOpacity = (typeof(opacity) == 'undefined' || opacity === null) ? 1.0 : opacity;
392
+ var vecolor = new VEColor(mxColor.red, mxColor.green, mxColor.blue, mxOpacity);
393
+ return vecolor;
394
+ };
395
+
396
+ for(var i = 0, length = this.points.length; i < length; i++) {
397
+ mpoints.push(this.points[i].toProprietary('microsoft'));
398
+ }
399
+ if (this.closed) {
400
+ mtype = VEShapeType.Polygon;
401
+ }
402
+ else {
403
+ mtype = VEShapeType.Polyline;
404
+ }
405
+ var mpolyline = new VEShape(mtype, mpoints);
406
+ if (this.width) {
407
+ mpolyline.SetLineWidth(this.width);
408
+ }
409
+ if (this.color) {
410
+ mpolyline.SetLineColor(colorToVEColor(this.color, this.opacity));
411
+ }
412
+ if (this.fillColor) {
413
+ mpolyline.SetFillColor(colorToVEColor(this.fillColor, this.fillOpacity));
414
+ }
415
+
416
+ return mpolyline;
417
+ },
418
+
419
+ show: function() {
420
+ this.proprietary_polyline.Show();
421
+ },
422
+
423
+ hide: function() {
424
+ this.proprietary_polyline.Hide();
425
+ }
426
+
427
+ }
428
+
429
+ });
@@ -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",{Mapstraction:{init:function(a,b){var c=this;if(!Microsoft||!Microsoft.Maps){throw b+" map script not imported"}this.maps[b]=new Microsoft.Maps.Map(a,{credentials:microsoft_key});a.addEventListener("contextmenu",function(d){d.preventDefault()});Microsoft.Maps.Events.addHandler(this.maps[b],"rightclick",function(h){var j=c.maps[c.api];var g=h.getX();var e=h.getY();var f=new Microsoft.Maps.Point(g,e);var i=j.tryPixelToLocation(f);var d={location:new mxn.LatLonPoint(i.latitude,i.longitude),position:{x:g,y:e},button:"right"};c.click.fire(d)});Microsoft.Maps.Events.addHandler(this.maps[b],"click",function(h){var j=c.maps[c.api];h.originalEvent.preventDefault();if(h.targetType=="pushpin"){h.target.mapstraction_marker.click.fire()}else{var g=h.getX();var e=h.getY();var f=new Microsoft.Maps.Point(g,e);var i=j.tryPixelToLocation(f);var d={location:new mxn.LatLonPoint(i.latitude,i.longitude),position:{x:g,y:e},button:h.isSecondary?"right":"left"};c.click.fire(d)}});Microsoft.Maps.Events.addHandler(this.maps[b],"viewchangeend",function(d){c.changeZoom.fire()});Microsoft.Maps.Events.addHandler(this.maps[b],"viewchangeend",function(d){c.endPan.fire()});Microsoft.Maps.Events.addHandler(this.maps[b],"viewchange",function(d){c.endPan.fire()})},applyOptions:function(){var b=this.maps[this.api];var a=[];if(!this.options.enableDragging){a.disablePanning=true}if(!this.options.enableScrollWheelZoom){a.disableZooming=true}},resizeTo:function(b,a){var c=this.maps[this.api];c.setOptions(a,b)},addControls:function(a){var b=this.maps[this.api]},addSmallControls:function(){var a=this.maps[this.api]},addLargeControls:function(){var a=this.maps[this.api]},addMapTypeControls:function(){var a=this.maps[this.api]},setCenterAndZoom:function(a,c){var e=this.maps[this.api];var d=a.toProprietary(this.api);var b={};b.zoom=c;b.center=d;e.setView(b)},addMarker:function(b,a){var d=this.maps[this.api];var c=b.toProprietary(this.api);d.entities.push(c);return c},removeMarker:function(a){var b=this.maps[this.api];if(a.proprietary_marker){b.entities.remove(a.proprietary_marker)}},declutterMarkers:function(a){var b=this.maps[this.api]},addPolyline:function(b,a){var d=this.maps[this.api];var c=b.toProprietary(this.api);d.entities.push(c);return c},removePolyline:function(a){var b=this.maps[this.api];if(a.proprietary_polyline){b.entities.remove(a.proprietary_polyline)}},getCenter:function(){var a;var c=this.maps[this.api];var b=c.getOptions();a=new mxn.LatLonPoint(b.center.latitude,b.center.longitude);return a},setCenter:function(a,c){var e=this.maps[this.api];var d=a.toProprietary(this.api);var b=e.getOptions();b.center=d;b.bounds=null;e.setView(b)},setZoom:function(b){var c=this.maps[this.api];var a=c.getOptions();a.zoom=b;c.setView(a)},getZoom:function(){var c=this.maps[this.api];var b;var a=c.getOptions();b=a.zoom;return b},getZoomLevelForBoundingBox:function(e){var d=this.maps[this.api];var c=e.getNorthEast();var a=e.getSouthWest();var b;return b},setMapType:function(b){var c=this.maps[this.api];var a=c.getOptions();switch(b){case mxn.Mapstraction.ROAD:a.mapTypeId=Microsoft.Maps.MapTypeId.road;break;case mxn.Mapstraction.SATELLITE:a.mapTypeId=Microsoft.Maps.MapTypeId.aerial;break;case mxn.Mapstraction.HYBRID:a.mapTypeId=Microsoft.Maps.MapTypeId.birdseye;break;default:a.mapTypeId=Microsoft.Maps.MapTypeId.road}c.setView(a)},getMapType:function(){var b=this.maps[this.api];var a=b.getOptions();switch(a.mapTypeId){case Microsoft.Maps.MapTypeId.road:return mxn.Mapstraction.ROAD;case Microsoft.Maps.MapTypeId.aerial:return mxn.Mapstraction.SATELLITE;case Microsoft.Maps.MapTypeId.birdseye:return mxn.Mapstraction.HYBRID;default:return mxn.Mapstraction.ROAD}},getBounds:function(){var d=this.maps[this.api];var b=d.getOptions();var a=b.bounds.getNorthwest;var c=b.bounds.getSoutheast;return new mxn.BoundingBox(c.latitude,a.longitude,a.latitude,c.longitude)},setBounds:function(d){var f=this.maps[this.api];var a=d.getSouthWest();var e=d.getNorthEast();var b=Microsoft.Maps.LocationRect.fromCorners(new Microsoft.Maps.Location(a.lat,e.lon),new Microsoft.Maps.Location(e.at,a.lon));var c=f.getOptions();c.bounds=b;c.center=null;f.setView(c)},addImageOverlay:function(c,a,e,i,f,g,d,h){var b=this.maps[this.api]},setImagePosition:function(e,b){var d=this.maps[this.api];var c;var a},addOverlay:function(a,b){var c=this.maps[this.api]},addTileLayer:function(g,a,c,e,f,b){var d=this.maps[this.api]},toggleTileLayer:function(b){var a=this.maps[this.api]},getPixelRatio:function(){var a=this.maps[this.api]},mousePosition:function(a){var b=this.maps[this.api]}},LatLonPoint:{toProprietary:function(){return new Microsoft.Maps.Location(this.lat,this.lon)},fromProprietary:function(a){this.lat=a.latitude;this.lon=a.longitude}},Marker:{toProprietary:function(){var c={};if(this.draggable){c.draggable=true}var e=0;var d=0;if(this.iconAnchor){e=this.iconAnchor[0];d=this.iconAnchor[1]}var f=new Microsoft.Maps.Point(e,d);if(this.iconUrl){c.icon=this.iconUrl;c.height=this.iconSize[1];c.width=this.iconSize[0];c.anchor=f}if(this.label){c.text=this.label}var a=new Microsoft.Maps.Pushpin(this.location.toProprietary("microsoft7"),c);if(this.infoBubble){var b="click";if(this.hover){b="mouseover"}Microsoft.Maps.Events.addHandler(a,b,function(){a.mapstraction_marker.openBubble()});Microsoft.Maps.Events.addHandler(map,"viewchange",function(){a.mapstraction_marker.closeBubble()})}return a},openBubble:function(){var a=new Microsoft.Maps.InfoBox({description:this.infoBubble});this.events.openInfoBubble.fire({marker:this});this.map.entities.push(a);a.setOptions({visible:true});this.proprietary_infowindow=a},closeBubble:function(){if(!this.map){throw"Marker must be added to map in order to display infobox"}if(!this.proprietary_infowindow){return}this.proprietary_infowindow.setOptions({visible:false});this.map.entities.remove(this.proprietary_infowindow)},hide:function(){this.proprietary_marker.setOptions({visible:false})},show:function(){this.proprietary_marker.setOptions({visible:true})},update:function(){var b=this.proprietary_marker.getLocation();var a=new mxn.LatLonPoint(b.latitude,b.longitude);this.location=a}},Polyline:{toProprietary:function(){var c=[];for(var b=0,d=this.points.length;b<d;b++){c.push(this.points[b].toProprietary(this.api))}var e=Microsoft.Maps.Color.fromHex(this.color);e.a=this.opacity*255;var f=Microsoft.Maps.Color.fromHex(this.fillColor);f.a=this.fillOpacity*255;var a={strokeColor:_strokeColor,strokeThickness:this.width};if(this.closed){a.fillColor=_fillColor;c.push(this.points[0].toProprietary(this.api));return new Microsoft.Maps.Polygon(c,a)}else{console.log("Rendering PolyLine");return new Microsoft.Maps.Polyline(c,a)}},show:function(){this.proprietary_polyline.setOptions({visible:true})},hide:function(){this.proprietary_polyline.setOptions({visible:false})}}});