Support changing tags

This commit is contained in:
Tom MacWright
2012-11-05 16:24:06 -05:00
parent 4d6c54b87e
commit 525f9fdc51
4 changed files with 16 additions and 36 deletions
+10
View File
@@ -38,6 +38,16 @@ iD.operations.addTemporary = function(map, node) {
map.update();
};
iD.operations.changeTags = function(map, node, tags) {
map.graph.modify(function(graph) {
var o = {};
var copy = pdata.object(node).set({ tags: tags }).get();
o[copy.id] = copy;
return graph.set(o);
}, 'changed tags');
map.update();
};
iD.operations.removeTemporary = function(map, node) {
map.graph.modify(function(graph) {
return graph.remove(node.id);
-21
View File
@@ -1,21 +0,0 @@
/*
iD.Node = function(id, lat, lon, tags, loaded) {
this.id = id;
this.lat = lat;
this.lon = lon;
this.tags = tags || {};
this.children = [];
this.loaded = (loaded === undefined) ? true : loaded;
};
iD.Node.prototype = {
type: 'node',
intersects: function(extent) {
return (this.lon >= extent[0][0]) &&
(this.lon <= extent[1][0]) &&
(this.lat <= extent[0][1]) &&
(this.lat >= extent[1][1]);
}
};
*/
-13
View File
@@ -1,13 +0,0 @@
iD.Relation = function(id, uid, children, tags, loaded) {
this.id = id;
this.uid = uid;
this.children = children || [];
this.tags = tags || {};
this.loaded = (loaded === undefined) ? true : loaded;
};
iD.Relation.prototype = {
type: 'relation',
intersects: function() { return true; }
};
+6 -2
View File
@@ -221,11 +221,15 @@ iD.Map = function(elem) {
selection = [d.id];
drawVector();
d3.select('.inspector-wrap')
.style('display', 'block')
.datum(d).call(inspector);
.style('display', 'block')
.datum(d).call(inspector);
d3.event.stopPropagation();
}
inspector.on('change', function(d, tags) {
iD.operations.changeTags(map, d, tags);
});
function zoomPan() {
projection
.translate(d3.event.translate)