mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
[WIP] attempting to add task outline gpxLayer to map_in_map
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
|
||||
<gpx xmlns="http://www.topografix.com/GPX/1/1">
|
||||
<metadata>
|
||||
<link href="https://github.com/hotosm/osm-tasking-manager2">
|
||||
<text>HOT Tasking Manager</text>
|
||||
</link>
|
||||
<time>2015-06-13T01:58:26.967102</time>
|
||||
</metadata>
|
||||
<trk>
|
||||
<name>Task for project 1062</name>
|
||||
<trkseg>
|
||||
<trkpt lon="85.8361816252" lat="27.702983731"></trkpt>
|
||||
<trkpt lon="85.8471679534" lat="27.702983731"></trkpt>
|
||||
<trkpt lon="85.8471679534" lat="27.7127102563"></trkpt>
|
||||
<trkpt lon="85.8361816252" lat="27.7127102563"></trkpt>
|
||||
<trkpt lon="85.8361816252" lat="27.702983731"></trkpt>
|
||||
</trkseg>
|
||||
</trk>
|
||||
</gpx>
|
||||
+19
-1
@@ -3,6 +3,8 @@ iD.ui.MapInMap = function(context) {
|
||||
|
||||
function map_in_map(selection) {
|
||||
var backgroundLayer = iD.TileLayer(),
|
||||
gpxLayer = iD.GpxLayer(context)
|
||||
.projection(context.projection),
|
||||
overlayLayer = iD.TileLayer(),
|
||||
projection = iD.geo.RawMercator(),
|
||||
zoom = d3.behavior.zoom()
|
||||
@@ -134,7 +136,6 @@ iD.ui.MapInMap = function(context) {
|
||||
.append('div')
|
||||
.attr('class', 'map-in-map-tiles');
|
||||
|
||||
|
||||
// redraw background
|
||||
backgroundLayer
|
||||
.source(context.background().baseLayerSource())
|
||||
@@ -152,6 +153,10 @@ iD.ui.MapInMap = function(context) {
|
||||
background
|
||||
.call(backgroundLayer);
|
||||
|
||||
// Add the gpxLayer _somewhere_ here
|
||||
// background
|
||||
// .call(gpxLayer)
|
||||
|
||||
// redraw overlay
|
||||
var overlaySources = context.background().overlayLayerSources(),
|
||||
hasOverlay = false;
|
||||
@@ -261,6 +266,19 @@ iD.ui.MapInMap = function(context) {
|
||||
if (drawn.full === true) redraw();
|
||||
});
|
||||
|
||||
function toDom(x) {
|
||||
return (new DOMParser()).parseFromString(x, 'text/xml');
|
||||
}
|
||||
|
||||
var q = iD.util.stringQs(location.hash.substring(1));
|
||||
var gpx = q.gpx;
|
||||
if (gpx) {
|
||||
d3.text(gpx, function(err, gpxTxt) {
|
||||
gpxLayer.geojson(toGeoJSON.gpx(toDom(gpxTxt)));
|
||||
console.log(gpxTxt)
|
||||
queueRedraw();
|
||||
});
|
||||
}
|
||||
redraw();
|
||||
|
||||
var keybinding = d3.keybinding('map-in-map')
|
||||
|
||||
Reference in New Issue
Block a user