From e30995921e89c75d6b8c4fc5c04940c81e39660c Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Fri, 11 Jan 2013 15:35:10 -0500 Subject: [PATCH] Remove indirection between entity and types --- js/id/connection.js | 11 +++++++++-- js/id/graph/entity.js | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/js/id/connection.js b/js/id/connection.js index 2ac1ffe7f..195a2cd68 100644 --- a/js/id/connection.js +++ b/js/id/connection.js @@ -77,8 +77,15 @@ iD.Connection = function() { delete o.lat; } o.id = iD.Entity.id.fromOSM(o.type, o.id); - if (o.type === 'node') o._poi = !refNodes[o.id]; - return iD.Entity(o); + switch (o.type) { + case 'node': + o._poi = !refNodes[o.id]; + return iD.Node(o); + case 'way': + return iD.Way(o); + case 'relation': + return iD.Relation(o); + } } function parse(dom) { diff --git a/js/id/graph/entity.js b/js/id/graph/entity.js index 52b841544..afc152589 100644 --- a/js/id/graph/entity.js +++ b/js/id/graph/entity.js @@ -26,7 +26,7 @@ iD.Entity.id.toOSM = function (id) { // A function suitable for use as the second argument to d3.selection#data(). iD.Entity.key = function (entity) { return entity.id; -} +}; iD.Entity.prototype = { tags: {},