mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 23:44:47 +02:00
Fix Relation#multipolygon for unmatched inner rings (fixes #461)
This commit is contained in:
@@ -140,7 +140,7 @@ _.extend(iD.Relation.prototype, {
|
||||
if (o !== undefined)
|
||||
result[o].push(inners[i]);
|
||||
else
|
||||
result.push(inners[i]); // Invalid geometry
|
||||
result.push([inners[i]]); // Invalid geometry
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -298,6 +298,17 @@ describe('iD.Relation', function () {
|
||||
expect(r.multipolygon(graph)).to.eql([[[a, b, c, a], [d, e, f, d]], [[g, h, i, g]]]);
|
||||
});
|
||||
|
||||
specify("invalid geometry: unmatched inner", function () {
|
||||
var a = iD.Node(),
|
||||
b = iD.Node(),
|
||||
c = iD.Node(),
|
||||
w = iD.Way({nodes: [a.id, b.id, c.id, a.id]}),
|
||||
r = iD.Relation({members: [{id: w.id, role: 'inner', type: 'way'}]}),
|
||||
g = iD.Graph([a, b, c, w, r]);
|
||||
|
||||
expect(r.multipolygon(g)).to.eql([[[a, b, c, a]]]);
|
||||
});
|
||||
|
||||
specify("incomplete relation", function () {
|
||||
var a = iD.Node(),
|
||||
b = iD.Node(),
|
||||
|
||||
Reference in New Issue
Block a user