Mercurial > gemma
comparison 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 |
comparison
equal
deleted
inserted
replaced
4643:a1a9b1eab57c | 4646:89a72e0e2f9b |
---|---|
22 "database/sql" | 22 "database/sql" |
23 "encoding/hex" | 23 "encoding/hex" |
24 "errors" | 24 "errors" |
25 "fmt" | 25 "fmt" |
26 "io" | 26 "io" |
27 "log" | |
27 "math" | 28 "math" |
28 "os" | 29 "os" |
29 "path" | 30 "path" |
30 "path/filepath" | 31 "path/filepath" |
31 "strconv" | 32 "strconv" |
563 clippingPolygonBuffered.Indexify() | 564 clippingPolygonBuffered.Indexify() |
564 removed = str.Clip(&clippingPolygonBuffered) | 565 removed = str.Clip(&clippingPolygonBuffered) |
565 feedback.Info("Clipping STR tree took %v.", time.Since(start)) | 566 feedback.Info("Clipping STR tree took %v.", time.Since(start)) |
566 feedback.Info("Number of triangles to clip %d.", len(removed)) | 567 feedback.Info("Number of triangles to clip %d.", len(removed)) |
567 | 568 |
569 start = time.Now() | |
570 s := octree.STRTree{Entries: 16} | |
571 s.BuildWithout(tin, removed) | |
572 if _, err2 := s.Bytes(); err2 != nil { | |
573 log.Printf("serializing STRTree failed: %v\n", err2) | |
574 } | |
575 log.Printf("Building strtree took: %v.\n", time.Since(start)) | |
576 | |
577 // return nil, UnchangedError("nothing to do") | |
578 | |
568 feedback.Info("Build final octree index") | 579 feedback.Info("Build final octree index") |
569 | 580 |
570 builder := octree.NewBuilder(tin) | 581 builder := octree.NewBuilder(tin) |
571 builder.Build(removed) | 582 builder.Build(removed) |
572 octreeIndex, err := builder.Bytes() | 583 octreeIndex, err := builder.Bytes() |