@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.
Files changed (438) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +185 -0
  3. package/dist/cjs/_commonjsHelpers-B83fTs8d.js +36 -0
  4. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  5. package/dist/cjs/cesium-provider-BiFFyAl9.js +2598 -0
  6. package/dist/cjs/deck-provider-Ctq3Q8a1.js +47824 -0
  7. package/dist/cjs/geotiff-CEwvF9cG.js +47 -0
  8. package/dist/cjs/geotiff-source-RaNzzWkC.js +1522 -0
  9. package/dist/cjs/index-B1oGO1g-.js +10658 -0
  10. package/dist/cjs/index-B8LHqjyg.js +1765 -0
  11. package/dist/cjs/index-BIL4VsgP.js +310 -0
  12. package/dist/cjs/index-Blku2QY8.js +167 -0
  13. package/dist/cjs/index-CJvvX4yx.js +21 -0
  14. package/dist/cjs/index-CbVT-Con.js +699 -0
  15. package/dist/cjs/index-ISOEpMC3.js +20478 -0
  16. package/dist/cjs/index-JSwBbvGA.js +1621 -0
  17. package/dist/cjs/index.browser-DQhD8Jwl.js +6873 -0
  18. package/dist/cjs/index.cjs.js +2 -0
  19. package/dist/cjs/layer-extension-B_olS0rc.js +65 -0
  20. package/dist/cjs/leaflet-provider-DOqfs7g5.js +1815 -0
  21. package/dist/cjs/loader.cjs.js +13 -0
  22. package/dist/cjs/main-dist-7TykwFci.js +2655 -0
  23. package/dist/cjs/messages-D7h4m8Tx.js +186 -0
  24. package/dist/cjs/openlayers-provider-Dfeg6L4n.js +1604 -0
  25. package/dist/cjs/polygon-layer-B9PrN7vr.js +1300 -0
  26. package/dist/cjs/scenegraph-layer-DwNoxQdi.js +2530 -0
  27. package/dist/cjs/styleconfig-CVRqArk-.js +23 -0
  28. package/dist/cjs/v-map-builder.cjs.entry.js +3786 -0
  29. package/dist/cjs/v-map-layer-geojson_12.cjs.entry.js +40894 -0
  30. package/dist/cjs/v-map-layer-helper-iAzxAg9I.js +285 -0
  31. package/dist/cjs/v-map-layer-terrain-geotiff.cjs.entry.js +258 -0
  32. package/dist/cjs/v-map-layercontrol.cjs.entry.js +247 -0
  33. package/dist/cjs/v-map.cjs.js +25 -0
  34. package/dist/cjs/v-map.v-map-layer-osm.v-map-layergroup-BsXp3BoL.js +582 -0
  35. package/dist/cjs/v-map_3.cjs.entry.js +12 -0
  36. package/dist/collection/collection-manifest.json +30 -0
  37. package/dist/collection/components/v-map/v-map.css +3 -0
  38. package/dist/collection/components/v-map/v-map.js +467 -0
  39. package/dist/collection/components/v-map/v-map.test.js +33 -0
  40. package/dist/collection/components/v-map-builder/v-map-builder.css +1 -0
  41. package/dist/collection/components/v-map-builder/v-map-builder.js +913 -0
  42. package/dist/collection/components/v-map-builder/v-map-builder.test.js +56 -0
  43. package/dist/collection/components/v-map-layer-geojson/v-map-layer-geojson.js +862 -0
  44. package/dist/collection/components/v-map-layer-geojson/v-map-layer-geojson.test.js +42 -0
  45. package/dist/collection/components/v-map-layer-geotiff/v-map-layer-geotiff.css +4 -0
  46. package/dist/collection/components/v-map-layer-geotiff/v-map-layer-geotiff.js +500 -0
  47. package/dist/collection/components/v-map-layer-geotiff/v-map-layer-geotiff.test.js +38 -0
  48. package/dist/collection/components/v-map-layer-google/v-map-layer-google.css +1 -0
  49. package/dist/collection/components/v-map-layer-google/v-map-layer-google.js +442 -0
  50. package/dist/collection/components/v-map-layer-osm/error-api.test.js +108 -0
  51. package/dist/collection/components/v-map-layer-osm/v-map-layer-osm.css +4 -0
  52. package/dist/collection/components/v-map-layer-osm/v-map-layer-osm.js +311 -0
  53. package/dist/collection/components/v-map-layer-osm/v-map-layer-osm.test.js +36 -0
  54. package/dist/collection/components/v-map-layer-scatterplot/v-map-layer-scatterplot.css +1 -0
  55. package/dist/collection/components/v-map-layer-scatterplot/v-map-layer-scatterplot.js +305 -0
  56. package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.css +3 -0
  57. package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.js +548 -0
  58. package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.test.js +36 -0
  59. package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.css +3 -0
  60. package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.js +735 -0
  61. package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.test.js +42 -0
  62. package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.css +3 -0
  63. package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.js +449 -0
  64. package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.test.js +50 -0
  65. package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.css +1 -0
  66. package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.js +448 -0
  67. package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.test.js +39 -0
  68. package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.css +1 -0
  69. package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.js +489 -0
  70. package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.test.js +43 -0
  71. package/dist/collection/components/v-map-layer-wkt/v-map-layer-wkt.css +1 -0
  72. package/dist/collection/components/v-map-layer-wkt/v-map-layer-wkt.js +811 -0
  73. package/dist/collection/components/v-map-layer-wkt/v-map-layer-wkt.test.js +34 -0
  74. package/dist/collection/components/v-map-layer-wms/v-map-layer-wms.css +1 -0
  75. package/dist/collection/components/v-map-layer-wms/v-map-layer-wms.js +453 -0
  76. package/dist/collection/components/v-map-layer-wms/v-map-layer-wms.test.js +36 -0
  77. package/dist/collection/components/v-map-layer-xyz/v-map-layer-xyz.css +1 -0
  78. package/dist/collection/components/v-map-layer-xyz/v-map-layer-xyz.js +331 -0
  79. package/dist/collection/components/v-map-layer-xyz/v-map-layer-xyz.test.js +28 -0
  80. package/dist/collection/components/v-map-layercontrol/v-map-layercontrol.css +74 -0
  81. package/dist/collection/components/v-map-layercontrol/v-map-layercontrol.js +277 -0
  82. package/dist/collection/components/v-map-layercontrol/v-map-layercontrol.test.js +134 -0
  83. package/dist/collection/components/v-map-layergroup/v-map-layergroup.css +4 -0
  84. package/dist/collection/components/v-map-layergroup/v-map-layergroup.js +212 -0
  85. package/dist/collection/components/v-map-layergroup/v-map-layergroup.test.js +39 -0
  86. package/dist/collection/components/v-map-style/v-map-style.css +38 -0
  87. package/dist/collection/components/v-map-style/v-map-style.js +492 -0
  88. package/dist/collection/components/v-map-style/v-map-style.unit.js +62 -0
  89. package/dist/collection/index.js +1 -0
  90. package/dist/collection/layer/v-map-layer-helper.js +281 -0
  91. package/dist/collection/layer/v-map-layer-helper.unit.js +234 -0
  92. package/dist/collection/lib/cesium-loader.js +58 -0
  93. package/dist/collection/lib/ensure-importmap.js +12 -0
  94. package/dist/collection/lib/ensure-importmap.unit.js +57 -0
  95. package/dist/collection/lib/versions.gen.js +6 -0
  96. package/dist/collection/lib/vstyle.js +8 -0
  97. package/dist/collection/map-provider/cesium/CesiumGeoTIFFTerrainProvider.js +285 -0
  98. package/dist/collection/map-provider/cesium/CesiumLayerGroups.js +159 -0
  99. package/dist/collection/map-provider/cesium/GeoTIFFImageryProvider.js +192 -0
  100. package/dist/collection/map-provider/cesium/GeoTIFFImageryProvider.test.js +57 -0
  101. package/dist/collection/map-provider/cesium/cesium-provider.js +1408 -0
  102. package/dist/collection/map-provider/cesium/i-layer.js +1 -0
  103. package/dist/collection/map-provider/cesium/layer-manager.js +467 -0
  104. package/dist/collection/map-provider/deck/DeckGLGeoTIFFLayer.js +483 -0
  105. package/dist/collection/map-provider/deck/DeckGLGeoTIFFTerrainLayer.js +410 -0
  106. package/dist/collection/map-provider/deck/LayerGroupWithModel.js +169 -0
  107. package/dist/collection/map-provider/deck/LayerGroups.js +192 -0
  108. package/dist/collection/map-provider/deck/LayerModel.js +1 -0
  109. package/dist/collection/map-provider/deck/RenderableGroup.js +1 -0
  110. package/dist/collection/map-provider/deck/deck-provider.js +1563 -0
  111. package/dist/collection/map-provider/geotiff/geotiff-source.js +172 -0
  112. package/dist/collection/map-provider/geotiff/utils/AABB2D.js +24 -0
  113. package/dist/collection/map-provider/geotiff/utils/BVHNode2D.js +166 -0
  114. package/dist/collection/map-provider/geotiff/utils/GeoTIFFTileProcessor.js +484 -0
  115. package/dist/collection/map-provider/geotiff/utils/Triangle.js +1 -0
  116. package/dist/collection/map-provider/geotiff/utils/Triangulation.js +321 -0
  117. package/dist/collection/map-provider/geotiff/utils/colormap-utils.js +190 -0
  118. package/dist/collection/map-provider/geotiff/utils/normalization-utils.js +122 -0
  119. package/dist/collection/map-provider/geotiff/utils/sampling-utils.js +108 -0
  120. package/dist/collection/map-provider/leaflet/GeoTIFFGridLayer.js +147 -0
  121. package/dist/collection/map-provider/leaflet/WCSGridLayer.js +124 -0
  122. package/dist/collection/map-provider/leaflet/google-map-tiles-layer.js +352 -0
  123. package/dist/collection/map-provider/leaflet/leaflet-helpers.js +94 -0
  124. package/dist/collection/map-provider/leaflet/leaflet-provider.js +1095 -0
  125. package/dist/collection/map-provider/ol/CustomGeoTiff.js +145 -0
  126. package/dist/collection/map-provider/ol/openlayers-helper.js +26 -0
  127. package/dist/collection/map-provider/ol/openlayers-provider.js +1427 -0
  128. package/dist/collection/map-provider/provider-factory.js +44 -0
  129. package/dist/collection/map-provider/provider-factory.unit.js +66 -0
  130. package/dist/collection/testing/browser-test-utils.js +49 -0
  131. package/dist/collection/testing/e2e-testing.js +122 -0
  132. package/dist/collection/testing/e2e-utils.js +70 -0
  133. package/dist/collection/testing/geotiff-test-server.js +100 -0
  134. package/dist/collection/testing/mocks/geostyler-lyrx-parser.js +12 -0
  135. package/dist/collection/testing/mocks/geostyler-mapbox-parser.js +12 -0
  136. package/dist/collection/testing/mocks/geostyler-qgis-parser.js +12 -0
  137. package/dist/collection/testing/mocks/geostyler-sld-parser.js +13 -0
  138. package/dist/collection/testing/mocks/geostyler-style.js +5 -0
  139. package/dist/collection/testing/setupTests.browser.js +1 -0
  140. package/dist/collection/testing/setupTests.stencil.js +20 -0
  141. package/dist/collection/testing/setupTests.vitest.js +59 -0
  142. package/dist/collection/testing/stencil-testing-wrapper.js +43 -0
  143. package/dist/collection/testing/styleMock.js +1 -0
  144. package/dist/collection/types/color.js +1 -0
  145. package/dist/collection/types/cssmode.js +1 -0
  146. package/dist/collection/types/flavour.js +1 -0
  147. package/dist/collection/types/layerconfig.js +1 -0
  148. package/dist/collection/types/lonlat.js +1 -0
  149. package/dist/collection/types/mapinitoptions.js +1 -0
  150. package/dist/collection/types/mapprovider.js +1 -0
  151. package/dist/collection/types/provideroptions.js +1 -0
  152. package/dist/collection/types/styleconfig.js +19 -0
  153. package/dist/collection/types/styling.js +13 -0
  154. package/dist/collection/types/styling.unit.js +37 -0
  155. package/dist/collection/types/vmaplayer.js +1 -0
  156. package/dist/collection/utils/async-mutex.js +28 -0
  157. package/dist/collection/utils/diff.js +142 -0
  158. package/dist/collection/utils/diff.unit.js +59 -0
  159. package/dist/collection/utils/dom-env.js +43 -0
  160. package/dist/collection/utils/dom-env.unit.js +92 -0
  161. package/dist/collection/utils/events.js +8 -0
  162. package/dist/collection/utils/logger.js +183 -0
  163. package/dist/collection/utils/logger.unit.js +98 -0
  164. package/dist/collection/utils/messages.js +12 -0
  165. package/dist/collection/utils/spatial-utils.js +27 -0
  166. package/dist/collection/utils/spatial-utils.unit.js +24 -0
  167. package/dist/components/_commonjsHelpers.js +1 -0
  168. package/dist/components/cesium-provider.js +1 -0
  169. package/dist/components/deck-provider.js +1 -0
  170. package/dist/components/events.js +1 -0
  171. package/dist/components/geotiff-source.js +1 -0
  172. package/dist/components/geotiff.js +4 -0
  173. package/dist/components/index.browser.js +15 -0
  174. package/dist/components/index.d.ts +35 -0
  175. package/dist/components/index.js +1 -0
  176. package/dist/components/index2.js +1 -0
  177. package/dist/components/index3.js +1 -0
  178. package/dist/components/index4.js +1 -0
  179. package/dist/components/index5.js +1 -0
  180. package/dist/components/index6.js +1 -0
  181. package/dist/components/index7.js +1 -0
  182. package/dist/components/index8.js +7 -0
  183. package/dist/components/layer-extension.js +1 -0
  184. package/dist/components/leaflet-provider.js +1 -0
  185. package/dist/components/main-dist.js +1 -0
  186. package/dist/components/messages.js +1 -0
  187. package/dist/components/openlayers-provider.js +1 -0
  188. package/dist/components/polygon-layer.js +1 -0
  189. package/dist/components/scenegraph-layer.js +1 -0
  190. package/dist/components/styleconfig.js +1 -0
  191. package/dist/components/styling.js +1 -0
  192. package/dist/components/v-map-builder.d.ts +11 -0
  193. package/dist/components/v-map-builder.js +2 -0
  194. package/dist/components/v-map-layer-geojson.d.ts +11 -0
  195. package/dist/components/v-map-layer-geojson.js +1 -0
  196. package/dist/components/v-map-layer-geojson2.js +1 -0
  197. package/dist/components/v-map-layer-geotiff.d.ts +11 -0
  198. package/dist/components/v-map-layer-geotiff.js +1 -0
  199. package/dist/components/v-map-layer-geotiff2.js +1 -0
  200. package/dist/components/v-map-layer-google.d.ts +11 -0
  201. package/dist/components/v-map-layer-google.js +1 -0
  202. package/dist/components/v-map-layer-google2.js +1 -0
  203. package/dist/components/v-map-layer-helper.js +1 -0
  204. package/dist/components/v-map-layer-osm.d.ts +11 -0
  205. package/dist/components/v-map-layer-osm.js +1 -0
  206. package/dist/components/v-map-layer-osm2.js +1 -0
  207. package/dist/components/v-map-layer-scatterplot.d.ts +11 -0
  208. package/dist/components/v-map-layer-scatterplot.js +1 -0
  209. package/dist/components/v-map-layer-scatterplot2.js +1 -0
  210. package/dist/components/v-map-layer-terrain-geotiff.d.ts +11 -0
  211. package/dist/components/v-map-layer-terrain-geotiff.js +1 -0
  212. package/dist/components/v-map-layer-terrain.d.ts +11 -0
  213. package/dist/components/v-map-layer-terrain.js +1 -0
  214. package/dist/components/v-map-layer-terrain2.js +1 -0
  215. package/dist/components/v-map-layer-tile3d.d.ts +11 -0
  216. package/dist/components/v-map-layer-tile3d.js +1 -0
  217. package/dist/components/v-map-layer-tile3d2.js +1 -0
  218. package/dist/components/v-map-layer-wcs.d.ts +11 -0
  219. package/dist/components/v-map-layer-wcs.js +1 -0
  220. package/dist/components/v-map-layer-wcs2.js +1 -0
  221. package/dist/components/v-map-layer-wfs.d.ts +11 -0
  222. package/dist/components/v-map-layer-wfs.js +1 -0
  223. package/dist/components/v-map-layer-wfs2.js +1 -0
  224. package/dist/components/v-map-layer-wkt.d.ts +11 -0
  225. package/dist/components/v-map-layer-wkt.js +1 -0
  226. package/dist/components/v-map-layer-wkt2.js +1 -0
  227. package/dist/components/v-map-layer-wms.d.ts +11 -0
  228. package/dist/components/v-map-layer-wms.js +1 -0
  229. package/dist/components/v-map-layer-wms2.js +1 -0
  230. package/dist/components/v-map-layer-xyz.d.ts +11 -0
  231. package/dist/components/v-map-layer-xyz.js +1 -0
  232. package/dist/components/v-map-layer-xyz2.js +1 -0
  233. package/dist/components/v-map-layercontrol.d.ts +11 -0
  234. package/dist/components/v-map-layercontrol.js +1 -0
  235. package/dist/components/v-map-layergroup.d.ts +11 -0
  236. package/dist/components/v-map-layergroup.js +1 -0
  237. package/dist/components/v-map-layergroup2.js +1 -0
  238. package/dist/components/v-map-style.d.ts +11 -0
  239. package/dist/components/v-map-style.js +1 -0
  240. package/dist/components/v-map-style2.js +10 -0
  241. package/dist/components/v-map.d.ts +11 -0
  242. package/dist/components/v-map.js +1 -0
  243. package/dist/components/v-map2.js +1 -0
  244. package/dist/esm/_commonjsHelpers-E-ZsRS8r.js +32 -0
  245. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  246. package/dist/esm/cesium-provider-BJfAup3w.js +2596 -0
  247. package/dist/esm/deck-provider-C7U9VDEq.js +47709 -0
  248. package/dist/esm/geotiff-BEWxTIfH.js +45 -0
  249. package/dist/esm/geotiff-source-esnDnC-u.js +1516 -0
  250. package/dist/esm/index-B1zwA4IC.js +685 -0
  251. package/dist/esm/index-BBpiaTpT.js +165 -0
  252. package/dist/esm/index-BIEmlzCf.js +1697 -0
  253. package/dist/esm/index-BUHa4Jj0.js +307 -0
  254. package/dist/esm/index-DbSdn93t.js +20461 -0
  255. package/dist/esm/index-RpJarvr_.js +10656 -0
  256. package/dist/esm/index-jN06TXUp.js +14 -0
  257. package/dist/esm/index-jzneDarq.js +1613 -0
  258. package/dist/esm/index.browser-DhQAXuA7.js +6860 -0
  259. package/dist/esm/index.js +1 -0
  260. package/dist/esm/layer-extension-CZXK5goK.js +63 -0
  261. package/dist/esm/leaflet-provider-Q41TB6ku.js +1794 -0
  262. package/dist/esm/loader.js +11 -0
  263. package/dist/esm/main-dist-CwnA7_Xn.js +2652 -0
  264. package/dist/esm/messages-CMKJzsgL.js +180 -0
  265. package/dist/esm/openlayers-provider-CMsDsQTQ.js +1602 -0
  266. package/dist/esm/polygon-layer-ByhxGhWC.js +1295 -0
  267. package/dist/esm/scenegraph-layer-09K_B6DT.js +2526 -0
  268. package/dist/esm/styleconfig-B-bAcABs.js +21 -0
  269. package/dist/esm/v-map-builder.entry.js +3784 -0
  270. package/dist/esm/v-map-layer-geojson_12.entry.js +40881 -0
  271. package/dist/esm/v-map-layer-helper-Dys44Cgo.js +283 -0
  272. package/dist/esm/v-map-layer-terrain-geotiff.entry.js +256 -0
  273. package/dist/esm/v-map-layercontrol.entry.js +245 -0
  274. package/dist/esm/v-map.js +21 -0
  275. package/dist/esm/v-map.v-map-layer-osm.v-map-layergroup-B4pFHuSf.js +572 -0
  276. package/dist/esm/v-map_3.entry.js +4 -0
  277. package/dist/index.cjs.js +1 -0
  278. package/dist/index.js +1 -0
  279. package/dist/types/cesium-augment.d.ts +5 -0
  280. package/dist/types/components/v-map/v-map.d.ts +70 -0
  281. package/dist/types/components/v-map/v-map.test.d.ts +1 -0
  282. package/dist/types/components/v-map-builder/v-map-builder.d.ts +48 -0
  283. package/dist/types/components/v-map-builder/v-map-builder.test.d.ts +1 -0
  284. package/dist/types/components/v-map-layer-geojson/v-map-layer-geojson.d.ts +129 -0
  285. package/dist/types/components/v-map-layer-geojson/v-map-layer-geojson.test.d.ts +1 -0
  286. package/dist/types/components/v-map-layer-geotiff/v-map-layer-geotiff.d.ts +74 -0
  287. package/dist/types/components/v-map-layer-geotiff/v-map-layer-geotiff.test.d.ts +1 -0
  288. package/dist/types/components/v-map-layer-google/v-map-layer-google.d.ts +78 -0
  289. package/dist/types/components/v-map-layer-osm/error-api.test.d.ts +1 -0
  290. package/dist/types/components/v-map-layer-osm/v-map-layer-osm.d.ts +50 -0
  291. package/dist/types/components/v-map-layer-osm/v-map-layer-osm.test.d.ts +1 -0
  292. package/dist/types/components/v-map-layer-scatterplot/v-map-layer-scatterplot.d.ts +54 -0
  293. package/dist/types/components/v-map-layer-terrain/v-map-layer-terrain.d.ts +74 -0
  294. package/dist/types/components/v-map-layer-terrain/v-map-layer-terrain.test.d.ts +1 -0
  295. package/dist/types/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.d.ts +117 -0
  296. package/dist/types/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.test.d.ts +1 -0
  297. package/dist/types/components/v-map-layer-tile3d/v-map-layer-tile3d.d.ts +69 -0
  298. package/dist/types/components/v-map-layer-tile3d/v-map-layer-tile3d.test.d.ts +1 -0
  299. package/dist/types/components/v-map-layer-wcs/v-map-layer-wcs.d.ts +47 -0
  300. package/dist/types/components/v-map-layer-wcs/v-map-layer-wcs.test.d.ts +1 -0
  301. package/dist/types/components/v-map-layer-wfs/v-map-layer-wfs.d.ts +59 -0
  302. package/dist/types/components/v-map-layer-wfs/v-map-layer-wfs.test.d.ts +1 -0
  303. package/dist/types/components/v-map-layer-wkt/v-map-layer-wkt.d.ts +132 -0
  304. package/dist/types/components/v-map-layer-wkt/v-map-layer-wkt.test.d.ts +1 -0
  305. package/dist/types/components/v-map-layer-wms/v-map-layer-wms.d.ts +76 -0
  306. package/dist/types/components/v-map-layer-wms/v-map-layer-wms.test.d.ts +1 -0
  307. package/dist/types/components/v-map-layer-xyz/v-map-layer-xyz.d.ts +59 -0
  308. package/dist/types/components/v-map-layer-xyz/v-map-layer-xyz.test.d.ts +1 -0
  309. package/dist/types/components/v-map-layercontrol/v-map-layercontrol.d.ts +44 -0
  310. package/dist/types/components/v-map-layercontrol/v-map-layercontrol.test.d.ts +1 -0
  311. package/dist/types/components/v-map-layergroup/v-map-layergroup.d.ts +31 -0
  312. package/dist/types/components/v-map-layergroup/v-map-layergroup.test.d.ts +1 -0
  313. package/dist/types/components/v-map-style/v-map-style.d.ts +75 -0
  314. package/dist/types/components/v-map-style/v-map-style.unit.d.ts +1 -0
  315. package/dist/types/components.d.ts +2391 -0
  316. package/dist/types/globals.d.ts +16 -0
  317. package/dist/types/index.d.ts +10 -0
  318. package/dist/types/layer/v-map-layer-helper.d.ts +45 -0
  319. package/dist/types/layer/v-map-layer-helper.unit.d.ts +1 -0
  320. package/dist/types/leaflet-augment.d.ts +15 -0
  321. package/dist/types/lib/cesium-loader.d.ts +3 -0
  322. package/dist/types/lib/ensure-importmap.d.ts +3 -0
  323. package/dist/types/lib/ensure-importmap.unit.d.ts +1 -0
  324. package/dist/types/lib/versions.gen.d.ts +5 -0
  325. package/dist/types/lib/vstyle.d.ts +44 -0
  326. package/dist/types/map-provider/cesium/CesiumGeoTIFFTerrainProvider.d.ts +92 -0
  327. package/dist/types/map-provider/cesium/CesiumLayerGroups.d.ts +64 -0
  328. package/dist/types/map-provider/cesium/GeoTIFFImageryProvider.d.ts +75 -0
  329. package/dist/types/map-provider/cesium/GeoTIFFImageryProvider.test.d.ts +1 -0
  330. package/dist/types/map-provider/cesium/cesium-provider.d.ts +87 -0
  331. package/dist/types/map-provider/cesium/i-layer.d.ts +11 -0
  332. package/dist/types/map-provider/cesium/layer-manager.d.ts +31 -0
  333. package/dist/types/map-provider/deck/DeckGLGeoTIFFLayer.d.ts +91 -0
  334. package/dist/types/map-provider/deck/DeckGLGeoTIFFTerrainLayer.d.ts +82 -0
  335. package/dist/types/map-provider/deck/LayerGroupWithModel.d.ts +55 -0
  336. package/dist/types/map-provider/deck/LayerGroups.d.ts +63 -0
  337. package/dist/types/map-provider/deck/LayerModel.d.ts +8 -0
  338. package/dist/types/map-provider/deck/RenderableGroup.d.ts +20 -0
  339. package/dist/types/map-provider/deck/deck-provider.d.ts +92 -0
  340. package/dist/types/map-provider/geotiff/geotiff-source.d.ts +30 -0
  341. package/dist/types/map-provider/geotiff/utils/AABB2D.d.ts +28 -0
  342. package/dist/types/map-provider/geotiff/utils/BVHNode2D.d.ts +36 -0
  343. package/dist/types/map-provider/geotiff/utils/GeoTIFFTileProcessor.d.ts +116 -0
  344. package/dist/types/map-provider/geotiff/utils/Triangle.d.ts +5 -0
  345. package/dist/types/map-provider/geotiff/utils/Triangulation.d.ts +94 -0
  346. package/dist/types/map-provider/geotiff/utils/colormap-utils.d.ts +47 -0
  347. package/dist/types/map-provider/geotiff/utils/normalization-utils.d.ts +39 -0
  348. package/dist/types/map-provider/geotiff/utils/sampling-utils.d.ts +13 -0
  349. package/dist/types/map-provider/leaflet/GeoTIFFGridLayer.d.ts +34 -0
  350. package/dist/types/map-provider/leaflet/WCSGridLayer.d.ts +38 -0
  351. package/dist/types/map-provider/leaflet/google-map-tiles-layer.d.ts +73 -0
  352. package/dist/types/map-provider/leaflet/leaflet-helpers.d.ts +6 -0
  353. package/dist/types/map-provider/leaflet/leaflet-provider.d.ts +73 -0
  354. package/dist/types/map-provider/ol/CustomGeoTiff.d.ts +14 -0
  355. package/dist/types/map-provider/ol/openlayers-helper.d.ts +2 -0
  356. package/dist/types/map-provider/ol/openlayers-provider.d.ts +80 -0
  357. package/dist/types/map-provider/provider-factory.d.ts +12 -0
  358. package/dist/types/map-provider/provider-factory.unit.d.ts +1 -0
  359. package/dist/types/namespaces.d.ts +3 -0
  360. package/dist/types/ol-augment.d.ts +3 -0
  361. package/dist/types/ol-override.d.ts +7 -0
  362. package/dist/types/ol.d.ts +10 -0
  363. package/dist/types/stencil-public-runtime.d.ts +1860 -0
  364. package/dist/types/testing/browser-test-utils.d.ts +6 -0
  365. package/dist/types/testing/e2e-testing.d.ts +5 -0
  366. package/dist/types/testing/e2e-utils.d.ts +4 -0
  367. package/dist/types/testing/geotiff-test-server.d.ts +5 -0
  368. package/dist/types/testing/mocks/geostyler-lyrx-parser.d.ts +11 -0
  369. package/dist/types/testing/mocks/geostyler-mapbox-parser.d.ts +11 -0
  370. package/dist/types/testing/mocks/geostyler-qgis-parser.d.ts +11 -0
  371. package/dist/types/testing/mocks/geostyler-sld-parser.d.ts +11 -0
  372. package/dist/types/testing/mocks/geostyler-style.d.ts +5 -0
  373. package/dist/types/testing/setupTests.browser.d.ts +1 -0
  374. package/dist/types/testing/setupTests.stencil.d.ts +1 -0
  375. package/dist/types/testing/setupTests.vitest.d.ts +1 -0
  376. package/dist/types/testing/stencil-testing-wrapper.d.ts +3 -0
  377. package/dist/types/types/color.d.ts +1 -0
  378. package/dist/types/types/cssmode.d.ts +1 -0
  379. package/dist/types/types/flavour.d.ts +1 -0
  380. package/dist/types/types/layerconfig.d.ts +207 -0
  381. package/dist/types/types/lonlat.d.ts +1 -0
  382. package/dist/types/types/mapinitoptions.d.ts +4 -0
  383. package/dist/types/types/mapprovider.d.ts +46 -0
  384. package/dist/types/types/provideroptions.d.ts +8 -0
  385. package/dist/types/types/styleconfig.d.ts +27 -0
  386. package/dist/types/types/styling.d.ts +24 -0
  387. package/dist/types/types/styling.unit.d.ts +1 -0
  388. package/dist/types/types/vmaplayer.d.ts +10 -0
  389. package/dist/types/utils/async-mutex.d.ts +7 -0
  390. package/dist/types/utils/diff.d.ts +64 -0
  391. package/dist/types/utils/diff.unit.d.ts +1 -0
  392. package/dist/types/utils/dom-env.d.ts +5 -0
  393. package/dist/types/utils/dom-env.unit.d.ts +1 -0
  394. package/dist/types/utils/events.d.ts +29 -0
  395. package/dist/types/utils/logger.d.ts +47 -0
  396. package/dist/types/utils/logger.unit.d.ts +1 -0
  397. package/dist/types/utils/messages.d.ts +12 -0
  398. package/dist/types/utils/spatial-utils.d.ts +6 -0
  399. package/dist/types/utils/spatial-utils.unit.d.ts +1 -0
  400. package/dist/types/versions.d.ts +7 -0
  401. package/dist/v-map/index.esm.js +0 -0
  402. package/dist/v-map/p--vVleK-M.js +1 -0
  403. package/dist/v-map/p-09d10db0.entry.js +1 -0
  404. package/dist/v-map/p-5eba6058.entry.js +10 -0
  405. package/dist/v-map/p-6b102336.entry.js +1 -0
  406. package/dist/v-map/p-B-bAcABs.js +1 -0
  407. package/dist/v-map/p-BBpiaTpT.js +1 -0
  408. package/dist/v-map/p-BdijL4Av.js +1 -0
  409. package/dist/v-map/p-Be3r33VF.js +4 -0
  410. package/dist/v-map/p-BeFu0ap4.js +1 -0
  411. package/dist/v-map/p-BxFJezdK.js +1 -0
  412. package/dist/v-map/p-CMKJzsgL.js +1 -0
  413. package/dist/v-map/p-CXfA_q8m.js +1 -0
  414. package/dist/v-map/p-CZqY0yW4.js +1 -0
  415. package/dist/v-map/p-CafTHT9i.js +1 -0
  416. package/dist/v-map/p-DCTHyf58.js +1 -0
  417. package/dist/v-map/p-DQuL1Twl.js +1 -0
  418. package/dist/v-map/p-DR9McdNX.js +1 -0
  419. package/dist/v-map/p-Dckgonw8.js +1 -0
  420. package/dist/v-map/p-DhQAXuA7.js +15 -0
  421. package/dist/v-map/p-DmICdG34.js +7 -0
  422. package/dist/v-map/p-DrOQ9V4h.js +1 -0
  423. package/dist/v-map/p-DvHXtWUg.js +1 -0
  424. package/dist/v-map/p-E-ZsRS8r.js +1 -0
  425. package/dist/v-map/p-MyTSFnEk.js +1 -0
  426. package/dist/v-map/p-RpJarvr_.js +1 -0
  427. package/dist/v-map/p-WaMDUuAz.js +1 -0
  428. package/dist/v-map/p-aa410e64.entry.js +2 -0
  429. package/dist/v-map/p-c21c93fe.entry.js +1 -0
  430. package/dist/v-map/p-jzneDarq.js +2 -0
  431. package/dist/v-map/p-uiIP-taz.js +1 -0
  432. package/dist/v-map/v-map.esm.js +1 -0
  433. package/loader/cdn.js +1 -0
  434. package/loader/index.cjs.js +1 -0
  435. package/loader/index.d.ts +24 -0
  436. package/loader/index.es2017.js +1 -0
  437. package/loader/index.js +2 -0
  438. package/package.json +193 -0
