@vcmap/core 5.0.0-rc.2 → 5.0.0-rc.20

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 (186) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +3 -2
  3. package/index.d.ts +2221 -1992
  4. package/index.js +137 -131
  5. package/package.json +16 -23
  6. package/src/category/appBackedCategory.js +89 -0
  7. package/src/category/category.js +444 -0
  8. package/src/category/categoryCollection.js +145 -0
  9. package/src/cesium/cesium3DTileFeature.js +1 -1
  10. package/src/cesium/entity.js +27 -0
  11. package/src/classRegistry.js +162 -0
  12. package/src/context.js +89 -0
  13. package/src/{vcs/vcm/util/featureProvider → featureProvider}/abstractFeatureProvider.js +6 -7
  14. package/src/{vcs/vcm/util/featureProvider → featureProvider}/featureProviderHelpers.js +4 -5
  15. package/src/{vcs/vcm/util/featureProvider → featureProvider}/featureProviderSymbols.js +0 -0
  16. package/src/{vcs/vcm/util/featureProvider → featureProvider}/tileProviderFeatureProvider.js +4 -2
  17. package/src/{vcs/vcm/util/featureProvider → featureProvider}/wmsFeatureProvider.js +22 -14
  18. package/src/{vcs/vcm/interaction → interaction}/abstractInteraction.js +20 -19
  19. package/src/{vcs/vcm/interaction → interaction}/coordinateAtPixel.js +7 -10
  20. package/src/{vcs/vcm/interaction → interaction}/eventHandler.js +3 -3
  21. package/src/{vcs/vcm/interaction → interaction}/featureAtPixelInteraction.js +17 -26
  22. package/src/{vcs/vcm/interaction → interaction}/featureProviderInteraction.js +3 -14
  23. package/src/{vcs/vcm/interaction → interaction}/interactionChain.js +11 -32
  24. package/src/{vcs/vcm/interaction → interaction}/interactionType.js +1 -5
  25. package/src/{vcs/vcm/layer/cesium/cesiumTilesetCesium.js → layer/cesium/cesiumTilesetCesiumImpl.js} +10 -13
  26. package/src/{vcs/vcm/layer → layer}/cesium/clusterContext.js +0 -0
  27. package/src/{vcs/vcm/layer/cesium/dataSourceCesium.js → layer/cesium/dataSourceCesiumImpl.js} +5 -3
  28. package/src/{vcs/vcm/layer/cesium/openStreetMapCesium.js → layer/cesium/openStreetMapCesiumImpl.js} +6 -7
  29. package/src/{vcs/vcm/layer/cesium/rasterLayerCesium.js → layer/cesium/rasterLayerCesiumImpl.js} +5 -6
  30. package/src/{vcs/vcm/layer/cesium/singleImageCesium.js → layer/cesium/singleImageCesiumImpl.js} +5 -6
  31. package/src/{vcs/vcm/layer/cesium/terrainCesium.js → layer/cesium/terrainCesiumImpl.js} +4 -5
  32. package/src/{vcs/vcm/layer/cesium/tmsCesium.js → layer/cesium/tmsCesiumImpl.js} +6 -7
  33. package/src/{vcs/vcm/layer/cesium/vectorCesium.js → layer/cesium/vectorCesiumImpl.js} +6 -7
  34. package/src/{vcs/vcm/layer → layer}/cesium/vectorContext.js +0 -0
  35. package/src/{vcs/vcm/layer/cesium/vectorRasterTileCesium.js → layer/cesium/vectorRasterTileCesiumImpl.js} +5 -6
  36. package/src/{vcs/vcm/layer → layer}/cesium/vectorTileImageryProvider.js +1 -2
  37. package/src/{vcs/vcm/layer/cesium/wmsCesium.js → layer/cesium/wmsCesiumImpl.js} +6 -7
  38. package/src/{vcs/vcm/layer/cesium/wmtsCesium.js → layer/cesium/wmtsCesiumImpl.js} +6 -7
  39. package/src/{vcs/vcm/layer → layer}/cesium/x3dmHelper.js +0 -0
  40. package/src/{vcs/vcm/layer/cesiumTileset.js → layer/cesiumTilesetLayer.js} +36 -35
  41. package/src/{vcs/vcm/layer/czml.js → layer/czmlLayer.js} +12 -15
  42. package/src/{vcs/vcm/layer/dataSource.js → layer/dataSourceLayer.js} +36 -27
  43. package/src/{vcs/vcm/layer → layer}/featureLayer.js +25 -29
  44. package/src/{vcs/vcm/layer/featureStore.js → layer/featureStoreLayer.js} +51 -51
  45. package/src/{vcs/vcm/layer/featureStoreChanges.js → layer/featureStoreLayerChanges.js} +100 -82
  46. package/src/{vcs/vcm/layer/featureStoreState.js → layer/featureStoreLayerState.js} +1 -2
  47. package/src/{vcs/vcm/layer → layer}/featureVisibility.js +9 -6
  48. package/src/{vcs/vcm/layer → layer}/geojsonHelpers.js +15 -41
  49. package/src/{vcs/vcm/layer/geojson.js → layer/geojsonLayer.js} +15 -18
  50. package/src/{vcs/vcm/layer → layer}/globalHider.js +8 -32
  51. package/src/{vcs/vcm/layer → layer}/layer.js +92 -46
  52. package/src/{vcs/vcm/layer → layer}/layerImplementation.js +2 -3
  53. package/src/{vcs/vcm/layer → layer}/layerState.js +0 -1
  54. package/src/{vcs/vcm/layer → layer}/layerSymbols.js +0 -0
  55. package/src/{vcs/vcm/layer/oblique/layerOblique.js → layer/oblique/layerObliqueImpl.js} +4 -4
  56. package/src/{vcs/vcm/layer → layer}/oblique/obliqueHelpers.js +2 -2
  57. package/src/{vcs/vcm/layer/oblique/vectorOblique.js → layer/oblique/vectorObliqueImpl.js} +7 -9
  58. package/src/{vcs/vcm/layer/openStreetMap.js → layer/openStreetMapLayer.js} +30 -31
  59. package/src/{vcs/vcm/layer/openlayers/layerOpenlayers.js → layer/openlayers/layerOpenlayersImpl.js} +5 -6
  60. package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +26 -0
  61. package/src/{vcs/vcm/layer/openlayers/rasterLayerOpenlayers.js → layer/openlayers/rasterLayerOpenlayersImpl.js} +15 -14
  62. package/src/{vcs/vcm/layer/openlayers/singleImageOpenlayers.js → layer/openlayers/singleImageOpenlayersImpl.js} +6 -7
  63. package/src/{vcs/vcm/layer/openlayers/tileDebugOpenlayers.js → layer/openlayers/tileDebugOpenlayersImpl.js} +5 -6
  64. package/src/{vcs/vcm/layer/openlayers/tmsOpenlayers.js → layer/openlayers/tmsOpenlayersImpl.js} +7 -8
  65. package/src/{vcs/vcm/layer/openlayers/vectorOpenlayers.js → layer/openlayers/vectorOpenlayersImpl.js} +8 -9
  66. package/src/{vcs/vcm/layer/openlayers/vectorTileOpenlayers.js → layer/openlayers/vectorTileOpenlayersImpl.js} +6 -7
  67. package/src/{vcs/vcm/layer/openlayers/wmsOpenlayers.js → layer/openlayers/wmsOpenlayersImpl.js} +7 -8
  68. package/src/{vcs/vcm/layer/openlayers/wmtsOpenlayers.js → layer/openlayers/wmtsOpenlayersImpl.js} +7 -8
  69. package/src/{vcs/vcm/layer/pointCloud.js → layer/pointCloudLayer.js} +24 -32
  70. package/src/{vcs/vcm/layer → layer}/rasterLayer.js +16 -18
  71. package/src/{vcs/vcm/layer/singleImage.js → layer/singleImageLayer.js} +18 -18
  72. package/src/{vcs/vcm/layer → layer}/terrainHelpers.js +13 -49
  73. package/src/{vcs/vcm/layer/terrain.js → layer/terrainLayer.js} +11 -12
  74. package/src/{vcs/vcm/layer → layer}/tileLoadedHelper.js +5 -5
  75. package/src/{vcs/vcm/layer → layer}/tileProvider/mvtTileProvider.js +43 -6
  76. package/src/layer/tileProvider/staticGeojsonTileProvider.js +81 -0
  77. package/src/{vcs/vcm/layer → layer}/tileProvider/tileProvider.js +41 -6
  78. package/src/{vcs/vcm/layer → layer}/tileProvider/urlTemplateTileProvider.js +46 -11
  79. package/src/{vcs/vcm/layer/tms.js → layer/tmsLayer.js} +17 -18
  80. package/src/{vcs/vcm/layer → layer}/vectorHelpers.js +5 -5
  81. package/src/{vcs/vcm/layer/vector.js → layer/vectorLayer.js} +35 -45
  82. package/src/{vcs/vcm/layer → layer}/vectorProperties.js +3 -4
  83. package/src/{vcs/vcm/layer → layer}/vectorSymbols.js +0 -0
  84. package/src/{vcs/vcm/layer/vectorTile.js → layer/vectorTileLayer.js} +75 -52
  85. package/src/{vcs/vcm/layer/wfs.js → layer/wfsLayer.js} +16 -17
  86. package/src/{vcs/vcm/layer → layer}/wmsHelpers.js +1 -1
  87. package/src/{vcs/vcm/layer/wms.js → layer/wmsLayer.js} +19 -20
  88. package/src/{vcs/vcm/layer/wmts.js → layer/wmtsLayer.js} +24 -25
  89. package/src/{vcs/vcm/maps → map}/baseOLMap.js +5 -6
  90. package/src/{vcs/vcm/maps → map}/cameraLimiter.js +10 -16
  91. package/src/{vcs/vcm/maps/cesium.js → map/cesiumMap.js} +18 -31
  92. package/src/{vcs/vcm/maps → map}/mapState.js +0 -1
  93. package/src/{vcs/vcm/maps/oblique.js → map/obliqueMap.js} +40 -55
  94. package/src/{vcs/vcm/maps/openlayers.js → map/openlayersMap.js} +15 -13
  95. package/src/{vcs/vcm/maps/map.js → map/vcsMap.js} +39 -20
  96. package/src/oblique/defaultObliqueCollection.js +62 -0
  97. package/src/{vcs/vcm/oblique → oblique}/helpers.js +13 -44
  98. package/src/{vcs/vcm/oblique/ObliqueCollection.js → oblique/obliqueCollection.js} +117 -37
  99. package/src/{vcs/vcm/oblique/ObliqueDataSet.js → oblique/obliqueDataSet.js} +67 -26
  100. package/src/{vcs/vcm/oblique/ObliqueImage.js → oblique/obliqueImage.js} +1 -2
  101. package/src/{vcs/vcm/oblique/ObliqueImageMeta.js → oblique/obliqueImageMeta.js} +4 -5
  102. package/src/{vcs/vcm/oblique/ObliqueProvider.js → oblique/obliqueProvider.js} +17 -12
  103. package/src/{vcs/vcm/oblique/ObliqueView.js → oblique/obliqueView.js} +31 -2
  104. package/src/{vcs/vcm/oblique/ObliqueViewDirection.js → oblique/obliqueViewDirection.js} +0 -3
  105. package/src/{vcs/vcm/oblique → oblique}/parseImageJson.js +20 -12
  106. package/src/ol/geom/circle.js +1 -1
  107. package/src/ol/render/canvas/canvasTileRenderer.js +0 -1
  108. package/src/overrideClassRegistry.js +204 -0
  109. package/src/{vcs/vcm/util/style → style}/declarativeStyleItem.js +43 -20
  110. package/src/{vcs/vcm/util/style → style}/shapesCategory.js +0 -2
  111. package/src/style/styleFactory.js +29 -0
  112. package/src/{vcs/vcm/util/style → style}/styleHelpers.js +3 -14
  113. package/src/{vcs/vcm/util/style → style}/styleItem.js +18 -105
  114. package/src/{vcs/vcm/util/style → style}/vectorStyleItem.js +73 -85
  115. package/src/{vcs/vcm/util/style → style}/writeStyle.js +4 -7
  116. package/src/{vcs/vcm/util → util}/clipping/clippingObject.js +10 -12
  117. package/src/{vcs/vcm/util → util}/clipping/clippingObjectManager.js +2 -3
  118. package/src/{vcs/vcm/util → util}/clipping/clippingPlaneHelper.js +4 -8
  119. package/src/{vcs/vcm/util → util}/collection.js +16 -4
  120. package/src/{vcs/vcm/util → util}/exclusiveManager.js +0 -0
  121. package/src/{vcs/vcm/util → util}/extent.js +16 -10
  122. package/src/{vcs/vcm/util → util}/featureconverter/circleToCesium.js +0 -0
  123. package/src/{vcs/vcm/util → util}/featureconverter/convert.js +0 -0
  124. package/src/util/featureconverter/extent3D.js +181 -0
  125. package/src/{vcs/vcm/util → util}/featureconverter/featureconverterHelper.js +1 -1
  126. package/src/{vcs/vcm/util → util}/featureconverter/lineStringToCesium.js +0 -0
  127. package/src/{vcs/vcm/util → util}/featureconverter/pointToCesium.js +9 -6
  128. package/src/{vcs/vcm/util → util}/featureconverter/polygonToCesium.js +1 -1
  129. package/src/util/fetch.js +32 -0
  130. package/src/{vcs/vcm/util → util}/geometryHelpers.js +0 -0
  131. package/src/{vcs/vcm/util → util}/indexedCollection.js +24 -2
  132. package/src/{vcs/vcm/util → util}/isMobile.js +0 -0
  133. package/src/{vcs/vcm/util → util}/layerCollection.js +89 -12
  134. package/src/util/locale.js +12 -0
  135. package/src/{vcs/vcm/util → util}/mapCollection.js +91 -34
  136. package/src/{vcs/vcm/util → util}/math.js +0 -0
  137. package/src/util/overrideCollection.js +223 -0
  138. package/src/{vcs/vcm/util → util}/projection.js +38 -28
  139. package/src/{vcs/vcm/util → util}/splitScreen.js +10 -10
  140. package/src/{vcs/vcm/util → util}/urlHelpers.js +0 -0
  141. package/src/{vcs/vcm/util → util}/viewpoint.js +2 -6
  142. package/src/vcsApp.js +571 -0
  143. package/src/vcsAppContextHelpers.js +121 -0
  144. package/src/{vcs/vcm/event/vcsEvent.js → vcsEvent.js} +2 -3
  145. package/src/{vcs/vcm/object.js → vcsObject.js} +1 -9
  146. package/tests/data/dynamicPointCzml.json +64 -0
  147. package/tests/data/oblique/imageData/imagev34.json +352 -0
  148. package/tests/data/oblique/imageData/imagev35.json +54 -0
  149. package/tests/data/oblique/imageData/imagev35PerImageSize.json +53 -0
  150. package/tests/data/oblique/tiledImageData/12/2199/1342.json +1 -0
  151. package/tests/data/oblique/tiledImageData/12/2199/1343.json +1 -0
  152. package/tests/data/oblique/tiledImageData/12/2199/1344.json +1 -0
  153. package/tests/data/oblique/tiledImageData/12/2200/1342.json +1 -0
  154. package/tests/data/oblique/tiledImageData/12/2200/1343.json +1 -0
  155. package/tests/data/oblique/tiledImageData/12/2200/1344.json +1 -0
  156. package/tests/data/oblique/tiledImageData/12/2201/1342.json +1 -0
  157. package/tests/data/oblique/tiledImageData/12/2201/1343.json +1 -0
  158. package/tests/data/oblique/tiledImageData/12/2201/1344.json +1 -0
  159. package/tests/data/oblique/tiledImageData/image.json +1 -0
  160. package/tests/data/terrain/13/8800/6485.terrain +0 -0
  161. package/tests/data/terrain/13/8800/6486.terrain +0 -0
  162. package/tests/data/terrain/13/8801/6485.terrain +0 -0
  163. package/tests/data/terrain/13/8801/6486.terrain +0 -0
  164. package/tests/data/terrain/layer.json +136 -0
  165. package/tests/data/testGeoJSON.json +161 -0
  166. package/tests/data/tile.pbf +0 -0
  167. package/tests/unit/helpers/cesiumHelpers.js +290 -0
  168. package/tests/unit/helpers/getFileNameFromUrl.js +12 -0
  169. package/tests/unit/helpers/helpers.js +11 -0
  170. package/tests/unit/helpers/imageHelpers.js +20 -0
  171. package/tests/unit/helpers/importJSON.js +15 -0
  172. package/tests/unit/helpers/obliqueData.js +76 -0
  173. package/tests/unit/helpers/obliqueHelpers.js +112 -0
  174. package/tests/unit/helpers/openlayersHelpers.js +22 -0
  175. package/tests/unit/helpers/terrain/terrainData.js +46 -0
  176. package/src/vcs/vcm/classRegistry.js +0 -106
  177. package/src/vcs/vcm/globalCollections.js +0 -11
  178. package/src/vcs/vcm/layer/buildings.js +0 -17
  179. package/src/vcs/vcm/layer/cesium/pointCloudCesium.js +0 -58
  180. package/src/vcs/vcm/layer/openlayers/openStreetMapOpenlayers.js +0 -27
  181. package/src/vcs/vcm/layer/tileProvider/staticGeojsonTileProvider.js +0 -67
  182. package/src/vcs/vcm/layer/tileProvider/tileProviderFactory.js +0 -28
  183. package/src/vcs/vcm/util/dateTime.js +0 -60
  184. package/src/vcs/vcm/util/featureconverter/extent3d.js +0 -154
  185. package/src/vcs/vcm/util/locale.js +0 -53
  186. package/src/vcs/vcm/util/style/styleFactory.js +0 -48
