@vcmap/core 5.0.2 → 5.1.0-rc.1

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 (309) hide show
  1. package/dist/cesium.d.ts +257 -0
  2. package/dist/geojson.d.ts +27 -0
  3. package/dist/index.d.ts +15 -2
  4. package/dist/index.js +9 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/ol.d.ts +138 -0
  7. package/dist/src/classRegistry.js +2 -2
  8. package/dist/src/classRegistry.js.map +1 -1
  9. package/dist/src/featureProvider/abstractFeatureProvider.d.ts +2 -1
  10. package/dist/src/featureProvider/abstractFeatureProvider.js +2 -1
  11. package/dist/src/featureProvider/abstractFeatureProvider.js.map +1 -1
  12. package/dist/src/featureProvider/tileProviderFeatureProvider.d.ts +1 -1
  13. package/dist/src/featureProvider/tileProviderFeatureProvider.js +2 -2
  14. package/dist/src/featureProvider/tileProviderFeatureProvider.js.map +1 -1
  15. package/dist/src/featureProvider/wmsFeatureProvider.d.ts +1 -1
  16. package/dist/src/featureProvider/wmsFeatureProvider.js +4 -3
  17. package/dist/src/featureProvider/wmsFeatureProvider.js.map +1 -1
  18. package/dist/src/interaction/eventHandler.js +3 -3
  19. package/dist/src/interaction/eventHandler.js.map +1 -1
  20. package/dist/src/interaction/featureProviderInteraction.js +1 -1
  21. package/dist/src/interaction/featureProviderInteraction.js.map +1 -1
  22. package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.d.ts +4 -1
  23. package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.js +31 -2
  24. package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.js.map +1 -1
  25. package/dist/src/layer/cesium/resourceHelper.d.ts +2 -0
  26. package/dist/src/layer/cesium/resourceHelper.js +12 -0
  27. package/dist/src/layer/cesium/resourceHelper.js.map +1 -0
  28. package/dist/src/layer/cesium/singleImageCesiumImpl.js +2 -1
  29. package/dist/src/layer/cesium/singleImageCesiumImpl.js.map +1 -1
  30. package/dist/src/layer/cesium/terrainCesiumImpl.js +1 -1
  31. package/dist/src/layer/cesium/terrainCesiumImpl.js.map +1 -1
  32. package/dist/src/layer/cesium/tmsCesiumImpl.js +2 -1
  33. package/dist/src/layer/cesium/tmsCesiumImpl.js.map +1 -1
  34. package/dist/src/layer/cesium/vectorRasterTileCesiumImpl.js +1 -0
  35. package/dist/src/layer/cesium/vectorRasterTileCesiumImpl.js.map +1 -1
  36. package/dist/src/layer/cesium/vectorTileImageryProvider.d.ts +2 -0
  37. package/dist/src/layer/cesium/vectorTileImageryProvider.js +3 -1
  38. package/dist/src/layer/cesium/vectorTileImageryProvider.js.map +1 -1
  39. package/dist/src/layer/cesium/wmsCesiumImpl.js +2 -1
  40. package/dist/src/layer/cesium/wmsCesiumImpl.js.map +1 -1
  41. package/dist/src/layer/cesium/wmtsCesiumImpl.js +2 -1
  42. package/dist/src/layer/cesium/wmtsCesiumImpl.js.map +1 -1
  43. package/dist/src/layer/cesiumTilesetLayer.d.ts +5 -1
  44. package/dist/src/layer/cesiumTilesetLayer.js +17 -7
  45. package/dist/src/layer/cesiumTilesetLayer.js.map +1 -1
  46. package/dist/src/layer/czmlLayer.js +2 -1
  47. package/dist/src/layer/czmlLayer.js.map +1 -1
  48. package/dist/src/layer/featureLayer.js +2 -2
  49. package/dist/src/layer/featureLayer.js.map +1 -1
  50. package/dist/src/layer/featureStoreLayer.js +8 -5
  51. package/dist/src/layer/featureStoreLayer.js.map +1 -1
  52. package/dist/src/layer/featureStoreLayerChanges.d.ts +20 -8
  53. package/dist/src/layer/featureStoreLayerChanges.js +26 -26
  54. package/dist/src/layer/featureStoreLayerChanges.js.map +1 -1
  55. package/dist/src/layer/featureStoreLayerState.d.ts +1 -5
  56. package/dist/src/layer/featureStoreLayerState.js +0 -9
  57. package/dist/src/layer/featureStoreLayerState.js.map +1 -1
  58. package/dist/src/layer/geojsonLayer.js +3 -2
  59. package/dist/src/layer/geojsonLayer.js.map +1 -1
  60. package/dist/src/layer/layer.d.ts +15 -0
  61. package/dist/src/layer/layer.js +30 -4
  62. package/dist/src/layer/layer.js.map +1 -1
  63. package/dist/src/layer/layerImplementation.d.ts +1 -0
  64. package/dist/src/layer/layerImplementation.js +2 -0
  65. package/dist/src/layer/layerImplementation.js.map +1 -1
  66. package/dist/src/layer/oblique/vectorObliqueImpl.js +9 -6
  67. package/dist/src/layer/oblique/vectorObliqueImpl.js.map +1 -1
  68. package/dist/src/layer/openlayers/loadFunctionHelpers.d.ts +2 -0
  69. package/dist/src/layer/openlayers/loadFunctionHelpers.js +20 -0
  70. package/dist/src/layer/openlayers/loadFunctionHelpers.js.map +1 -0
  71. package/dist/src/layer/openlayers/singleImageOpenlayersImpl.js +25 -1
  72. package/dist/src/layer/openlayers/singleImageOpenlayersImpl.js.map +1 -1
  73. package/dist/src/layer/openlayers/tmsOpenlayersImpl.js +9 -1
  74. package/dist/src/layer/openlayers/tmsOpenlayersImpl.js.map +1 -1
  75. package/dist/src/layer/openlayers/vectorTileOpenlayersImpl.js +1 -1
  76. package/dist/src/layer/openlayers/vectorTileOpenlayersImpl.js.map +1 -1
  77. package/dist/src/layer/openlayers/wmsOpenlayersImpl.d.ts +4 -1
  78. package/dist/src/layer/openlayers/wmsOpenlayersImpl.js +20 -1
  79. package/dist/src/layer/openlayers/wmsOpenlayersImpl.js.map +1 -1
  80. package/dist/src/layer/openlayers/wmtsOpenlayersImpl.js +9 -1
  81. package/dist/src/layer/openlayers/wmtsOpenlayersImpl.js.map +1 -1
  82. package/dist/src/layer/pointCloudLayer.js +2 -2
  83. package/dist/src/layer/pointCloudLayer.js.map +1 -1
  84. package/dist/src/layer/terrainHelpers.d.ts +3 -3
  85. package/dist/src/layer/terrainHelpers.js +12 -7
  86. package/dist/src/layer/terrainHelpers.js.map +1 -1
  87. package/dist/src/layer/terrainLayer.js +1 -1
  88. package/dist/src/layer/terrainLayer.js.map +1 -1
  89. package/dist/src/layer/tileProvider/mvtTileProvider.d.ts +1 -1
  90. package/dist/src/layer/tileProvider/mvtTileProvider.js +4 -3
  91. package/dist/src/layer/tileProvider/mvtTileProvider.js.map +1 -1
  92. package/dist/src/layer/tileProvider/staticGeojsonTileProvider.d.ts +1 -1
  93. package/dist/src/layer/tileProvider/staticGeojsonTileProvider.js +4 -3
  94. package/dist/src/layer/tileProvider/staticGeojsonTileProvider.js.map +1 -1
  95. package/dist/src/layer/tileProvider/tileProvider.d.ts +14 -11
  96. package/dist/src/layer/tileProvider/tileProvider.js +23 -20
  97. package/dist/src/layer/tileProvider/tileProvider.js.map +1 -1
  98. package/dist/src/layer/tileProvider/urlTemplateTileProvider.d.ts +1 -1
  99. package/dist/src/layer/tileProvider/urlTemplateTileProvider.js +4 -3
  100. package/dist/src/layer/tileProvider/urlTemplateTileProvider.js.map +1 -1
  101. package/dist/src/layer/vectorLayer.d.ts +1 -2
  102. package/dist/src/layer/vectorLayer.js +3 -3
  103. package/dist/src/layer/vectorLayer.js.map +1 -1
  104. package/dist/src/layer/vectorProperties.d.ts +11 -16
  105. package/dist/src/layer/vectorProperties.js +16 -13
  106. package/dist/src/layer/vectorProperties.js.map +1 -1
  107. package/dist/src/layer/wfsLayer.js +9 -6
  108. package/dist/src/layer/wfsLayer.js.map +1 -1
  109. package/dist/src/layer/wmsHelpers.d.ts +10 -0
  110. package/dist/src/layer/wmsHelpers.js +53 -12
  111. package/dist/src/layer/wmsHelpers.js.map +1 -1
  112. package/dist/src/layer/wmsLayer.d.ts +6 -0
  113. package/dist/src/layer/wmsLayer.js +5 -2
  114. package/dist/src/layer/wmsLayer.js.map +1 -1
  115. package/dist/src/map/cameraLimiter.d.ts +5 -0
  116. package/dist/src/map/cameraLimiter.js +11 -4
  117. package/dist/src/map/cameraLimiter.js.map +1 -1
  118. package/dist/src/map/cesiumMap.d.ts +20 -1
  119. package/dist/src/map/cesiumMap.js +51 -2
  120. package/dist/src/map/cesiumMap.js.map +1 -1
  121. package/dist/src/map/vcsMap.js +2 -2
  122. package/dist/src/map/vcsMap.js.map +1 -1
  123. package/dist/src/oblique/helpers.d.ts +1 -1
  124. package/dist/src/oblique/helpers.js +5 -9
  125. package/dist/src/oblique/helpers.js.map +1 -1
  126. package/dist/src/oblique/obliqueCollection.d.ts +1 -0
  127. package/dist/src/oblique/obliqueCollection.js +1 -1
  128. package/dist/src/oblique/obliqueCollection.js.map +1 -1
  129. package/dist/src/oblique/obliqueDataSet.d.ts +3 -1
  130. package/dist/src/oblique/obliqueDataSet.js +13 -6
  131. package/dist/src/oblique/obliqueDataSet.js.map +1 -1
  132. package/dist/src/oblique/obliqueImageMeta.d.ts +2 -0
  133. package/dist/src/oblique/obliqueImageMeta.js +2 -0
  134. package/dist/src/oblique/obliqueImageMeta.js.map +1 -1
  135. package/dist/src/oblique/obliqueView.d.ts +1 -0
  136. package/dist/src/oblique/obliqueView.js +12 -2
  137. package/dist/src/oblique/obliqueView.js.map +1 -1
  138. package/dist/src/oblique/parseImageJson.d.ts +6 -5
  139. package/dist/src/oblique/parseImageJson.js +7 -5
  140. package/dist/src/oblique/parseImageJson.js.map +1 -1
  141. package/dist/src/ol/geom/circle.js.map +1 -1
  142. package/dist/src/style/declarativeStyleItem.js +10 -2
  143. package/dist/src/style/declarativeStyleItem.js.map +1 -1
  144. package/dist/src/style/styleFactory.js +2 -2
  145. package/dist/src/style/styleFactory.js.map +1 -1
  146. package/dist/src/style/styleHelpers.js +13 -3
  147. package/dist/src/style/styleHelpers.js.map +1 -1
  148. package/dist/src/style/vectorStyleItem.js +29 -16
  149. package/dist/src/style/vectorStyleItem.js.map +1 -1
  150. package/dist/src/util/clipping/clippingPlaneHelper.js +3 -3
  151. package/dist/src/util/clipping/clippingPlaneHelper.js.map +1 -1
  152. package/dist/src/util/editor/createFeatureSession.d.ts +2 -2
  153. package/dist/src/util/editor/createFeatureSession.js +2 -2
  154. package/dist/src/util/editor/createFeatureSession.js.map +1 -1
  155. package/dist/src/util/editor/editFeaturesSession.d.ts +2 -2
  156. package/dist/src/util/editor/editGeometrySession.d.ts +2 -2
  157. package/dist/src/util/editor/editorSessionHelpers.d.ts +2 -2
  158. package/dist/src/util/editor/selectFeaturesSession.d.ts +2 -2
  159. package/dist/src/util/editor/selectFeaturesSession.js +2 -2
  160. package/dist/src/util/editor/selectFeaturesSession.js.map +1 -1
  161. package/dist/src/util/featureconverter/arcToCesium.d.ts +1 -1
  162. package/dist/src/util/featureconverter/arcToCesium.js +5 -2
  163. package/dist/src/util/featureconverter/arcToCesium.js.map +1 -1
  164. package/dist/src/util/featureconverter/circleToCesium.d.ts +4 -2
  165. package/dist/src/util/featureconverter/circleToCesium.js +8 -3
  166. package/dist/src/util/featureconverter/circleToCesium.js.map +1 -1
  167. package/dist/src/util/featureconverter/extent3D.js.map +1 -1
  168. package/dist/src/util/featureconverter/featureconverterHelper.js +2 -2
  169. package/dist/src/util/featureconverter/featureconverterHelper.js.map +1 -1
  170. package/dist/src/util/featureconverter/lineStringToCesium.d.ts +3 -1
  171. package/dist/src/util/featureconverter/lineStringToCesium.js +7 -2
  172. package/dist/src/util/featureconverter/lineStringToCesium.js.map +1 -1
  173. package/dist/src/util/featureconverter/pointToCesium.js +1 -1
  174. package/dist/src/util/featureconverter/pointToCesium.js.map +1 -1
  175. package/dist/src/util/featureconverter/polygonToCesium.d.ts +3 -3
  176. package/dist/src/util/featureconverter/polygonToCesium.js +9 -15
  177. package/dist/src/util/featureconverter/polygonToCesium.js.map +1 -1
  178. package/dist/src/util/fetch.d.ts +2 -0
  179. package/dist/src/util/fetch.js +16 -0
  180. package/dist/src/util/fetch.js.map +1 -1
  181. package/dist/src/util/flight/flightAnchor.d.ts +23 -0
  182. package/dist/src/util/flight/flightAnchor.js +152 -0
  183. package/dist/src/util/flight/flightAnchor.js.map +1 -0
  184. package/dist/src/util/flight/flightCollection.d.ts +25 -0
  185. package/dist/src/util/flight/flightCollection.js +63 -0
  186. package/dist/src/util/flight/flightCollection.js.map +1 -0
  187. package/dist/src/util/flight/flightHelpers.d.ts +29 -0
  188. package/dist/src/util/flight/flightHelpers.js +134 -0
  189. package/dist/src/util/flight/flightHelpers.js.map +1 -0
  190. package/dist/src/util/flight/flightInstance.d.ts +57 -0
  191. package/dist/src/util/flight/flightInstance.js +166 -0
  192. package/dist/src/util/flight/flightInstance.js.map +1 -0
  193. package/dist/src/util/flight/flightPlayer.d.ts +30 -0
  194. package/dist/src/util/flight/flightPlayer.js +247 -0
  195. package/dist/src/util/flight/flightPlayer.js.map +1 -0
  196. package/dist/src/util/flight/flightVisualizer.d.ts +18 -0
  197. package/dist/src/util/flight/flightVisualizer.js +151 -0
  198. package/dist/src/util/flight/flightVisualizer.js.map +1 -0
  199. package/dist/src/util/hiddenObjects.d.ts +8 -0
  200. package/dist/src/util/hiddenObjects.js +17 -0
  201. package/dist/src/util/hiddenObjects.js.map +1 -0
  202. package/dist/src/util/mapCollection.js +2 -2
  203. package/dist/src/util/mapCollection.js.map +1 -1
  204. package/dist/src/util/overrideCollection.d.ts +8 -3
  205. package/dist/src/util/overrideCollection.js +17 -0
  206. package/dist/src/util/overrideCollection.js.map +1 -1
  207. package/dist/src/util/projection.js +5 -2
  208. package/dist/src/util/projection.js.map +1 -1
  209. package/dist/src/util/viewpoint.d.ts +1 -0
  210. package/dist/src/util/viewpoint.js +24 -7
  211. package/dist/src/util/viewpoint.js.map +1 -1
  212. package/dist/src/vcsApp.d.ts +10 -3
  213. package/dist/src/vcsApp.js +34 -15
  214. package/dist/src/vcsApp.js.map +1 -1
  215. package/dist/src/vcsModule.d.ts +4 -0
  216. package/dist/src/vcsModule.js.map +1 -1
  217. package/dist/tests/unit/helpers/cesiumHelpers.d.ts +2 -2
  218. package/dist/tests/unit/helpers/cesiumHelpers.js +2 -1
  219. package/dist/tests/unit/helpers/cesiumHelpers.js.map +1 -1
  220. package/dist/tests/unit/helpers/terrain/terrainData.d.ts +7 -0
  221. package/dist/tests/unit/helpers/terrain/terrainData.js +2 -2
  222. package/dist/tests/unit/helpers/terrain/terrainData.js.map +1 -1
  223. package/index.ts +39 -1
  224. package/package.json +4 -2
  225. package/src/classRegistry.ts +2 -2
  226. package/src/featureProvider/abstractFeatureProvider.ts +2 -0
  227. package/src/featureProvider/tileProviderFeatureProvider.ts +2 -0
  228. package/src/featureProvider/wmsFeatureProvider.ts +4 -2
  229. package/src/interaction/eventHandler.ts +3 -3
  230. package/src/interaction/featureProviderInteraction.ts +1 -0
  231. package/src/layer/cesium/cesiumTilesetCesiumImpl.ts +44 -5
  232. package/src/layer/cesium/resourceHelper.ts +15 -0
  233. package/src/layer/cesium/singleImageCesiumImpl.ts +2 -1
  234. package/src/layer/cesium/terrainCesiumImpl.ts +2 -1
  235. package/src/layer/cesium/tmsCesiumImpl.ts +2 -1
  236. package/src/layer/cesium/vectorRasterTileCesiumImpl.ts +1 -0
  237. package/src/layer/cesium/vectorTileImageryProvider.ts +10 -1
  238. package/src/layer/cesium/wmsCesiumImpl.ts +2 -1
  239. package/src/layer/cesium/wmtsCesiumImpl.ts +4 -2
  240. package/src/layer/cesiumTilesetLayer.ts +25 -7
  241. package/src/layer/czmlLayer.ts +2 -1
  242. package/src/layer/featureLayer.ts +2 -2
  243. package/src/layer/featureStoreLayer.ts +8 -8
  244. package/src/layer/featureStoreLayerChanges.ts +63 -45
  245. package/src/layer/featureStoreLayerState.ts +6 -5
  246. package/src/layer/geojsonLayer.ts +3 -3
  247. package/src/layer/layer.ts +41 -4
  248. package/src/layer/layerImplementation.ts +3 -0
  249. package/src/layer/oblique/vectorObliqueImpl.ts +9 -8
  250. package/src/layer/openlayers/loadFunctionHelpers.ts +24 -0
  251. package/src/layer/openlayers/singleImageOpenlayersImpl.ts +25 -1
  252. package/src/layer/openlayers/tmsOpenlayersImpl.ts +8 -1
  253. package/src/layer/openlayers/vectorTileOpenlayersImpl.ts +1 -0
  254. package/src/layer/openlayers/wmsOpenlayersImpl.ts +23 -2
  255. package/src/layer/openlayers/wmtsOpenlayersImpl.ts +8 -1
  256. package/src/layer/pointCloudLayer.ts +2 -2
  257. package/src/layer/terrainHelpers.ts +19 -6
  258. package/src/layer/terrainLayer.ts +8 -4
  259. package/src/layer/tileProvider/mvtTileProvider.ts +9 -3
  260. package/src/layer/tileProvider/staticGeojsonTileProvider.ts +9 -3
  261. package/src/layer/tileProvider/tileProvider.ts +49 -13
  262. package/src/layer/tileProvider/urlTemplateTileProvider.ts +10 -3
  263. package/src/layer/vectorLayer.ts +9 -9
  264. package/src/layer/vectorProperties.ts +46 -22
  265. package/src/layer/wfsLayer.ts +9 -6
  266. package/src/layer/wmsHelpers.ts +78 -10
  267. package/src/layer/wmsLayer.ts +11 -2
  268. package/src/map/cameraLimiter.ts +21 -2
  269. package/src/map/cesiumMap.ts +67 -2
  270. package/src/map/vcsMap.ts +2 -2
  271. package/src/oblique/helpers.ts +5 -13
  272. package/src/oblique/obliqueCollection.ts +2 -0
  273. package/src/oblique/obliqueDataSet.ts +16 -2
  274. package/src/oblique/obliqueImageMeta.ts +4 -0
  275. package/src/oblique/obliqueView.ts +12 -2
  276. package/src/oblique/parseImageJson.ts +7 -4
  277. package/src/ol/geojson.d.ts +1 -2
  278. package/src/ol/geom/circle.ts +1 -1
  279. package/src/style/declarativeStyleItem.ts +10 -2
  280. package/src/style/styleFactory.ts +2 -2
  281. package/src/style/styleHelpers.ts +13 -4
  282. package/src/style/vectorStyleItem.ts +32 -20
  283. package/src/util/clipping/clippingPlaneHelper.ts +3 -3
  284. package/src/util/editor/createFeatureSession.ts +9 -8
  285. package/src/util/editor/editFeaturesSession.ts +1 -1
  286. package/src/util/editor/editGeometrySession.ts +1 -1
  287. package/src/util/editor/editorSessionHelpers.ts +2 -2
  288. package/src/util/editor/selectFeaturesSession.ts +3 -3
  289. package/src/util/featureconverter/arcToCesium.ts +5 -1
  290. package/src/util/featureconverter/circleToCesium.ts +8 -2
  291. package/src/util/featureconverter/extent3D.ts +1 -1
  292. package/src/util/featureconverter/featureconverterHelper.ts +3 -5
  293. package/src/util/featureconverter/lineStringToCesium.ts +8 -1
  294. package/src/util/featureconverter/pointToCesium.ts +1 -1
  295. package/src/util/featureconverter/polygonToCesium.ts +6 -15
  296. package/src/util/fetch.ts +25 -0
  297. package/src/util/flight/flightAnchor.ts +195 -0
  298. package/src/util/flight/flightCollection.ts +78 -0
  299. package/src/util/flight/flightHelpers.ts +208 -0
  300. package/src/util/flight/flightInstance.ts +240 -0
  301. package/src/util/flight/flightPlayer.ts +326 -0
  302. package/src/util/flight/flightVisualizer.ts +202 -0
  303. package/src/util/hiddenObjects.ts +35 -0
  304. package/src/util/mapCollection.ts +2 -2
  305. package/src/util/overrideCollection.ts +26 -3
  306. package/src/util/projection.ts +5 -2
  307. package/src/util/viewpoint.ts +27 -7
  308. package/src/vcsApp.ts +56 -15
  309. package/src/vcsModule.ts +4 -0
