mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-17 22:24:49 +02:00
Force natural=coastline not to be an area (fixes #900)
This commit is contained in:
+19
-4
@@ -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: {}
|
||||
};
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user