mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-05 22:46:38 +02:00
@@ -203,9 +203,9 @@ iD.Connection = function() {
|
||||
};
|
||||
};
|
||||
|
||||
connection.changesetTags = function(comment, imagery_used) {
|
||||
connection.changesetTags = function(comment, imageryUsed) {
|
||||
var tags = {
|
||||
imagery_used: imagery_used.join(';'),
|
||||
imagery_used: imageryUsed.join(';'),
|
||||
created_by: 'iD ' + iD.version
|
||||
};
|
||||
|
||||
@@ -216,12 +216,12 @@ iD.Connection = function() {
|
||||
return tags;
|
||||
};
|
||||
|
||||
connection.putChangeset = function(changes, comment, imagery_used, callback) {
|
||||
connection.putChangeset = function(changes, comment, imageryUsed, callback) {
|
||||
oauth.xhr({
|
||||
method: 'PUT',
|
||||
path: '/api/0.6/changeset/create',
|
||||
options: { header: { 'Content-Type': 'text/xml' } },
|
||||
content: JXON.stringify(connection.changesetJXON(connection.changesetTags(comment, imagery_used)))
|
||||
content: JXON.stringify(connection.changesetJXON(connection.changesetTags(comment, imageryUsed)))
|
||||
}, function(err, changeset_id) {
|
||||
if (err) return callback(err);
|
||||
oauth.xhr({
|
||||
|
||||
+15
-8
@@ -1,6 +1,6 @@
|
||||
iD.History = function(context) {
|
||||
var stack, index, tree,
|
||||
imagery_used = 'Bing',
|
||||
imageryUsed = ['Bing'],
|
||||
dispatch = d3.dispatch('change', 'undone', 'redone'),
|
||||
lock = false;
|
||||
|
||||
@@ -21,7 +21,7 @@ iD.History = function(context) {
|
||||
return {
|
||||
graph: graph,
|
||||
annotation: annotation,
|
||||
imagery_used: imagery_used
|
||||
imageryUsed: imageryUsed
|
||||
};
|
||||
}
|
||||
|
||||
@@ -162,11 +162,18 @@ iD.History = function(context) {
|
||||
return this.difference().length();
|
||||
},
|
||||
|
||||
imagery_used: function(source) {
|
||||
if (source) imagery_used = source;
|
||||
else return _.without(
|
||||
_.unique(_.pluck(stack.slice(1, index + 1), 'imagery_used')),
|
||||
undefined, 'Custom');
|
||||
imageryUsed: function(sources) {
|
||||
if (sources) {
|
||||
imageryUsed = sources;
|
||||
return history;
|
||||
} else {
|
||||
return _(stack.slice(1, index + 1))
|
||||
.pluck('imageryUsed')
|
||||
.flatten()
|
||||
.unique()
|
||||
.without(undefined, 'Custom')
|
||||
.value();
|
||||
}
|
||||
},
|
||||
|
||||
reset: function() {
|
||||
@@ -182,7 +189,7 @@ iD.History = function(context) {
|
||||
|
||||
var s = stack.map(function(i) {
|
||||
var x = { entities: i.graph.entities };
|
||||
if (i.imagery_used) x.imagery_used = i.imagery_used;
|
||||
if (i.imageryUsed) x.imageryUsed = i.imageryUsed;
|
||||
if (i.annotation) x.annotation = i.annotation;
|
||||
return x;
|
||||
});
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ iD.modes.Save = function(context) {
|
||||
context.connection().putChangeset(
|
||||
context.history().changes(iD.actions.DiscardTags(context.history().difference())),
|
||||
e.comment,
|
||||
context.history().imagery_used(),
|
||||
context.history().imageryUsed(),
|
||||
function(err, changeset_id) {
|
||||
loading.close();
|
||||
if (err) {
|
||||
|
||||
@@ -22,13 +22,13 @@ iD.Background = function(context) {
|
||||
});
|
||||
}
|
||||
|
||||
function updateHash() {
|
||||
function updateImagery() {
|
||||
var b = background.baseLayerSource().data,
|
||||
o = overlayLayers.map(function (d) { return d.source().data.sourcetag; }).join(','),
|
||||
q = iD.util.stringQs(location.hash.substring(1));
|
||||
|
||||
var tag = b && b.sourcetag;
|
||||
if (!tag && b && b.name === 'Custom') {
|
||||
var tag = b.sourcetag;
|
||||
if (!tag && b.name === 'Custom') {
|
||||
tag = 'custom:' + b.template;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,23 @@ iD.Background = function(context) {
|
||||
}
|
||||
|
||||
location.replace('#' + iD.util.qsString(q, true));
|
||||
|
||||
var imageryUsed = [];
|
||||
if (b.name === 'Custom') {
|
||||
imageryUsed.push('Custom (' + b.template + ')');
|
||||
} else {
|
||||
imageryUsed.push(b.sourcetag || b.name);
|
||||
}
|
||||
|
||||
overlayLayers.forEach(function (d) {
|
||||
imageryUsed.push(d.source().data.sourcetag || d.source().data.name);
|
||||
});
|
||||
|
||||
if (background.showsGpxLayer()) {
|
||||
imageryUsed.push('Local GPX');
|
||||
}
|
||||
|
||||
context.history().imageryUsed(imageryUsed);
|
||||
}
|
||||
|
||||
function background(selection) {
|
||||
@@ -101,15 +118,7 @@ iD.Background = function(context) {
|
||||
|
||||
baseLayer.source(d);
|
||||
dispatch.change();
|
||||
updateHash();
|
||||
|
||||
if (d.data.name === 'Custom (customized)') {
|
||||
context.history()
|
||||
.imagery_used('Custom (' + d.data.template + ')');
|
||||
} else {
|
||||
context.history()
|
||||
.imagery_used(d.data.sourcetag || d.data.name);
|
||||
}
|
||||
updateImagery();
|
||||
|
||||
return background;
|
||||
};
|
||||
@@ -150,7 +159,7 @@ iD.Background = function(context) {
|
||||
if (layer.source() === d) {
|
||||
overlayLayers.splice(i, 1);
|
||||
dispatch.change();
|
||||
updateHash();
|
||||
updateImagery();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -162,7 +171,7 @@ iD.Background = function(context) {
|
||||
|
||||
overlayLayers.push(layer);
|
||||
dispatch.change();
|
||||
updateHash();
|
||||
updateImagery();
|
||||
};
|
||||
|
||||
background.nudge = function(d, zoom) {
|
||||
|
||||
Reference in New Issue
Block a user