@math.gl/geospatial 5.0.0-beta.8 → 5.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/crs/crs-descriptor-types.d.ts +2 -1
- package/dist/crs/crs-descriptor-types.d.ts.map +1 -1
- package/dist/crs/index.cjs +54 -0
- package/dist/crs/index.cjs.map +2 -2
- package/dist/crs/index.d.ts +1 -0
- package/dist/crs/index.d.ts.map +1 -1
- package/dist/crs/index.js +1 -0
- package/dist/crs/index.js.map +1 -1
- package/dist/crs/spatial-reference-metadata.d.ts +20 -0
- package/dist/crs/spatial-reference-metadata.d.ts.map +1 -0
- package/dist/crs/spatial-reference-metadata.js +86 -0
- package/dist/crs/spatial-reference-metadata.js.map +1 -0
- package/dist/ellipsoid-helpers/ellipsoid-transform.d.ts +1 -1
- package/dist/ellipsoid-helpers/ellipsoid-transform.d.ts.map +1 -1
- package/dist/ellipsoid-helpers/ellipsoid-transform.js +2 -2
- package/dist/ellipsoid-helpers/ellipsoid-transform.js.map +1 -1
- package/dist/ellipsoid-helpers/scale-to-geodetic-surface.js +1 -1
- package/dist/ellipsoid-helpers/scale-to-geodetic-surface.js.map +1 -1
- package/dist/ellipsoid-helpers/tangent-plane-numerics.d.ts +1 -1
- package/dist/ellipsoid-helpers/tangent-plane-numerics.d.ts.map +1 -1
- package/dist/ellipsoid-tangent-plane.d.ts +2 -2
- package/dist/ellipsoid-tangent-plane.d.ts.map +1 -1
- package/dist/ellipsoid-tangent-plane.js +1 -1
- package/dist/ellipsoid-tangent-plane.js.map +1 -1
- package/dist/ellipsoid-transforms.d.ts +2 -2
- package/dist/ellipsoid-transforms.d.ts.map +1 -1
- package/dist/ellipsoid-transforms.js +1 -1
- package/dist/ellipsoid-transforms.js.map +1 -1
- package/dist/ellipsoid.d.ts +2 -2
- package/dist/ellipsoid.d.ts.map +1 -1
- package/dist/ellipsoid.js +2 -2
- package/dist/ellipsoid.js.map +1 -1
- package/dist/expressions.d.ts +1 -1
- package/dist/expressions.d.ts.map +1 -1
- package/dist/expressions.js +1 -1
- package/dist/expressions.js.map +1 -1
- package/dist/geodesic-buffer.d.ts +1 -1
- package/dist/geodesic-buffer.d.ts.map +1 -1
- package/dist/geodesic-path.d.ts +1 -1
- package/dist/geodesic-path.d.ts.map +1 -1
- package/dist/geometry-constructors.d.ts +6 -0
- package/dist/geometry-constructors.d.ts.map +1 -0
- package/dist/geometry-constructors.js +37 -0
- package/dist/geometry-constructors.js.map +1 -0
- package/dist/geometry-inspection.d.ts +8 -0
- package/dist/geometry-inspection.d.ts.map +1 -0
- package/dist/geometry-inspection.js +61 -0
- package/dist/geometry-inspection.js.map +1 -0
- package/dist/index.cjs +3773 -846
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +173 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +115 -0
- package/dist/index.js.map +1 -1
- package/dist/line-simplification.d.ts +4 -0
- package/dist/line-simplification.d.ts.map +1 -0
- package/dist/line-simplification.js +83 -0
- package/dist/line-simplification.js.map +1 -0
- package/dist/linear-referencing.d.ts +6 -0
- package/dist/linear-referencing.d.ts.map +1 -0
- package/dist/linear-referencing.js +74 -0
- package/dist/linear-referencing.js.map +1 -0
- package/dist/lng-lat-rectangle.d.ts +1 -1
- package/dist/lng-lat-rectangle.d.ts.map +1 -1
- package/dist/lng-lat-rectangle.js +1 -1
- package/dist/lng-lat-rectangle.js.map +1 -1
- package/dist/local-reference-frame.d.ts +3 -3
- package/dist/local-reference-frame.d.ts.map +1 -1
- package/dist/local-reference-frame.js +2 -2
- package/dist/local-reference-frame.js.map +1 -1
- package/dist/make-obb-from-region.d.ts +1 -1
- package/dist/make-obb-from-region.d.ts.map +1 -1
- package/dist/make-obb-from-region.js +1 -1
- package/dist/make-obb-from-region.js.map +1 -1
- package/dist/maps/air-ocean-mesh.js +1 -1
- package/dist/maps/air-ocean-mesh.js.map +1 -1
- package/dist/maps/myriahedral/unfold.d.ts +1 -1
- package/dist/maps/myriahedral/unfold.d.ts.map +1 -1
- package/dist/maps/myriahedral/unfold.js +1 -1
- package/dist/maps/myriahedral/unfold.js.map +1 -1
- package/dist/maps/presets.cjs +6 -6
- package/dist/maps/presets.cjs.map +2 -2
- package/dist/maps.cjs +6 -6
- package/dist/maps.cjs.map +2 -2
- package/dist/projection/deformation.cjs +5 -5
- package/dist/projection/deformation.cjs.map +2 -2
- package/dist/projection/experimental/core.cjs +8 -4
- package/dist/projection/experimental/core.cjs.map +1 -1
- package/dist/projection/experimental/crs/spatial-reference.d.ts.map +1 -1
- package/dist/projection/experimental/crs/spatial-reference.js.map +1 -1
- package/dist/projection/experimental/crs/types.d.ts +1 -1
- package/dist/projection/experimental/crs/types.d.ts.map +1 -1
- package/dist/projection/experimental/crs-rendering-scale.d.ts.map +1 -1
- package/dist/projection/experimental/crs-rendering-scale.js +13 -2
- package/dist/projection/experimental/crs-rendering-scale.js.map +1 -1
- package/dist/projection/experimental/datum.js +1 -1
- package/dist/projection/experimental/datum.js.map +1 -1
- package/dist/projection/experimental/entries/projections/geocent.cjs +3 -3
- package/dist/projection/experimental/entries/projections/geocent.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/aea.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/aea.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/aea.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/aea.js +4 -1
- package/dist/projection/experimental/lazy-projections/aea.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/bonne.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/bonne.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/bonne.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/bonne.js +4 -1
- package/dist/projection/experimental/lazy-projections/bonne.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/cass.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/cass.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/cass.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/cass.js +4 -1
- package/dist/projection/experimental/lazy-projections/cass.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/eck6.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/eck6.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/eck6.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/eck6.js +4 -1
- package/dist/projection/experimental/lazy-projections/eck6.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/eqdc.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/eqdc.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/eqdc.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/eqdc.js +4 -1
- package/dist/projection/experimental/lazy-projections/eqdc.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/eqearth.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/eqearth.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/eqearth.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/eqearth.js +4 -1
- package/dist/projection/experimental/lazy-projections/eqearth.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/equi.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/equi.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/equi.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/equi.js +4 -1
- package/dist/projection/experimental/lazy-projections/equi.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/geocent.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/geocent.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/geocent.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/geocent.js +4 -1
- package/dist/projection/experimental/lazy-projections/geocent.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/geos.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/geos.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/geos.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/geos.js +4 -1
- package/dist/projection/experimental/lazy-projections/geos.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/gnom.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/gnom.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/gnom.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/gnom.js +4 -1
- package/dist/projection/experimental/lazy-projections/gnom.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/index.cjs +100 -27
- package/dist/projection/experimental/lazy-projections/index.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/krovak.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/krovak.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/krovak.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/krovak.js +4 -1
- package/dist/projection/experimental/lazy-projections/krovak.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/merc.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/merc.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/merc.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/merc.js +4 -1
- package/dist/projection/experimental/lazy-projections/merc.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/mill.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/mill.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/mill.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/mill.js +4 -1
- package/dist/projection/experimental/lazy-projections/mill.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/moll.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/moll.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/moll.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/moll.js +4 -1
- package/dist/projection/experimental/lazy-projections/moll.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/nzmg.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/nzmg.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/nzmg.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/nzmg.js +4 -1
- package/dist/projection/experimental/lazy-projections/nzmg.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/omerc.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/omerc.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/omerc.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/omerc.js +4 -1
- package/dist/projection/experimental/lazy-projections/omerc.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/ortho.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/ortho.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/ortho.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/ortho.js +4 -1
- package/dist/projection/experimental/lazy-projections/ortho.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/poly.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/poly.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/poly.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/poly.js +4 -1
- package/dist/projection/experimental/lazy-projections/poly.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/robin.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/robin.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/robin.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/robin.js +4 -1
- package/dist/projection/experimental/lazy-projections/robin.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/sinu.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/sinu.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/sinu.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/sinu.js +4 -1
- package/dist/projection/experimental/lazy-projections/sinu.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/stere.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/stere.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/stere.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/stere.js +4 -1
- package/dist/projection/experimental/lazy-projections/stere.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/tpers.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/tpers.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/tpers.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/tpers.js +4 -1
- package/dist/projection/experimental/lazy-projections/tpers.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/vandg.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/vandg.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/vandg.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/vandg.js +4 -1
- package/dist/projection/experimental/lazy-projections/vandg.js.map +1 -1
- package/dist/projection/experimental/spatial-deformation.js +1 -1
- package/dist/projection/experimental/spatial-deformation.js.map +1 -1
- package/dist/projection/index.cjs +8 -4
- package/dist/projection/index.cjs.map +1 -1
- package/dist/projection/index.d.ts.map +1 -1
- package/dist/projection/index.js.map +1 -1
- package/dist/projection/lib/projection.js.map +1 -1
- package/dist/projection/pipeline.cjs +3 -3
- package/dist/projection/pipeline.cjs.map +1 -1
- package/dist/projection/temporal.cjs +5 -5
- package/dist/projection/temporal.cjs.map +2 -2
- package/dist/projection/transform-analysis.cjs +3 -3
- package/dist/projection/transform-analysis.cjs.map +1 -1
- package/dist/rhumb-path.d.ts +1 -1
- package/dist/rhumb-path.d.ts.map +1 -1
- package/dist/spatial-planar-intersects.d.ts +4 -0
- package/dist/spatial-planar-intersects.d.ts.map +1 -0
- package/dist/spatial-planar-intersects.js +108 -0
- package/dist/spatial-planar-intersects.js.map +1 -0
- package/dist/spatial-planar.d.ts +16 -0
- package/dist/spatial-planar.d.ts.map +1 -0
- package/dist/spatial-planar.js +240 -0
- package/dist/spatial-planar.js.map +1 -0
- package/dist/spatial-sql.d.ts +45 -0
- package/dist/spatial-sql.d.ts.map +1 -0
- package/dist/spatial-sql.js +192 -0
- package/dist/spatial-sql.js.map +1 -0
- package/dist/st-functions.cjs +1616 -0
- package/dist/st-functions.cjs.map +6 -0
- package/dist/st-functions.d.ts +307 -0
- package/dist/st-functions.d.ts.map +1 -0
- package/dist/st-functions.js +593 -0
- package/dist/st-functions.js.map +1 -0
- package/dist/subdivide-globe-mesh.js +1 -1
- package/dist/subdivide-globe-mesh.js.map +1 -1
- package/dist/tasks/index.cjs +1266 -155
- package/dist/tasks/index.cjs.map +3 -3
- package/dist/tasks/index.d.ts +12 -0
- package/dist/tasks/index.d.ts.map +1 -1
- package/dist/tasks/index.js +26 -0
- package/dist/tasks/index.js.map +1 -1
- package/dist/tasks/terrain-coverage-worker.d.ts +2 -0
- package/dist/tasks/terrain-coverage-worker.d.ts.map +1 -0
- package/dist/tasks/terrain-coverage-worker.js +7 -0
- package/dist/tasks/terrain-coverage-worker.js.map +1 -0
- package/dist/tasks/terrain-coverage.d.ts +25 -0
- package/dist/tasks/terrain-coverage.d.ts.map +1 -0
- package/dist/tasks/terrain-coverage.js +15 -0
- package/dist/tasks/terrain-coverage.js.map +1 -0
- package/dist/tasks/terrain-residency-worker.d.ts +2 -0
- package/dist/tasks/terrain-residency-worker.d.ts.map +1 -0
- package/dist/tasks/terrain-residency-worker.js +7 -0
- package/dist/tasks/terrain-residency-worker.js.map +1 -0
- package/dist/tasks/terrain-residency.d.ts +73 -0
- package/dist/tasks/terrain-residency.d.ts.map +1 -0
- package/dist/tasks/terrain-residency.js +203 -0
- package/dist/tasks/terrain-residency.js.map +1 -0
- package/dist/terrain/breakline-mesh.d.ts +18 -0
- package/dist/terrain/breakline-mesh.d.ts.map +1 -0
- package/dist/terrain/breakline-mesh.js +126 -0
- package/dist/terrain/breakline-mesh.js.map +1 -0
- package/dist/terrain/breakline-preprocess.d.ts +11 -0
- package/dist/terrain/breakline-preprocess.d.ts.map +1 -0
- package/dist/terrain/breakline-preprocess.js +94 -0
- package/dist/terrain/breakline-preprocess.js.map +1 -0
- package/dist/terrain/continuous-mesh-error.d.ts +34 -0
- package/dist/terrain/continuous-mesh-error.d.ts.map +1 -0
- package/dist/terrain/continuous-mesh-error.js +221 -0
- package/dist/terrain/continuous-mesh-error.js.map +1 -0
- package/dist/terrain/cutout-polygons.d.ts +21 -0
- package/dist/terrain/cutout-polygons.d.ts.map +1 -0
- package/dist/terrain/cutout-polygons.js +172 -0
- package/dist/terrain/cutout-polygons.js.map +1 -0
- package/dist/terrain/cutout-region.d.ts +34 -0
- package/dist/terrain/cutout-region.d.ts.map +1 -0
- package/dist/terrain/cutout-region.js +33 -0
- package/dist/terrain/cutout-region.js.map +1 -0
- package/dist/terrain/cutout-skirts.d.ts +34 -0
- package/dist/terrain/cutout-skirts.d.ts.map +1 -0
- package/dist/terrain/cutout-skirts.js +29 -0
- package/dist/terrain/cutout-skirts.js.map +1 -0
- package/dist/terrain/depression-fill.d.ts +25 -0
- package/dist/terrain/depression-fill.d.ts.map +1 -0
- package/dist/terrain/depression-fill.js +106 -0
- package/dist/terrain/depression-fill.js.map +1 -0
- package/dist/terrain/geographic-cutout.d.ts +38 -0
- package/dist/terrain/geographic-cutout.d.ts.map +1 -0
- package/dist/terrain/geographic-cutout.js +120 -0
- package/dist/terrain/geographic-cutout.js.map +1 -0
- package/dist/terrain/geographic-lod-seams.d.ts +10 -0
- package/dist/terrain/geographic-lod-seams.d.ts.map +1 -0
- package/dist/terrain/geographic-lod-seams.js +100 -0
- package/dist/terrain/geographic-lod-seams.js.map +1 -0
- package/dist/terrain/geographic-neighbor.d.ts +18 -0
- package/dist/terrain/geographic-neighbor.d.ts.map +1 -0
- package/dist/terrain/geographic-neighbor.js +44 -0
- package/dist/terrain/geographic-neighbor.js.map +1 -0
- package/dist/terrain/geographic-poles.d.ts +24 -0
- package/dist/terrain/geographic-poles.d.ts.map +1 -0
- package/dist/terrain/geographic-poles.js +34 -0
- package/dist/terrain/geographic-poles.js.map +1 -0
- package/dist/terrain/geographic-seam.d.ts +21 -0
- package/dist/terrain/geographic-seam.d.ts.map +1 -0
- package/dist/terrain/geographic-seam.js +52 -0
- package/dist/terrain/geographic-seam.js.map +1 -0
- package/dist/terrain/hydrology.d.ts +42 -0
- package/dist/terrain/hydrology.d.ts.map +1 -0
- package/dist/terrain/hydrology.js +112 -0
- package/dist/terrain/hydrology.js.map +1 -0
- package/dist/terrain/index.cjs +3158 -213
- package/dist/terrain/index.cjs.map +3 -3
- package/dist/terrain/index.d.ts +32 -0
- package/dist/terrain/index.d.ts.map +1 -1
- package/dist/terrain/index.js +30 -0
- package/dist/terrain/index.js.map +1 -1
- package/dist/terrain/lod-screen-error.d.ts +28 -0
- package/dist/terrain/lod-screen-error.d.ts.map +1 -0
- package/dist/terrain/lod-screen-error.js +95 -0
- package/dist/terrain/lod-screen-error.js.map +1 -0
- package/dist/terrain/lod-select.d.ts +48 -0
- package/dist/terrain/lod-select.d.ts.map +1 -0
- package/dist/terrain/lod-select.js +73 -0
- package/dist/terrain/lod-select.js.map +1 -0
- package/dist/terrain/lod-stitch.d.ts +15 -0
- package/dist/terrain/lod-stitch.d.ts.map +1 -0
- package/dist/terrain/lod-stitch.js +64 -0
- package/dist/terrain/lod-stitch.js.map +1 -0
- package/dist/terrain/mesh-coverage.d.ts +35 -0
- package/dist/terrain/mesh-coverage.d.ts.map +1 -0
- package/dist/terrain/mesh-coverage.js +186 -0
- package/dist/terrain/mesh-coverage.js.map +1 -0
- package/dist/terrain/mesh-cutout.d.ts +45 -0
- package/dist/terrain/mesh-cutout.d.ts.map +1 -0
- package/dist/terrain/mesh-cutout.js +336 -0
- package/dist/terrain/mesh-cutout.js.map +1 -0
- package/dist/terrain/mesh-regions-data.d.ts +2 -2
- package/dist/terrain/mesh-regions-data.d.ts.map +1 -1
- package/dist/terrain/mesh-regions-data.js +20 -10
- package/dist/terrain/mesh-regions-data.js.map +1 -1
- package/dist/terrain/mesh-skirts.d.ts +8 -2
- package/dist/terrain/mesh-skirts.d.ts.map +1 -1
- package/dist/terrain/mesh-skirts.js +5 -4
- package/dist/terrain/mesh-skirts.js.map +1 -1
- package/dist/terrain/mixed-halo-update.d.ts.map +1 -1
- package/dist/terrain/mixed-halo-update.js +138 -26
- package/dist/terrain/mixed-halo-update.js.map +1 -1
- package/dist/terrain/mixed-vertex-halos.d.ts +34 -1
- package/dist/terrain/mixed-vertex-halos.d.ts.map +1 -1
- package/dist/terrain/mixed-vertex-halos.js +98 -43
- package/dist/terrain/mixed-vertex-halos.js.map +1 -1
- package/dist/terrain/regional-viewshed.d.ts +55 -0
- package/dist/terrain/regional-viewshed.d.ts.map +1 -0
- package/dist/terrain/regional-viewshed.js +119 -0
- package/dist/terrain/regional-viewshed.js.map +1 -0
- package/dist/terrain/surface.d.ts +1 -1
- package/dist/terrain/surface.d.ts.map +1 -1
- package/dist/terrain/surface.js +1 -1
- package/dist/terrain/surface.js.map +1 -1
- package/dist/terrain/sweep-capsule.d.ts +27 -0
- package/dist/terrain/sweep-capsule.d.ts.map +1 -0
- package/dist/terrain/sweep-capsule.js +104 -0
- package/dist/terrain/sweep-capsule.js.map +1 -0
- package/dist/terrain/sweep-cylinder.d.ts +16 -0
- package/dist/terrain/sweep-cylinder.d.ts.map +1 -0
- package/dist/terrain/sweep-cylinder.js +52 -0
- package/dist/terrain/sweep-cylinder.js.map +1 -0
- package/dist/terrain/sweep-plane.d.ts +9 -0
- package/dist/terrain/sweep-plane.d.ts.map +1 -0
- package/dist/terrain/sweep-plane.js +52 -0
- package/dist/terrain/sweep-plane.js.map +1 -0
- package/dist/terrain/sweep-polytope.d.ts +42 -0
- package/dist/terrain/sweep-polytope.d.ts.map +1 -0
- package/dist/terrain/sweep-polytope.js +189 -0
- package/dist/terrain/sweep-polytope.js.map +1 -0
- package/dist/terrain/sweep-rotating-capsule.d.ts +17 -0
- package/dist/terrain/sweep-rotating-capsule.d.ts.map +1 -0
- package/dist/terrain/sweep-rotating-capsule.js +118 -0
- package/dist/terrain/sweep-rotating-capsule.js.map +1 -0
- package/dist/terrain/sweep-rotation.d.ts +35 -0
- package/dist/terrain/sweep-rotation.d.ts.map +1 -0
- package/dist/terrain/sweep-rotation.js +114 -0
- package/dist/terrain/sweep-rotation.js.map +1 -0
- package/dist/terrain/sweep-sphere.d.ts +27 -0
- package/dist/terrain/sweep-sphere.d.ts.map +1 -0
- package/dist/terrain/sweep-sphere.js +69 -0
- package/dist/terrain/sweep-sphere.js.map +1 -0
- package/dist/terrain/tile-cutout-update.d.ts +73 -0
- package/dist/terrain/tile-cutout-update.d.ts.map +1 -0
- package/dist/terrain/tile-cutout-update.js +181 -0
- package/dist/terrain/tile-cutout-update.js.map +1 -0
- package/dist/terrain/tile-cutout.d.ts +33 -0
- package/dist/terrain/tile-cutout.d.ts.map +1 -0
- package/dist/terrain/tile-cutout.js +93 -0
- package/dist/terrain/tile-cutout.js.map +1 -0
- package/dist/terrain/valid-domain-mesh.d.ts +29 -0
- package/dist/terrain/valid-domain-mesh.d.ts.map +1 -0
- package/dist/terrain/valid-domain-mesh.js +183 -0
- package/dist/terrain/valid-domain-mesh.js.map +1 -0
- package/dist/terrain/valid-domain-regions.d.ts +16 -0
- package/dist/terrain/valid-domain-regions.d.ts.map +1 -0
- package/dist/terrain/valid-domain-regions.js +19 -0
- package/dist/terrain/valid-domain-regions.js.map +1 -0
- package/dist/terrain/watershed-accumulation.d.ts +20 -0
- package/dist/terrain/watershed-accumulation.d.ts.map +1 -0
- package/dist/terrain/watershed-accumulation.js +53 -0
- package/dist/terrain/watershed-accumulation.js.map +1 -0
- package/dist/triaxial.d.ts +1 -1
- package/dist/triaxial.d.ts.map +1 -1
- package/dist/turf-expressions.cjs +1997 -0
- package/dist/turf-expressions.cjs.map +6 -0
- package/dist/turf-expressions.d.ts +3 -0
- package/dist/turf-expressions.d.ts.map +1 -0
- package/dist/turf-expressions.js +7 -0
- package/dist/turf-expressions.js.map +1 -0
- package/dist/turf-functions.cjs +743 -0
- package/dist/turf-functions.cjs.map +6 -0
- package/dist/turf-functions.d.ts +90 -0
- package/dist/turf-functions.d.ts.map +1 -0
- package/dist/{turf/expressions.js → turf-functions.js} +51 -5
- package/dist/turf-functions.js.map +1 -0
- package/dist/turf.cjs +25 -25
- package/dist/turf.cjs.map +2 -2
- package/dist/turf.d.ts +1 -1
- package/dist/turf.d.ts.map +1 -1
- package/dist/turf.js +2 -2
- package/dist/turf.js.map +1 -1
- package/dist/type-utils.d.ts +1 -1
- package/dist/type-utils.d.ts.map +1 -1
- package/dist/type-utils.js +1 -1
- package/dist/type-utils.js.map +1 -1
- package/dist/web-mercator/assert.d.ts +2 -0
- package/dist/web-mercator/assert.d.ts.map +1 -0
- package/dist/web-mercator/assert.js +12 -0
- package/dist/web-mercator/assert.js.map +1 -0
- package/dist/web-mercator/fit-bounds.d.ts +52 -0
- package/dist/web-mercator/fit-bounds.d.ts.map +1 -0
- package/dist/web-mercator/fit-bounds.js +70 -0
- package/dist/web-mercator/fit-bounds.js.map +1 -0
- package/dist/web-mercator/fly-to-viewport.d.ts +19 -0
- package/dist/web-mercator/fly-to-viewport.d.ts.map +1 -0
- package/dist/web-mercator/fly-to-viewport.js +94 -0
- package/dist/web-mercator/fly-to-viewport.js.map +1 -0
- package/dist/web-mercator/get-bounds.d.ts +3 -0
- package/dist/web-mercator/get-bounds.d.ts.map +1 -0
- package/dist/web-mercator/get-bounds.js +56 -0
- package/dist/web-mercator/get-bounds.js.map +1 -0
- package/dist/web-mercator/index.cjs +705 -0
- package/dist/web-mercator/index.cjs.map +6 -0
- package/dist/web-mercator/index.d.ts +14 -0
- package/dist/web-mercator/index.d.ts.map +1 -0
- package/dist/web-mercator/index.js +14 -0
- package/dist/web-mercator/index.js.map +1 -0
- package/dist/web-mercator/math-utils.d.ts +7 -0
- package/dist/web-mercator/math-utils.d.ts.map +1 -0
- package/dist/web-mercator/math-utils.js +30 -0
- package/dist/web-mercator/math-utils.js.map +1 -0
- package/dist/web-mercator/mercator-meters.d.ts +29 -0
- package/dist/web-mercator/mercator-meters.d.ts.map +1 -0
- package/dist/web-mercator/mercator-meters.js +61 -0
- package/dist/web-mercator/mercator-meters.js.map +1 -0
- package/dist/web-mercator/normalize-viewport-props.d.ts +16 -0
- package/dist/web-mercator/normalize-viewport-props.d.ts.map +1 -0
- package/dist/web-mercator/normalize-viewport-props.js +45 -0
- package/dist/web-mercator/normalize-viewport-props.js.map +1 -0
- package/dist/web-mercator/web-mercator-utils.d.ts +192 -0
- package/dist/web-mercator/web-mercator-utils.d.ts.map +1 -0
- package/dist/web-mercator/web-mercator-utils.js +321 -0
- package/dist/web-mercator/web-mercator-utils.js.map +1 -0
- package/dist/web-mercator/web-mercator-viewport.d.ts +177 -0
- package/dist/web-mercator/web-mercator-viewport.d.ts.map +1 -0
- package/dist/web-mercator/web-mercator-viewport.js +276 -0
- package/dist/web-mercator/web-mercator-viewport.js.map +1 -0
- package/dist/web-mercator.d.ts +1 -1
- package/dist/web-mercator.d.ts.map +1 -1
- package/dist/web-mercator.js +1 -1
- package/dist/web-mercator.js.map +1 -1
- package/package.json +35 -462
- package/src/crs/crs-descriptor-types.ts +2 -1
- package/src/crs/index.ts +7 -0
- package/src/crs/spatial-reference-metadata.ts +118 -0
- package/src/ellipsoid-helpers/ellipsoid-transform.ts +3 -3
- package/src/ellipsoid-helpers/scale-to-geodetic-surface.ts +1 -1
- package/src/ellipsoid-helpers/tangent-plane-numerics.ts +1 -1
- package/src/ellipsoid-tangent-plane.ts +2 -2
- package/src/ellipsoid-transforms.ts +2 -2
- package/src/ellipsoid.ts +7 -3
- package/src/expressions.ts +2 -2
- package/src/geodesic-buffer.ts +1 -1
- package/src/geodesic-path.ts +1 -1
- package/src/geometry-constructors.ts +36 -0
- package/src/geometry-inspection.ts +66 -0
- package/src/index.ts +314 -4
- package/src/line-simplification.ts +97 -0
- package/src/linear-referencing.ts +94 -0
- package/src/lng-lat-rectangle.ts +1 -1
- package/src/local-reference-frame.ts +4 -4
- package/src/make-obb-from-region.ts +9 -1
- package/src/maps/air-ocean-mesh.ts +1 -1
- package/src/maps/myriahedral/unfold.ts +1 -1
- package/src/projection/experimental/crs/spatial-reference.ts +1 -6
- package/src/projection/experimental/crs/types.ts +2 -2
- package/src/projection/experimental/crs/wkt.ts +1 -1
- package/src/projection/experimental/crs-descriptor.ts +1 -1
- package/src/projection/experimental/crs-rendering-scale.ts +16 -4
- package/src/projection/experimental/datum.ts +1 -1
- package/src/projection/experimental/lazy-projections/aea.ts +4 -1
- package/src/projection/experimental/lazy-projections/bonne.ts +4 -1
- package/src/projection/experimental/lazy-projections/cass.ts +4 -1
- package/src/projection/experimental/lazy-projections/eck6.ts +4 -1
- package/src/projection/experimental/lazy-projections/eqdc.ts +4 -1
- package/src/projection/experimental/lazy-projections/eqearth.ts +4 -1
- package/src/projection/experimental/lazy-projections/equi.ts +4 -1
- package/src/projection/experimental/lazy-projections/geocent.ts +4 -1
- package/src/projection/experimental/lazy-projections/geos.ts +4 -1
- package/src/projection/experimental/lazy-projections/gnom.ts +4 -1
- package/src/projection/experimental/lazy-projections/krovak.ts +4 -1
- package/src/projection/experimental/lazy-projections/merc.ts +4 -1
- package/src/projection/experimental/lazy-projections/mill.ts +4 -1
- package/src/projection/experimental/lazy-projections/moll.ts +4 -1
- package/src/projection/experimental/lazy-projections/nzmg.ts +4 -1
- package/src/projection/experimental/lazy-projections/omerc.ts +4 -1
- package/src/projection/experimental/lazy-projections/ortho.ts +4 -1
- package/src/projection/experimental/lazy-projections/poly.ts +4 -1
- package/src/projection/experimental/lazy-projections/robin.ts +4 -1
- package/src/projection/experimental/lazy-projections/sinu.ts +4 -1
- package/src/projection/experimental/lazy-projections/stere.ts +4 -1
- package/src/projection/experimental/lazy-projections/tpers.ts +4 -1
- package/src/projection/experimental/lazy-projections/vandg.ts +4 -1
- package/src/projection/experimental/spatial-deformation.ts +1 -1
- package/src/projection/index.ts +1 -1
- package/src/projection/lib/projection.ts +1 -1
- package/src/rhumb-path.ts +1 -1
- package/src/spatial-planar-intersects.ts +134 -0
- package/src/spatial-planar.ts +266 -0
- package/src/spatial-sql.ts +276 -0
- package/src/st-functions.ts +852 -0
- package/src/subdivide-globe-mesh.ts +1 -1
- package/src/tasks/index.ts +34 -0
- package/src/tasks/terrain-coverage-worker.ts +6 -0
- package/src/tasks/terrain-coverage.ts +25 -0
- package/src/tasks/terrain-residency-worker.ts +6 -0
- package/src/tasks/terrain-residency.ts +250 -0
- package/src/terrain/breakline-mesh.ts +164 -0
- package/src/terrain/breakline-preprocess.ts +106 -0
- package/src/terrain/cdt2d.d.ts +10 -0
- package/src/terrain/continuous-mesh-error.ts +321 -0
- package/src/terrain/cutout-polygons.ts +202 -0
- package/src/terrain/cutout-region.ts +54 -0
- package/src/terrain/cutout-skirts.ts +52 -0
- package/src/terrain/depression-fill.ts +125 -0
- package/src/terrain/geographic-cutout.ts +154 -0
- package/src/terrain/geographic-lod-seams.ts +109 -0
- package/src/terrain/geographic-neighbor.ts +58 -0
- package/src/terrain/geographic-poles.ts +52 -0
- package/src/terrain/geographic-seam.ts +73 -0
- package/src/terrain/hydrology.ts +149 -0
- package/src/terrain/index.ts +160 -0
- package/src/terrain/lod-screen-error.ts +128 -0
- package/src/terrain/lod-select.ts +129 -0
- package/src/terrain/lod-stitch.ts +88 -0
- package/src/terrain/mesh-coverage.ts +215 -0
- package/src/terrain/mesh-cutout.ts +420 -0
- package/src/terrain/mesh-regions-data.ts +21 -13
- package/src/terrain/mesh-skirts.ts +10 -7
- package/src/terrain/mixed-halo-update.ts +147 -25
- package/src/terrain/mixed-vertex-halos.ts +125 -55
- package/src/terrain/regional-viewshed.ts +177 -0
- package/src/terrain/surface.ts +1 -1
- package/src/terrain/sweep-capsule.ts +148 -0
- package/src/terrain/sweep-cylinder.ts +64 -0
- package/src/terrain/sweep-plane.ts +61 -0
- package/src/terrain/sweep-polytope.ts +253 -0
- package/src/terrain/sweep-rotating-capsule.ts +139 -0
- package/src/terrain/sweep-rotation.ts +149 -0
- package/src/terrain/sweep-sphere.ts +100 -0
- package/src/terrain/tile-cutout-update.ts +293 -0
- package/src/terrain/tile-cutout.ts +123 -0
- package/src/terrain/valid-domain-mesh.ts +221 -0
- package/src/terrain/valid-domain-regions.ts +41 -0
- package/src/terrain/watershed-accumulation.ts +67 -0
- package/src/triaxial.ts +1 -1
- package/src/turf-expressions.ts +7 -0
- package/src/{turf/expressions.ts → turf-functions.ts} +121 -6
- package/src/turf.ts +3 -7
- package/src/type-utils.ts +2 -2
- package/src/web-mercator/assert.ts +11 -0
- package/src/web-mercator/fit-bounds.ts +132 -0
- package/src/web-mercator/fly-to-viewport.ts +157 -0
- package/src/web-mercator/get-bounds.ts +62 -0
- package/src/web-mercator/index.ts +49 -0
- package/src/web-mercator/math-utils.ts +35 -0
- package/src/web-mercator/mercator-meters.ts +83 -0
- package/src/web-mercator/normalize-viewport-props.ts +58 -0
- package/src/web-mercator/web-mercator-utils.ts +468 -0
- package/src/web-mercator/web-mercator-viewport.ts +406 -0
- package/src/web-mercator.ts +1 -1
- package/dist/projection/experimental/index.cjs +0 -11707
- package/dist/projection/experimental/index.cjs.map +0 -6
- package/dist/turf/expressions.cjs +0 -87
- package/dist/turf/expressions.cjs.map +0 -6
- package/dist/turf/expressions.d.ts +0 -24
- package/dist/turf/expressions.d.ts.map +0 -1
- package/dist/turf/expressions.js.map +0 -1
package/dist/tasks/index.cjs
CHANGED
|
@@ -18,9 +18,9 @@ var __export = (target, all) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __copyProps = (to, from, except, desc) => {
|
|
20
20
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
21
|
-
for (let
|
|
22
|
-
if (!__hasOwnProp.call(to,
|
|
23
|
-
__defProp(to,
|
|
21
|
+
for (let key3 of __getOwnPropNames(from))
|
|
22
|
+
if (!__hasOwnProp.call(to, key3) && key3 !== except)
|
|
23
|
+
__defProp(to, key3, { get: () => from[key3], enumerable: !(desc = __getOwnPropDesc(from, key3)) || desc.enumerable });
|
|
24
24
|
}
|
|
25
25
|
return to;
|
|
26
26
|
};
|
|
@@ -34,6 +34,900 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
34
34
|
));
|
|
35
35
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
36
|
|
|
37
|
+
// dist/terrain/box-index.js
|
|
38
|
+
function createTerrainBoxIndex(boxes) {
|
|
39
|
+
const build = (ids) => {
|
|
40
|
+
const box = { minX: Infinity, minY: Infinity, maxX: -Infinity, maxY: -Infinity };
|
|
41
|
+
for (const id of ids) {
|
|
42
|
+
const b = boxes[id];
|
|
43
|
+
box.minX = Math.min(box.minX, b.minX);
|
|
44
|
+
box.minY = Math.min(box.minY, b.minY);
|
|
45
|
+
box.maxX = Math.max(box.maxX, b.maxX);
|
|
46
|
+
box.maxY = Math.max(box.maxY, b.maxY);
|
|
47
|
+
}
|
|
48
|
+
if (ids.length <= 8)
|
|
49
|
+
return { ...box, ids };
|
|
50
|
+
const axis = box.maxX - box.minX >= box.maxY - box.minY ? "X" : "Y";
|
|
51
|
+
ids.sort((a, b) => boxes[a][`min${axis}`] / 2 + boxes[a][`max${axis}`] / 2 - (boxes[b][`min${axis}`] / 2 + boxes[b][`max${axis}`] / 2) || a - b);
|
|
52
|
+
const mid = ids.length >>> 1;
|
|
53
|
+
return { ...box, left: build(ids.slice(0, mid)), right: build(ids.slice(mid)) };
|
|
54
|
+
};
|
|
55
|
+
const root = build(boxes.map((_, i) => i));
|
|
56
|
+
return (query, charge) => {
|
|
57
|
+
const found = [], stack = [root];
|
|
58
|
+
while (stack.length) {
|
|
59
|
+
charge();
|
|
60
|
+
const node = stack.pop();
|
|
61
|
+
if (!overlaps(node, query))
|
|
62
|
+
continue;
|
|
63
|
+
if (node.ids) {
|
|
64
|
+
for (const id of node.ids) {
|
|
65
|
+
charge();
|
|
66
|
+
if (overlaps(boxes[id], query))
|
|
67
|
+
found.push(id);
|
|
68
|
+
}
|
|
69
|
+
} else
|
|
70
|
+
stack.push(node.right, node.left);
|
|
71
|
+
}
|
|
72
|
+
return found.sort((a, b) => a - b);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
var overlaps;
|
|
76
|
+
var init_box_index = __esm({
|
|
77
|
+
"dist/terrain/box-index.js"() {
|
|
78
|
+
overlaps = (a, b) => a.minX <= b.maxX && b.minX <= a.maxX && a.minY <= b.maxY && b.minY <= a.maxY;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// dist/terrain/types.js
|
|
83
|
+
var TerrainSampleStatus;
|
|
84
|
+
var init_types = __esm({
|
|
85
|
+
"dist/terrain/types.js"() {
|
|
86
|
+
TerrainSampleStatus = {
|
|
87
|
+
VALID: 0,
|
|
88
|
+
OUTSIDE_DOMAIN: 1,
|
|
89
|
+
NO_DATA: 2,
|
|
90
|
+
INVALID_INPUT: 3,
|
|
91
|
+
NUMERIC_ERROR: 4,
|
|
92
|
+
UNAVAILABLE: 5,
|
|
93
|
+
NOT_RESIDENT: 6
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// dist/terrain/height-field.js
|
|
99
|
+
var height_field_exports = {};
|
|
100
|
+
__export(height_field_exports, {
|
|
101
|
+
HeightField: () => HeightField
|
|
102
|
+
});
|
|
103
|
+
function copyVector(value2) {
|
|
104
|
+
if (value2.length !== 2 || !value2.every(Number.isFinite))
|
|
105
|
+
throw new Error("Grid vectors must be finite XY pairs");
|
|
106
|
+
return Object.freeze([value2[0], value2[1]]);
|
|
107
|
+
}
|
|
108
|
+
function createSample() {
|
|
109
|
+
return {
|
|
110
|
+
status: TerrainSampleStatus.NO_DATA,
|
|
111
|
+
height: 0,
|
|
112
|
+
gradientStatus: TerrainSampleStatus.NO_DATA,
|
|
113
|
+
gradientX: 0,
|
|
114
|
+
gradientY: 0,
|
|
115
|
+
normalX: 0,
|
|
116
|
+
normalY: 0,
|
|
117
|
+
normalZ: 0
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function resetSample(result, status) {
|
|
121
|
+
result.status = status;
|
|
122
|
+
result.gradientStatus = status;
|
|
123
|
+
result.height = result.gradientX = result.gradientY = result.normalX = result.normalY = result.normalZ = 0;
|
|
124
|
+
return result;
|
|
125
|
+
}
|
|
126
|
+
function isTerrainArray(value2) {
|
|
127
|
+
return value2 instanceof Float32Array || value2 instanceof Float64Array;
|
|
128
|
+
}
|
|
129
|
+
function validateBatch(positions, output) {
|
|
130
|
+
if (!isTerrainArray(positions) || positions.length % 2 !== 0) {
|
|
131
|
+
throw new Error("Terrain batch positions must contain Float32/Float64 XY pairs");
|
|
132
|
+
}
|
|
133
|
+
const count = positions.length / 2;
|
|
134
|
+
const buffers = [positions];
|
|
135
|
+
for (const [key3, size] of [
|
|
136
|
+
["heights", 1],
|
|
137
|
+
["statuses", 1],
|
|
138
|
+
["gradients", 2],
|
|
139
|
+
["normals", 3],
|
|
140
|
+
["gradientStatuses", 1]
|
|
141
|
+
]) {
|
|
142
|
+
const buffer = output[key3];
|
|
143
|
+
if (buffer === void 0 && key3 !== "heights" && key3 !== "statuses")
|
|
144
|
+
continue;
|
|
145
|
+
const byte = key3 === "statuses" || key3 === "gradientStatuses";
|
|
146
|
+
if ((byte ? !(buffer instanceof Uint8Array) : !isTerrainArray(buffer)) || buffer.length < count * size) {
|
|
147
|
+
throw new Error(`Terrain batch ${key3} has an invalid type or insufficient length`);
|
|
148
|
+
}
|
|
149
|
+
for (const other of buffers) {
|
|
150
|
+
if (buffer.buffer === other.buffer && buffer.byteOffset < other.byteOffset + other.byteLength && other.byteOffset < buffer.byteOffset + buffer.byteLength) {
|
|
151
|
+
throw new Error("Terrain batch input and output buffers must not overlap");
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
buffers.push(buffer);
|
|
155
|
+
}
|
|
156
|
+
if ((output.gradients || output.normals) && !output.gradientStatuses) {
|
|
157
|
+
throw new Error("Terrain batch derivatives require gradientStatuses");
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
var HeightField;
|
|
161
|
+
var init_height_field = __esm({
|
|
162
|
+
"dist/terrain/height-field.js"() {
|
|
163
|
+
init_types();
|
|
164
|
+
HeightField = class {
|
|
165
|
+
constructor(props) {
|
|
166
|
+
this.batchSample = createSample();
|
|
167
|
+
const { width, height: height2, heights, validity, offset = 0, stride = width } = props;
|
|
168
|
+
if (!Number.isSafeInteger(width) || width < 2 || !Number.isSafeInteger(height2) || height2 < 2) {
|
|
169
|
+
throw new Error("HeightField width and height must be integers >= 2");
|
|
170
|
+
}
|
|
171
|
+
if (!isTerrainArray(heights) || validity !== void 0 && !(validity instanceof Uint8Array)) {
|
|
172
|
+
throw new Error("HeightField requires Float32/Float64 heights and an optional Uint8 validity mask");
|
|
173
|
+
}
|
|
174
|
+
if (!Number.isSafeInteger(offset) || offset < 0 || !Number.isSafeInteger(stride) || stride < width) {
|
|
175
|
+
throw new Error("HeightField offset must be nonnegative and stride must be >= width");
|
|
176
|
+
}
|
|
177
|
+
const end = offset + (height2 - 1) * stride + width;
|
|
178
|
+
if (!Number.isSafeInteger(end) || end > heights.length || validity && end > validity.length) {
|
|
179
|
+
throw new Error("HeightField input buffers are too small");
|
|
180
|
+
}
|
|
181
|
+
this.width = width;
|
|
182
|
+
this.height = height2;
|
|
183
|
+
this.origin = copyVector(props.origin ?? [0, 0]);
|
|
184
|
+
this.columnStep = copyVector(props.columnStep ?? [1, 0]);
|
|
185
|
+
this.rowStep = copyVector(props.rowStep ?? [0, 1]);
|
|
186
|
+
this.registration = props.registration ?? "vertex";
|
|
187
|
+
this.diagonal = props.diagonal ?? "00-11";
|
|
188
|
+
this.heightReference = props.heightReference ?? "unknown";
|
|
189
|
+
if (this.registration !== "vertex" && this.registration !== "cell") {
|
|
190
|
+
throw new Error("HeightField registration must be vertex or cell");
|
|
191
|
+
}
|
|
192
|
+
if (this.diagonal !== "00-11" && this.diagonal !== "10-01") {
|
|
193
|
+
throw new Error("HeightField diagonal must be 00-11 or 10-01");
|
|
194
|
+
}
|
|
195
|
+
if (typeof this.heightReference !== "string") {
|
|
196
|
+
throw new Error("HeightField heightReference must be a string");
|
|
197
|
+
}
|
|
198
|
+
const [a, c] = this.columnStep;
|
|
199
|
+
const [b, d] = this.rowStep;
|
|
200
|
+
const determinant = a * d - b * c;
|
|
201
|
+
const scale3 = Math.hypot(a, c) * Math.hypot(b, d);
|
|
202
|
+
if (!Number.isFinite(determinant) || Math.abs(determinant) <= Number.EPSILON * scale3) {
|
|
203
|
+
throw new Error("HeightField grid transform must be finite and nonsingular");
|
|
204
|
+
}
|
|
205
|
+
this.inverse = [d / determinant, -b / determinant, -c / determinant, a / determinant];
|
|
206
|
+
if (!this.inverse.every(Number.isFinite)) {
|
|
207
|
+
throw new Error("HeightField inverse transform must be finite");
|
|
208
|
+
}
|
|
209
|
+
this.heights = heights instanceof Float64Array ? new Float64Array(width * height2) : new Float32Array(width * height2);
|
|
210
|
+
this.validity = new Uint8Array(width * height2);
|
|
211
|
+
let min2 = Infinity;
|
|
212
|
+
let max2 = -Infinity;
|
|
213
|
+
let validCount = 0;
|
|
214
|
+
for (let row = 0; row < height2; row++) {
|
|
215
|
+
for (let column = 0; column < width; column++) {
|
|
216
|
+
const input = offset + row * stride + column;
|
|
217
|
+
const output = row * width + column;
|
|
218
|
+
const value2 = heights[input];
|
|
219
|
+
if (Number.isFinite(value2) && (!validity || validity[input] !== 0)) {
|
|
220
|
+
this.heights[output] = value2;
|
|
221
|
+
this.validity[output] = 1;
|
|
222
|
+
min2 = Math.min(min2, value2);
|
|
223
|
+
max2 = Math.max(max2, value2);
|
|
224
|
+
validCount++;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
this.validCount = validCount;
|
|
229
|
+
this.heightRange = validCount ? Object.freeze([min2, max2]) : void 0;
|
|
230
|
+
}
|
|
231
|
+
/** Reads an original grid sample, independently of interpolation footprints. */
|
|
232
|
+
getHeight(column, row) {
|
|
233
|
+
if (!Number.isInteger(column) || !Number.isInteger(row) || column < 0 || row < 0 || column >= this.width || row >= this.height)
|
|
234
|
+
return void 0;
|
|
235
|
+
const index = row * this.width + column;
|
|
236
|
+
return this.validity[index] ? this.heights[index] : void 0;
|
|
237
|
+
}
|
|
238
|
+
/** Independent, tightly packed copies, suitable for worker transfer or GPU preparation. */
|
|
239
|
+
copyData() {
|
|
240
|
+
return { heights: this.heights.slice(), validity: this.validity.slice() };
|
|
241
|
+
}
|
|
242
|
+
/** Samples world XY in meters. Supply result to avoid allocating a result object. */
|
|
243
|
+
sample(x, y, options, result = createSample()) {
|
|
244
|
+
resetSample(result, TerrainSampleStatus.INVALID_INPUT);
|
|
245
|
+
const interpolation = (options == null ? void 0 : options.interpolation) ?? "bilinear";
|
|
246
|
+
if (interpolation !== "nearest" && interpolation !== "bilinear" && interpolation !== "triangle") {
|
|
247
|
+
throw new Error("Unknown terrain interpolation");
|
|
248
|
+
}
|
|
249
|
+
const domain = (options == null ? void 0 : options.domain) ?? "samples";
|
|
250
|
+
const noData = (options == null ? void 0 : options.noData) ?? "cell";
|
|
251
|
+
if (domain !== "samples" && domain !== "footprint")
|
|
252
|
+
throw new Error("Unknown terrain sample domain");
|
|
253
|
+
if (noData !== "cell" && noData !== "support")
|
|
254
|
+
throw new Error("Unknown terrain nodata policy");
|
|
255
|
+
if (!Number.isFinite(x) || !Number.isFinite(y))
|
|
256
|
+
return result;
|
|
257
|
+
const dx = x - this.origin[0];
|
|
258
|
+
const dy = y - this.origin[1];
|
|
259
|
+
const offset = this.registration === "cell" ? 0.5 : 0;
|
|
260
|
+
let u = this.inverse[0] * dx + this.inverse[1] * dy - offset;
|
|
261
|
+
let v = this.inverse[2] * dx + this.inverse[3] * dy - offset;
|
|
262
|
+
if (!Number.isFinite(u) || !Number.isFinite(v))
|
|
263
|
+
return resetSample(result, TerrainSampleStatus.NUMERIC_ERROR);
|
|
264
|
+
const tolerance = 8 * Number.EPSILON * Math.max(this.width, this.height);
|
|
265
|
+
const errorX = 4 * Number.EPSILON * Math.abs(x) + 4 * Number.EPSILON * Math.abs(this.origin[0]);
|
|
266
|
+
const errorY = 4 * Number.EPSILON * Math.abs(y) + 4 * Number.EPSILON * Math.abs(this.origin[1]);
|
|
267
|
+
const toleranceU = tolerance + Math.abs(this.inverse[0]) * errorX + Math.abs(this.inverse[1]) * errorY;
|
|
268
|
+
const toleranceV = tolerance + Math.abs(this.inverse[2]) * errorX + Math.abs(this.inverse[3]) * errorY;
|
|
269
|
+
const margin = domain === "footprint" && this.registration === "cell" ? 0.5 : 0;
|
|
270
|
+
if (u < -margin - toleranceU || v < -margin - toleranceV || u > this.width - 1 + margin + toleranceU || v > this.height - 1 + margin + toleranceV) {
|
|
271
|
+
return resetSample(result, TerrainSampleStatus.OUTSIDE_DOMAIN);
|
|
272
|
+
}
|
|
273
|
+
const edgeToleranceU = Math.min(1e-6, toleranceU);
|
|
274
|
+
const edgeToleranceV = Math.min(1e-6, toleranceV);
|
|
275
|
+
const clampedColumn = margin > 0 && (u < -edgeToleranceU || u > this.width - 1 + edgeToleranceU);
|
|
276
|
+
const clampedRow = margin > 0 && (v < -edgeToleranceV || v > this.height - 1 + edgeToleranceV);
|
|
277
|
+
u = Math.max(0, Math.min(this.width - 1, u));
|
|
278
|
+
v = Math.max(0, Math.min(this.height - 1, v));
|
|
279
|
+
if (noData === "support" && interpolation === "bilinear") {
|
|
280
|
+
const column2 = Math.round(u), row2 = Math.round(v);
|
|
281
|
+
if (Math.abs(u - column2) <= Math.min(1e-6, toleranceU))
|
|
282
|
+
u = column2;
|
|
283
|
+
if (Math.abs(v - row2) <= Math.min(1e-6, toleranceV))
|
|
284
|
+
v = row2;
|
|
285
|
+
}
|
|
286
|
+
if (interpolation === "nearest") {
|
|
287
|
+
const value2 = this.getHeight(Math.floor(u + 0.5), Math.floor(v + 0.5));
|
|
288
|
+
if (value2 === void 0)
|
|
289
|
+
return resetSample(result, TerrainSampleStatus.NO_DATA);
|
|
290
|
+
result.status = TerrainSampleStatus.VALID;
|
|
291
|
+
result.height = value2;
|
|
292
|
+
result.gradientStatus = TerrainSampleStatus.UNAVAILABLE;
|
|
293
|
+
return result;
|
|
294
|
+
}
|
|
295
|
+
const column = Math.min(Math.floor(u), this.width - 2);
|
|
296
|
+
const row = Math.min(Math.floor(v), this.height - 2);
|
|
297
|
+
u -= column;
|
|
298
|
+
v -= row;
|
|
299
|
+
const a = row * this.width + column;
|
|
300
|
+
const b = a + 1;
|
|
301
|
+
const c = a + this.width;
|
|
302
|
+
const d = c + 1;
|
|
303
|
+
const za = this.heights[a];
|
|
304
|
+
const zb = this.heights[b];
|
|
305
|
+
const zc = this.heights[c];
|
|
306
|
+
const zd = this.heights[d];
|
|
307
|
+
let du;
|
|
308
|
+
let dv;
|
|
309
|
+
if (interpolation === "bilinear") {
|
|
310
|
+
if (!this.validity[a] || !this.validity[b] || !this.validity[c] || !this.validity[d]) {
|
|
311
|
+
if (noData === "cell")
|
|
312
|
+
return resetSample(result, TerrainSampleStatus.NO_DATA);
|
|
313
|
+
const weightA = (1 - u) * (1 - v);
|
|
314
|
+
const weightB = u * (1 - v);
|
|
315
|
+
const weightC = (1 - u) * v;
|
|
316
|
+
const weightD = u * v;
|
|
317
|
+
if (weightA > 0 && !this.validity[a] || weightB > 0 && !this.validity[b] || weightC > 0 && !this.validity[c] || weightD > 0 && !this.validity[d])
|
|
318
|
+
return resetSample(result, TerrainSampleStatus.NO_DATA);
|
|
319
|
+
const height2 = weightA * za + weightB * zb + weightC * zc + weightD * zd;
|
|
320
|
+
if (!Number.isFinite(height2))
|
|
321
|
+
return resetSample(result, TerrainSampleStatus.NUMERIC_ERROR);
|
|
322
|
+
result.status = TerrainSampleStatus.VALID;
|
|
323
|
+
result.height = height2;
|
|
324
|
+
result.gradientStatus = TerrainSampleStatus.NO_DATA;
|
|
325
|
+
return result;
|
|
326
|
+
}
|
|
327
|
+
result.height = (1 - v) * ((1 - u) * za + u * zb) + v * ((1 - u) * zc + u * zd);
|
|
328
|
+
du = (1 - v) * (zb - za) + v * (zd - zc);
|
|
329
|
+
dv = (1 - u) * (zc - za) + u * (zd - zb);
|
|
330
|
+
} else if (this.diagonal === "00-11" ? v <= u : u + v <= 1) {
|
|
331
|
+
const last = this.diagonal === "00-11" ? d : c;
|
|
332
|
+
if (!this.validity[a] || !this.validity[b] || !this.validity[last]) {
|
|
333
|
+
return resetSample(result, TerrainSampleStatus.NO_DATA);
|
|
334
|
+
}
|
|
335
|
+
du = zb - za;
|
|
336
|
+
dv = this.diagonal === "00-11" ? zd - zb : zc - za;
|
|
337
|
+
result.height = this.diagonal === "00-11" ? (1 - u) * za + (u - v) * zb + v * zd : (1 - u - v) * za + u * zb + v * zc;
|
|
338
|
+
} else {
|
|
339
|
+
const first = this.diagonal === "00-11" ? a : b;
|
|
340
|
+
if (!this.validity[first] || !this.validity[c] || !this.validity[d]) {
|
|
341
|
+
return resetSample(result, TerrainSampleStatus.NO_DATA);
|
|
342
|
+
}
|
|
343
|
+
du = zd - zc;
|
|
344
|
+
dv = this.diagonal === "00-11" ? zc - za : zd - zb;
|
|
345
|
+
result.height = this.diagonal === "00-11" ? (1 - v) * za + u * zd + (v - u) * zc : (1 - v) * zb + (1 - u) * zc + (u + v - 1) * zd;
|
|
346
|
+
}
|
|
347
|
+
if (!Number.isFinite(result.height))
|
|
348
|
+
return resetSample(result, TerrainSampleStatus.NUMERIC_ERROR);
|
|
349
|
+
result.status = TerrainSampleStatus.VALID;
|
|
350
|
+
if (clampedColumn)
|
|
351
|
+
du = 0;
|
|
352
|
+
if (clampedRow)
|
|
353
|
+
dv = 0;
|
|
354
|
+
const gx = du * this.inverse[0] + dv * this.inverse[2];
|
|
355
|
+
const gy = du * this.inverse[1] + dv * this.inverse[3];
|
|
356
|
+
if (!Number.isFinite(gx) || !Number.isFinite(gy)) {
|
|
357
|
+
result.gradientStatus = TerrainSampleStatus.NUMERIC_ERROR;
|
|
358
|
+
return result;
|
|
359
|
+
}
|
|
360
|
+
const normalScale = Math.max(Math.abs(gx), Math.abs(gy), 1);
|
|
361
|
+
const nx = -gx / normalScale;
|
|
362
|
+
const ny = -gy / normalScale;
|
|
363
|
+
const nz = 1 / normalScale;
|
|
364
|
+
const length = Math.hypot(nx, ny, nz);
|
|
365
|
+
result.gradientStatus = TerrainSampleStatus.VALID;
|
|
366
|
+
result.gradientX = gx;
|
|
367
|
+
result.gradientY = gy;
|
|
368
|
+
result.normalX = nx / length;
|
|
369
|
+
result.normalY = ny / length;
|
|
370
|
+
result.normalZ = nz / length;
|
|
371
|
+
return result;
|
|
372
|
+
}
|
|
373
|
+
/** Interleaved XY inputs and caller-owned outputs, with no per-sample allocation. */
|
|
374
|
+
sampleBatch(positions, output, options) {
|
|
375
|
+
validateBatch(positions, output);
|
|
376
|
+
for (let i = 0; i < positions.length / 2; i++) {
|
|
377
|
+
const sample2 = this.sample(positions[2 * i], positions[2 * i + 1], options, this.batchSample);
|
|
378
|
+
output.heights[i] = sample2.height;
|
|
379
|
+
if (!Number.isFinite(output.heights[i])) {
|
|
380
|
+
resetSample(sample2, TerrainSampleStatus.NUMERIC_ERROR);
|
|
381
|
+
output.heights[i] = 0;
|
|
382
|
+
}
|
|
383
|
+
if (output.gradients) {
|
|
384
|
+
output.gradients[2 * i] = sample2.gradientX;
|
|
385
|
+
output.gradients[2 * i + 1] = sample2.gradientY;
|
|
386
|
+
if (!Number.isFinite(output.gradients[2 * i]) || !Number.isFinite(output.gradients[2 * i + 1])) {
|
|
387
|
+
output.gradients[2 * i] = output.gradients[2 * i + 1] = 0;
|
|
388
|
+
sample2.gradientStatus = TerrainSampleStatus.NUMERIC_ERROR;
|
|
389
|
+
sample2.normalX = sample2.normalY = sample2.normalZ = 0;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
if (output.normals) {
|
|
393
|
+
output.normals[3 * i] = sample2.normalX;
|
|
394
|
+
output.normals[3 * i + 1] = sample2.normalY;
|
|
395
|
+
output.normals[3 * i + 2] = sample2.normalZ;
|
|
396
|
+
}
|
|
397
|
+
output.statuses[i] = sample2.status;
|
|
398
|
+
if (output.gradientStatuses)
|
|
399
|
+
output.gradientStatuses[i] = sample2.gradientStatus;
|
|
400
|
+
}
|
|
401
|
+
return output;
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
// dist/terrain/sample-triangle-height.js
|
|
408
|
+
function sampleTerrainTriangleHeight(field, x, y) {
|
|
409
|
+
if (Number.isInteger(x) && Number.isInteger(y))
|
|
410
|
+
return field.getHeight(x, y);
|
|
411
|
+
const column = Math.min(Math.floor(x), field.width - 2);
|
|
412
|
+
const row = Math.min(Math.floor(y), field.height - 2);
|
|
413
|
+
const u = x - column, v = y - row;
|
|
414
|
+
let a, b, c, d;
|
|
415
|
+
if (field.diagonal === "00-11") {
|
|
416
|
+
if (v <= u) {
|
|
417
|
+
a = 1 - u;
|
|
418
|
+
b = u - v;
|
|
419
|
+
c = 0;
|
|
420
|
+
d = v;
|
|
421
|
+
} else {
|
|
422
|
+
a = 1 - v;
|
|
423
|
+
b = 0;
|
|
424
|
+
c = v - u;
|
|
425
|
+
d = u;
|
|
426
|
+
}
|
|
427
|
+
} else if (u + v <= 1) {
|
|
428
|
+
a = 1 - u - v;
|
|
429
|
+
b = u;
|
|
430
|
+
c = v;
|
|
431
|
+
d = 0;
|
|
432
|
+
} else {
|
|
433
|
+
a = 0;
|
|
434
|
+
b = 1 - v;
|
|
435
|
+
c = 1 - u;
|
|
436
|
+
d = u + v - 1;
|
|
437
|
+
}
|
|
438
|
+
const za = a ? field.getHeight(column, row) : 0;
|
|
439
|
+
const zb = b ? field.getHeight(column + 1, row) : 0;
|
|
440
|
+
const zc = c ? field.getHeight(column, row + 1) : 0;
|
|
441
|
+
const zd = d ? field.getHeight(column + 1, row + 1) : 0;
|
|
442
|
+
if (za === void 0 || zb === void 0 || zc === void 0 || zd === void 0)
|
|
443
|
+
return void 0;
|
|
444
|
+
const height2 = a * za + b * zb + c * zc + d * zd;
|
|
445
|
+
if (!Number.isFinite(height2))
|
|
446
|
+
throw new Error("Terrain triangle numeric sampling failure");
|
|
447
|
+
return height2;
|
|
448
|
+
}
|
|
449
|
+
var init_sample_triangle_height = __esm({
|
|
450
|
+
"dist/terrain/sample-triangle-height.js"() {
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
// dist/terrain/mixed-vertex-halos.js
|
|
455
|
+
function buildMixedVertexTileHalos(tiles, options = {}, targets, preparation) {
|
|
456
|
+
const maxSamples = options.maxSamples ?? 4e6, maxTests = options.maxTileTests ?? 1e7;
|
|
457
|
+
if (![maxSamples, maxTests].every((v) => Number.isSafeInteger(v) && v >= 0))
|
|
458
|
+
throw new Error("Invalid mixed halo capacity");
|
|
459
|
+
let count = 0;
|
|
460
|
+
let previousKey;
|
|
461
|
+
let frame;
|
|
462
|
+
const sources = [...tiles].sort((a, b) => a.spacing - b.spacing || a.column - b.column || a.row - b.row).map((tile) => {
|
|
463
|
+
count += (tile.field.width + 2) * (tile.field.height + 2);
|
|
464
|
+
if (!Number.isSafeInteger(count) || count > maxSamples)
|
|
465
|
+
throw new Error("Mixed halo sample capacity exceeded");
|
|
466
|
+
let prepared = preparation == null ? void 0 : preparation.tiles.get(tile);
|
|
467
|
+
if (!prepared) {
|
|
468
|
+
prepared = prepareMixedHaloTile(tile);
|
|
469
|
+
preparation == null ? void 0 : preparation.tiles.set(tile, prepared);
|
|
470
|
+
}
|
|
471
|
+
const { key: key3, source: field, columnStep: column, rowStep: row, frameOrigin: origin, scale: scale3 } = prepared;
|
|
472
|
+
if (previousKey === key3)
|
|
473
|
+
throw new Error("Duplicate mixed halo tile");
|
|
474
|
+
previousKey = key3;
|
|
475
|
+
if (frame) {
|
|
476
|
+
if (frame.reference !== field.heightReference)
|
|
477
|
+
throw new Error("Mixed halo frames or height references differ");
|
|
478
|
+
for (let i = 0; i < 2; i++) {
|
|
479
|
+
if (column[i] !== frame.column[i] || row[i] !== frame.row[i] || origin[i] !== frame.origin[i] && Math.abs(origin[i] - frame.origin[i]) > Math.min(16 * Number.EPSILON * Math.max(scale3[i], frame.scale[i]), 1e-9 * Math.max(Math.abs(column[i]), Math.abs(row[i]))))
|
|
480
|
+
throw new Error("Mixed halo frames or height references differ");
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
frame ?? (frame = { origin, column, row, reference: field.heightReference, scale: scale3 });
|
|
484
|
+
return prepared;
|
|
485
|
+
});
|
|
486
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
487
|
+
for (let i = 0; i < sources.length; i++) {
|
|
488
|
+
const { haloBounds } = sources[i];
|
|
489
|
+
minX = Math.min(minX, haloBounds.minX);
|
|
490
|
+
minY = Math.min(minY, haloBounds.minY);
|
|
491
|
+
maxX = Math.max(maxX, haloBounds.maxX);
|
|
492
|
+
maxY = Math.max(maxY, haloBounds.maxY);
|
|
493
|
+
}
|
|
494
|
+
if (sources.length && (!Number.isSafeInteger(maxX - minX) || !Number.isSafeInteger(maxY - minY)))
|
|
495
|
+
throw new Error("Mixed halo lattice span overflow");
|
|
496
|
+
if (targets && targets.size === 0)
|
|
497
|
+
return { tiles: [] };
|
|
498
|
+
let index;
|
|
499
|
+
if (sources.length > 8) {
|
|
500
|
+
const cached = preparation == null ? void 0 : preparation.layout;
|
|
501
|
+
if (cached && sources.length === cached.keys.length && sources.every((tile, i) => tile.layoutKey === cached.keys[i])) {
|
|
502
|
+
index = cached.query;
|
|
503
|
+
} else {
|
|
504
|
+
index = createTerrainBoxIndex(sources.map((tile) => ({
|
|
505
|
+
minX: tile.column,
|
|
506
|
+
minY: tile.row,
|
|
507
|
+
maxX: tile.column + (tile.source.width - 1) * tile.spacing,
|
|
508
|
+
maxY: tile.row + (tile.source.height - 1) * tile.spacing
|
|
509
|
+
})));
|
|
510
|
+
if (preparation)
|
|
511
|
+
preparation.layout = { keys: sources.map((tile) => tile.layoutKey), query: index };
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
let tests = 0;
|
|
515
|
+
const charge = () => {
|
|
516
|
+
if (++tests > maxTests)
|
|
517
|
+
throw new Error("Mixed halo tile-test budget exceeded");
|
|
518
|
+
};
|
|
519
|
+
return {
|
|
520
|
+
tiles: sources.filter((tile) => !targets || targets.has(tile.key)).map((tile) => {
|
|
521
|
+
const source = tile.source, width = source.width + 2, height2 = source.height + 2;
|
|
522
|
+
const heights = new Float64Array(width * height2), validity = new Uint8Array(heights.length), statuses = new Uint8Array(heights.length);
|
|
523
|
+
const candidates = (index == null ? void 0 : index(tile.haloBounds, charge).map((id) => sources[id])) ?? sources;
|
|
524
|
+
for (let y = 0; y < height2; y++)
|
|
525
|
+
for (let x = 0; x < width; x++) {
|
|
526
|
+
const gx = tile.column + (x - 1) * tile.spacing, gy = tile.row + (y - 1) * tile.spacing;
|
|
527
|
+
if (!Number.isSafeInteger(gx) || !Number.isSafeInteger(gy))
|
|
528
|
+
throw new Error("Mixed halo lattice overflow");
|
|
529
|
+
for (let candidateIndex = 0; candidateIndex < candidates.length; candidateIndex++) {
|
|
530
|
+
const candidate = candidates[candidateIndex];
|
|
531
|
+
charge();
|
|
532
|
+
const cx = (gx - candidate.column) / candidate.spacing, cy = (gy - candidate.row) / candidate.spacing;
|
|
533
|
+
const f = candidate.source;
|
|
534
|
+
if (cx < 0 || cy < 0 || cx > f.width - 1 || cy > f.height - 1)
|
|
535
|
+
continue;
|
|
536
|
+
const value2 = sampleTerrainTriangleHeight(f, cx, cy);
|
|
537
|
+
const i = y * width + x;
|
|
538
|
+
statuses[i] = value2 === void 0 ? 1 : 2;
|
|
539
|
+
if (value2 !== void 0) {
|
|
540
|
+
heights[i] = value2;
|
|
541
|
+
validity[i] = 1;
|
|
542
|
+
}
|
|
543
|
+
break;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
const origin = [
|
|
547
|
+
source.origin[0] - source.columnStep[0] - source.rowStep[0],
|
|
548
|
+
source.origin[1] - source.columnStep[1] - source.rowStep[1]
|
|
549
|
+
];
|
|
550
|
+
if (!origin.every(Number.isFinite))
|
|
551
|
+
throw new Error("Mixed halo coordinate overflow");
|
|
552
|
+
return {
|
|
553
|
+
column: tile.column,
|
|
554
|
+
row: tile.row,
|
|
555
|
+
spacing: tile.spacing,
|
|
556
|
+
statuses,
|
|
557
|
+
field: {
|
|
558
|
+
...tile.field,
|
|
559
|
+
width,
|
|
560
|
+
height: height2,
|
|
561
|
+
heights,
|
|
562
|
+
validity,
|
|
563
|
+
offset: 0,
|
|
564
|
+
stride: width,
|
|
565
|
+
origin,
|
|
566
|
+
columnStep: [...source.columnStep],
|
|
567
|
+
rowStep: [...source.rowStep]
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
})
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
function prepareMixedHaloTile(tile) {
|
|
574
|
+
const { column, row, spacing } = tile;
|
|
575
|
+
if (![column, row, spacing].every(Number.isSafeInteger) || spacing < 1 || 2 ** Math.round(Math.log2(spacing)) !== spacing)
|
|
576
|
+
throw new Error("Invalid mixed halo lattice");
|
|
577
|
+
const source = new HeightField(tile.field);
|
|
578
|
+
if (source.registration !== "vertex")
|
|
579
|
+
throw new Error("Mixed halos require vertex registration");
|
|
580
|
+
const columnStep = source.columnStep.map((v) => v / spacing);
|
|
581
|
+
const rowStep = source.rowStep.map((v) => v / spacing);
|
|
582
|
+
const frameOrigin = source.origin.map((v, i) => v - column * columnStep[i] - row * rowStep[i]);
|
|
583
|
+
const scale3 = source.origin.map((v, i) => Math.max(1, Math.abs(v), Math.abs(column * columnStep[i]), Math.abs(row * rowStep[i])));
|
|
584
|
+
if (!frameOrigin.every(Number.isFinite))
|
|
585
|
+
throw new Error("Mixed halo coordinate overflow");
|
|
586
|
+
const minX = column - spacing, minY = row - spacing;
|
|
587
|
+
const maxX = column + source.width * spacing, maxY = row + source.height * spacing;
|
|
588
|
+
if (![minX, minY, maxX, maxY].every(Number.isSafeInteger))
|
|
589
|
+
throw new Error("Mixed halo lattice overflow");
|
|
590
|
+
const key3 = `${spacing}/${column}/${row}`;
|
|
591
|
+
return {
|
|
592
|
+
...tile,
|
|
593
|
+
source,
|
|
594
|
+
columnStep,
|
|
595
|
+
rowStep,
|
|
596
|
+
frameOrigin,
|
|
597
|
+
scale: scale3,
|
|
598
|
+
key: key3,
|
|
599
|
+
layoutKey: `${key3}/${source.width}/${source.height}`,
|
|
600
|
+
haloBounds: { minX, minY, maxX, maxY }
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
var init_mixed_vertex_halos = __esm({
|
|
604
|
+
"dist/terrain/mixed-vertex-halos.js"() {
|
|
605
|
+
init_box_index();
|
|
606
|
+
init_height_field();
|
|
607
|
+
init_sample_triangle_height();
|
|
608
|
+
}
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
// dist/terrain/mixed-halo-update.js
|
|
612
|
+
var mixed_halo_update_exports = {};
|
|
613
|
+
__export(mixed_halo_update_exports, {
|
|
614
|
+
updateTerrainMixedVertexTileHalos: () => updateTerrainMixedVertexTileHalos
|
|
615
|
+
});
|
|
616
|
+
function editedBounds(old, next) {
|
|
617
|
+
const a = old.field;
|
|
618
|
+
const b = next.field;
|
|
619
|
+
if (a.width !== b.width || a.height !== b.height || (a.diagonal ?? "00-11") !== (b.diagonal ?? "00-11"))
|
|
620
|
+
return bounds(next);
|
|
621
|
+
const sample2 = (field, x, y) => {
|
|
622
|
+
const i = (field.offset ?? 0) + y * (field.stride ?? field.width) + x;
|
|
623
|
+
const z = field.heights[i];
|
|
624
|
+
return Number.isFinite(z) && (field.validity === void 0 || field.validity[i] !== 0) ? z : void 0;
|
|
625
|
+
};
|
|
626
|
+
let left = b.width, right = -1, top = b.height, bottom = -1;
|
|
627
|
+
for (let y = 0; y < b.height; y++) {
|
|
628
|
+
for (let x = 0; x < b.width; x++) {
|
|
629
|
+
if (Object.is(sample2(a, x, y), sample2(b, x, y)))
|
|
630
|
+
continue;
|
|
631
|
+
left = Math.min(left, x);
|
|
632
|
+
right = Math.max(right, x);
|
|
633
|
+
top = Math.min(top, y);
|
|
634
|
+
bottom = Math.max(bottom, y);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
if (right < 0)
|
|
638
|
+
return null;
|
|
639
|
+
return {
|
|
640
|
+
minX: next.column + Math.max(0, left - 1) * next.spacing,
|
|
641
|
+
maxX: next.column + Math.min(b.width - 1, right + 1) * next.spacing,
|
|
642
|
+
minY: next.row + Math.max(0, top - 1) * next.spacing,
|
|
643
|
+
maxY: next.row + Math.min(b.height - 1, bottom + 1) * next.spacing
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
function updateTerrainMixedVertexTileHalos(previous, resident, options = {}) {
|
|
647
|
+
const budget = options.maxDependencyTests ?? 1e7;
|
|
648
|
+
if (!Number.isSafeInteger(budget) || budget < 0)
|
|
649
|
+
throw new Error("Invalid mixed halo dependency budget");
|
|
650
|
+
const unchangedLayout = (previous == null ? void 0 : previous.sources.length) === resident.length && resident.every((tile, i) => {
|
|
651
|
+
const prior = previous.sources[i];
|
|
652
|
+
return prior === tile || prior.column === tile.column && prior.row === tile.row && prior.spacing === tile.spacing && prior.field.width === tile.field.width && prior.field.height === tile.field.height;
|
|
653
|
+
});
|
|
654
|
+
const old = unchangedLayout ? void 0 : new Map(previous == null ? void 0 : previous.sources.map((t) => [key(t), t]));
|
|
655
|
+
const targets = /* @__PURE__ */ new Set();
|
|
656
|
+
const initialized = previous !== null && preparations.has(previous);
|
|
657
|
+
if (!initialized) {
|
|
658
|
+
const cached = new Set(previous == null ? void 0 : previous.tiles.map(key));
|
|
659
|
+
for (const tile of resident) {
|
|
660
|
+
const address = key(tile);
|
|
661
|
+
if (!cached.has(address))
|
|
662
|
+
targets.add(address);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
let index = unchangedLayout && previous ? targetIndexes.get(previous) : void 0;
|
|
666
|
+
let tests = 0;
|
|
667
|
+
const charge = () => {
|
|
668
|
+
if (++tests > budget)
|
|
669
|
+
throw new Error("Mixed halo dependency budget exceeded");
|
|
670
|
+
};
|
|
671
|
+
function invalidate(box) {
|
|
672
|
+
index ?? (index = createTerrainBoxIndex(resident.map((tile) => bounds(tile, tile.spacing))));
|
|
673
|
+
for (const id of index(box, charge))
|
|
674
|
+
targets.add(key(resident[id]));
|
|
675
|
+
}
|
|
676
|
+
for (let i = 0; i < resident.length; i++) {
|
|
677
|
+
const tile = resident[i];
|
|
678
|
+
const prior = unchangedLayout ? previous.sources[i] : old == null ? void 0 : old.get(key(tile));
|
|
679
|
+
if (prior === tile)
|
|
680
|
+
continue;
|
|
681
|
+
targets.add(key(tile));
|
|
682
|
+
if (!previous)
|
|
683
|
+
continue;
|
|
684
|
+
if (!prior) {
|
|
685
|
+
invalidate(bounds(tile));
|
|
686
|
+
} else if (prior.field.width !== tile.field.width || prior.field.height !== tile.field.height) {
|
|
687
|
+
invalidate(bounds(prior));
|
|
688
|
+
invalidate(bounds(tile));
|
|
689
|
+
} else {
|
|
690
|
+
const dirty = editedBounds(prior, tile);
|
|
691
|
+
if (dirty)
|
|
692
|
+
invalidate(dirty);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
const removed = [];
|
|
696
|
+
if (old == null ? void 0 : old.size) {
|
|
697
|
+
const current = new Set(resident.map(key));
|
|
698
|
+
for (const [address, tile] of old) {
|
|
699
|
+
if (current.has(address))
|
|
700
|
+
continue;
|
|
701
|
+
removed.push(address);
|
|
702
|
+
if (resident.length)
|
|
703
|
+
invalidate(bounds(tile));
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
const priorPreparation = previous && preparations.get(previous);
|
|
707
|
+
const preparation = {
|
|
708
|
+
tiles: (priorPreparation == null ? void 0 : priorPreparation.tiles) ?? /* @__PURE__ */ new WeakMap(),
|
|
709
|
+
layout: priorPreparation == null ? void 0 : priorPreparation.layout
|
|
710
|
+
};
|
|
711
|
+
const built = buildMixedVertexTileHalos(resident, options, targets, preparation).tiles;
|
|
712
|
+
let tiles;
|
|
713
|
+
if (unchangedLayout && initialized) {
|
|
714
|
+
let cursor = 0;
|
|
715
|
+
tiles = previous.tiles.map((tile) => {
|
|
716
|
+
const replacement = built[cursor];
|
|
717
|
+
if ((replacement == null ? void 0 : replacement.spacing) !== tile.spacing || replacement.column !== tile.column || replacement.row !== tile.row)
|
|
718
|
+
return tile;
|
|
719
|
+
cursor++;
|
|
720
|
+
return replacement;
|
|
721
|
+
});
|
|
722
|
+
} else {
|
|
723
|
+
const cached = new Map(previous == null ? void 0 : previous.tiles.map((tile) => [key(tile), tile]));
|
|
724
|
+
for (const tile of built)
|
|
725
|
+
cached.set(key(tile), tile);
|
|
726
|
+
tiles = resident.map((tile) => cached.get(key(tile))).sort((a, b) => a.spacing - b.spacing || a.column - b.column || a.row - b.row);
|
|
727
|
+
}
|
|
728
|
+
const snapshot2 = {
|
|
729
|
+
sources: resident.slice(),
|
|
730
|
+
tiles,
|
|
731
|
+
rebuilt: built.map(key),
|
|
732
|
+
removed: removed.sort()
|
|
733
|
+
};
|
|
734
|
+
preparations.set(snapshot2, preparation);
|
|
735
|
+
if (index)
|
|
736
|
+
targetIndexes.set(snapshot2, index);
|
|
737
|
+
return snapshot2;
|
|
738
|
+
}
|
|
739
|
+
var key, bounds, preparations, targetIndexes;
|
|
740
|
+
var init_mixed_halo_update = __esm({
|
|
741
|
+
"dist/terrain/mixed-halo-update.js"() {
|
|
742
|
+
init_box_index();
|
|
743
|
+
init_mixed_vertex_halos();
|
|
744
|
+
key = (t) => `${t.spacing}/${t.column}/${t.row}`;
|
|
745
|
+
bounds = (tile, padding = 0) => ({
|
|
746
|
+
minX: tile.column - padding,
|
|
747
|
+
minY: tile.row - padding,
|
|
748
|
+
maxX: tile.column + (tile.field.width - 1) * tile.spacing + padding,
|
|
749
|
+
maxY: tile.row + (tile.field.height - 1) * tile.spacing + padding
|
|
750
|
+
});
|
|
751
|
+
preparations = /* @__PURE__ */ new WeakMap();
|
|
752
|
+
targetIndexes = /* @__PURE__ */ new WeakMap();
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
|
|
756
|
+
// dist/terrain/mesh-coverage.js
|
|
757
|
+
var mesh_coverage_exports = {};
|
|
758
|
+
__export(mesh_coverage_exports, {
|
|
759
|
+
certifyTerrainMeshCoverage: () => certifyTerrainMeshCoverage
|
|
760
|
+
});
|
|
761
|
+
function gcd(a, b) {
|
|
762
|
+
if (a < 0n)
|
|
763
|
+
a = -a;
|
|
764
|
+
if (b < 0n)
|
|
765
|
+
b = -b;
|
|
766
|
+
while (b !== 0n)
|
|
767
|
+
[a, b] = [b, a % b];
|
|
768
|
+
return a;
|
|
769
|
+
}
|
|
770
|
+
function certifyTerrainMeshCoverage(field, mesh, options = {}) {
|
|
771
|
+
var _a3, _b2;
|
|
772
|
+
const { reference = "triangle", maxTriangles = 2e6 } = options;
|
|
773
|
+
const referenceMesh = typeof reference === "object" ? reference : null;
|
|
774
|
+
const validShape = (input) => input.indices.length % 3 === 0 && input.gridCoordinates.length % 2 === 0;
|
|
775
|
+
if (!Number.isSafeInteger(maxTriangles) || maxTriangles < 1 || !referenceMesh && reference !== "triangle" && reference !== "bilinear" || !validShape(mesh) || referenceMesh && !validShape(referenceMesh))
|
|
776
|
+
throw new Error("Invalid terrain coverage input");
|
|
777
|
+
const trianglesVisited = mesh.indices.length / 3 + (referenceMesh ? referenceMesh.indices.length / 3 : 2 * (field.width - 1) * (field.height - 1));
|
|
778
|
+
if (trianglesVisited > maxTriangles) {
|
|
779
|
+
return {
|
|
780
|
+
status: "budget-exhausted",
|
|
781
|
+
unmatchedSegments: 0,
|
|
782
|
+
witness: null,
|
|
783
|
+
trianglesVisited: 0,
|
|
784
|
+
residualEdges: 0
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
const bits = new DataView(new ArrayBuffer(8));
|
|
788
|
+
function exact(value2) {
|
|
789
|
+
bits.setFloat64(0, value2);
|
|
790
|
+
const raw = bits.getBigUint64(0);
|
|
791
|
+
const exponent = Number(raw >> 52n & 2047n);
|
|
792
|
+
const fraction = raw & (1n << 52n) - 1n;
|
|
793
|
+
const integer = exponent === 0 ? fraction : (1n << 52n | fraction) << BigInt(exponent - 1);
|
|
794
|
+
return value2 < 0 ? -integer : integer;
|
|
795
|
+
}
|
|
796
|
+
const vertices2 = [];
|
|
797
|
+
const vertexIds = /* @__PURE__ */ new Map();
|
|
798
|
+
const edges = /* @__PURE__ */ new Map();
|
|
799
|
+
function vertex(x, y) {
|
|
800
|
+
if (!Number.isFinite(x) || !Number.isFinite(y))
|
|
801
|
+
throw new Error("Nonfinite coverage coordinate");
|
|
802
|
+
const key3 = `${x},${y}`;
|
|
803
|
+
const previous = vertexIds.get(key3);
|
|
804
|
+
if (previous !== void 0)
|
|
805
|
+
return previous;
|
|
806
|
+
const id = vertices2.length;
|
|
807
|
+
vertices2.push([x, y]);
|
|
808
|
+
vertexIds.set(key3, id);
|
|
809
|
+
return id;
|
|
810
|
+
}
|
|
811
|
+
function edge2(a, b, weight) {
|
|
812
|
+
var _a4;
|
|
813
|
+
if (a > b) {
|
|
814
|
+
[a, b] = [b, a];
|
|
815
|
+
weight = -weight;
|
|
816
|
+
}
|
|
817
|
+
const key3 = b < 2 ** 26 ? a * 2 ** 26 + b : `${a},${b}`;
|
|
818
|
+
const sum = (((_a4 = edges.get(key3)) == null ? void 0 : _a4.weight) ?? 0) + weight;
|
|
819
|
+
if (sum === 0)
|
|
820
|
+
edges.delete(key3);
|
|
821
|
+
else
|
|
822
|
+
edges.set(key3, { a, b, weight: sum });
|
|
823
|
+
}
|
|
824
|
+
function triangle(a, b, c, weight) {
|
|
825
|
+
edge2(a, b, weight);
|
|
826
|
+
edge2(b, c, weight);
|
|
827
|
+
edge2(c, a, weight);
|
|
828
|
+
}
|
|
829
|
+
function addMesh({ indices, gridCoordinates }, weight) {
|
|
830
|
+
for (let i = 0; i < indices.length; i += 3) {
|
|
831
|
+
const ids = [indices[i], indices[i + 1], indices[i + 2]].map((id) => {
|
|
832
|
+
if (!Number.isSafeInteger(id) || id < 0 || id >= gridCoordinates.length / 2)
|
|
833
|
+
throw new Error("Invalid coverage vertex index");
|
|
834
|
+
return vertex(gridCoordinates[id * 2], gridCoordinates[id * 2 + 1]);
|
|
835
|
+
});
|
|
836
|
+
const [a, b, c] = ids.map((id) => vertices2[id]);
|
|
837
|
+
const left = (b[0] - a[0]) * (c[1] - a[1]);
|
|
838
|
+
const right = (b[1] - a[1]) * (c[0] - a[0]);
|
|
839
|
+
const det = left - right;
|
|
840
|
+
const limit = 8 * Number.EPSILON * (Math.abs(left) + Math.abs(right)) + 8 * Number.MIN_VALUE;
|
|
841
|
+
let sign5 = Math.sign(det);
|
|
842
|
+
if (!Number.isFinite(det) || Math.abs(det) <= limit) {
|
|
843
|
+
const [ax, ay] = a.map(exact), [bx, by] = b.map(exact), [cx, cy] = c.map(exact);
|
|
844
|
+
const determinant = (bx - ax) * (cy - ay) - (by - ay) * (cx - ax);
|
|
845
|
+
sign5 = determinant > 0n ? 1 : determinant < 0n ? -1 : 0;
|
|
846
|
+
}
|
|
847
|
+
if (!sign5)
|
|
848
|
+
throw new Error("Degenerate coverage triangle");
|
|
849
|
+
triangle(ids[0], ids[1], ids[2], weight * sign5);
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
addMesh(mesh, 1);
|
|
853
|
+
if (referenceMesh)
|
|
854
|
+
addMesh(referenceMesh, -1);
|
|
855
|
+
else
|
|
856
|
+
for (let y = 0; y < field.height - 1; y++) {
|
|
857
|
+
for (let x = 0; x < field.width - 1; x++) {
|
|
858
|
+
const valid = [
|
|
859
|
+
field.getHeight(x, y),
|
|
860
|
+
field.getHeight(x + 1, y),
|
|
861
|
+
field.getHeight(x, y + 1),
|
|
862
|
+
field.getHeight(x + 1, y + 1)
|
|
863
|
+
].map((z) => z !== void 0);
|
|
864
|
+
if (reference === "bilinear" && !valid.every(Boolean))
|
|
865
|
+
continue;
|
|
866
|
+
const corners2 = [
|
|
867
|
+
[x, y],
|
|
868
|
+
[x + 1, y],
|
|
869
|
+
[x, y + 1],
|
|
870
|
+
[x + 1, y + 1]
|
|
871
|
+
];
|
|
872
|
+
const faces = field.diagonal === "00-11" ? [
|
|
873
|
+
[0, 1, 3],
|
|
874
|
+
[0, 3, 2]
|
|
875
|
+
] : [
|
|
876
|
+
[0, 1, 2],
|
|
877
|
+
[1, 3, 2]
|
|
878
|
+
];
|
|
879
|
+
for (const [a, b, c] of faces) {
|
|
880
|
+
if (!valid[a] || !valid[b] || !valid[c])
|
|
881
|
+
continue;
|
|
882
|
+
triangle(vertex(...corners2[a]), vertex(...corners2[b]), vertex(...corners2[c]), -1);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
const lines = /* @__PURE__ */ new Map();
|
|
887
|
+
for (const { a, b, weight } of edges.values()) {
|
|
888
|
+
const p = vertices2[a], q = vertices2[b];
|
|
889
|
+
const [x, y] = p.map(exact), [u, v] = q.map(exact);
|
|
890
|
+
const divisor = gcd(u - x, v - y);
|
|
891
|
+
let dx = (u - x) / divisor, dy = (v - y) / divisor;
|
|
892
|
+
if (dx < 0n || dx === 0n && dy < 0n)
|
|
893
|
+
[dx, dy] = [-dx, -dy];
|
|
894
|
+
const key3 = `${dx},${dy},${dx * y - dy * x}`;
|
|
895
|
+
let events = lines.get(key3);
|
|
896
|
+
if (!events) {
|
|
897
|
+
events = /* @__PURE__ */ new Map();
|
|
898
|
+
lines.set(key3, events);
|
|
899
|
+
}
|
|
900
|
+
const axis = dx === 0n ? 1 : 0;
|
|
901
|
+
const delta = weight;
|
|
902
|
+
events.set(p[axis], { point: p, delta: (((_a3 = events.get(p[axis])) == null ? void 0 : _a3.delta) ?? 0) + delta });
|
|
903
|
+
events.set(q[axis], { point: q, delta: (((_b2 = events.get(q[axis])) == null ? void 0 : _b2.delta) ?? 0) - delta });
|
|
904
|
+
}
|
|
905
|
+
let unmatchedSegments = 0;
|
|
906
|
+
let witness = null;
|
|
907
|
+
for (const events of lines.values()) {
|
|
908
|
+
const sorted = [...events].sort(([a], [b]) => a - b);
|
|
909
|
+
let jump = 0;
|
|
910
|
+
for (let i = 0; i + 1 < sorted.length; i++) {
|
|
911
|
+
jump += sorted[i][1].delta;
|
|
912
|
+
if (!jump)
|
|
913
|
+
continue;
|
|
914
|
+
unmatchedSegments++;
|
|
915
|
+
witness ?? (witness = { start: sorted[i][1].point, end: sorted[i + 1][1].point, multiplicityJump: jump });
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
return {
|
|
919
|
+
status: unmatchedSegments ? "mismatch" : "certified",
|
|
920
|
+
unmatchedSegments,
|
|
921
|
+
witness,
|
|
922
|
+
trianglesVisited,
|
|
923
|
+
residualEdges: edges.size
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
var init_mesh_coverage = __esm({
|
|
927
|
+
"dist/terrain/mesh-coverage.js"() {
|
|
928
|
+
}
|
|
929
|
+
});
|
|
930
|
+
|
|
37
931
|
// dist/maps/layout.js
|
|
38
932
|
function getMapLayout(map, options = {}) {
|
|
39
933
|
const regions2 = map.regions.map((region) => {
|
|
@@ -201,7 +1095,7 @@ function snapshot(value2) {
|
|
|
201
1095
|
if (Array.isArray(value2))
|
|
202
1096
|
return Object.freeze(value2.map(snapshot));
|
|
203
1097
|
if (typeof value2 === "object" && Object.getPrototypeOf(value2) === Object.prototype)
|
|
204
|
-
return Object.freeze(Object.fromEntries(Object.entries(value2).map(([
|
|
1098
|
+
return Object.freeze(Object.fromEntries(Object.entries(value2).map(([key3, item]) => [key3, snapshot(item)])));
|
|
205
1099
|
throw new Error("MapDescription must contain only finite JSON data; pass callbacks in MapEngineOptions");
|
|
206
1100
|
}
|
|
207
1101
|
var MapEngine;
|
|
@@ -286,9 +1180,9 @@ var init_map_engine = __esm({
|
|
|
286
1180
|
const first = groups.get(seam.regions[0]);
|
|
287
1181
|
for (const id of seam.regions.slice(1)) {
|
|
288
1182
|
const previous = groups.get(id);
|
|
289
|
-
for (const [
|
|
1183
|
+
for (const [key3, group] of groups)
|
|
290
1184
|
if (group === previous)
|
|
291
|
-
groups.set(
|
|
1185
|
+
groups.set(key3, first);
|
|
292
1186
|
}
|
|
293
1187
|
}
|
|
294
1188
|
this.capabilities = Object.freeze({
|
|
@@ -966,10 +1860,10 @@ var init_map_layout = __esm({
|
|
|
966
1860
|
}
|
|
967
1861
|
buildSeams() {
|
|
968
1862
|
const groups = /* @__PURE__ */ new Map();
|
|
969
|
-
const
|
|
1863
|
+
const key3 = (p) => p.map((v) => Math.round(v * 1e9)).join(",");
|
|
970
1864
|
for (const r of this.compiled)
|
|
971
1865
|
r.vertices.forEach((p, i) => {
|
|
972
|
-
const k2 = [
|
|
1866
|
+
const k2 = [key3(p), key3(r.vertices[(i + 1) % r.vertices.length])].sort().join("/");
|
|
973
1867
|
const group = groups.get(k2) || [];
|
|
974
1868
|
group.push({ r, i });
|
|
975
1869
|
groups.set(k2, group);
|
|
@@ -1777,15 +2671,15 @@ function tracePolygonConstraints(input, output, tolerance = 1e-10, priorities, a
|
|
|
1777
2671
|
Math.max(a[0], b[0]) + padding,
|
|
1778
2672
|
Math.max(a[1], b[1]) + padding
|
|
1779
2673
|
], ids = [];
|
|
1780
|
-
const
|
|
2674
|
+
const overlaps2 = (b2) => b2[0] <= box[2] && b2[2] >= box[0] && b2[1] <= box[3] && b2[3] >= box[1];
|
|
1781
2675
|
const visit = (node) => {
|
|
1782
2676
|
tick();
|
|
1783
|
-
if (!
|
|
2677
|
+
if (!overlaps2(node.box))
|
|
1784
2678
|
return;
|
|
1785
2679
|
if (node.ids) {
|
|
1786
2680
|
for (const id of node.ids) {
|
|
1787
2681
|
tick();
|
|
1788
|
-
if (
|
|
2682
|
+
if (overlaps2(boxes[id]))
|
|
1789
2683
|
ids.push(id);
|
|
1790
2684
|
}
|
|
1791
2685
|
} else {
|
|
@@ -4105,15 +4999,15 @@ function createWorldKernel(name, parameters = {}) {
|
|
|
4105
4999
|
}
|
|
4106
5000
|
};
|
|
4107
5001
|
const entry = table[name];
|
|
4108
|
-
for (const
|
|
4109
|
-
if (!(entry == null ? void 0 : entry.fields.some((f) => f[0] ===
|
|
4110
|
-
throw new Error(`Unsupported ${name} parameter: ${
|
|
5002
|
+
for (const key3 of Object.keys(parameters))
|
|
5003
|
+
if (!(entry == null ? void 0 : entry.fields.some((f) => f[0] === key3)))
|
|
5004
|
+
throw new Error(`Unsupported ${name} parameter: ${key3}`);
|
|
4111
5005
|
if (!entry || !Object.keys(parameters).length)
|
|
4112
5006
|
return worldKernels[name];
|
|
4113
|
-
const values = entry.fields.map(([
|
|
4114
|
-
const value2 = parameters[
|
|
5007
|
+
const values = entry.fields.map(([key3, fallback, low, high, degrees4]) => {
|
|
5008
|
+
const value2 = parameters[key3] ?? fallback;
|
|
4115
5009
|
if (!Number.isFinite(value2) || value2 < low || value2 > high)
|
|
4116
|
-
throw new Error(`Invalid ${name} ${
|
|
5010
|
+
throw new Error(`Invalid ${name} ${key3}; expected [${low}, ${high}]`);
|
|
4117
5011
|
return degrees4 ? value2 * Math.PI / 180 : value2;
|
|
4118
5012
|
});
|
|
4119
5013
|
if (name === "hammer" && values[0] === 1 || name === "lagrange" && values[0] === 1)
|
|
@@ -5198,13 +6092,13 @@ var init_map = __esm({
|
|
|
5198
6092
|
}
|
|
5199
6093
|
makeSeams() {
|
|
5200
6094
|
const groups = /* @__PURE__ */ new Map();
|
|
5201
|
-
const
|
|
6095
|
+
const key3 = (p) => [Math.abs(p[0]) === 180 ? -180 : p[0], p[1]].map((v) => Math.round(v * 1e7)).join(",");
|
|
5202
6096
|
for (const c of this.charts) {
|
|
5203
6097
|
let edge2 = 0;
|
|
5204
6098
|
for (const polygon of c.domain)
|
|
5205
6099
|
for (const ring of polygon)
|
|
5206
6100
|
for (let i = 1; i < ring.length; i++, edge2++) {
|
|
5207
|
-
const a = ring[i - 1], b = ring[i], k2 = [
|
|
6101
|
+
const a = ring[i - 1], b = ring[i], k2 = [key3(a), key3(b)].sort().join("/"), group = groups.get(k2) ?? [];
|
|
5208
6102
|
group.push({ c, a, b, edge: edge2 });
|
|
5209
6103
|
groups.set(k2, group);
|
|
5210
6104
|
}
|
|
@@ -5318,7 +6212,7 @@ function airOceanMesh() {
|
|
|
5318
6212
|
faces[19] = [1, 13, 2];
|
|
5319
6213
|
faces.push([13, 1, 10]);
|
|
5320
6214
|
const radians4 = Math.PI / 180;
|
|
5321
|
-
const rotation2 = new
|
|
6215
|
+
const rotation2 = new import_matrix.Matrix4().rotateZ(83.65929 * radians4).rotateY(25.44458 * radians4).rotateX(87.45184 * radians4);
|
|
5322
6216
|
const geographicVertices = vertices2.map((v) => Array.from(rotation2.transformAsPoint(v)));
|
|
5323
6217
|
for (const f of faces) {
|
|
5324
6218
|
if (dot(cross(subtract(geographicVertices[f[1]], geographicVertices[f[0]]), subtract(geographicVertices[f[2]], geographicVertices[f[0]])), geographicVertices[f[0]]) < 0)
|
|
@@ -5355,10 +6249,10 @@ function airOceanMesh() {
|
|
|
5355
6249
|
joins: parents.flatMap((parent, face) => parent < 0 ? [] : [[parent, face]])
|
|
5356
6250
|
};
|
|
5357
6251
|
}
|
|
5358
|
-
var
|
|
6252
|
+
var import_matrix, subtract, center;
|
|
5359
6253
|
var init_air_ocean_mesh = __esm({
|
|
5360
6254
|
"dist/maps/air-ocean-mesh.js"() {
|
|
5361
|
-
|
|
6255
|
+
import_matrix = require("@math.gl/core/matrix");
|
|
5362
6256
|
init_math();
|
|
5363
6257
|
subtract = (a, b) => add(a, scale(b, -1));
|
|
5364
6258
|
center = (points) => scale(points.reduce(add, [0, 0, 0]), 1 / points.length);
|
|
@@ -6593,12 +7487,12 @@ function createRegionalMap(options) {
|
|
|
6593
7487
|
if (!Number.isFinite(radius2) || radius2 <= 0)
|
|
6594
7488
|
throw new Error("Expected positive finite radius");
|
|
6595
7489
|
if (projection === "hammer-retroazimuthal") {
|
|
6596
|
-
if (Object.keys(options).some((
|
|
7490
|
+
if (Object.keys(options).some((key3) => !["projection", "radius", "type", "parallel"].includes(key3)))
|
|
6597
7491
|
throw new Error("Unsupported Hammer retroazimuthal option");
|
|
6598
7492
|
return createHammerRetroazimuthalMap({ radius: radius2, parallel: options.parallel });
|
|
6599
7493
|
}
|
|
6600
7494
|
if (projection === "armadillo") {
|
|
6601
|
-
if (Object.keys(options).some((
|
|
7495
|
+
if (Object.keys(options).some((key3) => !["projection", "radius", "type", "parallel"].includes(key3)))
|
|
6602
7496
|
throw new Error("Unsupported Armadillo option");
|
|
6603
7497
|
const parallel = options.parallel ?? 20;
|
|
6604
7498
|
if (!Number.isFinite(parallel) || parallel <= 0 || parallel >= 90)
|
|
@@ -6627,13 +7521,13 @@ function createRegionalMap(options) {
|
|
|
6627
7521
|
"two-point-azimuthal": ["controlPoints"],
|
|
6628
7522
|
"two-point-equidistant": ["controlPoints"]
|
|
6629
7523
|
};
|
|
6630
|
-
for (const
|
|
6631
|
-
if (!["projection", "radius", "type"].includes(
|
|
6632
|
-
throw new Error(`Unsupported ${projection} option: ${
|
|
6633
|
-
const value2 = (
|
|
6634
|
-
const n = options[
|
|
7524
|
+
for (const key3 of Object.keys(options))
|
|
7525
|
+
if (!["projection", "radius", "type"].includes(key3) && !((_a3 = allowed[projection]) == null ? void 0 : _a3.includes(key3)))
|
|
7526
|
+
throw new Error(`Unsupported ${projection} option: ${key3}`);
|
|
7527
|
+
const value2 = (key3, fallback, low, high) => {
|
|
7528
|
+
const n = options[key3] ?? fallback;
|
|
6635
7529
|
if (!Number.isFinite(n) || n <= low || n >= high)
|
|
6636
|
-
throw new Error(`Invalid ${projection} ${
|
|
7530
|
+
throw new Error(`Invalid ${projection} ${key3}`);
|
|
6637
7531
|
return n;
|
|
6638
7532
|
};
|
|
6639
7533
|
let kernel2, clipAngle = 90, aspect = [0, 0], frame;
|
|
@@ -6657,7 +7551,7 @@ function createRegionalMap(options) {
|
|
|
6657
7551
|
kernel2 = satelliteRaw(distance3, tilt);
|
|
6658
7552
|
clipAngle = horizon / RAD - 1e-6;
|
|
6659
7553
|
} else if (projection.startsWith("modified-stereographic")) {
|
|
6660
|
-
const
|
|
7554
|
+
const key3 = projection.slice("modified-stereographic-".length);
|
|
6661
7555
|
const presets = {
|
|
6662
7556
|
alaska: { center: [-152, 64], clip: 30 },
|
|
6663
7557
|
gs48: { center: [-95, 38], clip: 55 },
|
|
@@ -6665,8 +7559,8 @@ function createRegionalMap(options) {
|
|
|
6665
7559
|
miller: { center: [20, 18], clip: 82 },
|
|
6666
7560
|
lee: { center: [-165, -10], clip: 130 }
|
|
6667
7561
|
};
|
|
6668
|
-
const preset2 = presets[
|
|
6669
|
-
const c = projection === "modified-stereographic" ? options.coefficients : coefficients[
|
|
7562
|
+
const preset2 = presets[key3];
|
|
7563
|
+
const c = projection === "modified-stereographic" ? options.coefficients : coefficients[key3];
|
|
6670
7564
|
if (!(c == null ? void 0 : c.length) || c.length > 32 || !c.every((p) => p.length === 2 && p.every(Number.isFinite)))
|
|
6671
7565
|
throw new Error("Expected finite complex coefficients");
|
|
6672
7566
|
if (preset2) {
|
|
@@ -7454,8 +8348,8 @@ function createAlbersUsaMap(options = {}) {
|
|
|
7454
8348
|
const radius2 = options.radius ?? 1;
|
|
7455
8349
|
if (!Number.isFinite(radius2) || radius2 <= 0)
|
|
7456
8350
|
throw new Error("Radius must be finite and positive");
|
|
7457
|
-
const region = (id,
|
|
7458
|
-
const [west, south, east, north] =
|
|
8351
|
+
const region = (id, bounds2, center3, parallels, size, offset, insetBounds) => {
|
|
8352
|
+
const [west, south, east, north] = bounds2;
|
|
7459
8353
|
const n = (Math.sin(parallels[0] * RAD) + Math.sin(parallels[1] * RAD)) / 2;
|
|
7460
8354
|
const c = Math.cos(parallels[0] * RAD) ** 2 + 2 * n * Math.sin(parallels[0] * RAD);
|
|
7461
8355
|
const rho = (latitude) => Math.sqrt(c - 2 * n * Math.sin(latitude)) / n;
|
|
@@ -7526,8 +8420,8 @@ function createAlbersUsaMap(options = {}) {
|
|
|
7526
8420
|
region("hawaii", [-179, 17, -153, 30], [-157, 21], [8, 18], 1, [-0.15, -0.2], [-0.215, -0.245, -0.1, -0.155])
|
|
7527
8421
|
];
|
|
7528
8422
|
if (options.includeTerritories) {
|
|
7529
|
-
const territory = (id,
|
|
7530
|
-
const result = region(id,
|
|
8423
|
+
const territory = (id, bounds2, center3, parallels, scale3, frame) => {
|
|
8424
|
+
const result = region(id, bounds2, center3, parallels, scale3, [
|
|
7531
8425
|
(frame[0] + frame[2]) / 2,
|
|
7532
8426
|
(frame[1] + frame[3]) / 2
|
|
7533
8427
|
]);
|
|
@@ -7642,10 +8536,10 @@ function createSolid(solid, subdivisions = 0) {
|
|
|
7642
8536
|
for (let level = 0; level < subdivisions; level++) {
|
|
7643
8537
|
const midpoints = /* @__PURE__ */ new Map();
|
|
7644
8538
|
const midpoint = (a, b) => {
|
|
7645
|
-
const
|
|
7646
|
-
if (!midpoints.has(
|
|
7647
|
-
midpoints.set(
|
|
7648
|
-
return midpoints.get(
|
|
8539
|
+
const key3 = edgeKey(a, b);
|
|
8540
|
+
if (!midpoints.has(key3))
|
|
8541
|
+
midpoints.set(key3, vertices2.push(normalize(center2([vertices2[a], vertices2[b]]))) - 1);
|
|
8542
|
+
return midpoints.get(key3);
|
|
7649
8543
|
};
|
|
7650
8544
|
faces = faces.flatMap(([a, b, c]) => {
|
|
7651
8545
|
const ab = midpoint(a, b), bc = midpoint(b, c), ca = midpoint(c, a);
|
|
@@ -7682,8 +8576,8 @@ function convexFaces(vertices2) {
|
|
|
7682
8576
|
distances = distances.map((x2) => -x2);
|
|
7683
8577
|
}
|
|
7684
8578
|
const ids = distances.flatMap((d, i) => Math.abs(d) < 1e-8 ? [i] : []);
|
|
7685
|
-
const
|
|
7686
|
-
if (found.has(
|
|
8579
|
+
const key3 = ids.join(":");
|
|
8580
|
+
if (found.has(key3))
|
|
7687
8581
|
continue;
|
|
7688
8582
|
const origin = center2(ids.map((i) => vertices2[i]));
|
|
7689
8583
|
const x = normalize(subtract3(vertices2[ids[0]], origin)), y = cross3(n, x);
|
|
@@ -7691,7 +8585,7 @@ function convexFaces(vertices2) {
|
|
|
7691
8585
|
const p = subtract3(vertices2[i], origin), q = subtract3(vertices2[j], origin);
|
|
7692
8586
|
return Math.atan2(dot2(p, y), dot2(p, x)) - Math.atan2(dot2(q, y), dot2(q, x));
|
|
7693
8587
|
});
|
|
7694
|
-
found.set(
|
|
8588
|
+
found.set(key3, ids);
|
|
7695
8589
|
}
|
|
7696
8590
|
return [...found.values()];
|
|
7697
8591
|
}
|
|
@@ -7750,10 +8644,10 @@ function createLayout(mesh, seed = 1, options = {}) {
|
|
|
7750
8644
|
const normals = mesh.faces.map((f) => faceNormal(mesh, f));
|
|
7751
8645
|
const map = /* @__PURE__ */ new Map();
|
|
7752
8646
|
mesh.faces.forEach((face, i) => face.forEach((a, j) => {
|
|
7753
|
-
const b = face[(j + 1) % face.length],
|
|
7754
|
-
if (!map.has(
|
|
7755
|
-
map.set(
|
|
7756
|
-
map.get(
|
|
8647
|
+
const b = face[(j + 1) % face.length], key3 = edgeKey(a, b);
|
|
8648
|
+
if (!map.has(key3))
|
|
8649
|
+
map.set(key3, { a: Math.min(a, b), b: Math.max(a, b), faces: [], weight: 0, hinge: false });
|
|
8650
|
+
map.get(key3).faces.push(i);
|
|
7757
8651
|
}));
|
|
7758
8652
|
const edges = [...map.values()];
|
|
7759
8653
|
for (const edge2 of edges) {
|
|
@@ -7798,7 +8692,7 @@ function createLayout(mesh, seed = 1, options = {}) {
|
|
|
7798
8692
|
const origin = center2(mesh.faces[0].map((i) => mesh.vertices[i]));
|
|
7799
8693
|
const x = normalize(subtract3(mesh.vertices[mesh.faces[0][1]], mesh.vertices[mesh.faces[0][0]]));
|
|
7800
8694
|
const z = normals[0], y = cross3(z, x);
|
|
7801
|
-
const rootTransform = new
|
|
8695
|
+
const rootTransform = new import_matrix2.Matrix4([
|
|
7802
8696
|
x[0],
|
|
7803
8697
|
y[0],
|
|
7804
8698
|
z[0],
|
|
@@ -7832,7 +8726,7 @@ function restoreLayout(data) {
|
|
|
7832
8726
|
if (panels.length !== mesh.faces.length || targetAngles.length !== panels.length || !targetAngles.every(Number.isFinite) || data.rootTransform.length !== 16 || !data.rootTransform.every(Number.isFinite))
|
|
7833
8727
|
throw new Error("Invalid prepared hinge layout");
|
|
7834
8728
|
const tree = new import_geometry3.HingeTree(panels);
|
|
7835
|
-
const rootTransform = new
|
|
8729
|
+
const rootTransform = new import_matrix2.Matrix4(data.rootTransform);
|
|
7836
8730
|
const poses = new Float64Array(panels.length * 16), angles = new Float64Array(panels.length);
|
|
7837
8731
|
const evaluate2 = (amount) => {
|
|
7838
8732
|
if (!Number.isFinite(amount) || amount < 0 || amount > 1)
|
|
@@ -7840,7 +8734,7 @@ function restoreLayout(data) {
|
|
|
7840
8734
|
for (let i = 0; i < angles.length; i++)
|
|
7841
8735
|
angles[i] = targetAngles[i] * amount;
|
|
7842
8736
|
tree.evaluate(angles, poses, rootTransform);
|
|
7843
|
-
const matrix = new
|
|
8737
|
+
const matrix = new import_matrix2.Matrix4();
|
|
7844
8738
|
return mesh.faces.map((face, i) => {
|
|
7845
8739
|
matrix.copy(poses.subarray(i * 16, i * 16 + 16));
|
|
7846
8740
|
return face.map((v) => Array.from(matrix.transformAsPoint(mesh.vertices[v])));
|
|
@@ -7849,7 +8743,7 @@ function restoreLayout(data) {
|
|
|
7849
8743
|
return { ...data, tree, rootTransform, evaluate: evaluate2 };
|
|
7850
8744
|
}
|
|
7851
8745
|
function countOverlaps(faces) {
|
|
7852
|
-
const
|
|
8746
|
+
const bounds2 = faces.map((points, i) => ({
|
|
7853
8747
|
i,
|
|
7854
8748
|
minX: Math.min(...points.map((p) => p[0])),
|
|
7855
8749
|
maxX: Math.max(...points.map((p) => p[0])),
|
|
@@ -7857,9 +8751,9 @@ function countOverlaps(faces) {
|
|
|
7857
8751
|
maxY: Math.max(...points.map((p) => p[1]))
|
|
7858
8752
|
})).sort((a, b) => a.minX - b.minX);
|
|
7859
8753
|
let count = 0;
|
|
7860
|
-
for (let i = 0; i <
|
|
7861
|
-
for (let j = i + 1; j <
|
|
7862
|
-
const a =
|
|
8754
|
+
for (let i = 0; i < bounds2.length; i++)
|
|
8755
|
+
for (let j = i + 1; j < bounds2.length && bounds2[j].minX < bounds2[i].maxX - 1e-8; j++) {
|
|
8756
|
+
const a = bounds2[i], b = bounds2[j];
|
|
7863
8757
|
if (b.minY >= a.maxY - 1e-8 || a.minY >= b.maxY - 1e-8)
|
|
7864
8758
|
continue;
|
|
7865
8759
|
const p = faces[a.i], q = faces[b.i];
|
|
@@ -7874,10 +8768,10 @@ function countOverlaps(faces) {
|
|
|
7874
8768
|
}
|
|
7875
8769
|
return count;
|
|
7876
8770
|
}
|
|
7877
|
-
var
|
|
8771
|
+
var import_matrix2, import_geometry3;
|
|
7878
8772
|
var init_unfold = __esm({
|
|
7879
8773
|
"dist/maps/myriahedral/unfold.js"() {
|
|
7880
|
-
|
|
8774
|
+
import_matrix2 = require("@math.gl/core/matrix");
|
|
7881
8775
|
import_geometry3 = require("@math.gl/geometry");
|
|
7882
8776
|
init_mesh();
|
|
7883
8777
|
}
|
|
@@ -7912,8 +8806,8 @@ function createMyriahedralLayout(options = {}) {
|
|
|
7912
8806
|
[mesh.faces[0], mesh.faces[root]] = [mesh.faces[root], mesh.faces[0]];
|
|
7913
8807
|
const samples = /* @__PURE__ */ new Map();
|
|
7914
8808
|
const data = (edge2) => {
|
|
7915
|
-
const
|
|
7916
|
-
let value2 = samples.get(
|
|
8809
|
+
const key3 = `${edge2.a}:${edge2.b}`;
|
|
8810
|
+
let value2 = samples.get(key3);
|
|
7917
8811
|
if (value2)
|
|
7918
8812
|
return value2;
|
|
7919
8813
|
const a = mesh.vertices[edge2.a], b = mesh.vertices[edge2.b];
|
|
@@ -7937,7 +8831,7 @@ function createMyriahedralLayout(options = {}) {
|
|
|
7937
8831
|
arcLength,
|
|
7938
8832
|
landFraction
|
|
7939
8833
|
});
|
|
7940
|
-
samples.set(
|
|
8834
|
+
samples.set(key3, value2);
|
|
7941
8835
|
return value2;
|
|
7942
8836
|
};
|
|
7943
8837
|
const weight = (edge2) => {
|
|
@@ -9117,8 +10011,8 @@ function fullCoverage(map) {
|
|
|
9117
10011
|
completeSections = false;
|
|
9118
10012
|
return valid.length ? import_polygon_clipping4.default.intersection(domain, valid) : [];
|
|
9119
10013
|
});
|
|
9120
|
-
const
|
|
9121
|
-
covered = completeSections && !
|
|
10014
|
+
const overlaps2 = domains.some((domain, i) => domains.slice(i + 1).some((other) => import_polygon_clipping4.default.intersection(domain, other).length > 0));
|
|
10015
|
+
covered = completeSections && !overlaps2 && import_polygon_clipping4.default.difference(world, ...domains).length === 0;
|
|
9122
10016
|
} else if (d.type === "world") {
|
|
9123
10017
|
covered = directWorldProjections.has(d.projection) && Object.keys(d.parameters ?? {}).length === 0;
|
|
9124
10018
|
}
|
|
@@ -9550,7 +10444,7 @@ function unsupportedStage(message) {
|
|
|
9550
10444
|
throw new TypeScriptCRSError("missing-transform-stage", message);
|
|
9551
10445
|
}
|
|
9552
10446
|
var _a, CRS_ERROR, TypeScriptCRSError;
|
|
9553
|
-
var
|
|
10447
|
+
var init_types2 = __esm({
|
|
9554
10448
|
"dist/projection/experimental/crs/types.js"() {
|
|
9555
10449
|
CRS_ERROR = /* @__PURE__ */ Symbol.for("@math.gl/projection/TypeScriptCRSError");
|
|
9556
10450
|
TypeScriptCRSError = class _TypeScriptCRSError extends Error {
|
|
@@ -9645,7 +10539,7 @@ function applySpatialReference(crs, reference) {
|
|
|
9645
10539
|
}
|
|
9646
10540
|
var init_spatial_reference2 = __esm({
|
|
9647
10541
|
"dist/projection/experimental/crs/spatial-reference.js"() {
|
|
9648
|
-
|
|
10542
|
+
init_types2();
|
|
9649
10543
|
}
|
|
9650
10544
|
});
|
|
9651
10545
|
|
|
@@ -9698,13 +10592,13 @@ function getDatumDefinitions(options) {
|
|
|
9698
10592
|
if (!catalog.name || !catalog.datums)
|
|
9699
10593
|
throw new Error("Invalid datum catalogue plugin");
|
|
9700
10594
|
for (const [name, definition] of Object.entries(catalog.datums)) {
|
|
9701
|
-
const
|
|
9702
|
-
if (!
|
|
10595
|
+
const key3 = datumNameKey(name);
|
|
10596
|
+
if (!key3 || key3 === "none" || !definition || ["ellipse", "towgs84", "nadgrids"].some((field) => definition[field] !== void 0 && typeof definition[field] !== "string"))
|
|
9703
10597
|
throw new Error("Invalid datum definition: " + name);
|
|
9704
|
-
const previous = names.get(
|
|
10598
|
+
const previous = names.get(key3);
|
|
9705
10599
|
if (previous && (previous.owner !== owner || previous.definition.ellipse !== definition.ellipse || previous.definition.towgs84 !== definition.towgs84 || previous.definition.nadgrids !== definition.nadgrids))
|
|
9706
10600
|
throw new Error("Conflicting datum registration: " + name);
|
|
9707
|
-
names.set(
|
|
10601
|
+
names.set(key3, { definition, owner });
|
|
9708
10602
|
definitions[name] = definition;
|
|
9709
10603
|
}
|
|
9710
10604
|
});
|
|
@@ -10015,7 +10909,7 @@ function getCRSSignature(crs) {
|
|
|
10015
10909
|
return JSON.stringify([
|
|
10016
10910
|
crs.coordinateFrame,
|
|
10017
10911
|
crs.projection,
|
|
10018
|
-
Object.keys(crs.parameters).sort().map((
|
|
10912
|
+
Object.keys(crs.parameters).sort().map((key3) => [key3, crs.parameters[key3]]),
|
|
10019
10913
|
[crs.ellipsoid.semiMajorAxis, crs.ellipsoid.semiMinorAxis],
|
|
10020
10914
|
crs.axis,
|
|
10021
10915
|
[crs.xUnit.name, crs.xUnit.metersPerUnit, crs.xUnit.degreesPerUnit],
|
|
@@ -10033,8 +10927,8 @@ var init_crs_metadata = __esm({
|
|
|
10033
10927
|
|
|
10034
10928
|
// dist/projection/experimental/crs/normalize.js
|
|
10035
10929
|
function lookup(table, name) {
|
|
10036
|
-
const
|
|
10037
|
-
return
|
|
10930
|
+
const key3 = Object.keys(table).find((key4) => keyOf(key4) === keyOf(name));
|
|
10931
|
+
return key3 === void 0 ? void 0 : table[key3];
|
|
10038
10932
|
}
|
|
10039
10933
|
function parseAngle(text) {
|
|
10040
10934
|
if (/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(text)) {
|
|
@@ -10240,7 +11134,7 @@ var init_normalize = __esm({
|
|
|
10240
11134
|
init_ellipsoid_table();
|
|
10241
11135
|
init_primemeridian_table();
|
|
10242
11136
|
init_crs_metadata();
|
|
10243
|
-
|
|
11137
|
+
init_types2();
|
|
10244
11138
|
ALIASES = {
|
|
10245
11139
|
WGS84: "+proj=longlat +datum=WGS84",
|
|
10246
11140
|
"EPSG:4326": "+proj=longlat +datum=WGS84",
|
|
@@ -10278,7 +11172,7 @@ var init_normalize = __esm({
|
|
|
10278
11172
|
"lon_wrap"
|
|
10279
11173
|
];
|
|
10280
11174
|
CORE_FLAGS = ["no_defs", "over"];
|
|
10281
|
-
own = (object2,
|
|
11175
|
+
own = (object2, key3) => Object.prototype.hasOwnProperty.call(object2, key3);
|
|
10282
11176
|
keyOf = (value2) => value2.toLowerCase().replace(/[\s_-]/g, "");
|
|
10283
11177
|
}
|
|
10284
11178
|
});
|
|
@@ -10326,6 +11220,9 @@ var init_numerical_derivative = __esm({
|
|
|
10326
11220
|
});
|
|
10327
11221
|
|
|
10328
11222
|
// dist/projection/experimental/crs-rendering-scale.js
|
|
11223
|
+
function isEarth(ellipsoid) {
|
|
11224
|
+
return Math.abs(ellipsoid.semiMajorAxis - 6375e3) < 7e-3 * 6375e3;
|
|
11225
|
+
}
|
|
10329
11226
|
function validateScale(scale3) {
|
|
10330
11227
|
if (scale3.length !== 3 || scale3.some((value2) => !Number.isFinite(value2) || value2 <= 0))
|
|
10331
11228
|
throw new Error("Invalid CRS rendering scale");
|
|
@@ -10339,6 +11236,7 @@ function createRenderingScale(crs, projection, axis, center3) {
|
|
|
10339
11236
|
}
|
|
10340
11237
|
const anchor = [0, 0, 0], input = [0, 0, 0], geographic2 = [0, 0, 0], sample2 = [0, 0, 0];
|
|
10341
11238
|
const derivatives = Array.from({ length: 3 }, () => [0, 0, 0]);
|
|
11239
|
+
const body = isEarth(crs.ellipsoid) ? WGS84 : crs.ellipsoid;
|
|
10342
11240
|
let component = 0, longitudeMeters = 0, latitudeMeters = 0, busy = false;
|
|
10343
11241
|
const numerical = new NumericalDerivative((offset, output) => {
|
|
10344
11242
|
for (let i = 0; i < 3; i++)
|
|
@@ -10367,7 +11265,7 @@ function createRenderingScale(crs, projection, axis, center3) {
|
|
|
10367
11265
|
return null;
|
|
10368
11266
|
projection.unprojectTo(anchor, geographic2);
|
|
10369
11267
|
const latitude = geographic2[1] * RADIANS;
|
|
10370
|
-
const a =
|
|
11268
|
+
const a = body.semiMajorAxis, es = body.eccentricitySquared;
|
|
10371
11269
|
const denominator = 1 - es * Math.sin(latitude) ** 2;
|
|
10372
11270
|
longitudeMeters = a * Math.cos(latitude) / Math.sqrt(denominator) * RADIANS;
|
|
10373
11271
|
latitudeMeters = a * (1 - es) / denominator ** 1.5 * RADIANS;
|
|
@@ -10473,7 +11371,7 @@ async function resolveCRSDescriptor(engine, definition, normalization, options =
|
|
|
10473
11371
|
if (!profile)
|
|
10474
11372
|
throw new Error("Projection must define a rendering profile for CRS retrieval");
|
|
10475
11373
|
const center3 = (projection.targetLongitudeOrigin + crs.primeMeridian) * 180 / Math.PI;
|
|
10476
|
-
const
|
|
11374
|
+
const bounds2 = adaptBounds(profile, crs, axis);
|
|
10477
11375
|
const normalizeWGS84 = createNormalization(profile.normalize);
|
|
10478
11376
|
const renderingScale = createRenderingScale(crs, projection, axis, center3);
|
|
10479
11377
|
const sources = [.../* @__PURE__ */ new Set(["WGS84", ...conventions.converters || []])];
|
|
@@ -10512,7 +11410,7 @@ async function resolveCRSDescriptor(engine, definition, normalization, options =
|
|
|
10512
11410
|
// Exact caller identity is sufficient under default execution conventions.
|
|
10513
11411
|
// Additional source converters do not change the target CRS.
|
|
10514
11412
|
signature: useDefinitionSignature && typeof input === "string" && !conventions.enforceAxis && !crs.lossy ? input : getCRSSignature(metadata),
|
|
10515
|
-
renderingBounds:
|
|
11413
|
+
renderingBounds: bounds2,
|
|
10516
11414
|
renderingScale,
|
|
10517
11415
|
getRenderingScale: (coordinate) => typeof renderingScale === "function" ? renderingScale(coordinate) : renderingScale,
|
|
10518
11416
|
converter
|
|
@@ -10565,11 +11463,11 @@ function adaptBounds(profile, crs, axis) {
|
|
|
10565
11463
|
horizontalUnit,
|
|
10566
11464
|
crs.kind === "geocentric" ? crs.toMeter : crs.verticalUnit
|
|
10567
11465
|
];
|
|
10568
|
-
const
|
|
11466
|
+
const bounds2 = profile.bounds;
|
|
10569
11467
|
const limits = [...axis].map((direction) => {
|
|
10570
11468
|
const index = /[ew]/.test(direction) ? 0 : /[ns]/.test(direction) ? 1 : 2;
|
|
10571
|
-
const minimum =
|
|
10572
|
-
const maximum =
|
|
11469
|
+
const minimum = bounds2[0][index] / units2[index];
|
|
11470
|
+
const maximum = bounds2[1][index] / units2[index];
|
|
10573
11471
|
return /[wsd]/.test(direction) ? [-maximum, -minimum] : [minimum, maximum];
|
|
10574
11472
|
});
|
|
10575
11473
|
return [
|
|
@@ -10697,19 +11595,19 @@ function createGeographicBounds(west, south, east, north) {
|
|
|
10697
11595
|
north
|
|
10698
11596
|
];
|
|
10699
11597
|
}
|
|
10700
|
-
function getLongitudeSpan(
|
|
10701
|
-
const span =
|
|
11598
|
+
function getLongitudeSpan(bounds2) {
|
|
11599
|
+
const span = bounds2[2] - bounds2[0];
|
|
10702
11600
|
return span < 0 ? span + 360 : span;
|
|
10703
11601
|
}
|
|
10704
|
-
function splitGeographicBounds(
|
|
10705
|
-
const [west, south, east, north] =
|
|
10706
|
-
return west <= east ? [
|
|
11602
|
+
function splitGeographicBounds(bounds2) {
|
|
11603
|
+
const [west, south, east, north] = bounds2;
|
|
11604
|
+
return west <= east ? [bounds2] : [
|
|
10707
11605
|
[west, south, 180, north],
|
|
10708
11606
|
[-180, south, east, north]
|
|
10709
11607
|
];
|
|
10710
11608
|
}
|
|
10711
|
-
function containsGeographicPoint(
|
|
10712
|
-
const [west, south, east, north] =
|
|
11609
|
+
function containsGeographicPoint(bounds2, point) {
|
|
11610
|
+
const [west, south, east, north] = bounds2;
|
|
10713
11611
|
const longitude3 = normalizeLongitude(point[0]);
|
|
10714
11612
|
return point[1] >= south && point[1] <= north && (west <= east ? longitude3 >= west && longitude3 <= east || longitude3 === -180 && east === 180 : longitude3 >= west || longitude3 <= east);
|
|
10715
11613
|
}
|
|
@@ -10744,32 +11642,32 @@ function intersectGeographicBounds(a, b) {
|
|
|
10744
11642
|
}
|
|
10745
11643
|
return merged.map(([west, east]) => [west, south, east, north]);
|
|
10746
11644
|
}
|
|
10747
|
-
function clampGeographicPoint(
|
|
11645
|
+
function clampGeographicPoint(bounds2, point) {
|
|
10748
11646
|
let longitude3 = normalizeLongitude(point[0]);
|
|
10749
|
-
const latitude = Math.max(
|
|
10750
|
-
if (!containsGeographicPoint(
|
|
10751
|
-
const westDistance = Math.abs(normalizeLongitude(longitude3 -
|
|
10752
|
-
const eastDistance = Math.abs(normalizeLongitude(longitude3 -
|
|
10753
|
-
longitude3 = westDistance <= eastDistance ?
|
|
11647
|
+
const latitude = Math.max(bounds2[1], Math.min(bounds2[3], point[1]));
|
|
11648
|
+
if (!containsGeographicPoint(bounds2, [longitude3, latitude])) {
|
|
11649
|
+
const westDistance = Math.abs(normalizeLongitude(longitude3 - bounds2[0]));
|
|
11650
|
+
const eastDistance = Math.abs(normalizeLongitude(longitude3 - bounds2[2]));
|
|
11651
|
+
longitude3 = westDistance <= eastDistance ? bounds2[0] : bounds2[2];
|
|
10754
11652
|
}
|
|
10755
11653
|
return [longitude3, latitude];
|
|
10756
11654
|
}
|
|
10757
|
-
function getAngularRanges(
|
|
10758
|
-
const width = getLongitudeSpan(
|
|
10759
|
-
const west =
|
|
11655
|
+
function getAngularRanges(bounds2, primeMeridian2 = 0, origin = 0) {
|
|
11656
|
+
const width = getLongitudeSpan(bounds2);
|
|
11657
|
+
const west = bounds2[0] * RADIANS2 - primeMeridian2;
|
|
10760
11658
|
const middle = west + width * RADIANS2 / 2;
|
|
10761
11659
|
const shift = Math.round((origin - middle) / (2 * Math.PI)) * 2 * Math.PI;
|
|
10762
|
-
return createAngularRanges(width === 360 ? origin - Math.PI : west + shift,
|
|
11660
|
+
return createAngularRanges(width === 360 ? origin - Math.PI : west + shift, bounds2[1] * RADIANS2, width === 360 ? origin + Math.PI : west + shift + width * RADIANS2, bounds2[3] * RADIANS2);
|
|
10763
11661
|
}
|
|
10764
11662
|
function getGeographicBounds(ranges, primeMeridian2 = 0) {
|
|
10765
11663
|
return createGeographicBounds((ranges[0][0] + primeMeridian2) / RADIANS2, ranges[0][1] / RADIANS2, (ranges[1][0] + primeMeridian2) / RADIANS2, ranges[1][1] / RADIANS2);
|
|
10766
11664
|
}
|
|
10767
|
-
function unionRenderingBounds(
|
|
10768
|
-
if (!
|
|
11665
|
+
function unionRenderingBounds(bounds2) {
|
|
11666
|
+
if (!bounds2.length)
|
|
10769
11667
|
throw new Error("CRS coverage does not intersect the rendering target");
|
|
10770
11668
|
return [
|
|
10771
|
-
[0, 1, 2].map((axis) => Math.min(...
|
|
10772
|
-
[0, 1, 2].map((axis) => Math.max(...
|
|
11669
|
+
[0, 1, 2].map((axis) => Math.min(...bounds2.map((pair2) => pair2[0][axis]))),
|
|
11670
|
+
[0, 1, 2].map((axis) => Math.max(...bounds2.map((pair2) => pair2[1][axis])))
|
|
10773
11671
|
];
|
|
10774
11672
|
}
|
|
10775
11673
|
var RADIANS2;
|
|
@@ -10793,10 +11691,10 @@ function resolveRenderingProfile(getRenderingProfile, coverage) {
|
|
|
10793
11691
|
}
|
|
10794
11692
|
function resolveBounds(profile) {
|
|
10795
11693
|
var _a3;
|
|
10796
|
-
const
|
|
10797
|
-
if (
|
|
11694
|
+
const bounds2 = profile.bounds;
|
|
11695
|
+
if (bounds2.some((corner) => corner.some((value2) => !Number.isFinite(value2))))
|
|
10798
11696
|
throw new Error("Projection rendering bounds must be finite");
|
|
10799
|
-
return { bounds, normalize: (_a3 = profile.normalize) == null ? void 0 : _a3.bind(profile) };
|
|
11697
|
+
return { bounds: bounds2, normalize: (_a3 = profile.normalize) == null ? void 0 : _a3.bind(profile) };
|
|
10800
11698
|
}
|
|
10801
11699
|
function createAngularNormalization(normalize2, primeMeridian2 = 0) {
|
|
10802
11700
|
return (point) => {
|
|
@@ -10883,9 +11781,9 @@ function preloadProjection(projection) {
|
|
|
10883
11781
|
return Promise.resolve(state.implementation);
|
|
10884
11782
|
const entry = state;
|
|
10885
11783
|
entry.pending || (entry.pending = Promise.resolve().then(entry.load).then((plugin) => {
|
|
10886
|
-
const
|
|
10887
|
-
const supported = new Set([plugin.name, ...plugin.aliases || []].map(
|
|
10888
|
-
if (typeof plugin.create !== "function" || ![projection.name, ...projection.aliases || []].every((name) => supported.has(
|
|
11784
|
+
const key3 = (value2) => value2.toLowerCase().replace(/[\s_-]/g, "");
|
|
11785
|
+
const supported = new Set([plugin.name, ...plugin.aliases || []].map(key3));
|
|
11786
|
+
if (typeof plugin.create !== "function" || ![projection.name, ...projection.aliases || []].every((name) => supported.has(key3(name))))
|
|
10889
11787
|
throw new Error("Loaded projection does not match descriptor: " + projection.name);
|
|
10890
11788
|
entry.implementation = plugin;
|
|
10891
11789
|
return plugin;
|
|
@@ -10988,7 +11886,7 @@ var init_mutable_projection = __esm({
|
|
|
10988
11886
|
function geodeticToGeocentricInPlace(point, ellipsoid) {
|
|
10989
11887
|
if (Math.abs(point.y) > Math.PI / 2)
|
|
10990
11888
|
throw new Error("Latitude outside geocentric domain");
|
|
10991
|
-
if (!(0,
|
|
11889
|
+
if (!(0, import_matrix3.spheroidToCartesian)(point, ellipsoid))
|
|
10992
11890
|
throw new Error("Geocentric coordinate must be finite");
|
|
10993
11891
|
}
|
|
10994
11892
|
function geocentricToGeodeticInPlace(point, ellipsoid) {
|
|
@@ -11004,7 +11902,7 @@ function geocentricToGeodeticInPlace(point, ellipsoid) {
|
|
|
11004
11902
|
point.z = Math.abs(z) - b;
|
|
11005
11903
|
return;
|
|
11006
11904
|
}
|
|
11007
|
-
if (!(0,
|
|
11905
|
+
if (!(0, import_matrix3.cartesianToSpheroid)(point, ellipsoid)) {
|
|
11008
11906
|
if (!Number.isFinite(Math.hypot(x, y, z)))
|
|
11009
11907
|
throw new Error("Geocentric radius must be finite");
|
|
11010
11908
|
throw new Error("Geocentric inverse did not converge");
|
|
@@ -11110,10 +12008,10 @@ function geocentricToGeodetic(coordinate, ellipsoid) {
|
|
|
11110
12008
|
geocentricToGeodeticInPlace(point, ellipsoid);
|
|
11111
12009
|
return [point.x, point.y, point.z];
|
|
11112
12010
|
}
|
|
11113
|
-
var
|
|
12011
|
+
var import_matrix3, ARC_SECOND, WGS842;
|
|
11114
12012
|
var init_datum = __esm({
|
|
11115
12013
|
"dist/projection/experimental/datum.js"() {
|
|
11116
|
-
|
|
12014
|
+
import_matrix3 = require("@math.gl/core/matrix");
|
|
11117
12015
|
ARC_SECOND = Math.PI / (180 * 3600);
|
|
11118
12016
|
WGS842 = {
|
|
11119
12017
|
ellipsoid: {
|
|
@@ -11180,8 +12078,8 @@ function withRectangleRenderingProfile(implementation, parameters, resolveBounds
|
|
|
11180
12078
|
};
|
|
11181
12079
|
try {
|
|
11182
12080
|
const profile = createRectangleRenderingProfile(resolveBounds2, coverage, origin, primeMeridian2, over);
|
|
11183
|
-
const
|
|
11184
|
-
return { bounds, normalize: profile.normalize };
|
|
12081
|
+
const bounds2 = profile.bounds;
|
|
12082
|
+
return { bounds: bounds2, normalize: profile.normalize };
|
|
11185
12083
|
} catch {
|
|
11186
12084
|
return createRegionsRenderingProfile(resolveBounds2, intersectGeographicBounds(coverage, defaults), origin, primeMeridian2, over);
|
|
11187
12085
|
}
|
|
@@ -11349,7 +12247,7 @@ function compileVerticalGrid(names, grids = {}) {
|
|
|
11349
12247
|
}
|
|
11350
12248
|
var init_vertical_datum = __esm({
|
|
11351
12249
|
"dist/projection/experimental/vertical-datum.js"() {
|
|
11352
|
-
|
|
12250
|
+
init_types2();
|
|
11353
12251
|
}
|
|
11354
12252
|
});
|
|
11355
12253
|
|
|
@@ -11439,14 +12337,14 @@ function compileCRS(definition, plugins, options) {
|
|
|
11439
12337
|
if (!["geographic", "identity"].includes(crs.kind) && !plugin)
|
|
11440
12338
|
throw new TypeScriptCRSError("missing-plugin", "Projection plugin is not registered: " + crs.projection);
|
|
11441
12339
|
const allowed = /* @__PURE__ */ new Set([...CORE_PARAMETERS, ...(plugin == null ? void 0 : plugin.parameters) || []]);
|
|
11442
|
-
for (const
|
|
11443
|
-
if (!allowed.has(
|
|
11444
|
-
throw new TypeScriptCRSError("missing-transform-stage", "Unsupported PROJ parameter: +" +
|
|
11445
|
-
const flag = CORE_FLAGS.includes(
|
|
11446
|
-
if (flag && crs.parameters[
|
|
11447
|
-
throw new Error("Expected a flag without a value: +" +
|
|
11448
|
-
if (!flag && !crs.parameters[
|
|
11449
|
-
throw new Error("PROJ parameter requires a value: +" +
|
|
12340
|
+
for (const key3 of Object.keys(crs.parameters)) {
|
|
12341
|
+
if (!allowed.has(key3))
|
|
12342
|
+
throw new TypeScriptCRSError("missing-transform-stage", "Unsupported PROJ parameter: +" + key3);
|
|
12343
|
+
const flag = CORE_FLAGS.includes(key3) || ((_a3 = plugin == null ? void 0 : plugin.flags) == null ? void 0 : _a3.includes(key3));
|
|
12344
|
+
if (flag && crs.parameters[key3] !== void 0)
|
|
12345
|
+
throw new Error("Expected a flag without a value: +" + key3);
|
|
12346
|
+
if (!flag && !crs.parameters[key3])
|
|
12347
|
+
throw new Error("PROJ parameter requires a value: +" + key3);
|
|
11450
12348
|
}
|
|
11451
12349
|
if (crs.parameters["type"] && crs.parameters["type"] !== "crs")
|
|
11452
12350
|
throw new Error("Only +type=crs is supported");
|
|
@@ -11674,7 +12572,7 @@ var init_typescript_projection = __esm({
|
|
|
11674
12572
|
init_projection_scratch();
|
|
11675
12573
|
init_scalar_output();
|
|
11676
12574
|
init_normalize();
|
|
11677
|
-
|
|
12575
|
+
init_types2();
|
|
11678
12576
|
init_datum();
|
|
11679
12577
|
init_parameters();
|
|
11680
12578
|
init_geographic_rendering_profile();
|
|
@@ -13214,8 +14112,8 @@ var init_datum_table = __esm({
|
|
|
13214
14112
|
towgs84: "0,0,0"
|
|
13215
14113
|
}
|
|
13216
14114
|
};
|
|
13217
|
-
for (const
|
|
13218
|
-
const datum = datums[
|
|
14115
|
+
for (const key3 in datums) {
|
|
14116
|
+
const datum = datums[key3];
|
|
13219
14117
|
if (!datum.datumName) {
|
|
13220
14118
|
continue;
|
|
13221
14119
|
}
|
|
@@ -13344,14 +14242,14 @@ var init_mercator = __esm({
|
|
|
13344
14242
|
getRenderingProfile(coverage) {
|
|
13345
14243
|
if (coverage) {
|
|
13346
14244
|
const clipped = coverage[1] <= -90 || coverage[3] >= 90;
|
|
13347
|
-
const
|
|
14245
|
+
const bounds2 = [
|
|
13348
14246
|
coverage[0],
|
|
13349
14247
|
clipped ? Math.max(-maxLatitude * 180 / Math.PI, Math.min(maxLatitude * 180 / Math.PI, coverage[1])) : coverage[1],
|
|
13350
14248
|
coverage[2],
|
|
13351
14249
|
clipped ? Math.max(-maxLatitude * 180 / Math.PI, Math.min(maxLatitude * 180 / Math.PI, coverage[3])) : coverage[3]
|
|
13352
14250
|
];
|
|
13353
14251
|
const northing = (latitude) => y0 + radius2 * (Math.asinh(Math.tan(latitude)) - e * Math.atanh(e * Math.sin(latitude)));
|
|
13354
|
-
return createRectangleRenderingProfile((region) => envelope(add2([x0, x0], scale2(longitudeRange(region, longitudeOrigin, over), radius2)), [northing(region[0][1]), northing(region[1][1])]),
|
|
14252
|
+
return createRectangleRenderingProfile((region) => envelope(add2([x0, x0], scale2(longitudeRange(region, longitudeOrigin, over), radius2)), [northing(region[0][1]), northing(region[1][1])]), bounds2, longitudeOrigin, primeMeridian2, over);
|
|
13355
14253
|
}
|
|
13356
14254
|
const defaultBounds = [
|
|
13357
14255
|
[x0 - width, y0 - height2, 0],
|
|
@@ -20900,13 +21798,13 @@ function obliqueTransformation(wrapped) {
|
|
|
20900
21798
|
}, context.primeMeridian ?? 0);
|
|
20901
21799
|
return {
|
|
20902
21800
|
get bounds() {
|
|
20903
|
-
const
|
|
21801
|
+
const bounds2 = child2.bounds;
|
|
20904
21802
|
const degrees4 = (corner) => [
|
|
20905
21803
|
corner[0] * 180 / Math.PI,
|
|
20906
21804
|
corner[1] * 180 / Math.PI,
|
|
20907
21805
|
corner[2]
|
|
20908
21806
|
];
|
|
20909
|
-
return geographic2 ? [degrees4(
|
|
21807
|
+
return geographic2 ? [degrees4(bounds2[0]), degrees4(bounds2[1])] : bounds2;
|
|
20910
21808
|
},
|
|
20911
21809
|
normalize(point) {
|
|
20912
21810
|
source == null ? void 0 : source.normalize(point);
|
|
@@ -20939,7 +21837,7 @@ var init_ob_tran = __esm({
|
|
|
20939
21837
|
init_geographic_rendering_profile();
|
|
20940
21838
|
init_parameters();
|
|
20941
21839
|
init_rendering_profile();
|
|
20942
|
-
|
|
21840
|
+
init_types2();
|
|
20943
21841
|
init_rectangular_rendering_profile();
|
|
20944
21842
|
init_geographic_bounds();
|
|
20945
21843
|
init_spherical_rendering_domain();
|
|
@@ -21477,7 +22375,7 @@ function object(value2) {
|
|
|
21477
22375
|
function array(value2) {
|
|
21478
22376
|
return Array.isArray(value2) ? value2 : [];
|
|
21479
22377
|
}
|
|
21480
|
-
function
|
|
22378
|
+
function key2(value2) {
|
|
21481
22379
|
return String(value2 || "").toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
21482
22380
|
}
|
|
21483
22381
|
function finite2(value2) {
|
|
@@ -21508,7 +22406,7 @@ function unit2(value2, fallback) {
|
|
|
21508
22406
|
partspermillion: 1e-6,
|
|
21509
22407
|
unity: 1
|
|
21510
22408
|
};
|
|
21511
|
-
const factor = factors2[
|
|
22409
|
+
const factor = factors2[key2(value2)];
|
|
21512
22410
|
if (!factor)
|
|
21513
22411
|
unsupportedStage("Unsupported CRS unit: " + String(value2));
|
|
21514
22412
|
return factor;
|
|
@@ -21532,7 +22430,7 @@ function readStructuredCRS(crs, options) {
|
|
|
21532
22430
|
if (target.parameters["datum"] !== "WGS84" || !["longlat", "geocent"].includes(target.parameters["proj"]) || Number(target.parameters["pm"] || 0) !== 0 || target.parameters["towgs84"] || Number(target.parameters["a"]) !== 6378137 || !(Math.abs(Number(target.parameters["rf"]) - 298.257223563) <= 1e-9 || Math.abs(Number(target.parameters["b"]) - 6356752314245179e-9) <= 1e-6))
|
|
21533
22431
|
unsupportedStage("BoundCRS requires a WGS84 target");
|
|
21534
22432
|
const operation2 = object(crs["transformation"]);
|
|
21535
|
-
const method =
|
|
22433
|
+
const method = key2(object(operation2["method"])["name"]);
|
|
21536
22434
|
const translation = method === "geocentrictranslations" || /^geocentrictranslationsgeog[23]ddomain$/.test(method);
|
|
21537
22435
|
const position2 = /^positionvector(?:transformation)?(?:geog[23]ddomain|geocentricdomain)?$/.test(method);
|
|
21538
22436
|
const frame = /^coordinateframe(?:rotation)?(?:geog[23]ddomain|geocentricdomain)?$/.test(method);
|
|
@@ -21549,7 +22447,7 @@ function readStructuredCRS(crs, options) {
|
|
|
21549
22447
|
];
|
|
21550
22448
|
const values = new Array(translation ? 3 : 7).fill(void 0);
|
|
21551
22449
|
for (const entry of array(operation2["parameters"])) {
|
|
21552
|
-
const parameter = object(entry), index = names2.indexOf(
|
|
22450
|
+
const parameter = object(entry), index = names2.indexOf(key2(parameter["name"]));
|
|
21553
22451
|
if (index < 0 || index >= values.length || values[index] !== void 0)
|
|
21554
22452
|
unsupportedStage("Unsupported or duplicate Helmert parameter: " + String(parameter["name"]));
|
|
21555
22453
|
const base2 = index < 3 ? 1 : index < 6 ? DEGREES_TO_RADIANS / 3600 : 1e-6;
|
|
@@ -21586,10 +22484,10 @@ function readStructuredCRS(crs, options) {
|
|
|
21586
22484
|
throw new Error("Ellipsoid requires inverse flattening or semi-minor axis");
|
|
21587
22485
|
const datums2 = getDatumDefinitions(options);
|
|
21588
22486
|
const rawDatumName = String(datum["name"] || "");
|
|
21589
|
-
const datumName =
|
|
22487
|
+
const datumName = key2(rawDatumName);
|
|
21590
22488
|
const names = Object.keys(datums2);
|
|
21591
22489
|
const exactDatum = names.find((name) => datumNameKey(name) === datumNameKey(rawDatumName));
|
|
21592
|
-
const matches = exactDatum ? [exactDatum] : names.filter((name) =>
|
|
22490
|
+
const matches = exactDatum ? [exactDatum] : names.filter((name) => key2(name) === datumName || key2(name) === datumName.replace(/^d/, ""));
|
|
21593
22491
|
const namedDatum = matches[0];
|
|
21594
22492
|
const first = datums2[namedDatum];
|
|
21595
22493
|
if (first && matches.some((name) => {
|
|
@@ -21636,8 +22534,8 @@ function readStructuredCRS(crs, options) {
|
|
|
21636
22534
|
}
|
|
21637
22535
|
const cs = crs["coordinate_system"] ? object(crs["coordinate_system"]) : {};
|
|
21638
22536
|
const axes = array(cs["axis"]).map(object);
|
|
21639
|
-
const geocentric2 =
|
|
21640
|
-
if (type !== "ProjectedCRS" && !geocentric2 && cs["subtype"] &&
|
|
22537
|
+
const geocentric2 = key2(cs["subtype"]) === "cartesian" && type === "GeodeticCRS";
|
|
22538
|
+
if (type !== "ProjectedCRS" && !geocentric2 && cs["subtype"] && key2(cs["subtype"]) !== "ellipsoidal")
|
|
21641
22539
|
unsupportedStage("Unsupported coordinate system subtype");
|
|
21642
22540
|
if (geocentric2)
|
|
21643
22541
|
parameters["proj"] = "geocent";
|
|
@@ -21653,19 +22551,19 @@ function readStructuredCRS(crs, options) {
|
|
|
21653
22551
|
parameters["pm"] = String(finite2(meridian["longitude"]) * unit2(meridian["unit"], angularUnit) / DEGREES_TO_RADIANS);
|
|
21654
22552
|
}
|
|
21655
22553
|
if (type === "ProjectedCRS") {
|
|
21656
|
-
const conversion = object(crs["conversion"]), method =
|
|
22554
|
+
const conversion = object(crs["conversion"]), method = key2(object(conversion["method"])["name"]);
|
|
21657
22555
|
const conversionParameters = array(conversion["parameters"]).map(object);
|
|
21658
|
-
const polarTrueScale = method === "stereographicnorthpole" && !conversionParameters.some((parameter) =>
|
|
22556
|
+
const polarTrueScale = method === "stereographicnorthpole" && !conversionParameters.some((parameter) => key2(parameter["name"]).startsWith("scalefactor"));
|
|
21659
22557
|
const projection = polarTrueScale ? "stere" : METHODS[method];
|
|
21660
|
-
const esriKrovak = conversionParameters.filter((parameter) => ["xscale", "yscale", "xyplanerotation"].includes(
|
|
22558
|
+
const esriKrovak = conversionParameters.filter((parameter) => ["xscale", "yscale", "xyplanerotation"].includes(key2(parameter["name"])));
|
|
21661
22559
|
if (esriKrovak.length) {
|
|
21662
22560
|
const expected = {
|
|
21663
22561
|
xscale: -1,
|
|
21664
22562
|
yscale: 1,
|
|
21665
22563
|
xyplanerotation: 90
|
|
21666
22564
|
};
|
|
21667
|
-
if (projection !== "krovak" || esriKrovak.length !== 3 || new Set(esriKrovak.map((parameter) =>
|
|
21668
|
-
const name =
|
|
22565
|
+
if (projection !== "krovak" || esriKrovak.length !== 3 || new Set(esriKrovak.map((parameter) => key2(parameter["name"]))).size !== 3 || esriKrovak.some((parameter) => {
|
|
22566
|
+
const name = key2(parameter["name"]);
|
|
21669
22567
|
const factor2 = name === "xyplanerotation" ? unit2(parameter["unit"], angularUnit) / DEGREES_TO_RADIANS : unit2(parameter["unit"], 1);
|
|
21670
22568
|
return Math.abs(finite2(parameter["value"]) * factor2 - expected[name]) > 1e-10;
|
|
21671
22569
|
}))
|
|
@@ -21676,7 +22574,7 @@ function readStructuredCRS(crs, options) {
|
|
|
21676
22574
|
parameters["proj"] = projection === "webmerc" ? "merc" : projection;
|
|
21677
22575
|
let hasSemiMinor = false;
|
|
21678
22576
|
for (const parameter of conversionParameters) {
|
|
21679
|
-
const parameterName =
|
|
22577
|
+
const parameterName = key2(parameter["name"]);
|
|
21680
22578
|
if (esriKrovak.includes(parameter))
|
|
21681
22579
|
continue;
|
|
21682
22580
|
if (parameterName === "auxiliaryspheretype" && projection === "webmerc" && parameter["value"] === 0)
|
|
@@ -21781,7 +22679,7 @@ function readAxisDirection(entry, parameters, projected) {
|
|
|
21781
22679
|
if (meridian !== void 0) {
|
|
21782
22680
|
const latitude = Number(parameters["lat_0"]);
|
|
21783
22681
|
const north = latitude === 90;
|
|
21784
|
-
if (!projected || parameters["proj"] !== "stere" || Math.abs(latitude) !== 90 ||
|
|
22682
|
+
if (!projected || parameters["proj"] !== "stere" || Math.abs(latitude) !== 90 || key2(direction) !== (north ? "south" : "north"))
|
|
21785
22683
|
unsupportedStage("Axis meridians require an outward-facing polar stereographic axis");
|
|
21786
22684
|
const longitude3 = object(meridian)["longitude"];
|
|
21787
22685
|
const degrees4 = typeof longitude3 === "number" ? finite2(longitude3) : finite2(object(longitude3)["value"]) * unit2(object(longitude3)["unit"], DEGREES_TO_RADIANS) / DEGREES_TO_RADIANS;
|
|
@@ -21791,7 +22689,7 @@ function readAxisDirection(entry, parameters, projected) {
|
|
|
21791
22689
|
const quadrant = (Math.round(quarterTurns) % 4 + 4) % 4;
|
|
21792
22690
|
return (north ? "senw" : "nesw")[quadrant];
|
|
21793
22691
|
}
|
|
21794
|
-
const result = DIRECTIONS[
|
|
22692
|
+
const result = DIRECTIONS[key2(direction)];
|
|
21795
22693
|
if (!result)
|
|
21796
22694
|
unsupportedStage("Unsupported axis direction: " + direction);
|
|
21797
22695
|
return result;
|
|
@@ -21801,7 +22699,7 @@ var init_structured = __esm({
|
|
|
21801
22699
|
"dist/projection/experimental/crs/structured.js"() {
|
|
21802
22700
|
init_datum_catalog();
|
|
21803
22701
|
init_parameters();
|
|
21804
|
-
|
|
22702
|
+
init_types2();
|
|
21805
22703
|
METHODS = {
|
|
21806
22704
|
hotineobliquemercator: "omerc",
|
|
21807
22705
|
hotineobliquemercatorvarianta: "omerc",
|
|
@@ -22091,7 +22989,7 @@ var init_wkt = __esm({
|
|
|
22091
22989
|
"dist/projection/experimental/crs/wkt.js"() {
|
|
22092
22990
|
init_spatial_reference();
|
|
22093
22991
|
init_wkt_crs();
|
|
22094
|
-
|
|
22992
|
+
init_types2();
|
|
22095
22993
|
init_structured();
|
|
22096
22994
|
wktCRSParser = {
|
|
22097
22995
|
name: "wkt",
|
|
@@ -22192,8 +23090,8 @@ function compatibilityParser(parser) {
|
|
|
22192
23090
|
parse(definition, options) {
|
|
22193
23091
|
const parsed = parser.parse(definition, options);
|
|
22194
23092
|
const datum = parsed.parameters["datum"];
|
|
22195
|
-
const
|
|
22196
|
-
if (datum && !Object.keys(getDatumDefinitions(options)).some((name) =>
|
|
23093
|
+
const key3 = (name) => name.toLowerCase().replace(/[\s_-]/g, "");
|
|
23094
|
+
if (datum && !Object.keys(getDatumDefinitions(options)).some((name) => key3(name) === key3(datum))) {
|
|
22197
23095
|
const parameters = { ...parsed.parameters };
|
|
22198
23096
|
delete parameters["datum"];
|
|
22199
23097
|
return { ...parsed, parameters };
|
|
@@ -22242,7 +23140,7 @@ function defaultProjections() {
|
|
|
22242
23140
|
tiltedPerspective,
|
|
22243
23141
|
vanDerGrinten
|
|
22244
23142
|
];
|
|
22245
|
-
const
|
|
23143
|
+
const key3 = (name) => name.toLowerCase().replace(/[\s_-]/g, "");
|
|
22246
23144
|
const geographic2 = obliqueTransformation("longlat");
|
|
22247
23145
|
const oblique = {
|
|
22248
23146
|
name: geographic2.name,
|
|
@@ -22253,7 +23151,7 @@ function defaultProjections() {
|
|
|
22253
23151
|
const requested = context.parameters["o_proj"];
|
|
22254
23152
|
if (!requested)
|
|
22255
23153
|
throw new Error("Oblique transformation requires +o_proj");
|
|
22256
|
-
const child2 = ["longlat", "latlong", "latlon", "lonlat", "identity"].includes(
|
|
23154
|
+
const child2 = ["longlat", "latlong", "latlon", "lonlat", "identity"].includes(key3(requested)) ? "longlat" : projections.find((p) => [p.name, ...p.aliases || []].some((name) => key3(name) === key3(requested)));
|
|
22257
23155
|
if (!child2)
|
|
22258
23156
|
throw new Error("Unknown oblique transformation projection: " + requested);
|
|
22259
23157
|
const plugin = obliqueTransformation(child2);
|
|
@@ -22346,11 +23244,206 @@ var init_operations = __esm({
|
|
|
22346
23244
|
// dist/tasks/index.js
|
|
22347
23245
|
var index_exports = {};
|
|
22348
23246
|
__export(index_exports, {
|
|
23247
|
+
CertifyTerrainCoverageTask: () => CertifyTerrainCoverageTask2,
|
|
22349
23248
|
PrepareMapTask: () => PrepareMapTask2,
|
|
22350
|
-
ProjectCoordinatesTask: () => ProjectCoordinatesTask2
|
|
23249
|
+
ProjectCoordinatesTask: () => ProjectCoordinatesTask2,
|
|
23250
|
+
TerrainResidencyTask: () => TerrainResidencyTask2
|
|
22351
23251
|
});
|
|
22352
23252
|
module.exports = __toCommonJS(index_exports);
|
|
22353
23253
|
|
|
23254
|
+
// dist/tasks/terrain-residency.js
|
|
23255
|
+
var sourceIndexes = /* @__PURE__ */ new WeakMap();
|
|
23256
|
+
var addressKey = ({ spacing, column, row }) => `${spacing}/${column}/${row}`;
|
|
23257
|
+
function sameArray(a, b) {
|
|
23258
|
+
if (a.length !== b.length)
|
|
23259
|
+
return false;
|
|
23260
|
+
for (let i = 0; i < a.length; i++)
|
|
23261
|
+
if (!Object.is(a[i], b[i]))
|
|
23262
|
+
return false;
|
|
23263
|
+
return true;
|
|
23264
|
+
}
|
|
23265
|
+
function sameHalo(a, b) {
|
|
23266
|
+
if (a === b)
|
|
23267
|
+
return true;
|
|
23268
|
+
const af = a.field;
|
|
23269
|
+
const bf = b.field;
|
|
23270
|
+
const keys = Object.keys(af);
|
|
23271
|
+
return keys.length === Object.keys(bf).length && keys.every((key3) => {
|
|
23272
|
+
const left = af[key3];
|
|
23273
|
+
const right = bf[key3];
|
|
23274
|
+
if (typeof left === "object" && typeof right === "object")
|
|
23275
|
+
return sameArray(left, right);
|
|
23276
|
+
return Object.prototype.hasOwnProperty.call(bf, key3) && Object.is(left, right);
|
|
23277
|
+
}) && sameArray(a.statuses, b.statuses);
|
|
23278
|
+
}
|
|
23279
|
+
function copyResidentSamples(field) {
|
|
23280
|
+
const { width, height: height2, offset = 0, stride = width } = field;
|
|
23281
|
+
const heights = field.heights instanceof Float64Array ? new Float64Array(width * height2) : new Float32Array(width * height2);
|
|
23282
|
+
const validity = new Uint8Array(heights.length);
|
|
23283
|
+
for (let y = 0; y < height2; y++) {
|
|
23284
|
+
for (let x = 0; x < width; x++) {
|
|
23285
|
+
const input = offset + y * stride + x;
|
|
23286
|
+
const output = y * width + x;
|
|
23287
|
+
const value2 = field.heights[input];
|
|
23288
|
+
if (Number.isFinite(value2) && (!field.validity || field.validity[input] !== 0)) {
|
|
23289
|
+
heights[output] = value2;
|
|
23290
|
+
validity[output] = 1;
|
|
23291
|
+
}
|
|
23292
|
+
}
|
|
23293
|
+
}
|
|
23294
|
+
return { heights, validity };
|
|
23295
|
+
}
|
|
23296
|
+
function compareAddress(a, b) {
|
|
23297
|
+
return a.spacing - b.spacing || a.column - b.column || a.row - b.row;
|
|
23298
|
+
}
|
|
23299
|
+
function changedHalos(previous, next) {
|
|
23300
|
+
const changed = [];
|
|
23301
|
+
let index = 0;
|
|
23302
|
+
for (let i = 0; i < next.length; i++) {
|
|
23303
|
+
const tile = next[i];
|
|
23304
|
+
while (index < previous.length && compareAddress(previous[index], tile) < 0)
|
|
23305
|
+
index++;
|
|
23306
|
+
const prior = previous[index];
|
|
23307
|
+
if (!prior || prior !== tile && (compareAddress(prior, tile) !== 0 || !sameHalo(prior, tile)))
|
|
23308
|
+
changed.push(tile);
|
|
23309
|
+
}
|
|
23310
|
+
return changed;
|
|
23311
|
+
}
|
|
23312
|
+
var TerrainResidencyTask = {
|
|
23313
|
+
id: "terrain-residency",
|
|
23314
|
+
initialize(limits) {
|
|
23315
|
+
return { limits: { ...limits }, snapshot: null, revision: 0 };
|
|
23316
|
+
},
|
|
23317
|
+
async process(input, _options, context) {
|
|
23318
|
+
var _a3, _b2, _c;
|
|
23319
|
+
const state = context.state;
|
|
23320
|
+
if ("type" in input) {
|
|
23321
|
+
if (input.type !== "snapshot")
|
|
23322
|
+
throw new Error("Unknown terrain residency request");
|
|
23323
|
+
return {
|
|
23324
|
+
revision: state.revision,
|
|
23325
|
+
tiles: structuredClone(((_a3 = state.snapshot) == null ? void 0 : _a3.tiles) ?? []),
|
|
23326
|
+
removed: []
|
|
23327
|
+
};
|
|
23328
|
+
}
|
|
23329
|
+
const start = input.measureStages ? performance.now() : 0;
|
|
23330
|
+
try {
|
|
23331
|
+
if (input.revision !== state.revision)
|
|
23332
|
+
throw new Error("Stale terrain residency revision");
|
|
23333
|
+
const { updateTerrainMixedVertexTileHalos: updateTerrainMixedVertexTileHalos2 } = await Promise.resolve().then(() => (init_mixed_halo_update(), mixed_halo_update_exports));
|
|
23334
|
+
context.throwIfAborted();
|
|
23335
|
+
const priorSources = ((_b2 = state.snapshot) == null ? void 0 : _b2.sources) ?? [];
|
|
23336
|
+
let sourceIndex = state.snapshot && sourceIndexes.get(state.snapshot);
|
|
23337
|
+
if (!sourceIndex) {
|
|
23338
|
+
sourceIndex = /* @__PURE__ */ new Map();
|
|
23339
|
+
for (let i = 0; i < priorSources.length; i++)
|
|
23340
|
+
sourceIndex.set(addressKey(priorSources[i]), i);
|
|
23341
|
+
}
|
|
23342
|
+
const resident = priorSources.slice();
|
|
23343
|
+
let structural;
|
|
23344
|
+
const getSource = (key3) => structural ? structural.get(key3) : resident[sourceIndex.get(key3)];
|
|
23345
|
+
const setSource = (key3, tile) => {
|
|
23346
|
+
if (structural)
|
|
23347
|
+
structural.set(key3, tile);
|
|
23348
|
+
else
|
|
23349
|
+
resident[sourceIndex.get(key3)] = tile;
|
|
23350
|
+
};
|
|
23351
|
+
const editLayout = () => {
|
|
23352
|
+
if (!structural) {
|
|
23353
|
+
structural = /* @__PURE__ */ new Map();
|
|
23354
|
+
for (const tile of resident)
|
|
23355
|
+
structural.set(addressKey(tile), tile);
|
|
23356
|
+
}
|
|
23357
|
+
return structural;
|
|
23358
|
+
};
|
|
23359
|
+
const writable = /* @__PURE__ */ new Map();
|
|
23360
|
+
for (const edit of input.edits) {
|
|
23361
|
+
if (edit.type === "upsert") {
|
|
23362
|
+
const key4 = addressKey(edit.tile);
|
|
23363
|
+
editLayout().set(key4, structuredClone(edit.tile));
|
|
23364
|
+
writable.delete(key4);
|
|
23365
|
+
continue;
|
|
23366
|
+
}
|
|
23367
|
+
const key3 = addressKey(edit.address);
|
|
23368
|
+
if (edit.type === "remove") {
|
|
23369
|
+
editLayout().delete(key3);
|
|
23370
|
+
writable.delete(key3);
|
|
23371
|
+
continue;
|
|
23372
|
+
}
|
|
23373
|
+
if (edit.type !== "samples")
|
|
23374
|
+
throw new Error("Unknown terrain residency edit");
|
|
23375
|
+
const source = getSource(key3);
|
|
23376
|
+
if (!source)
|
|
23377
|
+
throw new Error("Terrain sample edit requires a resident tile");
|
|
23378
|
+
if (!edit.samples.length)
|
|
23379
|
+
continue;
|
|
23380
|
+
let data = writable.get(key3);
|
|
23381
|
+
if (!data) {
|
|
23382
|
+
data = structural ? new (await Promise.resolve().then(() => (init_height_field(), height_field_exports))).HeightField(source.field).copyData() : copyResidentSamples(source.field);
|
|
23383
|
+
writable.set(key3, data);
|
|
23384
|
+
setSource(key3, {
|
|
23385
|
+
...source,
|
|
23386
|
+
field: { ...source.field, ...data, offset: 0, stride: source.field.width }
|
|
23387
|
+
});
|
|
23388
|
+
}
|
|
23389
|
+
for (const { index, height: height2 } of edit.samples) {
|
|
23390
|
+
if (!Number.isSafeInteger(index) || index < 0 || index >= data.heights.length || height2 !== null && !Number.isFinite(height2)) {
|
|
23391
|
+
throw new Error("Invalid terrain sample edit");
|
|
23392
|
+
}
|
|
23393
|
+
data.heights[index] = height2 ?? 0;
|
|
23394
|
+
if (!Number.isFinite(data.heights[index]))
|
|
23395
|
+
throw new Error("Terrain sample edit overflow");
|
|
23396
|
+
data.validity[index] = height2 === null ? 0 : 1;
|
|
23397
|
+
}
|
|
23398
|
+
}
|
|
23399
|
+
const applied = input.measureStages ? performance.now() : 0;
|
|
23400
|
+
const next = updateTerrainMixedVertexTileHalos2(state.snapshot, structural ? [...structural.values()] : resident, state.limits);
|
|
23401
|
+
const updated = input.measureStages ? performance.now() : 0;
|
|
23402
|
+
const tiles = structuredClone(changedHalos(((_c = state.snapshot) == null ? void 0 : _c.tiles) ?? [], next.tiles));
|
|
23403
|
+
context.throwIfAborted();
|
|
23404
|
+
if (!structural)
|
|
23405
|
+
sourceIndexes.set(next, sourceIndex);
|
|
23406
|
+
state.snapshot = next;
|
|
23407
|
+
state.revision++;
|
|
23408
|
+
const result = {
|
|
23409
|
+
revision: state.revision,
|
|
23410
|
+
tiles,
|
|
23411
|
+
removed: next.removed
|
|
23412
|
+
};
|
|
23413
|
+
if (input.measureStages) {
|
|
23414
|
+
const finish = performance.now();
|
|
23415
|
+
result.timings = {
|
|
23416
|
+
applyEditsMs: applied - start,
|
|
23417
|
+
updateHalosMs: updated - applied,
|
|
23418
|
+
prepareDeltaMs: finish - updated,
|
|
23419
|
+
processMs: finish - start
|
|
23420
|
+
};
|
|
23421
|
+
}
|
|
23422
|
+
return result;
|
|
23423
|
+
} catch (error) {
|
|
23424
|
+
context.throwIfAborted();
|
|
23425
|
+
return {
|
|
23426
|
+
revision: state.revision,
|
|
23427
|
+
tiles: [],
|
|
23428
|
+
removed: [],
|
|
23429
|
+
error: error instanceof Error ? error.message : String(error)
|
|
23430
|
+
};
|
|
23431
|
+
}
|
|
23432
|
+
}
|
|
23433
|
+
};
|
|
23434
|
+
|
|
23435
|
+
// dist/tasks/terrain-coverage.js
|
|
23436
|
+
var CertifyTerrainCoverageTask = {
|
|
23437
|
+
id: "certify-terrain-coverage",
|
|
23438
|
+
async process({ field, mesh }, options) {
|
|
23439
|
+
const [{ HeightField: HeightField2 }, { certifyTerrainMeshCoverage: certifyTerrainMeshCoverage2 }] = await Promise.all([
|
|
23440
|
+
Promise.resolve().then(() => (init_height_field(), height_field_exports)),
|
|
23441
|
+
Promise.resolve().then(() => (init_mesh_coverage(), mesh_coverage_exports))
|
|
23442
|
+
]);
|
|
23443
|
+
return certifyTerrainMeshCoverage2(new HeightField2(field), mesh, options);
|
|
23444
|
+
}
|
|
23445
|
+
};
|
|
23446
|
+
|
|
22354
23447
|
// dist/tasks/definitions.js
|
|
22355
23448
|
var processCoordinates = async (input, options, context) => {
|
|
22356
23449
|
const projection = input.projection ?? context.state.defaultOptions;
|
|
@@ -22395,12 +23488,12 @@ var PrepareMapTask = {
|
|
|
22395
23488
|
}
|
|
22396
23489
|
};
|
|
22397
23490
|
async function prepareProjection(state, options) {
|
|
22398
|
-
const
|
|
22399
|
-
if (!state.projection || state.key !==
|
|
23491
|
+
const key3 = JSON.stringify(options);
|
|
23492
|
+
if (!state.projection || state.key !== key3) {
|
|
22400
23493
|
const { FullProjectionEngine: FullProjectionEngine2 } = await Promise.resolve().then(() => (init_projection(), projection_exports));
|
|
22401
23494
|
const projection = new FullProjectionEngine2().createProjection(options);
|
|
22402
23495
|
state.projection = projection;
|
|
22403
|
-
state.key =
|
|
23496
|
+
state.key = key3;
|
|
22404
23497
|
}
|
|
22405
23498
|
}
|
|
22406
23499
|
|
|
@@ -22426,4 +23519,22 @@ var PrepareMapTask2 = {
|
|
|
22426
23519
|
capabilities: { atomic: true, streaming: false }
|
|
22427
23520
|
}
|
|
22428
23521
|
};
|
|
23522
|
+
var CertifyTerrainCoverageTask2 = {
|
|
23523
|
+
...CertifyTerrainCoverageTask,
|
|
23524
|
+
worker: {
|
|
23525
|
+
...!isBrowser ? { url: /* @__PURE__ */ (() => new URL("./terrain-coverage-worker.js", moduleUrl).href)() } : {
|
|
23526
|
+
create: () => new Worker(new URL("./terrain-coverage-worker.js", import_meta.url), { type: "module" })
|
|
23527
|
+
},
|
|
23528
|
+
capabilities: { atomic: true, streaming: false }
|
|
23529
|
+
}
|
|
23530
|
+
};
|
|
23531
|
+
var TerrainResidencyTask2 = {
|
|
23532
|
+
...TerrainResidencyTask,
|
|
23533
|
+
worker: {
|
|
23534
|
+
...!isBrowser ? { url: /* @__PURE__ */ (() => new URL("./terrain-residency-worker.js", moduleUrl).href)() } : {
|
|
23535
|
+
create: () => new Worker(new URL("./terrain-residency-worker.js", import_meta.url), { type: "module" })
|
|
23536
|
+
},
|
|
23537
|
+
capabilities: { atomic: true, streaming: false }
|
|
23538
|
+
}
|
|
23539
|
+
};
|
|
22429
23540
|
//# sourceMappingURL=index.cjs.map
|