Force natural=coastline not to be an area (fixes #900)

This commit is contained in:
John Firebaugh
2013-03-05 17:39:05 -08:00
parent 8a646b79cc
commit e9b2563ad8
2 changed files with 23 additions and 4 deletions
+19 -4
View File
@@ -52,7 +52,7 @@ _.extend(iD.Way.prototype, {
if (!this.isClosed() || this.tags.area === 'no')
return false;
for (var key in this.tags)
if (key in iD.Way.areaKeys)
if (key in iD.Way.areaKeys && !(this.tags[key] in iD.Way.areaKeys[key]))
return true;
return false;
},
@@ -149,6 +149,21 @@ _.extend(iD.Way.prototype, {
}
});
iD.Way.areaKeys = iD.util.trueObj(['area', 'building', 'leisure', 'tourism', 'ruins',
'historic', 'landuse', 'military', 'natural', 'amenity', 'shop', 'man_made',
'public_transport']);
// A closed way is considered to be an area if it has a tag with one
// of the following keys, and the value is _not_ one of the associated
// values for the respective key.
iD.Way.areaKeys = {
area: {},
building: {},
leisure: {},
tourism: {},
ruins: {},
historic: {},
landuse: {},
military: {},
natural: iD.util.trueObj(['coastline']),
amenity: {},
shop: {},
man_made: {},
public_transport: {}
};
+4
View File
@@ -110,6 +110,10 @@ describe('iD.Way', function() {
it('returns false if the way is closed and has tag area=no', function() {
expect(iD.Way({nodes: ['n1', 'n1'], tags: {area: 'no', building: 'yes'}}).isArea()).to.equal(false);
});
it('returns false for coastline', function() {
expect(iD.Way({nodes: ['n1', 'n1'], tags: {natural: 'coastline'}}).isArea()).to.equal(false);
});
});
describe("#isDegenerate", function() {