@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,1300 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var deckProvider = require('./deck-provider-Ctq3Q8a1.js');
|
|
4
|
+
|
|
5
|
+
// deck.gl
|
|
6
|
+
// SPDX-License-Identifier: MIT
|
|
7
|
+
// Copyright (c) vis.gl contributors
|
|
8
|
+
const uniformBlock$1 = `\
|
|
9
|
+
uniform arcUniforms {
|
|
10
|
+
bool greatCircle;
|
|
11
|
+
bool useShortestPath;
|
|
12
|
+
float numSegments;
|
|
13
|
+
float widthScale;
|
|
14
|
+
float widthMinPixels;
|
|
15
|
+
float widthMaxPixels;
|
|
16
|
+
highp int widthUnits;
|
|
17
|
+
} arc;
|
|
18
|
+
`;
|
|
19
|
+
const arcUniforms = {
|
|
20
|
+
name: 'arc',
|
|
21
|
+
vs: uniformBlock$1,
|
|
22
|
+
fs: uniformBlock$1,
|
|
23
|
+
uniformTypes: {
|
|
24
|
+
greatCircle: 'f32',
|
|
25
|
+
useShortestPath: 'f32',
|
|
26
|
+
numSegments: 'f32',
|
|
27
|
+
widthScale: 'f32',
|
|
28
|
+
widthMinPixels: 'f32',
|
|
29
|
+
widthMaxPixels: 'f32',
|
|
30
|
+
widthUnits: 'i32'
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// deck.gl
|
|
35
|
+
// SPDX-License-Identifier: MIT
|
|
36
|
+
// Copyright (c) vis.gl contributors
|
|
37
|
+
var vs$2 = `\
|
|
38
|
+
#version 300 es
|
|
39
|
+
#define SHADER_NAME arc-layer-vertex-shader
|
|
40
|
+
in vec4 instanceSourceColors;
|
|
41
|
+
in vec4 instanceTargetColors;
|
|
42
|
+
in vec3 instanceSourcePositions;
|
|
43
|
+
in vec3 instanceSourcePositions64Low;
|
|
44
|
+
in vec3 instanceTargetPositions;
|
|
45
|
+
in vec3 instanceTargetPositions64Low;
|
|
46
|
+
in vec3 instancePickingColors;
|
|
47
|
+
in float instanceWidths;
|
|
48
|
+
in float instanceHeights;
|
|
49
|
+
in float instanceTilts;
|
|
50
|
+
out vec4 vColor;
|
|
51
|
+
out vec2 uv;
|
|
52
|
+
out float isValid;
|
|
53
|
+
float paraboloid(float distance, float sourceZ, float targetZ, float ratio) {
|
|
54
|
+
float deltaZ = targetZ - sourceZ;
|
|
55
|
+
float dh = distance * instanceHeights;
|
|
56
|
+
if (dh == 0.0) {
|
|
57
|
+
return sourceZ + deltaZ * ratio;
|
|
58
|
+
}
|
|
59
|
+
float unitZ = deltaZ / dh;
|
|
60
|
+
float p2 = unitZ * unitZ + 1.0;
|
|
61
|
+
float dir = step(deltaZ, 0.0);
|
|
62
|
+
float z0 = mix(sourceZ, targetZ, dir);
|
|
63
|
+
float r = mix(ratio, 1.0 - ratio, dir);
|
|
64
|
+
return sqrt(r * (p2 - r)) * dh + z0;
|
|
65
|
+
}
|
|
66
|
+
vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {
|
|
67
|
+
vec2 dir_screenspace = normalize(line_clipspace * project.viewportSize);
|
|
68
|
+
dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
|
|
69
|
+
return dir_screenspace * offset_direction * width / 2.0;
|
|
70
|
+
}
|
|
71
|
+
float getSegmentRatio(float index) {
|
|
72
|
+
return smoothstep(0.0, 1.0, index / (arc.numSegments - 1.0));
|
|
73
|
+
}
|
|
74
|
+
vec3 interpolateFlat(vec3 source, vec3 target, float segmentRatio) {
|
|
75
|
+
float distance = length(source.xy - target.xy);
|
|
76
|
+
float z = paraboloid(distance, source.z, target.z, segmentRatio);
|
|
77
|
+
float tiltAngle = radians(instanceTilts);
|
|
78
|
+
vec2 tiltDirection = normalize(target.xy - source.xy);
|
|
79
|
+
vec2 tilt = vec2(-tiltDirection.y, tiltDirection.x) * z * sin(tiltAngle);
|
|
80
|
+
return vec3(
|
|
81
|
+
mix(source.xy, target.xy, segmentRatio) + tilt,
|
|
82
|
+
z * cos(tiltAngle)
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
float getAngularDist (vec2 source, vec2 target) {
|
|
86
|
+
vec2 sourceRadians = radians(source);
|
|
87
|
+
vec2 targetRadians = radians(target);
|
|
88
|
+
vec2 sin_half_delta = sin((sourceRadians - targetRadians) / 2.0);
|
|
89
|
+
vec2 shd_sq = sin_half_delta * sin_half_delta;
|
|
90
|
+
float a = shd_sq.y + cos(sourceRadians.y) * cos(targetRadians.y) * shd_sq.x;
|
|
91
|
+
return 2.0 * asin(sqrt(a));
|
|
92
|
+
}
|
|
93
|
+
vec3 interpolateGreatCircle(vec3 source, vec3 target, vec3 source3D, vec3 target3D, float angularDist, float t) {
|
|
94
|
+
vec2 lngLat;
|
|
95
|
+
if(abs(angularDist - PI) < 0.001) {
|
|
96
|
+
lngLat = (1.0 - t) * source.xy + t * target.xy;
|
|
97
|
+
} else {
|
|
98
|
+
float a = sin((1.0 - t) * angularDist);
|
|
99
|
+
float b = sin(t * angularDist);
|
|
100
|
+
vec3 p = source3D.yxz * a + target3D.yxz * b;
|
|
101
|
+
lngLat = degrees(vec2(atan(p.y, -p.x), atan(p.z, length(p.xy))));
|
|
102
|
+
}
|
|
103
|
+
float z = paraboloid(angularDist * EARTH_RADIUS, source.z, target.z, t);
|
|
104
|
+
return vec3(lngLat, z);
|
|
105
|
+
}
|
|
106
|
+
void main(void) {
|
|
107
|
+
geometry.worldPosition = instanceSourcePositions;
|
|
108
|
+
geometry.worldPositionAlt = instanceTargetPositions;
|
|
109
|
+
float segmentIndex = float(gl_VertexID / 2);
|
|
110
|
+
float segmentSide = mod(float(gl_VertexID), 2.) == 0. ? -1. : 1.;
|
|
111
|
+
float segmentRatio = getSegmentRatio(segmentIndex);
|
|
112
|
+
float prevSegmentRatio = getSegmentRatio(max(0.0, segmentIndex - 1.0));
|
|
113
|
+
float nextSegmentRatio = getSegmentRatio(min(arc.numSegments - 1.0, segmentIndex + 1.0));
|
|
114
|
+
float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));
|
|
115
|
+
isValid = 1.0;
|
|
116
|
+
uv = vec2(segmentRatio, segmentSide);
|
|
117
|
+
geometry.uv = uv;
|
|
118
|
+
geometry.pickingColor = instancePickingColors;
|
|
119
|
+
vec4 curr;
|
|
120
|
+
vec4 next;
|
|
121
|
+
vec3 source;
|
|
122
|
+
vec3 target;
|
|
123
|
+
if ((arc.greatCircle || project.projectionMode == PROJECTION_MODE_GLOBE) && project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
|
|
124
|
+
source = project_globe_(vec3(instanceSourcePositions.xy, 0.0));
|
|
125
|
+
target = project_globe_(vec3(instanceTargetPositions.xy, 0.0));
|
|
126
|
+
float angularDist = getAngularDist(instanceSourcePositions.xy, instanceTargetPositions.xy);
|
|
127
|
+
vec3 prevPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, prevSegmentRatio);
|
|
128
|
+
vec3 currPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, segmentRatio);
|
|
129
|
+
vec3 nextPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, nextSegmentRatio);
|
|
130
|
+
if (abs(currPos.x - prevPos.x) > 180.0) {
|
|
131
|
+
indexDir = -1.0;
|
|
132
|
+
isValid = 0.0;
|
|
133
|
+
} else if (abs(currPos.x - nextPos.x) > 180.0) {
|
|
134
|
+
indexDir = 1.0;
|
|
135
|
+
isValid = 0.0;
|
|
136
|
+
}
|
|
137
|
+
nextPos = indexDir < 0.0 ? prevPos : nextPos;
|
|
138
|
+
nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;
|
|
139
|
+
if (isValid == 0.0) {
|
|
140
|
+
nextPos.x += nextPos.x > 0.0 ? -360.0 : 360.0;
|
|
141
|
+
float t = ((currPos.x > 0.0 ? 180.0 : -180.0) - currPos.x) / (nextPos.x - currPos.x);
|
|
142
|
+
currPos = mix(currPos, nextPos, t);
|
|
143
|
+
segmentRatio = mix(segmentRatio, nextSegmentRatio, t);
|
|
144
|
+
}
|
|
145
|
+
vec3 currPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, segmentRatio);
|
|
146
|
+
vec3 nextPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, nextSegmentRatio);
|
|
147
|
+
curr = project_position_to_clipspace(currPos, currPos64Low, vec3(0.0), geometry.position);
|
|
148
|
+
next = project_position_to_clipspace(nextPos, nextPos64Low, vec3(0.0));
|
|
149
|
+
} else {
|
|
150
|
+
vec3 source_world = instanceSourcePositions;
|
|
151
|
+
vec3 target_world = instanceTargetPositions;
|
|
152
|
+
if (arc.useShortestPath) {
|
|
153
|
+
source_world.x = mod(source_world.x + 180., 360.0) - 180.;
|
|
154
|
+
target_world.x = mod(target_world.x + 180., 360.0) - 180.;
|
|
155
|
+
float deltaLng = target_world.x - source_world.x;
|
|
156
|
+
if (deltaLng > 180.) target_world.x -= 360.;
|
|
157
|
+
if (deltaLng < -180.) source_world.x -= 360.;
|
|
158
|
+
}
|
|
159
|
+
source = project_position(source_world, instanceSourcePositions64Low);
|
|
160
|
+
target = project_position(target_world, instanceTargetPositions64Low);
|
|
161
|
+
float antiMeridianX = 0.0;
|
|
162
|
+
if (arc.useShortestPath) {
|
|
163
|
+
if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {
|
|
164
|
+
antiMeridianX = -(project.coordinateOrigin.x + 180.) / 360. * TILE_SIZE;
|
|
165
|
+
}
|
|
166
|
+
float thresholdRatio = (antiMeridianX - source.x) / (target.x - source.x);
|
|
167
|
+
if (prevSegmentRatio <= thresholdRatio && nextSegmentRatio > thresholdRatio) {
|
|
168
|
+
isValid = 0.0;
|
|
169
|
+
indexDir = sign(segmentRatio - thresholdRatio);
|
|
170
|
+
segmentRatio = thresholdRatio;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;
|
|
174
|
+
vec3 currPos = interpolateFlat(source, target, segmentRatio);
|
|
175
|
+
vec3 nextPos = interpolateFlat(source, target, nextSegmentRatio);
|
|
176
|
+
if (arc.useShortestPath) {
|
|
177
|
+
if (nextPos.x < antiMeridianX) {
|
|
178
|
+
currPos.x += TILE_SIZE;
|
|
179
|
+
nextPos.x += TILE_SIZE;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
curr = project_common_position_to_clipspace(vec4(currPos, 1.0));
|
|
183
|
+
next = project_common_position_to_clipspace(vec4(nextPos, 1.0));
|
|
184
|
+
geometry.position = vec4(currPos, 1.0);
|
|
185
|
+
}
|
|
186
|
+
float widthPixels = clamp(
|
|
187
|
+
project_size_to_pixel(instanceWidths * arc.widthScale, arc.widthUnits),
|
|
188
|
+
arc.widthMinPixels, arc.widthMaxPixels
|
|
189
|
+
);
|
|
190
|
+
vec3 offset = vec3(
|
|
191
|
+
getExtrusionOffset((next.xy - curr.xy) * indexDir, segmentSide, widthPixels),
|
|
192
|
+
0.0);
|
|
193
|
+
DECKGL_FILTER_SIZE(offset, geometry);
|
|
194
|
+
DECKGL_FILTER_GL_POSITION(curr, geometry);
|
|
195
|
+
gl_Position = curr + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);
|
|
196
|
+
vec4 color = mix(instanceSourceColors, instanceTargetColors, segmentRatio);
|
|
197
|
+
vColor = vec4(color.rgb, color.a * layer.opacity);
|
|
198
|
+
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
199
|
+
}
|
|
200
|
+
`;
|
|
201
|
+
|
|
202
|
+
// deck.gl
|
|
203
|
+
// SPDX-License-Identifier: MIT
|
|
204
|
+
// Copyright (c) vis.gl contributors
|
|
205
|
+
var fs$2 = `\
|
|
206
|
+
#version 300 es
|
|
207
|
+
#define SHADER_NAME arc-layer-fragment-shader
|
|
208
|
+
precision highp float;
|
|
209
|
+
in vec4 vColor;
|
|
210
|
+
in vec2 uv;
|
|
211
|
+
in float isValid;
|
|
212
|
+
out vec4 fragColor;
|
|
213
|
+
void main(void) {
|
|
214
|
+
if (isValid == 0.0) {
|
|
215
|
+
discard;
|
|
216
|
+
}
|
|
217
|
+
fragColor = vColor;
|
|
218
|
+
geometry.uv = uv;
|
|
219
|
+
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
220
|
+
}
|
|
221
|
+
`;
|
|
222
|
+
|
|
223
|
+
// deck.gl
|
|
224
|
+
// SPDX-License-Identifier: MIT
|
|
225
|
+
// Copyright (c) vis.gl contributors
|
|
226
|
+
const DEFAULT_COLOR$2 = [0, 0, 0, 255];
|
|
227
|
+
const defaultProps$3 = {
|
|
228
|
+
getSourcePosition: { type: 'accessor', value: (x) => x.sourcePosition },
|
|
229
|
+
getTargetPosition: { type: 'accessor', value: (x) => x.targetPosition },
|
|
230
|
+
getSourceColor: { type: 'accessor', value: DEFAULT_COLOR$2 },
|
|
231
|
+
getTargetColor: { type: 'accessor', value: DEFAULT_COLOR$2 },
|
|
232
|
+
getWidth: { type: 'accessor', value: 1 },
|
|
233
|
+
getHeight: { type: 'accessor', value: 1 },
|
|
234
|
+
getTilt: { type: 'accessor', value: 0 },
|
|
235
|
+
greatCircle: false,
|
|
236
|
+
numSegments: { type: 'number', value: 50, min: 1 },
|
|
237
|
+
widthUnits: 'pixels',
|
|
238
|
+
widthScale: { type: 'number', value: 1, min: 0 },
|
|
239
|
+
widthMinPixels: { type: 'number', value: 0, min: 0 },
|
|
240
|
+
widthMaxPixels: { type: 'number', value: Number.MAX_SAFE_INTEGER, min: 0 }
|
|
241
|
+
};
|
|
242
|
+
/** Render raised arcs joining pairs of source and target coordinates. */
|
|
243
|
+
class ArcLayer extends deckProvider.Layer {
|
|
244
|
+
getBounds() {
|
|
245
|
+
return this.getAttributeManager()?.getBounds([
|
|
246
|
+
'instanceSourcePositions',
|
|
247
|
+
'instanceTargetPositions'
|
|
248
|
+
]);
|
|
249
|
+
}
|
|
250
|
+
getShaders() {
|
|
251
|
+
return super.getShaders({ vs: vs$2, fs: fs$2, modules: [deckProvider.project32, deckProvider.picking, arcUniforms] }); // 'project' module added by default.
|
|
252
|
+
}
|
|
253
|
+
// This layer has its own wrapLongitude logic
|
|
254
|
+
get wrapLongitude() {
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
initializeState() {
|
|
258
|
+
const attributeManager = this.getAttributeManager();
|
|
259
|
+
/* eslint-disable max-len */
|
|
260
|
+
attributeManager.addInstanced({
|
|
261
|
+
instanceSourcePositions: {
|
|
262
|
+
size: 3,
|
|
263
|
+
type: 'float64',
|
|
264
|
+
fp64: this.use64bitPositions(),
|
|
265
|
+
transition: true,
|
|
266
|
+
accessor: 'getSourcePosition'
|
|
267
|
+
},
|
|
268
|
+
instanceTargetPositions: {
|
|
269
|
+
size: 3,
|
|
270
|
+
type: 'float64',
|
|
271
|
+
fp64: this.use64bitPositions(),
|
|
272
|
+
transition: true,
|
|
273
|
+
accessor: 'getTargetPosition'
|
|
274
|
+
},
|
|
275
|
+
instanceSourceColors: {
|
|
276
|
+
size: this.props.colorFormat.length,
|
|
277
|
+
type: 'unorm8',
|
|
278
|
+
transition: true,
|
|
279
|
+
accessor: 'getSourceColor',
|
|
280
|
+
defaultValue: DEFAULT_COLOR$2
|
|
281
|
+
},
|
|
282
|
+
instanceTargetColors: {
|
|
283
|
+
size: this.props.colorFormat.length,
|
|
284
|
+
type: 'unorm8',
|
|
285
|
+
transition: true,
|
|
286
|
+
accessor: 'getTargetColor',
|
|
287
|
+
defaultValue: DEFAULT_COLOR$2
|
|
288
|
+
},
|
|
289
|
+
instanceWidths: {
|
|
290
|
+
size: 1,
|
|
291
|
+
transition: true,
|
|
292
|
+
accessor: 'getWidth',
|
|
293
|
+
defaultValue: 1
|
|
294
|
+
},
|
|
295
|
+
instanceHeights: {
|
|
296
|
+
size: 1,
|
|
297
|
+
transition: true,
|
|
298
|
+
accessor: 'getHeight',
|
|
299
|
+
defaultValue: 1
|
|
300
|
+
},
|
|
301
|
+
instanceTilts: {
|
|
302
|
+
size: 1,
|
|
303
|
+
transition: true,
|
|
304
|
+
accessor: 'getTilt',
|
|
305
|
+
defaultValue: 0
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
/* eslint-enable max-len */
|
|
309
|
+
}
|
|
310
|
+
updateState(params) {
|
|
311
|
+
super.updateState(params);
|
|
312
|
+
if (params.changeFlags.extensionsChanged) {
|
|
313
|
+
this.state.model?.destroy();
|
|
314
|
+
this.state.model = this._getModel();
|
|
315
|
+
this.getAttributeManager().invalidateAll();
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
draw({ uniforms }) {
|
|
319
|
+
const { widthUnits, widthScale, widthMinPixels, widthMaxPixels, greatCircle, wrapLongitude, numSegments } = this.props;
|
|
320
|
+
const arcProps = {
|
|
321
|
+
numSegments,
|
|
322
|
+
widthUnits: deckProvider.UNIT[widthUnits],
|
|
323
|
+
widthScale,
|
|
324
|
+
widthMinPixels,
|
|
325
|
+
widthMaxPixels,
|
|
326
|
+
greatCircle,
|
|
327
|
+
useShortestPath: wrapLongitude
|
|
328
|
+
};
|
|
329
|
+
const model = this.state.model;
|
|
330
|
+
model.shaderInputs.setProps({ arc: arcProps });
|
|
331
|
+
model.setVertexCount(numSegments * 2);
|
|
332
|
+
model.draw(this.context.renderPass);
|
|
333
|
+
}
|
|
334
|
+
_getModel() {
|
|
335
|
+
return new deckProvider.Model(this.context.device, {
|
|
336
|
+
...this.getShaders(),
|
|
337
|
+
id: this.props.id,
|
|
338
|
+
bufferLayout: this.getAttributeManager().getBufferLayouts(),
|
|
339
|
+
topology: 'triangle-strip',
|
|
340
|
+
isInstanced: true
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
ArcLayer.layerName = 'ArcLayer';
|
|
345
|
+
ArcLayer.defaultProps = defaultProps$3;
|
|
346
|
+
|
|
347
|
+
// deck.gl
|
|
348
|
+
// SPDX-License-Identifier: MIT
|
|
349
|
+
// Copyright (c) vis.gl contributors
|
|
350
|
+
const wgslUniformBlock = /* wgsl */ `\
|
|
351
|
+
struct PointCloudUniforms {
|
|
352
|
+
radiusPixels: f32,
|
|
353
|
+
sizeUnits: i32,
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
@group(0) @binding(3)
|
|
357
|
+
var<uniform> pointCloud: PointCloudUniforms;
|
|
358
|
+
`;
|
|
359
|
+
const glslUniformBlock = `\
|
|
360
|
+
uniform pointCloudUniforms {
|
|
361
|
+
float radiusPixels;
|
|
362
|
+
highp int sizeUnits;
|
|
363
|
+
} pointCloud;
|
|
364
|
+
`;
|
|
365
|
+
const pointCloudUniforms = {
|
|
366
|
+
name: 'pointCloud',
|
|
367
|
+
source: wgslUniformBlock,
|
|
368
|
+
vs: glslUniformBlock,
|
|
369
|
+
fs: glslUniformBlock,
|
|
370
|
+
uniformTypes: {
|
|
371
|
+
radiusPixels: 'f32',
|
|
372
|
+
sizeUnits: 'i32'
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
// deck.gl
|
|
377
|
+
// SPDX-License-Identifier: MIT
|
|
378
|
+
// Copyright (c) vis.gl contributors
|
|
379
|
+
var vs$1 = `\
|
|
380
|
+
#version 300 es
|
|
381
|
+
#define SHADER_NAME point-cloud-layer-vertex-shader
|
|
382
|
+
in vec3 positions;
|
|
383
|
+
in vec3 instanceNormals;
|
|
384
|
+
in vec4 instanceColors;
|
|
385
|
+
in vec3 instancePositions;
|
|
386
|
+
in vec3 instancePositions64Low;
|
|
387
|
+
in vec3 instancePickingColors;
|
|
388
|
+
out vec4 vColor;
|
|
389
|
+
out vec2 unitPosition;
|
|
390
|
+
void main(void) {
|
|
391
|
+
geometry.worldPosition = instancePositions;
|
|
392
|
+
geometry.normal = project_normal(instanceNormals);
|
|
393
|
+
unitPosition = positions.xy;
|
|
394
|
+
geometry.uv = unitPosition;
|
|
395
|
+
geometry.pickingColor = instancePickingColors;
|
|
396
|
+
vec3 offset = vec3(positions.xy * project_size_to_pixel(pointCloud.radiusPixels, pointCloud.sizeUnits), 0.0);
|
|
397
|
+
DECKGL_FILTER_SIZE(offset, geometry);
|
|
398
|
+
gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.), geometry.position);
|
|
399
|
+
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
400
|
+
gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);
|
|
401
|
+
vec3 lightColor = lighting_getLightColor(instanceColors.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
|
|
402
|
+
vColor = vec4(lightColor, instanceColors.a * layer.opacity);
|
|
403
|
+
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
404
|
+
}
|
|
405
|
+
`;
|
|
406
|
+
|
|
407
|
+
// deck.gl
|
|
408
|
+
// SPDX-License-Identifier: MIT
|
|
409
|
+
// Copyright (c) vis.gl contributors
|
|
410
|
+
var fs$1 = `\
|
|
411
|
+
#version 300 es
|
|
412
|
+
#define SHADER_NAME point-cloud-layer-fragment-shader
|
|
413
|
+
precision highp float;
|
|
414
|
+
in vec4 vColor;
|
|
415
|
+
in vec2 unitPosition;
|
|
416
|
+
out vec4 fragColor;
|
|
417
|
+
void main(void) {
|
|
418
|
+
geometry.uv = unitPosition.xy;
|
|
419
|
+
float distToCenter = length(unitPosition);
|
|
420
|
+
if (distToCenter > 1.0) {
|
|
421
|
+
discard;
|
|
422
|
+
}
|
|
423
|
+
fragColor = vColor;
|
|
424
|
+
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
425
|
+
}
|
|
426
|
+
`;
|
|
427
|
+
|
|
428
|
+
// deck.gl
|
|
429
|
+
// SPDX-License-Identifier: MIT
|
|
430
|
+
// Copyright (c) vis.gl contributors
|
|
431
|
+
var source = /* wgsl */ `\
|
|
432
|
+
struct ConstantAttributes {
|
|
433
|
+
instanceNormals: vec3<f32>,
|
|
434
|
+
instanceColors: vec4<f32>,
|
|
435
|
+
instancePositions: vec3<f32>,
|
|
436
|
+
instancePositions64Low: vec3<f32>,
|
|
437
|
+
instancePickingColors: vec3<f32>
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
const constants = ConstantAttributes(
|
|
441
|
+
vec3<f32>(1.0, 0.0, 0.0),
|
|
442
|
+
vec4<f32>(0.0, 0.0, 0.0, 1.0),
|
|
443
|
+
vec3<f32>(0.0),
|
|
444
|
+
vec3<f32>(0.0),
|
|
445
|
+
vec3<f32>(0.0)
|
|
446
|
+
);
|
|
447
|
+
|
|
448
|
+
struct Attributes {
|
|
449
|
+
@builtin(instance_index) instanceIndex : u32,
|
|
450
|
+
@builtin(vertex_index) vertexIndex : u32,
|
|
451
|
+
@location(0) positions: vec3<f32>,
|
|
452
|
+
@location(1) instancePositions: vec3<f32>,
|
|
453
|
+
@location(2) instancePositions64Low: vec3<f32>,
|
|
454
|
+
@location(3) instanceNormals: vec3<f32>,
|
|
455
|
+
@location(4) instanceColors: vec4<f32>,
|
|
456
|
+
@location(5) instancePickingColors: vec3<f32>
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
struct Varyings {
|
|
460
|
+
@builtin(position) position: vec4<f32>,
|
|
461
|
+
@location(0) vColor: vec4<f32>,
|
|
462
|
+
@location(1) unitPosition: vec2<f32>,
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
@vertex
|
|
466
|
+
fn vertexMain(attributes: Attributes) -> Varyings {
|
|
467
|
+
var varyings: Varyings;
|
|
468
|
+
|
|
469
|
+
// var geometry: Geometry;
|
|
470
|
+
// geometry.worldPosition = instancePositions;
|
|
471
|
+
// geometry.normal = project_normal(instanceNormals);
|
|
472
|
+
|
|
473
|
+
// position on the containing square in [-1, 1] space
|
|
474
|
+
varyings.unitPosition = attributes.positions.xy;
|
|
475
|
+
geometry.uv = varyings.unitPosition;
|
|
476
|
+
geometry.pickingColor = attributes.instancePickingColors;
|
|
477
|
+
|
|
478
|
+
// Find the center of the point and add the current vertex
|
|
479
|
+
let offset = vec3<f32>(attributes.positions.xy * project_unit_size_to_pixel(pointCloud.radiusPixels, pointCloud.sizeUnits), 0.0);
|
|
480
|
+
// DECKGL_FILTER_SIZE(offset, geometry);
|
|
481
|
+
|
|
482
|
+
varyings.position = project_position_to_clipspace(attributes.instancePositions, attributes.instancePositions64Low, vec3<f32>(0.0)); // TODO , geometry.position);
|
|
483
|
+
// DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
484
|
+
let clipPixels = project_pixel_size_to_clipspace(offset.xy);
|
|
485
|
+
varyings.position.x += clipPixels.x;
|
|
486
|
+
varyings.position.y += clipPixels.y;
|
|
487
|
+
|
|
488
|
+
// Apply lighting
|
|
489
|
+
let lightColor = lighting_getLightColor2(attributes.instanceColors.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
|
|
490
|
+
|
|
491
|
+
// Apply opacity to instance color, or return instance picking color
|
|
492
|
+
varyings.vColor = vec4(lightColor, attributes.instanceColors.a * color.opacity);
|
|
493
|
+
// DECKGL_FILTER_COLOR(vColor, geometry);
|
|
494
|
+
|
|
495
|
+
return varyings;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
@fragment
|
|
499
|
+
fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> {
|
|
500
|
+
// var geometry: Geometry;
|
|
501
|
+
// geometry.uv = unitPosition.xy;
|
|
502
|
+
|
|
503
|
+
let distToCenter = length(varyings.unitPosition);
|
|
504
|
+
if (distToCenter > 1.0) {
|
|
505
|
+
discard;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
var fragColor: vec4<f32>;
|
|
509
|
+
|
|
510
|
+
fragColor = varyings.vColor;
|
|
511
|
+
// DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
512
|
+
|
|
513
|
+
// Apply premultiplied alpha as required by transparent canvas
|
|
514
|
+
fragColor = deckgl_premultiplied_alpha(fragColor);
|
|
515
|
+
|
|
516
|
+
return fragColor;
|
|
517
|
+
}
|
|
518
|
+
`;
|
|
519
|
+
|
|
520
|
+
// deck.gl
|
|
521
|
+
// SPDX-License-Identifier: MIT
|
|
522
|
+
// Copyright (c) vis.gl contributors
|
|
523
|
+
const DEFAULT_COLOR$1 = [0, 0, 0, 255];
|
|
524
|
+
const DEFAULT_NORMAL = [0, 0, 1];
|
|
525
|
+
const defaultProps$2 = {
|
|
526
|
+
sizeUnits: 'pixels',
|
|
527
|
+
pointSize: { type: 'number', min: 0, value: 10 }, // point radius in pixels
|
|
528
|
+
getPosition: { type: 'accessor', value: (x) => x.position },
|
|
529
|
+
getNormal: { type: 'accessor', value: DEFAULT_NORMAL },
|
|
530
|
+
getColor: { type: 'accessor', value: DEFAULT_COLOR$1 },
|
|
531
|
+
material: true,
|
|
532
|
+
// Depreated
|
|
533
|
+
radiusPixels: { deprecatedFor: 'pointSize' }
|
|
534
|
+
};
|
|
535
|
+
// support loaders.gl point cloud format
|
|
536
|
+
function normalizeData(data) {
|
|
537
|
+
const { header, attributes } = data;
|
|
538
|
+
if (!header || !attributes) {
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
data.length = header.vertexCount;
|
|
542
|
+
if (attributes.POSITION) {
|
|
543
|
+
attributes.instancePositions = attributes.POSITION;
|
|
544
|
+
}
|
|
545
|
+
if (attributes.NORMAL) {
|
|
546
|
+
attributes.instanceNormals = attributes.NORMAL;
|
|
547
|
+
}
|
|
548
|
+
if (attributes.COLOR_0) {
|
|
549
|
+
const { size, value } = attributes.COLOR_0;
|
|
550
|
+
attributes.instanceColors = { size, type: 'unorm8', value };
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
/** Render a point cloud with 3D positions, normals and colors. */
|
|
554
|
+
class PointCloudLayer extends deckProvider.Layer {
|
|
555
|
+
getShaders() {
|
|
556
|
+
return super.getShaders({
|
|
557
|
+
vs: vs$1,
|
|
558
|
+
fs: fs$1,
|
|
559
|
+
source,
|
|
560
|
+
modules: [deckProvider.project32, deckProvider.color, deckProvider.gouraudMaterial, deckProvider.picking, pointCloudUniforms]
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
initializeState() {
|
|
564
|
+
this.getAttributeManager().addInstanced({
|
|
565
|
+
instancePositions: {
|
|
566
|
+
size: 3,
|
|
567
|
+
type: 'float64',
|
|
568
|
+
fp64: this.use64bitPositions(),
|
|
569
|
+
transition: true,
|
|
570
|
+
accessor: 'getPosition'
|
|
571
|
+
},
|
|
572
|
+
instanceNormals: {
|
|
573
|
+
size: 3,
|
|
574
|
+
transition: true,
|
|
575
|
+
accessor: 'getNormal',
|
|
576
|
+
defaultValue: DEFAULT_NORMAL
|
|
577
|
+
},
|
|
578
|
+
instanceColors: {
|
|
579
|
+
size: this.props.colorFormat.length,
|
|
580
|
+
type: 'unorm8',
|
|
581
|
+
transition: true,
|
|
582
|
+
accessor: 'getColor',
|
|
583
|
+
defaultValue: DEFAULT_COLOR$1
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
updateState(params) {
|
|
588
|
+
const { changeFlags, props } = params;
|
|
589
|
+
super.updateState(params);
|
|
590
|
+
if (changeFlags.extensionsChanged) {
|
|
591
|
+
this.state.model?.destroy();
|
|
592
|
+
this.state.model = this._getModel();
|
|
593
|
+
this.getAttributeManager().invalidateAll();
|
|
594
|
+
}
|
|
595
|
+
if (changeFlags.dataChanged) {
|
|
596
|
+
normalizeData(props.data);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
draw({ uniforms }) {
|
|
600
|
+
const { pointSize, sizeUnits } = this.props;
|
|
601
|
+
const model = this.state.model;
|
|
602
|
+
const pointCloudProps = {
|
|
603
|
+
sizeUnits: deckProvider.UNIT[sizeUnits],
|
|
604
|
+
radiusPixels: pointSize
|
|
605
|
+
};
|
|
606
|
+
model.shaderInputs.setProps({ pointCloud: pointCloudProps });
|
|
607
|
+
if (this.context.device.type === 'webgpu') {
|
|
608
|
+
// @ts-expect-error TODO - this line was needed during WebGPU port
|
|
609
|
+
model.instanceCount = this.props.data.length;
|
|
610
|
+
}
|
|
611
|
+
model.draw(this.context.renderPass);
|
|
612
|
+
}
|
|
613
|
+
_getModel() {
|
|
614
|
+
// TODO(ibgreen): WebGPU complication: Matching attachment state of the renderpass requires including a depth buffer
|
|
615
|
+
const parameters = this.context.device.type === 'webgpu'
|
|
616
|
+
? {
|
|
617
|
+
depthWriteEnabled: true,
|
|
618
|
+
depthCompare: 'less-equal'
|
|
619
|
+
}
|
|
620
|
+
: undefined;
|
|
621
|
+
// a triangle that minimally cover the unit circle
|
|
622
|
+
const positions = [];
|
|
623
|
+
for (let i = 0; i < 3; i++) {
|
|
624
|
+
const angle = (i / 3) * Math.PI * 2;
|
|
625
|
+
positions.push(Math.cos(angle) * 2, Math.sin(angle) * 2, 0);
|
|
626
|
+
}
|
|
627
|
+
return new deckProvider.Model(this.context.device, {
|
|
628
|
+
...this.getShaders(),
|
|
629
|
+
id: this.props.id,
|
|
630
|
+
bufferLayout: this.getAttributeManager().getBufferLayouts(),
|
|
631
|
+
geometry: new deckProvider.Geometry({
|
|
632
|
+
topology: 'triangle-list',
|
|
633
|
+
attributes: {
|
|
634
|
+
positions: new Float32Array(positions)
|
|
635
|
+
}
|
|
636
|
+
}),
|
|
637
|
+
parameters,
|
|
638
|
+
isInstanced: true
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
PointCloudLayer.layerName = 'PointCloudLayer';
|
|
643
|
+
PointCloudLayer.defaultProps = defaultProps$2;
|
|
644
|
+
|
|
645
|
+
// deck.gl
|
|
646
|
+
// SPDX-License-Identifier: MIT
|
|
647
|
+
// Copyright (c) vis.gl contributors
|
|
648
|
+
class ColumnGeometry extends deckProvider.Geometry {
|
|
649
|
+
constructor(props) {
|
|
650
|
+
const { indices, attributes } = tesselateColumn(props);
|
|
651
|
+
super({
|
|
652
|
+
...props,
|
|
653
|
+
indices,
|
|
654
|
+
// @ts-expect-error
|
|
655
|
+
attributes
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
/* eslint-disable max-statements, complexity */
|
|
660
|
+
function tesselateColumn(props) {
|
|
661
|
+
const { radius, height = 1, nradial = 10 } = props;
|
|
662
|
+
let { vertices } = props;
|
|
663
|
+
if (vertices) {
|
|
664
|
+
deckProvider.defaultLogger.assert(vertices.length >= nradial); // `vertices` must contain at least `diskResolution` points
|
|
665
|
+
vertices = vertices.flatMap(v => [v[0], v[1]]);
|
|
666
|
+
deckProvider.modifyPolygonWindingDirection(vertices, deckProvider.WINDING.COUNTER_CLOCKWISE);
|
|
667
|
+
}
|
|
668
|
+
const isExtruded = height > 0;
|
|
669
|
+
const vertsAroundEdge = nradial + 1; // loop
|
|
670
|
+
const numVertices = isExtruded
|
|
671
|
+
? vertsAroundEdge * 3 + 1 // top, side top edge, side bottom edge, one additional degenerage vertex
|
|
672
|
+
: nradial; // top
|
|
673
|
+
const stepAngle = (Math.PI * 2) / nradial;
|
|
674
|
+
// Used for wireframe
|
|
675
|
+
const indices = new Uint16Array(isExtruded ? nradial * 3 * 2 : 0); // top loop, side vertical, bottom loop
|
|
676
|
+
const positions = new Float32Array(numVertices * 3);
|
|
677
|
+
const normals = new Float32Array(numVertices * 3);
|
|
678
|
+
let i = 0;
|
|
679
|
+
// side tesselation: 0, 1, 2, 3, 4, 5, ...
|
|
680
|
+
//
|
|
681
|
+
// 0 - 2 - 4 ... top
|
|
682
|
+
// | / | / |
|
|
683
|
+
// 1 - 3 - 5 ... bottom
|
|
684
|
+
//
|
|
685
|
+
if (isExtruded) {
|
|
686
|
+
for (let j = 0; j < vertsAroundEdge; j++) {
|
|
687
|
+
const a = j * stepAngle;
|
|
688
|
+
const vertexIndex = j % nradial;
|
|
689
|
+
const sin = Math.sin(a);
|
|
690
|
+
const cos = Math.cos(a);
|
|
691
|
+
for (let k = 0; k < 2; k++) {
|
|
692
|
+
positions[i + 0] = vertices ? vertices[vertexIndex * 2] : cos * radius;
|
|
693
|
+
positions[i + 1] = vertices ? vertices[vertexIndex * 2 + 1] : sin * radius;
|
|
694
|
+
positions[i + 2] = (1 / 2 - k) * height;
|
|
695
|
+
normals[i + 0] = vertices ? vertices[vertexIndex * 2] : cos;
|
|
696
|
+
normals[i + 1] = vertices ? vertices[vertexIndex * 2 + 1] : sin;
|
|
697
|
+
i += 3;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
// duplicate the last vertex to create proper degenerate triangle.
|
|
701
|
+
positions[i + 0] = positions[i - 3];
|
|
702
|
+
positions[i + 1] = positions[i - 2];
|
|
703
|
+
positions[i + 2] = positions[i - 1];
|
|
704
|
+
i += 3;
|
|
705
|
+
}
|
|
706
|
+
// The column geometry is rendered as a triangle strip, so
|
|
707
|
+
// in order to render sides and top in one go we need to use degenerate triangles.
|
|
708
|
+
// Duplicate last vertex of side trinagles and first vertex of the top cap to preserve winding order.
|
|
709
|
+
// top tesselation: 0, -1, 1, -2, 2, -3, 3, ...
|
|
710
|
+
//
|
|
711
|
+
// 0 -- 1
|
|
712
|
+
// / \
|
|
713
|
+
// -1 2
|
|
714
|
+
// | |
|
|
715
|
+
// -2 3
|
|
716
|
+
// \ /
|
|
717
|
+
// -3 -- 4
|
|
718
|
+
//
|
|
719
|
+
for (let j = isExtruded ? 0 : 1; j < vertsAroundEdge; j++) {
|
|
720
|
+
const v = Math.floor(j / 2) * Math.sign(0.5 - (j % 2));
|
|
721
|
+
const a = v * stepAngle;
|
|
722
|
+
const vertexIndex = (v + nradial) % nradial;
|
|
723
|
+
const sin = Math.sin(a);
|
|
724
|
+
const cos = Math.cos(a);
|
|
725
|
+
positions[i + 0] = vertices ? vertices[vertexIndex * 2] : cos * radius;
|
|
726
|
+
positions[i + 1] = vertices ? vertices[vertexIndex * 2 + 1] : sin * radius;
|
|
727
|
+
positions[i + 2] = height / 2;
|
|
728
|
+
normals[i + 2] = 1;
|
|
729
|
+
i += 3;
|
|
730
|
+
}
|
|
731
|
+
if (isExtruded) {
|
|
732
|
+
let index = 0;
|
|
733
|
+
for (let j = 0; j < nradial; j++) {
|
|
734
|
+
// top loop
|
|
735
|
+
indices[index++] = j * 2 + 0;
|
|
736
|
+
indices[index++] = j * 2 + 2;
|
|
737
|
+
// side vertical
|
|
738
|
+
indices[index++] = j * 2 + 0;
|
|
739
|
+
indices[index++] = j * 2 + 1;
|
|
740
|
+
// bottom loop
|
|
741
|
+
indices[index++] = j * 2 + 1;
|
|
742
|
+
indices[index++] = j * 2 + 3;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
return {
|
|
746
|
+
indices,
|
|
747
|
+
attributes: {
|
|
748
|
+
POSITION: { size: 3, value: positions },
|
|
749
|
+
NORMAL: { size: 3, value: normals }
|
|
750
|
+
}
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
// deck.gl
|
|
755
|
+
// SPDX-License-Identifier: MIT
|
|
756
|
+
// Copyright (c) vis.gl contributors
|
|
757
|
+
const uniformBlock = `\
|
|
758
|
+
uniform columnUniforms {
|
|
759
|
+
float radius;
|
|
760
|
+
float angle;
|
|
761
|
+
vec2 offset;
|
|
762
|
+
bool extruded;
|
|
763
|
+
bool stroked;
|
|
764
|
+
bool isStroke;
|
|
765
|
+
float coverage;
|
|
766
|
+
float elevationScale;
|
|
767
|
+
float edgeDistance;
|
|
768
|
+
float widthScale;
|
|
769
|
+
float widthMinPixels;
|
|
770
|
+
float widthMaxPixels;
|
|
771
|
+
highp int radiusUnits;
|
|
772
|
+
highp int widthUnits;
|
|
773
|
+
} column;
|
|
774
|
+
`;
|
|
775
|
+
const columnUniforms = {
|
|
776
|
+
name: 'column',
|
|
777
|
+
vs: uniformBlock,
|
|
778
|
+
fs: uniformBlock,
|
|
779
|
+
uniformTypes: {
|
|
780
|
+
radius: 'f32',
|
|
781
|
+
angle: 'f32',
|
|
782
|
+
offset: 'vec2<f32>',
|
|
783
|
+
extruded: 'f32',
|
|
784
|
+
stroked: 'f32',
|
|
785
|
+
isStroke: 'f32',
|
|
786
|
+
coverage: 'f32',
|
|
787
|
+
elevationScale: 'f32',
|
|
788
|
+
edgeDistance: 'f32',
|
|
789
|
+
widthScale: 'f32',
|
|
790
|
+
widthMinPixels: 'f32',
|
|
791
|
+
widthMaxPixels: 'f32',
|
|
792
|
+
radiusUnits: 'i32',
|
|
793
|
+
widthUnits: 'i32'
|
|
794
|
+
}
|
|
795
|
+
};
|
|
796
|
+
|
|
797
|
+
// deck.gl
|
|
798
|
+
// SPDX-License-Identifier: MIT
|
|
799
|
+
// Copyright (c) vis.gl contributors
|
|
800
|
+
var vs = `#version 300 es
|
|
801
|
+
#define SHADER_NAME column-layer-vertex-shader
|
|
802
|
+
in vec3 positions;
|
|
803
|
+
in vec3 normals;
|
|
804
|
+
in vec3 instancePositions;
|
|
805
|
+
in float instanceElevations;
|
|
806
|
+
in vec3 instancePositions64Low;
|
|
807
|
+
in vec4 instanceFillColors;
|
|
808
|
+
in vec4 instanceLineColors;
|
|
809
|
+
in float instanceStrokeWidths;
|
|
810
|
+
in vec3 instancePickingColors;
|
|
811
|
+
out vec4 vColor;
|
|
812
|
+
#ifdef FLAT_SHADING
|
|
813
|
+
out vec3 cameraPosition;
|
|
814
|
+
out vec4 position_commonspace;
|
|
815
|
+
#endif
|
|
816
|
+
void main(void) {
|
|
817
|
+
geometry.worldPosition = instancePositions;
|
|
818
|
+
vec4 color = column.isStroke ? instanceLineColors : instanceFillColors;
|
|
819
|
+
mat2 rotationMatrix = mat2(cos(column.angle), sin(column.angle), -sin(column.angle), cos(column.angle));
|
|
820
|
+
float elevation = 0.0;
|
|
821
|
+
float strokeOffsetRatio = 1.0;
|
|
822
|
+
if (column.extruded) {
|
|
823
|
+
elevation = instanceElevations * (positions.z + 1.0) / 2.0 * column.elevationScale;
|
|
824
|
+
} else if (column.stroked) {
|
|
825
|
+
float widthPixels = clamp(
|
|
826
|
+
project_size_to_pixel(instanceStrokeWidths * column.widthScale, column.widthUnits),
|
|
827
|
+
column.widthMinPixels, column.widthMaxPixels) / 2.0;
|
|
828
|
+
float halfOffset = project_pixel_size(widthPixels) / project_size(column.edgeDistance * column.coverage * column.radius);
|
|
829
|
+
if (column.isStroke) {
|
|
830
|
+
strokeOffsetRatio -= sign(positions.z) * halfOffset;
|
|
831
|
+
} else {
|
|
832
|
+
strokeOffsetRatio -= halfOffset;
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
float shouldRender = float(color.a > 0.0 && instanceElevations >= 0.0);
|
|
836
|
+
float dotRadius = column.radius * column.coverage * shouldRender;
|
|
837
|
+
geometry.pickingColor = instancePickingColors;
|
|
838
|
+
vec3 centroidPosition = vec3(instancePositions.xy, instancePositions.z + elevation);
|
|
839
|
+
vec3 centroidPosition64Low = instancePositions64Low;
|
|
840
|
+
vec2 offset = (rotationMatrix * positions.xy * strokeOffsetRatio + column.offset) * dotRadius;
|
|
841
|
+
if (column.radiusUnits == UNIT_METERS) {
|
|
842
|
+
offset = project_size(offset);
|
|
843
|
+
} else if (column.radiusUnits == UNIT_PIXELS) {
|
|
844
|
+
offset = project_pixel_size(offset);
|
|
845
|
+
}
|
|
846
|
+
vec3 pos = vec3(offset, 0.);
|
|
847
|
+
DECKGL_FILTER_SIZE(pos, geometry);
|
|
848
|
+
gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
|
|
849
|
+
geometry.normal = project_normal(vec3(rotationMatrix * normals.xy, normals.z));
|
|
850
|
+
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
851
|
+
if (column.extruded && !column.isStroke) {
|
|
852
|
+
#ifdef FLAT_SHADING
|
|
853
|
+
cameraPosition = project.cameraPosition;
|
|
854
|
+
position_commonspace = geometry.position;
|
|
855
|
+
vColor = vec4(color.rgb, color.a * layer.opacity);
|
|
856
|
+
#else
|
|
857
|
+
vec3 lightColor = lighting_getLightColor(color.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal);
|
|
858
|
+
vColor = vec4(lightColor, color.a * layer.opacity);
|
|
859
|
+
#endif
|
|
860
|
+
} else {
|
|
861
|
+
vColor = vec4(color.rgb, color.a * layer.opacity);
|
|
862
|
+
}
|
|
863
|
+
DECKGL_FILTER_COLOR(vColor, geometry);
|
|
864
|
+
}
|
|
865
|
+
`;
|
|
866
|
+
|
|
867
|
+
// deck.gl
|
|
868
|
+
// SPDX-License-Identifier: MIT
|
|
869
|
+
// Copyright (c) vis.gl contributors
|
|
870
|
+
var fs = `#version 300 es
|
|
871
|
+
#define SHADER_NAME column-layer-fragment-shader
|
|
872
|
+
precision highp float;
|
|
873
|
+
out vec4 fragColor;
|
|
874
|
+
in vec4 vColor;
|
|
875
|
+
#ifdef FLAT_SHADING
|
|
876
|
+
in vec3 cameraPosition;
|
|
877
|
+
in vec4 position_commonspace;
|
|
878
|
+
#endif
|
|
879
|
+
void main(void) {
|
|
880
|
+
fragColor = vColor;
|
|
881
|
+
geometry.uv = vec2(0.);
|
|
882
|
+
#ifdef FLAT_SHADING
|
|
883
|
+
if (column.extruded && !column.isStroke && !bool(picking.isActive)) {
|
|
884
|
+
vec3 normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));
|
|
885
|
+
fragColor.rgb = lighting_getLightColor(vColor.rgb, cameraPosition, position_commonspace.xyz, normal);
|
|
886
|
+
}
|
|
887
|
+
#endif
|
|
888
|
+
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
889
|
+
}
|
|
890
|
+
`;
|
|
891
|
+
|
|
892
|
+
// deck.gl
|
|
893
|
+
// SPDX-License-Identifier: MIT
|
|
894
|
+
// Copyright (c) vis.gl contributors
|
|
895
|
+
const DEFAULT_COLOR = [0, 0, 0, 255];
|
|
896
|
+
const defaultProps$1 = {
|
|
897
|
+
diskResolution: { type: 'number', min: 4, value: 20 },
|
|
898
|
+
vertices: null,
|
|
899
|
+
radius: { type: 'number', min: 0, value: 1000 },
|
|
900
|
+
angle: { type: 'number', value: 0 },
|
|
901
|
+
offset: { type: 'array', value: [0, 0] },
|
|
902
|
+
coverage: { type: 'number', min: 0, max: 1, value: 1 },
|
|
903
|
+
elevationScale: { type: 'number', min: 0, value: 1 },
|
|
904
|
+
radiusUnits: 'meters',
|
|
905
|
+
lineWidthUnits: 'meters',
|
|
906
|
+
lineWidthScale: 1,
|
|
907
|
+
lineWidthMinPixels: 0,
|
|
908
|
+
lineWidthMaxPixels: Number.MAX_SAFE_INTEGER,
|
|
909
|
+
extruded: true,
|
|
910
|
+
wireframe: false,
|
|
911
|
+
filled: true,
|
|
912
|
+
stroked: false,
|
|
913
|
+
flatShading: false,
|
|
914
|
+
getPosition: { type: 'accessor', value: (x) => x.position },
|
|
915
|
+
getFillColor: { type: 'accessor', value: DEFAULT_COLOR },
|
|
916
|
+
getLineColor: { type: 'accessor', value: DEFAULT_COLOR },
|
|
917
|
+
getLineWidth: { type: 'accessor', value: 1 },
|
|
918
|
+
getElevation: { type: 'accessor', value: 1000 },
|
|
919
|
+
material: true,
|
|
920
|
+
getColor: { deprecatedFor: ['getFillColor', 'getLineColor'] }
|
|
921
|
+
};
|
|
922
|
+
/** Render extruded cylinders (tessellated regular polygons) at given coordinates. */
|
|
923
|
+
class ColumnLayer extends deckProvider.Layer {
|
|
924
|
+
getShaders() {
|
|
925
|
+
const defines = {};
|
|
926
|
+
const { flatShading } = this.props;
|
|
927
|
+
if (flatShading) {
|
|
928
|
+
defines.FLAT_SHADING = 1;
|
|
929
|
+
}
|
|
930
|
+
return super.getShaders({
|
|
931
|
+
vs,
|
|
932
|
+
fs,
|
|
933
|
+
defines,
|
|
934
|
+
modules: [deckProvider.project32, flatShading ? deckProvider.phongMaterial : deckProvider.gouraudMaterial, deckProvider.picking, columnUniforms]
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* DeckGL calls initializeState when GL context is available
|
|
939
|
+
* Essentially a deferred constructor
|
|
940
|
+
*/
|
|
941
|
+
initializeState() {
|
|
942
|
+
const attributeManager = this.getAttributeManager();
|
|
943
|
+
/* eslint-disable max-len */
|
|
944
|
+
attributeManager.addInstanced({
|
|
945
|
+
instancePositions: {
|
|
946
|
+
size: 3,
|
|
947
|
+
type: 'float64',
|
|
948
|
+
fp64: this.use64bitPositions(),
|
|
949
|
+
transition: true,
|
|
950
|
+
accessor: 'getPosition'
|
|
951
|
+
},
|
|
952
|
+
instanceElevations: {
|
|
953
|
+
size: 1,
|
|
954
|
+
transition: true,
|
|
955
|
+
accessor: 'getElevation'
|
|
956
|
+
},
|
|
957
|
+
instanceFillColors: {
|
|
958
|
+
size: this.props.colorFormat.length,
|
|
959
|
+
type: 'unorm8',
|
|
960
|
+
transition: true,
|
|
961
|
+
accessor: 'getFillColor',
|
|
962
|
+
defaultValue: DEFAULT_COLOR
|
|
963
|
+
},
|
|
964
|
+
instanceLineColors: {
|
|
965
|
+
size: this.props.colorFormat.length,
|
|
966
|
+
type: 'unorm8',
|
|
967
|
+
transition: true,
|
|
968
|
+
accessor: 'getLineColor',
|
|
969
|
+
defaultValue: DEFAULT_COLOR
|
|
970
|
+
},
|
|
971
|
+
instanceStrokeWidths: {
|
|
972
|
+
size: 1,
|
|
973
|
+
accessor: 'getLineWidth',
|
|
974
|
+
transition: true
|
|
975
|
+
}
|
|
976
|
+
});
|
|
977
|
+
/* eslint-enable max-len */
|
|
978
|
+
}
|
|
979
|
+
updateState(params) {
|
|
980
|
+
super.updateState(params);
|
|
981
|
+
const { props, oldProps, changeFlags } = params;
|
|
982
|
+
const regenerateModels = changeFlags.extensionsChanged || props.flatShading !== oldProps.flatShading;
|
|
983
|
+
if (regenerateModels) {
|
|
984
|
+
this.state.models?.forEach(model => model.destroy());
|
|
985
|
+
this.setState(this._getModels());
|
|
986
|
+
this.getAttributeManager().invalidateAll();
|
|
987
|
+
}
|
|
988
|
+
const instanceCount = this.getNumInstances();
|
|
989
|
+
this.state.fillModel.setInstanceCount(instanceCount);
|
|
990
|
+
this.state.wireframeModel.setInstanceCount(instanceCount);
|
|
991
|
+
if (regenerateModels ||
|
|
992
|
+
props.diskResolution !== oldProps.diskResolution ||
|
|
993
|
+
props.vertices !== oldProps.vertices ||
|
|
994
|
+
(props.extruded || props.stroked) !== (oldProps.extruded || oldProps.stroked)) {
|
|
995
|
+
this._updateGeometry(props);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
getGeometry(diskResolution, vertices, hasThinkness) {
|
|
999
|
+
const geometry = new ColumnGeometry({
|
|
1000
|
+
radius: 1,
|
|
1001
|
+
height: hasThinkness ? 2 : 0,
|
|
1002
|
+
vertices,
|
|
1003
|
+
nradial: diskResolution
|
|
1004
|
+
});
|
|
1005
|
+
let meanVertexDistance = 0;
|
|
1006
|
+
if (vertices) {
|
|
1007
|
+
for (let i = 0; i < diskResolution; i++) {
|
|
1008
|
+
const p = vertices[i];
|
|
1009
|
+
const d = Math.sqrt(p[0] * p[0] + p[1] * p[1]);
|
|
1010
|
+
meanVertexDistance += d / diskResolution;
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
else {
|
|
1014
|
+
meanVertexDistance = 1;
|
|
1015
|
+
}
|
|
1016
|
+
this.setState({
|
|
1017
|
+
edgeDistance: Math.cos(Math.PI / diskResolution) * meanVertexDistance
|
|
1018
|
+
});
|
|
1019
|
+
return geometry;
|
|
1020
|
+
}
|
|
1021
|
+
_getModels() {
|
|
1022
|
+
const shaders = this.getShaders();
|
|
1023
|
+
const bufferLayout = this.getAttributeManager().getBufferLayouts();
|
|
1024
|
+
const fillModel = new deckProvider.Model(this.context.device, {
|
|
1025
|
+
...shaders,
|
|
1026
|
+
id: `${this.props.id}-fill`,
|
|
1027
|
+
bufferLayout,
|
|
1028
|
+
isInstanced: true
|
|
1029
|
+
});
|
|
1030
|
+
const wireframeModel = new deckProvider.Model(this.context.device, {
|
|
1031
|
+
...shaders,
|
|
1032
|
+
id: `${this.props.id}-wireframe`,
|
|
1033
|
+
bufferLayout,
|
|
1034
|
+
isInstanced: true
|
|
1035
|
+
});
|
|
1036
|
+
return {
|
|
1037
|
+
fillModel,
|
|
1038
|
+
wireframeModel,
|
|
1039
|
+
models: [wireframeModel, fillModel]
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
_updateGeometry({ diskResolution, vertices, extruded, stroked }) {
|
|
1043
|
+
const geometry = this.getGeometry(diskResolution, vertices, extruded || stroked);
|
|
1044
|
+
this.setState({
|
|
1045
|
+
fillVertexCount: geometry.attributes.POSITION.value.length / 3
|
|
1046
|
+
});
|
|
1047
|
+
const fillModel = this.state.fillModel;
|
|
1048
|
+
const wireframeModel = this.state.wireframeModel;
|
|
1049
|
+
fillModel.setGeometry(geometry);
|
|
1050
|
+
fillModel.setTopology('triangle-strip');
|
|
1051
|
+
// Disable indices
|
|
1052
|
+
fillModel.setIndexBuffer(null);
|
|
1053
|
+
wireframeModel.setGeometry(geometry);
|
|
1054
|
+
wireframeModel.setTopology('line-list');
|
|
1055
|
+
}
|
|
1056
|
+
draw({ uniforms }) {
|
|
1057
|
+
const { lineWidthUnits, lineWidthScale, lineWidthMinPixels, lineWidthMaxPixels, radiusUnits, elevationScale, extruded, filled, stroked, wireframe, offset, coverage, radius, angle } = this.props;
|
|
1058
|
+
const fillModel = this.state.fillModel;
|
|
1059
|
+
const wireframeModel = this.state.wireframeModel;
|
|
1060
|
+
const { fillVertexCount, edgeDistance } = this.state;
|
|
1061
|
+
const columnProps = {
|
|
1062
|
+
radius,
|
|
1063
|
+
angle: (angle / 180) * Math.PI,
|
|
1064
|
+
offset,
|
|
1065
|
+
extruded,
|
|
1066
|
+
stroked,
|
|
1067
|
+
coverage,
|
|
1068
|
+
elevationScale,
|
|
1069
|
+
edgeDistance,
|
|
1070
|
+
radiusUnits: deckProvider.UNIT[radiusUnits],
|
|
1071
|
+
widthUnits: deckProvider.UNIT[lineWidthUnits],
|
|
1072
|
+
widthScale: lineWidthScale,
|
|
1073
|
+
widthMinPixels: lineWidthMinPixels,
|
|
1074
|
+
widthMaxPixels: lineWidthMaxPixels
|
|
1075
|
+
};
|
|
1076
|
+
// When drawing 3d: draw wireframe first so it doesn't get occluded by depth test
|
|
1077
|
+
if (extruded && wireframe) {
|
|
1078
|
+
wireframeModel.shaderInputs.setProps({
|
|
1079
|
+
column: {
|
|
1080
|
+
...columnProps,
|
|
1081
|
+
isStroke: true
|
|
1082
|
+
}
|
|
1083
|
+
});
|
|
1084
|
+
wireframeModel.draw(this.context.renderPass);
|
|
1085
|
+
}
|
|
1086
|
+
if (filled) {
|
|
1087
|
+
// model.setProps({isIndexed: false});
|
|
1088
|
+
fillModel.setVertexCount(fillVertexCount);
|
|
1089
|
+
fillModel.shaderInputs.setProps({
|
|
1090
|
+
column: {
|
|
1091
|
+
...columnProps,
|
|
1092
|
+
isStroke: false
|
|
1093
|
+
}
|
|
1094
|
+
});
|
|
1095
|
+
fillModel.draw(this.context.renderPass);
|
|
1096
|
+
}
|
|
1097
|
+
// When drawing 2d: draw fill before stroke so that the outline is always on top
|
|
1098
|
+
if (!extruded && stroked) {
|
|
1099
|
+
// model.setProps({isIndexed: false});
|
|
1100
|
+
// The width of the stroke is achieved by flattening the side of the cylinder.
|
|
1101
|
+
// Skip the last 1/3 of the vertices which is the top.
|
|
1102
|
+
fillModel.setVertexCount((fillVertexCount * 2) / 3);
|
|
1103
|
+
fillModel.shaderInputs.setProps({
|
|
1104
|
+
column: {
|
|
1105
|
+
...columnProps,
|
|
1106
|
+
isStroke: true
|
|
1107
|
+
}
|
|
1108
|
+
});
|
|
1109
|
+
fillModel.draw(this.context.renderPass);
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
ColumnLayer.layerName = 'ColumnLayer';
|
|
1114
|
+
ColumnLayer.defaultProps = defaultProps$1;
|
|
1115
|
+
|
|
1116
|
+
// deck.gl
|
|
1117
|
+
// SPDX-License-Identifier: MIT
|
|
1118
|
+
// Copyright (c) vis.gl contributors
|
|
1119
|
+
const defaultLineColor = [0, 0, 0, 255];
|
|
1120
|
+
const defaultFillColor = [0, 0, 0, 255];
|
|
1121
|
+
const defaultProps = {
|
|
1122
|
+
stroked: true,
|
|
1123
|
+
filled: true,
|
|
1124
|
+
extruded: false,
|
|
1125
|
+
elevationScale: 1,
|
|
1126
|
+
wireframe: false,
|
|
1127
|
+
_normalize: true,
|
|
1128
|
+
_windingOrder: 'CW',
|
|
1129
|
+
lineWidthUnits: 'meters',
|
|
1130
|
+
lineWidthScale: 1,
|
|
1131
|
+
lineWidthMinPixels: 0,
|
|
1132
|
+
lineWidthMaxPixels: Number.MAX_SAFE_INTEGER,
|
|
1133
|
+
lineJointRounded: false,
|
|
1134
|
+
lineMiterLimit: 4,
|
|
1135
|
+
getPolygon: { type: 'accessor', value: (f) => f.polygon },
|
|
1136
|
+
// Polygon fill color
|
|
1137
|
+
getFillColor: { type: 'accessor', value: defaultFillColor },
|
|
1138
|
+
// Point, line and polygon outline color
|
|
1139
|
+
getLineColor: { type: 'accessor', value: defaultLineColor },
|
|
1140
|
+
// Line and polygon outline accessors
|
|
1141
|
+
getLineWidth: { type: 'accessor', value: 1 },
|
|
1142
|
+
// Polygon extrusion accessor
|
|
1143
|
+
getElevation: { type: 'accessor', value: 1000 },
|
|
1144
|
+
// Optional material for 'lighting' shader module
|
|
1145
|
+
material: true
|
|
1146
|
+
};
|
|
1147
|
+
/** A composite layer that renders filled, stroked and/or extruded polygons. */
|
|
1148
|
+
class PolygonLayer extends deckProvider.CompositeLayer {
|
|
1149
|
+
initializeState() {
|
|
1150
|
+
this.state = {
|
|
1151
|
+
paths: [],
|
|
1152
|
+
pathsDiff: null
|
|
1153
|
+
};
|
|
1154
|
+
if (this.props.getLineDashArray) {
|
|
1155
|
+
deckProvider.defaultLogger.removed('getLineDashArray', 'PathStyleExtension')();
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
updateState({ changeFlags }) {
|
|
1159
|
+
const geometryChanged = changeFlags.dataChanged ||
|
|
1160
|
+
(changeFlags.updateTriggersChanged &&
|
|
1161
|
+
(changeFlags.updateTriggersChanged.all || changeFlags.updateTriggersChanged.getPolygon));
|
|
1162
|
+
if (geometryChanged && Array.isArray(changeFlags.dataChanged)) {
|
|
1163
|
+
const paths = this.state.paths.slice();
|
|
1164
|
+
const pathsDiff = changeFlags.dataChanged.map(dataRange => deckProvider.replaceInRange({
|
|
1165
|
+
data: paths,
|
|
1166
|
+
getIndex: p => p.__source.index,
|
|
1167
|
+
dataRange,
|
|
1168
|
+
replace: this._getPaths(dataRange)
|
|
1169
|
+
}));
|
|
1170
|
+
this.setState({ paths, pathsDiff });
|
|
1171
|
+
}
|
|
1172
|
+
else if (geometryChanged) {
|
|
1173
|
+
this.setState({
|
|
1174
|
+
paths: this._getPaths(),
|
|
1175
|
+
pathsDiff: null
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
_getPaths(dataRange = {}) {
|
|
1180
|
+
const { data, getPolygon, positionFormat, _normalize } = this.props;
|
|
1181
|
+
const paths = [];
|
|
1182
|
+
const positionSize = positionFormat === 'XY' ? 2 : 3;
|
|
1183
|
+
const { startRow, endRow } = dataRange;
|
|
1184
|
+
const { iterable, objectInfo } = deckProvider.createIterable(data, startRow, endRow);
|
|
1185
|
+
for (const object of iterable) {
|
|
1186
|
+
objectInfo.index++;
|
|
1187
|
+
let polygon = getPolygon(object, objectInfo);
|
|
1188
|
+
if (_normalize) {
|
|
1189
|
+
polygon = deckProvider.normalize(polygon, positionSize);
|
|
1190
|
+
}
|
|
1191
|
+
const { holeIndices } = polygon;
|
|
1192
|
+
const positions = polygon.positions || polygon;
|
|
1193
|
+
if (holeIndices) {
|
|
1194
|
+
// split the positions array into `holeIndices.length + 1` rings
|
|
1195
|
+
// holeIndices[-1] falls back to 0
|
|
1196
|
+
// holeIndices[holeIndices.length] falls back to positions.length
|
|
1197
|
+
for (let i = 0; i <= holeIndices.length; i++) {
|
|
1198
|
+
const path = positions.slice(holeIndices[i - 1] || 0, holeIndices[i] || positions.length);
|
|
1199
|
+
paths.push(this.getSubLayerRow({ path }, object, objectInfo.index));
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
else {
|
|
1203
|
+
paths.push(this.getSubLayerRow({ path: positions }, object, objectInfo.index));
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
return paths;
|
|
1207
|
+
}
|
|
1208
|
+
/* eslint-disable complexity */
|
|
1209
|
+
renderLayers() {
|
|
1210
|
+
// Layer composition props
|
|
1211
|
+
const { data, _dataDiff, stroked, filled, extruded, wireframe, _normalize, _windingOrder, elevationScale, transitions, positionFormat } = this.props;
|
|
1212
|
+
// Rendering props underlying layer
|
|
1213
|
+
const { lineWidthUnits, lineWidthScale, lineWidthMinPixels, lineWidthMaxPixels, lineJointRounded, lineMiterLimit, lineDashJustified } = this.props;
|
|
1214
|
+
// Accessor props for underlying layers
|
|
1215
|
+
const { getFillColor, getLineColor, getLineWidth, getLineDashArray, getElevation, getPolygon, updateTriggers, material } = this.props;
|
|
1216
|
+
const { paths, pathsDiff } = this.state;
|
|
1217
|
+
const FillLayer = this.getSubLayerClass('fill', deckProvider.SolidPolygonLayer);
|
|
1218
|
+
const StrokeLayer = this.getSubLayerClass('stroke', deckProvider.PathLayer);
|
|
1219
|
+
// Filled Polygon Layer
|
|
1220
|
+
const polygonLayer = this.shouldRenderSubLayer('fill', paths) &&
|
|
1221
|
+
new FillLayer({
|
|
1222
|
+
_dataDiff,
|
|
1223
|
+
extruded,
|
|
1224
|
+
elevationScale,
|
|
1225
|
+
filled,
|
|
1226
|
+
wireframe,
|
|
1227
|
+
_normalize,
|
|
1228
|
+
_windingOrder,
|
|
1229
|
+
getElevation,
|
|
1230
|
+
getFillColor,
|
|
1231
|
+
getLineColor: extruded && wireframe ? getLineColor : defaultLineColor,
|
|
1232
|
+
material,
|
|
1233
|
+
transitions
|
|
1234
|
+
}, this.getSubLayerProps({
|
|
1235
|
+
id: 'fill',
|
|
1236
|
+
updateTriggers: updateTriggers && {
|
|
1237
|
+
getPolygon: updateTriggers.getPolygon,
|
|
1238
|
+
getElevation: updateTriggers.getElevation,
|
|
1239
|
+
getFillColor: updateTriggers.getFillColor,
|
|
1240
|
+
// using a legacy API to invalid lineColor attributes
|
|
1241
|
+
// if (extruded && wireframe) has changed
|
|
1242
|
+
lineColors: extruded && wireframe,
|
|
1243
|
+
getLineColor: updateTriggers.getLineColor
|
|
1244
|
+
}
|
|
1245
|
+
}), {
|
|
1246
|
+
data,
|
|
1247
|
+
positionFormat,
|
|
1248
|
+
getPolygon
|
|
1249
|
+
});
|
|
1250
|
+
// Polygon line layer
|
|
1251
|
+
const polygonLineLayer = !extruded &&
|
|
1252
|
+
stroked &&
|
|
1253
|
+
this.shouldRenderSubLayer('stroke', paths) &&
|
|
1254
|
+
new StrokeLayer({
|
|
1255
|
+
_dataDiff: pathsDiff && (() => pathsDiff),
|
|
1256
|
+
widthUnits: lineWidthUnits,
|
|
1257
|
+
widthScale: lineWidthScale,
|
|
1258
|
+
widthMinPixels: lineWidthMinPixels,
|
|
1259
|
+
widthMaxPixels: lineWidthMaxPixels,
|
|
1260
|
+
jointRounded: lineJointRounded,
|
|
1261
|
+
miterLimit: lineMiterLimit,
|
|
1262
|
+
dashJustified: lineDashJustified,
|
|
1263
|
+
// Already normalized
|
|
1264
|
+
_pathType: 'loop',
|
|
1265
|
+
transitions: transitions && {
|
|
1266
|
+
getWidth: transitions.getLineWidth,
|
|
1267
|
+
getColor: transitions.getLineColor,
|
|
1268
|
+
getPath: transitions.getPolygon
|
|
1269
|
+
},
|
|
1270
|
+
getColor: this.getSubLayerAccessor(getLineColor),
|
|
1271
|
+
getWidth: this.getSubLayerAccessor(getLineWidth),
|
|
1272
|
+
getDashArray: this.getSubLayerAccessor(getLineDashArray)
|
|
1273
|
+
}, this.getSubLayerProps({
|
|
1274
|
+
id: 'stroke',
|
|
1275
|
+
updateTriggers: updateTriggers && {
|
|
1276
|
+
getWidth: updateTriggers.getLineWidth,
|
|
1277
|
+
getColor: updateTriggers.getLineColor,
|
|
1278
|
+
getDashArray: updateTriggers.getLineDashArray
|
|
1279
|
+
}
|
|
1280
|
+
}), {
|
|
1281
|
+
data: paths,
|
|
1282
|
+
positionFormat,
|
|
1283
|
+
getPath: x => x.path
|
|
1284
|
+
});
|
|
1285
|
+
return [
|
|
1286
|
+
// If not extruded: flat fill layer is drawn below outlines
|
|
1287
|
+
!extruded && polygonLayer,
|
|
1288
|
+
polygonLineLayer,
|
|
1289
|
+
// If extruded: draw fill layer last for correct blending behavior
|
|
1290
|
+
extruded && polygonLayer
|
|
1291
|
+
];
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
PolygonLayer.layerName = 'PolygonLayer';
|
|
1295
|
+
PolygonLayer.defaultProps = defaultProps;
|
|
1296
|
+
|
|
1297
|
+
exports.ArcLayer = ArcLayer;
|
|
1298
|
+
exports.ColumnLayer = ColumnLayer;
|
|
1299
|
+
exports.PointCloudLayer = PointCloudLayer;
|
|
1300
|
+
exports.PolygonLayer = PolygonLayer;
|