@npm9912/v-map 0.1.0
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/LICENSE +21 -0
- package/README.md +185 -0
- package/dist/cjs/_commonjsHelpers-B83fTs8d.js +36 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/cesium-provider-BiFFyAl9.js +2598 -0
- package/dist/cjs/deck-provider-Ctq3Q8a1.js +47824 -0
- package/dist/cjs/geotiff-CEwvF9cG.js +47 -0
- package/dist/cjs/geotiff-source-RaNzzWkC.js +1522 -0
- package/dist/cjs/index-B1oGO1g-.js +10658 -0
- package/dist/cjs/index-B8LHqjyg.js +1765 -0
- package/dist/cjs/index-BIL4VsgP.js +310 -0
- package/dist/cjs/index-Blku2QY8.js +167 -0
- package/dist/cjs/index-CJvvX4yx.js +21 -0
- package/dist/cjs/index-CbVT-Con.js +699 -0
- package/dist/cjs/index-ISOEpMC3.js +20478 -0
- package/dist/cjs/index-JSwBbvGA.js +1621 -0
- package/dist/cjs/index.browser-DQhD8Jwl.js +6873 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/layer-extension-B_olS0rc.js +65 -0
- package/dist/cjs/leaflet-provider-DOqfs7g5.js +1815 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/main-dist-7TykwFci.js +2655 -0
- package/dist/cjs/messages-D7h4m8Tx.js +186 -0
- package/dist/cjs/openlayers-provider-Dfeg6L4n.js +1604 -0
- package/dist/cjs/polygon-layer-B9PrN7vr.js +1300 -0
- package/dist/cjs/scenegraph-layer-DwNoxQdi.js +2530 -0
- package/dist/cjs/styleconfig-CVRqArk-.js +23 -0
- package/dist/cjs/v-map-builder.cjs.entry.js +3786 -0
- package/dist/cjs/v-map-layer-geojson_12.cjs.entry.js +40894 -0
- package/dist/cjs/v-map-layer-helper-iAzxAg9I.js +285 -0
- package/dist/cjs/v-map-layer-terrain-geotiff.cjs.entry.js +258 -0
- package/dist/cjs/v-map-layercontrol.cjs.entry.js +247 -0
- package/dist/cjs/v-map.cjs.js +25 -0
- package/dist/cjs/v-map.v-map-layer-osm.v-map-layergroup-BsXp3BoL.js +582 -0
- package/dist/cjs/v-map_3.cjs.entry.js +12 -0
- package/dist/collection/collection-manifest.json +30 -0
- package/dist/collection/components/v-map/v-map.css +3 -0
- package/dist/collection/components/v-map/v-map.js +467 -0
- package/dist/collection/components/v-map/v-map.test.js +33 -0
- package/dist/collection/components/v-map-builder/v-map-builder.css +1 -0
- package/dist/collection/components/v-map-builder/v-map-builder.js +913 -0
- package/dist/collection/components/v-map-builder/v-map-builder.test.js +56 -0
- package/dist/collection/components/v-map-layer-geojson/v-map-layer-geojson.js +862 -0
- package/dist/collection/components/v-map-layer-geojson/v-map-layer-geojson.test.js +42 -0
- package/dist/collection/components/v-map-layer-geotiff/v-map-layer-geotiff.css +4 -0
- package/dist/collection/components/v-map-layer-geotiff/v-map-layer-geotiff.js +500 -0
- package/dist/collection/components/v-map-layer-geotiff/v-map-layer-geotiff.test.js +38 -0
- package/dist/collection/components/v-map-layer-google/v-map-layer-google.css +1 -0
- package/dist/collection/components/v-map-layer-google/v-map-layer-google.js +442 -0
- package/dist/collection/components/v-map-layer-osm/error-api.test.js +108 -0
- package/dist/collection/components/v-map-layer-osm/v-map-layer-osm.css +4 -0
- package/dist/collection/components/v-map-layer-osm/v-map-layer-osm.js +311 -0
- package/dist/collection/components/v-map-layer-osm/v-map-layer-osm.test.js +36 -0
- package/dist/collection/components/v-map-layer-scatterplot/v-map-layer-scatterplot.css +1 -0
- package/dist/collection/components/v-map-layer-scatterplot/v-map-layer-scatterplot.js +305 -0
- package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.css +3 -0
- package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.js +548 -0
- package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.test.js +36 -0
- package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.css +3 -0
- package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.js +735 -0
- package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.test.js +42 -0
- package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.css +3 -0
- package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.js +449 -0
- package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.test.js +50 -0
- package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.css +1 -0
- package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.js +448 -0
- package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.test.js +39 -0
- package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.css +1 -0
- package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.js +489 -0
- package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.test.js +43 -0
- package/dist/collection/components/v-map-layer-wkt/v-map-layer-wkt.css +1 -0
- package/dist/collection/components/v-map-layer-wkt/v-map-layer-wkt.js +811 -0
- package/dist/collection/components/v-map-layer-wkt/v-map-layer-wkt.test.js +34 -0
- package/dist/collection/components/v-map-layer-wms/v-map-layer-wms.css +1 -0
- package/dist/collection/components/v-map-layer-wms/v-map-layer-wms.js +453 -0
- package/dist/collection/components/v-map-layer-wms/v-map-layer-wms.test.js +36 -0
- package/dist/collection/components/v-map-layer-xyz/v-map-layer-xyz.css +1 -0
- package/dist/collection/components/v-map-layer-xyz/v-map-layer-xyz.js +331 -0
- package/dist/collection/components/v-map-layer-xyz/v-map-layer-xyz.test.js +28 -0
- package/dist/collection/components/v-map-layercontrol/v-map-layercontrol.css +74 -0
- package/dist/collection/components/v-map-layercontrol/v-map-layercontrol.js +277 -0
- package/dist/collection/components/v-map-layercontrol/v-map-layercontrol.test.js +134 -0
- package/dist/collection/components/v-map-layergroup/v-map-layergroup.css +4 -0
- package/dist/collection/components/v-map-layergroup/v-map-layergroup.js +212 -0
- package/dist/collection/components/v-map-layergroup/v-map-layergroup.test.js +39 -0
- package/dist/collection/components/v-map-style/v-map-style.css +38 -0
- package/dist/collection/components/v-map-style/v-map-style.js +492 -0
- package/dist/collection/components/v-map-style/v-map-style.unit.js +62 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/layer/v-map-layer-helper.js +281 -0
- package/dist/collection/layer/v-map-layer-helper.unit.js +234 -0
- package/dist/collection/lib/cesium-loader.js +58 -0
- package/dist/collection/lib/ensure-importmap.js +12 -0
- package/dist/collection/lib/ensure-importmap.unit.js +57 -0
- package/dist/collection/lib/versions.gen.js +6 -0
- package/dist/collection/lib/vstyle.js +8 -0
- package/dist/collection/map-provider/cesium/CesiumGeoTIFFTerrainProvider.js +285 -0
- package/dist/collection/map-provider/cesium/CesiumLayerGroups.js +159 -0
- package/dist/collection/map-provider/cesium/GeoTIFFImageryProvider.js +192 -0
- package/dist/collection/map-provider/cesium/GeoTIFFImageryProvider.test.js +57 -0
- package/dist/collection/map-provider/cesium/cesium-provider.js +1408 -0
- package/dist/collection/map-provider/cesium/i-layer.js +1 -0
- package/dist/collection/map-provider/cesium/layer-manager.js +467 -0
- package/dist/collection/map-provider/deck/DeckGLGeoTIFFLayer.js +483 -0
- package/dist/collection/map-provider/deck/DeckGLGeoTIFFTerrainLayer.js +410 -0
- package/dist/collection/map-provider/deck/LayerGroupWithModel.js +169 -0
- package/dist/collection/map-provider/deck/LayerGroups.js +192 -0
- package/dist/collection/map-provider/deck/LayerModel.js +1 -0
- package/dist/collection/map-provider/deck/RenderableGroup.js +1 -0
- package/dist/collection/map-provider/deck/deck-provider.js +1563 -0
- package/dist/collection/map-provider/geotiff/geotiff-source.js +172 -0
- package/dist/collection/map-provider/geotiff/utils/AABB2D.js +24 -0
- package/dist/collection/map-provider/geotiff/utils/BVHNode2D.js +166 -0
- package/dist/collection/map-provider/geotiff/utils/GeoTIFFTileProcessor.js +484 -0
- package/dist/collection/map-provider/geotiff/utils/Triangle.js +1 -0
- package/dist/collection/map-provider/geotiff/utils/Triangulation.js +321 -0
- package/dist/collection/map-provider/geotiff/utils/colormap-utils.js +190 -0
- package/dist/collection/map-provider/geotiff/utils/normalization-utils.js +122 -0
- package/dist/collection/map-provider/geotiff/utils/sampling-utils.js +108 -0
- package/dist/collection/map-provider/leaflet/GeoTIFFGridLayer.js +147 -0
- package/dist/collection/map-provider/leaflet/WCSGridLayer.js +124 -0
- package/dist/collection/map-provider/leaflet/google-map-tiles-layer.js +352 -0
- package/dist/collection/map-provider/leaflet/leaflet-helpers.js +94 -0
- package/dist/collection/map-provider/leaflet/leaflet-provider.js +1095 -0
- package/dist/collection/map-provider/ol/CustomGeoTiff.js +145 -0
- package/dist/collection/map-provider/ol/openlayers-helper.js +26 -0
- package/dist/collection/map-provider/ol/openlayers-provider.js +1427 -0
- package/dist/collection/map-provider/provider-factory.js +44 -0
- package/dist/collection/map-provider/provider-factory.unit.js +66 -0
- package/dist/collection/testing/browser-test-utils.js +49 -0
- package/dist/collection/testing/e2e-testing.js +122 -0
- package/dist/collection/testing/e2e-utils.js +70 -0
- package/dist/collection/testing/geotiff-test-server.js +100 -0
- package/dist/collection/testing/mocks/geostyler-lyrx-parser.js +12 -0
- package/dist/collection/testing/mocks/geostyler-mapbox-parser.js +12 -0
- package/dist/collection/testing/mocks/geostyler-qgis-parser.js +12 -0
- package/dist/collection/testing/mocks/geostyler-sld-parser.js +13 -0
- package/dist/collection/testing/mocks/geostyler-style.js +5 -0
- package/dist/collection/testing/setupTests.browser.js +1 -0
- package/dist/collection/testing/setupTests.stencil.js +20 -0
- package/dist/collection/testing/setupTests.vitest.js +59 -0
- package/dist/collection/testing/stencil-testing-wrapper.js +43 -0
- package/dist/collection/testing/styleMock.js +1 -0
- package/dist/collection/types/color.js +1 -0
- package/dist/collection/types/cssmode.js +1 -0
- package/dist/collection/types/flavour.js +1 -0
- package/dist/collection/types/layerconfig.js +1 -0
- package/dist/collection/types/lonlat.js +1 -0
- package/dist/collection/types/mapinitoptions.js +1 -0
- package/dist/collection/types/mapprovider.js +1 -0
- package/dist/collection/types/provideroptions.js +1 -0
- package/dist/collection/types/styleconfig.js +19 -0
- package/dist/collection/types/styling.js +13 -0
- package/dist/collection/types/styling.unit.js +37 -0
- package/dist/collection/types/vmaplayer.js +1 -0
- package/dist/collection/utils/async-mutex.js +28 -0
- package/dist/collection/utils/diff.js +142 -0
- package/dist/collection/utils/diff.unit.js +59 -0
- package/dist/collection/utils/dom-env.js +43 -0
- package/dist/collection/utils/dom-env.unit.js +92 -0
- package/dist/collection/utils/events.js +8 -0
- package/dist/collection/utils/logger.js +183 -0
- package/dist/collection/utils/logger.unit.js +98 -0
- package/dist/collection/utils/messages.js +12 -0
- package/dist/collection/utils/spatial-utils.js +27 -0
- package/dist/collection/utils/spatial-utils.unit.js +24 -0
- package/dist/components/_commonjsHelpers.js +1 -0
- package/dist/components/cesium-provider.js +1 -0
- package/dist/components/deck-provider.js +1 -0
- package/dist/components/events.js +1 -0
- package/dist/components/geotiff-source.js +1 -0
- package/dist/components/geotiff.js +4 -0
- package/dist/components/index.browser.js +15 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index2.js +1 -0
- package/dist/components/index3.js +1 -0
- package/dist/components/index4.js +1 -0
- package/dist/components/index5.js +1 -0
- package/dist/components/index6.js +1 -0
- package/dist/components/index7.js +1 -0
- package/dist/components/index8.js +7 -0
- package/dist/components/layer-extension.js +1 -0
- package/dist/components/leaflet-provider.js +1 -0
- package/dist/components/main-dist.js +1 -0
- package/dist/components/messages.js +1 -0
- package/dist/components/openlayers-provider.js +1 -0
- package/dist/components/polygon-layer.js +1 -0
- package/dist/components/scenegraph-layer.js +1 -0
- package/dist/components/styleconfig.js +1 -0
- package/dist/components/styling.js +1 -0
- package/dist/components/v-map-builder.d.ts +11 -0
- package/dist/components/v-map-builder.js +2 -0
- package/dist/components/v-map-layer-geojson.d.ts +11 -0
- package/dist/components/v-map-layer-geojson.js +1 -0
- package/dist/components/v-map-layer-geojson2.js +1 -0
- package/dist/components/v-map-layer-geotiff.d.ts +11 -0
- package/dist/components/v-map-layer-geotiff.js +1 -0
- package/dist/components/v-map-layer-geotiff2.js +1 -0
- package/dist/components/v-map-layer-google.d.ts +11 -0
- package/dist/components/v-map-layer-google.js +1 -0
- package/dist/components/v-map-layer-google2.js +1 -0
- package/dist/components/v-map-layer-helper.js +1 -0
- package/dist/components/v-map-layer-osm.d.ts +11 -0
- package/dist/components/v-map-layer-osm.js +1 -0
- package/dist/components/v-map-layer-osm2.js +1 -0
- package/dist/components/v-map-layer-scatterplot.d.ts +11 -0
- package/dist/components/v-map-layer-scatterplot.js +1 -0
- package/dist/components/v-map-layer-scatterplot2.js +1 -0
- package/dist/components/v-map-layer-terrain-geotiff.d.ts +11 -0
- package/dist/components/v-map-layer-terrain-geotiff.js +1 -0
- package/dist/components/v-map-layer-terrain.d.ts +11 -0
- package/dist/components/v-map-layer-terrain.js +1 -0
- package/dist/components/v-map-layer-terrain2.js +1 -0
- package/dist/components/v-map-layer-tile3d.d.ts +11 -0
- package/dist/components/v-map-layer-tile3d.js +1 -0
- package/dist/components/v-map-layer-tile3d2.js +1 -0
- package/dist/components/v-map-layer-wcs.d.ts +11 -0
- package/dist/components/v-map-layer-wcs.js +1 -0
- package/dist/components/v-map-layer-wcs2.js +1 -0
- package/dist/components/v-map-layer-wfs.d.ts +11 -0
- package/dist/components/v-map-layer-wfs.js +1 -0
- package/dist/components/v-map-layer-wfs2.js +1 -0
- package/dist/components/v-map-layer-wkt.d.ts +11 -0
- package/dist/components/v-map-layer-wkt.js +1 -0
- package/dist/components/v-map-layer-wkt2.js +1 -0
- package/dist/components/v-map-layer-wms.d.ts +11 -0
- package/dist/components/v-map-layer-wms.js +1 -0
- package/dist/components/v-map-layer-wms2.js +1 -0
- package/dist/components/v-map-layer-xyz.d.ts +11 -0
- package/dist/components/v-map-layer-xyz.js +1 -0
- package/dist/components/v-map-layer-xyz2.js +1 -0
- package/dist/components/v-map-layercontrol.d.ts +11 -0
- package/dist/components/v-map-layercontrol.js +1 -0
- package/dist/components/v-map-layergroup.d.ts +11 -0
- package/dist/components/v-map-layergroup.js +1 -0
- package/dist/components/v-map-layergroup2.js +1 -0
- package/dist/components/v-map-style.d.ts +11 -0
- package/dist/components/v-map-style.js +1 -0
- package/dist/components/v-map-style2.js +10 -0
- package/dist/components/v-map.d.ts +11 -0
- package/dist/components/v-map.js +1 -0
- package/dist/components/v-map2.js +1 -0
- package/dist/esm/_commonjsHelpers-E-ZsRS8r.js +32 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/cesium-provider-BJfAup3w.js +2596 -0
- package/dist/esm/deck-provider-C7U9VDEq.js +47709 -0
- package/dist/esm/geotiff-BEWxTIfH.js +45 -0
- package/dist/esm/geotiff-source-esnDnC-u.js +1516 -0
- package/dist/esm/index-B1zwA4IC.js +685 -0
- package/dist/esm/index-BBpiaTpT.js +165 -0
- package/dist/esm/index-BIEmlzCf.js +1697 -0
- package/dist/esm/index-BUHa4Jj0.js +307 -0
- package/dist/esm/index-DbSdn93t.js +20461 -0
- package/dist/esm/index-RpJarvr_.js +10656 -0
- package/dist/esm/index-jN06TXUp.js +14 -0
- package/dist/esm/index-jzneDarq.js +1613 -0
- package/dist/esm/index.browser-DhQAXuA7.js +6860 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/layer-extension-CZXK5goK.js +63 -0
- package/dist/esm/leaflet-provider-Q41TB6ku.js +1794 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/main-dist-CwnA7_Xn.js +2652 -0
- package/dist/esm/messages-CMKJzsgL.js +180 -0
- package/dist/esm/openlayers-provider-CMsDsQTQ.js +1602 -0
- package/dist/esm/polygon-layer-ByhxGhWC.js +1295 -0
- package/dist/esm/scenegraph-layer-09K_B6DT.js +2526 -0
- package/dist/esm/styleconfig-B-bAcABs.js +21 -0
- package/dist/esm/v-map-builder.entry.js +3784 -0
- package/dist/esm/v-map-layer-geojson_12.entry.js +40881 -0
- package/dist/esm/v-map-layer-helper-Dys44Cgo.js +283 -0
- package/dist/esm/v-map-layer-terrain-geotiff.entry.js +256 -0
- package/dist/esm/v-map-layercontrol.entry.js +245 -0
- package/dist/esm/v-map.js +21 -0
- package/dist/esm/v-map.v-map-layer-osm.v-map-layergroup-B4pFHuSf.js +572 -0
- package/dist/esm/v-map_3.entry.js +4 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/cesium-augment.d.ts +5 -0
- package/dist/types/components/v-map/v-map.d.ts +70 -0
- package/dist/types/components/v-map/v-map.test.d.ts +1 -0
- package/dist/types/components/v-map-builder/v-map-builder.d.ts +48 -0
- package/dist/types/components/v-map-builder/v-map-builder.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-geojson/v-map-layer-geojson.d.ts +129 -0
- package/dist/types/components/v-map-layer-geojson/v-map-layer-geojson.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-geotiff/v-map-layer-geotiff.d.ts +74 -0
- package/dist/types/components/v-map-layer-geotiff/v-map-layer-geotiff.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-google/v-map-layer-google.d.ts +78 -0
- package/dist/types/components/v-map-layer-osm/error-api.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-osm/v-map-layer-osm.d.ts +50 -0
- package/dist/types/components/v-map-layer-osm/v-map-layer-osm.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-scatterplot/v-map-layer-scatterplot.d.ts +54 -0
- package/dist/types/components/v-map-layer-terrain/v-map-layer-terrain.d.ts +74 -0
- package/dist/types/components/v-map-layer-terrain/v-map-layer-terrain.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.d.ts +117 -0
- package/dist/types/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-tile3d/v-map-layer-tile3d.d.ts +69 -0
- package/dist/types/components/v-map-layer-tile3d/v-map-layer-tile3d.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-wcs/v-map-layer-wcs.d.ts +47 -0
- package/dist/types/components/v-map-layer-wcs/v-map-layer-wcs.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-wfs/v-map-layer-wfs.d.ts +59 -0
- package/dist/types/components/v-map-layer-wfs/v-map-layer-wfs.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-wkt/v-map-layer-wkt.d.ts +132 -0
- package/dist/types/components/v-map-layer-wkt/v-map-layer-wkt.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-wms/v-map-layer-wms.d.ts +76 -0
- package/dist/types/components/v-map-layer-wms/v-map-layer-wms.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-xyz/v-map-layer-xyz.d.ts +59 -0
- package/dist/types/components/v-map-layer-xyz/v-map-layer-xyz.test.d.ts +1 -0
- package/dist/types/components/v-map-layercontrol/v-map-layercontrol.d.ts +44 -0
- package/dist/types/components/v-map-layercontrol/v-map-layercontrol.test.d.ts +1 -0
- package/dist/types/components/v-map-layergroup/v-map-layergroup.d.ts +31 -0
- package/dist/types/components/v-map-layergroup/v-map-layergroup.test.d.ts +1 -0
- package/dist/types/components/v-map-style/v-map-style.d.ts +75 -0
- package/dist/types/components/v-map-style/v-map-style.unit.d.ts +1 -0
- package/dist/types/components.d.ts +2391 -0
- package/dist/types/globals.d.ts +16 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/layer/v-map-layer-helper.d.ts +45 -0
- package/dist/types/layer/v-map-layer-helper.unit.d.ts +1 -0
- package/dist/types/leaflet-augment.d.ts +15 -0
- package/dist/types/lib/cesium-loader.d.ts +3 -0
- package/dist/types/lib/ensure-importmap.d.ts +3 -0
- package/dist/types/lib/ensure-importmap.unit.d.ts +1 -0
- package/dist/types/lib/versions.gen.d.ts +5 -0
- package/dist/types/lib/vstyle.d.ts +44 -0
- package/dist/types/map-provider/cesium/CesiumGeoTIFFTerrainProvider.d.ts +92 -0
- package/dist/types/map-provider/cesium/CesiumLayerGroups.d.ts +64 -0
- package/dist/types/map-provider/cesium/GeoTIFFImageryProvider.d.ts +75 -0
- package/dist/types/map-provider/cesium/GeoTIFFImageryProvider.test.d.ts +1 -0
- package/dist/types/map-provider/cesium/cesium-provider.d.ts +87 -0
- package/dist/types/map-provider/cesium/i-layer.d.ts +11 -0
- package/dist/types/map-provider/cesium/layer-manager.d.ts +31 -0
- package/dist/types/map-provider/deck/DeckGLGeoTIFFLayer.d.ts +91 -0
- package/dist/types/map-provider/deck/DeckGLGeoTIFFTerrainLayer.d.ts +82 -0
- package/dist/types/map-provider/deck/LayerGroupWithModel.d.ts +55 -0
- package/dist/types/map-provider/deck/LayerGroups.d.ts +63 -0
- package/dist/types/map-provider/deck/LayerModel.d.ts +8 -0
- package/dist/types/map-provider/deck/RenderableGroup.d.ts +20 -0
- package/dist/types/map-provider/deck/deck-provider.d.ts +92 -0
- package/dist/types/map-provider/geotiff/geotiff-source.d.ts +30 -0
- package/dist/types/map-provider/geotiff/utils/AABB2D.d.ts +28 -0
- package/dist/types/map-provider/geotiff/utils/BVHNode2D.d.ts +36 -0
- package/dist/types/map-provider/geotiff/utils/GeoTIFFTileProcessor.d.ts +116 -0
- package/dist/types/map-provider/geotiff/utils/Triangle.d.ts +5 -0
- package/dist/types/map-provider/geotiff/utils/Triangulation.d.ts +94 -0
- package/dist/types/map-provider/geotiff/utils/colormap-utils.d.ts +47 -0
- package/dist/types/map-provider/geotiff/utils/normalization-utils.d.ts +39 -0
- package/dist/types/map-provider/geotiff/utils/sampling-utils.d.ts +13 -0
- package/dist/types/map-provider/leaflet/GeoTIFFGridLayer.d.ts +34 -0
- package/dist/types/map-provider/leaflet/WCSGridLayer.d.ts +38 -0
- package/dist/types/map-provider/leaflet/google-map-tiles-layer.d.ts +73 -0
- package/dist/types/map-provider/leaflet/leaflet-helpers.d.ts +6 -0
- package/dist/types/map-provider/leaflet/leaflet-provider.d.ts +73 -0
- package/dist/types/map-provider/ol/CustomGeoTiff.d.ts +14 -0
- package/dist/types/map-provider/ol/openlayers-helper.d.ts +2 -0
- package/dist/types/map-provider/ol/openlayers-provider.d.ts +80 -0
- package/dist/types/map-provider/provider-factory.d.ts +12 -0
- package/dist/types/map-provider/provider-factory.unit.d.ts +1 -0
- package/dist/types/namespaces.d.ts +3 -0
- package/dist/types/ol-augment.d.ts +3 -0
- package/dist/types/ol-override.d.ts +7 -0
- package/dist/types/ol.d.ts +10 -0
- package/dist/types/stencil-public-runtime.d.ts +1860 -0
- package/dist/types/testing/browser-test-utils.d.ts +6 -0
- package/dist/types/testing/e2e-testing.d.ts +5 -0
- package/dist/types/testing/e2e-utils.d.ts +4 -0
- package/dist/types/testing/geotiff-test-server.d.ts +5 -0
- package/dist/types/testing/mocks/geostyler-lyrx-parser.d.ts +11 -0
- package/dist/types/testing/mocks/geostyler-mapbox-parser.d.ts +11 -0
- package/dist/types/testing/mocks/geostyler-qgis-parser.d.ts +11 -0
- package/dist/types/testing/mocks/geostyler-sld-parser.d.ts +11 -0
- package/dist/types/testing/mocks/geostyler-style.d.ts +5 -0
- package/dist/types/testing/setupTests.browser.d.ts +1 -0
- package/dist/types/testing/setupTests.stencil.d.ts +1 -0
- package/dist/types/testing/setupTests.vitest.d.ts +1 -0
- package/dist/types/testing/stencil-testing-wrapper.d.ts +3 -0
- package/dist/types/types/color.d.ts +1 -0
- package/dist/types/types/cssmode.d.ts +1 -0
- package/dist/types/types/flavour.d.ts +1 -0
- package/dist/types/types/layerconfig.d.ts +207 -0
- package/dist/types/types/lonlat.d.ts +1 -0
- package/dist/types/types/mapinitoptions.d.ts +4 -0
- package/dist/types/types/mapprovider.d.ts +46 -0
- package/dist/types/types/provideroptions.d.ts +8 -0
- package/dist/types/types/styleconfig.d.ts +27 -0
- package/dist/types/types/styling.d.ts +24 -0
- package/dist/types/types/styling.unit.d.ts +1 -0
- package/dist/types/types/vmaplayer.d.ts +10 -0
- package/dist/types/utils/async-mutex.d.ts +7 -0
- package/dist/types/utils/diff.d.ts +64 -0
- package/dist/types/utils/diff.unit.d.ts +1 -0
- package/dist/types/utils/dom-env.d.ts +5 -0
- package/dist/types/utils/dom-env.unit.d.ts +1 -0
- package/dist/types/utils/events.d.ts +29 -0
- package/dist/types/utils/logger.d.ts +47 -0
- package/dist/types/utils/logger.unit.d.ts +1 -0
- package/dist/types/utils/messages.d.ts +12 -0
- package/dist/types/utils/spatial-utils.d.ts +6 -0
- package/dist/types/utils/spatial-utils.unit.d.ts +1 -0
- package/dist/types/versions.d.ts +7 -0
- package/dist/v-map/index.esm.js +0 -0
- package/dist/v-map/p--vVleK-M.js +1 -0
- package/dist/v-map/p-09d10db0.entry.js +1 -0
- package/dist/v-map/p-5eba6058.entry.js +10 -0
- package/dist/v-map/p-6b102336.entry.js +1 -0
- package/dist/v-map/p-B-bAcABs.js +1 -0
- package/dist/v-map/p-BBpiaTpT.js +1 -0
- package/dist/v-map/p-BdijL4Av.js +1 -0
- package/dist/v-map/p-Be3r33VF.js +4 -0
- package/dist/v-map/p-BeFu0ap4.js +1 -0
- package/dist/v-map/p-BxFJezdK.js +1 -0
- package/dist/v-map/p-CMKJzsgL.js +1 -0
- package/dist/v-map/p-CXfA_q8m.js +1 -0
- package/dist/v-map/p-CZqY0yW4.js +1 -0
- package/dist/v-map/p-CafTHT9i.js +1 -0
- package/dist/v-map/p-DCTHyf58.js +1 -0
- package/dist/v-map/p-DQuL1Twl.js +1 -0
- package/dist/v-map/p-DR9McdNX.js +1 -0
- package/dist/v-map/p-Dckgonw8.js +1 -0
- package/dist/v-map/p-DhQAXuA7.js +15 -0
- package/dist/v-map/p-DmICdG34.js +7 -0
- package/dist/v-map/p-DrOQ9V4h.js +1 -0
- package/dist/v-map/p-DvHXtWUg.js +1 -0
- package/dist/v-map/p-E-ZsRS8r.js +1 -0
- package/dist/v-map/p-MyTSFnEk.js +1 -0
- package/dist/v-map/p-RpJarvr_.js +1 -0
- package/dist/v-map/p-WaMDUuAz.js +1 -0
- package/dist/v-map/p-aa410e64.entry.js +2 -0
- package/dist/v-map/p-c21c93fe.entry.js +1 -0
- package/dist/v-map/p-jzneDarq.js +2 -0
- package/dist/v-map/p-uiIP-taz.js +1 -0
- package/dist/v-map/v-map.esm.js +1 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +193 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { log, warn } from "../../utils/logger";
|
|
2
|
+
//const DEFAULT_TO_PROJECTION = 'EPSG:3857';
|
|
3
|
+
export async function loadGeoTIFFSource(url, options, deps) {
|
|
4
|
+
const { geotiff, proj4, geokeysToProj4 } = deps;
|
|
5
|
+
const { fromUrl } = geotiff;
|
|
6
|
+
const { toProj4 } = geokeysToProj4;
|
|
7
|
+
let tiff = null;
|
|
8
|
+
let lasterr = null;
|
|
9
|
+
for (let i = 0; i <= 2; i++) {
|
|
10
|
+
try {
|
|
11
|
+
tiff = await fromUrl(url, {
|
|
12
|
+
allowFullFile: true,
|
|
13
|
+
blockSize: 1024 * 1024, // 1MB blocks to reduce HTTP range-request count for non-COG files
|
|
14
|
+
cacheSize: 100,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
lasterr = err;
|
|
19
|
+
}
|
|
20
|
+
if (tiff != null) {
|
|
21
|
+
lasterr = null;
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (lasterr != null) {
|
|
26
|
+
log(lasterr);
|
|
27
|
+
warn('Error - loadGeoTIFFSource - fromUrl: ', url);
|
|
28
|
+
throw lasterr;
|
|
29
|
+
}
|
|
30
|
+
const baseImage = await tiff.getImage(0);
|
|
31
|
+
const imageCount = await tiff.getImageCount();
|
|
32
|
+
const overviewImages = [];
|
|
33
|
+
for (let i = 1; i < imageCount; i++) {
|
|
34
|
+
overviewImages.push(await tiff.getImage(i));
|
|
35
|
+
}
|
|
36
|
+
const width = baseImage.getWidth();
|
|
37
|
+
const height = baseImage.getHeight();
|
|
38
|
+
const samplesPerPixel = Math.max(1, baseImage.getSamplesPerPixel?.() ?? 1);
|
|
39
|
+
let fromProjection = options.forceProjection && options.projection
|
|
40
|
+
? options.projection
|
|
41
|
+
: options.projection ?? 'EPSG:4326';
|
|
42
|
+
let proj4String = null;
|
|
43
|
+
if (!options.forceProjection) {
|
|
44
|
+
const geoKeys = typeof baseImage.getGeoKeys === 'function'
|
|
45
|
+
? baseImage.getGeoKeys() ?? null
|
|
46
|
+
: null;
|
|
47
|
+
if (geoKeys) {
|
|
48
|
+
try {
|
|
49
|
+
const projParams = toProj4(geoKeys);
|
|
50
|
+
const epsg = geoKeys.ProjectedCSTypeGeoKey ?? geoKeys.GeographicTypeGeoKey;
|
|
51
|
+
if (epsg) {
|
|
52
|
+
fromProjection = `EPSG:${epsg}`;
|
|
53
|
+
}
|
|
54
|
+
if (projParams?.proj4) {
|
|
55
|
+
proj4String = projParams.proj4;
|
|
56
|
+
const numericCode = String(epsg);
|
|
57
|
+
if (epsg && !proj4.defs(fromProjection)) {
|
|
58
|
+
proj4.defs(fromProjection, projParams.proj4);
|
|
59
|
+
}
|
|
60
|
+
if (epsg && !proj4.defs(numericCode)) {
|
|
61
|
+
proj4.defs(numericCode, projParams.proj4);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
warn('v-map - geotiff - failed to parse GeoKeys', err);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (!proj4String) {
|
|
71
|
+
switch (fromProjection) {
|
|
72
|
+
case 'EPSG:4326':
|
|
73
|
+
proj4String = '+proj=longlat +datum=WGS84 +no_defs';
|
|
74
|
+
break;
|
|
75
|
+
case 'EPSG:3857':
|
|
76
|
+
proj4String =
|
|
77
|
+
'+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs';
|
|
78
|
+
break;
|
|
79
|
+
case 'EPSG:32632':
|
|
80
|
+
proj4String = '+proj=utm +zone=32 +datum=WGS84 +units=m +no_defs';
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (!fromProjection || fromProjection.trim() === '') {
|
|
85
|
+
fromProjection = 'EPSG:4326';
|
|
86
|
+
}
|
|
87
|
+
if (proj4String && !proj4.defs(fromProjection)) {
|
|
88
|
+
proj4.defs(fromProjection, proj4String);
|
|
89
|
+
}
|
|
90
|
+
const sourceBounds = baseImage.getBoundingBox();
|
|
91
|
+
const sourceRef = [sourceBounds[0], sourceBounds[1]];
|
|
92
|
+
const resolution = baseImage.getResolution()[0];
|
|
93
|
+
const rawNoData = options.nodata !== undefined && options.nodata !== null
|
|
94
|
+
? Number(options.nodata)
|
|
95
|
+
: typeof baseImage.getGDALNoData === 'function'
|
|
96
|
+
? baseImage.getGDALNoData()
|
|
97
|
+
: undefined;
|
|
98
|
+
const noDataValue = rawNoData !== undefined && rawNoData !== null
|
|
99
|
+
? Number(rawNoData)
|
|
100
|
+
: undefined;
|
|
101
|
+
const clampLon = (lon) => Math.max(-180, Math.min(180, Number.isFinite(lon) ? lon : 0));
|
|
102
|
+
const clampLat = (lat) => Math.max(-90, Math.min(90, Number.isFinite(lat) ? lat : 0));
|
|
103
|
+
let transformToWgs84;
|
|
104
|
+
if (!fromProjection || fromProjection === 'EPSG:4326') {
|
|
105
|
+
transformToWgs84 = coord => coord;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
transformToWgs84 = (coord) => {
|
|
109
|
+
try {
|
|
110
|
+
const result = proj4(fromProjection, 'EPSG:4326', coord);
|
|
111
|
+
return [Number(result[0]), Number(result[1])];
|
|
112
|
+
}
|
|
113
|
+
catch (err) {
|
|
114
|
+
warn('v-map - geotiff - transform to WGS84 failed, falling back', err);
|
|
115
|
+
return coord;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
const [minX, minY, maxX, maxY] = sourceBounds;
|
|
120
|
+
const corners = [
|
|
121
|
+
transformToWgs84([minX, minY]),
|
|
122
|
+
transformToWgs84([maxX, minY]),
|
|
123
|
+
transformToWgs84([maxX, maxY]),
|
|
124
|
+
transformToWgs84([minX, maxY]),
|
|
125
|
+
];
|
|
126
|
+
const west = clampLon(Math.min(...corners.map(c => c[0])));
|
|
127
|
+
const east = clampLon(Math.max(...corners.map(c => c[0])));
|
|
128
|
+
const south = clampLat(Math.min(...corners.map(c => c[1])));
|
|
129
|
+
const north = clampLat(Math.max(...corners.map(c => c[1])));
|
|
130
|
+
log('v-map - geotiff - loaded source', {
|
|
131
|
+
url,
|
|
132
|
+
width,
|
|
133
|
+
height,
|
|
134
|
+
samplesPerPixel,
|
|
135
|
+
fromProjection,
|
|
136
|
+
bounds: sourceBounds,
|
|
137
|
+
});
|
|
138
|
+
return {
|
|
139
|
+
tiff,
|
|
140
|
+
baseImage,
|
|
141
|
+
overviewImages,
|
|
142
|
+
width,
|
|
143
|
+
height,
|
|
144
|
+
samplesPerPixel,
|
|
145
|
+
fromProjection,
|
|
146
|
+
//toProjection: DEFAULT_TO_PROJECTION,
|
|
147
|
+
sourceBounds,
|
|
148
|
+
sourceRef,
|
|
149
|
+
resolution,
|
|
150
|
+
proj4,
|
|
151
|
+
noDataValue,
|
|
152
|
+
wgs84Bounds: [west, south, east, north],
|
|
153
|
+
transformToWgs84,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
export async function getGeoTIFFSource(url, projection, forceProjection, nodata) {
|
|
157
|
+
const [geotiffModule, { default: proj4 }, geokeysModule] = await Promise.all([
|
|
158
|
+
import('geotiff'),
|
|
159
|
+
import('proj4'),
|
|
160
|
+
import('geotiff-geokeys-to-proj4'),
|
|
161
|
+
]);
|
|
162
|
+
const source = await loadGeoTIFFSource(url, {
|
|
163
|
+
projection: projection,
|
|
164
|
+
forceProjection: forceProjection,
|
|
165
|
+
nodata: nodata,
|
|
166
|
+
}, {
|
|
167
|
+
geotiff: geotiffModule,
|
|
168
|
+
proj4,
|
|
169
|
+
geokeysToProj4: geokeysModule,
|
|
170
|
+
});
|
|
171
|
+
return source;
|
|
172
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export class AABB2D {
|
|
2
|
+
min;
|
|
3
|
+
max;
|
|
4
|
+
constructor(min, max) {
|
|
5
|
+
this.min = min;
|
|
6
|
+
this.max = max;
|
|
7
|
+
}
|
|
8
|
+
contains(point) {
|
|
9
|
+
return (point.x >= this.min.x &&
|
|
10
|
+
point.x <= this.max.x &&
|
|
11
|
+
point.y >= this.min.y &&
|
|
12
|
+
point.y <= this.max.y);
|
|
13
|
+
}
|
|
14
|
+
static fromTriangle(triangle) {
|
|
15
|
+
const minX = Math.min(triangle.a.x, triangle.b.x, triangle.c.x);
|
|
16
|
+
const minY = Math.min(triangle.a.y, triangle.b.y, triangle.c.y);
|
|
17
|
+
const maxX = Math.max(triangle.a.x, triangle.b.x, triangle.c.x);
|
|
18
|
+
const maxY = Math.max(triangle.a.y, triangle.b.y, triangle.c.y);
|
|
19
|
+
return new AABB2D({ x: minX, y: minY }, { x: maxX, y: maxY });
|
|
20
|
+
}
|
|
21
|
+
static union(a, b) {
|
|
22
|
+
return new AABB2D({ x: Math.min(a.min.x, b.min.x), y: Math.min(a.min.y, b.min.y) }, { x: Math.max(a.max.x, b.max.x), y: Math.max(a.max.y, b.max.y) });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { AABB2D } from "./AABB2D";
|
|
2
|
+
export class BVHNode2D {
|
|
3
|
+
bbox;
|
|
4
|
+
triangles;
|
|
5
|
+
left;
|
|
6
|
+
right;
|
|
7
|
+
constructor(bbox, triangles = [], left = null, right = null) {
|
|
8
|
+
this.bbox = bbox;
|
|
9
|
+
this.triangles = triangles;
|
|
10
|
+
this.left = left;
|
|
11
|
+
this.right = right;
|
|
12
|
+
}
|
|
13
|
+
static build(triangles, depth = 0, maxDepth = 10) {
|
|
14
|
+
if (triangles.length <= 2 || depth >= maxDepth) {
|
|
15
|
+
let bbox = AABB2D.fromTriangle(triangles[0]);
|
|
16
|
+
for (let i = 1; i < triangles.length; i++) {
|
|
17
|
+
bbox = AABB2D.union(bbox, AABB2D.fromTriangle(triangles[i]));
|
|
18
|
+
}
|
|
19
|
+
return new BVHNode2D(bbox, triangles);
|
|
20
|
+
}
|
|
21
|
+
const centroids = triangles.map(t => ({
|
|
22
|
+
x: (t.a.x + t.b.x + t.c.x) / 3,
|
|
23
|
+
y: (t.a.y + t.b.y + t.c.y) / 3,
|
|
24
|
+
}));
|
|
25
|
+
const { min, max } = centroids.reduce((acc, c) => ({
|
|
26
|
+
min: { x: Math.min(acc.min.x, c.x), y: Math.min(acc.min.y, c.y) },
|
|
27
|
+
max: { x: Math.max(acc.max.x, c.x), y: Math.max(acc.max.y, c.y) },
|
|
28
|
+
}), { min: centroids[0], max: centroids[0] });
|
|
29
|
+
const axis = max.x - min.x > max.y - min.y ? 'x' : 'y';
|
|
30
|
+
centroids.sort((a, b) => a[axis] - b[axis]);
|
|
31
|
+
const mid = Math.floor(centroids.length / 2);
|
|
32
|
+
const leftTriangles = [];
|
|
33
|
+
const rightTriangles = [];
|
|
34
|
+
for (let i = 0; i < triangles.length; i++) {
|
|
35
|
+
(i < mid ? leftTriangles : rightTriangles).push(triangles[i]);
|
|
36
|
+
}
|
|
37
|
+
const left = BVHNode2D.build(leftTriangles, depth + 1, maxDepth);
|
|
38
|
+
const right = BVHNode2D.build(rightTriangles, depth + 1, maxDepth);
|
|
39
|
+
const bbox = AABB2D.union(left.bbox, right.bbox);
|
|
40
|
+
return new BVHNode2D(bbox, [], left, right);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Finds the triangle containing the given point.
|
|
44
|
+
* @param point The point to test.
|
|
45
|
+
* @returns The containing triangle or `null`.
|
|
46
|
+
*/
|
|
47
|
+
findContainingTriangle(point) {
|
|
48
|
+
if (!this.bbox.contains(point)) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
if (this.triangles.length > 0) {
|
|
52
|
+
for (const triangle of this.triangles) {
|
|
53
|
+
if (BVHNode2D.punktInDreieck2D(point, triangle)) {
|
|
54
|
+
return triangle;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
return (this.left?.findContainingTriangle(point) ||
|
|
60
|
+
this.right?.findContainingTriangle(point) ||
|
|
61
|
+
null);
|
|
62
|
+
}
|
|
63
|
+
static punktInDreieck2D(p, triangle) {
|
|
64
|
+
const { a, b, c } = triangle;
|
|
65
|
+
const v0 = { x: c.x - a.x, y: c.y - a.y };
|
|
66
|
+
const v1 = { x: b.x - a.x, y: b.y - a.y };
|
|
67
|
+
const v2 = { x: p.x - a.x, y: p.y - a.y };
|
|
68
|
+
const dot00 = v0.x * v0.x + v0.y * v0.y;
|
|
69
|
+
const dot01 = v0.x * v1.x + v0.y * v1.y;
|
|
70
|
+
const dot02 = v0.x * v2.x + v0.y * v2.y;
|
|
71
|
+
const dot11 = v1.x * v1.x + v1.y * v1.y;
|
|
72
|
+
const dot12 = v1.x * v2.x + v1.y * v2.y;
|
|
73
|
+
const invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
|
|
74
|
+
const u = (dot11 * dot02 - dot01 * dot12) * invDenom;
|
|
75
|
+
const v = (dot00 * dot12 - dot01 * dot02) * invDenom;
|
|
76
|
+
return u >= 0 && v >= 0 && u + v <= 1;
|
|
77
|
+
//return u >= 0 && v >= 0 && u + v < 1;
|
|
78
|
+
}
|
|
79
|
+
static toTriangle2D(triangle) {
|
|
80
|
+
return {
|
|
81
|
+
a: { x: triangle.target[0][0], y: triangle.target[0][1] },
|
|
82
|
+
b: { x: triangle.target[1][0], y: triangle.target[1][1] },
|
|
83
|
+
c: { x: triangle.target[2][0], y: triangle.target[2][1] },
|
|
84
|
+
triangle: triangle,
|
|
85
|
+
transform: null,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Returns a string representation of the BVH tree structure
|
|
90
|
+
* @param indent - Internal parameter for recursive formatting
|
|
91
|
+
* @returns Formatted string showing tree structure
|
|
92
|
+
*/
|
|
93
|
+
toString(indent = '') {
|
|
94
|
+
const isLeaf = this.triangles.length > 0;
|
|
95
|
+
const nodeType = isLeaf ? 'LEAF' : 'NODE';
|
|
96
|
+
const bboxStr = `[${this.bbox.min.x.toFixed(2)}, ${this.bbox.min.y.toFixed(2)}, ${this.bbox.max.x.toFixed(2)}, ${this.bbox.max.y.toFixed(2)}]`;
|
|
97
|
+
let result = `${indent}${nodeType} bbox=${bboxStr}`;
|
|
98
|
+
if (isLeaf) {
|
|
99
|
+
const triArray = this.triangles.map(t2D => t2D.a.x.toFixed(2) +
|
|
100
|
+
',' +
|
|
101
|
+
t2D.a.y.toFixed(2) +
|
|
102
|
+
' ' +
|
|
103
|
+
t2D.b.x.toFixed(2) +
|
|
104
|
+
',' +
|
|
105
|
+
t2D.b.y.toFixed(2) +
|
|
106
|
+
' ' +
|
|
107
|
+
t2D.c.x.toFixed(2) +
|
|
108
|
+
',' +
|
|
109
|
+
t2D.c.y.toFixed(2));
|
|
110
|
+
const triArrayStr = triArray.toString();
|
|
111
|
+
result += ` triangles=${this.triangles.length} - ${triArrayStr}`;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
result += '\n';
|
|
115
|
+
if (this.left) {
|
|
116
|
+
result += `${indent}├─ left:\n${this.left.toString(indent + '│ ')}`;
|
|
117
|
+
}
|
|
118
|
+
if (this.right) {
|
|
119
|
+
result += `${indent}└─ right:\n${this.right.toString(indent + ' ')}`;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return result;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get statistics about the BVH tree
|
|
126
|
+
* @returns Object with tree statistics
|
|
127
|
+
*/
|
|
128
|
+
getStats() {
|
|
129
|
+
const stats = {
|
|
130
|
+
depth: 1,
|
|
131
|
+
nodeCount: 1,
|
|
132
|
+
leafCount: 0,
|
|
133
|
+
triangleCount: this.triangles.length,
|
|
134
|
+
minTrianglesPerLeaf: Infinity,
|
|
135
|
+
maxTrianglesPerLeaf: 0,
|
|
136
|
+
};
|
|
137
|
+
if (this.triangles.length > 0) {
|
|
138
|
+
// This is a leaf
|
|
139
|
+
stats.leafCount = 1;
|
|
140
|
+
stats.minTrianglesPerLeaf = this.triangles.length;
|
|
141
|
+
stats.maxTrianglesPerLeaf = this.triangles.length;
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
// This is an internal node
|
|
145
|
+
if (this.left) {
|
|
146
|
+
const leftStats = this.left.getStats();
|
|
147
|
+
stats.depth = Math.max(stats.depth, leftStats.depth + 1);
|
|
148
|
+
stats.nodeCount += leftStats.nodeCount;
|
|
149
|
+
stats.leafCount += leftStats.leafCount;
|
|
150
|
+
stats.triangleCount += leftStats.triangleCount;
|
|
151
|
+
stats.minTrianglesPerLeaf = Math.min(stats.minTrianglesPerLeaf, leftStats.minTrianglesPerLeaf);
|
|
152
|
+
stats.maxTrianglesPerLeaf = Math.max(stats.maxTrianglesPerLeaf, leftStats.maxTrianglesPerLeaf);
|
|
153
|
+
}
|
|
154
|
+
if (this.right) {
|
|
155
|
+
const rightStats = this.right.getStats();
|
|
156
|
+
stats.depth = Math.max(stats.depth, rightStats.depth + 1);
|
|
157
|
+
stats.nodeCount += rightStats.nodeCount;
|
|
158
|
+
stats.leafCount += rightStats.leafCount;
|
|
159
|
+
stats.triangleCount += rightStats.triangleCount;
|
|
160
|
+
stats.minTrianglesPerLeaf = Math.min(stats.minTrianglesPerLeaf, rightStats.minTrianglesPerLeaf);
|
|
161
|
+
stats.maxTrianglesPerLeaf = Math.max(stats.maxTrianglesPerLeaf, rightStats.maxTrianglesPerLeaf);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return stats;
|
|
165
|
+
}
|
|
166
|
+
}
|