@@ -1,19 +1,23 @@
1
1
  import { unByKey } from 'ol/Observable.js';
2
2
  import Feature from 'ol/Feature.js';
3
3
  import { EventsKey } from 'ol/events.js';
4
- import { GeoJSONFeature } from 'ol/format/GeoJSON.js';
5
4
  import type { VectorSourceEvent } from 'ol/source/Vector.js';
6
-
5
+ import type {
6
+ Feature as GeojsonFeature,
7
+ LineString,
8
+ MultiLineString,
9
+ MultiPoint,
10
+ MultiPolygon,
11
+ Point,
12
+ Polygon,
13
+ } from 'geojson';
7
14
  import { check } from '@vcsuite/check';
8
- import {
9
- FeatureStoreLayerState,
10
- featureStoreStateSymbol,
11
- } from './featureStoreLayerState.js';
15
+ import { featureStoreStateSymbol } from './featureStoreLayerState.js';
12
16
  import { parseGeoJSON, writeGeoJSONFeature } from './geojsonHelpers.js';
13
17
  import VcsObject from '../vcsObject.js';
14
- import { requestJson } from '../util/fetch.js';
15
18
 
16
19
  import type FeatureStoreLayer from './featureStoreLayer.js';
20
+ import VcsEvent from '../vcsEvent.js';
17
21
 
