Mercurial > gemma
comparison cmd/tin2octree/tin.go @ 664:a3d722e1f593 octree
octree: Load point cloud data projected in a suited UTM zone.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 18 Sep 2018 13:41:04 +0200 |
parents | af1d4d44a88a |
children | b0bd242ff821 |
comparison
equal
deleted
inserted
replaced
662:d856e458dd64 | 664:a3d722e1f593 |
---|---|
20 wkbNDR byte = 1 | 20 wkbNDR byte = 1 |
21 wkbTinZ uint32 = 1000 + 16 | 21 wkbTinZ uint32 = 1000 + 16 |
22 wkbTriangleZ uint32 = 1000 + 17 | 22 wkbTriangleZ uint32 = 1000 + 17 |
23 ) | 23 ) |
24 | 24 |
25 const wgs84 = 4326 | |
26 | |
25 type tin struct { | 27 type tin struct { |
28 epsg uint32 | |
26 vertices []vertex | 29 vertices []vertex |
27 triangles [][]int32 | 30 triangles [][]int32 |
28 | 31 |
29 min vertex | 32 min vertex |
30 max vertex | 33 max vertex |
153 } | 156 } |
154 } | 157 } |
155 triangles = append(triangles, triangle) | 158 triangles = append(triangles, triangle) |
156 } | 159 } |
157 | 160 |
161 log.Printf("bbox: [[%f, %f], [%f, %f]]\n", | |
162 min.x, min.y, max.x, max.y) | |
163 | |
158 *t = tin{ | 164 *t = tin{ |
165 epsg: wgs84, | |
159 vertices: vertices, | 166 vertices: vertices, |
160 triangles: triangles, | 167 triangles: triangles, |
161 min: min, | 168 min: min, |
162 max: max, | 169 max: max, |
163 } | 170 } |
183 } | 190 } |
184 return nil | 191 return nil |
185 } | 192 } |
186 | 193 |
187 func (t *tin) Serialize(w io.Writer) error { | 194 func (t *tin) Serialize(w io.Writer) error { |
195 | |
196 if err := binary.Write(w, binary.LittleEndian, t.epsg); err != nil { | |
197 return err | |
198 } | |
188 | 199 |
189 if err := t.min.write(w); err != nil { | 200 if err := t.min.write(w); err != nil { |
190 return err | 201 return err |
191 } | 202 } |
192 if err := t.max.write(w); err != nil { | 203 if err := t.max.write(w); err != nil { |