]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/leaflet.map.js
Fixed tests + Altered migration file + Added reporting strings + Added update method
[rails.git] / app / assets / javascripts / leaflet.map.js
index 2201afe68a83baa73cd891fa43162980e7aa327c..7395898b7d488066e44a23b4d7766fd5fbda4205 100644 (file)
@@ -35,12 +35,6 @@ L.OSM.Map = L.Map.extend({
         keyid: "transportmap",
         name: I18n.t("javascripts.map.base.transport_map")
       }),
         keyid: "transportmap",
         name: I18n.t("javascripts.map.base.transport_map")
       }),
-      new L.OSM.MapQuestOpen({
-        attribution: copyright + ". Tiles courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a> <img src='https://developer.mapquest.com/content/osm/mq_logo.png'>",
-        code: "Q",
-        keyid: "mapquest",
-        name: I18n.t("javascripts.map.base.mapquest")
-      }),
       new L.OSM.HOT({
         attribution: copyright + ". Tiles courtesy of <a href='http://hot.openstreetmap.org/' target='_blank'>Humanitarian OpenStreetMap Team</a>",
         code: "H",
       new L.OSM.HOT({
         attribution: copyright + ". Tiles courtesy of <a href='http://hot.openstreetmap.org/' target='_blank'>Humanitarian OpenStreetMap Team</a>",
         code: "H",
@@ -64,7 +58,7 @@ L.OSM.Map = L.Map.extend({
       if (layerParam.indexOf(this.baseLayers[i].options.code) >= 0) {
         this.addLayer(this.baseLayers[i]);
         layersAdded = layersAdded + this.baseLayers[i].options.code;
       if (layerParam.indexOf(this.baseLayers[i].options.code) >= 0) {
         this.addLayer(this.baseLayers[i]);
         layersAdded = layersAdded + this.baseLayers[i].options.code;
-      } else if (i == 0 && layersAdded == "") {
+      } else if (i === 0 && layersAdded === "") {
         this.addLayer(this.baseLayers[i]);
       } else {
         this.removeLayer(this.baseLayers[i]);
         this.addLayer(this.baseLayers[i]);
       } else {
         this.removeLayer(this.baseLayers[i]);
@@ -170,6 +164,24 @@ L.OSM.Map = L.Map.extend({
     return str;
   },
 
     return str;
   },
 
+  getGeoUri: function(marker) {
+    var precision = OSM.zoomPrecision(this.getZoom()),
+        latLng,
+        params = {};
+
+    if (marker && this.hasLayer(marker)) {
+      latLng = marker.getLatLng().wrap();
+    } else {
+      latLng = this.getCenter();
+    }
+
+    params.lat = latLng.lat.toFixed(precision);
+    params.lon = latLng.lng.toFixed(precision);
+    params.zoom = this.getZoom();
+
+    return 'geo:' + params.lat + ',' + params.lon + '?z=' + params.zoom;
+  },
+
   addObject: function(object, callback) {
     var objectStyle = {
       color: "#FF6200",
   addObject: function(object, callback) {
     var objectStyle = {
       color: "#FF6200",
@@ -210,7 +222,7 @@ L.OSM.Map = L.Map.extend({
             return true;
           } else if (object.type === "relation") {
             for (var i = 0; i < relations.length; i++)
             return true;
           } else if (object.type === "relation") {
             for (var i = 0; i < relations.length; i++)
-              if (relations[i].members.indexOf(node) != -1)
+              if (relations[i].members.indexOf(node) !== -1)
                 return true;
           } else {
             return false;
                 return true;
           } else {
             return false;
@@ -236,7 +248,7 @@ L.OSM.Map = L.Map.extend({
       center: this.getCenter().wrap(),
       zoom: this.getZoom(),
       layers: this.getLayersCode()
       center: this.getCenter().wrap(),
       zoom: this.getZoom(),
       layers: this.getLayersCode()
-    }
+    };
   },
 
   setState: function(state, options) {
   },
 
   setState: function(state, options) {
@@ -275,7 +287,7 @@ L.extend(L.Icon.Default.prototype, {
   }
 });
 
   }
 });
 
-function getUserIcon(url) {
+OSM.getUserIcon = function (url) {
   return L.icon({
     iconUrl: url || OSM.MARKER_RED,
     iconSize: [25, 41],
   return L.icon({
     iconUrl: url || OSM.MARKER_RED,
     iconSize: [25, 41],
@@ -284,4 +296,4 @@ function getUserIcon(url) {
     shadowUrl: OSM.MARKER_SHADOW,
     shadowSize: [41, 41]
   });
     shadowUrl: OSM.MARKER_SHADOW,
     shadowSize: [41, 41]
   });
-}
+};