@math.gl/geospatial 5.0.0-rc.2 → 5.0.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 +6 -6
- package/dist/coordinates.cjs +2523 -0
- package/dist/coordinates.cjs.map +6 -0
- package/dist/coordinates.d.ts +4 -0
- package/dist/coordinates.d.ts.map +1 -1
- package/dist/coordinates.js +2 -0
- package/dist/coordinates.js.map +1 -1
- package/dist/entries/ellipsoid.cjs +1209 -0
- package/dist/entries/ellipsoid.cjs.map +6 -0
- package/dist/entries/ellipsoid.d.ts +3 -19
- package/dist/entries/ellipsoid.d.ts.map +1 -1
- package/dist/entries/ellipsoid.js +1 -9
- package/dist/entries/ellipsoid.js.map +1 -1
- package/dist/expressions.cjs +726 -0
- package/dist/expressions.cjs.map +6 -0
- package/dist/geodesics.cjs +3195 -0
- package/dist/geodesics.cjs.map +6 -0
- package/dist/geodesics.d.ts +18 -0
- package/dist/geodesics.d.ts.map +1 -0
- package/dist/geodesics.js +13 -0
- package/dist/geodesics.js.map +1 -0
- package/dist/geographic-atlas/sampling.d.ts +1 -1
- package/dist/geographic-atlas/sampling.d.ts.map +1 -1
- package/dist/geographic-atlas/sampling.js +1 -1
- package/dist/geographic-atlas/sampling.js.map +1 -1
- package/dist/geographic-cuts.cjs +4160 -0
- package/dist/geographic-cuts.cjs.map +6 -0
- package/dist/geographic-cuts.d.ts +2 -0
- package/dist/geographic-cuts.d.ts.map +1 -1
- package/dist/geographic-cuts.js +1 -0
- package/dist/geographic-cuts.js.map +1 -1
- package/dist/geographic-seams/subdivide-cut.d.ts +1 -1
- package/dist/geographic-seams/subdivide-cut.d.ts.map +1 -1
- package/dist/geographic-seams/subdivide-cut.js +1 -1
- package/dist/geographic-seams/subdivide-cut.js.map +1 -1
- package/dist/geographic-seams/types.shared.cjs +32 -0
- package/dist/geographic-seams/types.shared.cjs.map +6 -0
- package/dist/globe.cjs +4223 -0
- package/dist/globe.cjs.map +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/line-simplification.d.ts +7 -0
- package/dist/line-simplification.d.ts.map +1 -1
- package/dist/line-simplification.js +4 -13
- package/dist/line-simplification.js.map +1 -1
- package/dist/linear-referencing.d.ts +13 -1
- package/dist/linear-referencing.d.ts.map +1 -1
- package/dist/linear-referencing.js +29 -9
- package/dist/linear-referencing.js.map +1 -1
- package/dist/maps/map-transition.shared.cjs +364 -0
- package/dist/maps/map-transition.shared.cjs.map +6 -0
- 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 +2 -2
- package/dist/maps/presets.cjs.map +2 -2
- package/dist/maps/transitions.cjs +3 -342
- package/dist/maps/transitions.cjs.map +3 -3
- package/dist/maps.cjs +15 -319
- package/dist/maps.cjs.map +3 -3
- package/dist/measure-referencing.d.ts +16 -0
- package/dist/measure-referencing.d.ts.map +1 -0
- package/dist/measure-referencing.js +143 -0
- package/dist/measure-referencing.js.map +1 -0
- package/dist/polygon-simplification.d.ts +6 -0
- package/dist/polygon-simplification.d.ts.map +1 -0
- package/dist/polygon-simplification.js +141 -0
- package/dist/polygon-simplification.js.map +1 -0
- package/dist/projection/experimental/core.cjs +63 -1317
- package/dist/projection/experimental/core.cjs.map +3 -3
- package/dist/projection/experimental/core.d.ts +1 -1
- package/dist/projection/experimental/core.d.ts.map +1 -1
- package/dist/projection/experimental/crs/projjson.cjs +26 -45
- package/dist/projection/experimental/crs/projjson.cjs.map +3 -3
- package/dist/projection/experimental/crs/types.shared.cjs +44 -0
- package/dist/projection/experimental/crs/types.shared.cjs.map +6 -0
- package/dist/projection/experimental/crs/wkt.cjs +36 -52
- package/dist/projection/experimental/crs/wkt.cjs.map +3 -3
- package/dist/projection/experimental/entries/projections/ob_tran.cjs +9 -23
- package/dist/projection/experimental/entries/projections/ob_tran.cjs.map +3 -3
- package/dist/projection/experimental/lazy-projections/aea.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/aea.js +1 -1
- package/dist/projection/experimental/lazy-projections/aeqd.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/aeqd.js +1 -1
- package/dist/projection/experimental/lazy-projections/bonne.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/bonne.js +1 -1
- package/dist/projection/experimental/lazy-projections/cass.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/cass.js +1 -1
- package/dist/projection/experimental/lazy-projections/cea.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/cea.js +1 -1
- package/dist/projection/experimental/lazy-projections/eck6.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/eck6.js +1 -1
- package/dist/projection/experimental/lazy-projections/eqc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/eqc.js +1 -1
- package/dist/projection/experimental/lazy-projections/eqdc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/eqdc.js +1 -1
- package/dist/projection/experimental/lazy-projections/eqearth.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/eqearth.js +1 -1
- package/dist/projection/experimental/lazy-projections/equi.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/equi.js +1 -1
- package/dist/projection/experimental/lazy-projections/etmerc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/etmerc.js +1 -1
- package/dist/projection/experimental/lazy-projections/geocent.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/geocent.js +1 -1
- package/dist/projection/experimental/lazy-projections/geos.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/geos.js +1 -1
- package/dist/projection/experimental/lazy-projections/gnom.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/gnom.js +1 -1
- package/dist/projection/experimental/lazy-projections/gstmerc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/gstmerc.js +1 -1
- package/dist/projection/experimental/lazy-projections/index.cjs +60 -903
- package/dist/projection/experimental/lazy-projections/index.cjs.map +3 -3
- package/dist/projection/experimental/lazy-projections/krovak.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/krovak.js +1 -1
- package/dist/projection/experimental/lazy-projections/laea.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/laea.js +1 -1
- package/dist/projection/experimental/lazy-projections/lcc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/lcc.js +1 -1
- package/dist/projection/experimental/lazy-projections/merc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/merc.js +1 -1
- package/dist/projection/experimental/lazy-projections/mill.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/mill.js +1 -1
- package/dist/projection/experimental/lazy-projections/moll.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/moll.js +1 -1
- package/dist/projection/experimental/lazy-projections/nzmg.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/nzmg.js +1 -1
- package/dist/projection/experimental/lazy-projections/ob_tran.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/ob_tran.js +1 -1
- package/dist/projection/experimental/lazy-projections/omerc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/omerc.js +1 -1
- package/dist/projection/experimental/lazy-projections/ortho.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/ortho.js +1 -1
- package/dist/projection/experimental/lazy-projections/poly.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/poly.js +1 -1
- package/dist/projection/experimental/lazy-projections/qsc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/qsc.js +1 -1
- package/dist/projection/experimental/lazy-projections/robin.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/robin.js +1 -1
- package/dist/projection/experimental/lazy-projections/sinu.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/sinu.js +1 -1
- package/dist/projection/experimental/lazy-projections/somerc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/somerc.js +1 -1
- package/dist/projection/experimental/lazy-projections/stere.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/stere.js +1 -1
- package/dist/projection/experimental/lazy-projections/sterea.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/sterea.js +1 -1
- package/dist/projection/experimental/lazy-projections/tmerc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/tmerc.js +1 -1
- package/dist/projection/experimental/lazy-projections/tpers.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/tpers.js +1 -1
- package/dist/projection/experimental/lazy-projections/utm.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/utm.js +1 -1
- package/dist/projection/experimental/lazy-projections/vandg.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/vandg.js +1 -1
- package/dist/projection/experimental/projection-engine.shared.cjs +1184 -0
- package/dist/projection/experimental/projection-engine.shared.cjs.map +6 -0
- package/dist/projection/experimental/typescript-projection.shared.cjs +1703 -0
- package/dist/projection/experimental/typescript-projection.shared.cjs.map +6 -0
- package/dist/projection/index.cjs +622 -1535
- package/dist/projection/index.cjs.map +3 -3
- package/dist/projection/pipeline.cjs +44 -58
- package/dist/projection/pipeline.cjs.map +3 -3
- package/dist/projection/transform-analysis.cjs +20 -936
- package/dist/projection/transform-analysis.cjs.map +3 -3
- package/dist/spatial-box-clipping.d.ts +9 -0
- package/dist/spatial-box-clipping.d.ts.map +1 -0
- package/dist/spatial-box-clipping.js +123 -0
- package/dist/spatial-box-clipping.js.map +1 -0
- package/dist/spatial-dwithin.d.ts +19 -0
- package/dist/spatial-dwithin.d.ts.map +1 -0
- package/dist/spatial-dwithin.js +107 -0
- package/dist/spatial-dwithin.js.map +1 -0
- package/dist/spatial-hulls.d.ts +6 -0
- package/dist/spatial-hulls.d.ts.map +1 -0
- package/dist/spatial-hulls.js +176 -0
- package/dist/spatial-hulls.js.map +1 -0
- package/dist/spatial-line-intersection-result.d.ts +4 -0
- package/dist/spatial-line-intersection-result.d.ts.map +1 -0
- package/dist/spatial-line-intersection-result.js +79 -0
- package/dist/spatial-line-intersection-result.js.map +1 -0
- package/dist/spatial-line-polygon-intersection.d.ts +4 -0
- package/dist/spatial-line-polygon-intersection.d.ts.map +1 -0
- package/dist/spatial-line-polygon-intersection.js +130 -0
- package/dist/spatial-line-polygon-intersection.js.map +1 -0
- package/dist/spatial-planar-intersects.d.ts +11 -0
- package/dist/spatial-planar-intersects.d.ts.map +1 -1
- package/dist/spatial-planar-intersects.js +20 -12
- package/dist/spatial-planar-intersects.js.map +1 -1
- package/dist/spatial-planar.d.ts +9 -0
- package/dist/spatial-planar.d.ts.map +1 -1
- package/dist/spatial-planar.js +13 -1
- package/dist/spatial-planar.js.map +1 -1
- package/dist/spatial-polygon-overlay.d.ts +5 -0
- package/dist/spatial-polygon-overlay.d.ts.map +1 -0
- package/dist/spatial-polygon-overlay.js +23 -0
- package/dist/spatial-polygon-overlay.js.map +1 -0
- package/dist/spatial-sql.d.ts +13 -2
- package/dist/spatial-sql.d.ts.map +1 -1
- package/dist/spatial-sql.js +30 -12
- package/dist/spatial-sql.js.map +1 -1
- package/dist/spatial-subdivision.d.ts +9 -0
- package/dist/spatial-subdivision.d.ts.map +1 -0
- package/dist/spatial-subdivision.js +61 -0
- package/dist/spatial-subdivision.js.map +1 -0
- package/dist/spatial-touches.d.ts +13 -0
- package/dist/spatial-touches.d.ts.map +1 -0
- package/dist/spatial-touches.js +192 -0
- package/dist/spatial-touches.js.map +1 -0
- package/dist/st-functions.cjs +2411 -112
- package/dist/st-functions.cjs.map +3 -3
- package/dist/st-functions.d.ts +67 -2
- package/dist/st-functions.d.ts.map +1 -1
- package/dist/st-functions.js +195 -12
- package/dist/st-functions.js.map +1 -1
- package/dist/st-geodesic-functions.d.ts +33 -0
- package/dist/st-geodesic-functions.d.ts.map +1 -0
- package/dist/st-geodesic-functions.js +84 -0
- package/dist/st-geodesic-functions.js.map +1 -0
- package/dist/st-hull-functions.cjs +386 -0
- package/dist/st-hull-functions.cjs.map +6 -0
- package/dist/st-hull-functions.d.ts +17 -0
- package/dist/st-hull-functions.d.ts.map +1 -0
- package/dist/st-hull-functions.js +14 -0
- package/dist/st-hull-functions.js.map +1 -0
- package/dist/st-overlay-functions.cjs +621 -0
- package/dist/st-overlay-functions.cjs.map +6 -0
- package/dist/st-overlay-functions.d.ts +36 -0
- package/dist/st-overlay-functions.d.ts.map +1 -0
- package/dist/st-overlay-functions.js +183 -0
- package/dist/st-overlay-functions.js.map +1 -0
- package/dist/st-viewport-functions.cjs +481 -0
- package/dist/st-viewport-functions.cjs.map +6 -0
- package/dist/st-viewport-functions.d.ts +13 -0
- package/dist/st-viewport-functions.d.ts.map +1 -0
- package/dist/st-viewport-functions.js +81 -0
- package/dist/st-viewport-functions.js.map +1 -0
- package/dist/subdivide-geodesic-polyline.d.ts +1 -1
- package/dist/subdivide-geodesic-polyline.d.ts.map +1 -1
- package/dist/subdivide-geodesic-polyline.js +1 -1
- package/dist/subdivide-geodesic-polyline.js.map +1 -1
- package/dist/subdivide-globe-mesh.d.ts +1 -1
- package/dist/subdivide-globe-mesh.d.ts.map +1 -1
- package/dist/subdivide-globe-mesh.js +1 -1
- package/dist/subdivide-globe-mesh.js.map +1 -1
- package/dist/subdivide-rhumb-polyline.d.ts +1 -1
- package/dist/subdivide-rhumb-polyline.d.ts.map +1 -1
- package/dist/subdivide-rhumb-polyline.js +1 -1
- package/dist/subdivide-rhumb-polyline.js.map +1 -1
- package/dist/tasks/index.cjs +808 -2993
- package/dist/tasks/index.cjs.map +3 -3
- package/dist/terrain/geometry.d.ts +1 -1
- package/dist/terrain/geometry.d.ts.map +1 -1
- package/dist/terrain/geometry.js +1 -1
- package/dist/terrain/geometry.js.map +1 -1
- package/dist/terrain/index.cjs +95 -22
- package/dist/terrain/index.cjs.map +3 -3
- package/dist/terrain/index.d.ts +1 -0
- package/dist/terrain/index.d.ts.map +1 -1
- package/dist/terrain/index.js +1 -0
- package/dist/terrain/index.js.map +1 -1
- package/dist/terrain/regional-watersheds.d.ts +44 -0
- package/dist/terrain/regional-watersheds.d.ts.map +1 -0
- package/dist/terrain/regional-watersheds.js +108 -0
- package/dist/terrain/regional-watersheds.js.map +1 -0
- package/dist/terrain/tile-cutout-update.d.ts.map +1 -1
- package/dist/terrain/tile-cutout-update.js +28 -22
- package/dist/terrain/tile-cutout-update.js.map +1 -1
- package/dist/tiles.cjs +354 -0
- package/dist/tiles.cjs.map +6 -0
- package/dist/turf-functions.cjs +16 -9
- package/dist/turf-functions.cjs.map +1 -1
- package/package.json +154 -117
- package/src/coordinates.ts +5 -0
- package/src/entries/ellipsoid.ts +7 -32
- package/src/geodesics.ts +40 -0
- package/src/geographic-atlas/sampling.ts +1 -1
- package/src/geographic-cuts.ts +21 -0
- package/src/geographic-seams/subdivide-cut.ts +1 -1
- package/src/index.ts +2 -0
- package/src/line-simplification.ts +4 -16
- package/src/linear-referencing.ts +44 -16
- package/src/maps/myriahedral/unfold.ts +1 -1
- package/src/measure-referencing.ts +165 -0
- package/src/polygon-simplification.ts +185 -0
- package/src/projection/experimental/core.ts +1 -1
- package/src/projection/experimental/lazy-projections/aea.ts +1 -1
- package/src/projection/experimental/lazy-projections/aeqd.ts +1 -1
- package/src/projection/experimental/lazy-projections/bonne.ts +1 -1
- package/src/projection/experimental/lazy-projections/cass.ts +1 -1
- package/src/projection/experimental/lazy-projections/cea.ts +1 -1
- package/src/projection/experimental/lazy-projections/eck6.ts +1 -1
- package/src/projection/experimental/lazy-projections/eqc.ts +1 -1
- package/src/projection/experimental/lazy-projections/eqdc.ts +1 -1
- package/src/projection/experimental/lazy-projections/eqearth.ts +1 -1
- package/src/projection/experimental/lazy-projections/equi.ts +1 -1
- package/src/projection/experimental/lazy-projections/etmerc.ts +1 -1
- package/src/projection/experimental/lazy-projections/geocent.ts +1 -1
- package/src/projection/experimental/lazy-projections/geos.ts +1 -1
- package/src/projection/experimental/lazy-projections/gnom.ts +1 -1
- package/src/projection/experimental/lazy-projections/gstmerc.ts +1 -1
- package/src/projection/experimental/lazy-projections/krovak.ts +1 -1
- package/src/projection/experimental/lazy-projections/laea.ts +1 -1
- package/src/projection/experimental/lazy-projections/lcc.ts +1 -1
- package/src/projection/experimental/lazy-projections/merc.ts +1 -1
- package/src/projection/experimental/lazy-projections/mill.ts +1 -1
- package/src/projection/experimental/lazy-projections/moll.ts +1 -1
- package/src/projection/experimental/lazy-projections/nzmg.ts +1 -1
- package/src/projection/experimental/lazy-projections/ob_tran.ts +1 -1
- package/src/projection/experimental/lazy-projections/omerc.ts +1 -1
- package/src/projection/experimental/lazy-projections/ortho.ts +1 -1
- package/src/projection/experimental/lazy-projections/poly.ts +1 -1
- package/src/projection/experimental/lazy-projections/qsc.ts +1 -1
- package/src/projection/experimental/lazy-projections/robin.ts +1 -1
- package/src/projection/experimental/lazy-projections/sinu.ts +1 -1
- package/src/projection/experimental/lazy-projections/somerc.ts +1 -1
- package/src/projection/experimental/lazy-projections/stere.ts +1 -1
- package/src/projection/experimental/lazy-projections/sterea.ts +1 -1
- package/src/projection/experimental/lazy-projections/tmerc.ts +1 -1
- package/src/projection/experimental/lazy-projections/tpers.ts +1 -1
- package/src/projection/experimental/lazy-projections/utm.ts +1 -1
- package/src/projection/experimental/lazy-projections/vandg.ts +1 -1
- package/src/spatial-box-clipping.ts +140 -0
- package/src/spatial-dwithin.ts +135 -0
- package/src/spatial-hulls.ts +203 -0
- package/src/spatial-line-intersection-result.ts +93 -0
- package/src/spatial-line-polygon-intersection.ts +147 -0
- package/src/spatial-planar-intersects.ts +21 -15
- package/src/spatial-planar.ts +20 -1
- package/src/spatial-polygon-overlay.ts +30 -0
- package/src/spatial-sql.ts +47 -12
- package/src/spatial-subdivision.ts +75 -0
- package/src/spatial-touches.ts +218 -0
- package/src/st-functions.ts +283 -15
- package/src/st-geodesic-functions.ts +121 -0
- package/src/st-hull-functions.ts +25 -0
- package/src/st-overlay-functions.ts +244 -0
- package/src/st-viewport-functions.ts +98 -0
- package/src/subdivide-geodesic-polyline.ts +2 -2
- package/src/subdivide-globe-mesh.ts +2 -2
- package/src/subdivide-rhumb-polyline.ts +2 -2
- package/src/terrain/geometry.ts +1 -1
- package/src/terrain/index.ts +7 -0
- package/src/terrain/regional-watersheds.ts +153 -0
- package/src/terrain/tile-cutout-update.ts +32 -26
- package/dist/index.cjs +0 -18674
- package/dist/index.cjs.map +0 -6
- package/dist/turf-expressions.cjs +0 -1997
- package/dist/turf-expressions.cjs.map +0 -6
- package/dist/turf-expressions.d.ts +0 -3
- package/dist/turf-expressions.d.ts.map +0 -1
- package/dist/turf-expressions.js +0 -7
- package/dist/turf-expressions.js.map +0 -1
- package/src/turf-expressions.ts +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../src/terrain/geometry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,QAAQ,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../src/terrain/geometry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,QAAQ,EAAC,MAAM,8BAA8B,CAAC;AACtD,OAAO,KAAK,EAAC,WAAW,EAAC,0BAAuB;AAEhD,MAAM,MAAM,0BAA0B,GAAG;IACvC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,qGAAqG;IACrG,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACnC,CAAC;AAEF,6FAA6F;AAC7F,qBAAa,mBAAoB,SAAQ,QAAQ;IAC/C,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;gBAEvC,KAAK,EAAE,WAAW,EAAE,OAAO,GAAE,0BAA+B;CA6GzE"}
|
package/dist/terrain/geometry.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// math.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
-
import { Geometry } from '@math.gl/geometry';
|
|
4
|
+
import { Geometry } from '@math.gl/geometry/primitives';
|
|
5
5
|
/** Z-up regular terrain mesh. Triangles and triangle sampling use the same cell diagonal. */
|
|
6
6
|
export class HeightFieldGeometry extends Geometry {
|
|
7
7
|
constructor(field, options = {}) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../src/terrain/geometry.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,OAAO,EAAC,QAAQ,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../src/terrain/geometry.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,OAAO,EAAC,QAAQ,EAAC,MAAM,8BAA8B,CAAC;AAUtD,6FAA6F;AAC7F,MAAM,OAAO,mBAAoB,SAAQ,QAAQ;IAG/C,YAAY,KAAkB,EAAE,UAAsC,EAAE;QACtE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACvE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;YACvD,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC7D,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,SAAS,CAAC;QACjD,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS;YACpD,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACpD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,M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64
|
createTerrainMixedVertexTileHalos: () => createTerrainMixedVertexTileHalos,
|
|
65
65
|
createTerrainRegionalViewshed: () => createTerrainRegionalViewshed,
|
|
66
|
+
createTerrainRegionalWatersheds: () => createTerrainRegionalWatersheds,
|
|
66
67
|
createTerrainSkirt: () => createTerrainSkirt,
|
|
67
68
|
createTerrainSlopeAspectGrid: () => createTerrainSlopeAspectGrid,
|
|
68
69
|
createTerrainSurface: () => createTerrainSurface,
|
|
@@ -533,8 +534,8 @@ function edgeKey(a, b) {
|
|
|
533
534
|
}
|
|
534
535
|
|
|
535
536
|
// dist/terrain/geometry.js
|
|
536
|
-
var
|
|
537
|
-
var HeightFieldGeometry = class extends
|
|
537
|
+
var import_primitives = require("@math.gl/geometry/primitives");
|
|
538
|
+
var HeightFieldGeometry = class extends import_primitives.Geometry {
|
|
538
539
|
constructor(field, options = {}) {
|
|
539
540
|
const origin = options.origin ?? [field.origin[0], field.origin[1], 0];
|
|
540
541
|
if (origin.length !== 3 || !origin.every(Number.isFinite))
|
|
@@ -8032,6 +8033,7 @@ function updateTerrainTileCutouts(residents, polygon2, previous, options = {}) {
|
|
|
8032
8033
|
splitTerrainMesh({ positions: new Float64Array(), indices: new Uint32Array() }, polygon2, limits);
|
|
8033
8034
|
const entries = /* @__PURE__ */ new Map();
|
|
8034
8035
|
const rebuilt = [];
|
|
8036
|
+
const dirty = /* @__PURE__ */ new Map();
|
|
8035
8037
|
let boundaryCount = 0;
|
|
8036
8038
|
for (const resident of residents) {
|
|
8037
8039
|
if (!resident.id || typeof resident.id !== "string" || entries.has(resident.id) || !Number.isSafeInteger(resident.revision) || resident.revision < 0)
|
|
@@ -8053,6 +8055,7 @@ function updateTerrainTileCutouts(residents, polygon2, previous, options = {}) {
|
|
|
8053
8055
|
}
|
|
8054
8056
|
entry = { resident: { ...resident }, split, displayed: split, bounds: bounds2, edges: edges2 };
|
|
8055
8057
|
rebuilt.push(resident.id);
|
|
8058
|
+
dirty.set(entry, entries.size);
|
|
8056
8059
|
}
|
|
8057
8060
|
boundaryCount += entry.edges.length;
|
|
8058
8061
|
if (boundaryCount > limits.maxBoundaryEdges)
|
|
@@ -8060,45 +8063,42 @@ function updateTerrainTileCutouts(residents, polygon2, previous, options = {}) {
|
|
|
8060
8063
|
entries.set(resident.id, entry);
|
|
8061
8064
|
}
|
|
8062
8065
|
const values = [...entries.values()];
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
if (a.bounds[2] < b.bounds[0] || b.bounds[2] < a.bounds[0] || a.bounds[3] < b.bounds[1] || b.bounds[3] < a.bounds[1])
|
|
8066
|
+
const pairCount = values.length * (values.length - 1) / 2;
|
|
8067
|
+
if (pairCount > limits.maxPairChecks)
|
|
8068
|
+
throw new RangeError("Terrain cutout pair budget exceeded");
|
|
8069
|
+
for (const [a, index] of dirty)
|
|
8070
|
+
for (const b of values) {
|
|
8071
|
+
if (a === b || (dirty.get(b) ?? Infinity) < index)
|
|
8070
8072
|
continue;
|
|
8071
|
-
if (
|
|
8073
|
+
if (a.bounds[2] < b.bounds[0] || b.bounds[2] < a.bounds[0] || a.bounds[3] < b.bounds[1] || b.bounds[3] < a.bounds[1])
|
|
8072
8074
|
continue;
|
|
8073
8075
|
const combined = assembleTerrainCutoutTiles([a.resident.mesh, b.resident.mesh], limits);
|
|
8074
8076
|
validateTerrainCutoutTopology(combined.mesh, combined.remainingWork);
|
|
8075
8077
|
}
|
|
8076
8078
|
const boundaries = /* @__PURE__ */ new Map();
|
|
8077
|
-
const cutKeys = /* @__PURE__ */ new Map();
|
|
8078
8079
|
for (let tile = 0; tile < values.length; tile++)
|
|
8079
8080
|
for (const edge2 of values[tile].edges) {
|
|
8080
8081
|
const other = boundaries.get(edge2.key);
|
|
8081
|
-
if (
|
|
8082
|
-
boundaries.set(edge2.key,
|
|
8082
|
+
if (other === void 0) {
|
|
8083
|
+
boundaries.set(edge2.key, edge2);
|
|
8083
8084
|
continue;
|
|
8084
8085
|
}
|
|
8085
|
-
if (other
|
|
8086
|
+
if (typeof other !== "object" || other === null || other.start !== edge2.end || other.end !== edge2.start)
|
|
8086
8087
|
throw new RangeError("Nonconforming terrain cutout tile boundary");
|
|
8087
|
-
other.
|
|
8088
|
-
if (other.edge.side !== edge2.side) {
|
|
8089
|
-
cutKeys.set(edge2.key, edge2.side === 0 ? edge2.polygon : other.edge.polygon);
|
|
8090
|
-
}
|
|
8088
|
+
boundaries.set(edge2.key, other.side === edge2.side ? null : edge2.side === 0 ? edge2.polygon : other.polygon);
|
|
8091
8089
|
}
|
|
8092
8090
|
const tiles = /* @__PURE__ */ new Map();
|
|
8093
8091
|
const changed = [];
|
|
8092
|
+
const cuts = [[], []];
|
|
8093
|
+
const polygons = [[], []];
|
|
8094
8094
|
for (let i = 0; i < values.length; i++) {
|
|
8095
8095
|
const entry = values[i];
|
|
8096
8096
|
const old = prior == null ? void 0 : prior.entries.get(entry.resident.id);
|
|
8097
|
-
|
|
8098
|
-
|
|
8097
|
+
cuts[0].length = cuts[1].length = 0;
|
|
8098
|
+
polygons[0].length = polygons[1].length = 0;
|
|
8099
8099
|
for (const edge2 of entry.edges) {
|
|
8100
|
-
const polygonIndex =
|
|
8101
|
-
if (polygonIndex
|
|
8100
|
+
const polygonIndex = boundaries.get(edge2.key);
|
|
8101
|
+
if (typeof polygonIndex === "number") {
|
|
8102
8102
|
cuts[edge2.side].push(edge2.a, edge2.b);
|
|
8103
8103
|
polygons[edge2.side].push(polygonIndex);
|
|
8104
8104
|
}
|
|
@@ -8374,4 +8374,77 @@ function contains(ring, p, charge) {
|
|
|
8374
8374
|
}
|
|
8375
8375
|
return winding === 0 ? -1 : 1;
|
|
8376
8376
|
}
|
|
8377
|
+
|
|
8378
|
+
// dist/terrain/regional-watersheds.js
|
|
8379
|
+
function createTerrainRegionalWatersheds(tiles, { width, height, origin, outlets, maxCells = 4194304 }) {
|
|
8380
|
+
const count = width * height;
|
|
8381
|
+
if (!Number.isSafeInteger(width) || width < 2 || !Number.isSafeInteger(height) || height < 2 || !Number.isSafeInteger(maxCells) || maxCells < 0 || origin.length !== 2 || !origin.every(Number.isFinite) || count > maxCells || count > 2147483647 || !tiles.length)
|
|
8382
|
+
throw new RangeError("Invalid regional watershed window or cell budget");
|
|
8383
|
+
const { columnStep, rowStep, heightReference, diagonal } = tiles[0].field;
|
|
8384
|
+
const heights = new Float64Array(count);
|
|
8385
|
+
const validity = new Uint8Array(count);
|
|
8386
|
+
const coverage = new Uint8Array(count);
|
|
8387
|
+
for (const { column, row, field: field2 } of tiles) {
|
|
8388
|
+
if (!Number.isSafeInteger(column) || !Number.isSafeInteger(row) || column < 0 || row < 0 || column + field2.width > width || row + field2.height > height || field2.registration !== "cell" || field2.heightReference !== heightReference || field2.diagonal !== diagonal || !origin.every((value, axis) => field2.origin[axis] === value + column * columnStep[axis] + row * rowStep[axis] && field2.columnStep[axis] === columnStep[axis] && field2.rowStep[axis] === rowStep[axis]))
|
|
8389
|
+
throw new RangeError("Regional watershed tiles must align to the shared cell grid");
|
|
8390
|
+
for (let y = 0; y < field2.height; y++) {
|
|
8391
|
+
for (let x = 0; x < field2.width; x++) {
|
|
8392
|
+
const index = (row + y) * width + column + x;
|
|
8393
|
+
if (coverage[index])
|
|
8394
|
+
throw new RangeError("Regional watershed tiles overlap");
|
|
8395
|
+
const value = field2.getHeight(x, y);
|
|
8396
|
+
coverage[index] = value === void 0 ? 1 : 2;
|
|
8397
|
+
if (value !== void 0) {
|
|
8398
|
+
heights[index] = value;
|
|
8399
|
+
validity[index] = 1;
|
|
8400
|
+
}
|
|
8401
|
+
}
|
|
8402
|
+
}
|
|
8403
|
+
}
|
|
8404
|
+
const mosaic = new HeightField({
|
|
8405
|
+
width,
|
|
8406
|
+
height,
|
|
8407
|
+
origin,
|
|
8408
|
+
columnStep,
|
|
8409
|
+
rowStep,
|
|
8410
|
+
heightReference,
|
|
8411
|
+
diagonal,
|
|
8412
|
+
registration: "cell",
|
|
8413
|
+
heights,
|
|
8414
|
+
validity
|
|
8415
|
+
});
|
|
8416
|
+
const { field, receiver } = fillTerrainDepressions(mosaic, { outlets, maxCells });
|
|
8417
|
+
const touchesUnknown = new Uint8Array(count);
|
|
8418
|
+
const queue = new Int32Array(count);
|
|
8419
|
+
let end = 0;
|
|
8420
|
+
function mark(index) {
|
|
8421
|
+
if (coverage[index] !== 2 || touchesUnknown[index])
|
|
8422
|
+
return;
|
|
8423
|
+
touchesUnknown[index] = 1;
|
|
8424
|
+
queue[end++] = index;
|
|
8425
|
+
}
|
|
8426
|
+
function markNeighbors(index) {
|
|
8427
|
+
const x = index % width;
|
|
8428
|
+
if (x > 0)
|
|
8429
|
+
mark(index - 1);
|
|
8430
|
+
if (x + 1 < width)
|
|
8431
|
+
mark(index + 1);
|
|
8432
|
+
if (index >= width)
|
|
8433
|
+
mark(index - width);
|
|
8434
|
+
if (index < count - width)
|
|
8435
|
+
mark(index + width);
|
|
8436
|
+
}
|
|
8437
|
+
for (let i = 0; i < count; i++)
|
|
8438
|
+
if (coverage[i] === 0)
|
|
8439
|
+
markNeighbors(i);
|
|
8440
|
+
for (let i = 0; i < end; i++)
|
|
8441
|
+
markNeighbors(queue[i]);
|
|
8442
|
+
return {
|
|
8443
|
+
field,
|
|
8444
|
+
receiver,
|
|
8445
|
+
coverage,
|
|
8446
|
+
touchesUnknown,
|
|
8447
|
+
...accumulateTerrainWatersheds(receiver, { maxCells })
|
|
8448
|
+
};
|
|
8449
|
+
}
|
|
8377
8450
|
//# sourceMappingURL=index.cjs.map
|