comparison pkg/octree/contours.go @ 2479:c85b16db8a02 octree-diff

Calculate better triangulation and store it into database. A bit fake by now. Needs extra: CREATE TABLE diff_contour_lines ( height numeric NOT NULL, lines geography(MultiLineString,4326) NOT NULL ); GRANT ALL ON diff_contour_lines TO sophie;
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 28 Feb 2019 15:55:32 +0100
parents f4dcbe8941a1
children 45d51a49f191
comparison
equal deleted inserted replaced
2478:930ca9c4e2a7 2479:c85b16db8a02
13 // * Tom Gottfried <tom.gottfried@intevation.de> 13 // * Tom Gottfried <tom.gottfried@intevation.de>
14 14
15 package octree 15 package octree
16 16
17 import ( 17 import (
18 "log"
18 "runtime" 19 "runtime"
19 "sync" 20 "sync"
20 ) 21 )
21 22
22 // ContourResult stores an calculated iso line for a given height. 23 // ContourResult stores an calculated iso line for a given height.
64 // This is done concurrently. 65 // This is done concurrently.
65 // It is guaranteed that the results are given to the store 66 // It is guaranteed that the results are given to the store
66 // function in order of the original heights values. 67 // function in order of the original heights values.
67 func DoContours(tree *Tree, heights []float64, store func(*ContourResult)) { 68 func DoContours(tree *Tree, heights []float64, store func(*ContourResult)) {
68 69
70 if len(heights) == 0 {
71 return
72 }
73
74 log.Printf("num heights: %d\n", len(heights))
75
69 contours := make([]*ContourResult, len(heights)) 76 contours := make([]*ContourResult, len(heights))
70 77
71 for i, h := range heights { 78 for i, h := range heights {
72 contours[i] = NewContourResult(h) 79 contours[i] = NewContourResult(h)
73 } 80 }