Mercurial > gemma
changeset 4546:a3f1d92b8597 iso-areas
Simplified code.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 27 Sep 2019 17:26:43 +0200 |
parents | e7970d84cb4f |
children | 6247f5a42226 |
files | cmd/isoareas/main.go |
diffstat | 1 files changed, 2 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/cmd/isoareas/main.go Fri Sep 27 17:13:29 2019 +0200 +++ b/cmd/isoareas/main.go Fri Sep 27 17:26:43 2019 +0200 @@ -315,32 +315,8 @@ segment: for e := pb.open.Front(); e != nil; e = e.Next() { line := e.Value.(octree.LineStringZ) - first, last := line[0], line[len(line)-1] - - front, back := curr[0], curr[len(curr)-1] - - if back.EpsEquals(first) { - curr = append(curr, line[1:]...) - pb.open.Remove(e) - goto segment - } - - if back.EpsEquals(last) { - line.Reverse() - curr = append(curr, line[1:]...) - pb.open.Remove(e) - goto segment - } - - if front.EpsEquals(last) { - curr = append(line, curr[1:]...) - pb.open.Remove(e) - goto segment - } - - if front.EpsEquals(first) { - line.Reverse() - curr = append(line, curr[1:]...) + if nline := glue(curr, line); nline != nil { + curr = nline pb.open.Remove(e) goto segment }