diff cmd/octreediff/main.go @ 2496:12ed6feefea5 octree-diff

Use octree clipping. Not working, yet!
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 04 Mar 2019 13:32:32 +0100
parents cb55d7eaaa36
children e0a7571ac13a
line wrap: on
line diff
--- a/cmd/octreediff/main.go	Mon Mar 04 12:45:44 2019 +0100
+++ b/cmd/octreediff/main.go	Mon Mar 04 13:32:32 2019 +0100
@@ -375,6 +375,12 @@
 			return err
 		}
 
+		var clippingPolygon octree.Polygon
+		if err := clippingPolygon.FromWKB(clip); err != nil {
+			return err
+		}
+		clippingPolygon.Indexify()
+
 		now = time.Now()
 		log.Printf("loading clipping polygon took %v\n", now.Sub(last))
 		last = now
@@ -396,6 +402,11 @@
 		last = now
 
 		tree := builder.Tree()
+		tree.Clip(&clippingPolygon)
+
+		now = time.Now()
+		log.Printf("clipping octree took %v\n", now.Sub(last))
+		last = now
 
 		log.Printf("min/max: %f %f\n", tree.Min.Z, tree.Max.Z)
 
@@ -430,7 +441,7 @@
 
 		var dataSize int
 
-		stmt, err := tx.PrepareContext(ctx, insertContourSQLClipped)
+		stmt, err := tx.PrepareContext(ctx, insertContourSQL)
 		if err != nil {
 			return err
 		}
@@ -444,13 +455,10 @@
 				dataSize += len(wkb)
 				_, err = stmt.ExecContext(
 					ctx,
-					bottleneck,
+					wkb,
 					first.EPSG,
-					firstDate,
-					secondDate,
+					contourTolerance,
 					res.Height,
-					wkb,
-					contourTolerance,
 				)
 			}
 		})