changeset 974:7a89313f0ead

Fetch the octree directly from the builder. No need to deserialize it from the blob.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 18 Oct 2018 15:11:49 +0200
parents b6fec8f85599
children 3da707172772
files pkg/imports/sr.go pkg/octree/builder.go
diffstat 2 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/imports/sr.go	Thu Oct 18 13:09:49 2018 +0200
+++ b/pkg/imports/sr.go	Thu Oct 18 15:11:49 2018 +0200
@@ -325,7 +325,7 @@
 	start = time.Now()
 	builder.Build()
 	octreeIndex, err := builder.Bytes()
-	builder, tin = nil, nil // not needed from now on
+	tin = nil // not needed from now on
 	log.Printf("building octree took %s\n", time.Since(start))
 	if err != nil {
 		return err
@@ -342,10 +342,8 @@
 		return err
 	}
 
-	index, err := octree.Deserialize(octreeIndex)
-	if err != nil {
-		return err
-	}
+	index := builder.Tree()
+	builder = nil // not needed from now on
 
 	// TODO: Generate iso-lines
 
--- a/pkg/octree/builder.go	Thu Oct 18 13:09:49 2018 +0200
+++ b/pkg/octree/builder.go	Thu Oct 18 15:11:49 2018 +0200
@@ -178,3 +178,14 @@
 	}
 	return buf.Bytes(), nil
 }
+
+func (tb *Builder) Tree() *Tree {
+	return &Tree{
+		EPSG:      tb.t.EPSG,
+		vertices:  tb.t.Vertices,
+		triangles: tb.t.Triangles,
+		index:     tb.index,
+		Min:       tb.t.Min,
+		Max:       tb.t.Max,
+	}
+}