@vcmap/core 5.0.0-rc.10 → 5.0.0-rc.13

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 (129) hide show
  1. package/index.d.ts +201 -125
  2. package/index.js +2 -3
  3. package/package.json +6 -2
  4. package/src/category/category.js +21 -5
  5. package/src/classRegistry.js +0 -6
  6. package/src/context.js +0 -1
  7. package/src/featureProvider/abstractFeatureProvider.js +0 -1
  8. package/src/featureProvider/wmsFeatureProvider.js +0 -1
  9. package/src/interaction/abstractInteraction.js +0 -1
  10. package/src/interaction/interactionChain.js +0 -1
  11. package/src/interaction/interactionType.js +1 -5
  12. package/src/layer/cesium/cesiumTilesetCesiumImpl.js +2 -3
  13. package/src/layer/cesium/dataSourceCesiumImpl.js +0 -1
  14. package/src/layer/cesium/openStreetMapCesiumImpl.js +0 -1
  15. package/src/layer/cesium/rasterLayerCesiumImpl.js +0 -1
  16. package/src/layer/cesium/singleImageCesiumImpl.js +0 -1
  17. package/src/layer/cesium/terrainCesiumImpl.js +0 -1
  18. package/src/layer/cesium/tmsCesiumImpl.js +0 -1
  19. package/src/layer/cesium/vectorCesiumImpl.js +3 -4
  20. package/src/layer/cesium/vectorRasterTileCesiumImpl.js +0 -1
  21. package/src/layer/cesium/vectorTileImageryProvider.js +0 -1
  22. package/src/layer/cesium/wmsCesiumImpl.js +0 -1
  23. package/src/layer/cesium/wmtsCesiumImpl.js +0 -1
  24. package/src/layer/cesiumTilesetLayer.js +0 -1
  25. package/src/layer/czmlLayer.js +0 -1
  26. package/src/layer/dataSourceLayer.js +25 -16
  27. package/src/layer/featureLayer.js +10 -1
  28. package/src/layer/featureStoreLayer.js +1 -1
  29. package/src/layer/featureStoreLayerState.js +0 -1
  30. package/src/layer/featureVisibility.js +3 -1
  31. package/src/layer/geojsonHelpers.js +0 -4
  32. package/src/layer/geojsonLayer.js +0 -1
  33. package/src/layer/globalHider.js +7 -21
  34. package/src/layer/layer.js +84 -38
  35. package/src/layer/layerImplementation.js +0 -1
  36. package/src/layer/layerState.js +0 -1
  37. package/src/layer/oblique/vectorObliqueImpl.js +1 -3
  38. package/src/layer/openStreetMapLayer.js +0 -1
  39. package/src/layer/openlayers/layerOpenlayersImpl.js +0 -1
  40. package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +0 -1
  41. package/src/layer/openlayers/singleImageOpenlayersImpl.js +0 -1
  42. package/src/layer/openlayers/tileDebugOpenlayersImpl.js +0 -1
  43. package/src/layer/openlayers/tmsOpenlayersImpl.js +0 -1
  44. package/src/layer/openlayers/vectorOpenlayersImpl.js +2 -3
  45. package/src/layer/openlayers/vectorTileOpenlayersImpl.js +0 -1
  46. package/src/layer/openlayers/wmsOpenlayersImpl.js +0 -1
  47. package/src/layer/openlayers/wmtsOpenlayersImpl.js +0 -1
  48. package/src/layer/pointCloudLayer.js +0 -1
  49. package/src/layer/rasterLayer.js +0 -2
  50. package/src/layer/singleImageLayer.js +0 -1
  51. package/src/layer/terrainLayer.js +0 -1
  52. package/src/layer/tileProvider/mvtTileProvider.js +21 -2
  53. package/src/layer/tileProvider/staticGeojsonTileProvider.js +0 -1
  54. package/src/layer/tileProvider/tileProvider.js +27 -1
  55. package/src/layer/tileProvider/urlTemplateTileProvider.js +26 -6
  56. package/src/layer/tmsLayer.js +0 -1
  57. package/src/layer/vectorLayer.js +0 -1
  58. package/src/layer/vectorProperties.js +0 -1
  59. package/src/layer/vectorTileLayer.js +45 -13
  60. package/src/layer/wfsLayer.js +0 -1
  61. package/src/layer/wmsLayer.js +0 -1
  62. package/src/layer/wmtsLayer.js +0 -1
  63. package/src/map/baseOLMap.js +0 -1
  64. package/src/map/cameraLimiter.js +0 -1
  65. package/src/map/cesiumMap.js +0 -1
  66. package/src/map/mapState.js +0 -1
  67. package/src/map/obliqueMap.js +0 -1
  68. package/src/map/openlayersMap.js +0 -1
  69. package/src/map/vcsMap.js +6 -2
  70. package/src/oblique/helpers.js +0 -3
  71. package/src/oblique/obliqueCollection.js +0 -1
  72. package/src/oblique/obliqueDataSet.js +0 -2
  73. package/src/oblique/obliqueImage.js +0 -1
  74. package/src/oblique/obliqueImageMeta.js +0 -1
  75. package/src/oblique/obliqueProvider.js +0 -1
  76. package/src/oblique/obliqueView.js +0 -1
  77. package/src/oblique/obliqueViewDirection.js +0 -3
  78. package/src/ol/render/canvas/canvasTileRenderer.js +0 -1
  79. package/src/style/declarativeStyleItem.js +0 -1
  80. package/src/style/shapesCategory.js +0 -2
  81. package/src/style/styleHelpers.js +0 -11
  82. package/src/style/styleItem.js +0 -1
  83. package/src/style/vectorStyleItem.js +0 -4
  84. package/src/util/clipping/clippingObject.js +0 -2
  85. package/src/util/clipping/clippingObjectManager.js +0 -1
  86. package/src/util/clipping/clippingPlaneHelper.js +0 -4
  87. package/src/util/collection.js +15 -3
  88. package/src/util/extent.js +0 -1
  89. package/src/util/indexedCollection.js +0 -1
  90. package/src/util/layerCollection.js +71 -6
  91. package/src/util/locale.js +1 -42
  92. package/src/util/mapCollection.js +29 -14
  93. package/src/util/overrideCollection.js +8 -9
  94. package/src/util/projection.js +0 -5
  95. package/src/util/viewpoint.js +0 -4
  96. package/src/vcsApp.js +53 -0
  97. package/src/vcsEvent.js +0 -1
  98. package/tests/data/buildings/tileset.json +428 -0
  99. package/tests/data/dynamicPointCzml.json +64 -0
  100. package/tests/data/oblique/imageData/imagev34.json +352 -0
  101. package/tests/data/oblique/imageData/imagev35.json +54 -0
  102. package/tests/data/oblique/imageData/imagev35PerImageSize.json +53 -0
  103. package/tests/data/oblique/tiledImageData/12/2199/1342.json +1 -0
  104. package/tests/data/oblique/tiledImageData/12/2199/1343.json +1 -0
  105. package/tests/data/oblique/tiledImageData/12/2199/1344.json +1 -0
  106. package/tests/data/oblique/tiledImageData/12/2200/1342.json +1 -0
  107. package/tests/data/oblique/tiledImageData/12/2200/1343.json +1 -0
  108. package/tests/data/oblique/tiledImageData/12/2200/1344.json +1 -0
  109. package/tests/data/oblique/tiledImageData/12/2201/1342.json +1 -0
  110. package/tests/data/oblique/tiledImageData/12/2201/1343.json +1 -0
  111. package/tests/data/oblique/tiledImageData/12/2201/1344.json +1 -0
  112. package/tests/data/oblique/tiledImageData/image.json +1 -0
  113. package/tests/data/terrain/13/8800/6485.terrain +0 -0
  114. package/tests/data/terrain/13/8800/6486.terrain +0 -0
  115. package/tests/data/terrain/13/8801/6485.terrain +0 -0
  116. package/tests/data/terrain/13/8801/6486.terrain +0 -0
  117. package/tests/data/terrain/layer.json +136 -0
  118. package/tests/data/testGeoJSON.json +161 -0
  119. package/tests/data/tile.pbf +0 -0
  120. package/tests/unit/helpers/cesiumHelpers.js +272 -0
  121. package/tests/unit/helpers/getFileNameFromUrl.js +12 -0
  122. package/tests/unit/helpers/helpers.js +11 -0
  123. package/tests/unit/helpers/imageHelpers.js +20 -0
  124. package/tests/unit/helpers/importJSON.js +15 -0
  125. package/tests/unit/helpers/obliqueData.js +76 -0
  126. package/tests/unit/helpers/obliqueHelpers.js +112 -0
  127. package/tests/unit/helpers/openlayersHelpers.js +22 -0
  128. package/tests/unit/helpers/terrain/terrainData.js +46 -0
  129. package/src/util/dateTime.js +0 -60
