Mercurial > gemma
comparison cmd/isoareas/main.go @ 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 |
comparison
equal
deleted
inserted
replaced
4545:e7970d84cb4f | 4546:a3f1d92b8597 |
---|---|
313 } | 313 } |
314 | 314 |
315 segment: | 315 segment: |
316 for e := pb.open.Front(); e != nil; e = e.Next() { | 316 for e := pb.open.Front(); e != nil; e = e.Next() { |
317 line := e.Value.(octree.LineStringZ) | 317 line := e.Value.(octree.LineStringZ) |
318 first, last := line[0], line[len(line)-1] | 318 if nline := glue(curr, line); nline != nil { |
319 | 319 curr = nline |
320 front, back := curr[0], curr[len(curr)-1] | |
321 | |
322 if back.EpsEquals(first) { | |
323 curr = append(curr, line[1:]...) | |
324 pb.open.Remove(e) | |
325 goto segment | |
326 } | |
327 | |
328 if back.EpsEquals(last) { | |
329 line.Reverse() | |
330 curr = append(curr, line[1:]...) | |
331 pb.open.Remove(e) | |
332 goto segment | |
333 } | |
334 | |
335 if front.EpsEquals(last) { | |
336 curr = append(line, curr[1:]...) | |
337 pb.open.Remove(e) | |
338 goto segment | |
339 } | |
340 | |
341 if front.EpsEquals(first) { | |
342 line.Reverse() | |
343 curr = append(line, curr[1:]...) | |
344 pb.open.Remove(e) | 320 pb.open.Remove(e) |
345 goto segment | 321 goto segment |
346 } | 322 } |
347 } // all open | 323 } // all open |
348 | 324 |