mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 13:38:26 +02:00
Prevent no-match parent relations from breaking getMatches
(e.g. a site relation with a fence in it) Also, updated the test graph to contain one of these. see https://github.com/openstreetmap/iD/pull/2554#issuecomment-78517442
This commit is contained in:
@@ -305,8 +305,10 @@ iD.Features = function(context) {
|
||||
var parents = features.getParents(entity, resolver, geometry);
|
||||
if (parents.length === 1) {
|
||||
var pkey = iD.Entity.key(parents[0]);
|
||||
matches = _.clone(_cache[pkey].matches);
|
||||
continue;
|
||||
if (_cache[pkey] && _cache[pkey].matches) {
|
||||
matches = _.clone(_cache[pkey].matches);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,6 +135,8 @@ describe('iD.Features', function() {
|
||||
iD.Way({id: 'scrub', tags: {area: 'yes', natural: 'scrub'}, version: 1}),
|
||||
iD.Way({id: 'industrial', tags: {area: 'yes', landuse: 'industrial'}, version: 1}),
|
||||
iD.Way({id: 'parkinglot', tags: {area: 'yes', amenity: 'parking', parking: 'surface'}, version: 1}),
|
||||
|
||||
// Landuse with hole
|
||||
iD.Way({id: 'inner', version: 1}),
|
||||
iD.Way({id: 'outer', version: 1}),
|
||||
iD.Relation({id: 'retail', tags: {landuse: 'retail', type: 'multipolygon'},
|
||||
@@ -175,7 +177,17 @@ describe('iD.Features', function() {
|
||||
|
||||
// Others
|
||||
iD.Way({id: 'fence', tags: {barrier: 'fence'}, version: 1}),
|
||||
iD.Way({id: 'pipeline', tags: {man_made: 'pipeline'}, version: 1})
|
||||
iD.Way({id: 'pipeline', tags: {man_made: 'pipeline'}, version: 1}),
|
||||
|
||||
// Site relation
|
||||
iD.Relation({id: 'site', tags: {type: 'site'},
|
||||
members: [
|
||||
{id: 'fence', role: 'perimeter'},
|
||||
{id: 'building_yes'}
|
||||
],
|
||||
version: 1
|
||||
}),
|
||||
|
||||
]),
|
||||
all = _.values(graph.base().entities);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user