@@ -1,12 +1,12 @@
1
- import { ImagerySplitDirection, WebMercatorTilingScheme, GeographicTilingScheme, Cartographic } from '@vcmap/cesium';
1
+ import { SplitDirection, WebMercatorTilingScheme, GeographicTilingScheme, Cartographic } from '@vcmap/cesium';
2
2
  import { getBottomLeft, getBottomRight, getTopLeft, getTopRight } from 'ol/extent.js';
3
3
 
4
4
  import { parseInteger, parseNumberRange, parseEnumValue } from '@vcsuite/parsers';
5
5
  import { wgs84Projection } from '../util/projection.js';
6
6
  import Layer from './layer.js';
7
- import VcsEvent from '../event/vcsEvent.js';
7
+ import VcsEvent from '../vcsEvent.js';
8
8
  import Extent from '../util/extent.js';
9
- import { VcsClassRegistry } from '../classRegistry.js';
9
+ import { layerClassRegistry } from '../classRegistry.js';
10
10
 
11
11
  /**
12
12
  * @typedef {LayerOptions} RasterLayerOptions
@@ -24,14 +24,14 @@ import { VcsClassRegistry } from '../classRegistry.js';
24
24
  * @property {number} maxLevel
25
25
  * @property {string} tilingSchema
26
26
  * @property {number} opacity
27
- * @property {import("@vcmap/cesium").ImagerySplitDirection} splitDirection
27
+ * @property {import("@vcmap/cesium").SplitDirection} splitDirection
28
28
  * @property {Extent|undefined} extent
29
29
  */
