comparison pkg/mesh/tin.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 4847ac70103a
children 1222b777f51f
comparison
equal deleted inserted replaced
5488:a726a92ea5c9 5490:5f47eeea988d
17 "bytes" 17 "bytes"
18 "encoding/binary" 18 "encoding/binary"
19 "errors" 19 "errors"
20 "fmt" 20 "fmt"
21 "io" 21 "io"
22 "log"
23 "math" 22 "math"
24 23
24 "gemma.intevation.de/gemma/pkg/log"
25 "gemma.intevation.de/gemma/pkg/models" 25 "gemma.intevation.de/gemma/pkg/models"
26 "gemma.intevation.de/gemma/pkg/wkb" 26 "gemma.intevation.de/gemma/pkg/wkb"
27 ) 27 )
28 28
29 var ( 29 var (
54 54
55 // FromWKB constructs the TIN from a WKB representation. 55 // FromWKB constructs the TIN from a WKB representation.
56 // Shared vertices are identified and referenced by the 56 // Shared vertices are identified and referenced by the
57 // same index. 57 // same index.
58 func (t *Tin) FromWKB(data []byte) error { 58 func (t *Tin) FromWKB(data []byte) error {
59 log.Printf("info: data length %d\n", len(data)) 59 log.Infof("data length %d\n", len(data))
60 60
61 r := bytes.NewReader(data) 61 r := bytes.NewReader(data)
62 62
63 endian, err := r.ReadByte() 63 endian, err := r.ReadByte()
64 64
178 } 178 }
179 } 179 }
180 triangles = append(triangles, triangle) 180 triangles = append(triangles, triangle)
181 } 181 }
182 182
183 log.Printf("info: bbox: [[%f, %f], [%f, %f]]\n", 183 log.Infof("bbox: [[%f, %f], [%f, %f]]\n",
184 min.X, min.Y, max.X, max.Y) 184 min.X, min.Y, max.X, max.Y)
185 185
186 *t = Tin{ 186 *t = Tin{
187 EPSG: models.WGS84, 187 EPSG: models.WGS84,
188 Vertices: vertices, 188 Vertices: vertices,
238 } 238 }
239 239
240 if err != nil { 240 if err != nil {
241 return err 241 return err
242 } 242 }
243 log.Printf("info: vertices %d (%d)\n", len(t.Vertices), len(t.Vertices)*3*8) 243 log.Infof("vertices %d (%d)\n", len(t.Vertices), len(t.Vertices)*3*8)
244 244
245 if err := binary.Write( 245 if err := binary.Write(
246 w, binary.LittleEndian, uint32(len(t.Triangles))); err != nil { 246 w, binary.LittleEndian, uint32(len(t.Triangles))); err != nil {
247 return err 247 return err
248 } 248 }
262 written += n 262 written += n
263 } 263 }
264 last = idx 264 last = idx
265 } 265 }
266 } 266 }
267 log.Printf("info: compressed tin indices in bytes: %d (%d)\n", 267 log.Infof("compressed tin indices in bytes: %d (%d)\n",
268 written, 3*4*len(t.Triangles)) 268 written, 3*4*len(t.Triangles))
269 269
270 return nil 270 return nil
271 } 271 }