@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,281 @@
|
|
|
1
|
+
import { VMapEvents } from "../utils/events";
|
|
2
|
+
import { log, warn } from "../utils/logger";
|
|
3
|
+
export class VMapLayerHelper {
|
|
4
|
+
el;
|
|
5
|
+
static RUNTIME_ERROR_DEBOUNCE_MS = 5000;
|
|
6
|
+
layerId = null;
|
|
7
|
+
mapProvider = null;
|
|
8
|
+
_error;
|
|
9
|
+
host;
|
|
10
|
+
initContext;
|
|
11
|
+
listenersBound = false;
|
|
12
|
+
recreateInFlight = false;
|
|
13
|
+
lastRuntimeErrorTime = 0;
|
|
14
|
+
constructor(el, host) {
|
|
15
|
+
this.el = el;
|
|
16
|
+
this.host = host;
|
|
17
|
+
}
|
|
18
|
+
// ── Error / State management ──────────────────────────────────────
|
|
19
|
+
startLoading() {
|
|
20
|
+
// Keep the last error visible during retry until success or new error
|
|
21
|
+
this.host?.setLoadState('loading');
|
|
22
|
+
}
|
|
23
|
+
markReady() {
|
|
24
|
+
this.clearError();
|
|
25
|
+
this.host?.setLoadState('ready');
|
|
26
|
+
}
|
|
27
|
+
markUpdated() {
|
|
28
|
+
// Semantically separate success path for updates, currently identical to markReady()
|
|
29
|
+
this.markReady();
|
|
30
|
+
}
|
|
31
|
+
setError(detail) {
|
|
32
|
+
this._error = detail;
|
|
33
|
+
this.host?.setLoadState('error');
|
|
34
|
+
this.el.dispatchEvent(new CustomEvent(VMapEvents.Error, {
|
|
35
|
+
detail,
|
|
36
|
+
bubbles: true,
|
|
37
|
+
composed: true,
|
|
38
|
+
}));
|
|
39
|
+
warn(`${this.el.nodeName.toLowerCase()} - ${detail.message}`);
|
|
40
|
+
}
|
|
41
|
+
setRuntimeError(detail) {
|
|
42
|
+
const now = Date.now();
|
|
43
|
+
if (now - this.lastRuntimeErrorTime < VMapLayerHelper.RUNTIME_ERROR_DEBOUNCE_MS) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this.lastRuntimeErrorTime = now;
|
|
47
|
+
this.setError(detail);
|
|
48
|
+
}
|
|
49
|
+
clearError() {
|
|
50
|
+
this._error = undefined;
|
|
51
|
+
this.lastRuntimeErrorTime = 0;
|
|
52
|
+
}
|
|
53
|
+
getError() {
|
|
54
|
+
return this._error;
|
|
55
|
+
}
|
|
56
|
+
// ── Layer operations ──────────────────────────────────────────────
|
|
57
|
+
async addLayer(basemapid, groupId, groupVisible, layerConfig, layerElementId) {
|
|
58
|
+
if (!this.mapProvider) {
|
|
59
|
+
warn('Map provider not available.');
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
if (basemapid) {
|
|
63
|
+
return await this.mapProvider?.addBaseLayer({
|
|
64
|
+
...layerConfig,
|
|
65
|
+
groupId: groupId,
|
|
66
|
+
groupVisible: groupVisible,
|
|
67
|
+
}, basemapid, layerElementId);
|
|
68
|
+
}
|
|
69
|
+
return await this.mapProvider?.addLayerToGroup({
|
|
70
|
+
...layerConfig,
|
|
71
|
+
groupId: groupId,
|
|
72
|
+
groupVisible: groupVisible,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
async addToMapInternal(group, vmap, createLayerConfig, elementId) {
|
|
76
|
+
if (this.layerId) {
|
|
77
|
+
this.unregisterLayerError();
|
|
78
|
+
await this.mapProvider?.removeLayer(this.layerId);
|
|
79
|
+
this.layerId = null;
|
|
80
|
+
}
|
|
81
|
+
const isMapProviderAvailable = (await vmap.isMapProviderReady?.()) === true;
|
|
82
|
+
if (isMapProviderAvailable) {
|
|
83
|
+
log(`${this.el.nodeName.toLowerCase()} - layer is being added`);
|
|
84
|
+
this.mapProvider = vmap.__vMapProvider ?? null;
|
|
85
|
+
const groupId = await group.getGroupId();
|
|
86
|
+
const groupVisible = await group.visible;
|
|
87
|
+
if (this.layerId === null && this.mapProvider) {
|
|
88
|
+
try {
|
|
89
|
+
this.layerId = await this.addLayer(group.basemapid, groupId, groupVisible, createLayerConfig(), elementId);
|
|
90
|
+
if (this.layerId) {
|
|
91
|
+
this.registerLayerError();
|
|
92
|
+
this.markReady();
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
this.setError({
|
|
96
|
+
type: 'provider',
|
|
97
|
+
message: 'Layer could not be added: provider returned no layer ID',
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
this.setError({
|
|
103
|
+
type: 'provider',
|
|
104
|
+
message: `Layer could not be added: ${e instanceof Error ? e.message : String(e)}`,
|
|
105
|
+
cause: e,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// ── Event binding ─────────────────────────────────────────────────
|
|
112
|
+
bindMapEventsOnce() {
|
|
113
|
+
if (this.listenersBound || !this.initContext)
|
|
114
|
+
return;
|
|
115
|
+
const { vmap } = this.initContext;
|
|
116
|
+
vmap.addEventListener(VMapEvents.MapProviderReady, this.onMapProviderReady);
|
|
117
|
+
vmap.addEventListener(VMapEvents.MapProviderWillShutdown, this.onMapProviderWillShutdown);
|
|
118
|
+
this.listenersBound = true;
|
|
119
|
+
}
|
|
120
|
+
onMapProviderReady = async (event) => {
|
|
121
|
+
log(`${this.el.nodeName.toLowerCase()} - layer add deferred`);
|
|
122
|
+
const mapEvent = event.detail;
|
|
123
|
+
this.mapProvider = mapEvent.mapProvider;
|
|
124
|
+
if (!this.layerId && this.initContext) {
|
|
125
|
+
this.startLoading();
|
|
126
|
+
const { group, vmap, createLayerConfig, elementId } = this.initContext;
|
|
127
|
+
await this.addToMapInternal(group, vmap, createLayerConfig, elementId);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
onMapProviderWillShutdown = async (_event) => {
|
|
131
|
+
log(`${this.el.nodeName.toLowerCase()} - map provider shutting down`);
|
|
132
|
+
this.mapProvider = null;
|
|
133
|
+
this.layerId = null;
|
|
134
|
+
this.clearError();
|
|
135
|
+
this.host?.setLoadState('idle');
|
|
136
|
+
};
|
|
137
|
+
// ── Mutators ──────────────────────────────────────────────────────
|
|
138
|
+
async setVisible(visible) {
|
|
139
|
+
if (!this.layerId || !this.mapProvider) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
try {
|
|
143
|
+
await this.mapProvider.setVisible(this.layerId, visible);
|
|
144
|
+
}
|
|
145
|
+
catch (e) {
|
|
146
|
+
this.setError({
|
|
147
|
+
type: 'provider',
|
|
148
|
+
message: `setVisible failed: ${e instanceof Error ? e.message : String(e)}`,
|
|
149
|
+
cause: e,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
async setOpacity(opacity) {
|
|
154
|
+
if (!this.layerId || !this.mapProvider) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
try {
|
|
158
|
+
await this.mapProvider.setOpacity(this.layerId, opacity);
|
|
159
|
+
}
|
|
160
|
+
catch (e) {
|
|
161
|
+
this.setError({
|
|
162
|
+
type: 'provider',
|
|
163
|
+
message: `setOpacity failed: ${e instanceof Error ? e.message : String(e)}`,
|
|
164
|
+
cause: e,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
async setZIndex(zIndex) {
|
|
169
|
+
if (!this.layerId || !this.mapProvider) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
try {
|
|
173
|
+
await this.mapProvider.setZIndex(this.layerId, zIndex);
|
|
174
|
+
}
|
|
175
|
+
catch (e) {
|
|
176
|
+
this.setError({
|
|
177
|
+
type: 'provider',
|
|
178
|
+
message: `setZIndex failed: ${e instanceof Error ? e.message : String(e)}`,
|
|
179
|
+
cause: e,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
async updateLayer(update) {
|
|
184
|
+
if (!this.layerId || !this.mapProvider) {
|
|
185
|
+
await this.recreateLayer();
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
await this.mapProvider.updateLayer(this.layerId, update);
|
|
190
|
+
this.markUpdated();
|
|
191
|
+
}
|
|
192
|
+
catch (e) {
|
|
193
|
+
this.setError({
|
|
194
|
+
type: 'provider',
|
|
195
|
+
message: `updateLayer failed: ${e instanceof Error ? e.message : String(e)}`,
|
|
196
|
+
cause: e,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
// ── Lifecycle ─────────────────────────────────────────────────────
|
|
201
|
+
async recreateLayer() {
|
|
202
|
+
if (!this.initContext || this.recreateInFlight)
|
|
203
|
+
return;
|
|
204
|
+
this.recreateInFlight = true;
|
|
205
|
+
this.startLoading();
|
|
206
|
+
const { group, vmap, createLayerConfig, elementId } = this.initContext;
|
|
207
|
+
try {
|
|
208
|
+
await this.addToMapInternal(group, vmap, createLayerConfig, elementId);
|
|
209
|
+
}
|
|
210
|
+
finally {
|
|
211
|
+
this.recreateInFlight = false;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
async initLayer(createLayerConfig, elementId) {
|
|
215
|
+
const group = this.el.closest('v-map-layergroup');
|
|
216
|
+
if (!group) {
|
|
217
|
+
warn(`${this.el.nodeName.toLowerCase()} is not inside a v-map-layergroup`);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const vmap = await this.getVMap();
|
|
221
|
+
if (!vmap) {
|
|
222
|
+
warn(`No parent v-map component found for ${this.el.nodeName.toLowerCase()}`);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
this.initContext = { group, vmap, createLayerConfig, elementId };
|
|
226
|
+
this.bindMapEventsOnce();
|
|
227
|
+
await this.addToMapInternal(group, vmap, createLayerConfig, elementId);
|
|
228
|
+
}
|
|
229
|
+
async dispose() {
|
|
230
|
+
if (this.initContext && this.listenersBound) {
|
|
231
|
+
const { vmap } = this.initContext;
|
|
232
|
+
vmap.removeEventListener(VMapEvents.MapProviderReady, this.onMapProviderReady);
|
|
233
|
+
vmap.removeEventListener(VMapEvents.MapProviderWillShutdown, this.onMapProviderWillShutdown);
|
|
234
|
+
}
|
|
235
|
+
// listenersBound = false enables re-binding on a later connectedCallback()/initLayer()
|
|
236
|
+
this.listenersBound = false;
|
|
237
|
+
await this.removeLayer();
|
|
238
|
+
this.clearError();
|
|
239
|
+
this.host?.setLoadState('idle');
|
|
240
|
+
}
|
|
241
|
+
// ── Accessors ─────────────────────────────────────────────────────
|
|
242
|
+
getMapProvider() {
|
|
243
|
+
return this.mapProvider;
|
|
244
|
+
}
|
|
245
|
+
getLayerId() {
|
|
246
|
+
return this.layerId;
|
|
247
|
+
}
|
|
248
|
+
async removeLayer() {
|
|
249
|
+
this.unregisterLayerError();
|
|
250
|
+
await this.mapProvider?.removeLayer(this.layerId);
|
|
251
|
+
this.layerId = null;
|
|
252
|
+
}
|
|
253
|
+
registerLayerError() {
|
|
254
|
+
if (this.layerId && this.mapProvider?.onLayerError) {
|
|
255
|
+
this.mapProvider.onLayerError(this.layerId, (err) => {
|
|
256
|
+
this.setRuntimeError({
|
|
257
|
+
type: err.type,
|
|
258
|
+
message: err.message,
|
|
259
|
+
cause: err.cause,
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
unregisterLayerError() {
|
|
265
|
+
if (this.layerId && this.mapProvider?.offLayerError) {
|
|
266
|
+
this.mapProvider.offLayerError(this.layerId);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
async getVMap() {
|
|
270
|
+
log(`${this.el.nodeName.toLowerCase()} - getVMap`);
|
|
271
|
+
const mapElement = this.el.closest('v-map');
|
|
272
|
+
if (!mapElement) {
|
|
273
|
+
log(`${this.el.nodeName.toLowerCase()} - getVMap - v-map not found.`);
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
await customElements.whenDefined('v-map');
|
|
277
|
+
const vmap = mapElement;
|
|
278
|
+
log(`${this.el.nodeName.toLowerCase()} - getVMap - assigned.`);
|
|
279
|
+
return vmap;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { vi, describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
2
|
+
vi.mock('../utils/logger', () => ({
|
|
3
|
+
log: vi.fn(),
|
|
4
|
+
warn: vi.fn(),
|
|
5
|
+
error: vi.fn(),
|
|
6
|
+
info: vi.fn(),
|
|
7
|
+
}));
|
|
8
|
+
vi.mock('../utils/events', () => ({
|
|
9
|
+
VMapEvents: {
|
|
10
|
+
Ready: 'ready',
|
|
11
|
+
Error: 'vmap-error',
|
|
12
|
+
MapProviderReady: 'map-provider-ready',
|
|
13
|
+
MapProviderWillShutdown: 'map-provider-will-shutdown',
|
|
14
|
+
MapMouseMove: 'map-mousemove',
|
|
15
|
+
},
|
|
16
|
+
}));
|
|
17
|
+
import { VMapLayerHelper } from "./v-map-layer-helper";
|
|
18
|
+
/* ------------------------------------------------------------------ */
|
|
19
|
+
/* Helpers */
|
|
20
|
+
/* ------------------------------------------------------------------ */
|
|
21
|
+
function createMockMapProvider(overrides = {}) {
|
|
22
|
+
return {
|
|
23
|
+
addBaseLayer: vi.fn().mockResolvedValue('base-layer-id'),
|
|
24
|
+
addLayerToGroup: vi.fn().mockResolvedValue('group-layer-id'),
|
|
25
|
+
removeLayer: vi.fn().mockResolvedValue(undefined),
|
|
26
|
+
setVisible: vi.fn().mockResolvedValue(undefined),
|
|
27
|
+
setOpacity: vi.fn().mockResolvedValue(undefined),
|
|
28
|
+
setZIndex: vi.fn().mockResolvedValue(undefined),
|
|
29
|
+
updateLayer: vi.fn().mockResolvedValue(undefined),
|
|
30
|
+
onLayerError: vi.fn(),
|
|
31
|
+
offLayerError: vi.fn(),
|
|
32
|
+
...overrides,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function asHelperInternals(value) {
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
function createMockVMap(provider) {
|
|
39
|
+
return {
|
|
40
|
+
__vMapProvider: provider,
|
|
41
|
+
isMapProviderReady: vi.fn().mockResolvedValue(true),
|
|
42
|
+
addEventListener: vi.fn(),
|
|
43
|
+
removeEventListener: vi.fn(),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function createMockGroup(groupId = 'test-group-id') {
|
|
47
|
+
return {
|
|
48
|
+
getGroupId: vi.fn().mockResolvedValue(groupId),
|
|
49
|
+
visible: true,
|
|
50
|
+
basemapid: '',
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function createMockElement() {
|
|
54
|
+
return {
|
|
55
|
+
nodeName: 'V-MAP-LAYER-XYZ',
|
|
56
|
+
closest: vi.fn(() => null),
|
|
57
|
+
dispatchEvent: vi.fn(),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function createMockHost() {
|
|
61
|
+
return {
|
|
62
|
+
states: [],
|
|
63
|
+
setLoadState(state) {
|
|
64
|
+
this.states.push(state);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/* ------------------------------------------------------------------ */
|
|
69
|
+
/* Tests */
|
|
70
|
+
/* ------------------------------------------------------------------ */
|
|
71
|
+
describe('VMapLayerHelper – runtime error propagation', () => {
|
|
72
|
+
let helper;
|
|
73
|
+
let mockEl;
|
|
74
|
+
let mockProvider;
|
|
75
|
+
let mockHost;
|
|
76
|
+
beforeEach(() => {
|
|
77
|
+
vi.useFakeTimers();
|
|
78
|
+
vi.clearAllMocks();
|
|
79
|
+
mockProvider = createMockMapProvider();
|
|
80
|
+
mockEl = createMockElement();
|
|
81
|
+
mockHost = createMockHost();
|
|
82
|
+
helper = new VMapLayerHelper(mockEl, mockHost);
|
|
83
|
+
});
|
|
84
|
+
afterEach(() => {
|
|
85
|
+
vi.useRealTimers();
|
|
86
|
+
});
|
|
87
|
+
/* ================================================================ */
|
|
88
|
+
/* setRuntimeError – leading-edge throttle */
|
|
89
|
+
/* ================================================================ */
|
|
90
|
+
describe('setRuntimeError', () => {
|
|
91
|
+
it('fires immediately on first call', () => {
|
|
92
|
+
const detail = { type: 'network', message: 'Tile load error' };
|
|
93
|
+
helper.setRuntimeError(detail);
|
|
94
|
+
expect(helper.getError()).toEqual(detail);
|
|
95
|
+
expect(mockHost.states).toContain('error');
|
|
96
|
+
expect(mockEl.dispatchEvent).toHaveBeenCalledTimes(1);
|
|
97
|
+
});
|
|
98
|
+
it('suppresses repeated calls within the 5s window', () => {
|
|
99
|
+
const detail1 = { type: 'network', message: 'Error 1' };
|
|
100
|
+
const detail2 = { type: 'network', message: 'Error 2' };
|
|
101
|
+
helper.setRuntimeError(detail1);
|
|
102
|
+
expect(helper.getError()).toEqual(detail1);
|
|
103
|
+
// Advance less than 5s
|
|
104
|
+
vi.advanceTimersByTime(3000);
|
|
105
|
+
helper.setRuntimeError(detail2);
|
|
106
|
+
// Error should still be the first one – second was suppressed
|
|
107
|
+
expect(helper.getError()).toEqual(detail1);
|
|
108
|
+
expect(mockEl.dispatchEvent).toHaveBeenCalledTimes(1);
|
|
109
|
+
});
|
|
110
|
+
it('fires again after the 5s window expires', () => {
|
|
111
|
+
const detail1 = { type: 'network', message: 'Error 1' };
|
|
112
|
+
const detail2 = { type: 'network', message: 'Error 2' };
|
|
113
|
+
helper.setRuntimeError(detail1);
|
|
114
|
+
expect(mockEl.dispatchEvent).toHaveBeenCalledTimes(1);
|
|
115
|
+
// Advance past the 5s debounce window
|
|
116
|
+
vi.advanceTimersByTime(5001);
|
|
117
|
+
helper.setRuntimeError(detail2);
|
|
118
|
+
expect(helper.getError()).toEqual(detail2);
|
|
119
|
+
expect(mockEl.dispatchEvent).toHaveBeenCalledTimes(2);
|
|
120
|
+
});
|
|
121
|
+
it('suppresses at exactly 5s but fires at 5001ms', () => {
|
|
122
|
+
const detail1 = { type: 'network', message: 'Error 1' };
|
|
123
|
+
const detail2 = { type: 'network', message: 'Error 2' };
|
|
124
|
+
const detail3 = { type: 'network', message: 'Error 3' };
|
|
125
|
+
helper.setRuntimeError(detail1);
|
|
126
|
+
// At exactly 4999ms – still suppressed
|
|
127
|
+
vi.advanceTimersByTime(4999);
|
|
128
|
+
helper.setRuntimeError(detail2);
|
|
129
|
+
expect(helper.getError()).toEqual(detail1);
|
|
130
|
+
expect(mockEl.dispatchEvent).toHaveBeenCalledTimes(1);
|
|
131
|
+
// At 5001ms from the first call
|
|
132
|
+
vi.advanceTimersByTime(2);
|
|
133
|
+
helper.setRuntimeError(detail3);
|
|
134
|
+
expect(helper.getError()).toEqual(detail3);
|
|
135
|
+
expect(mockEl.dispatchEvent).toHaveBeenCalledTimes(2);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
/* ================================================================ */
|
|
139
|
+
/* clearError resets the debounce timer */
|
|
140
|
+
/* ================================================================ */
|
|
141
|
+
describe('clearError resets debounce timer', () => {
|
|
142
|
+
it('allows immediate fire after clearError', () => {
|
|
143
|
+
const detail1 = { type: 'network', message: 'Error 1' };
|
|
144
|
+
const detail2 = { type: 'network', message: 'Error 2' };
|
|
145
|
+
helper.setRuntimeError(detail1);
|
|
146
|
+
expect(mockEl.dispatchEvent).toHaveBeenCalledTimes(1);
|
|
147
|
+
// Only 1s in – normally would be suppressed
|
|
148
|
+
vi.advanceTimersByTime(1000);
|
|
149
|
+
helper.clearError();
|
|
150
|
+
// Should fire immediately after clearError, even within the 5s window
|
|
151
|
+
helper.setRuntimeError(detail2);
|
|
152
|
+
expect(helper.getError()).toEqual(detail2);
|
|
153
|
+
expect(mockEl.dispatchEvent).toHaveBeenCalledTimes(2);
|
|
154
|
+
});
|
|
155
|
+
it('clearError removes the stored error', () => {
|
|
156
|
+
helper.setRuntimeError({ type: 'network', message: 'err' });
|
|
157
|
+
expect(helper.getError()).toBeDefined();
|
|
158
|
+
helper.clearError();
|
|
159
|
+
expect(helper.getError()).toBeUndefined();
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
/* ================================================================ */
|
|
163
|
+
/* registerLayerError / unregisterLayerError */
|
|
164
|
+
/* ================================================================ */
|
|
165
|
+
describe('registerLayerError', () => {
|
|
166
|
+
it('calls mapProvider.onLayerError after addLayer succeeds', async () => {
|
|
167
|
+
const testHelper = asHelperInternals(helper);
|
|
168
|
+
const mockVMap = createMockVMap(mockProvider);
|
|
169
|
+
const mockGroup = createMockGroup();
|
|
170
|
+
await testHelper.addToMapInternal(mockGroup, mockVMap, () => ({ type: 'osm' }));
|
|
171
|
+
expect(mockProvider.onLayerError).toHaveBeenCalledWith('group-layer-id', expect.any(Function));
|
|
172
|
+
});
|
|
173
|
+
it('onLayerError callback delegates to setRuntimeError', async () => {
|
|
174
|
+
let capturedCallback;
|
|
175
|
+
mockProvider.onLayerError.mockImplementation((_id, cb) => {
|
|
176
|
+
capturedCallback = cb;
|
|
177
|
+
});
|
|
178
|
+
const testHelper = asHelperInternals(helper);
|
|
179
|
+
const mockVMap = createMockVMap(mockProvider);
|
|
180
|
+
const mockGroup = createMockGroup();
|
|
181
|
+
await testHelper.addToMapInternal(mockGroup, mockVMap, () => ({ type: 'osm' }));
|
|
182
|
+
// Simulate a layer error from the provider
|
|
183
|
+
capturedCallback({ type: 'network', message: 'Tile load error' });
|
|
184
|
+
expect(helper.getError()).toEqual({
|
|
185
|
+
type: 'network',
|
|
186
|
+
message: 'Tile load error',
|
|
187
|
+
});
|
|
188
|
+
expect(mockHost.states).toContain('error');
|
|
189
|
+
});
|
|
190
|
+
it('does not call onLayerError if provider lacks the method', async () => {
|
|
191
|
+
const testHelper = asHelperInternals(helper);
|
|
192
|
+
const providerWithoutError = createMockMapProvider();
|
|
193
|
+
delete providerWithoutError.onLayerError;
|
|
194
|
+
delete providerWithoutError.offLayerError;
|
|
195
|
+
const mockVMap = createMockVMap(providerWithoutError);
|
|
196
|
+
const mockGroup = createMockGroup('g1');
|
|
197
|
+
// Should not throw
|
|
198
|
+
await testHelper.addToMapInternal(mockGroup, mockVMap, () => ({ type: 'osm' }));
|
|
199
|
+
expect(helper.getLayerId()).toBe('group-layer-id');
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
describe('unregisterLayerError', () => {
|
|
203
|
+
it('calls mapProvider.offLayerError on removeLayer', async () => {
|
|
204
|
+
const testHelper = asHelperInternals(helper);
|
|
205
|
+
testHelper.mapProvider = mockProvider;
|
|
206
|
+
testHelper.layerId = 'layer-1';
|
|
207
|
+
await helper.removeLayer();
|
|
208
|
+
expect(mockProvider.offLayerError).toHaveBeenCalledWith('layer-1');
|
|
209
|
+
expect(helper.getLayerId()).toBeNull();
|
|
210
|
+
});
|
|
211
|
+
it('calls offLayerError before removing old layer in addToMapInternal', async () => {
|
|
212
|
+
const testHelper = asHelperInternals(helper);
|
|
213
|
+
testHelper.layerId = 'old-layer';
|
|
214
|
+
testHelper.mapProvider = mockProvider;
|
|
215
|
+
const mockVMap = createMockVMap(mockProvider);
|
|
216
|
+
const mockGroup = createMockGroup('g1');
|
|
217
|
+
await testHelper.addToMapInternal(mockGroup, mockVMap, () => ({ type: 'osm' }));
|
|
218
|
+
// offLayerError should have been called for the old layer
|
|
219
|
+
expect(mockProvider.offLayerError).toHaveBeenCalledWith('old-layer');
|
|
220
|
+
// And onLayerError for the new layer
|
|
221
|
+
expect(mockProvider.onLayerError).toHaveBeenCalledWith('group-layer-id', expect.any(Function));
|
|
222
|
+
});
|
|
223
|
+
it('does not throw if provider lacks offLayerError', async () => {
|
|
224
|
+
const testHelper = asHelperInternals(helper);
|
|
225
|
+
const providerWithoutOff = createMockMapProvider();
|
|
226
|
+
delete providerWithoutOff.offLayerError;
|
|
227
|
+
testHelper.mapProvider = providerWithoutOff;
|
|
228
|
+
testHelper.layerId = 'layer-1';
|
|
229
|
+
// Should not throw
|
|
230
|
+
await helper.removeLayer();
|
|
231
|
+
expect(helper.getLayerId()).toBeNull();
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { CESIUM_VERSION } from "./versions.gen";
|
|
2
|
+
import { AsyncMutex } from "../utils/async-mutex";
|
|
3
|
+
function assert(cond, msg) {
|
|
4
|
+
if (!cond)
|
|
5
|
+
throw new Error(msg);
|
|
6
|
+
}
|
|
7
|
+
const sameMM = (exp, act) => exp.match(/^\d+\.\d+/)?.[0] === act.match(/^\d+\.\d+/)?.[0];
|
|
8
|
+
const loadCesiumMutex = new AsyncMutex();
|
|
9
|
+
export async function loadCesium(version = CESIUM_VERSION) {
|
|
10
|
+
const v = version.replace(/^[^\d]*/, '');
|
|
11
|
+
const base = `https://cdn.jsdelivr.net/npm/cesium@${v}/Build/Cesium`;
|
|
12
|
+
const url = `${base}/Cesium.js`;
|
|
13
|
+
await loadCesiumMutex.runExclusive(async () => {
|
|
14
|
+
if (!globalThis.Cesium) {
|
|
15
|
+
await new Promise((resolve, reject) => {
|
|
16
|
+
const id = 'cesium-cdn-script';
|
|
17
|
+
if (document.getElementById(id))
|
|
18
|
+
return resolve();
|
|
19
|
+
const s = document.createElement('script');
|
|
20
|
+
s.id = id;
|
|
21
|
+
s.async = true;
|
|
22
|
+
s.src = url;
|
|
23
|
+
s.addEventListener('load', () => resolve(), { once: true });
|
|
24
|
+
s.addEventListener('error', () => reject(new Error(`Laden fehlgeschlagen: ${url}`)), { once: true });
|
|
25
|
+
document.head.appendChild(s);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const Cesium = globalThis.Cesium;
|
|
30
|
+
assert(Cesium, 'globalThis.Cesium nicht verfügbar.');
|
|
31
|
+
const actual = Cesium.VERSION; // z.B. "1.133"
|
|
32
|
+
assert(sameMM(String(version), actual), // Major.Minor muss passen
|
|
33
|
+
`Cesium-Version abweichend: erwartet ~${version}, geladen ${actual}`);
|
|
34
|
+
globalThis.CESIUM_BASE_URL = base;
|
|
35
|
+
return Cesium;
|
|
36
|
+
}
|
|
37
|
+
export async function injectWidgetsCss(shadowRoot) {
|
|
38
|
+
const v = CESIUM_VERSION.replace(/^[^\d]*/, '');
|
|
39
|
+
const base = `https://cdn.jsdelivr.net/npm/cesium@${v}/Build/Cesium`;
|
|
40
|
+
const cssUrl = `${base}/Widgets/widgets.css`;
|
|
41
|
+
const cssText = await (await fetch(cssUrl)).text();
|
|
42
|
+
const absolutized = cssText.replace(/url\((?!['"]?data:)(['"]?)([^'")]+)\1\)/g, (_m, _q, rel) => `url(${base}/Widgets/${rel.replace(/^\.?\//, '')})`);
|
|
43
|
+
if (!shadowRoot)
|
|
44
|
+
return;
|
|
45
|
+
if ('adoptedStyleSheets' in Document.prototype) {
|
|
46
|
+
const sheet = new CSSStyleSheet();
|
|
47
|
+
await sheet.replace(absolutized);
|
|
48
|
+
shadowRoot.adoptedStyleSheets = [
|
|
49
|
+
...(shadowRoot.adoptedStyleSheets ?? []),
|
|
50
|
+
sheet,
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
const style = document.createElement('style');
|
|
55
|
+
style.textContent = absolutized;
|
|
56
|
+
shadowRoot.appendChild(style);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IMPORT_MAP_JSON } from "./versions.gen";
|
|
2
|
+
export function ensureImportMap({ allowOverride = true } = {}) {
|
|
3
|
+
if (allowOverride && document.querySelector('script[type="importmap"]'))
|
|
4
|
+
return;
|
|
5
|
+
if (!document.querySelector('script[type="importmap"][data-v-map]')) {
|
|
6
|
+
const s = document.createElement('script');
|
|
7
|
+
s.type = 'importmap';
|
|
8
|
+
s.dataset.vMap = 'true';
|
|
9
|
+
s.textContent = IMPORT_MAP_JSON;
|
|
10
|
+
document.head.appendChild(s);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { IMPORT_MAP_JSON } from "./versions.gen";
|
|
3
|
+
import { ensureImportMap } from "./ensure-importmap";
|
|
4
|
+
function stubDocument(options) {
|
|
5
|
+
const appended = [];
|
|
6
|
+
const fakeDocument = {
|
|
7
|
+
querySelector: (selector) => {
|
|
8
|
+
if (selector === 'script[type="importmap"]' &&
|
|
9
|
+
options?.hasAnyImportMap) {
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
if (selector === 'script[type="importmap"][data-v-map]' &&
|
|
13
|
+
options?.hasVMapImportMap) {
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
},
|
|
18
|
+
createElement: (_tagName) => ({
|
|
19
|
+
type: '',
|
|
20
|
+
dataset: {},
|
|
21
|
+
textContent: null,
|
|
22
|
+
}),
|
|
23
|
+
head: {
|
|
24
|
+
appendChild: (node) => {
|
|
25
|
+
appended.push(node);
|
|
26
|
+
return node;
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
vi.stubGlobal('document', fakeDocument);
|
|
31
|
+
return appended;
|
|
32
|
+
}
|
|
33
|
+
describe('ensureImportMap unit', () => {
|
|
34
|
+
afterEach(() => {
|
|
35
|
+
vi.unstubAllGlobals();
|
|
36
|
+
});
|
|
37
|
+
it('appends a v-map importmap when none exists', () => {
|
|
38
|
+
const appended = stubDocument();
|
|
39
|
+
ensureImportMap();
|
|
40
|
+
expect(appended).toHaveLength(1);
|
|
41
|
+
expect(appended[0]).toEqual({
|
|
42
|
+
type: 'importmap',
|
|
43
|
+
dataset: { vMap: 'true' },
|
|
44
|
+
textContent: IMPORT_MAP_JSON,
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
it('skips injection when another importmap exists and override is allowed', () => {
|
|
48
|
+
const appended = stubDocument({ hasAnyImportMap: true });
|
|
49
|
+
ensureImportMap();
|
|
50
|
+
expect(appended).toHaveLength(0);
|
|
51
|
+
});
|
|
52
|
+
it('does not append a duplicate v-map importmap', () => {
|
|
53
|
+
const appended = stubDocument({ hasVMapImportMap: true });
|
|
54
|
+
ensureImportMap({ allowOverride: false });
|
|
55
|
+
expect(appended).toHaveLength(0);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/* AUTO-GENERATED: DO NOT EDIT. Run "pnpm build" to regenerate. */
|
|
2
|
+
export const CESIUM_VERSION = '1.139.1';
|
|
3
|
+
export const OL_VERSION = '10.8.0';
|
|
4
|
+
export const LEAFLET_VERSION = '1.9.4';
|
|
5
|
+
export const DECK_VERSION = '9.2.11';
|
|
6
|
+
export const IMPORT_MAP_JSON = "{\n \"imports\": {\n \"ol/\": \"https://esm.sh/ol@10.8.0/\",\n \"ol\": \"https://esm.sh/ol@10.8.0\",\n \"leaflet\": \"https://esm.sh/leaflet@1.9.4\",\n \"deck\": \"https://esm.sh/deck@9.2.11\",\n \"@loaders.gl/core\": \"https://esm.sh/@loaders.gl/core@4.3.4\",\n \"@loaders.gl/3d-tiles\": \"https://esm.sh/@loaders.gl/3d-tiles@4.3.4\",\n \"@loaders.gl/gis\": \"https://esm.sh/@loaders.gl/gis@4.3.4\",\n \"@loaders.gl/gltf\": \"https://esm.sh/@loaders.gl/gltf@4.3.4\",\n \"@loaders.gl/images\": \"https://esm.sh/@loaders.gl/images@4.3.4\",\n \"@loaders.gl/loader-utils\": \"https://esm.sh/@loaders.gl/loader-utils@4.3.4\",\n \"@loaders.gl/mvt\": \"https://esm.sh/@loaders.gl/mvt@4.3.4\",\n \"@loaders.gl/schema\": \"https://esm.sh/@loaders.gl/schema@4.3.4\",\n \"@loaders.gl/terrain\": \"https://esm.sh/@loaders.gl/terrain@4.3.4\",\n \"@loaders.gl/textures\": \"https://esm.sh/@loaders.gl/textures@4.3.4\",\n \"@loaders.gl/tiles\": \"https://esm.sh/@loaders.gl/tiles@4.3.4\",\n \"@loaders.gl/wms\": \"https://esm.sh/@loaders.gl/wms@4.3.4\"\n }\n}";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const VSTYLE_DEFAULT = {
|
|
2
|
+
rules: [
|
|
3
|
+
{ polygon: { fill: 'rgba(0,120,255,0.15)', stroke: { color: '#0971fe', width: 1 } } },
|
|
4
|
+
{ line: { color: '#0971fe', width: ['interpolate', 'linear', ['zoom'], 4, 1, 10, 3] } },
|
|
5
|
+
{ point: { radius: ['interpolate', 'linear', ['zoom'], 4, 3, 10, 6], fill: '#0971fe', stroke: { color: '#fff', width: 1 } } },
|
|
6
|
+
{ label: { text: ['get', 'name'], color: '#111', size: ['interpolate', 'linear', ['zoom'], 4, 11, 10, 14], halo: { color: '#fff', width: 2 } } },
|
|
7
|
+
]
|
|
8
|
+
};
|