Cache area

This commit is contained in:
John Firebaugh
2013-05-13 22:46:29 -07:00
parent 544c493eba
commit 51cb9af907
2 changed files with 8 additions and 2 deletions
+6
View File
@@ -95,6 +95,12 @@ iD.Entity.prototype = {
return this.extent(resolver).intersects(extent);
},
area: function(resolver, path) {
return resolver.transient(this, 'area', function() {
return path.area(this);
});
},
hasInterestingTags: function() {
return _.keys(this.tags).some(function(key) {
return key != 'attribution' &&
+2 -2
View File
@@ -37,12 +37,12 @@ iD.svg.Areas = function(projection) {
if (multipolygon = iD.geo.isSimpleMultipolygonOuterMember(entity, graph)) {
areas[multipolygon.id] = {
entity: multipolygon.mergeTags(entity.tags),
area: Math.abs(path.area(entity))
area: Math.abs(entity.area(graph, path))
};
} else if (!areas[entity.id]) {
areas[entity.id] = {
entity: entity,
area: Math.abs(path.area(entity))
area: Math.abs(entity.area(graph, path))
};
}
}