30
30
 
31
31
  /**
32
32
  * @typedef {import("@vcmap/core").LayerImplementation<import("@vcmap/core").VcsMap>} RasterLayerImplementation
33
33
  * @property {function(number):void} updateOpacity
34
- * @property {function(import("@vcmap/cesium").ImagerySplitDirection):void} updateSplitDirection
34
+ * @property {function(import("@vcmap/cesium").SplitDirection):void} updateSplitDirection
35
35
  * @api
36
36
  */
37
37
 
@@ -41,7 +41,6 @@ import { VcsClassRegistry } from '../classRegistry.js';
41
41
  * @api
42
42
  * @property {string} GEOGRAPHIC
43
43
  * @property {string} MERCATOR
44
- * @export
45
44
  */
46
45
  export const TilingScheme = {
47
46
  GEOGRAPHIC: 'geographic',
@@ -112,13 +111,12 @@ export function calculateMinLevel(extent, tilingScheme, maxLevel, minLevel = 0)
112
111
  * This abstract class allows for automatic loading scheme determination
113
112
  * for raster layers
114
113
  * @class
115
- * @export
116
114
  * @extends {Layer}
117
115
  * @implements {SplitLayer}
118
116
  * @abstract
119
117
  */
120
118
  class RasterLayer extends Layer {
121
- static get className() { return 'vcs.vcm.layer.RasterLayer'; }
119
+ static get className() { return 'RasterLayer'; }
122
120
 
123
121
  /**
124
122
  * @returns {RasterLayerOptions}
@@ -166,18 +164,18 @@ class RasterLayer extends Layer {
166
164
  */
167
165
  this._opacity = parseNumberRange(options.opacity, defaultOptions.opacity, 0.0, 1.0);
168
166
 
169
- /** @type {import("@vcmap/cesium").ImagerySplitDirection} */
170
- this._splitDirection = ImagerySplitDirection.NONE;
167
+ /** @type {import("@vcmap/cesium").SplitDirection} */
168
+ this._splitDirection = SplitDirection.NONE;
171
169
 
172
170
  if (options.splitDirection) {
173
171
  this._splitDirection = options.splitDirection === 'left' ?
174
- ImagerySplitDirection.LEFT :
175
- ImagerySplitDirection.RIGHT;
172
+ SplitDirection.LEFT :
173
+ SplitDirection.RIGHT;
176
174
  }
177
175
 
178
176
  /**
179
177
  * raised if the split direction changes, is passed the split direction as its only argument
180
- * @type {VcsEvent<import("@vcmap/cesium").ImagerySplitDirection>}
178
+ * @type {VcsEvent<import("@vcmap/cesium").SplitDirection>}
181
179
  * @api
182
180
  */
183
181
  this.splitDirectionChanged = new VcsEvent();
@@ -186,12 +184,12 @@ class RasterLayer extends Layer {
186
184
  /**
187
185
  * The split directions of this layer
188
186
  * @api
189
- * @type {import("@vcmap/cesium").ImagerySplitDirection}
187
+ * @type {import("@vcmap/cesium").SplitDirection}
190
188
  */
191
189
  get splitDirection() { return this._splitDirection; }
192
190
 
193
191
  /**
194
- * @param {import("@vcmap/cesium").ImagerySplitDirection} direction
192
+ * @param {import("@vcmap/cesium").SplitDirection} direction
195
193
  */
196
194
  set splitDirection(direction) {
197
195
  if (direction !== this._splitDirection) {
@@ -272,8 +270,8 @@ class RasterLayer extends Layer {
272
270
  config.opacity = this.opacity;
273
271
  }
274
272
 
275
- if (this._splitDirection !== ImagerySplitDirection.NONE) {
276
- config.splitDirection = this._splitDirection === ImagerySplitDirection.RIGHT ?
273
+ if (this._splitDirection !== SplitDirection.NONE) {
274
+ config.splitDirection = this._splitDirection === SplitDirection.RIGHT ?
277
275
  'right' :
278
276
  'left';
279
277
  }
@@ -290,5 +288,5 @@ class RasterLayer extends Layer {
290
288
  }
291
289
  }
292
290
 
293
- VcsClassRegistry.registerClass(RasterLayer.className, RasterLayer);
291
+ layerClassRegistry.registerClass(RasterLayer.className, RasterLayer);
294
292
  export default RasterLayer;
@@ -1,11 +1,12 @@
1
1
  import { check } from '@vcsuite/check';
2
2
  import RasterLayer from './rasterLayer.js';
3
- import SingleImageCesium from './cesium/singleImageCesium.js';
4
- import SingleImageOpenlayers from './openlayers/singleImageOpenlayers.js';
5
- import CesiumMap from '../maps/cesium.js';
6
- import Openlayers from '../maps/openlayers.js';
3
+ import SingleImageCesiumImpl from './cesium/singleImageCesiumImpl.js';
4
+ import SingleImageOpenlayersImpl from './openlayers/singleImageOpenlayersImpl.js';
5
+ import CesiumMap from '../map/cesiumMap.js';
6
+ import OpenlayersMap from '../map/openlayersMap.js';
7
7
  import Extent from '../util/extent.js';
8
- import { VcsClassRegistry } from '../classRegistry.js';
8
+ import { layerClassRegistry } from '../classRegistry.js';
9
+ import { wgs84Projection } from '../util/projection.js';
9
10
 
10
11
  /**
11
12
  * @typedef {RasterLayerOptions} SingleImageOptions
@@ -19,14 +20,13 @@ import { VcsClassRegistry } from '../classRegistry.js';
19
20
  */
20
21
 
21
22
  /**
22
- * Image layer for Cesium and Openlayers
23
+ * Image layer for Cesium and OpenlayersMap
23
24
  * @class
24
- * @export
25
25
  * @extends {RasterLayer}
26
26
  * @api stable
27
27
  */
28
- class SingleImage extends RasterLayer {
29
- static get className() { return 'vcs.vcm.layer.SingleImage'; }
28
+ class SingleImageLayer extends RasterLayer {
29
+ static get className() { return 'SingleImageLayer'; }
30
30
 
31
31
  /**
32
32
  * @returns {SingleImageOptions}
@@ -43,21 +43,21 @@ class SingleImage extends RasterLayer {
43
43
  */
44
44
  constructor(options) {
45
45
  super(options);
46
- const defaultOptions = SingleImage.getDefaultOptions();
46
+ const defaultOptions = SingleImageLayer.getDefaultOptions();
47
47
  /** @type {string} */
48
48
  this.credit = options.credit || defaultOptions.credit;
49
49
 
50
50
  if (!this.extent.isValid()) {
51
51
  this.getLogger().warning(`layer ${this.name} was constructed with an invalid extent, defaulting to global extent`);
52
52
  this.extent = new Extent({
53
- epsg: 'EPSG:4326',
53
+ projection: wgs84Projection.toJSON(),
54
54
  coordinates: [-180, -90, 180, 90],
55
55
  });
56
56
  }
57
57
 
58
58
  this._supportedMaps = [
59
59
  CesiumMap.className,
60
- Openlayers.className,
60
+ OpenlayersMap.className,
61
61
  ];
62
62
  }
63
63
 
@@ -73,13 +73,13 @@ class SingleImage extends RasterLayer {
73
73
 
74
74
  /**
75
75
  * @param {import("@vcmap/core").VcsMap} map
76
- * @returns {Array<SingleImageOpenlayers|SingleImageCesium>}
76
+ * @returns {Array<SingleImageOpenlayersImpl|SingleImageCesiumImpl>}
77
77
  */
78
78
  createImplementationsForMap(map) {
79
79
  if (map instanceof CesiumMap) {
80
- return [new SingleImageCesium(map, this.getImplementationOptions())];
81
- } else if (map instanceof Openlayers) {
82
- return [new SingleImageOpenlayers(map, this.getImplementationOptions())];
80
+ return [new SingleImageCesiumImpl(map, this.getImplementationOptions())];
81
+ } else if (map instanceof OpenlayersMap) {
82
+ return [new SingleImageOpenlayersImpl(map, this.getImplementationOptions())];
83
83
  }
84
84
  return [];
85
85
  }
@@ -115,5 +115,5 @@ class SingleImage extends RasterLayer {
115
115
  }
116
116
  }
117
117
 
118
- VcsClassRegistry.registerClass(SingleImage.className, SingleImage);
119
- export default SingleImage;
118
+ layerClassRegistry.registerClass(SingleImageLayer.className, SingleImageLayer);
119
+ export default SingleImageLayer;
@@ -1,6 +1,6 @@
1
- import { CesiumTerrainProvider, Cartographic, Cartesian2, sampleTerrainMostDetailed, sampleTerrain } from '@vcmap/cesium';
1
+ import { CesiumTerrainProvider, Cartographic, Cartesian2, sampleTerrainMostDetailed } from '@vcmap/cesium';
2
2
  import { getTransform } from 'ol/proj.js';
3
- import Projection, { wgs84Projection } from '../util/projection.js';
3
+ import { wgs84Projection } from '../util/projection.js';
4
4
 
5
5
  /**
6
6
  * @typedef {Object} TerrainProviderOptions
@@ -26,7 +26,7 @@ export function getTerrainProviderForUrl(options) {
26
26
  }
27
27
  let terrainProvider = terrainProviders[options.url];
28
28
  if ((options.requestVertexNormals !== undefined &&
29
- terrainProvider.requestVertexNormals !== options.requestVertexNormals) ||
29
+ terrainProvider.requestVertexNormals !== options.requestVertexNormals) ||
30
30
  (options.requestWaterMask !== undefined &&
31
31
  terrainProvider.requestWaterMask !== options.requestWaterMask)) {
32
32
  terrainProviders[options.url] = new CesiumTerrainProvider(options);
@@ -35,52 +35,18 @@ export function getTerrainProviderForUrl(options) {
35
35
  return terrainProvider;
36
36
  }
37
37
 
38
- /**
39
- * @param {import("@vcmap/cesium").CesiumTerrainProvider} terrainProvider
40
- * @param {Array<import("@vcmap/cesium").Cartographic>} positions
41
- * @returns {Promise<Array<import("@vcmap/cesium").Cartographic>>}
42
- */
43
- export function sampleCesiumTerrainMostDetailed(terrainProvider, positions) {
44
- return new Promise((resolve, reject) => {
45
- sampleTerrainMostDetailed(terrainProvider, positions)
46
- .then((updatedPositions) => {
47
- resolve(updatedPositions);
48
- }, reject);
49
- });
50
- }
51
-
52
- /**
53
- * updates the height of the positions in place.
54
- * @param {import("@vcmap/cesium").CesiumTerrainProvider} terrainProvider
55
- * @param {number} level
56
- * @param {Array<import("@vcmap/cesium").Cartographic>} positions
57
- * @returns {Promise<Array<import("@vcmap/cesium").Cartographic>>}
58
- */
59
- export function sampleCesiumTerrain(terrainProvider, level, positions) {
60
- return new Promise((resolve, reject) => {
61
- sampleTerrain(terrainProvider, level, positions)
62
- .then((updatedPositions) => {
63
- resolve(updatedPositions);
64
- }, reject);
65
- });
66
- }
67
-
68
38
  /**
69
39
  * changes input coordinate Array in place, new height can also be accessed by coordinates[x][2]
70
40
  * @param {import("@vcmap/cesium").CesiumTerrainProvider} terrainProvider
71
41
  * @param {Array<import("ol/coordinate").Coordinate>} coordinates
72
- * @param {(import("@vcmap/core").Projection|import("ol/proj/Projection").default)=} optSourceProjection - if input is not WGS84
42
+ * @param {import("@vcmap/core").Projection=} optSourceProjection - if input is not WGS84
73
43
  * @param {Array<import("ol/coordinate").Coordinate>=} result
74
44
  * @returns {Promise<Array<import("ol/coordinate").Coordinate>>}
75
45
  */
76
46
  export function getHeightFromTerrainProvider(terrainProvider, coordinates, optSourceProjection, result) {
77
- const usedProj = optSourceProjection instanceof Projection ?
78
- optSourceProjection.proj :
79
- optSourceProjection;
80
-
81
- const sourceTransformer = usedProj ?
47
+ const sourceTransformer = optSourceProjection ?
82
48
  getTransform(
83
- usedProj,
49
+ optSourceProjection.proj,
84
50
  wgs84Projection.proj,
85
51
  ) :
86
52
  null;
@@ -93,15 +59,13 @@ export function getHeightFromTerrainProvider(terrainProvider, coordinates, optSo
93
59
  });
94
60
 
95
61
  const outArray = result || coordinates.map(c => c.slice());
96
- return new Promise((resolve, reject) => {
97
- sampleTerrainMostDetailed(terrainProvider, positions)
98
- .then((updatedPositions) => {
99
- updatedPositions.forEach((position, index) => {
100
- outArray[index][2] = position.height || 0;
101
- });
102
- resolve(outArray);
103
- }, reject);
104
- });
62
+ return sampleTerrainMostDetailed(terrainProvider, positions)
63
+ .then((updatedPositions) => {
64
+ updatedPositions.forEach((position, index) => {
65
+ outArray[index][2] = position.height || 0;
66
+ });
67
+ return outArray;
68
+ });
105
69
  }
106
70
 
107
71
  /**
@@ -1,9 +1,9 @@
1
1
  import { parseBoolean } from '@vcsuite/parsers';
2
2
  import Layer from './layer.js';
3
3
  import { getHeightFromTerrainProvider, getTerrainProviderForUrl } from './terrainHelpers.js';
4
- import CesiumMap from '../maps/cesium.js';
5
- import TerrainCesium from './cesium/terrainCesium.js';
6
- import { VcsClassRegistry } from '../classRegistry.js';
4
+ import CesiumMap from '../map/cesiumMap.js';
5
+ import TerrainCesiumImpl from './cesium/terrainCesiumImpl.js';
6
+ import { layerClassRegistry } from '../classRegistry.js';
7
7
 
8
8
  /**
9
9
  * @typedef {LayerOptions} TerrainOptions
@@ -21,12 +21,11 @@ import { VcsClassRegistry } from '../classRegistry.js';
21
21
  /**
22
22
  * represents a terrain layer.
23
23
  * @class
24
- * @export
25
24
  * @extends {Layer}
26
25
  * @api stable
27
26
  */
28
- class Terrain extends Layer {
29
- static get className() { return 'vcs.vcm.layer.Terrain'; }
27
+ class TerrainLayer extends Layer {
28
+ static get className() { return 'TerrainLayer'; }
30
29
 
31
30
  /**
32
31
  * @returns {TerrainOptions}
@@ -44,7 +43,7 @@ class Terrain extends Layer {
44
43
  */
45
44
  constructor(options) {
46
45
  super(options);
47
- const defaultOptions = Terrain.getDefaultOptions();
46
+ const defaultOptions = TerrainLayer.getDefaultOptions();
48
47
 
49
48
  this._supportedMaps = [
50
49
  CesiumMap.className,
@@ -77,11 +76,11 @@ class Terrain extends Layer {
77
76
  /**
78
77
  * @inheritDoc
79
78
  * @param {import("@vcmap/core").VcsMap} map
80
- * @returns {Array<TerrainCesium>}
79
+ * @returns {Array<TerrainCesiumImpl>}
81
80
  */
82
81
  createImplementationsForMap(map) {
83
82
  if (map instanceof CesiumMap) {
84
- return [new TerrainCesium(map, this.getImplementationOptions())];
83
+ return [new TerrainCesiumImpl(map, this.getImplementationOptions())];
85
84
  }
86
85
  return [];
87
86
  }
@@ -106,7 +105,7 @@ class Terrain extends Layer {
106
105
  */
107
106
  toJSON() {
108
107
  const config = /** @type {TerrainOptions} */ (super.toJSON());
109
- const defaultOptions = Terrain.getDefaultOptions();
108
+ const defaultOptions = TerrainLayer.getDefaultOptions();
110
109
 
111
110
  if (this.requestVertexNormals !== defaultOptions.requestVertexNormals) {
112
111
  config.requestVertexNormals = this.requestVertexNormals;
@@ -118,5 +117,5 @@ class Terrain extends Layer {
118
117
  }
119
118
  }
120
119
 
121
- VcsClassRegistry.registerClass(Terrain.className, Terrain);
122
- export default Terrain;
120
+ layerClassRegistry.registerClass(TerrainLayer.className, TerrainLayer);
121
+ export default TerrainLayer;
@@ -1,7 +1,7 @@
1
- import CesiumTilesetCesium from './cesium/cesiumTilesetCesium.js';
1
+ import CesiumTilesetCesiumImpl from './cesium/cesiumTilesetCesiumImpl.js';
2
2
 
3
3
  /**
4
- * @param {CesiumTilesetCesium} impl
4
+ * @param {CesiumTilesetCesiumImpl} impl
5
5
  * @param {number=} timeout
6
6
  * @returns {Promise<void>}
7
7
  */
@@ -26,13 +26,13 @@ function waitForImplTilesLoaded(impl, timeout) {
26
26
  }
27
27
 
28
28
  /**
29
- * @param {import("@vcmap/core").CesiumTileset|import("@vcmap/core").FeatureStore} layer
29
+ * @param {import("@vcmap/core").CesiumTilesetLayer|import("@vcmap/core").FeatureStoreLayer} layer
30
30
  * @param {number=} timeout
31
31
  * @returns {Promise<void>}
32
32
  */
33
33
  export async function tiledLayerLoaded(layer, timeout) {
34
- const impls = /** @type {Array<CesiumTilesetCesium>} */
35
- (layer.getImplementations().filter(i => i instanceof CesiumTilesetCesium));
34
+ const impls = /** @type {Array<CesiumTilesetCesiumImpl>} */
35
+ (layer.getImplementations().filter(i => i instanceof CesiumTilesetCesiumImpl));
36
36
  if (!layer.active || impls.every(i => i.cesium3DTileset.tilesLoaded)) {
37
37
  return;
38
38
  }
@@ -1,9 +1,10 @@
1
- import axios from 'axios';
2
1
  import MVT from 'ol/format/MVT.js';
3
2
  import Feature from 'ol/Feature.js';
4
3
  import { getCenter } from 'ol/extent.js';
5
4
  import TileProvider, { rectangleToExtent } from './tileProvider.js';
6
5
  import { getURL } from './urlTemplateTileProvider.js';
6
+ import { requestArrayBuffer } from '../../util/fetch.js';
7
+ import { tileProviderClassRegistry } from '../../classRegistry.js';
7
8
 
8
9
  /**
9
10
  * @typedef {TileProviderOptions} MVTTileProviderOptions
@@ -17,7 +18,6 @@ import { getURL } from './urlTemplateTileProvider.js';
17
18
  *
18
19
  * @class
19
20
  * @extends {TileProvider}
20
- * @export
21
21
  * @api
22
22
  */
23
23
  class MVTTileProvider extends TileProvider {
@@ -25,7 +25,7 @@ class MVTTileProvider extends TileProvider {
25
25
  * @readonly
26
26
  * @returns {string}
27
27
  */
28
- static get className() { return 'vcs.vcm.layer.tileProvider.MVTTileProvider'; }
28
+ static get className() { return 'MVTTileProvider'; }
29
29
 
30
30
  /**
31
31
  * @returns {MVTTileProviderOptions}
@@ -62,6 +62,26 @@ class MVTTileProvider extends TileProvider {
62
62
  this._MVTFormat = new MVT({ featureClass: Feature });
63
63
  }
64
64
 
65
+ /**
66
+ * @type {string}
67
+ */
68
+ get locale() {
69
+ return super.locale;
70
+ }
71
+
72
+ /**
73
+ * sets the locale and clears the Cache if the URL is a locale aware Object.
74
+ * @param {string} value
75
+ */
76
+ set locale(value) {
77
+ if (this.locale !== value) {
78
+ super.locale = value;
79
+ if (this.url.includes('{locale}')) {
80
+ this.clearCache();
81
+ }
82
+ }
83
+ }
84
+
65
85
  /**
66
86
  * @inheritDoc
67
87
  * @param {number} x
@@ -71,12 +91,12 @@ class MVTTileProvider extends TileProvider {
71
91
  */
72
92
  async loader(x, y, z) {
73
93
  const rectangle = this.tilingScheme.tileXYToRectangle(x, y, z);
74
- const url = getURL(this.url, x, y, z, rectangle);
94
+ const url = getURL(this.url, x, y, z, rectangle, this.locale);
75
95
  const extent = rectangleToExtent(rectangle);
76
96
  const center = getCenter(extent);
77
- const response = await axios.get(url, { responseType: 'arraybuffer' });
97
+ const data = await requestArrayBuffer(url);
78
98
  const features = /** @type {Array<import("ol").Feature<import("ol/geom/Geometry").default>>} */
79
- (this._MVTFormat.readFeatures(response.data));
99
+ (this._MVTFormat.readFeatures(data));
80
100
  const sx = ((extent[2] - extent[0]) / 4096);
81
101
  const sy = -((extent[3] - extent[1]) / 4096);
82
102
  features.forEach((feature) => {
@@ -99,6 +119,23 @@ class MVTTileProvider extends TileProvider {
99
119
  });
100
120
  return features;
101
121
  }
122
+
123
+ /**
124
+ * @returns {MVTTileProviderOptions}
125
+ */
126
+ toJSON() {
127
+ const config = /** @type {MVTTileProviderOptions} */ (super.toJSON());
128
+
129
+ if (this.url) {
130
+ config.url = this.url;
131
+ }
132
+
133
+ if (this.idProperty) {
134
+ config.idProperty = this.idProperty;
135
+ }
136
+ return config;
137
+ }
102
138
  }
103
139
 
104
140
  export default MVTTileProvider;
141
+ tileProviderClassRegistry.registerClass(MVTTileProvider.className, MVTTileProvider);
@@ -0,0 +1,81 @@
1
+ import { parseGeoJSON } from '../geojsonHelpers.js';
2
+ import TileProvider from './tileProvider.js';
3
+ import { requestJson } from '../../util/fetch.js';
4
+ import { tileProviderClassRegistry } from '../../classRegistry.js';
5
+
6
+ /**
7
+ * @typedef {TileProviderOptions} StaticGeoJSONTileProviderOptions
8
+ * @property {string} url - url to the geojson
9
+ * @api
10
+ */
11
+
12
+ /**
13
+ * Loads the provided geojson url and tiles the content in memory, data is only requested once
14
+ *
15
+ * @class
16
+ * @extends {TileProvider}
17
+ * @api
18
+ */
19
+ class StaticGeoJSONTileProvider extends TileProvider {
20
+ /**
21
+ * @readonly
22
+ * @returns {string}
23
+ */
24
+ static get className() { return 'StaticGeoJSONTileProvider'; }
25
+
26
+ /**
27
+ * @returns {StaticGeoJSONTileProviderOptions}
28
+ */
29
+ static getDefaultOptions() {
30
+ return {
31
+ ...TileProvider.getDefaultOptions(),
32
+ url: undefined,
33
+ baseLevels: [0],
34
+ };
35
+ }
36
+
37
+ /**
38
+ * @param {StaticGeoJSONTileProviderOptions} options
39
+ */
40
+ constructor(options) {
41
+ const defaultOptions = StaticGeoJSONTileProvider.getDefaultOptions();
42
+ options.baseLevels = defaultOptions.baseLevels;
43
+ super(options);
44
+
45
+ /**
46
+ * @type {string}
47
+ */
48
+ this.url = options.url || defaultOptions.url;
49
+ }
50
+
51
+
52
+ /**
53
+ * @inheritDoc
54
+ * @param {number} x
55
+ * @param {number} y
56
+ * @param {number} z
57
+ * @returns {Promise<Array<import("ol").Feature<import("ol/geom/Geometry").default>>>}
58
+ */
59
+ // eslint-disable-next-line no-unused-vars
60
+ async loader(x, y, z) {
61
+ const data = await requestJson(this.url);
62
+ const { features } = parseGeoJSON(data, { dynamicStyle: true });
63
+ return features;
64
+ }
65
+
66
+ /**
67
+ * @returns {StaticGeoJSONTileProviderOptions}
68
+ */
69
+ toJSON() {
70
+ const config = /** @type {StaticGeoJSONTileProviderOptions} */ (super.toJSON());
71
+ delete config.baseLevels;
72
+
73
+ if (this.url) {
74
+ config.url = this.url;
75
+ }
76
+ return config;
77
+ }
78
+ }
79
+
80
+ export default StaticGeoJSONTileProvider;
81
+ tileProviderClassRegistry.registerClass(StaticGeoJSONTileProvider.className, StaticGeoJSONTileProvider);
@@ -1,5 +1,6 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
2
  import RBush from 'rbush';
3
+ import { check } from '@vcsuite/check';
3
4
  import { Rectangle, Math as CesiumMath, WebMercatorTilingScheme, Cartographic } from '@vcmap/cesium';
4
5
  import LRUCache from 'ol/structs/LRUCache.js';
5
6
  import { buffer, createOrUpdateFromCoordinate } from 'ol/extent.js';
@@ -10,8 +11,9 @@ import {
10
11
  wgs84Projection,
11
12
  wgs84ToMercatorTransformer,
12
13
  } from '../../util/projection.js';
13
- import VcsObject from '../../object.js';
14
- import VcsEvent from '../../event/vcsEvent.js';
14
+ import VcsObject from '../../vcsObject.js';
15
+ import VcsEvent from '../../vcsEvent.js';
16
+ import { tileProviderClassRegistry } from '../../classRegistry.js';
15
17
 
16
18
  /**
17
19
  * @typedef {Object} tileProviderRTreeEntry
@@ -74,7 +76,6 @@ export function rectangleToExtent(rectangle) {
74
76
  *
75
77
  * @class
76
78
  * @extends {VcsObject}
77
- * @export
78
79
  * @api
79
80
  */
80
81
  class TileProvider extends VcsObject {
@@ -82,7 +83,7 @@ class TileProvider extends VcsObject {
82
83
  * @readonly
83
84
  * @returns {string}
84
85
  */
85
- static get className() { return 'vcs.vcm.layer.tileProvider.TileProvider'; }
86
+ static get className() { return 'TileProvider'; }
86
87
 
87
88
  /**
88
89
  * @returns {TileProviderOptions}
@@ -176,6 +177,12 @@ class TileProvider extends VcsObject {
176
177
  * @api
177
178
  */
178
179
  this.tileLoadedEvent = new VcsEvent();
180
+
181
+ /**
182
+ * @type {string}
183
+ * @private
184
+ */
185
+ this._locale = 'en';
179
186
  }
180
187
 
181
188
  /**
@@ -188,6 +195,26 @@ class TileProvider extends VcsObject {
188
195
  return this._tileCacheSize;
189
196
  }
190
197
 
198
+
199
+ /**
200
+ * @type {string}
201
+ */
202
+ get locale() {
203
+ return this._locale;
204
+ }
205
+
206
+ /**
207
+ * sets the locale and reloads the layer the if the URL is a locale aware Object.
208
+ * @param {string} value
209
+ */
210
+ set locale(value) {
211
+ check(value, String);
212
+ if (this._locale !== value) {
213
+ this._locale = value;
214
+ }
215
+ }
216
+
217
+
191
218
  /**
192
219
  * @param {number} value
193
220
  * @returns {Promise<*>}
@@ -494,7 +521,7 @@ class TileProvider extends VcsObject {
494
521
  }
495
522
 
496
523
  /**
497
- * Public API to load features from a source (for example a rest API, or WFS)
524
+ * Public API to load features from a source (for example a rest API, or WfsLayer)
498
525
  *
499
526
  * Can be used to write custom TileProvider to provide an interface to a "feature Source"
500
527
  * Can also be used to manipulate the features, for example setting an ID Prefix or filter the features.
@@ -538,13 +565,20 @@ class TileProvider extends VcsObject {
538
565
  config.tileCacheSize = this.tileCacheSize;
539
566
  }
540
567
 
541
- if (defaultOptions.baseLevels !== this.baseLevels) {
568
+ if (!(
569
+ this.baseLevels.length === defaultOptions.baseLevels.length &&
570
+ this.baseLevels.every(level => defaultOptions.baseLevels.includes(level))
571
+ )) {
542
572
  config.baseLevels = this.baseLevels.slice();
543
573
  }
544
574
 
545
575
  if (defaultOptions.trackFeaturesToTiles !== this.trackFeaturesToTiles) {
546
576
  config.trackFeaturesToTiles = this.trackFeaturesToTiles;
547
577
  }
578
+
579
+ if (defaultOptions.allowTileAggregation !== this.allowTileAggregation) {
580
+ config.allowTileAggregation = this.allowTileAggregation;
581
+ }
548
582
  return config;
549
583
  }
550
584
 
@@ -582,3 +616,4 @@ class TileProvider extends VcsObject {
582
616
  }
583
617
 
584
618
  export default TileProvider;
619
+ tileProviderClassRegistry.registerClass(TileProvider.className, TileProvider);