18
22
  export type FeatureStoreTrackResults = {
19
23
  add: Feature[];
@@ -27,13 +31,25 @@ export type FeatureStoreChangesListeners = {
27
31
  removefeature: EventsKey | EventsKey[] | null;
28
32
  };
29
33
 
30
- export type FeatureStoreChangesValues = {
31
- changed: boolean;
34
+ export type FeatureStoreGeojsonGeometry =
35
+ | Point
36
+ | MultiPoint
37
+ | LineString
38
+ | MultiLineString
39
+ | Polygon
40
+ | MultiPolygon;
41
+
42
+ export type FeatureStoreGeojsonFeature<
43
+ G extends FeatureStoreGeojsonGeometry = FeatureStoreGeojsonGeometry,
44
+ P extends Record<string, unknown> = Record<string, unknown>,
45
+ > = Omit<GeojsonFeature<G, P>, 'id'> & {
46
+ _id?: string;
47
+ id?: string;
32
48
  };
33
49
 
34
50
  type CommitAction = {
35
- action: string;
36
- feature: GeoJSONFeature | { _id: string | number | undefined };
51
+ action: 'add' | 'edit' | 'remove';
52
+ feature: FeatureStoreGeojsonFeature | { _id: string };
37
53
  original: Feature;
38
54
  success(opt?: string): void;
39
55
  };
@@ -45,28 +61,32 @@ export function createCommitActions(
45
61
  ): CommitAction[] {
46
62
  const actions: CommitAction[] = [];
47
63
  added.forEach((f) => {
48
- const feature = writeGeoJSONFeature(f, { writeStyle: true });
64
+ const feature = writeGeoJSONFeature(f, {
65
+ writeStyle: true,
66
+ }) as FeatureStoreGeojsonFeature;
49
67
  actions.push({
50
68
  action: 'add',
51
69
  feature,
52
70
  original: f,
53
71
  success(data) {
54
72
  f.setId(data);
55
- f[featureStoreStateSymbol] = FeatureStoreLayerState.DYNAMIC;
73
+ f[featureStoreStateSymbol] = 'dynamic';
56
74
  },
57
75
  });
58
76
  });
59
77
 
60
78
  edited.forEach((f) => {
61
- const feature = writeGeoJSONFeature(f, { writeStyle: true });
62
- feature._id = f.getId();
79
+ const feature = writeGeoJSONFeature(f, {
80
+ writeStyle: true,
81
+ }) as FeatureStoreGeojsonFeature;
82
+ feature._id = f.getId() as string;
63
83
  actions.push({
64
84
  action: 'edit',
65
85
  original: f,
66
86
  feature,
67
87
  success() {
68
- if (f[featureStoreStateSymbol] === FeatureStoreLayerState.STATIC) {
69
- f[featureStoreStateSymbol] = FeatureStoreLayerState.EDITED;
88
+ if (f[featureStoreStateSymbol] === 'static') {
89
+ f[featureStoreStateSymbol] = 'edited';
70
90
  }
71
91
  },
72
92
  });
@@ -76,7 +96,7 @@ export function createCommitActions(
76
96
  actions.push({
77
97
  original: f,
78
98
  action: 'remove',
79
- feature: { _id: f.getId() },
99
+ feature: { _id: f.getId() as string },
80
100
  success() {},
81
101
  });
82
102
  });
@@ -108,9 +128,7 @@ class FeatureStoreLayerChanges extends VcsObject {
108
128
 
109
129
  private _convertedFeatures: Set<Feature> = new Set();
110
130
 
111
- values: FeatureStoreChangesValues = {
112
- changed: false,
113
- };
131
+ changed = new VcsEvent<void>();
114
132
 
115
133
  constructor(layer: FeatureStoreLayer) {
116
134
  super({});
@@ -166,12 +184,24 @@ class FeatureStoreLayerChanges extends VcsObject {
166
184
  };
167
185
  }
168
186
 
187
+ hasChanges(): boolean {
188
+ return (
189
+ this._addedFeatures.size !== 0 ||
190
+ this._editedFeatures.size !== 0 ||
191
+ this._removedFeatures.size !== 0
192
+ );
193
+ }
194
+
169
195
  /**
170
196
  * commits the changes to the provided url. url should contain accessTokens and point to a featureStore layers bulk operation endpoint
171
197
  */
172
198
  async commitChanges(
173
- url: string,
174
- headers: Record<string, string> = {},
199
+ postCallback: (
200
+ body: Pick<CommitAction, 'action' | 'feature'>[],
201
+ ) => Promise<{
202
+ failedActions: { index: number; error: string }[];
203
+ insertedIds: { _id: string }[];
204
+ }>,
175
205
  ): Promise<void> {
176
206
  const actions: (CommitAction | null)[] = createCommitActions(
177
207
  this._addedFeatures,
@@ -179,19 +209,9 @@ class FeatureStoreLayerChanges extends VcsObject {
179
209
  this._removedFeatures,
180
210
  );
181
211
  if (actions.length > 0) {
182
- const data = await requestJson<{
183
- failedActions: { index: number; error: string }[];
184
- insertedIds: { _id: string }[];
185
- }>(url.toString(), {
186
- method: 'POST',
187
- headers: {
188
- ...headers,
189
- 'Content-Type': 'application/json',
190
- },
191
- body: JSON.stringify(
192
- actions.map((a) => ({ action: a!.action, feature: a!.feature })),
193
- ),
194
- });
212
+ const data = await postCallback(
213
+ actions.map((a) => ({ action: a!.action, feature: a!.feature })),
214
+ );
195
215
 
196
216
  const failures = data.failedActions.map(({ index, error }) => {
197
217
  const action = actions[index] as CommitAction;
@@ -259,7 +279,7 @@ class FeatureStoreLayerChanges extends VcsObject {
259
279
  return Promise.resolve();
260
280
  }
261
281
 
262
- if (feature[featureStoreStateSymbol] === FeatureStoreLayerState.STATIC) {
282
+ if (feature[featureStoreStateSymbol] === 'static') {
263
283
  this.layer.resetStaticFeature(featureId);
264
284
  return Promise.resolve();
265
285
  }
@@ -284,7 +304,6 @@ class FeatureStoreLayerChanges extends VcsObject {
284
304
  this._editedFeatures.clear();
285
305
  this._removedFeatures.clear();
286
306
  this._convertedFeatures.clear();
287
- this.values.changed = false;
288
307
  }
289
308
 
290
309
  /**
@@ -316,12 +335,10 @@ class FeatureStoreLayerChanges extends VcsObject {
316
335
  if (feature) {
317
336
  if (!feature[featureStoreStateSymbol]) {
318
337
  this._addedFeatures.add(feature);
319
- this.values.changed = true;
320
- } else if (
321
- feature[featureStoreStateSymbol] === FeatureStoreLayerState.STATIC
322
- ) {
338
+ this.changed.raiseEvent();
339
+ } else if (feature[featureStoreStateSymbol] === 'static') {
323
340
  this._convertedFeatures.add(feature);
324
- this.values.changed = true;
341
+ this.changed.raiseEvent();
325
342
  }
326
343
  }
327
344
  }
@@ -334,7 +351,7 @@ class FeatureStoreLayerChanges extends VcsObject {
334
351
  if (feature[featureStoreStateSymbol]) {
335
352
  this._convertedFeatures.delete(feature);
336
353
  this._editedFeatures.add(feature);
337
- this.values.changed = true;
354
+ this.changed.raiseEvent();
338
355
  }
339
356
  }
340
357
  }
@@ -348,7 +365,7 @@ class FeatureStoreLayerChanges extends VcsObject {
348
365
  this._removedFeatures.add(feature);
349
366
  this._editedFeatures.delete(feature);
350
367
  this._convertedFeatures.delete(feature);
351
- this.values.changed = true;
368
+ this.changed.raiseEvent();
352
369
  } else {
353
370
  this._addedFeatures.delete(feature);
354
371
  }
@@ -385,6 +402,7 @@ class FeatureStoreLayerChanges extends VcsObject {
385
402
  destroy(): void {
386
403
  this.unTrack();
387
404
  this._layer = undefined;
405
+ this.changed.destroy();
388
406
  super.destroy();
389
407
  }
390
408
  }
@@ -3,8 +3,9 @@ export const featureStoreStateSymbol = Symbol('vcsFeatureType');
3
3
  /**
4
4
  * Enumeration of feature store item states
5
5
  */
6
- export enum FeatureStoreLayerState {
7
- DYNAMIC = 'dynamic',
8
- STATIC = 'static',
9
- EDITED = 'edited',
10
- }
6
+ export type FeatureStoreLayerState =
7
+ | 'dynamic'
8
+ | 'static'
9
+ | 'edited'
10
+ | 'deleted'
11
+ | 'removed';
@@ -1,11 +1,10 @@
1
1
  import type { GeoJSONFeature } from 'ol/format/GeoJSON.js';
2
2
  import { FeatureCollection } from 'geojson';
3
-
4
3
  import VectorLayer, { VectorOptions } from './vectorLayer.js';
5
4
  import { parseGeoJSON, writeGeoJSONFeature } from './geojsonHelpers.js';
6
5
  import Projection, { wgs84Projection } from '../util/projection.js';
7
6
  import { layerClassRegistry } from '../classRegistry.js';
8
- import { requestJson } from '../util/fetch.js';
7
+ import { getInitForUrl, requestJson } from '../util/fetch.js';
9
8
 
10
9
  export type GeoJSONOptions = VectorOptions & {
11
10
  features?: GeoJSONFeature[];
@@ -86,7 +85,8 @@ class GeoJSONLayer extends VectorLayer {
86
85
  }
87
86
 
88
87
  if (this.url) {
89
- this._dataFetchedPromise = requestJson(this.url)
88
+ const init = getInitForUrl(this.url, this.headers);
89
+ this._dataFetchedPromise = requestJson(this.url, init)
90
90
  .then((data) => this._parseGeojsonData(data as FeatureCollection))
91
91
  .catch((err) => {
92
92
  this.getLogger().warning(
@@ -1,4 +1,5 @@
1
- import { check, checkMaybe } from '@vcsuite/check';
1
+ import deepEqual from 'fast-deep-equal';
2
+ import { check, maybe, oneOf, optional, recordOf } from '@vcsuite/check';
2
3
  import { parseBoolean, parseInteger } from '@vcsuite/parsers';
3
4
  import VcsObject, { VcsObjectOptions } from '../vcsObject.js';
4
5
  import Extent, { type ExtentOptions } from '../util/extent.js';
@@ -50,11 +51,17 @@ export type LayerOptions = VcsObjectOptions & {
50
51
  * to other sources of data.
51
52
  */
52
53
  datasourceId?: string;
54
+
55
+ /**
56
+ * Optional Request Headers which will be sent with each request.
57
+ */
58
+ headers?: Record<string, string>;
53
59
  };
54
60
 
55
61
  export type LayerImplementationOptions = {
56
62
  name: string;
57
63
  url: string;
64
+ headers?: Record<string, string>;
58
65
  };
59
66
 
60
67
  /**
@@ -82,6 +89,7 @@ class Layer<
82
89
  hiddenObjectIds: [],
83
90
  copyright: undefined,
84
91
  datasourceId: undefined,
92
+ headers: undefined,
85
93
  };
86
94
  }
87
95
 
@@ -145,6 +153,8 @@ class Layer<
145
153
 
146
154
  private _locale: string;
147
155
 
156
+ protected _headers?: Record<string, string>;
157
+
148
158
  /**
149
159
  * Optional Id to synchronize with the vcPublisher Datasources. This can also be used to track a connection
150
160
  * to other sources of data.
@@ -208,6 +218,8 @@ class Layer<
208
218
  this._locale = 'en';
209
219
 
210
220
  this.datasourceId = options.datasourceId || defaultOptions.datasourceId;
221
+
222
+ this._headers = structuredClone(options.headers);
211
223
  }
212
224
 
213
225
  /**
@@ -254,7 +266,7 @@ class Layer<
254
266
  }
255
267
 
256
268
  set url(url: string | Record<string, string>) {
257
- check(url, [String, Object]);
269
+ check(url, oneOf(String, recordOf(String)));
258
270
 
259
271
  if (this._url !== url) {
260
272
  const currentValue = this._url;
@@ -285,7 +297,7 @@ class Layer<
285
297
  }
286
298
 
287
299
  setGlobalHider(globalHider?: GlobalHider): void {
288
- checkMaybe(globalHider, GlobalHider);
300
+ check(globalHider, maybe(GlobalHider));
289
301
 
290
302
  if (globalHider && this.active) {
291
303
  globalHider.hideObjects(this.hiddenObjectIds);
@@ -308,7 +320,7 @@ class Layer<
308
320
  }
309
321
 
310
322
  set exclusiveGroups(groups: (string | symbol)[]) {
311
- check(groups, [[String, Symbol]]);
323
+ check(groups, [oneOf(String, Symbol)]);
312
324
 
313
325
  if (
314
326
  groups.length !== this._exclusiveGroups.length ||
@@ -332,6 +344,26 @@ class Layer<
332
344
  }
333
345
  }
334
346
 
347
+ /**
348
+ * directly manipulating the headers Object will not trigger a reload. Reload the data via layer.reload() manually.
349
+ */
350
+ get headers(): Record<string, string> | undefined {
351
+ return this._headers;
352
+ }
353
+
354
+ /**
355
+ *
356
+ * @param headers
357
+ */
358
+ set headers(headers: Record<string, string> | undefined) {
359
+ check(headers, optional(recordOf(String)));
360
+ if (!deepEqual(this._headers, headers)) {
361
+ this._headers = structuredClone(headers);
362
+ // eslint-disable-next-line no-void
363
+ void this.reload();
364
+ }
365
+ }
366
+
335
367
  /**
336
368
  * returns the currently set locale. Can be used to provide locale specific URLs.
337
369
  */
@@ -397,6 +429,7 @@ class Layer<
397
429
  return {
398
430
  name: this.name,
399
431
  url: this.url,
432
+ headers: this.headers,
400
433
  };
401
434
  }
402
435
 
@@ -652,6 +685,10 @@ class Layer<
652
685
  config.datasourceId = this.datasourceId;
653
686
  }
654
687
 
688
+ if (!deepEqual(this._headers, defaultOptions.headers)) {
689
+ config.headers = structuredClone(this._headers);
690
+ }
691
+
655
692
  return config;
656
693
  }
657
694
 
@@ -19,10 +19,13 @@ class LayerImplementation<M extends VcsMap> extends VcsObject {
19
19
 
20
20
  private _initialized = false;
21
21
 
22
+ headers?: Record<string, string>;
23
+
22
24
  constructor(map: M, options: LayerImplementationOptions) {
23
25
  super(options);
24
26
  this._map = map;
25
27
  this.url = options.url;
28
+ this.headers = options.headers;
26
29
  }
27
30
 
28
31
  get map(): M {
@@ -182,7 +182,7 @@ class VectorObliqueImpl
182
182
  }
183
183
  }
184
184
 
185
- private addFeature(originalFeature: Feature): Promise<void> {
185
+ private async addFeature(originalFeature: Feature): Promise<void> {
186
186
  if (!this.active) {
187
187
  this.fetchedFeaturesForImageName = null;
188
188
  }
@@ -196,7 +196,7 @@ class VectorObliqueImpl
196
196
  return Promise.resolve();
197
197
  }
198
198
 
199
- if (this.obliqueSource.getFeatureById(id)) {
199
+ if (this.obliqueSource.getFeatureById(id) || this._updatingOblique[id]) {
200
200
  return Promise.resolve();
201
201
  }
202
202
  const obliqueFeature = new Feature({});
@@ -207,11 +207,8 @@ class VectorObliqueImpl
207
207
 
208
208
  this._setFeatureListeners(originalFeature, obliqueFeature);
209
209
 
210
- return this._convertToOblique(originalFeature, obliqueFeature).then(
211
- () => {
212
- this.obliqueSource.addFeature(obliqueFeature);
213
- },
214
- );
210
+ await this._convertToOblique(originalFeature, obliqueFeature);
211
+ this.obliqueSource.addFeature(obliqueFeature);
215
212
  }
216
213
  return Promise.resolve();
217
214
  }
@@ -308,8 +305,9 @@ class VectorObliqueImpl
308
305
  const vectorGeometry = originalFeature.getGeometry() as Geometry;
309
306
  const imageGeometry = obliqueFeature.getGeometry() as Geometry;
310
307
  this._updatingOblique[id] = true;
308
+ let promise: Promise<unknown>;
311
309
  if (!vectorGeometry[alreadyTransformedToImage]) {
312
- await mercatorGeometryToImageGeometry(
310
+ promise = mercatorGeometryToImageGeometry(
313
311
  vectorGeometry,
314
312
  imageGeometry,
315
313
  this.map.currentImage as ObliqueImage,
@@ -318,7 +316,10 @@ class VectorObliqueImpl
318
316
  obliqueFeature
319
317
  .getGeometry()!
320
318
  .setCoordinates(vectorGeometry.getCoordinates());
319
+ // we MUST wait for a promise, otherwise this is sync and you can add a feature twice
320
+ promise = Promise.resolve();
321
321
  }
322
+ await promise;
322
323
  this._updatingOblique[id] = null;
323
324
  }
324
325
 
@@ -0,0 +1,24 @@
1
+ import type { LoadFunction } from 'ol/Tile.js';
2
+ import type { ImageTile } from 'ol';
3
+ import TileState from 'ol/TileState.js';
4
+ import { getInitForUrl, requestObjectUrl } from '../../util/fetch.js';
5
+
6
+ // eslint-disable-next-line import/prefer-default-export
7
+ export function getTileLoadFunction(
8
+ headers: Record<string, string>,
9
+ ): LoadFunction {
10
+ return function tileLoadFunction(imageTile, src): void {
11
+ const image = (imageTile as ImageTile).getImage() as HTMLImageElement;
12
+ const init = getInitForUrl(src, headers);
13
+ requestObjectUrl(src, init)
14
+ .then((blobUrl) => {
15
+ image.src = blobUrl;
16
+ image.onload = (): void => {
17
+ URL.revokeObjectURL(blobUrl);
18
+ };
19
+ })
20
+ .catch(() => {
21
+ imageTile.setState(TileState.ERROR);
22
+ });
23
+ };
24
+ }
@@ -1,4 +1,5 @@
1
1
  import ImageLayer from 'ol/layer/Image.js';
2
+ import { TrustedServers } from '@vcmap-cesium/engine';
2
3
  import ImageStatic, {
3
4
  type Options as ImageStaticOptions,
4
5
  } from 'ol/source/ImageStatic.js';
@@ -7,6 +8,7 @@ import { wgs84Projection } from '../../util/projection.js';
7
8
  import { isSameOrigin } from '../../util/urlHelpers.js';
8
9
  import type { SingleImageImplementationOptions } from '../singleImageLayer.js';
9
10
  import type OpenlayersMap from '../../map/openlayersMap.js';
11
+ import { getInitForUrl, requestObjectUrl } from '../../util/fetch.js';
10
12
 
11
13
  /**
12
14
  * represents a specific OpenLayers SingleImageLayer Layer class.
@@ -33,10 +35,32 @@ class SingleImageOpenlayersImpl extends RasterLayerOpenlayersImpl {
33
35
  projection: 'EPSG:4326',
34
36
  imageExtent: this.extent.getCoordinatesInProjection(wgs84Projection),
35
37
  };
36
- if (!isSameOrigin(this.url as string)) {
38
+ if (TrustedServers.contains(options.url)) {
39
+ options.crossOrigin = 'use-credentials';
40
+ } else if (!isSameOrigin(this.url as string)) {
37
41
  options.crossOrigin = 'anonymous';
38
42
  }
39
43
 
44
+ if (this.headers) {
45
+ options.imageLoadFunction = (imageWrapper, src): void => {
46
+ const init = getInitForUrl(src, this.headers);
47
+ requestObjectUrl(src, init)
48
+ .then((blobUrl) => {
49
+ const image = imageWrapper.getImage() as HTMLImageElement;
50
+ image.src = blobUrl;
51
+ image.onload = (): void => {
52
+ URL.revokeObjectURL(blobUrl);
53
+ };
54
+ })
55
+ .catch(() => {
56
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
57
+ // @ts-ignore
58
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call,no-underscore-dangle
59
+ imageWrapper.handleImageError_();
60
+ });
61
+ };
62
+ }
63
+
40
64
  return new ImageLayer({
41
65
  source: new ImageStatic(options),
42
66
  opacity: this.opacity,
@@ -1,3 +1,4 @@
1
+ import { TrustedServers } from '@vcmap-cesium/engine';
1
2
  import XYZ, { type Options as XYZOptions } from 'ol/source/XYZ.js';
2
3
  import Tile from 'ol/layer/Tile.js';
3
4
  import { type Options as TileOptions } from 'ol/layer/BaseTile.js';
@@ -8,6 +9,7 @@ import { TilingScheme } from '../rasterLayer.js';
8
9
  import { isSameOrigin } from '../../util/urlHelpers.js';
9
10
  import type { TMSImplementationOptions } from '../tmsLayer.js';
10
11
  import type OpenlayersMap from '../../map/openlayersMap.js';
12
+ import { getTileLoadFunction } from './loadFunctionHelpers.js';
11
13
 
12
14
  /**
13
15
  * TmsLayer implementation for {@link OpenlayersMap}.
@@ -43,12 +45,17 @@ class TmsOpenlayersImpl extends RasterLayerOpenlayersImpl {
43
45
  maxZoom: this.maxLevel,
44
46
  wrapX: false,
45
47
  };
46
- if (!isSameOrigin(this.url as string)) {
48
+ if (TrustedServers.contains(this.url as string)) {
49
+ sourceOptions.crossOrigin = 'use-credentials';
50
+ } else if (!isSameOrigin(this.url as string)) {
47
51
  sourceOptions.crossOrigin = 'anonymous';
48
52
  }
49
53
  if (this.tilingSchema === TilingScheme.GEOGRAPHIC) {
50
54
  sourceOptions.projection = 'EPSG:4326';
51
55
  }
56
+ if (this.headers) {
57
+ sourceOptions.tileLoadFunction = getTileLoadFunction(this.headers);
58
+ }
52
59
 
53
60
  const tileOptions: TileOptions<XYZ> = {
54
61
  source: new XYZ(sourceOptions),
@@ -67,6 +67,7 @@ class VectorTileOpenlayersImpl
67
67
  tile.tileCoord[1],
68
68
  tile.tileCoord[2],
69
69
  tile.tileCoord[0],
70
+ this.headers,
70
71
  );
71
72
  if (features.length > 0) {
72
73
  tile.setFeatures(features);
@@ -1,10 +1,13 @@
1
1
  import Tile from 'ol/layer/Tile.js';
2
2
  import type { Size } from 'ol/size.js';
3
3
  import type TileWMS from 'ol/source/TileWMS.js';
4
+ import ImageWMS from 'ol/source/ImageWMS.js';
5
+ import ImageLayer from 'ol/layer/Image.js';
4
6
  import RasterLayerOpenlayersImpl from './rasterLayerOpenlayersImpl.js';
5
- import { getWMSSource } from '../wmsHelpers.js';
7
+ import { getImageWMSSource, getWMSSource } from '../wmsHelpers.js';
6
8
  import type { WMSImplementationOptions } from '../wmsLayer.js';
7
9
  import type OpenlayersMap from '../../map/openlayersMap.js';
10
+ import { mercatorProjection } from '../../util/projection.js';
8
11
 
9
12
  /**
10
13
  * represents a specific Cesium WmsOpenlayersImpl Layer class.
@@ -20,14 +23,31 @@ class WmsOpenlayersImpl extends RasterLayerOpenlayersImpl {
20
23
 
21
24
  tileSize: Size;
22
25
 
26
+ singleImage2d: boolean;
27
+
23
28
  constructor(map: OpenlayersMap, options: WMSImplementationOptions) {
24
29
  super(map, options);
25
30
  this.parameters = options.parameters;
26
31
  this.version = options.version;
27
32
  this.tileSize = options.tileSize;
33
+ this.singleImage2d = options.singleImage2d;
28
34
  }
29
35
 
30
- getOLLayer(): Tile<TileWMS> {
36
+ getOLLayer(): Tile<TileWMS> | ImageLayer<ImageWMS> {
37
+ if (this.singleImage2d) {
38
+ return new ImageLayer({
39
+ extent: this.extent.getCoordinatesInProjection(mercatorProjection),
40
+ visible: false,
41
+ source: getImageWMSSource({
42
+ url: this.url as string,
43
+ parameters: this.parameters,
44
+ tilingSchema: this.tilingSchema,
45
+ version: this.version,
46
+ headers: this.headers,
47
+ }),
48
+ opacity: this.opacity,
49
+ });
50
+ }
31
51
  return new Tile({
32
52
  visible: false,
33
53
  source: getWMSSource({
@@ -39,6 +59,7 @@ class WmsOpenlayersImpl extends RasterLayerOpenlayersImpl {
39
59
  minLevel: this.minLevel,
40
60
  maxLevel: this.maxLevel,
41
61
  tilingSchema: this.tilingSchema,
62
+ headers: this.headers,
42
63
  }),
43
64
  opacity: this.opacity,
44
65
  });
@@ -1,3 +1,4 @@
1
+ import { TrustedServers } from '@vcmap-cesium/engine';
1
2
  import { getTopLeft, getWidth } from 'ol/extent.js';
2
3
  import WMTSTileGrid, {
3
4
  type Options as WMTSTileGridOptions,
@@ -11,6 +12,7 @@ import { TilingScheme } from '../rasterLayer.js';
11
12
  import { isSameOrigin } from '../../util/urlHelpers.js';
12
13
  import type { WMTSImplementationOptions } from '../wmtsLayer.js';
13
14
  import type OpenlayersMap from '../../map/openlayersMap.js';
15
+ import { getTileLoadFunction } from './loadFunctionHelpers.js';
14
16
 
15
17
  /**
16
18
  * WmtsLayer implementation for {@link OpenlayersMap}.
@@ -106,13 +108,18 @@ class WmtsOpenlayersImpl extends RasterLayerOpenlayersImpl {
106
108
  url: this.url,
107
109
  };
108
110
 
109
- if (!isSameOrigin(this.url as string)) {
111
+ if (TrustedServers.contains(this.url as string)) {
112
+ wmtsOptions.crossOrigin = 'use-credentials';
113
+ } else if (!isSameOrigin(this.url as string)) {
110
114
  wmtsOptions.crossOrigin = 'anonymous';
111
115
  }
112
116
 
113
117
  if (this.tilingSchema === TilingScheme.GEOGRAPHIC) {
114
118
  wmtsOptions.projection = 'EPSG:4326';
115
119
  }
120
+ if (this.headers) {
121
+ wmtsOptions.tileLoadFunction = getTileLoadFunction(this.headers);
122
+ }
116
123
 
117
124
  Object.assign(wmtsOptions, this.openlayersOptions);
118
125
  return new Tile({
@@ -1,4 +1,4 @@
1
- import { checkMaybe } from '@vcsuite/check';
1
+ import { check, maybe, oneOf } from '@vcsuite/check';
2
2
  // eslint-disable-next-line import/no-named-default
3
3
  import type { default as OLStyle, StyleFunction } from 'ol/style/Style.js';
4
4
  import CesiumTilesetLayer, {
@@ -80,7 +80,7 @@ class PointCloudLayer extends CesiumTilesetLayer {
80
80
  }
81
81
 
82
82
  set pointSize(size: string | number | undefined) {
83
- checkMaybe(size, [Number, String]);
83
+ check(size, maybe(oneOf(Number, String)));
84
84
  this._pointSize = size;
85
85
  (this.style as DeclarativeStyleItem).pointSize = size?.toString();
86
86
  }