Ensure isDegenerate can be called for all entities

This commit is contained in:
Bryan Housel
2017-01-23 14:17:41 -05:00
parent c9804fb3aa
commit ec2c2e6612
4 changed files with 51 additions and 0 deletions
+3
View File
@@ -153,6 +153,9 @@ osmEntity.prototype = {
return false;
},
isDegenerate: function() {
return true;
},
deprecatedTags: function() {
var tags = _.toPairs(this.tags);
+9
View File
@@ -36,6 +36,15 @@ _.extend(osmNode.prototype, {
},
isDegenerate: function() {
return !(
Array.isArray(this.loc) && this.loc.length === 2 &&
this.loc[0] >= -180 && this.loc[0] <= 180 &&
this.loc[1] >= -90 && this.loc[1] <= 90
);
},
isIntersection: function(resolver) {
return resolver.transient(this, 'isIntersection', function() {
return resolver.parentWays(this).filter(function(parent) {