comparison pkg/mesh/raster.go @ 5490:5f47eeea988d logging

Use own logging package.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 20 Sep 2021 17:45:39 +0200
parents 1a89084163d5
children 1222b777f51f
comparison
equal deleted inserted replaced
5488:a726a92ea5c9 5490:5f47eeea988d
12 // * Sascha L. Teichmann <sascha.teichmann@intevation.de> 12 // * Sascha L. Teichmann <sascha.teichmann@intevation.de>
13 13
14 package mesh 14 package mesh
15 15
16 import ( 16 import (
17 "log"
18 "math" 17 "math"
19 "runtime" 18 "runtime"
20 "sync" 19 "sync"
21 "time" 20 "time"
22 21
23 "github.com/fogleman/contourmap" 22 "github.com/fogleman/contourmap"
24 23
25 "gemma.intevation.de/gemma/pkg/common" 24 "gemma.intevation.de/gemma/pkg/common"
25 "gemma.intevation.de/gemma/pkg/log"
26 "gemma.intevation.de/gemma/pkg/wkb" 26 "gemma.intevation.de/gemma/pkg/wkb"
27 ) 27 )
28 28
29 type Raster struct { 29 type Raster struct {
30 BBox Box2D 30 BBox Box2D
38 38
39 func NewRaster(bbox Box2D, cellSize float64) *Raster { 39 func NewRaster(bbox Box2D, cellSize float64) *Raster {
40 40
41 width, height := bbox.Size() 41 width, height := bbox.Size()
42 42
43 log.Printf("info raster extent: %.2f / %.2f", width, height) 43 log.Infof("raster extent: %.2f / %.2f", width, height)
44 44
45 xCells := int(math.Ceil(width / cellSize)) 45 xCells := int(math.Ceil(width / cellSize))
46 yCells := int(math.Ceil(height / cellSize)) 46 yCells := int(math.Ceil(height / cellSize))
47 47
48 log.Printf("info raster size: %d / %d\n", xCells, yCells) 48 log.Infof("raster size: %d / %d\n", xCells, yCells)
49 49
50 size := (xCells + 2) * (yCells + 2) 50 size := (xCells + 2) * (yCells + 2)
51 cells := make([]float64, size) 51 cells := make([]float64, size)
52 for i := range cells { 52 for i := range cells {
53 cells[i] = noData 53 cells[i] = noData
229 cnts <- i 229 cnts <- i
230 } 230 }
231 close(cnts) 231 close(cnts)
232 232
233 wg.Wait() 233 wg.Wait()
234 log.Printf("info: Tracing areas took %v\n", time.Since(start)) 234 log.Infof("Tracing areas took %v\n", time.Since(start))
235 235
236 return areas 236 return areas
237 } 237 }
238 238
239 type contour []contourmap.Point 239 type contour []contourmap.Point
360 360
361 for _, cnt := range cnts { 361 for _, cnt := range cnts {
362 forest.insertRoot(contour(cnt)) 362 forest.insertRoot(contour(cnt))
363 } 363 }
364 364
365 //log.Printf("cnts: %d roots: %d\n", len(cnts), len(bf.roots)) 365 //log.Debugf("cnts: %d roots: %d\n", len(cnts), len(bf.roots))
366 366
367 var mp wkb.MultiPolygonGeom 367 var mp wkb.MultiPolygonGeom
368 368
369 out := func(sh contour, hls []contour) { 369 out := func(sh contour, hls []contour) {
370 370