@@ -9,11 +9,16 @@ import {
9
9
  import VcsEvent from '../vcsEvent.js';
10
10
 
11
11
  /**
12
- * @type {GlobalHider}
12
+ * @typedef {Object} HiddenObject
13
+ * @property {string} id
13
14
  */
14
- let instance;
15
15
 
16
16
  /**
17
+ * GlobalHider globally hides features existing within a layer of a {@link LayerCollection}.
18
+ * Features can be defined as hidden by {@link VcsAppConfig} or {@link LayerOptions}.
19
+ * Hiding will be performed, when a {@link Context} is loaded, a {@link Layer} is activated or GlobalHider API is called.
20
+ * A feature can be hidden multiple times by different actors, e.g. contexts, layers, which is handled by this class.
21
+ * A feature will be shown again, when a {@link Context} is removed, a {@link Layer} is deactivated or GlobalHider API is called.
17
22
  * @class
18
23
  */
19
24
  class GlobalHider {
@@ -123,25 +128,6 @@ class GlobalHider {
123
128
  this._hiddenObjectFeatures = {};
124
129
  this.changed.destroy();
125
130
  }
126
-
127
- static destroy() {
128
- if (instance) {
129
- instance.destroy();
130
- }
131
- instance = undefined;
132
- }
133
- }
134
-
135
- /**
136
- * @returns {GlobalHider}
137
- * @export
138
- * @api
139
- */
140
- export function getGlobalHider() {
141
- if (!instance) {
142
- instance = new GlobalHider();
143
- }
144
- return instance;
145
131
  }
146
132
 
147
133
  export default GlobalHider;
@@ -1,13 +1,12 @@
1
- import { check } from '@vcsuite/check';
1
+ import { check, checkMaybe } from '@vcsuite/check';
2
2
  import { parseBoolean, parseInteger } from '@vcsuite/parsers';
3
3
  import VcsObject from '../vcsObject.js';
4
4
  import Extent from '../util/extent.js';
5
- import { getGlobalHider } from './globalHider.js';
6
5
  import { vcsLayerName } from './layerSymbols.js';
7
6
  import LayerState from './layerState.js';
8
7
  import VcsEvent from '../vcsEvent.js';
9
- import { getCurrentLocale, getLocaleChangedEvent } from '../util/locale.js';
10
8
  import { layerClassRegistry } from '../classRegistry.js';
9
+ import GlobalHider from './globalHider.js';
11
10
 
12
11
  /**
13
12
  * @typedef {Object} GenericFeature
@@ -100,7 +99,6 @@ export const vcsMetaVersion = '2.0';
100
99
  * To receive implementation options, implement `geImplementationOptions`
101
100
  * @abstract
102
101
  * @class
103
- * @export
104
102
  * @extends {VcsObject}
105
103
  * @api stable
106
104
  */
@@ -188,16 +186,10 @@ class Layer extends VcsObject {
188
186
 
189
187
  /**
190
188
  * @type {string|Object}
191
- * @private
189
+ * @protected
192
190
  */
193
191
  this._url = options.url;
194
192
 
195
- /**
196
- * @type {Function}
197
- * @private
198
- */
199
- this._localeChangedListener = null;
200
-
201
193
  /**
202
194
  * @type {number}
203
195
  * @private
@@ -214,12 +206,19 @@ class Layer extends VcsObject {
214
206
  /**
215
207
  * array of object Ids which should be hidden within the context of the layers layerCollection, if this layer is active
216
208
  * @type {Array.<string>}
209
+ * @private
217
210
  * @api
218
211
  */
219
- this.hiddenObjectIds = Array.isArray(options.hiddenObjectIds) ?
212
+ this._hiddenObjectIds = Array.isArray(options.hiddenObjectIds) ?
220
213
  options.hiddenObjectIds :
221
214
  defaultOptions.hiddenObjectIds;
222
215
 
216
+ /**
217
+ * @type {import("@vcmap/core").GlobalHider|null}
218
+ * @private
219
+ */
220
+ this._globalHider = null;
221
+
223
222
  /**
224
223
  * @type {Array<string|symbol>}
225
224
  * @private
@@ -235,9 +234,6 @@ class Layer extends VcsObject {
235
234
  */
236
235
  this.exclusiveGroupsChanged = new VcsEvent();
237
236
 
238
- /** @type {import("@vcmap/core").GlobalHider} */
239
- this.globalHider = getGlobalHider();
240
-
241
237
  /**
242
238
  * @type {CopyrightOptions|undefined}
243
239
  */
@@ -268,6 +264,12 @@ class Layer extends VcsObject {
268
264
  * @api
269
265
  */
270
266
  this.featureProvider = undefined;
267
+
268
+ /**
269
+ * @type {string}
270
+ * @private
271
+ */
272
+ this._locale = 'en';
271
273
  }
272
274
 
273
275
  /**
@@ -332,9 +334,8 @@ class Layer extends VcsObject {
332
334
  if (typeof this._url === 'string') {
333
335
  return this._url;
334
336
  }
335
- const locale = getCurrentLocale();
336
- if (this._url[locale]) {
337
- return this._url[locale];
337
+ if (this._url[this._locale]) {
338
+ return this._url[this._locale];
338
339
  }
339
340
  return Object.values(this._url)[0];
340
341
  }
@@ -353,6 +354,42 @@ class Layer extends VcsObject {
353
354
  }
354
355
  }
355
356
 
357
+ /**
358
+ * @type {Array<string>}
359
+ */
360
+ get hiddenObjectIds() { return this._hiddenObjectIds; }
361
+
362
+ /**
363
+ * @param {Array<string>} hiddenObjectIds
364
+ */
365
+ set hiddenObjectIds(hiddenObjectIds) {
366
+ check(hiddenObjectIds, [String]);
367
+
368
+ if (this._globalHider && this.active) {
369
+ this._globalHider.hideObjects(hiddenObjectIds);
370
+ }
371
+ this._hiddenObjectIds = hiddenObjectIds;
372
+ }
373
+
374
+
375
+ /**
376
+ * @type {import("@vcmap/core").GlobalHider|null}
377
+ * @readonly
378
+ */
379
+ get globalHider() { return this._globalHider; }
380
+
381
+ /**
382
+ * @param {import("@vcmap/core").GlobalHider} globalHider
383
+ */
384
+ setGlobalHider(globalHider) {
385
+ checkMaybe(globalHider, GlobalHider);
386
+
387
+ if (globalHider && this.active) {
388
+ globalHider.hideObjects(this.hiddenObjectIds);
389
+ }
390
+ this._globalHider = globalHider;
391
+ }
392
+
356
393
  /**
357
394
  * Indicates, that this layer is part of an exclusiveGroup
358
395
  * @api
@@ -406,6 +443,29 @@ class Layer extends VcsObject {
406
443
  }
407
444
  }
408
445
 
446
+ /**
447
+ * returns the currently set locale. Can be used to provide locale specific URLs.
448
+ * @type {string}
449
+ */
450
+ get locale() {
451
+ return this._locale;
452
+ }
453
+
454
+ /**
455
+ * sets the locale and reloads the layer the if the URL is a locale aware Object.
456
+ * @param {string} value
457
+ */
458
+ set locale(value) {
459
+ check(value, String);
460
+
461
+ if (this._locale !== value) {
462
+ this._locale = value;
463
+ if (this._url && typeof this._url === 'object' && this._url[this._locale]) {
464
+ this.reload();
465
+ }
466
+ }
467
+ }
468
+
409
469
  /**
410
470
  * creates an array of layer implementations for the given map.
411
471
  * @param {import("@vcmap/core").VcsMap} map Map
@@ -501,25 +561,11 @@ class Layer extends VcsObject {
501
561
  return null;
502
562
  }
503
563
 
504
- /**
505
- * recreates the implementations on locale change, if the url of this layer is an Object
506
- * @param {string} locale
507
- * @private
508
- */
509
- _handleLocaleChange(locale) {
510
- if (this._url && typeof this._url === 'object' && this._url[locale]) {
511
- this.reload();
512
- }
513
- }
514
-
515
564
  /**
516
565
  * initializes the layer, can be used to defer loading
517
566
  * @returns {Promise<void>}
518
567
  */
519
568
  initialize() {
520
- if (!this.initialized) {
521
- this._localeChangedListener = getLocaleChangedEvent().addEventListener(this._handleLocaleChange.bind(this));
522
- }
523
569
  this._initialized = true;
524
570
  return Promise.resolve();
525
571
  }
@@ -617,7 +663,9 @@ class Layer extends VcsObject {
617
663
  if (this._state !== LayerState.LOADING) {
618
664
  return;
619
665
  }
620
- this.globalHider.hideObjects(this.hiddenObjectIds);
666
+ if (this._globalHider) {
667
+ this._globalHider.hideObjects(this.hiddenObjectIds);
668
+ }
621
669
  this._state = LayerState.ACTIVE;
622
670
  try {
623
671
  this.stateChanged.raiseEvent(LayerState.ACTIVE);
@@ -667,7 +715,9 @@ class Layer extends VcsObject {
667
715
  impl.deactivate();
668
716
  }
669
717
  });
670
- this.globalHider.showObjects(this.hiddenObjectIds);
718
+ if (this._globalHider) {
719
+ this._globalHider.showObjects(this.hiddenObjectIds);
720
+ }
671
721
  this._state = LayerState.INACTIVE;
672
722
  try {
673
723
  this.stateChanged.raiseEvent(LayerState.INACTIVE);
@@ -736,10 +786,6 @@ class Layer extends VcsObject {
736
786
  impl.destroy();
737
787
  });
738
788
 
739
- if (this._localeChangedListener) {
740
- this._localeChangedListener();
741
- this._localeChangedListener = null;
742
- }
743
789
  this._initialized = false;
744
790
  this._implementations.clear();
745
791
  this.stateChanged.destroy();
@@ -4,7 +4,6 @@ import LayerState from './layerState.js';
4
4
  /**
5
5
  * represents an implementation for a Layer for a specific Map
6
6
  * @class
7
- * @export
8
7
  * @extends {VcsObject}
9
8
  * @abstract
10
9
  * @api
@@ -2,7 +2,6 @@
2
2
  * Enumeration of possible layer states.
3
3
  * State machine: inactive <-> loading -> active -> inactive
4
4
  * @enum {number}
5
- * @export
6
5
  * @api
7
6
  * @property {number} INACTIVE
8
7
  * @property {number} ACTIVE
@@ -5,7 +5,6 @@ import Feature from 'ol/Feature.js';
5
5
 
6
6
  import { mercatorProjection } from '../../util/projection.js';
7
7
  import { mercatorGeometryToImageGeometry, imageGeometryToMercatorGeometry, getPolygonizedGeometry, setNewGeometry } from './obliqueHelpers.js';
8
- import { getGlobalHider } from '../globalHider.js';
9
8
  import {
10
9
  actuallyIsCircle,
11
10
  alreadyTransformedToImage,
@@ -19,7 +18,6 @@ import { synchronizeFeatureVisibilityWithSource } from '../vectorHelpers.js';
19
18
  /**
20
19
  * represents a specific vector layer for oblique.
21
20
  * @class
22
- * @export
23
21
  * @extends {LayerObliqueImpl}
24
22
  * @implements {FeatureLayerImplementation}
25
23
  */
@@ -75,7 +73,7 @@ class VectorObliqueImpl extends LayerObliqueImpl {
75
73
  /**
76
74
  * @type {import("@vcmap/core").GlobalHider}
77
75
  */
78
- this.globalHider = getGlobalHider();
76
+ this.globalHider = options.globalHider;
79
77
  /**
80
78
  * @type {import("ol/source").Vector<import("ol/geom/Geometry").default>}
81
79
  */
@@ -20,7 +20,6 @@ import { layerClassRegistry } from '../classRegistry.js';
20
20
  /**
21
21
  * OpenStreetMapLayer Layer
22
22
  * @class
23
- * @export
24
23
  * @extends {Layer}
25
24
  * @api stable
26
25
  * @implements {SplitLayer}
@@ -4,7 +4,6 @@ import LayerImplementation from '../layerImplementation.js';
4
4
  /**
5
5
  * Layer implementation for {@link CesiumMap}.
6
6
  * @class
7
- * @export
8
7
  * @extends {LayerImplementation<import("@vcmap/core").OpenlayersMap>}}
9
8
  */
10
9
  class LayerOpenlayersImpl extends LayerImplementation {
@@ -5,7 +5,6 @@ import RasterLayerOpenlayersImpl from './rasterLayerOpenlayersImpl.js';
5
5
  /**
6
6
  * represents a specific OpenStreetMapLayer layer for openlayers.
7
7
  * @class
8
- * @export
9
8
  * @extends {RasterLayerOpenlayersImpl}
10
9
  */
11
10
  class OpenStreetMapOpenlayersImpl extends RasterLayerOpenlayersImpl {
@@ -7,7 +7,6 @@ import { isSameOrigin } from '../../util/urlHelpers.js';
7
7
  /**
8
8
  * represents a specific OpenLayers SingleImageLayer Layer class.
9
9
  * @class
10
- * @export
11
10
  * @extends {RasterLayerOpenlayersImpl}
12
11
  */
13
12
  class SingleImageOpenlayersImpl extends RasterLayerOpenlayersImpl {
@@ -5,7 +5,6 @@ import LayerOpenlayersImpl from './layerOpenlayersImpl.js';
5
5
  /**
6
6
  * layer Implementation to render tile boundaries.
7
7
  * @class
8
- * @export
9
8
  * @extends {LayerOpenlayersImpl}
10
9
  * @implements {VectorTileImplementation}
11
10
  */
@@ -8,7 +8,6 @@ import { isSameOrigin } from '../../util/urlHelpers.js';
8
8
  /**
9
9
  * TmsLayer implementation for {@link Openlayers}.
10
10
  * @class
11
- * @export
12
11
  * @extends {RasterLayerOpenlayersImpl}
13
12
  */
14
13
  class TmsOpenlayersImpl extends RasterLayerOpenlayersImpl {
@@ -1,12 +1,10 @@
1
1
  import OLVectorLayer from 'ol/layer/Vector.js';
2
2
  import LayerOpenlayersImpl from './layerOpenlayersImpl.js';
3
3
  import { synchronizeFeatureVisibilityWithSource } from '../vectorHelpers.js';
4
- import { getGlobalHider } from '../globalHider.js';
5
4
 
6
5
  /**
7
6
  * represents a specific vectorlayer for openlayers.
8
7
  * @class
9
- * @export
10
8
  * @implements {FeatureLayerImplementation}
11
9
  * @extends {LayerOpenlayersImpl}
12
10
  */
@@ -36,7 +34,8 @@ class VectorOpenlayersImpl extends LayerOpenlayersImpl {
36
34
  this._featureVisibilityListeners = [];
37
35
  /** @type {import("ol/layer/Vector").default<import("ol/source").Vector<import("ol/geom/Geometry").default>>|null} */
38
36
  this.olLayer = null;
39
- this.globalHider = getGlobalHider();
37
+ /** @type {import("@vcmap/core").GlobalHider} */
38
+ this.globalHider = options.globalHider;
40
39
  }
41
40
 
42
41
  /**
@@ -7,7 +7,6 @@ import { mercatorProjection } from '../../util/projection.js';
7
7
  /**
8
8
  * represents a specific vectorTileLayer for openlayers.
9
9
  * @class
10
- * @export
11
10
  * @implements {VectorTileImplementation}
12
11
  * @extends {LayerOpenlayersImpl}
13
12
  */
@@ -5,7 +5,6 @@ import { getWMSSource } from '../wmsHelpers.js';
5
5
  /**
6
6
  * represents a specific Cesium WmsOpenlayersImpl Layer class.
7
7
  * @class
8
- * @export
9
8
  * @extends {RasterLayerOpenlayersImpl}
10
9
  */
11
10
  class WmsOpenlayersImpl extends RasterLayerOpenlayersImpl {
@@ -10,7 +10,6 @@ import { isSameOrigin } from '../../util/urlHelpers.js';
10
10
  /**
11
11
  * WmtsLayer implementation for {@link Openlayers}.
12
12
  * @class
13
- * @export
14
13
  * @extends {RasterLayerOpenlayersImpl}
15
14
  */
16
15
  class WmtsOpenlayersImpl extends RasterLayerOpenlayersImpl {
@@ -32,7 +32,6 @@ export const defaultPointCloudStyle = new DeclarativeStyleItem({});
32
32
  * </ul>
33
33
  *
34
34
  * @class
35
- * @export
36
35
  * @extends {CesiumTilesetLayer}
37
36
  * @api stable
38
37
  */
@@ -41,7 +41,6 @@ import { layerClassRegistry } 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,7 +111,6 @@ 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
@@ -22,7 +22,6 @@ import { wgs84Projection } from '../util/projection.js';
22
22
  /**
23
23
  * Image layer for Cesium and OpenlayersMap
24
24
  * @class
25
- * @export
26
25
  * @extends {RasterLayer}
27
26
  * @api stable
28
27
  */
@@ -21,7 +21,6 @@ import { layerClassRegistry } 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
  */
@@ -18,7 +18,6 @@ import { tileProviderClassRegistry } from '../../classRegistry.js';
18
18
  *
19
19
  * @class
20
20
  * @extends {TileProvider}
21
- * @export
22
21
  * @api
23
22
  */
24
23
  class MVTTileProvider extends TileProvider {
@@ -63,6 +62,26 @@ class MVTTileProvider extends TileProvider {
63
62
  this._MVTFormat = new MVT({ featureClass: Feature });
64
63
  }
65
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
+
66
85
  /**
67
86
  * @inheritDoc
68
87
  * @param {number} x
@@ -72,7 +91,7 @@ class MVTTileProvider extends TileProvider {
72
91
  */
73
92
  async loader(x, y, z) {
74
93
  const rectangle = this.tilingScheme.tileXYToRectangle(x, y, z);
75
- const url = getURL(this.url, x, y, z, rectangle);
94
+ const url = getURL(this.url, x, y, z, rectangle, this.locale);
76
95
  const extent = rectangleToExtent(rectangle);
77
96
  const center = getCenter(extent);
78
97
  const data = await requestArrayBuffer(url);
@@ -14,7 +14,6 @@ import { tileProviderClassRegistry } from '../../classRegistry.js';
14
14
  *
15
15
  * @class
16
16
  * @extends {TileProvider}
17
- * @export
18
17
  * @api
19
18
  */
20
19
  class StaticGeoJSONTileProvider extends TileProvider {
@@ -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';
@@ -75,7 +76,6 @@ export function rectangleToExtent(rectangle) {
75
76
  *
76
77
  * @class
77
78
  * @extends {VcsObject}
78
- * @export
79
79
  * @api
80
80
  */
81
81
  class TileProvider extends VcsObject {
@@ -177,6 +177,12 @@ class TileProvider extends VcsObject {
177
177
  * @api
178
178
  */
179
179
  this.tileLoadedEvent = new VcsEvent();
180
+
181
+ /**
182
+ * @type {string}
183
+ * @private
184
+ */
185
+ this._locale = 'en';
180
186
  }
181
187
 
182
188
  /**
@@ -189,6 +195,26 @@ class TileProvider extends VcsObject {
189
195
  return this._tileCacheSize;
190
196
  }
191
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
+
192
218
  /**
193
219
  * @param {number} value
194
220
  * @returns {Promise<*>}
@@ -1,7 +1,6 @@
1
1
  import { Math as CesiumMath, Rectangle } from '@vcmap/cesium';
2
2
  import { parseGeoJSON } from '../geojsonHelpers.js';
3
3
  import TileProvider from './tileProvider.js';
4
- import { getCurrentLocale } from '../../util/locale.js';
5
4
  import { requestJson } from '../../util/fetch.js';
6
5
  import { tileProviderClassRegistry } from '../../classRegistry.js';
7
6
 
@@ -14,16 +13,17 @@ import { tileProviderClassRegistry } from '../../classRegistry.js';
14
13
  /**
15
14
  * replaces {x}, {y}, {z} with the x, y, z tiling coordinates
16
15
  * replaces {minx}, {miny}, {maxx}, {maxy} with extent of the tile if tilingExtent is provided
17
- * replaces {locale} with the current locale
16
+ * replaces {locale} with the given locale
18
17
  *
19
18
  * @param {string} url
20
19
  * @param {number} x
21
20
  * @param {number} y
22
21
  * @param {number} z
23
22
  * @param {import("@vcmap/cesium").Rectangle=} tilingExtent
23
+ * @param {string=} locale
24
24
  * @returns {string}
25
25
  */
26
- export function getURL(url, x, y, z, tilingExtent) {
26
+ export function getURL(url, x, y, z, tilingExtent, locale = 'en') {
27
27
  let replacedURL = url;
28
28
  if (tilingExtent) {
29
29
  const southwest = Rectangle.southwest(tilingExtent);
@@ -43,7 +43,7 @@ export function getURL(url, x, y, z, tilingExtent) {
43
43
  .replace(/\{x\}/, String(x))
44
44
  .replace(/\{y\}/, String(y))
45
45
  .replace(/\{z\}/, String(z))
46
- .replace(/\{locale\}/, getCurrentLocale());
46
+ .replace(/\{locale\}/, locale);
47
47
  return replacedURL;
48
48
  }
49
49
 
@@ -55,7 +55,6 @@ export function getURL(url, x, y, z, tilingExtent) {
55
55
  *
56
56
  * @class
57
57
  * @extends {TileProvider}
58
- * @export
59
58
  * @api
60
59
  */
61
60
  class URLTemplateTileProvider extends TileProvider {
@@ -88,6 +87,27 @@ class URLTemplateTileProvider extends TileProvider {
88
87
  this.url = options.url || defaultOptions.url;
89
88
  }
90
89
 
90
+
91
+ /**
92
+ * @type {string}
93
+ */
94
+ get locale() {
95
+ return super.locale;
96
+ }
97
+
98
+ /**
99
+ * sets the locale and clears the Cache if the URL is a locale aware Object.
100
+ * @param {string} value
101
+ */
102
+ set locale(value) {
103
+ if (this.locale !== value) {
104
+ super.locale = value;
105
+ if (this.url.includes('{locale}')) {
106
+ this.clearCache();
107
+ }
108
+ }
109
+ }
110
+
91
111
  /**
92
112
  * @inheritDoc
93
113
  * @param {number} x
@@ -97,7 +117,7 @@ class URLTemplateTileProvider extends TileProvider {
97
117
  */
98
118
  async loader(x, y, z) {
99
119
  const rectangle = this.tilingScheme.tileXYToRectangle(x, y, z);
100
- const url = getURL(this.url, x, y, z, rectangle);
120
+ const url = getURL(this.url, x, y, z, rectangle, this.locale);
101
121
  const data = await requestJson(url);
102
122
  const { features } = parseGeoJSON(data, { dynamicStyle: true });
103
123
  return features;
@@ -21,7 +21,6 @@ import { layerClassRegistry } from '../classRegistry.js';
21
21
  /**
22
22
  * TmsLayer Layer
23
23
  * @class
24
- * @export
25
24
  * @extends {RasterLayer}
26
25
  * @api stable
27
26
  */
@@ -84,7 +84,6 @@ import { layerClassRegistry } from '../classRegistry.js';
84
84
  /**
85
85
  * VectorLayer Layer for OpenlayersMap, Cesium and ObliqueMap
86
86
  * @class
87
- * @export
88
87
  * @extends {FeatureLayer}
89
88
  * @api stable
90
89
  */
@@ -164,7 +164,6 @@ export function getCartesian3Options(cartesian3) {
164
164
  /**
165
165
  * Properties Collection for VectorLayer Features
166
166
  * @class
167
- * @export
168
167
  * @api stable
169
168
  */
170
169
  class VectorProperties {