Fix non-loaded way behavior

This commit is contained in:
Tom MacWright
2012-10-28 12:25:38 -04:00
parent 8f7f3a7204
commit f85b8241a7
4 changed files with 25 additions and 13 deletions
+19
View File
@@ -0,0 +1,19 @@
## Actions
Actions are operations on OSM data like adding nodes, moving ways,
and so on. They are initiated by controller states, like
`iD.controller.ControllerState` initiates a `CreatePOIAction` and
adds it to the undo stack.
## Entities
`iD.Entity` is the door from pure objects like `iD.Node` into a hierarchy
of objects - it provides handling of parents, children, and so on.
## loaded
The `.loaded` member of nodes and ways is because of [relations](http://wiki.openstreetmap.org/wiki/Relation),
which refer to elements, so we want to have real references of those
elements, but we don't have the data yet. Thus when the Connection
encounters a new object but has a non-loaded representation of it,
the non-loaded version is replaced.
+2
View File
@@ -102,12 +102,14 @@ circle.handle {
}
.stroke.highway-footway,
.stroke.highway-cycleway,
.stroke.highway-steps {
stroke: #ff6257;
stroke-width: 3;
stroke-dasharray: 6, 6;
}
.casing.highway-footway,
.casing.highway-cycleway,
.casing.highway-steps {
stroke-width: 3;
stroke: #fff;
+3 -13
View File
@@ -20,20 +20,10 @@ iD.Connection = function(apiURL) {
function assign(obj) {
// summary: Save an entity to the data store.
if (obj.entityType === 'node') { // never reassign nodes
if (!entities[obj.id]) entities[obj.id] = obj;
} else if (obj.entityType === 'way') {
if (!entities[obj.id]) {
entities[obj.id] = obj;
} else {
/*
for (var n = 0; n < obj.nodes.length; n++) {
entities[obj.id].addNode(obj.nodes[n]);
}
*/
}
} else if (obj.entityType === 'relation') {
if (obj.entityType === 'relation') {
if (!relations[obj.id]) relations[obj.id] = obj;
} else if (!entities[obj.id] || !entities[obj.id].loaded) {
entities[obj.id] = obj;
}
}
+1
View File
@@ -29,6 +29,7 @@ iD.Way = function(id, nodes, tags, loaded) {
};
iD.Way.prototype = {
addNode: function(node) {
node.entity.addParent(this);
this.nodes.push(node);