@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,352 @@
|
|
|
1
|
+
import * as L from "leaflet";
|
|
2
|
+
import { error, log } from "../../utils/logger";
|
|
3
|
+
const CREATE_SESSION_URL = 'https://tile.googleapis.com/v1/createSession';
|
|
4
|
+
const TILE_URL_BASE = 'https://tile.googleapis.com/v1/2dtiles';
|
|
5
|
+
const ATTRIBUTION_URL = 'https://tile.googleapis.com/tile/v1/viewport';
|
|
6
|
+
const DEFAULT_MAX_ZOOM = 22;
|
|
7
|
+
const SESSION_REFRESH_BUFFER_MS = 60 * 1000;
|
|
8
|
+
const FALLBACK_TILE_SIZE = 256;
|
|
9
|
+
export class GoogleMapTilesLayer extends L.GridLayer {
|
|
10
|
+
apiKey;
|
|
11
|
+
highDpi;
|
|
12
|
+
sessionRequest;
|
|
13
|
+
scaleFactor;
|
|
14
|
+
sessionToken;
|
|
15
|
+
sessionPromise;
|
|
16
|
+
sessionRefreshId;
|
|
17
|
+
previousViewport;
|
|
18
|
+
currentAttribution;
|
|
19
|
+
mapInstance;
|
|
20
|
+
onMoveEnd;
|
|
21
|
+
constructor(options) {
|
|
22
|
+
super();
|
|
23
|
+
this.applyInitialGridOptions(options);
|
|
24
|
+
const { apiKey, mapType, language, region, imageFormat, scale, highDpi, layerTypes, overlay, styles, apiOptions, } = options;
|
|
25
|
+
if (!apiKey) {
|
|
26
|
+
throw new Error('Google Map Tiles layer requires an apiKey');
|
|
27
|
+
}
|
|
28
|
+
this.apiKey = apiKey;
|
|
29
|
+
this.highDpi =
|
|
30
|
+
highDpi ?? (scale === undefined ? true : scale !== 'scaleFactor1x');
|
|
31
|
+
this.scaleFactor = this.mapScaleToFactor(scale, this.highDpi);
|
|
32
|
+
const request = {
|
|
33
|
+
mapType: mapType ?? 'roadmap',
|
|
34
|
+
language: language ?? 'en-US',
|
|
35
|
+
region: region ?? 'US',
|
|
36
|
+
};
|
|
37
|
+
if (imageFormat) {
|
|
38
|
+
request.imageFormat = imageFormat;
|
|
39
|
+
}
|
|
40
|
+
if (layerTypes?.length) {
|
|
41
|
+
request.layerTypes = layerTypes;
|
|
42
|
+
}
|
|
43
|
+
if (apiOptions?.length) {
|
|
44
|
+
request.apiOptions = apiOptions;
|
|
45
|
+
}
|
|
46
|
+
if (Array.isArray(styles) && styles.length > 0) {
|
|
47
|
+
request.styles = styles;
|
|
48
|
+
}
|
|
49
|
+
if (overlay === true) {
|
|
50
|
+
request.overlay = true;
|
|
51
|
+
}
|
|
52
|
+
const resolvedScale = scale ?? (this.scaleFactor > 1 ? this.factorToScale(this.scaleFactor) : undefined);
|
|
53
|
+
if (resolvedScale) {
|
|
54
|
+
request.scale = resolvedScale;
|
|
55
|
+
}
|
|
56
|
+
if (this.highDpi) {
|
|
57
|
+
request.highDpi = true;
|
|
58
|
+
}
|
|
59
|
+
this.sessionRequest = request;
|
|
60
|
+
this.onMoveEnd = () => {
|
|
61
|
+
void this.updateAttribution();
|
|
62
|
+
};
|
|
63
|
+
this.sessionPromise = this.startSessionFetch();
|
|
64
|
+
}
|
|
65
|
+
onAdd(map) {
|
|
66
|
+
this.mapInstance = map;
|
|
67
|
+
map.on('moveend', this.onMoveEnd);
|
|
68
|
+
map.on('zoomend', this.onMoveEnd);
|
|
69
|
+
void this.ensureSession().then(() => this.updateAttribution());
|
|
70
|
+
return super.onAdd(map);
|
|
71
|
+
}
|
|
72
|
+
onRemove(map) {
|
|
73
|
+
map.off('moveend', this.onMoveEnd);
|
|
74
|
+
map.off('zoomend', this.onMoveEnd);
|
|
75
|
+
this.clearSessionRefresh();
|
|
76
|
+
this.removeCurrentAttribution();
|
|
77
|
+
this.mapInstance = undefined;
|
|
78
|
+
return super.onRemove(map);
|
|
79
|
+
}
|
|
80
|
+
createTile(coords, done) {
|
|
81
|
+
const tile = document.createElement('img');
|
|
82
|
+
tile.decoding = 'async';
|
|
83
|
+
tile.alt = '';
|
|
84
|
+
tile.crossOrigin = 'anonymous';
|
|
85
|
+
const size = this.resolveTileSize();
|
|
86
|
+
tile.width = size.x;
|
|
87
|
+
tile.height = size.y;
|
|
88
|
+
const handleError = (err) => {
|
|
89
|
+
const message = err instanceof Error ? err.message : 'Google tile load error';
|
|
90
|
+
done(new Error(message), tile);
|
|
91
|
+
};
|
|
92
|
+
tile.onload = () => done(null, tile);
|
|
93
|
+
tile.onerror = (event) => {
|
|
94
|
+
const err = event instanceof ErrorEvent
|
|
95
|
+
? event.error ?? new Error(event.message)
|
|
96
|
+
: new Error('Google tile failed to load');
|
|
97
|
+
handleError(err);
|
|
98
|
+
};
|
|
99
|
+
void this.ensureSession()
|
|
100
|
+
.then(() => {
|
|
101
|
+
if (!this.sessionToken) {
|
|
102
|
+
handleError(new Error('Google Maps session unavailable'));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
tile.src = this.buildTileUrl(coords);
|
|
106
|
+
})
|
|
107
|
+
.catch((err) => {
|
|
108
|
+
handleError(err);
|
|
109
|
+
});
|
|
110
|
+
return tile;
|
|
111
|
+
}
|
|
112
|
+
ensureSession() {
|
|
113
|
+
if (this.sessionToken) {
|
|
114
|
+
return Promise.resolve();
|
|
115
|
+
}
|
|
116
|
+
if (!this.sessionPromise) {
|
|
117
|
+
this.sessionPromise = this.startSessionFetch();
|
|
118
|
+
}
|
|
119
|
+
return this.sessionPromise;
|
|
120
|
+
}
|
|
121
|
+
startSessionFetch(force = false) {
|
|
122
|
+
if (this.sessionPromise && !force) {
|
|
123
|
+
return this.sessionPromise;
|
|
124
|
+
}
|
|
125
|
+
const promise = this.fetchAndApplySession()
|
|
126
|
+
.catch((err) => {
|
|
127
|
+
const wrapped = err instanceof Error
|
|
128
|
+
? err
|
|
129
|
+
: new Error('Failed to create Google Maps session');
|
|
130
|
+
error('Google Map Tiles session error', wrapped);
|
|
131
|
+
this.sessionToken = undefined;
|
|
132
|
+
throw wrapped;
|
|
133
|
+
})
|
|
134
|
+
.finally(() => {
|
|
135
|
+
if (this.sessionPromise === promise) {
|
|
136
|
+
this.sessionPromise = undefined;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
this.sessionPromise = promise;
|
|
140
|
+
return promise;
|
|
141
|
+
}
|
|
142
|
+
async fetchAndApplySession() {
|
|
143
|
+
const url = `${CREATE_SESSION_URL}?key=${this.apiKey}`;
|
|
144
|
+
const response = await fetch(url, {
|
|
145
|
+
method: 'POST',
|
|
146
|
+
headers: {
|
|
147
|
+
'Content-Type': 'application/json',
|
|
148
|
+
},
|
|
149
|
+
body: JSON.stringify(this.sessionRequest),
|
|
150
|
+
});
|
|
151
|
+
if (!response.ok) {
|
|
152
|
+
let details;
|
|
153
|
+
try {
|
|
154
|
+
const body = await response.json();
|
|
155
|
+
details = body?.error?.message;
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
// ignore JSON parse errors
|
|
159
|
+
}
|
|
160
|
+
throw new Error(details ?? `Google Maps session request failed (${response.status})`);
|
|
161
|
+
}
|
|
162
|
+
const data = (await response.json());
|
|
163
|
+
this.sessionToken = data.session;
|
|
164
|
+
this.applyTileSize(data);
|
|
165
|
+
this.scheduleSessionRefresh(this.parseExpiry(data.expiry));
|
|
166
|
+
if (this.mapInstance) {
|
|
167
|
+
void this.updateAttribution();
|
|
168
|
+
this.redrawLayer();
|
|
169
|
+
}
|
|
170
|
+
log('Google Map Tiles session established');
|
|
171
|
+
}
|
|
172
|
+
scheduleSessionRefresh(expiryMs) {
|
|
173
|
+
if (!isFinite(expiryMs))
|
|
174
|
+
return;
|
|
175
|
+
const refreshInMs = Math.max(expiryMs - Date.now() - SESSION_REFRESH_BUFFER_MS, 1000);
|
|
176
|
+
this.clearSessionRefresh();
|
|
177
|
+
this.sessionRefreshId = setTimeout(() => {
|
|
178
|
+
void this.startSessionFetch(true).then(() => {
|
|
179
|
+
if (this.mapInstance) {
|
|
180
|
+
void this.updateAttribution();
|
|
181
|
+
this.redrawLayer();
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
}, refreshInMs);
|
|
185
|
+
}
|
|
186
|
+
clearSessionRefresh() {
|
|
187
|
+
if (this.sessionRefreshId !== undefined) {
|
|
188
|
+
clearTimeout(this.sessionRefreshId);
|
|
189
|
+
this.sessionRefreshId = undefined;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
async updateAttribution() {
|
|
193
|
+
if (!this.mapInstance || !this.sessionToken)
|
|
194
|
+
return;
|
|
195
|
+
const bounds = this.mapInstance.getBounds();
|
|
196
|
+
if (!bounds?.isValid())
|
|
197
|
+
return;
|
|
198
|
+
const zoom = this.mapInstance.getZoom();
|
|
199
|
+
const viewport = `zoom=${zoom}&north=${bounds.getNorth()}&south=${bounds.getSouth()}&east=${bounds.getEast()}&west=${bounds.getWest()}`;
|
|
200
|
+
if (this.previousViewport === viewport) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
this.previousViewport = viewport;
|
|
204
|
+
try {
|
|
205
|
+
const response = await fetch(`${ATTRIBUTION_URL}?session=${this.sessionToken}&key=${this.apiKey}&${viewport}`);
|
|
206
|
+
if (!response.ok) {
|
|
207
|
+
throw new Error(`Attribution request failed (${response.status})`);
|
|
208
|
+
}
|
|
209
|
+
const json = await response.json();
|
|
210
|
+
const copyright = json?.copyright;
|
|
211
|
+
if (typeof copyright === 'string' && copyright.length > 0) {
|
|
212
|
+
this.applyAttribution(copyright);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
catch (err) {
|
|
216
|
+
error('Failed to fetch Google attribution', err);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
applyAttribution(value) {
|
|
220
|
+
const map = this.mapInstance;
|
|
221
|
+
if (!map?.attributionControl)
|
|
222
|
+
return;
|
|
223
|
+
if (this.currentAttribution && this.currentAttribution !== value) {
|
|
224
|
+
map.attributionControl.removeAttribution(this.currentAttribution);
|
|
225
|
+
}
|
|
226
|
+
if (!this.currentAttribution || this.currentAttribution !== value) {
|
|
227
|
+
map.attributionControl.addAttribution(value);
|
|
228
|
+
this.currentAttribution = value;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
removeCurrentAttribution() {
|
|
232
|
+
const map = this.mapInstance;
|
|
233
|
+
if (!map?.attributionControl || !this.currentAttribution)
|
|
234
|
+
return;
|
|
235
|
+
map.attributionControl.removeAttribution(this.currentAttribution);
|
|
236
|
+
this.currentAttribution = undefined;
|
|
237
|
+
}
|
|
238
|
+
applyTileSize(data) {
|
|
239
|
+
const width = Math.max(1, Math.round(data.tileWidth / this.scaleFactor));
|
|
240
|
+
const height = Math.max(1, Math.round(data.tileHeight / this.scaleFactor));
|
|
241
|
+
const tileSize = L.point(width, height);
|
|
242
|
+
this.setGridOptions({ tileSize });
|
|
243
|
+
}
|
|
244
|
+
parseExpiry(expiry) {
|
|
245
|
+
const asInt = parseInt(expiry, 10);
|
|
246
|
+
return Number.isFinite(asInt) ? asInt * 1000 : Number.NaN;
|
|
247
|
+
}
|
|
248
|
+
buildTileUrl(coords) {
|
|
249
|
+
if (!this.sessionToken) {
|
|
250
|
+
throw new Error('Google Maps session missing');
|
|
251
|
+
}
|
|
252
|
+
const z = coords.z;
|
|
253
|
+
const x = coords.x;
|
|
254
|
+
const y = coords.y;
|
|
255
|
+
return `${TILE_URL_BASE}/${z}/${x}/${y}?session=${this.sessionToken}&key=${this.apiKey}`;
|
|
256
|
+
}
|
|
257
|
+
mapScaleToFactor(scale, highDpi) {
|
|
258
|
+
switch (scale) {
|
|
259
|
+
case 'scaleFactor4x':
|
|
260
|
+
return 4;
|
|
261
|
+
case 'scaleFactor2x':
|
|
262
|
+
return 2;
|
|
263
|
+
case 'scaleFactor1x':
|
|
264
|
+
return 1;
|
|
265
|
+
default:
|
|
266
|
+
return highDpi ? 2 : 1;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
factorToScale(factor) {
|
|
270
|
+
switch (factor) {
|
|
271
|
+
case 4:
|
|
272
|
+
return 'scaleFactor4x';
|
|
273
|
+
case 2:
|
|
274
|
+
return 'scaleFactor2x';
|
|
275
|
+
case 1:
|
|
276
|
+
return 'scaleFactor1x';
|
|
277
|
+
default:
|
|
278
|
+
return undefined;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
applyInitialGridOptions(options) {
|
|
282
|
+
const payload = {};
|
|
283
|
+
const keys = [
|
|
284
|
+
'attribution',
|
|
285
|
+
'bounds',
|
|
286
|
+
'className',
|
|
287
|
+
'detectRetina',
|
|
288
|
+
'errorTileUrl',
|
|
289
|
+
'keepBuffer',
|
|
290
|
+
'maxNativeZoom',
|
|
291
|
+
'maxZoom',
|
|
292
|
+
'minNativeZoom',
|
|
293
|
+
'minZoom',
|
|
294
|
+
'noWrap',
|
|
295
|
+
'opacity',
|
|
296
|
+
'pane',
|
|
297
|
+
'reuseTiles',
|
|
298
|
+
'subdomains',
|
|
299
|
+
'tileSize',
|
|
300
|
+
'tms',
|
|
301
|
+
'updateInterval',
|
|
302
|
+
'updateWhenIdle',
|
|
303
|
+
'updateWhenZooming',
|
|
304
|
+
'zIndex',
|
|
305
|
+
'zoomOffset',
|
|
306
|
+
];
|
|
307
|
+
for (const key of keys) {
|
|
308
|
+
const value = options[key];
|
|
309
|
+
if (value !== undefined) {
|
|
310
|
+
payload[key] = value;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
if (payload.maxZoom === undefined) {
|
|
314
|
+
payload.maxZoom = DEFAULT_MAX_ZOOM;
|
|
315
|
+
}
|
|
316
|
+
this.setGridOptions(payload);
|
|
317
|
+
}
|
|
318
|
+
setGridOptions(options) {
|
|
319
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- L.Util.setOptions is typed as (obj: any, options: any) => any in Leaflet
|
|
320
|
+
const setOptionsFn = L.Util?.setOptions;
|
|
321
|
+
if (typeof setOptionsFn === 'function') {
|
|
322
|
+
setOptionsFn(this, options);
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
const self = this;
|
|
326
|
+
self.options = {
|
|
327
|
+
...self.options,
|
|
328
|
+
...options,
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
resolveTileSize() {
|
|
333
|
+
const raw = this.options?.tileSize;
|
|
334
|
+
if (raw && typeof raw === 'object') {
|
|
335
|
+
if (Array.isArray(raw) && raw.length === 2) {
|
|
336
|
+
const [x, y] = raw;
|
|
337
|
+
return L.point(Number(x) || FALLBACK_TILE_SIZE, Number(y) || FALLBACK_TILE_SIZE);
|
|
338
|
+
}
|
|
339
|
+
if ('x' in raw && 'y' in raw) {
|
|
340
|
+
const point = raw;
|
|
341
|
+
return L.point(Number(point.x) || FALLBACK_TILE_SIZE, Number(point.y) || FALLBACK_TILE_SIZE);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
if (typeof raw === 'number' && Number.isFinite(raw)) {
|
|
345
|
+
return L.point(raw, raw);
|
|
346
|
+
}
|
|
347
|
+
return L.point(FALLBACK_TILE_SIZE, FALLBACK_TILE_SIZE);
|
|
348
|
+
}
|
|
349
|
+
redrawLayer() {
|
|
350
|
+
this.redraw();
|
|
351
|
+
}
|
|
352
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { LEAFLET_VERSION } from "../../lib/versions.gen";
|
|
2
|
+
import { isBrowser, supportsAdoptedStyleSheets } from "../../utils/dom-env";
|
|
3
|
+
import * as L from "leaflet";
|
|
4
|
+
function injectInlineMin(root) {
|
|
5
|
+
if (!isBrowser())
|
|
6
|
+
return;
|
|
7
|
+
const css = `
|
|
8
|
+
:host { display:block; }
|
|
9
|
+
#map { width:100%; height:100%; display:block; }
|
|
10
|
+
`;
|
|
11
|
+
if (supportsAdoptedStyleSheets()) {
|
|
12
|
+
const sheet = new CSSStyleSheet();
|
|
13
|
+
sheet.replaceSync(css);
|
|
14
|
+
const target = (root ?? document);
|
|
15
|
+
const current = target.adoptedStyleSheets ?? [];
|
|
16
|
+
target.adoptedStyleSheets = [...current, sheet];
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
const style = document.createElement('style');
|
|
21
|
+
style.textContent = css;
|
|
22
|
+
(root ?? document.head).appendChild(style);
|
|
23
|
+
return style;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function addLeafletCssFromCdn(root, version = LEAFLET_VERSION, cdn = 'jsdelivr') {
|
|
27
|
+
if (!isBrowser())
|
|
28
|
+
return;
|
|
29
|
+
const href = cdn === 'unpkg'
|
|
30
|
+
? `https://unpkg.com/leaflet@${version}/dist/leaflet.css`
|
|
31
|
+
: `https://cdn.jsdelivr.net/npm/leaflet@${version}/dist/leaflet.css`;
|
|
32
|
+
if (cdn === 'unpkg')
|
|
33
|
+
L.Icon.Default.imagePath = `https://unpkg.com/npm/leaflet@${version}/dist/images/`;
|
|
34
|
+
else
|
|
35
|
+
L.Icon.Default.imagePath = `https://cdn.jsdelivr.net/npm/leaflet@${version}/dist/images/`;
|
|
36
|
+
// doppelte Injektion vermeiden (prüfe ShadowRoot **und** globales head)
|
|
37
|
+
const scope = root ?? document;
|
|
38
|
+
const already = scope.querySelector?.(`link[rel="stylesheet"][href="${href}"]`) ||
|
|
39
|
+
document.head.querySelector(`link[rel="stylesheet"][href="${href}"]`);
|
|
40
|
+
if (already)
|
|
41
|
+
return null;
|
|
42
|
+
const link = document.createElement('link');
|
|
43
|
+
link.rel = 'stylesheet';
|
|
44
|
+
link.href = href;
|
|
45
|
+
// Optional: link.integrity = '<SRI-Hash>'; link.crossOrigin = '';
|
|
46
|
+
(root ?? document.head).appendChild(link);
|
|
47
|
+
return link;
|
|
48
|
+
}
|
|
49
|
+
export function removeInjectedCss(shadowRoot, injectedStyle) {
|
|
50
|
+
if (!shadowRoot || !injectedStyle)
|
|
51
|
+
return;
|
|
52
|
+
// Das <style>-Element aus dem Shadow‑DOM entfernen
|
|
53
|
+
injectedStyle.remove(); // moderne API
|
|
54
|
+
}
|
|
55
|
+
export function ensureLeafletCss(mode, root) {
|
|
56
|
+
if (!isBrowser())
|
|
57
|
+
return; // Tests/SSR: no-op
|
|
58
|
+
switch (mode) {
|
|
59
|
+
case 'cdn':
|
|
60
|
+
return addLeafletCssFromCdn(root);
|
|
61
|
+
case 'inline-min':
|
|
62
|
+
return injectInlineMin(root);
|
|
63
|
+
case 'bundle':
|
|
64
|
+
// CSS wird vom Host/App-Bundle geliefert (z.B. via import 'leaflet/dist/leaflet.css')
|
|
65
|
+
break;
|
|
66
|
+
case 'none':
|
|
67
|
+
default:
|
|
68
|
+
// Host kümmert sich selbst; nichts tun
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
// Die Google Maps JS API wird seit der Umstellung auf Map Tiles nicht mehr geladen.
|
|
74
|
+
/** Fügt ein kleines Google-Logo als Leaflet-Control hinzu (Branding-Sicherheit) */
|
|
75
|
+
export function ensureGoogleLogo(map, markAdded) {
|
|
76
|
+
if (map._googleLogoAdded)
|
|
77
|
+
return;
|
|
78
|
+
const Logo = L.Control.extend({
|
|
79
|
+
onAdd() {
|
|
80
|
+
const img = L.DomUtil.create('img');
|
|
81
|
+
img.src =
|
|
82
|
+
'https://developers.google.com/static/maps/documentation/images/google_on_white.png';
|
|
83
|
+
img.alt = 'Google';
|
|
84
|
+
img.style.pointerEvents = 'none';
|
|
85
|
+
img.style.height = '18px';
|
|
86
|
+
img.style.margin = '0 0 6px 6px';
|
|
87
|
+
return img;
|
|
88
|
+
},
|
|
89
|
+
onRemove() { },
|
|
90
|
+
});
|
|
91
|
+
new Logo({ position: 'bottomleft' }).addTo(map);
|
|
92
|
+
map._googleLogoAdded = true;
|
|
93
|
+
markAdded();
|
|
94
|
+
}
|