verify-aligned-far-tileset.mjs 1.4 KB

1234567891011121314151617181920212223242526
  1. // Verify the GIS-aligned far wrapper only references aligned coarse CAD content.
  2. import assert from 'node:assert/strict'
  3. import { readFileSync, existsSync } from 'node:fs'
  4. import { join, resolve } from 'node:path'
  5. const dir = resolve(process.argv[2] || 'tools/city-massing/city/cad-bim/far-aligned')
  6. const tree = JSON.parse(readFileSync(join(dir, 'tileset.json'), 'utf8'))
  7. const report = JSON.parse(readFileSync(join(dir, 'manifest.json'), 'utf8'))
  8. assert.equal(tree.asset.generator, 'CAD GIS-aligned far coarse wrapper')
  9. assert.equal(report.generator, tree.asset.generator)
  10. assert.equal(report.buildings, 30159)
  11. assert.ok(tree.root?.content?.uri?.endsWith('root-anchor.glb'))
  12. assert.equal(tree.root?.transform?.length, 16)
  13. assert.ok(tree.root.children?.length >= 70)
  14. assert.ok(!JSON.stringify(tree).includes('/gis/city'))
  15. assert.ok(!JSON.stringify(tree).includes('town.glb'))
  16. for (const child of tree.root.children) {
  17. assert.ok(/-(aligned|roofed2|roofed)\//.test(child.content?.uri || ''), child.id)
  18. assert.ok(child.content.uri.endsWith('-lod1.glb'), child.content.uri)
  19. assert.ok(child.boundingVolume?.box, child.id)
  20. const path = resolve(dir, child.content.uri)
  21. assert.ok(existsSync(path), `missing ${path}`)
  22. }
  23. console.log(JSON.stringify({ passed: true, buildings: report.buildings,
  24. coarseFiles: report.coarseFiles, childCount: tree.root.children.length,
  25. boundsENU: report.boundsENU }))