diff pkg/imports/sr.go @ 4646:89a72e0e2f9b stree-experiment

Add a method to serialize an STRTree.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sun, 13 Oct 2019 15:45:39 +0200
parents fb09a43b062e
children 3eda5a7215ab
line wrap: on
line diff
--- a/pkg/imports/sr.go	Fri Oct 11 23:46:35 2019 +0200
+++ b/pkg/imports/sr.go	Sun Oct 13 15:45:39 2019 +0200
@@ -24,6 +24,7 @@
 	"errors"
 	"fmt"
 	"io"
+	"log"
 	"math"
 	"os"
 	"path"
@@ -565,6 +566,16 @@
 	feedback.Info("Clipping STR tree took %v.", time.Since(start))
 	feedback.Info("Number of triangles to clip %d.", len(removed))
 
+	start = time.Now()
+	s := octree.STRTree{Entries: 16}
+	s.BuildWithout(tin, removed)
+	if _, err2 := s.Bytes(); err2 != nil {
+		log.Printf("serializing STRTree failed: %v\n", err2)
+	}
+	log.Printf("Building strtree took: %v.\n", time.Since(start))
+
+	// return nil, UnchangedError("nothing to do")
+
 	feedback.Info("Build final octree index")
 
 	builder := octree.NewBuilder(tin)