mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-24 00:54:03 +02:00
Use d3.geo.area
This commit is contained in:
@@ -36,11 +36,6 @@ iD.Entity.key = function(entity) {
|
||||
return entity.id + 'v' + (entity.v || 0);
|
||||
};
|
||||
|
||||
iD.Entity.areaPath = d3.geo.path()
|
||||
.projection(d3.geo.mercator()
|
||||
.scale(12016420.517592335)
|
||||
.precision(0));
|
||||
|
||||
iD.Entity.prototype = {
|
||||
tags: {},
|
||||
|
||||
@@ -107,12 +102,9 @@ iD.Entity.prototype = {
|
||||
resolver.parentRelations(this).length > 0;
|
||||
},
|
||||
|
||||
// Returns the (possibly negative) area of the entity in square pixels at an
|
||||
// arbitrary unspecified zoom level -- so basically, only useful for relative
|
||||
// comparisons.
|
||||
area: function(resolver) {
|
||||
return resolver.transient(this, 'area', function() {
|
||||
return iD.Entity.areaPath.area(this.asGeoJSON(resolver, true));
|
||||
return d3.geo.area(this.asGeoJSON(resolver, true));
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user