@@ -0,0 +1,321 @@
1
+ /**
2
+ * Triangulation for raster reprojection
3
+ *
4
+ * Based on OpenLayers' triangulation approach for efficient raster reprojection.
5
+ * Instead of transforming every pixel, we:
6
+ * 1. Divide the target extent into triangles
7
+ * 2. Transform only triangle vertices with proj4
8
+ * 3. Use affine transformation to map pixels within each triangle
9
+ *
10
+ * This reduces proj4 calls from ~65,536 per tile to ~50-200 per tile.
11
+ */
12
+ import { BVHNode2D } from "./BVHNode2D";
13
+ export function calculateBounds(sourceRef, resolution, targetExtent, transformFn, step = 10) {
14
+ const [west, south, east, north] = targetExtent;
15
+ let minX = Infinity;
16
+ let minY = Infinity;
17
+ let maxX = -Infinity;
18
+ let maxY = -Infinity;
19
+ let minXTarget = [0, 0];
20
+ let minYTarget = [0, 0];
21
+ let maxXTarget = [0, 0];
22
+ let maxYTarget = [0, 0];
23
+ // Funktion zum Abtasten einer Kante
24
+ const sampleEdge = (start, end, steps) => {
25
+ for (let i = 0; i <= steps; i++) {
26
+ const t = i / steps;
27
+ const x = start[0] + (end[0] - start[0]) * t;
28
+ const y = start[1] + (end[1] - start[1]) * t;
29
+ const target = [x, y];
30
+ const [xSrc, ySrc] = transformFn(target);
31
+ if (xSrc < minX) {
32
+ minX = xSrc;
33
+ minXTarget = target;
34
+ }
35
+ if (ySrc < minY) {
36
+ minY = ySrc;
37
+ minYTarget = target;
38
+ }
39
+ if (xSrc > maxX) {
40
+ maxX = xSrc;
41
+ maxXTarget = target;
42
+ }
43
+ if (ySrc > maxY) {
44
+ maxY = ySrc;
45
+ maxYTarget = target;
46
+ }
47
+ }
48
+ };
49
+ // Abtasten aller vier Kanten
50
+ sampleEdge([west, north], [east, north], step); // Top edge
51
+ sampleEdge([east, north], [east, south], step); // Right edge
52
+ sampleEdge([east, south], [west, south], step); // Bottom edge
53
+ sampleEdge([west, south], [west, north], step); // Left edge
54
+ if (sourceRef != null && resolution != null) {
55
+ const minXPix = Math.floor((minX - sourceRef[0]) / resolution);
56
+ minX = sourceRef[0] + minXPix * resolution;
57
+ const minYPix = Math.floor((minY - sourceRef[1]) / resolution);
58
+ minY = sourceRef[1] + minYPix * resolution;
59
+ const maxXPix = Math.ceil((maxX - sourceRef[0]) / resolution);
60
+ maxX = sourceRef[0] + maxXPix * resolution;
61
+ const maxYPix = Math.ceil((maxY - sourceRef[1]) / resolution);
62
+ maxY = sourceRef[1] + maxYPix * resolution;
63
+ }
64
+ return {
65
+ source: {
66
+ minX,
67
+ minY,
68
+ maxX,
69
+ maxY,
70
+ },
71
+ target: {
72
+ minX: minXTarget[0],
73
+ minY: minYTarget[1],
74
+ maxX: maxXTarget[0],
75
+ maxY: maxYTarget[1],
76
+ },
77
+ };
78
+ }
79
+ const MAX_SUBDIVISION = 10;
80
+ /**
81
+ * Class for triangulation of the given target extent
82
+ * Used for determining source data and the reprojection itself
83
+ */
84
+ export class Triangulation {
85
+ triangles_ = [];
86
+ transformFn_;
87
+ errorThresholdSquared_;
88
+ bvh_ = null;
89
+ bounds;
90
+ /**
91
+ * @param transformFn - Function that transforms [x, y] from target to source projection
92
+ * @param targetExtent - [west, south, east, north] in target projection
93
+ * @param errorThreshold - Maximum allowed error in pixels (default: 0.5)
94
+ */
95
+ constructor(transformFn, targetExtent, errorThreshold = 0.5, sourceRef = null, resolution = null, step = 10) {
96
+ this.transformFn_ = transformFn;
97
+ this.errorThresholdSquared_ = errorThreshold * errorThreshold;
98
+ const [west, south, east, north] = targetExtent;
99
+ // Transform the four corners
100
+ const a = [west, north]; // top-left
101
+ const b = [east, north]; // top-right
102
+ const c = [east, south]; // bottom-right
103
+ const d = [west, south]; // bottom-left
104
+ const extBounds = calculateBounds(sourceRef, resolution, targetExtent, this.transformFn_, step);
105
+ // const aSrc = this.transformFn_(a);
106
+ // const bSrc = this.transformFn_(b);
107
+ // const cSrc = this.transformFn_(c);
108
+ // const dSrc = this.transformFn_(d);
109
+ const aSrc = [
110
+ extBounds.source.minX,
111
+ extBounds.source.maxY,
112
+ ]; // top-left
113
+ const bSrc = [
114
+ extBounds.source.maxX,
115
+ extBounds.source.maxY,
116
+ ]; // top-right
117
+ const cSrc = [
118
+ extBounds.source.maxX,
119
+ extBounds.source.minY,
120
+ ]; // bottom-right
121
+ const dSrc = [
122
+ extBounds.source.minX,
123
+ extBounds.source.minY,
124
+ ]; // bottom-left
125
+ this.bounds = extBounds.source;
126
+ this.addQuad_(a, b, c, d, aSrc, bSrc, cSrc, dSrc, MAX_SUBDIVISION);
127
+ }
128
+ getBounds() {
129
+ return this.bounds;
130
+ }
131
+ /**
132
+ * Recursively subdivide a quadrilateral if needed
133
+ */
134
+ addQuad_(a, b, c, d, aSrc, bSrc, cSrc, dSrc, maxSubdivision) {
135
+ let needsSubdivision = false;
136
+ // Check if we need to subdivide based on error threshold
137
+ if (maxSubdivision > 0) {
138
+ // Calculate midpoints of all edges (linear interpolation in target space)
139
+ const abTarget = [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2];
140
+ const bcTarget = [(b[0] + c[0]) / 2, (b[1] + c[1]) / 2];
141
+ const cdTarget = [(c[0] + d[0]) / 2, (c[1] + d[1]) / 2];
142
+ const daTarget = [(d[0] + a[0]) / 2, (d[1] + a[1]) / 2];
143
+ // Transform midpoints to source space
144
+ const abSrc = this.transformFn_(abTarget);
145
+ const bcSrc = this.transformFn_(bcTarget);
146
+ const cdSrc = this.transformFn_(cdTarget);
147
+ const daSrc = this.transformFn_(daTarget);
148
+ // Calculate expected midpoints (linear interpolation in source space)
149
+ const abExpected = [
150
+ (aSrc[0] + bSrc[0]) / 2,
151
+ (aSrc[1] + bSrc[1]) / 2,
152
+ ];
153
+ const bcExpected = [
154
+ (bSrc[0] + cSrc[0]) / 2,
155
+ (bSrc[1] + cSrc[1]) / 2,
156
+ ];
157
+ const cdExpected = [
158
+ (cSrc[0] + dSrc[0]) / 2,
159
+ (cSrc[1] + dSrc[1]) / 2,
160
+ ];
161
+ const daExpected = [
162
+ (dSrc[0] + aSrc[0]) / 2,
163
+ (dSrc[1] + aSrc[1]) / 2,
164
+ ];
165
+ // Calculate squared errors
166
+ const abError = this.getSquaredError_(abSrc, abExpected);
167
+ const bcError = this.getSquaredError_(bcSrc, bcExpected);
168
+ const cdError = this.getSquaredError_(cdSrc, cdExpected);
169
+ const daError = this.getSquaredError_(daSrc, daExpected);
170
+ // Check if any edge exceeds error threshold
171
+ if (abError > this.errorThresholdSquared_ ||
172
+ bcError > this.errorThresholdSquared_ ||
173
+ cdError > this.errorThresholdSquared_ ||
174
+ daError > this.errorThresholdSquared_) {
175
+ needsSubdivision = true;
176
+ }
177
+ }
178
+ if (needsSubdivision) {
179
+ // Subdivide into 4 smaller quads
180
+ // Calculate center point
181
+ const eTarget = [
182
+ (a[0] + b[0] + c[0] + d[0]) / 4,
183
+ (a[1] + b[1] + c[1] + d[1]) / 4,
184
+ ];
185
+ const eSrc = this.transformFn_(eTarget);
186
+ // Calculate edge midpoints
187
+ const abTarget = [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2];
188
+ const bcTarget = [(b[0] + c[0]) / 2, (b[1] + c[1]) / 2];
189
+ const cdTarget = [(c[0] + d[0]) / 2, (c[1] + d[1]) / 2];
190
+ const daTarget = [(d[0] + a[0]) / 2, (d[1] + a[1]) / 2];
191
+ const abSrc = this.transformFn_(abTarget);
192
+ const bcSrc = this.transformFn_(bcTarget);
193
+ const cdSrc = this.transformFn_(cdTarget);
194
+ const daSrc = this.transformFn_(daTarget);
195
+ const newMaxSubdivision = maxSubdivision - 1;
196
+ // Recursively add 4 sub-quads
197
+ this.addQuad_(a, abTarget, eTarget, daTarget, aSrc, abSrc, eSrc, daSrc, newMaxSubdivision);
198
+ this.addQuad_(abTarget, b, bcTarget, eTarget, abSrc, bSrc, bcSrc, eSrc, newMaxSubdivision);
199
+ this.addQuad_(eTarget, bcTarget, c, cdTarget, eSrc, bcSrc, cSrc, cdSrc, newMaxSubdivision);
200
+ this.addQuad_(daTarget, eTarget, cdTarget, d, daSrc, eSrc, cdSrc, dSrc, newMaxSubdivision);
201
+ }
202
+ else {
203
+ // No subdivision needed - add two triangles for this quad
204
+ // Triangle 1: a-b-d
205
+ this.addTriangle_(a, b, d, aSrc, bSrc, dSrc);
206
+ // Triangle 2: b-c-d
207
+ this.addTriangle_(b, c, d, bSrc, cSrc, dSrc);
208
+ }
209
+ }
210
+ /**
211
+ * Add a single triangle
212
+ */
213
+ addTriangle_(a, b, c, aSrc, bSrc, cSrc) {
214
+ // Check for non-finite coordinates
215
+ if (!isFinite(aSrc[0]) ||
216
+ !isFinite(aSrc[1]) ||
217
+ !isFinite(bSrc[0]) ||
218
+ !isFinite(bSrc[1]) ||
219
+ !isFinite(cSrc[0]) ||
220
+ !isFinite(cSrc[1])) {
221
+ return; // Skip invalid triangles
222
+ }
223
+ this.triangles_.push({
224
+ source: [aSrc, bSrc, cSrc],
225
+ target: [a, b, c],
226
+ });
227
+ }
228
+ /**
229
+ * Calculate squared error between two points
230
+ */
231
+ getSquaredError_(actual, expected) {
232
+ const dx = actual[0] - expected[0];
233
+ const dy = actual[1] - expected[1];
234
+ return dx * dx + dy * dy;
235
+ }
236
+ /**
237
+ * Get all triangles
238
+ */
239
+ getTriangles() {
240
+ return this.triangles_;
241
+ }
242
+ /**
243
+ * Calculate the bounding extent of all source coordinates
244
+ */
245
+ calculateSourceExtent() {
246
+ if (this.triangles_.length === 0) {
247
+ return null;
248
+ }
249
+ let minX = Infinity;
250
+ let minY = Infinity;
251
+ let maxX = -Infinity;
252
+ let maxY = -Infinity;
253
+ for (const triangle of this.triangles_) {
254
+ for (const [x, y] of triangle.source) {
255
+ if (x < minX)
256
+ minX = x;
257
+ if (x > maxX)
258
+ maxX = x;
259
+ if (y < minY)
260
+ minY = y;
261
+ if (y > maxY)
262
+ maxY = y;
263
+ }
264
+ }
265
+ return [minX, minY, maxX, maxY];
266
+ }
267
+ buildBVH() {
268
+ const triangles2D = this.triangles_.map(BVHNode2D.toTriangle2D);
269
+ this.bvh_ = BVHNode2D.build(triangles2D);
270
+ }
271
+ findSourceTriangleForTargetPoint(point, extraTri = null) {
272
+ if (!this.bvh_)
273
+ this.buildBVH();
274
+ const point2D = { x: point[0], y: point[1] };
275
+ if (extraTri?.tri &&
276
+ BVHNode2D.punktInDreieck2D(point2D, BVHNode2D.toTriangle2D(extraTri.tri))) {
277
+ return extraTri;
278
+ }
279
+ const result = this.bvh_.findContainingTriangle(point2D);
280
+ if (result && !result.transform) {
281
+ result.transform = this.calculateAffineTransform(result.triangle);
282
+ }
283
+ return result
284
+ ? { tri: result.triangle, transform: result.transform }
285
+ : null;
286
+ }
287
+ /**
288
+ * Calculate affine transformation matrix for a triangle
289
+ * Maps from target triangle to source triangle
290
+ */
291
+ calculateAffineTransform(triangle) {
292
+ const [[x0t, y0t], [x1t, y1t], [x2t, y2t]] = triangle.target;
293
+ const [[x0s, y0s], [x1s, y1s], [x2s, y2s]] = triangle.source;
294
+ // Solve for affine transformation: [xs, ys] = [a*xt + b*yt + c, d*xt + e*yt + f]
295
+ // Using the three triangle vertices
296
+ const det = (x1t - x0t) * (y2t - y0t) - (x2t - x0t) * (y1t - y0t);
297
+ if (Math.abs(det) < 1e-10) {
298
+ // Degenerate triangle - return identity-like transform
299
+ return { a: 1, b: 0, c: x0s, d: 0, e: 1, f: y0s };
300
+ }
301
+ const a = ((x1s - x0s) * (y2t - y0t) - (x2s - x0s) * (y1t - y0t)) / det;
302
+ const b = ((x2s - x0s) * (x1t - x0t) - (x1s - x0s) * (x2t - x0t)) / det;
303
+ const c = x0s - a * x0t - b * y0t;
304
+ const d = ((y1s - y0s) * (y2t - y0t) - (y2s - y0s) * (y1t - y0t)) / det;
305
+ const e = ((y2s - y0s) * (x1t - x0t) - (y1s - y0s) * (x2t - x0t)) / det;
306
+ const f = y0s - d * x0t - e * y0t;
307
+ return { a, b, c, d, e, f };
308
+ }
309
+ // ============================================================================
310
+ // REPROJECTION METHODS
311
+ // ============================================================================
312
+ /**
313
+ * Apply affine transformation to a point
314
+ */
315
+ applyAffineTransform(x, y, transform) {
316
+ return [
317
+ transform.a * x + transform.b * y + transform.c,
318
+ transform.d * x + transform.e * y + transform.f,
319
+ ];
320
+ }
321
+ }
@@ -0,0 +1,190 @@
1
+ /**
2
+ * ColorMap utilities for GeoTIFF visualization
3
+ * Extracted for testability
4
+ */
5
+ import { warn } from "../../../utils/logger";
6
+ /**
7
+ * Predefined color maps
8
+ */
9
+ export const PREDEFINED_COLORMAPS = {
10
+ grayscale: [
11
+ { value: 0.0, color: [0, 0, 0] },
12
+ { value: 1.0, color: [255, 255, 255] },
13
+ ],
14
+ viridis: [
15
+ { value: 0.0, color: [68, 1, 84] },
16
+ { value: 0.25, color: [59, 82, 139] },
17
+ { value: 0.5, color: [33, 145, 140] },
18
+ { value: 0.75, color: [94, 201, 98] },
19
+ { value: 1.0, color: [253, 231, 37] },
20
+ ],
21
+ terrain: [
22
+ { value: 0.0, color: [0, 128, 0] }, // dark green (low)
23
+ { value: 0.25, color: [139, 195, 74] }, // light green
24
+ { value: 0.5, color: [255, 235, 59] }, // yellow
25
+ { value: 0.75, color: [255, 152, 0] }, // orange
26
+ { value: 1.0, color: [255, 255, 255] }, // white (high)
27
+ ],
28
+ turbo: [
29
+ { value: 0.0, color: [48, 18, 59] },
30
+ { value: 0.2, color: [33, 102, 172] },
31
+ { value: 0.4, color: [68, 190, 112] },
32
+ { value: 0.6, color: [253, 231, 37] },
33
+ { value: 0.8, color: [234, 51, 35] },
34
+ { value: 1.0, color: [122, 4, 3] },
35
+ ],
36
+ rainbow: [
37
+ { value: 0.0, color: [148, 0, 211] }, // violet
38
+ { value: 0.2, color: [0, 0, 255] }, // blue
39
+ { value: 0.4, color: [0, 255, 0] }, // green
40
+ { value: 0.6, color: [255, 255, 0] }, // yellow
41
+ { value: 0.8, color: [255, 127, 0] }, // orange
42
+ { value: 1.0, color: [255, 0, 0] }, // red
43
+ ],
44
+ };
45
+ /**
46
+ * Parse a hex color string to RGB array
47
+ * @param hexColor - Hex color string (e.g., "#FF0000" or "#F00")
48
+ * @returns RGB array [r, g, b] with values 0-255
49
+ */
50
+ export function parseHexColor(hexColor) {
51
+ let hex = hexColor.trim();
52
+ if (hex.startsWith('#')) {
53
+ hex = hex.slice(1);
54
+ }
55
+ // Handle shorthand hex (#RGB -> #RRGGBB)
56
+ if (hex.length === 3) {
57
+ hex = hex
58
+ .split('')
59
+ .map(c => c + c)
60
+ .join('');
61
+ }
62
+ if (hex.length !== 6) {
63
+ warn(`Invalid hex color: ${hexColor}, using black`);
64
+ return [0, 0, 0];
65
+ }
66
+ const r = parseInt(hex.slice(0, 2), 16);
67
+ const g = parseInt(hex.slice(2, 4), 16);
68
+ const b = parseInt(hex.slice(4, 6), 16);
69
+ if (isNaN(r) || isNaN(g) || isNaN(b)) {
70
+ warn(`Invalid hex color: ${hexColor}, using black`);
71
+ return [0, 0, 0];
72
+ }
73
+ return [r, g, b];
74
+ }
75
+ /**
76
+ * Convert GeoStyler ColorMap to internal ColorStop array
77
+ * @param geoStylerColorMap - GeoStyler ColorMap object
78
+ * @param valueRange - Optional value range [min, max] for normalization
79
+ * @returns Object with ColorStop array and computed range
80
+ */
81
+ export function convertGeoStylerColorMap(geoStylerColorMap, valueRange) {
82
+ const entries = geoStylerColorMap.colorMapEntries || [];
83
+ if (entries.length === 0) {
84
+ warn('GeoStyler ColorMap has no entries, using grayscale');
85
+ return { stops: PREDEFINED_COLORMAPS.grayscale };
86
+ }
87
+ // Extract quantity values for normalization
88
+ const quantities = entries
89
+ .map(e => e.quantity)
90
+ .filter((q) => typeof q === 'number');
91
+ let minVal;
92
+ let maxVal;
93
+ if (valueRange) {
94
+ [minVal, maxVal] = valueRange;
95
+ }
96
+ else if (quantities.length > 0) {
97
+ minVal = Math.min(...quantities);
98
+ maxVal = Math.max(...quantities);
99
+ }
100
+ else {
101
+ // No quantities and no valueRange - assume normalized 0-1
102
+ minVal = 0;
103
+ maxVal = 1;
104
+ }
105
+ // Avoid division by zero
106
+ if (maxVal === minVal) {
107
+ maxVal = minVal + 1;
108
+ }
109
+ const stops = entries.map(entry => {
110
+ const quantity = typeof entry.quantity === 'number' ? entry.quantity : 0;
111
+ const normalizedValue = (quantity - minVal) / (maxVal - minVal);
112
+ // Parse color (handle both string and Expression<string>)
113
+ const colorStr = typeof entry.color === 'string' ? entry.color : String(entry.color);
114
+ const color = parseHexColor(colorStr);
115
+ return {
116
+ value: Math.max(0, Math.min(1, normalizedValue)), // Clamp to [0, 1]
117
+ color,
118
+ };
119
+ });
120
+ // Sort by value for binary search
121
+ stops.sort((a, b) => a.value - b.value);
122
+ return {
123
+ stops,
124
+ computedRange: valueRange ? undefined : [minVal, maxVal],
125
+ };
126
+ }
127
+ /**
128
+ * Apply colormap to a normalized value using interpolation
129
+ * @param normalizedValue - Value between 0 and 1
130
+ * @param colorStops - Array of color stops (must be sorted by value)
131
+ * @returns RGB color [r, g, b]
132
+ */
133
+ export function applyColorMap(normalizedValue, colorStops) {
134
+ const v = Math.max(0, Math.min(1, normalizedValue));
135
+ if (colorStops.length === 0) {
136
+ return [0, 0, 0]; // Black fallback
137
+ }
138
+ if (colorStops.length === 1) {
139
+ return colorStops[0].color;
140
+ }
141
+ // Binary search for surrounding color stops
142
+ let left = 0;
143
+ let right = colorStops.length - 1;
144
+ // Handle edge cases
145
+ if (v <= colorStops[left].value) {
146
+ return colorStops[left].color;
147
+ }
148
+ if (v >= colorStops[right].value) {
149
+ return colorStops[right].color;
150
+ }
151
+ // Binary search
152
+ while (right - left > 1) {
153
+ const mid = Math.floor((left + right) / 2);
154
+ if (colorStops[mid].value <= v) {
155
+ left = mid;
156
+ }
157
+ else {
158
+ right = mid;
159
+ }
160
+ }
161
+ // Interpolate between left and right
162
+ const lower = colorStops[left];
163
+ const upper = colorStops[right];
164
+ const ratio = (v - lower.value) / (upper.value - lower.value);
165
+ const r = Math.round(lower.color[0] + ratio * (upper.color[0] - lower.color[0]));
166
+ const g = Math.round(lower.color[1] + ratio * (upper.color[1] - lower.color[1]));
167
+ const b = Math.round(lower.color[2] + ratio * (upper.color[2] - lower.color[2]));
168
+ return [r, g, b];
169
+ }
170
+ /**
171
+ * Get ColorStop array from ColorMapName or GeoStyler ColorMap
172
+ * @param colorMap - Predefined name or GeoStyler ColorMap
173
+ * @param valueRange - Optional value range for GeoStyler ColorMap
174
+ * @returns ColorStop array and computed range (if applicable)
175
+ */
176
+ export function getColorStops(colorMap, valueRange) {
177
+ if (typeof colorMap === 'string') {
178
+ // Predefined colormap name
179
+ const stops = PREDEFINED_COLORMAPS[colorMap];
180
+ if (!stops) {
181
+ warn(`Unknown colormap: ${colorMap}, using grayscale`);
182
+ return { stops: PREDEFINED_COLORMAPS.grayscale };
183
+ }
184
+ return { stops };
185
+ }
186
+ else {
187
+ // GeoStyler ColorMap
188
+ return convertGeoStylerColorMap(colorMap, valueRange);
189
+ }
190
+ }
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Normalization utilities for raster data
3
+ * Handles conversion of different TypedArray types to normalized 0-255 range
4
+ */
5
+ import { warn } from "../../../utils/logger";
6
+ /**
7
+ * Normalize a raw value to 0-255 range based on array type
8
+ * @param rawValue - The raw value from the raster
9
+ * @param arrayType - The TypedArray type name
10
+ * @returns Normalized value 0-255
11
+ */
12
+ export function normalizeValue(rawValue, arrayType) {
13
+ switch (arrayType) {
14
+ case 'Uint8Array':
15
+ return rawValue; // Already 0-255
16
+ case 'Uint16Array':
17
+ // 0-65535 → 0-255
18
+ return Math.round((rawValue / 65535) * 255);
19
+ case 'Int16Array':
20
+ // -32768-32767 → 0-255
21
+ return Math.round(((rawValue + 32768) / 65535) * 255);
22
+ case 'Uint32Array':
23
+ // 0-4294967295 → 0-255
24
+ return Math.round((rawValue / 4294967295) * 255);
25
+ case 'Int32Array':
26
+ // -2147483648-2147483647 → 0-255
27
+ return Math.round(((rawValue + 2147483648) / 4294967295) * 255);
28
+ case 'Float32Array':
29
+ case 'Float64Array':
30
+ // Assume 0.0-1.0 range for Float arrays (common for normalized data)
31
+ // Clamp to [0, 1] first
32
+ const clamped = Math.max(0, Math.min(1, rawValue));
33
+ return Math.round(clamped * 255);
34
+ default:
35
+ warn(`Unknown array type: ${arrayType}, treating as Uint8`);
36
+ return rawValue;
37
+ }
38
+ }
39
+ /**
40
+ * Normalize a raw value to 0-1 range for colormap application
41
+ * @param rawValue - The raw value from the raster
42
+ * @param valueRange - Optional [min, max] range. If not provided, assumes normalized data.
43
+ * @returns Normalized value 0-1
44
+ */
45
+ export function normalizeToColorMapRange(rawValue, valueRange) {
46
+ if (!valueRange) {
47
+ // Assume already normalized or single-value range
48
+ return Math.max(0, Math.min(1, rawValue));
49
+ }
50
+ const [minVal, maxVal] = valueRange;
51
+ // Avoid division by zero
52
+ if (maxVal === minVal) {
53
+ return 0.5; // Middle of range
54
+ }
55
+ const normalized = (rawValue - minVal) / (maxVal - minVal);
56
+ return Math.max(0, Math.min(1, normalized)); // Clamp to [0, 1]
57
+ }
58
+ /**
59
+ * Auto-detect value range from a Float32/Float64 array sample
60
+ * Useful when valueRange is not provided
61
+ * @param data - The raster data array
62
+ * @param sampleSize - Number of samples to analyze (default: 1000)
63
+ * @returns Detected [min, max] range
64
+ */
65
+ export function autoDetectValueRange(data, sampleSize = 1000) {
66
+ if (data.length === 0) {
67
+ return [0, 1];
68
+ }
69
+ const step = Math.max(1, Math.floor(data.length / sampleSize));
70
+ let min = Infinity;
71
+ let max = -Infinity;
72
+ for (let i = 0; i < data.length; i += step) {
73
+ const value = data[i];
74
+ if (Number.isFinite(value)) {
75
+ if (value < min)
76
+ min = value;
77
+ if (value > max)
78
+ max = value;
79
+ }
80
+ }
81
+ // Fallback if all values were invalid
82
+ if (!Number.isFinite(min) || !Number.isFinite(max)) {
83
+ return [0, 1];
84
+ }
85
+ // Handle single-value case
86
+ if (min === max) {
87
+ return [min, min + 1];
88
+ }
89
+ return [min, max];
90
+ }
91
+ /**
92
+ * Check if a TypedArray type represents floating point data
93
+ * @param arrayType - The TypedArray type name
94
+ * @returns True if Float32Array or Float64Array
95
+ */
96
+ export function isFloatType(arrayType) {
97
+ return arrayType === 'Float32Array' || arrayType === 'Float64Array';
98
+ }
99
+ /**
100
+ * Get the typical value range for a TypedArray type
101
+ * @param arrayType - The TypedArray type name
102
+ * @returns [min, max] range for the type
103
+ */
104
+ export function getTypeRange(arrayType) {
105
+ switch (arrayType) {
106
+ case 'Uint8Array':
107
+ return [0, 255];
108
+ case 'Uint16Array':
109
+ return [0, 65535];
110
+ case 'Int16Array':
111
+ return [-32768, 32767];
112
+ case 'Uint32Array':
113
+ return [0, 4294967295];
114
+ case 'Int32Array':
115
+ return [-2147483648, 2147483647];
116
+ case 'Float32Array':
117
+ case 'Float64Array':
118
+ return [0, 1]; // Assume normalized
119
+ default:
120
+ return [0, 255];
121
+ }
122
+ }