Cache isIntersection

This commit is contained in:
John Firebaugh
2013-05-13 22:40:43 -07:00
parent afc8f109e8
commit 544c493eba
2 changed files with 9 additions and 7 deletions
+8
View File
@@ -23,6 +23,14 @@ _.extend(iD.Node.prototype, {
return this.update({loc: loc});
},
isIntersection: function(resolver) {
return resolver.transient(this, 'isIntersection', function() {
return resolver.parentWays(this).filter(function(parent) {
return parent.geometry(resolver) === 'line';
}).length > 1;
});
},
asJXON: function(changeset_id) {
var r = {
node: {
+1 -7
View File
@@ -48,12 +48,6 @@ iD.svg.Vertices = function(projection, context) {
return vertices;
}
function isIntersection(entity, graph) {
return graph.parentWays(entity).filter(function (parent) {
return parent.geometry(graph) === 'line';
}).length > 1;
}
function draw(groups, vertices, klass, graph, zoom) {
groups = groups.data(vertices, function(entity) {
return iD.Entity.key(entity) + ',' + zoom;
@@ -129,7 +123,7 @@ iD.svg.Vertices = function(projection, context) {
if (entity.id in selected ||
entity.hasInterestingTags() ||
isIntersection(entity, graph)) {
entity.isIntersection(graph)) {
vertices.push(entity)
}
}