comparison 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
comparison
equal deleted inserted replaced
2495:98bc023750cf 2496:12ed6feefea5
373 firstDate, secondDate, 373 firstDate, secondDate,
374 ).Scan(&clip); err != nil { 374 ).Scan(&clip); err != nil {
375 return err 375 return err
376 } 376 }
377 377
378 var clippingPolygon octree.Polygon
379 if err := clippingPolygon.FromWKB(clip); err != nil {
380 return err
381 }
382 clippingPolygon.Indexify()
383
378 now = time.Now() 384 now = time.Now()
379 log.Printf("loading clipping polygon took %v\n", now.Sub(last)) 385 log.Printf("loading clipping polygon took %v\n", now.Sub(last))
380 last = now 386 last = now
381 387
382 tri, err := result.triangulate() 388 tri, err := result.triangulate()
394 now = time.Now() 400 now = time.Now()
395 log.Printf("building octree took %v\n", now.Sub(last)) 401 log.Printf("building octree took %v\n", now.Sub(last))
396 last = now 402 last = now
397 403
398 tree := builder.Tree() 404 tree := builder.Tree()
405 tree.Clip(&clippingPolygon)
406
407 now = time.Now()
408 log.Printf("clipping octree took %v\n", now.Sub(last))
409 last = now
399 410
400 log.Printf("min/max: %f %f\n", tree.Min.Z, tree.Max.Z) 411 log.Printf("min/max: %f %f\n", tree.Min.Z, tree.Max.Z)
401 412
402 var heights []float64 413 var heights []float64
403 414
428 439
429 log.Printf("num heights: %d\n", len(heights)) 440 log.Printf("num heights: %d\n", len(heights))
430 441
431 var dataSize int 442 var dataSize int
432 443
433 stmt, err := tx.PrepareContext(ctx, insertContourSQLClipped) 444 stmt, err := tx.PrepareContext(ctx, insertContourSQL)
434 if err != nil { 445 if err != nil {
435 return err 446 return err
436 } 447 }
437 defer stmt.Close() 448 defer stmt.Close()
438 449
442 log.Printf("%.2f: lines: %d\n", res.Height, len(res.Lines)) 453 log.Printf("%.2f: lines: %d\n", res.Height, len(res.Lines))
443 wkb := res.Lines.AsWKB2D() 454 wkb := res.Lines.AsWKB2D()
444 dataSize += len(wkb) 455 dataSize += len(wkb)
445 _, err = stmt.ExecContext( 456 _, err = stmt.ExecContext(
446 ctx, 457 ctx,
447 bottleneck, 458 wkb,
448 first.EPSG, 459 first.EPSG,
449 firstDate, 460 contourTolerance,
450 secondDate,
451 res.Height, 461 res.Height,
452 wkb,
453 contourTolerance,
454 ) 462 )
455 } 463 }
456 }) 464 })
457 465
458 if err != nil { 466 if err != nil {