decMesh decodes the mesh from the specified geometry
(start xml.StartElement, geom *Geometry)
| 288 | |
| 289 | // decMesh decodes the mesh from the specified geometry |
| 290 | func (d *Decoder) decMesh(start xml.StartElement, geom *Geometry) error { |
| 291 | |
| 292 | // Associates this mesh to the parent geometry |
| 293 | mesh := &Mesh{} |
| 294 | geom.GeometricElement = mesh |
| 295 | |
| 296 | // Decodes mesh children |
| 297 | for { |
| 298 | // Get next child |
| 299 | child, _, err := d.decNextChild(start) |
| 300 | if err != nil || child.Name.Local == "" { |
| 301 | return err |
| 302 | } |
| 303 | //log.Debug("decMesh(%s): %s", start.Name.Local, child.Name.Local) |
| 304 | // Decodes source |
| 305 | if child.Name.Local == "source" { |
| 306 | source, err := d.decSource(child) |
| 307 | if err != nil { |
| 308 | return err |
| 309 | } |
| 310 | mesh.Source = append(mesh.Source, source) |
| 311 | continue |
| 312 | } |
| 313 | // Decodes vertices |
| 314 | if child.Name.Local == "vertices" { |
| 315 | err = d.decVertices(child, mesh) |
| 316 | if err != nil { |
| 317 | return err |
| 318 | } |
| 319 | continue |
| 320 | } |
| 321 | // Decodes lines |
| 322 | if child.Name.Local == "lines" { |
| 323 | err = d.decLines(child, mesh) |
| 324 | if err != nil { |
| 325 | return err |
| 326 | } |
| 327 | continue |
| 328 | } |
| 329 | // Decodes polylist |
| 330 | if child.Name.Local == "polylist" { |
| 331 | err = d.decPolylist(child, mesh) |
| 332 | if err != nil { |
| 333 | return err |
| 334 | } |
| 335 | continue |
| 336 | } |
| 337 | // Decodes triangles |
| 338 | if child.Name.Local == "triangles" { |
| 339 | err = d.decTriangles(child, mesh) |
| 340 | if err != nil { |
| 341 | return err |
| 342 | } |
| 343 | continue |
| 344 | } |
| 345 | } |
| 346 | } |
| 347 |
no test coverage detected