@vcmap/core 5.0.3 → 5.1.0-rc.2

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 (307) hide show
  1. package/dist/geojson.d.ts +27 -0
  2. package/dist/index.d.ts +14 -4
  3. package/dist/index.js +9 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/src/classRegistry.js +2 -2
  6. package/dist/src/classRegistry.js.map +1 -1
  7. package/dist/src/featureProvider/abstractFeatureProvider.d.ts +2 -1
  8. package/dist/src/featureProvider/abstractFeatureProvider.js +2 -1
  9. package/dist/src/featureProvider/abstractFeatureProvider.js.map +1 -1
  10. package/dist/src/featureProvider/tileProviderFeatureProvider.d.ts +1 -1
  11. package/dist/src/featureProvider/tileProviderFeatureProvider.js +2 -2
  12. package/dist/src/featureProvider/tileProviderFeatureProvider.js.map +1 -1
  13. package/dist/src/featureProvider/wmsFeatureProvider.d.ts +1 -1
  14. package/dist/src/featureProvider/wmsFeatureProvider.js +4 -3
  15. package/dist/src/featureProvider/wmsFeatureProvider.js.map +1 -1
  16. package/dist/src/interaction/eventHandler.js +3 -3
  17. package/dist/src/interaction/eventHandler.js.map +1 -1
  18. package/dist/src/interaction/featureProviderInteraction.js +1 -1
  19. package/dist/src/interaction/featureProviderInteraction.js.map +1 -1
  20. package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.d.ts +4 -1
  21. package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.js +31 -2
  22. package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.js.map +1 -1
  23. package/dist/src/layer/cesium/resourceHelper.d.ts +2 -0
  24. package/dist/src/layer/cesium/resourceHelper.js +12 -0
  25. package/dist/src/layer/cesium/resourceHelper.js.map +1 -0
  26. package/dist/src/layer/cesium/singleImageCesiumImpl.js +2 -1
  27. package/dist/src/layer/cesium/singleImageCesiumImpl.js.map +1 -1
  28. package/dist/src/layer/cesium/terrainCesiumImpl.js +1 -1
  29. package/dist/src/layer/cesium/terrainCesiumImpl.js.map +1 -1
  30. package/dist/src/layer/cesium/tmsCesiumImpl.js +2 -1
  31. package/dist/src/layer/cesium/tmsCesiumImpl.js.map +1 -1
  32. package/dist/src/layer/cesium/vectorRasterTileCesiumImpl.js +1 -0
  33. package/dist/src/layer/cesium/vectorRasterTileCesiumImpl.js.map +1 -1
  34. package/dist/src/layer/cesium/vectorTileImageryProvider.d.ts +2 -0
  35. package/dist/src/layer/cesium/vectorTileImageryProvider.js +3 -1
  36. package/dist/src/layer/cesium/vectorTileImageryProvider.js.map +1 -1
  37. package/dist/src/layer/cesium/wmsCesiumImpl.js +2 -1
  38. package/dist/src/layer/cesium/wmsCesiumImpl.js.map +1 -1
  39. package/dist/src/layer/cesium/wmtsCesiumImpl.js +2 -1
  40. package/dist/src/layer/cesium/wmtsCesiumImpl.js.map +1 -1
  41. package/dist/src/layer/cesiumTilesetLayer.d.ts +5 -1
  42. package/dist/src/layer/cesiumTilesetLayer.js +17 -7
  43. package/dist/src/layer/cesiumTilesetLayer.js.map +1 -1
  44. package/dist/src/layer/czmlLayer.js +2 -1
  45. package/dist/src/layer/czmlLayer.js.map +1 -1
  46. package/dist/src/layer/featureLayer.js +2 -2
  47. package/dist/src/layer/featureLayer.js.map +1 -1
  48. package/dist/src/layer/featureStoreLayer.js +8 -5
  49. package/dist/src/layer/featureStoreLayer.js.map +1 -1
  50. package/dist/src/layer/featureStoreLayerChanges.d.ts +20 -8
  51. package/dist/src/layer/featureStoreLayerChanges.js +26 -26
  52. package/dist/src/layer/featureStoreLayerChanges.js.map +1 -1
  53. package/dist/src/layer/featureStoreLayerState.d.ts +1 -5
  54. package/dist/src/layer/featureStoreLayerState.js +0 -9
  55. package/dist/src/layer/featureStoreLayerState.js.map +1 -1
  56. package/dist/src/layer/geojsonLayer.js +3 -2
  57. package/dist/src/layer/geojsonLayer.js.map +1 -1
  58. package/dist/src/layer/layer.d.ts +15 -0
  59. package/dist/src/layer/layer.js +30 -4
  60. package/dist/src/layer/layer.js.map +1 -1
  61. package/dist/src/layer/layerImplementation.d.ts +1 -0
  62. package/dist/src/layer/layerImplementation.js +2 -0
  63. package/dist/src/layer/layerImplementation.js.map +1 -1
  64. package/dist/src/layer/oblique/vectorObliqueImpl.js +17 -7
  65. package/dist/src/layer/oblique/vectorObliqueImpl.js.map +1 -1
  66. package/dist/src/layer/openlayers/loadFunctionHelpers.d.ts +2 -0
  67. package/dist/src/layer/openlayers/loadFunctionHelpers.js +20 -0
  68. package/dist/src/layer/openlayers/loadFunctionHelpers.js.map +1 -0
  69. package/dist/src/layer/openlayers/singleImageOpenlayersImpl.js +25 -1
  70. package/dist/src/layer/openlayers/singleImageOpenlayersImpl.js.map +1 -1
  71. package/dist/src/layer/openlayers/tmsOpenlayersImpl.js +9 -1
  72. package/dist/src/layer/openlayers/tmsOpenlayersImpl.js.map +1 -1
  73. package/dist/src/layer/openlayers/vectorTileOpenlayersImpl.js +1 -1
  74. package/dist/src/layer/openlayers/vectorTileOpenlayersImpl.js.map +1 -1
  75. package/dist/src/layer/openlayers/wmsOpenlayersImpl.d.ts +4 -1
  76. package/dist/src/layer/openlayers/wmsOpenlayersImpl.js +20 -1
  77. package/dist/src/layer/openlayers/wmsOpenlayersImpl.js.map +1 -1
  78. package/dist/src/layer/openlayers/wmtsOpenlayersImpl.js +9 -1
  79. package/dist/src/layer/openlayers/wmtsOpenlayersImpl.js.map +1 -1
  80. package/dist/src/layer/pointCloudLayer.js +2 -2
  81. package/dist/src/layer/pointCloudLayer.js.map +1 -1
  82. package/dist/src/layer/terrainHelpers.d.ts +3 -3
  83. package/dist/src/layer/terrainHelpers.js +12 -7
  84. package/dist/src/layer/terrainHelpers.js.map +1 -1
  85. package/dist/src/layer/terrainLayer.js +1 -1
  86. package/dist/src/layer/terrainLayer.js.map +1 -1
  87. package/dist/src/layer/tileProvider/mvtTileProvider.d.ts +1 -1
  88. package/dist/src/layer/tileProvider/mvtTileProvider.js +4 -3
  89. package/dist/src/layer/tileProvider/mvtTileProvider.js.map +1 -1
  90. package/dist/src/layer/tileProvider/staticGeojsonTileProvider.d.ts +1 -1
  91. package/dist/src/layer/tileProvider/staticGeojsonTileProvider.js +4 -3
  92. package/dist/src/layer/tileProvider/staticGeojsonTileProvider.js.map +1 -1
  93. package/dist/src/layer/tileProvider/tileProvider.d.ts +14 -11
  94. package/dist/src/layer/tileProvider/tileProvider.js +23 -20
  95. package/dist/src/layer/tileProvider/tileProvider.js.map +1 -1
  96. package/dist/src/layer/tileProvider/urlTemplateTileProvider.d.ts +1 -1
  97. package/dist/src/layer/tileProvider/urlTemplateTileProvider.js +4 -3
  98. package/dist/src/layer/tileProvider/urlTemplateTileProvider.js.map +1 -1
  99. package/dist/src/layer/vectorLayer.d.ts +1 -2
  100. package/dist/src/layer/vectorLayer.js +3 -3
  101. package/dist/src/layer/vectorLayer.js.map +1 -1
  102. package/dist/src/layer/vectorProperties.d.ts +11 -16
  103. package/dist/src/layer/vectorProperties.js +16 -13
  104. package/dist/src/layer/vectorProperties.js.map +1 -1
  105. package/dist/src/layer/wfsLayer.js +9 -6
  106. package/dist/src/layer/wfsLayer.js.map +1 -1
  107. package/dist/src/layer/wmsHelpers.d.ts +10 -0
  108. package/dist/src/layer/wmsHelpers.js +53 -12
  109. package/dist/src/layer/wmsHelpers.js.map +1 -1
  110. package/dist/src/layer/wmsLayer.d.ts +6 -0
  111. package/dist/src/layer/wmsLayer.js +5 -2
  112. package/dist/src/layer/wmsLayer.js.map +1 -1
  113. package/dist/src/map/cameraLimiter.d.ts +5 -0
  114. package/dist/src/map/cameraLimiter.js +11 -4
  115. package/dist/src/map/cameraLimiter.js.map +1 -1
  116. package/dist/src/map/cesiumMap.d.ts +20 -1
  117. package/dist/src/map/cesiumMap.js +51 -2
  118. package/dist/src/map/cesiumMap.js.map +1 -1
  119. package/dist/src/map/vcsMap.js +2 -2
  120. package/dist/src/map/vcsMap.js.map +1 -1
  121. package/dist/src/oblique/helpers.d.ts +1 -1
  122. package/dist/src/oblique/helpers.js +5 -9
  123. package/dist/src/oblique/helpers.js.map +1 -1
  124. package/dist/src/oblique/obliqueCollection.d.ts +1 -0
  125. package/dist/src/oblique/obliqueCollection.js +1 -1
  126. package/dist/src/oblique/obliqueCollection.js.map +1 -1
  127. package/dist/src/oblique/obliqueDataSet.d.ts +3 -1
  128. package/dist/src/oblique/obliqueDataSet.js +13 -6
  129. package/dist/src/oblique/obliqueDataSet.js.map +1 -1
  130. package/dist/src/oblique/obliqueImageMeta.d.ts +2 -0
  131. package/dist/src/oblique/obliqueImageMeta.js +2 -0
  132. package/dist/src/oblique/obliqueImageMeta.js.map +1 -1
  133. package/dist/src/oblique/obliqueView.d.ts +1 -0
  134. package/dist/src/oblique/obliqueView.js +12 -2
  135. package/dist/src/oblique/obliqueView.js.map +1 -1
  136. package/dist/src/oblique/parseImageJson.d.ts +6 -5
  137. package/dist/src/oblique/parseImageJson.js +7 -5
  138. package/dist/src/oblique/parseImageJson.js.map +1 -1
  139. package/dist/src/ol/geom/circle.js.map +1 -1
  140. package/dist/src/style/declarativeStyleItem.js +10 -2
  141. package/dist/src/style/declarativeStyleItem.js.map +1 -1
  142. package/dist/src/style/styleFactory.js +2 -2
  143. package/dist/src/style/styleFactory.js.map +1 -1
  144. package/dist/src/style/styleHelpers.js +13 -3
  145. package/dist/src/style/styleHelpers.js.map +1 -1
  146. package/dist/src/style/vectorStyleItem.js +29 -16
  147. package/dist/src/style/vectorStyleItem.js.map +1 -1
  148. package/dist/src/util/clipping/clippingPlaneHelper.js +3 -3
  149. package/dist/src/util/clipping/clippingPlaneHelper.js.map +1 -1
  150. package/dist/src/util/editor/createFeatureSession.d.ts +2 -2
  151. package/dist/src/util/editor/createFeatureSession.js +2 -2
  152. package/dist/src/util/editor/createFeatureSession.js.map +1 -1
  153. package/dist/src/util/editor/editFeaturesSession.d.ts +2 -2
  154. package/dist/src/util/editor/editGeometrySession.d.ts +2 -2
  155. package/dist/src/util/editor/editorSessionHelpers.d.ts +2 -2
  156. package/dist/src/util/editor/selectFeaturesSession.d.ts +2 -2
  157. package/dist/src/util/editor/selectFeaturesSession.js +2 -2
  158. package/dist/src/util/editor/selectFeaturesSession.js.map +1 -1
  159. package/dist/src/util/featureconverter/arcToCesium.d.ts +1 -1
  160. package/dist/src/util/featureconverter/arcToCesium.js +5 -2
  161. package/dist/src/util/featureconverter/arcToCesium.js.map +1 -1
  162. package/dist/src/util/featureconverter/circleToCesium.d.ts +4 -2
  163. package/dist/src/util/featureconverter/circleToCesium.js +8 -3
  164. package/dist/src/util/featureconverter/circleToCesium.js.map +1 -1
  165. package/dist/src/util/featureconverter/extent3D.js.map +1 -1
  166. package/dist/src/util/featureconverter/featureconverterHelper.js +2 -2
  167. package/dist/src/util/featureconverter/featureconverterHelper.js.map +1 -1
  168. package/dist/src/util/featureconverter/lineStringToCesium.d.ts +3 -1
  169. package/dist/src/util/featureconverter/lineStringToCesium.js +7 -2
  170. package/dist/src/util/featureconverter/lineStringToCesium.js.map +1 -1
  171. package/dist/src/util/featureconverter/pointToCesium.js +1 -1
  172. package/dist/src/util/featureconverter/pointToCesium.js.map +1 -1
  173. package/dist/src/util/featureconverter/polygonToCesium.d.ts +3 -3
  174. package/dist/src/util/featureconverter/polygonToCesium.js +9 -15
  175. package/dist/src/util/featureconverter/polygonToCesium.js.map +1 -1
  176. package/dist/src/util/fetch.d.ts +2 -0
  177. package/dist/src/util/fetch.js +16 -0
  178. package/dist/src/util/fetch.js.map +1 -1
  179. package/dist/src/util/flight/flightAnchor.d.ts +23 -0
  180. package/dist/src/util/flight/flightAnchor.js +152 -0
  181. package/dist/src/util/flight/flightAnchor.js.map +1 -0
  182. package/dist/src/util/flight/flightCollection.d.ts +25 -0
  183. package/dist/src/util/flight/flightCollection.js +63 -0
  184. package/dist/src/util/flight/flightCollection.js.map +1 -0
  185. package/dist/src/util/flight/flightHelpers.d.ts +29 -0
  186. package/dist/src/util/flight/flightHelpers.js +134 -0
  187. package/dist/src/util/flight/flightHelpers.js.map +1 -0
  188. package/dist/src/util/flight/flightInstance.d.ts +57 -0
  189. package/dist/src/util/flight/flightInstance.js +166 -0
  190. package/dist/src/util/flight/flightInstance.js.map +1 -0
  191. package/dist/src/util/flight/flightPlayer.d.ts +30 -0
  192. package/dist/src/util/flight/flightPlayer.js +247 -0
  193. package/dist/src/util/flight/flightPlayer.js.map +1 -0
  194. package/dist/src/util/flight/flightVisualizer.d.ts +18 -0
  195. package/dist/src/util/flight/flightVisualizer.js +151 -0
  196. package/dist/src/util/flight/flightVisualizer.js.map +1 -0
  197. package/dist/src/util/hiddenObjects.d.ts +8 -0
  198. package/dist/src/util/hiddenObjects.js +17 -0
  199. package/dist/src/util/hiddenObjects.js.map +1 -0
  200. package/dist/src/util/mapCollection.js +2 -2
  201. package/dist/src/util/mapCollection.js.map +1 -1
  202. package/dist/src/util/overrideCollection.d.ts +8 -3
  203. package/dist/src/util/overrideCollection.js +17 -0
  204. package/dist/src/util/overrideCollection.js.map +1 -1
  205. package/dist/src/util/projection.js +5 -2
  206. package/dist/src/util/projection.js.map +1 -1
  207. package/dist/src/util/viewpoint.d.ts +1 -0
  208. package/dist/src/util/viewpoint.js +24 -7
  209. package/dist/src/util/viewpoint.js.map +1 -1
  210. package/dist/src/vcsApp.d.ts +10 -3
  211. package/dist/src/vcsApp.js +34 -15
  212. package/dist/src/vcsApp.js.map +1 -1
  213. package/dist/src/vcsModule.d.ts +4 -0
  214. package/dist/src/vcsModule.js.map +1 -1
  215. package/dist/tests/unit/helpers/cesiumHelpers.d.ts +2 -2
  216. package/dist/tests/unit/helpers/cesiumHelpers.js +2 -1
  217. package/dist/tests/unit/helpers/cesiumHelpers.js.map +1 -1
  218. package/dist/tests/unit/helpers/terrain/terrainData.d.ts +7 -0
  219. package/dist/tests/unit/helpers/terrain/terrainData.js +2 -2
  220. package/dist/tests/unit/helpers/terrain/terrainData.js.map +1 -1
  221. package/index.ts +39 -1
  222. package/package.json +3 -2
  223. package/src/classRegistry.ts +2 -2
  224. package/src/featureProvider/abstractFeatureProvider.ts +2 -0
  225. package/src/featureProvider/tileProviderFeatureProvider.ts +2 -0
  226. package/src/featureProvider/wmsFeatureProvider.ts +4 -2
  227. package/src/interaction/eventHandler.ts +3 -3
  228. package/src/interaction/featureProviderInteraction.ts +1 -0
  229. package/src/layer/cesium/cesiumTilesetCesiumImpl.ts +44 -5
  230. package/src/layer/cesium/resourceHelper.ts +15 -0
  231. package/src/layer/cesium/singleImageCesiumImpl.ts +2 -1
  232. package/src/layer/cesium/terrainCesiumImpl.ts +2 -1
  233. package/src/layer/cesium/tmsCesiumImpl.ts +2 -1
  234. package/src/layer/cesium/vectorRasterTileCesiumImpl.ts +1 -0
  235. package/src/layer/cesium/vectorTileImageryProvider.ts +10 -1
  236. package/src/layer/cesium/wmsCesiumImpl.ts +2 -1
  237. package/src/layer/cesium/wmtsCesiumImpl.ts +4 -2
  238. package/src/layer/cesiumTilesetLayer.ts +25 -7
  239. package/src/layer/czmlLayer.ts +2 -1
  240. package/src/layer/featureLayer.ts +2 -2
  241. package/src/layer/featureStoreLayer.ts +8 -8
  242. package/src/layer/featureStoreLayerChanges.ts +63 -45
  243. package/src/layer/featureStoreLayerState.ts +6 -5
  244. package/src/layer/geojsonLayer.ts +3 -3
  245. package/src/layer/layer.ts +41 -4
  246. package/src/layer/layerImplementation.ts +3 -0
  247. package/src/layer/oblique/vectorObliqueImpl.ts +18 -12
  248. package/src/layer/openlayers/loadFunctionHelpers.ts +24 -0
  249. package/src/layer/openlayers/singleImageOpenlayersImpl.ts +25 -1
  250. package/src/layer/openlayers/tmsOpenlayersImpl.ts +8 -1
  251. package/src/layer/openlayers/vectorTileOpenlayersImpl.ts +1 -0
  252. package/src/layer/openlayers/wmsOpenlayersImpl.ts +23 -2
  253. package/src/layer/openlayers/wmtsOpenlayersImpl.ts +8 -1
  254. package/src/layer/pointCloudLayer.ts +2 -2
  255. package/src/layer/terrainHelpers.ts +19 -6
  256. package/src/layer/terrainLayer.ts +8 -4
  257. package/src/layer/tileProvider/mvtTileProvider.ts +9 -3
  258. package/src/layer/tileProvider/staticGeojsonTileProvider.ts +9 -3
  259. package/src/layer/tileProvider/tileProvider.ts +49 -13
  260. package/src/layer/tileProvider/urlTemplateTileProvider.ts +10 -3
  261. package/src/layer/vectorLayer.ts +9 -9
  262. package/src/layer/vectorProperties.ts +46 -22
  263. package/src/layer/wfsLayer.ts +9 -6
  264. package/src/layer/wmsHelpers.ts +78 -10
  265. package/src/layer/wmsLayer.ts +11 -2
  266. package/src/map/cameraLimiter.ts +21 -2
  267. package/src/map/cesiumMap.ts +67 -2
  268. package/src/map/vcsMap.ts +2 -2
  269. package/src/oblique/helpers.ts +5 -13
  270. package/src/oblique/obliqueCollection.ts +2 -0
  271. package/src/oblique/obliqueDataSet.ts +16 -2
  272. package/src/oblique/obliqueImageMeta.ts +4 -0
  273. package/src/oblique/obliqueView.ts +12 -2
  274. package/src/oblique/parseImageJson.ts +7 -4
  275. package/src/ol/geojson.d.ts +1 -2
  276. package/src/ol/geom/circle.ts +1 -1
  277. package/src/style/declarativeStyleItem.ts +10 -2
  278. package/src/style/styleFactory.ts +2 -2
  279. package/src/style/styleHelpers.ts +13 -4
  280. package/src/style/vectorStyleItem.ts +32 -20
  281. package/src/util/clipping/clippingPlaneHelper.ts +3 -3
  282. package/src/util/editor/createFeatureSession.ts +9 -8
  283. package/src/util/editor/editFeaturesSession.ts +1 -1
  284. package/src/util/editor/editGeometrySession.ts +1 -1
  285. package/src/util/editor/editorSessionHelpers.ts +2 -2
  286. package/src/util/editor/selectFeaturesSession.ts +3 -3
  287. package/src/util/featureconverter/arcToCesium.ts +5 -1
  288. package/src/util/featureconverter/circleToCesium.ts +8 -2
  289. package/src/util/featureconverter/extent3D.ts +1 -1
  290. package/src/util/featureconverter/featureconverterHelper.ts +3 -5
  291. package/src/util/featureconverter/lineStringToCesium.ts +8 -1
  292. package/src/util/featureconverter/pointToCesium.ts +1 -1
  293. package/src/util/featureconverter/polygonToCesium.ts +6 -15
  294. package/src/util/fetch.ts +25 -0
  295. package/src/util/flight/flightAnchor.ts +195 -0
  296. package/src/util/flight/flightCollection.ts +78 -0
  297. package/src/util/flight/flightHelpers.ts +208 -0
  298. package/src/util/flight/flightInstance.ts +240 -0
  299. package/src/util/flight/flightPlayer.ts +326 -0
  300. package/src/util/flight/flightVisualizer.ts +202 -0
  301. package/src/util/hiddenObjects.ts +35 -0
  302. package/src/util/mapCollection.ts +2 -2
  303. package/src/util/overrideCollection.ts +26 -3
  304. package/src/util/projection.ts +5 -2
  305. package/src/util/viewpoint.ts +27 -7
  306. package/src/vcsApp.ts +56 -15
  307. package/src/vcsModule.ts +4 -0
