mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-24 09:04:02 +02:00
more clever splitting of closed ways
if a way is closed, iD needs to choose a second node to split the way at. This algorithm looks for a node that is both far away from the initial node in terms of way segment length and nearby in terms of beeline-distance. This assures that areas get split on the most "natural" points (independent of the number of nodes). For example: bone-shaped areas get split across their waist- line, circles across the diameter.
This commit is contained in:
@@ -259,10 +259,10 @@ describe("iD.actions.Split", function () {
|
||||
// d ==== c
|
||||
//
|
||||
var graph = iD.Graph({
|
||||
'a': iD.Node({id: 'a'}),
|
||||
'b': iD.Node({id: 'b'}),
|
||||
'c': iD.Node({id: 'c'}),
|
||||
'd': iD.Node({id: 'd'}),
|
||||
'a': iD.Node({id: 'a', loc: [0,1]}),
|
||||
'b': iD.Node({id: 'b', loc: [1,1]}),
|
||||
'c': iD.Node({id: 'c', loc: [1,0]}),
|
||||
'd': iD.Node({id: 'd', loc: [0,0]}),
|
||||
'-': iD.Way({id: '-', nodes: ['a', 'b', 'c', 'd', 'a']})
|
||||
});
|
||||
|
||||
@@ -285,10 +285,10 @@ describe("iD.actions.Split", function () {
|
||||
|
||||
it("splits an area by converting it to a multipolygon", function () {
|
||||
var graph = iD.Graph({
|
||||
'a': iD.Node({id: 'a'}),
|
||||
'b': iD.Node({id: 'b'}),
|
||||
'c': iD.Node({id: 'c'}),
|
||||
'd': iD.Node({id: 'd'}),
|
||||
'a': iD.Node({id: 'a', loc: [0,1]}),
|
||||
'b': iD.Node({id: 'b', loc: [1,1]}),
|
||||
'c': iD.Node({id: 'c', loc: [1,0]}),
|
||||
'd': iD.Node({id: 'd', loc: [0,0]}),
|
||||
'-': iD.Way({id: '-', tags: {building: 'yes'}, nodes: ['a', 'b', 'c', 'd', 'a']})
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user