diff cmd/octree2contour/main.go @ 727:41c8dc61f38f

Moved octree loading stuff to octree package.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sat, 22 Sep 2018 21:57:30 +0200
parents 5af9ab39e715
children 39b5cf9a6b8f
line wrap: on
line diff
--- a/cmd/octree2contour/main.go	Sat Sep 22 21:34:12 2018 +0200
+++ b/cmd/octree2contour/main.go	Sat Sep 22 21:57:30 2018 +0200
@@ -7,6 +7,8 @@
 	"sort"
 	"sync"
 	"time"
+
+	"gemma.intevation.de/gemma/pkg/octree"
 )
 
 var (
@@ -16,15 +18,15 @@
 )
 
 func processLevels(
-	tree *Octree,
+	tree *octree.Tree,
 	jobs <-chan float64,
 	results chan<- result,
 	wg *sync.WaitGroup,
 ) {
 	defer wg.Done()
 	for h := range jobs {
-		var lines MultiLineStringZ
-		tree.Horizontal(h, func(t *Triangle) {
+		var lines octree.MultiLineStringZ
+		tree.Horizontal(h, func(t *octree.Triangle) {
 			line := t.IntersectHorizontal(h)
 			if len(line) > 1 {
 				lines = append(lines, line)
@@ -34,11 +36,11 @@
 	}
 }
 
-func process(tree *Octree) []result {
+func process(tree *octree.Tree) []result {
 
 	if *one {
-		var lines MultiLineStringZ
-		tree.Horizontal(*step, func(t *Triangle) {
+		var lines octree.MultiLineStringZ
+		tree.Horizontal(*step, func(t *octree.Triangle) {
 			line := t.IntersectHorizontal(*step)
 			if len(line) > 0 {
 				lines = append(lines, line)
@@ -68,7 +70,7 @@
 		wg.Add(1)
 		go processLevels(tree, jobs, results, &wg)
 	}
-	for h := tree.Min.z; h <= tree.Max.z; h += *step {
+	for h := tree.Min.Z; h <= tree.Max.Z; h += *step {
 		jobs <- h
 	}
 	close(jobs)
@@ -88,7 +90,7 @@
 	for _, fname := range flag.Args() {
 		log.Printf("processing %s\n", fname)
 		start := time.Now()
-		tree, err := LoadOctree(fname)
+		tree, err := octree.LoadTree(fname)
 		if err != nil {
 			log.Printf("error: %v\n", err)
 			continue