X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/0aa32990d5d5b0a7889a0937b678900debf8bba8..9cc9a0098840363b6497337951b53aa583f4aa44:/vendor/assets/leaflet/leaflet.osm.js diff --git a/vendor/assets/leaflet/leaflet.osm.js b/vendor/assets/leaflet/leaflet.osm.js index dcb1e984a..4f8c9e230 100644 --- a/vendor/assets/leaflet/leaflet.osm.js +++ b/vendor/assets/leaflet/leaflet.osm.js @@ -39,6 +39,15 @@ L.OSM.MapQuestOpen = L.OSM.TileLayer.extend({ } }); +L.OSM.HOT = L.OSM.TileLayer.extend({ + options: { + url: 'http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', + maxZoom: 20, + subdomains: 'abc', + attribution: "Tiles courtesy of Humanitarian OpenStreetMap Team" + } +}); + L.OSM.DataLayer = L.FeatureGroup.extend({ options: { areaTags: ['area', 'building', 'leisure', 'tourism', 'ruins', 'historic', 'landuse', 'military', 'natural', 'sport'], @@ -64,7 +73,9 @@ L.OSM.DataLayer = L.FeatureGroup.extend({ for (var i = 0; i < features.length; i++) { var feature = features[i], layer; - if (feature.type === "node") { + if (feature.type === "changeset") { + layer = L.rectangle(feature.latLngBounds, this.options.styles.changeset); + } else if (feature.type === "node") { layer = L.circleMarker(feature.latLng, this.options.styles.node); } else { var latLngs = new Array(feature.nodes.length); @@ -87,7 +98,7 @@ L.OSM.DataLayer = L.FeatureGroup.extend({ }, buildFeatures: function (xml) { - var features = [], + var features = L.OSM.getChangesets(xml), nodes = L.OSM.getNodes(xml), ways = L.OSM.getWays(xml, nodes), relations = L.OSM.getRelations(xml, nodes, ways); @@ -151,6 +162,25 @@ L.OSM.DataLayer = L.FeatureGroup.extend({ }); L.Util.extend(L.OSM, { + getChangesets: function (xml) { + var result = []; + + var nodes = xml.getElementsByTagName("changeset"); + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i], id = node.getAttribute("id"); + result.push({ + id: id, + type: "changeset", + latLngBounds: L.latLngBounds( + [node.getAttribute("min_lat"), node.getAttribute("min_lon")], + [node.getAttribute("max_lat"), node.getAttribute("max_lon")]), + tags: this.getTags(node) + }); + } + + return result; + }, + getNodes: function (xml) { var result = {};