@@ -29,11 +29,12 @@ class TerrainCesiumImpl extends LayerImplementation<CesiumMap> {
29
29
  async initialize(): Promise<void> {
30
30
  if (!this.initialized) {
31
31
  this.terrainProvider = await getTerrainProviderForUrl(
32
- this.url as string,
32
+ this.url!,
33
33
  {
34
34
  requestVertexNormals: this.requestVertexNormals,
35
35
  requestWaterMask: this.requestWaterMask,
36
36
  },
37
+ this.headers,
37
38
  );
38
39
  this.terrainProvider[vcsLayerName] = this.name;
39
40
  }
@@ -9,6 +9,7 @@ import { wgs84Projection } from '../../util/projection.js';
9
9
  import { TilingScheme } from '../rasterLayer.js';
10
10
  import type CesiumMap from '../../map/cesiumMap.js';
11
11
  import type { TMSImplementationOptions } from '../tmsLayer.js';
12
+ import { getResourceOrUrl } from './resourceHelper.js';
12
13
 
13
14
  /**
14
15
  * TmsLayer implementation for {@link CesiumMap}.
@@ -48,7 +49,7 @@ class TmsCesiumImpl extends RasterLayerCesiumImpl {
48
49
  options.tilingScheme = new GeographicTilingScheme();
49
50
  }
50
51
  const imageryProvider = await TileMapServiceImageryProvider.fromUrl(
51
- this.url!,
52
+ getResourceOrUrl(this.url!, this.headers),
52
53
  options,
53
54
  );
54
55
  const layerOptions = {
@@ -47,6 +47,7 @@ class VectorRasterTileCesiumImpl extends RasterLayerCesiumImpl {
47
47
  this.imageryProvider = new VectorTileImageryProvider({
48
48
  tileProvider: this.tileProvider,
49
49
  tileSize: this.tileSize,
50
+ headers: this.headers,
50
51
  });
51
52
 
52
53
  const layerOptions: CesiumImageryLayer.ConstructorOptions = {
@@ -96,6 +96,7 @@ export function getCanvasFromFeatures(
96
96
  export type VectorTileImageryProviderOptions = {
97
97
  tileProvider: TileProvider;
98
98
  tileSize: Size;
99
+ headers?: Record<string, string>;
99
100
  };
100
101
 
101
102
  /**
@@ -110,6 +111,8 @@ class VectorTileImageryProvider {
110
111
 
111
112
  private _errorEvent = new CesiumEvent();
112
113
 
114
+ headers?: Record<string, string>;
115
+
113
116
  emptyCanvas: HTMLCanvasElement;
114
117
 
115
118
  minLevel = 0;
@@ -127,6 +130,7 @@ class VectorTileImageryProvider {
127
130
  this.emptyCanvas = document.createElement('canvas');
128
131
  this.emptyCanvas.width = this.tileWidth;
129
132
  this.emptyCanvas.height = this.tileHeight;
133
+ this.headers = options.headers;
130
134
  }
131
135
 
132
136
  // eslint-disable-next-line class-methods-use-this
@@ -204,7 +208,12 @@ class VectorTileImageryProvider {
204
208
  y: number,
205
209
  level: number,
206
210
  ): Promise<HTMLImageElement | HTMLCanvasElement> {
207
- const features = await this.tileProvider.getFeaturesForTile(x, y, level);
211
+ const features = await this.tileProvider.getFeaturesForTile(
212
+ x,
213
+ y,
214
+ level,
215
+ this.headers,
216
+ );
208
217
  if (features.length === 0) {
209
218
  return this.emptyCanvas;
210
219
  }
@@ -10,6 +10,7 @@ import RasterLayerCesiumImpl from './rasterLayerCesiumImpl.js';
10
10
  import { wgs84Projection } from '../../util/projection.js';
11
11
  import type { WMSImplementationOptions } from '../wmsLayer.js';
12
12
  import type CesiumMap from '../../map/cesiumMap.js';
13
+ import { getResourceOrUrl } from './resourceHelper.js';
13
14
 
14
15
  /**
15
16
  * represents a specific Cesium WmsCesiumImpl Layer class.
@@ -39,7 +40,7 @@ class WmsCesiumImpl extends RasterLayerCesiumImpl {
39
40
  parameters.height = String(this.tileSize[1] * 2);
40
41
  }
41
42
  const options: WebMapServiceImageryProvider.ConstructorOptions = {
42
- url: this.url as string,
43
+ url: getResourceOrUrl(this.url!, this.headers),
43
44
  layers: parameters.LAYERS,
44
45
  minimumLevel: this.minLevel,
45
46
  maximumLevel: this.maxLevel,
@@ -9,6 +9,7 @@ import { wgs84Projection } from '../../util/projection.js';
9
9
  import { getTilingScheme } from '../rasterLayer.js';
10
10
  import type { WMTSImplementationOptions } from '../wmtsLayer.js';
11
11
  import type CesiumMap from '../../map/cesiumMap.js';
12
+ import { getResourceOrUrl } from './resourceHelper.js';
12
13
 
13
14
  /**
14
15
  * represents a specific WmtsLayer Implementation for {@link CesiumMap}.
@@ -50,13 +51,14 @@ class WmtsCesiumImpl extends RasterLayerCesiumImpl {
50
51
  getCesiumLayer(): Promise<CesiumImageryLayer> {
51
52
  const currentUrl = this.url as string;
52
53
  // This is a bug in Cesium, they cant cope with {Layer} placeholder..
53
- const url =
54
+ const url: string =
54
55
  currentUrl.indexOf('{Layer}') !== -1
55
56
  ? currentUrl.replace('{Layer}', this.layer)
56
57
  : currentUrl;
58
+
57
59
  const extent = this.extent!.getCoordinatesInProjection(wgs84Projection);
58
60
  const options: WebMapTileServiceImageryProvider.ConstructorOptions = {
59
- url,
61
+ url: getResourceOrUrl(url, this.headers),
60
62
  layer: this.layer,
61
63
  style: this.style,
62
64
  format: this.format,
@@ -1,6 +1,10 @@
1
- import { type Cesium3DTileset, Matrix4 } from '@vcmap-cesium/engine';
1
+ import {
2
+ type Cesium3DTileset,
3
+ type CustomShader,
4
+ Matrix4,
5
+ } from '@vcmap-cesium/engine';
2
6
 
3
- import { checkMaybe } from '@vcsuite/check';
7
+ import { check, maybe } from '@vcsuite/check';
4
8
  import { parseInteger } from '@vcsuite/parsers';
5
9
  import type { Coordinate } from 'ol/coordinate.js';
6
10
  import VectorStyleItem, {
@@ -50,6 +54,7 @@ export type CesiumTilesetImplementationOptions =
50
54
  tilesetProperties?: CesiumTilesetTilesetProperties[];
51
55
  modelMatrix?: Matrix4;
52
56
  offset?: Coordinate;
57
+ customShader?: CustomShader;
53
58
  };
54
59
 
55
60
  /**
@@ -86,13 +91,12 @@ class CesiumTilesetLayer extends FeatureLayer<CesiumTilesetCesiumImpl> {
86
91
 
87
92
  protected _supportedMaps = [CesiumMap.className];
88
93
 
94
+ private _customShader: CustomShader | undefined = undefined;
95
+
89
96
  constructor(options: CesiumTilesetOptions) {
90
97
  super(options);
91
98
  this._supportedMaps = [CesiumMap.className];
92
99
  const defaultOptions = CesiumTilesetLayer.getDefaultOptions();
93
- if (this.url && !/\.json$/.test(this.url)) {
94
- this.url = `${this.url.replace(/\/$/, '')}/tileset.json`;
95
- }
96
100
 
97
101
  this.highlightStyle = null;
98
102
  if (options.highlightStyle) {
@@ -136,7 +140,7 @@ class CesiumTilesetLayer extends FeatureLayer<CesiumTilesetCesiumImpl> {
136
140
  }
137
141
 
138
142
  set modelMatrix(modelMatrix: Matrix4 | undefined) {
139
- checkMaybe(modelMatrix, Matrix4);
143
+ check(modelMatrix, maybe(Matrix4));
140
144
 
141
145
  this._modelMatrix = modelMatrix;
142
146
  this.getImplementations().forEach((impl) => {
@@ -154,7 +158,7 @@ class CesiumTilesetLayer extends FeatureLayer<CesiumTilesetCesiumImpl> {
154
158
  }
155
159
 
156
160
  set offset(offset: Coordinate | undefined) {
157
- checkMaybe(offset, [Number]);
161
+ check(offset, maybe([Number]));
158
162
 
159
163
  this._offset = offset;
160
164
  this.getImplementations().forEach((impl) => {
@@ -162,12 +166,26 @@ class CesiumTilesetLayer extends FeatureLayer<CesiumTilesetCesiumImpl> {
162
166
  });
163
167
  }
164
168
 
169
+ get customShader(): CustomShader | undefined {
170
+ return this._customShader;
171
+ }
172
+
173
+ set customShader(shader: CustomShader | undefined) {
174
+ if (this._customShader !== shader) {
175
+ this._customShader = shader;
176
+ this.getImplementations().forEach((impl) => {
177
+ impl.updateCustomShader(shader);
178
+ });
179
+ }
180
+ }
181
+
165
182
  getImplementationOptions(): CesiumTilesetImplementationOptions {
166
183
  return {
167
184
  ...super.getImplementationOptions(),
168
185
  tilesetOptions: this.tilesetOptions,
169
186
  modelMatrix: this.modelMatrix,
170
187
  offset: this.offset,
188
+ customShader: this.customShader,
171
189
  };
172
190
  }
173
191
 
@@ -4,6 +4,7 @@ import DataSourceLayer from './dataSourceLayer.js';
4
4
  import { vcsLayerName } from './layerSymbols.js';
5
5
  import { layerClassRegistry } from '../classRegistry.js';
6
6
  import type { LayerOptions } from './layer.js';
7
+ import { getResourceOrUrl } from './cesium/resourceHelper.js';
7
8
 
8
9
  export type CzmlOptions = LayerOptions & {
9
10
  sourceUri?: string;
@@ -82,7 +83,7 @@ class CzmlLayer extends DataSourceLayer {
82
83
 
83
84
  private async _loadData(): Promise<void> {
84
85
  await this.dataSource.load(
85
- this.url,
86
+ getResourceOrUrl(this.url, this.headers),
86
87
  this.sourceUri ? { sourceUri: this.sourceUri } : undefined,
87
88
  );
88
89
 
@@ -1,6 +1,6 @@
1
1
  import Style, { type StyleFunction } from 'ol/style/Style.js';
2
2
 
3
- import { check } from '@vcsuite/check';
3
+ import { check, oneOf } from '@vcsuite/check';
4
4
  import { parseInteger } from '@vcsuite/parsers';
5
5
  import { SplitDirection } from '@vcmap-cesium/engine';
6
6
  import Layer, {
@@ -176,7 +176,7 @@ class FeatureLayer<
176
176
  * Sets the style based on a styleName on a layer
177
177
  */
178
178
  setStyle(style: Style | StyleFunction | StyleItem, silent?: boolean): void {
179
- check(style, [Style, StyleItem, Function]);
179
+ check(style, oneOf(Style, StyleItem, Function));
180
180
 
181
181
  if (style instanceof StyleItem) {
182
182
  this._style = style;
@@ -10,10 +10,7 @@ import VectorLayer, {
10
10
  VectorImplementationOptions,
11
11
  VectorOptions,
12
12
  } from './vectorLayer.js';
13
- import {
14
- featureStoreStateSymbol,
15
- FeatureStoreLayerState,
16
- } from './featureStoreLayerState.js';
13
+ import { featureStoreStateSymbol } from './featureStoreLayerState.js';
17
14
  import { parseGeoJSON } from './geojsonHelpers.js';
18
15
  import { mercatorProjection } from '../util/projection.js';
19
16
  import FeatureStoreLayerChanges from './featureStoreLayerChanges.js';
@@ -206,7 +203,7 @@ class FeatureStoreLayer extends VectorLayer {
206
203
 
207
204
  this._removeVectorPropertiesChangeHandler =
208
205
  this.vectorProperties.propertyChanged.addEventListener(() => {
209
- this.changeTracker.values.changed = true;
206
+ this.changeTracker.changed.raiseEvent();
210
207
  });
211
208
 
212
209
  this.injectedFetchDynamicFeatureFunc =
@@ -264,7 +261,9 @@ class FeatureStoreLayer extends VectorLayer {
264
261
  const { twoDim } = this.staticRepresentation;
265
262
  if (!this._twoDimLoaded) {
266
263
  this._twoDimLoaded = (async (): Promise<void> => {
267
- const data = await requestJson<GeoJSONObject>(twoDim);
264
+ const data = await requestJson<GeoJSONObject>(twoDim, {
265
+ headers: this.headers,
266
+ });
268
267
  const { features } = parseGeoJSON(data, {
269
268
  targetProjection: mercatorProjection,
270
269
  dynamicStyle: true,
@@ -330,6 +329,7 @@ class FeatureStoreLayer extends VectorLayer {
330
329
  featureVisibility: this._staticFeatureVisibility,
331
330
  globalHider: this.globalHider,
332
331
  splitDirection: SplitDirection.NONE,
332
+ headers: this.headers,
333
333
  }),
334
334
  );
335
335
  } else if (this.staticRepresentation && this.staticRepresentation.twoDim) {
@@ -406,7 +406,7 @@ class FeatureStoreLayer extends VectorLayer {
406
406
  });
407
407
  if (changeTrackerActive) {
408
408
  this.changeTracker.track();
409
- this.changeTracker.values.changed = true;
409
+ this.changeTracker.changed.raiseEvent();
410
410
  }
411
411
  }
412
412
 
@@ -551,7 +551,7 @@ class FeatureStoreLayer extends VectorLayer {
551
551
  this.hiddenStaticFeatureIds.add(featureId);
552
552
  const feature = new Feature();
553
553
  feature.setId(featureId);
554
- feature[featureStoreStateSymbol] = FeatureStoreLayerState.STATIC;
554
+ feature[featureStoreStateSymbol] = 'static';
555
555
  this.changeTracker.removeFeature(feature);
556
556
  }
557
557
 
@@ -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