@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,913 @@
|
|
|
1
|
+
import { h, } from "@stencil/core";
|
|
2
|
+
import { load as loadYaml } from "js-yaml";
|
|
3
|
+
import { diffLayers } from "../../utils/diff";
|
|
4
|
+
import { log } from "../../utils/logger";
|
|
5
|
+
import MSG from "../../utils/messages";
|
|
6
|
+
import { VMapEvents } from "../../utils/events";
|
|
7
|
+
const MSG_COMPONENT = 'v-map-builder - ';
|
|
8
|
+
/**
|
|
9
|
+
* A component that builds map configurations dynamically from JSON/YAML configuration scripts.
|
|
10
|
+
*
|
|
11
|
+
* @part mount - The container element where the generated map and layers are mounted.
|
|
12
|
+
*/
|
|
13
|
+
export class VMapBuilder {
|
|
14
|
+
hostEl;
|
|
15
|
+
/**
|
|
16
|
+
* Configuration object for the map builder. Can be any structure that will be normalized to BuilderConfig.
|
|
17
|
+
*/
|
|
18
|
+
mapconfig;
|
|
19
|
+
/**
|
|
20
|
+
* Event emitted when the map configuration has been successfully parsed and is ready to use.
|
|
21
|
+
*/
|
|
22
|
+
configReady;
|
|
23
|
+
/**
|
|
24
|
+
* Event emitted when there is an error parsing the map configuration.
|
|
25
|
+
*/
|
|
26
|
+
configError;
|
|
27
|
+
current;
|
|
28
|
+
//componentWillLoad() {
|
|
29
|
+
async componentDidLoad() {
|
|
30
|
+
log(MSG_COMPONENT + MSG.COMPONENT_DID_LOAD);
|
|
31
|
+
this.parseFromSlot();
|
|
32
|
+
}
|
|
33
|
+
async onMapConfigChanged(_oldValue, _newValue) {
|
|
34
|
+
log(MSG_COMPONENT + 'onMapConfigChanged');
|
|
35
|
+
this.parseFromSlot();
|
|
36
|
+
}
|
|
37
|
+
parseFromSlot() {
|
|
38
|
+
log(MSG_COMPONENT + 'parseFromSlot');
|
|
39
|
+
try {
|
|
40
|
+
const script = this.hostEl.querySelector('script[type*="json"], script[type*="yaml"], script[type*="yml"]');
|
|
41
|
+
if (!script)
|
|
42
|
+
throw new Error('No configuration <script> found.');
|
|
43
|
+
const mime = (script.type || '').toLowerCase();
|
|
44
|
+
const text = script.textContent ?? '';
|
|
45
|
+
const raw = mime.includes('json') ? JSON.parse(text) : loadYaml(text);
|
|
46
|
+
const cfg = this.normalize(raw);
|
|
47
|
+
this.applyDiff(this.current, cfg);
|
|
48
|
+
this.current = cfg;
|
|
49
|
+
log(MSG_COMPONENT + 'emit configReady');
|
|
50
|
+
this.configReady.emit(cfg);
|
|
51
|
+
}
|
|
52
|
+
catch (e) {
|
|
53
|
+
const err = e;
|
|
54
|
+
const message = err?.message || 'Unknown error';
|
|
55
|
+
this.configError.emit({
|
|
56
|
+
message,
|
|
57
|
+
errors: err?.errors,
|
|
58
|
+
});
|
|
59
|
+
this.hostEl.dispatchEvent(new CustomEvent(VMapEvents.Error, {
|
|
60
|
+
detail: {
|
|
61
|
+
type: 'validation',
|
|
62
|
+
message,
|
|
63
|
+
cause: e,
|
|
64
|
+
},
|
|
65
|
+
bubbles: true,
|
|
66
|
+
composed: true,
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
normalizeLayerType(rawType) {
|
|
71
|
+
const type = String(rawType ?? '').toLowerCase();
|
|
72
|
+
switch (type) {
|
|
73
|
+
case 'osm':
|
|
74
|
+
case 'wms':
|
|
75
|
+
case 'wms-tiled':
|
|
76
|
+
case 'geojson':
|
|
77
|
+
case 'xyz':
|
|
78
|
+
case 'terrain':
|
|
79
|
+
case 'wfs':
|
|
80
|
+
case 'wcs':
|
|
81
|
+
case 'google':
|
|
82
|
+
case 'geotiff':
|
|
83
|
+
case 'tile3d':
|
|
84
|
+
case 'scatterplot':
|
|
85
|
+
case 'wkt':
|
|
86
|
+
return type;
|
|
87
|
+
default:
|
|
88
|
+
return 'custom';
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
toOptionalString(value) {
|
|
92
|
+
if (value === undefined || value === null)
|
|
93
|
+
return undefined;
|
|
94
|
+
return typeof value === 'string' ? value : String(value);
|
|
95
|
+
}
|
|
96
|
+
toOptionalNumber(value) {
|
|
97
|
+
if (value === undefined || value === null || value === '')
|
|
98
|
+
return undefined;
|
|
99
|
+
const num = typeof value === 'number' ? value : Number(value);
|
|
100
|
+
return Number.isFinite(num) ? num : undefined;
|
|
101
|
+
}
|
|
102
|
+
toOptionalBoolean(value) {
|
|
103
|
+
if (value === undefined || value === null || value === '')
|
|
104
|
+
return undefined;
|
|
105
|
+
if (typeof value === 'boolean')
|
|
106
|
+
return value;
|
|
107
|
+
const normalized = String(value).trim().toLowerCase();
|
|
108
|
+
if (['true', '1', 'yes', 'y'].includes(normalized))
|
|
109
|
+
return true;
|
|
110
|
+
if (['false', '0', 'no', 'n'].includes(normalized))
|
|
111
|
+
return false;
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
toCsv(value) {
|
|
115
|
+
if (value === undefined || value === null)
|
|
116
|
+
return undefined;
|
|
117
|
+
if (Array.isArray(value)) {
|
|
118
|
+
return value
|
|
119
|
+
.map(entry => this.toOptionalString(entry))
|
|
120
|
+
.filter((entry) => entry != null && entry !== '')
|
|
121
|
+
.join(',');
|
|
122
|
+
}
|
|
123
|
+
return this.toOptionalString(value);
|
|
124
|
+
}
|
|
125
|
+
cleanRecord(record) {
|
|
126
|
+
if (!record)
|
|
127
|
+
return undefined;
|
|
128
|
+
const result = {};
|
|
129
|
+
for (const [key, value] of Object.entries(record)) {
|
|
130
|
+
if (value !== undefined && value !== null) {
|
|
131
|
+
result[key] = value;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return Object.keys(result).length ? result : undefined;
|
|
135
|
+
}
|
|
136
|
+
normalizeLayer(rawLayer, groupIndex, layerIndex) {
|
|
137
|
+
const type = this.normalizeLayerType(rawLayer?.type ?? rawLayer?.layerType);
|
|
138
|
+
const layerId = String(rawLayer?.id ?? `${groupIndex + 1}-${layerIndex + 1}`);
|
|
139
|
+
const base = {
|
|
140
|
+
id: layerId,
|
|
141
|
+
type,
|
|
142
|
+
visible: rawLayer?.visible,
|
|
143
|
+
opacity: rawLayer?.opacity,
|
|
144
|
+
zIndex: rawLayer?.zIndex,
|
|
145
|
+
};
|
|
146
|
+
if (rawLayer?.style != null) {
|
|
147
|
+
base.style = rawLayer.style;
|
|
148
|
+
}
|
|
149
|
+
const data = {};
|
|
150
|
+
const setBase = (key, value) => {
|
|
151
|
+
if (value !== undefined && value !== null) {
|
|
152
|
+
// NormalizedLayer has [key: string]: unknown index signature
|
|
153
|
+
base[key] = value;
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
switch (type) {
|
|
157
|
+
case 'wms':
|
|
158
|
+
case 'wms-tiled': {
|
|
159
|
+
const url = this.toOptionalString(rawLayer?.url);
|
|
160
|
+
const layers = this.toOptionalString(rawLayer?.layers ?? rawLayer?.sublayers);
|
|
161
|
+
const tiled = type === 'wms-tiled'
|
|
162
|
+
? true
|
|
163
|
+
: this.toOptionalBoolean(rawLayer?.tiled);
|
|
164
|
+
setBase('url', url);
|
|
165
|
+
setBase('layers', layers);
|
|
166
|
+
if (tiled !== undefined)
|
|
167
|
+
setBase('tiled', tiled);
|
|
168
|
+
const params = rawLayer?.params ?? rawLayer?.extraParams;
|
|
169
|
+
Object.assign(data, this.cleanRecord({
|
|
170
|
+
styles: rawLayer?.styles,
|
|
171
|
+
format: rawLayer?.format,
|
|
172
|
+
transparent: this.toOptionalBoolean(rawLayer?.transparent),
|
|
173
|
+
tiled,
|
|
174
|
+
version: rawLayer?.version,
|
|
175
|
+
time: rawLayer?.time,
|
|
176
|
+
params,
|
|
177
|
+
}) ?? {});
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
case 'geojson': {
|
|
181
|
+
setBase('url', this.toOptionalString(rawLayer?.url));
|
|
182
|
+
Object.assign(data, this.cleanRecord({
|
|
183
|
+
geojson: rawLayer?.geojson ?? rawLayer?.data,
|
|
184
|
+
fillColor: rawLayer?.fillColor,
|
|
185
|
+
fillOpacity: this.toOptionalNumber(rawLayer?.fillOpacity),
|
|
186
|
+
strokeColor: rawLayer?.strokeColor,
|
|
187
|
+
strokeWidth: this.toOptionalNumber(rawLayer?.strokeWidth),
|
|
188
|
+
strokeOpacity: this.toOptionalNumber(rawLayer?.strokeOpacity),
|
|
189
|
+
pointRadius: this.toOptionalNumber(rawLayer?.pointRadius),
|
|
190
|
+
pointColor: rawLayer?.pointColor,
|
|
191
|
+
iconUrl: rawLayer?.iconUrl,
|
|
192
|
+
iconSize: rawLayer?.iconSize,
|
|
193
|
+
textProperty: rawLayer?.textProperty,
|
|
194
|
+
textColor: rawLayer?.textColor,
|
|
195
|
+
textSize: this.toOptionalNumber(rawLayer?.textSize),
|
|
196
|
+
}) ?? {});
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
case 'xyz': {
|
|
200
|
+
setBase('url', this.toOptionalString(rawLayer?.url));
|
|
201
|
+
Object.assign(data, this.cleanRecord({
|
|
202
|
+
attributions: rawLayer?.attributions,
|
|
203
|
+
maxZoom: this.toOptionalNumber(rawLayer?.maxZoom),
|
|
204
|
+
tileSize: this.toOptionalNumber(rawLayer?.tileSize),
|
|
205
|
+
subdomains: this.toCsv(rawLayer?.subdomains),
|
|
206
|
+
}) ?? {});
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
case 'terrain': {
|
|
210
|
+
const nested = (rawLayer?.data != null && typeof rawLayer.data === 'object'
|
|
211
|
+
? rawLayer.data
|
|
212
|
+
: {});
|
|
213
|
+
Object.assign(data, this.cleanRecord({
|
|
214
|
+
elevationData: rawLayer?.elevationData ??
|
|
215
|
+
rawLayer?.url ??
|
|
216
|
+
nested.elevationData,
|
|
217
|
+
texture: rawLayer?.texture ?? nested.texture,
|
|
218
|
+
elevationDecoder: rawLayer?.elevationDecoder ?? nested.elevationDecoder,
|
|
219
|
+
wireframe: this.toOptionalBoolean(rawLayer?.wireframe ?? nested.wireframe),
|
|
220
|
+
color: rawLayer?.color ?? nested.color,
|
|
221
|
+
minZoom: this.toOptionalNumber(rawLayer?.minZoom ?? nested.minZoom),
|
|
222
|
+
maxZoom: this.toOptionalNumber(rawLayer?.maxZoom ?? nested.maxZoom),
|
|
223
|
+
meshMaxError: this.toOptionalNumber(rawLayer?.meshMaxError ?? nested.meshMaxError),
|
|
224
|
+
}) ?? {});
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
case 'wfs': {
|
|
228
|
+
const url = this.toOptionalString(rawLayer?.url);
|
|
229
|
+
setBase('url', url);
|
|
230
|
+
Object.assign(data, this.cleanRecord({
|
|
231
|
+
url,
|
|
232
|
+
typeName: rawLayer?.typeName ?? rawLayer?.layerName,
|
|
233
|
+
version: rawLayer?.version,
|
|
234
|
+
outputFormat: rawLayer?.outputFormat ?? rawLayer?.format,
|
|
235
|
+
srsName: rawLayer?.srsName ?? rawLayer?.crs,
|
|
236
|
+
params: rawLayer?.params,
|
|
237
|
+
}) ?? {});
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
case 'wcs': {
|
|
241
|
+
const url = this.toOptionalString(rawLayer?.url);
|
|
242
|
+
setBase('url', url);
|
|
243
|
+
Object.assign(data, this.cleanRecord({
|
|
244
|
+
url,
|
|
245
|
+
coverageName: rawLayer?.coverageName,
|
|
246
|
+
format: rawLayer?.format,
|
|
247
|
+
version: rawLayer?.version,
|
|
248
|
+
projection: rawLayer?.projection,
|
|
249
|
+
resolutions: rawLayer?.resolutions,
|
|
250
|
+
params: rawLayer?.params,
|
|
251
|
+
}) ?? {});
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
case 'google': {
|
|
255
|
+
Object.assign(data, this.cleanRecord({
|
|
256
|
+
apiKey: rawLayer?.apiKey ?? rawLayer?.api_key,
|
|
257
|
+
mapType: rawLayer?.mapType,
|
|
258
|
+
language: rawLayer?.language,
|
|
259
|
+
region: rawLayer?.region,
|
|
260
|
+
scale: rawLayer?.scale,
|
|
261
|
+
libraries: this.toCsv(rawLayer?.libraries),
|
|
262
|
+
maxZoom: this.toOptionalNumber(rawLayer?.maxZoom),
|
|
263
|
+
styles: rawLayer?.styles,
|
|
264
|
+
}) ?? {});
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
case 'geotiff': {
|
|
268
|
+
setBase('url', this.toOptionalString(rawLayer?.url));
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
case 'tile3d': {
|
|
272
|
+
setBase('url', this.toOptionalString(rawLayer?.url));
|
|
273
|
+
Object.assign(data, this.cleanRecord({
|
|
274
|
+
tilesetOptions: rawLayer?.tilesetOptions ?? rawLayer?.options ?? rawLayer?.data,
|
|
275
|
+
style: rawLayer?.style ?? rawLayer?.cesiumStyle,
|
|
276
|
+
}) ?? {});
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
case 'scatterplot': {
|
|
280
|
+
Object.assign(data, this.cleanRecord({
|
|
281
|
+
url: this.toOptionalString(rawLayer?.url),
|
|
282
|
+
data: rawLayer?.data,
|
|
283
|
+
getFillColor: rawLayer?.getFillColor,
|
|
284
|
+
getRadius: this.toOptionalNumber(rawLayer?.getRadius),
|
|
285
|
+
}) ?? {});
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
288
|
+
case 'wkt': {
|
|
289
|
+
Object.assign(data, this.cleanRecord({
|
|
290
|
+
wkt: rawLayer?.wkt,
|
|
291
|
+
url: this.toOptionalString(rawLayer?.url),
|
|
292
|
+
fillColor: rawLayer?.fillColor,
|
|
293
|
+
fillOpacity: this.toOptionalNumber(rawLayer?.fillOpacity),
|
|
294
|
+
strokeColor: rawLayer?.strokeColor,
|
|
295
|
+
strokeWidth: this.toOptionalNumber(rawLayer?.strokeWidth),
|
|
296
|
+
strokeOpacity: this.toOptionalNumber(rawLayer?.strokeOpacity),
|
|
297
|
+
pointRadius: this.toOptionalNumber(rawLayer?.pointRadius),
|
|
298
|
+
pointColor: rawLayer?.pointColor,
|
|
299
|
+
iconUrl: rawLayer?.iconUrl,
|
|
300
|
+
iconSize: rawLayer?.iconSize,
|
|
301
|
+
textProperty: rawLayer?.textProperty,
|
|
302
|
+
textColor: rawLayer?.textColor,
|
|
303
|
+
textSize: this.toOptionalNumber(rawLayer?.textSize),
|
|
304
|
+
}) ?? {});
|
|
305
|
+
break;
|
|
306
|
+
}
|
|
307
|
+
case 'osm':
|
|
308
|
+
setBase('url', this.toOptionalString(rawLayer?.url));
|
|
309
|
+
break;
|
|
310
|
+
default: {
|
|
311
|
+
const payload = rawLayer?.data && typeof rawLayer.data === 'object'
|
|
312
|
+
? rawLayer.data
|
|
313
|
+
: rawLayer;
|
|
314
|
+
if (payload && typeof payload === 'object') {
|
|
315
|
+
Object.assign(data, this.cleanRecord(payload) ?? {});
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
base.data = this.cleanRecord(data);
|
|
320
|
+
return base;
|
|
321
|
+
}
|
|
322
|
+
normalize(raw) {
|
|
323
|
+
const rawObj = (raw != null && typeof raw === 'object' ? raw : {});
|
|
324
|
+
const map = (rawObj.map != null && typeof rawObj.map === 'object' ? rawObj.map : rawObj);
|
|
325
|
+
const norm = {
|
|
326
|
+
map: {
|
|
327
|
+
flavour: String(map.flavour ?? 'ol'),
|
|
328
|
+
id: String(map.id ?? 'map1'),
|
|
329
|
+
zoom: Number(map.zoom ?? 2),
|
|
330
|
+
center: String(map.center ?? '0,0'),
|
|
331
|
+
style: String(map.style ?? ''),
|
|
332
|
+
styles: this.normalizeStyles(map.styles),
|
|
333
|
+
layerGroups: (Array.isArray(map.layerGroups) ? map.layerGroups : []).map((g, gi) => ({
|
|
334
|
+
groupTitle: String(g.groupTitle ?? g.group ?? g.title ?? `Group ${gi + 1}`),
|
|
335
|
+
basemapid: String(g.basemapid ?? ''),
|
|
336
|
+
visible: g.visible,
|
|
337
|
+
layers: (Array.isArray(g.layers) ? g.layers : []).map((l, li) => this.normalizeLayer(l, gi, li)),
|
|
338
|
+
})),
|
|
339
|
+
},
|
|
340
|
+
};
|
|
341
|
+
return norm;
|
|
342
|
+
}
|
|
343
|
+
normalizeStyles(input) {
|
|
344
|
+
const list = Array.isArray(input) ? input : input ? [input] : [];
|
|
345
|
+
return list
|
|
346
|
+
.map((entry, index) => this.normalizeStyle(entry, index))
|
|
347
|
+
.filter((style) => Boolean(style));
|
|
348
|
+
}
|
|
349
|
+
normalizeStyle(entry, index) {
|
|
350
|
+
if (entry == null)
|
|
351
|
+
return undefined;
|
|
352
|
+
const raw = typeof entry === 'object' && entry !== null
|
|
353
|
+
? entry
|
|
354
|
+
: { content: entry };
|
|
355
|
+
const keySource = raw.key ?? raw.id ?? raw.name;
|
|
356
|
+
const key = String(keySource != null ? keySource : `style-${index + 1}`);
|
|
357
|
+
const format = String(raw.format ?? 'sld').toLowerCase();
|
|
358
|
+
let layerTargets;
|
|
359
|
+
if (Array.isArray(raw.layerTargets)) {
|
|
360
|
+
const targets = raw.layerTargets
|
|
361
|
+
.map((target) => String(target).trim())
|
|
362
|
+
.filter(Boolean);
|
|
363
|
+
layerTargets = targets.length ? targets.join(',') : undefined;
|
|
364
|
+
}
|
|
365
|
+
else if (typeof raw.layerTargets === 'string') {
|
|
366
|
+
const targets = raw.layerTargets
|
|
367
|
+
.split(',')
|
|
368
|
+
.map(target => target.trim())
|
|
369
|
+
.filter(Boolean);
|
|
370
|
+
layerTargets = targets.length ? targets.join(',') : undefined;
|
|
371
|
+
}
|
|
372
|
+
const autoApply = raw.autoApply == null
|
|
373
|
+
? undefined
|
|
374
|
+
: typeof raw.autoApply === 'boolean'
|
|
375
|
+
? raw.autoApply
|
|
376
|
+
: String(raw.autoApply).toLowerCase() !== 'false';
|
|
377
|
+
let src = raw.src != null ? String(raw.src).trim() : undefined;
|
|
378
|
+
if (src === '')
|
|
379
|
+
src = undefined;
|
|
380
|
+
let content = raw.content != null ? String(raw.content) : undefined;
|
|
381
|
+
if (!src && !content && typeof raw.source === 'string') {
|
|
382
|
+
const source = raw.source.trim();
|
|
383
|
+
if (source) {
|
|
384
|
+
if (/^(https?:)?\/\//.test(source) ||
|
|
385
|
+
source.startsWith('/') ||
|
|
386
|
+
source.startsWith('./') ||
|
|
387
|
+
source.startsWith('../')) {
|
|
388
|
+
src = source;
|
|
389
|
+
}
|
|
390
|
+
else {
|
|
391
|
+
content = source;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
if (!src && !content) {
|
|
396
|
+
if (typeof entry === 'string') {
|
|
397
|
+
content = String(entry);
|
|
398
|
+
}
|
|
399
|
+
else {
|
|
400
|
+
log(`${MSG_COMPONENT}normalizeStyle: skipping style without src/content (key=${key})`);
|
|
401
|
+
return undefined;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return {
|
|
405
|
+
key,
|
|
406
|
+
format,
|
|
407
|
+
src,
|
|
408
|
+
content,
|
|
409
|
+
layerTargets,
|
|
410
|
+
autoApply,
|
|
411
|
+
id: raw.id != null ? String(raw.id) : undefined,
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
syncStyles(mapEl, styles) {
|
|
415
|
+
const selector = 'v-map-style[data-builder-style="true"]';
|
|
416
|
+
const existing = Array.from(mapEl.querySelectorAll(selector));
|
|
417
|
+
const existingByKey = new Map();
|
|
418
|
+
for (const el of existing) {
|
|
419
|
+
const key = el.getAttribute('data-builder-style-id');
|
|
420
|
+
if (key)
|
|
421
|
+
existingByKey.set(key, el);
|
|
422
|
+
}
|
|
423
|
+
const processed = new Set();
|
|
424
|
+
const anchor = Array.from(mapEl.children).find(child => {
|
|
425
|
+
if (child.tagName.toLowerCase() !== 'v-map-style')
|
|
426
|
+
return true;
|
|
427
|
+
return (child.getAttribute('data-builder-style') !== 'true');
|
|
428
|
+
});
|
|
429
|
+
styles.forEach((style, index) => {
|
|
430
|
+
const key = style.key || `style-${index + 1}`;
|
|
431
|
+
let el = existingByKey.get(key);
|
|
432
|
+
if (!el || el.parentElement !== mapEl) {
|
|
433
|
+
el = document.createElement('v-map-style');
|
|
434
|
+
el.setAttribute('data-builder-style', 'true');
|
|
435
|
+
el.setAttribute('data-builder-style-id', key);
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
el.setAttribute('data-builder-style', 'true');
|
|
439
|
+
el.setAttribute('data-builder-style-id', key);
|
|
440
|
+
}
|
|
441
|
+
processed.add(key);
|
|
442
|
+
this.ensureAttr(el, 'format', style.format);
|
|
443
|
+
this.ensureAttr(el, 'layer-targets', style.layerTargets);
|
|
444
|
+
if (style.autoApply !== undefined) {
|
|
445
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- setting Stencil web component property
|
|
446
|
+
el.autoApply = style.autoApply;
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- setting Stencil web component property
|
|
450
|
+
el.autoApply = true;
|
|
451
|
+
}
|
|
452
|
+
const autoApplyAttr = style.autoApply === true ? '' : undefined;
|
|
453
|
+
this.ensureAttr(el, 'auto-apply', autoApplyAttr);
|
|
454
|
+
this.ensureAttr(el, 'id', style.id);
|
|
455
|
+
this.ensureAttr(el, 'src', style.src);
|
|
456
|
+
this.ensureAttr(el, 'content', style.content);
|
|
457
|
+
const reference = anchor && anchor.parentElement === mapEl ? anchor : null;
|
|
458
|
+
if (!el.isConnected || el.parentElement !== mapEl) {
|
|
459
|
+
mapEl.insertBefore(el, reference);
|
|
460
|
+
}
|
|
461
|
+
else if (reference) {
|
|
462
|
+
mapEl.insertBefore(el, reference);
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
for (const el of existing) {
|
|
466
|
+
const key = el.getAttribute('data-builder-style-id') || '';
|
|
467
|
+
if (!processed.has(key)) {
|
|
468
|
+
mapEl.removeChild(el);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
ensureAttr(el, name, value) {
|
|
473
|
+
const v = value == null ? undefined : String(value);
|
|
474
|
+
const cur = el.getAttribute(name);
|
|
475
|
+
if (v == null) {
|
|
476
|
+
if (cur != null)
|
|
477
|
+
el.removeAttribute(name);
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
if (cur !== v)
|
|
481
|
+
el.setAttribute(name, v);
|
|
482
|
+
}
|
|
483
|
+
ensureGroup(mapEl, title, basemapid, visible, index) {
|
|
484
|
+
let el = Array.from(mapEl.children).find(ch => ch.tagName.toLowerCase() === 'v-map-layergroup' &&
|
|
485
|
+
ch.getAttribute('group-title') === title);
|
|
486
|
+
if (!el) {
|
|
487
|
+
el = document.createElement('v-map-layergroup');
|
|
488
|
+
el.setAttribute('group-title', title);
|
|
489
|
+
mapEl.insertBefore(el, (index != null ? mapEl.children[index] : null) || null);
|
|
490
|
+
}
|
|
491
|
+
this.ensureAttr(el, 'visible', visible);
|
|
492
|
+
if (basemapid) {
|
|
493
|
+
this.ensureAttr(el, 'basemapid', basemapid);
|
|
494
|
+
}
|
|
495
|
+
return el;
|
|
496
|
+
}
|
|
497
|
+
toKebabCase(value) {
|
|
498
|
+
return value
|
|
499
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
|
500
|
+
.replace(/[\s_]+/g, '-')
|
|
501
|
+
.toLowerCase();
|
|
502
|
+
}
|
|
503
|
+
createLayerEl(layer) {
|
|
504
|
+
const data = (layer.data || {});
|
|
505
|
+
const common = {
|
|
506
|
+
id: layer.id,
|
|
507
|
+
visible: layer.visible,
|
|
508
|
+
opacity: layer.opacity,
|
|
509
|
+
'z-index': layer.zIndex,
|
|
510
|
+
...(layer.style ? { style: JSON.stringify(layer.style) } : {}),
|
|
511
|
+
};
|
|
512
|
+
const add = (attribute, value, opts) => {
|
|
513
|
+
if (value === undefined || value === null)
|
|
514
|
+
return;
|
|
515
|
+
if (opts?.json && typeof value !== 'string') {
|
|
516
|
+
try {
|
|
517
|
+
common[attribute] = JSON.stringify(value);
|
|
518
|
+
}
|
|
519
|
+
catch {
|
|
520
|
+
common[attribute] = String(value);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
else {
|
|
524
|
+
common[attribute] = value;
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
let el;
|
|
528
|
+
switch (layer.type) {
|
|
529
|
+
case 'osm':
|
|
530
|
+
el = document.createElement('v-map-layer-osm');
|
|
531
|
+
break;
|
|
532
|
+
case 'wms':
|
|
533
|
+
case 'wms-tiled': {
|
|
534
|
+
el = document.createElement('v-map-layer-wms');
|
|
535
|
+
add('url', layer.url ?? data.url);
|
|
536
|
+
add('layers', layer.layers ?? data.layers);
|
|
537
|
+
const tiledValue = layer.type === 'wms-tiled'
|
|
538
|
+
? true
|
|
539
|
+
: data.tiled ?? layer.tiled ?? undefined;
|
|
540
|
+
add('tiled', tiledValue);
|
|
541
|
+
add('styles', data.styles);
|
|
542
|
+
add('format', data.format);
|
|
543
|
+
add('transparent', data.transparent);
|
|
544
|
+
add('version', data.version);
|
|
545
|
+
add('time', data.time);
|
|
546
|
+
if (data.params)
|
|
547
|
+
add('params', typeof data.params === 'string'
|
|
548
|
+
? data.params
|
|
549
|
+
: JSON.stringify(data.params));
|
|
550
|
+
break;
|
|
551
|
+
}
|
|
552
|
+
case 'geojson': {
|
|
553
|
+
el = document.createElement('v-map-layer-geojson');
|
|
554
|
+
add('url', layer.url ?? data.url);
|
|
555
|
+
const geojsonPayload = data.geojson ?? data.data;
|
|
556
|
+
if (geojsonPayload !== undefined) {
|
|
557
|
+
add('geojson', typeof geojsonPayload === 'string'
|
|
558
|
+
? geojsonPayload
|
|
559
|
+
: JSON.stringify(geojsonPayload));
|
|
560
|
+
}
|
|
561
|
+
add('fill-color', data.fillColor);
|
|
562
|
+
add('fill-opacity', data.fillOpacity);
|
|
563
|
+
add('stroke-color', data.strokeColor);
|
|
564
|
+
add('stroke-width', data.strokeWidth);
|
|
565
|
+
add('stroke-opacity', data.strokeOpacity);
|
|
566
|
+
add('point-radius', data.pointRadius);
|
|
567
|
+
add('point-color', data.pointColor);
|
|
568
|
+
add('icon-url', data.iconUrl);
|
|
569
|
+
add('icon-size', data.iconSize);
|
|
570
|
+
add('text-property', data.textProperty);
|
|
571
|
+
add('text-color', data.textColor);
|
|
572
|
+
add('text-size', data.textSize);
|
|
573
|
+
break;
|
|
574
|
+
}
|
|
575
|
+
case 'xyz': {
|
|
576
|
+
el = document.createElement('v-map-layer-xyz');
|
|
577
|
+
add('url', layer.url ?? data.url);
|
|
578
|
+
add('attributions', data.attributions);
|
|
579
|
+
add('max-zoom', data.maxZoom);
|
|
580
|
+
add('tile-size', data.tileSize);
|
|
581
|
+
add('subdomains', data.subdomains);
|
|
582
|
+
break;
|
|
583
|
+
}
|
|
584
|
+
case 'terrain': {
|
|
585
|
+
el = document.createElement('v-map-layer-terrain');
|
|
586
|
+
add('elevation-data', data.elevationData);
|
|
587
|
+
add('texture', data.texture);
|
|
588
|
+
if (data.elevationDecoder)
|
|
589
|
+
add('elevation-decoder', data.elevationDecoder, { json: typeof data.elevationDecoder !== 'string' });
|
|
590
|
+
add('wireframe', data.wireframe);
|
|
591
|
+
if (data.color) {
|
|
592
|
+
add('color', Array.isArray(data.color) ? JSON.stringify(data.color) : data.color);
|
|
593
|
+
}
|
|
594
|
+
add('min-zoom', data.minZoom);
|
|
595
|
+
add('max-zoom', data.maxZoom);
|
|
596
|
+
add('mesh-max-error', data.meshMaxError);
|
|
597
|
+
break;
|
|
598
|
+
}
|
|
599
|
+
case 'wfs': {
|
|
600
|
+
el = document.createElement('v-map-layer-wfs');
|
|
601
|
+
add('url', data.url ?? layer.url);
|
|
602
|
+
add('type-name', data.typeName);
|
|
603
|
+
add('version', data.version);
|
|
604
|
+
add('output-format', data.outputFormat);
|
|
605
|
+
add('srs-name', data.srsName);
|
|
606
|
+
if (data.params)
|
|
607
|
+
add('params', typeof data.params === 'string'
|
|
608
|
+
? data.params
|
|
609
|
+
: JSON.stringify(data.params));
|
|
610
|
+
break;
|
|
611
|
+
}
|
|
612
|
+
case 'wcs': {
|
|
613
|
+
el = document.createElement('v-map-layer-wcs');
|
|
614
|
+
add('url', data.url ?? layer.url);
|
|
615
|
+
add('coverage-name', data.coverageName);
|
|
616
|
+
add('format', data.format);
|
|
617
|
+
add('version', data.version);
|
|
618
|
+
add('projection', data.projection);
|
|
619
|
+
if (data.resolutions)
|
|
620
|
+
add('resolutions', typeof data.resolutions === 'string'
|
|
621
|
+
? data.resolutions
|
|
622
|
+
: JSON.stringify(data.resolutions));
|
|
623
|
+
if (data.params)
|
|
624
|
+
add('params', typeof data.params === 'string'
|
|
625
|
+
? data.params
|
|
626
|
+
: JSON.stringify(data.params));
|
|
627
|
+
break;
|
|
628
|
+
}
|
|
629
|
+
case 'google': {
|
|
630
|
+
el = document.createElement('v-map-layer-google');
|
|
631
|
+
add('api-key', data.apiKey);
|
|
632
|
+
add('map-type', data.mapType);
|
|
633
|
+
add('language', data.language);
|
|
634
|
+
add('region', data.region);
|
|
635
|
+
add('scale', data.scale);
|
|
636
|
+
add('libraries', data.libraries);
|
|
637
|
+
add('max-zoom', data.maxZoom);
|
|
638
|
+
if (data.styles)
|
|
639
|
+
add('styles', typeof data.styles === 'string'
|
|
640
|
+
? data.styles
|
|
641
|
+
: JSON.stringify(data.styles));
|
|
642
|
+
break;
|
|
643
|
+
}
|
|
644
|
+
case 'geotiff': {
|
|
645
|
+
el = document.createElement('v-map-layer-geotiff');
|
|
646
|
+
add('url', layer.url ?? data.url);
|
|
647
|
+
break;
|
|
648
|
+
}
|
|
649
|
+
case 'tile3d': {
|
|
650
|
+
el = document.createElement('v-map-layer-tile3d');
|
|
651
|
+
add('url', layer.url ?? data.url);
|
|
652
|
+
if (data.tilesetOptions)
|
|
653
|
+
add('tileset-options', typeof data.tilesetOptions === 'string'
|
|
654
|
+
? data.tilesetOptions
|
|
655
|
+
: JSON.stringify(data.tilesetOptions));
|
|
656
|
+
break;
|
|
657
|
+
}
|
|
658
|
+
case 'scatterplot': {
|
|
659
|
+
el = document.createElement('v-map-layer-scatterplot');
|
|
660
|
+
add('url', data.url);
|
|
661
|
+
if (data.data)
|
|
662
|
+
add('data', typeof data.data === 'string'
|
|
663
|
+
? data.data
|
|
664
|
+
: JSON.stringify(data.data));
|
|
665
|
+
add('get-fill-color', data.getFillColor);
|
|
666
|
+
add('get-radius', data.getRadius);
|
|
667
|
+
break;
|
|
668
|
+
}
|
|
669
|
+
case 'wkt': {
|
|
670
|
+
el = document.createElement('v-map-layer-wkt');
|
|
671
|
+
if (data.wkt)
|
|
672
|
+
add('wkt', typeof data.wkt === 'string' ? data.wkt : JSON.stringify(data.wkt));
|
|
673
|
+
add('url', data.url);
|
|
674
|
+
add('fill-color', data.fillColor);
|
|
675
|
+
add('fill-opacity', data.fillOpacity);
|
|
676
|
+
add('stroke-color', data.strokeColor);
|
|
677
|
+
add('stroke-width', data.strokeWidth);
|
|
678
|
+
add('stroke-opacity', data.strokeOpacity);
|
|
679
|
+
add('point-radius', data.pointRadius);
|
|
680
|
+
add('point-color', data.pointColor);
|
|
681
|
+
add('icon-url', data.iconUrl);
|
|
682
|
+
add('icon-size', data.iconSize);
|
|
683
|
+
add('text-property', data.textProperty);
|
|
684
|
+
add('text-color', data.textColor);
|
|
685
|
+
add('text-size', data.textSize);
|
|
686
|
+
break;
|
|
687
|
+
}
|
|
688
|
+
default: {
|
|
689
|
+
el = document.createElement('v-map-layer-custom');
|
|
690
|
+
el.setAttribute('type', layer.type);
|
|
691
|
+
if (data && typeof data === 'object') {
|
|
692
|
+
for (const [key, value] of Object.entries(data)) {
|
|
693
|
+
add(this.toKebabCase(key), typeof value === 'object' && value !== null
|
|
694
|
+
? JSON.stringify(value)
|
|
695
|
+
: value);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
for (const [key, value] of Object.entries(common)) {
|
|
701
|
+
this.ensureAttr(el, key, value);
|
|
702
|
+
}
|
|
703
|
+
return el;
|
|
704
|
+
}
|
|
705
|
+
patchLayer(el, patch, next) {
|
|
706
|
+
for (const [field, change] of Object.entries(patch)) {
|
|
707
|
+
const nv = change.new;
|
|
708
|
+
switch (field) {
|
|
709
|
+
case 'visible':
|
|
710
|
+
this.ensureAttr(el, 'visible', nv);
|
|
711
|
+
break;
|
|
712
|
+
case 'opacity':
|
|
713
|
+
this.ensureAttr(el, 'opacity', nv);
|
|
714
|
+
break;
|
|
715
|
+
case 'zIndex':
|
|
716
|
+
this.ensureAttr(el, 'z-index', nv);
|
|
717
|
+
break;
|
|
718
|
+
case 'url':
|
|
719
|
+
this.ensureAttr(el, 'url', nv);
|
|
720
|
+
break;
|
|
721
|
+
case 'layers':
|
|
722
|
+
this.ensureAttr(el, 'layers', nv);
|
|
723
|
+
break;
|
|
724
|
+
case 'tiled':
|
|
725
|
+
this.ensureAttr(el, 'tiled', nv);
|
|
726
|
+
break;
|
|
727
|
+
case 'style':
|
|
728
|
+
this.ensureAttr(el, 'style', nv ? JSON.stringify(nv) : undefined);
|
|
729
|
+
break;
|
|
730
|
+
case 'data':
|
|
731
|
+
if ([
|
|
732
|
+
'terrain',
|
|
733
|
+
'wfs',
|
|
734
|
+
'wcs',
|
|
735
|
+
'wms',
|
|
736
|
+
'wms-tiled',
|
|
737
|
+
'geojson',
|
|
738
|
+
'xyz',
|
|
739
|
+
'google',
|
|
740
|
+
'tile3d',
|
|
741
|
+
'scatterplot',
|
|
742
|
+
'wkt',
|
|
743
|
+
].includes(next.type)) {
|
|
744
|
+
const parent = el.parentElement;
|
|
745
|
+
const newEl = this.createLayerEl(next);
|
|
746
|
+
parent.replaceChild(newEl, el);
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
749
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- custom web component method not in DOM typings
|
|
750
|
+
el.setData?.(nv);
|
|
751
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- custom web component method not in DOM typings
|
|
752
|
+
if (!el.setData) {
|
|
753
|
+
const s = typeof nv === 'object' ? JSON.stringify(nv) : nv;
|
|
754
|
+
this.ensureAttr(el, 'data', s);
|
|
755
|
+
}
|
|
756
|
+
break;
|
|
757
|
+
case 'type':
|
|
758
|
+
const parent = el.parentElement;
|
|
759
|
+
const newEl = this.createLayerEl(next);
|
|
760
|
+
parent.replaceChild(newEl, el);
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
applyDiff(_prev, next) {
|
|
766
|
+
const container = this.hostEl;
|
|
767
|
+
let mapEl = Array.from(container.children).find(ch => ch.tagName.toLowerCase() === 'v-map');
|
|
768
|
+
if (!mapEl) {
|
|
769
|
+
mapEl = document.createElement('v-map');
|
|
770
|
+
container.appendChild(mapEl);
|
|
771
|
+
}
|
|
772
|
+
this.ensureAttr(mapEl, 'flavour', next.map.flavour);
|
|
773
|
+
this.ensureAttr(mapEl, 'id', next.map.id);
|
|
774
|
+
this.ensureAttr(mapEl, 'zoom', String(next.map.zoom));
|
|
775
|
+
this.ensureAttr(mapEl, 'center', next.map.center);
|
|
776
|
+
this.ensureAttr(mapEl, 'style', next.map.style);
|
|
777
|
+
this.syncStyles(mapEl, next.map.styles || []);
|
|
778
|
+
const nextTitles = new Set(next.map.layerGroups.map(g => g.groupTitle));
|
|
779
|
+
Array.from(mapEl.children).forEach(ch => {
|
|
780
|
+
if (ch.tagName.toLowerCase() !== 'v-map-layergroup')
|
|
781
|
+
return;
|
|
782
|
+
const t = ch.getAttribute('group-title') || '';
|
|
783
|
+
if (!nextTitles.has(t))
|
|
784
|
+
mapEl.removeChild(ch);
|
|
785
|
+
});
|
|
786
|
+
next.map.layerGroups.forEach((group, gi) => {
|
|
787
|
+
const groupEl = this.ensureGroup(mapEl, group.groupTitle, group.basemapid, group.visible, gi);
|
|
788
|
+
const oldLayers = [];
|
|
789
|
+
Array.from(groupEl.children).forEach(ch => {
|
|
790
|
+
const id = ch.getAttribute('id') || '';
|
|
791
|
+
const type = ch.tagName
|
|
792
|
+
.toLowerCase()
|
|
793
|
+
.replace('v-map-layer-', '');
|
|
794
|
+
oldLayers.push({ id, type });
|
|
795
|
+
});
|
|
796
|
+
const { removed, updated, moved } = diffLayers(oldLayers, group.layers);
|
|
797
|
+
for (const r of removed) {
|
|
798
|
+
const el = Array.from(groupEl.children).find(ch => ch.getAttribute('id') === r.id);
|
|
799
|
+
if (el)
|
|
800
|
+
groupEl.removeChild(el);
|
|
801
|
+
}
|
|
802
|
+
for (const m of moved) {
|
|
803
|
+
const el = Array.from(groupEl.children).find(ch => ch.getAttribute('id') === m.id);
|
|
804
|
+
if (el)
|
|
805
|
+
groupEl.insertBefore(el, groupEl.children[m.to] || null);
|
|
806
|
+
}
|
|
807
|
+
for (const u of updated) {
|
|
808
|
+
const el = Array.from(groupEl.children).find(ch => ch.getAttribute('id') === u.id);
|
|
809
|
+
if (!el)
|
|
810
|
+
continue;
|
|
811
|
+
const nextLayer = group.layers.find(l => l.id === u.id);
|
|
812
|
+
this.patchLayer(el, u.changes, nextLayer);
|
|
813
|
+
}
|
|
814
|
+
group.layers.forEach((l, idx) => {
|
|
815
|
+
const exists = Array.from(groupEl.children).some(ch => ch.getAttribute('id') === l.id);
|
|
816
|
+
if (!exists) {
|
|
817
|
+
const el = this.createLayerEl(l);
|
|
818
|
+
groupEl.insertBefore(el, groupEl.children[idx] || null);
|
|
819
|
+
}
|
|
820
|
+
});
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
onSlotChange = () => {
|
|
824
|
+
log(MSG_COMPONENT + 'onSlotChange');
|
|
825
|
+
this.parseFromSlot();
|
|
826
|
+
//this.observeAssignedNodes();
|
|
827
|
+
//this.readGeoJsonFromSlot();
|
|
828
|
+
};
|
|
829
|
+
render() {
|
|
830
|
+
log(MSG_COMPONENT + MSG.COMPONENT_RENDER);
|
|
831
|
+
return (h("div", { key: '0e041d9d068e0b31b1d1245888e8aa3668b22625', class: "root" }, h("slot", { key: '0141bfb2be32531f9673bc8d0759943dd7ac63b1', name: "mapconfig", onSlotchange: this.onSlotChange }), h("slot", { key: '2df1c8fe43ea7ee4db3fc57875f0cec126b1fa97' })));
|
|
832
|
+
}
|
|
833
|
+
static get is() { return "v-map-builder"; }
|
|
834
|
+
static get encapsulation() { return "shadow"; }
|
|
835
|
+
static get originalStyleUrls() {
|
|
836
|
+
return {
|
|
837
|
+
"$": ["v-map-builder.css"]
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
static get styleUrls() {
|
|
841
|
+
return {
|
|
842
|
+
"$": ["v-map-builder.css"]
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
static get properties() {
|
|
846
|
+
return {
|
|
847
|
+
"mapconfig": {
|
|
848
|
+
"type": "unknown",
|
|
849
|
+
"mutable": true,
|
|
850
|
+
"complexType": {
|
|
851
|
+
"original": "unknown",
|
|
852
|
+
"resolved": "unknown",
|
|
853
|
+
"references": {}
|
|
854
|
+
},
|
|
855
|
+
"required": false,
|
|
856
|
+
"optional": true,
|
|
857
|
+
"docs": {
|
|
858
|
+
"tags": [],
|
|
859
|
+
"text": "Configuration object for the map builder. Can be any structure that will be normalized to BuilderConfig."
|
|
860
|
+
},
|
|
861
|
+
"getter": false,
|
|
862
|
+
"setter": false
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
static get events() {
|
|
867
|
+
return [{
|
|
868
|
+
"method": "configReady",
|
|
869
|
+
"name": "configReady",
|
|
870
|
+
"bubbles": true,
|
|
871
|
+
"cancelable": true,
|
|
872
|
+
"composed": true,
|
|
873
|
+
"docs": {
|
|
874
|
+
"tags": [],
|
|
875
|
+
"text": "Event emitted when the map configuration has been successfully parsed and is ready to use."
|
|
876
|
+
},
|
|
877
|
+
"complexType": {
|
|
878
|
+
"original": "BuilderConfig",
|
|
879
|
+
"resolved": "BuilderConfig",
|
|
880
|
+
"references": {
|
|
881
|
+
"BuilderConfig": {
|
|
882
|
+
"location": "import",
|
|
883
|
+
"path": "../../utils/diff",
|
|
884
|
+
"id": "src/utils/diff.ts::BuilderConfig",
|
|
885
|
+
"referenceLocation": "BuilderConfig"
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
}, {
|
|
890
|
+
"method": "configError",
|
|
891
|
+
"name": "configError",
|
|
892
|
+
"bubbles": true,
|
|
893
|
+
"cancelable": true,
|
|
894
|
+
"composed": true,
|
|
895
|
+
"docs": {
|
|
896
|
+
"tags": [],
|
|
897
|
+
"text": "Event emitted when there is an error parsing the map configuration."
|
|
898
|
+
},
|
|
899
|
+
"complexType": {
|
|
900
|
+
"original": "{\n message: string;\n errors?: string[];\n }",
|
|
901
|
+
"resolved": "{ message: string; errors?: string[]; }",
|
|
902
|
+
"references": {}
|
|
903
|
+
}
|
|
904
|
+
}];
|
|
905
|
+
}
|
|
906
|
+
static get elementRef() { return "hostEl"; }
|
|
907
|
+
static get watchers() {
|
|
908
|
+
return [{
|
|
909
|
+
"propName": "mapconfig",
|
|
910
|
+
"methodName": "onMapConfigChanged"
|
|
911
|
+
}];
|
|
912
|
+
}
|
|
913
|
+
}
|