@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,21 +1,21 @@
1
1
  import Style from 'ol/style/Style.js';
2
2
  import { parseInteger } from '@vcsuite/parsers';
3
- import CesiumMap from '../maps/cesium.js';
4
- import VectorRasterTileCesium from './cesium/vectorRasterTileCesium.js';
5
- import Openlayers from '../maps/openlayers.js';
6
- import VectorTileOpenlayers from './openlayers/vectorTileOpenlayers.js';
3
+ import CesiumMap from '../map/cesiumMap.js';
4
+ import VectorRasterTileCesiumImpl from './cesium/vectorRasterTileCesiumImpl.js';
5
+ import OpenlayersMap from '../map/openlayersMap.js';
6
+ import VectorTileOpenlayersImpl from './openlayers/vectorTileOpenlayersImpl.js';
7
7
  import FeatureLayer from './featureLayer.js';
8
- import VectorStyleItem, { defaultVectorStyle } from '../util/style/vectorStyleItem.js';
8
+ import VectorStyleItem, { defaultVectorStyle } from '../style/vectorStyleItem.js';
9
9
  import VectorProperties from './vectorProperties.js';
10
- import DeclarativeStyleItem from '../util/style/declarativeStyleItem.js';
10
+ import DeclarativeStyleItem from '../style/declarativeStyleItem.js';
11
11
  import { FeatureVisibilityAction, globalHidden, hidden, highlighted } from './featureVisibility.js';
12
12
  import { getStylesArray } from '../util/featureconverter/convert.js';
13
13
  import { vcsLayerName } from './layerSymbols.js';
14
- import TileProviderFeatureProvider from '../util/featureProvider/tileProviderFeatureProvider.js';
15
- import tileProviderFactory from './tileProvider/tileProviderFactory.js';
14
+ import TileProviderFeatureProvider from '../featureProvider/tileProviderFeatureProvider.js';
16
15
  import { getGenericFeatureFromClickedObject } from './vectorHelpers.js';
17
16
  import { originalFeatureSymbol } from './vectorSymbols.js';
18
- import { VcsClassRegistry } from '../classRegistry.js';
17
+ import { getObjectFromClassRegistry, layerClassRegistry, tileProviderClassRegistry } from '../classRegistry.js';
18
+ import TileProvider from './tileProvider/tileProvider.js';
19
19
 
20
20
  /**
21
21
  * synchronizes featureVisibility Symbols on the feature;
@@ -44,7 +44,7 @@ function synchronizeFeatureVisibility(featureVisibility, globalHider, feature) {
44
44
 
45
45
  /**
46
46
  * @typedef {FeatureLayerOptions} VectorTileOptions
47
- * @property {TileProviderOptions} tileProvider
47
+ * @property {TileProviderOptions|import("@vcmap/core").TileProvider} tileProvider
48
48
  * @property {VectorStyleItemOptions|import("@vcmap/core").VectorStyleItem|undefined} highlightStyle
49
49
  * @property {VectorPropertiesOptions|undefined} vectorProperties
50
50
  * @property {number|undefined} minLevel used to restrict the zoom level visibility (minlevel does not allow rendering above tileProvider baseLevel)
@@ -67,18 +67,17 @@ function synchronizeFeatureVisibility(featureVisibility, globalHider, feature) {
67
67
  */
68
68
 
69
69
  /**
70
- * VectorTile Layer for tiled vector Data. Can be connected to data with a TileProvider
70
+ * VectorTileLayer Layer for tiled vector Data. Can be connected to data with a TileProvider
71
71
  * @class
72
- * @export
73
72
  * @extends {FeatureLayer}
74
73
  * @api stable
75
74
  */
76
- class VectorTile extends FeatureLayer {
75
+ class VectorTileLayer extends FeatureLayer {
77
76
  /**
78
77
  * @readonly
79
78
  * @returns {string}
80
79
  */
81
- static get className() { return 'vcs.vcm.layer.VectorTile'; }
80
+ static get className() { return 'VectorTileLayer'; }
82
81
 
83
82
  /**
84
83
  * @returns {VectorTileOptions}
@@ -103,10 +102,10 @@ class VectorTile extends FeatureLayer {
103
102
 
104
103
  this._supportedMaps = [
105
104
  CesiumMap.className,
106
- Openlayers.className,
105
+ OpenlayersMap.className,
107
106
  ];
108
107
 
109
- const defaultOptions = VectorTile.getDefaultOptions();
108
+ const defaultOptions = VectorTileLayer.getDefaultOptions();
110
109
 
111
110
  /** @type {VectorStyleItem} */
112
111
  this.highlightStyle = /** @type {undefined} */ (defaultOptions.highlightStyle);
@@ -132,17 +131,16 @@ class VectorTile extends FeatureLayer {
132
131
  ...options.vectorProperties,
133
132
  });
134
133
 
135
- /**
136
- * @type {TileProviderOptions}
137
- * @private
138
- */
139
- this._tileProviderOptions = options.tileProvider;
140
-
141
134
  /**
142
135
  * @type {import("@vcmap/core").TileProvider}
143
136
  * @api
144
137
  */
145
- this.tileProvider = undefined;
138
+ this.tileProvider = options.tileProvider instanceof TileProvider ? // XXX this now throws if not passing in a tileProvider.
139
+ options.tileProvider :
140
+ getObjectFromClassRegistry(tileProviderClassRegistry, options.tileProvider);
141
+ if (this.tileProvider) {
142
+ this.tileProvider.locale = this.locale;
143
+ }
146
144
 
147
145
  /**
148
146
  * @type {number|undefined}
@@ -160,7 +158,7 @@ class VectorTile extends FeatureLayer {
160
158
  * @type {Array<Function>}
161
159
  * @private
162
160
  */
163
- this._featureVisibilityListener = [];
161
+ this._featureVisibilityListeners = [];
164
162
 
165
163
  /**
166
164
  * @type {Function}
@@ -182,26 +180,43 @@ class VectorTile extends FeatureLayer {
182
180
  this._styleZIndex = 0;
183
181
  }
184
182
 
183
+ /**
184
+ * returns the currently set locale. Can be used to provide locale specific URLs.
185
+ * @type {string}
186
+ */
187
+ get locale() {
188
+ return super.locale;
189
+ }
190
+
191
+ /**
192
+ * sets the locale and reloads the layer the if the URL is a locale aware Object.
193
+ * @param {string} value
194
+ */
195
+ set locale(value) {
196
+ if (this.tileProvider) {
197
+ this.tileProvider.locale = super.locale;
198
+ }
199
+ super.locale = value;
200
+ }
201
+
185
202
  /**
186
203
  * initializes the layer, can be used to defer loading
187
204
  * @returns {Promise<void>}
188
205
  */
189
206
  async initialize() {
190
- await super.initialize();
191
- if (!this.tileProvider) {
192
- this.tileProvider = await tileProviderFactory(this._tileProviderOptions);
193
- // this.tileProvider = await tileProviderFactory(this._tileProviderOptions);
207
+ if (!this.initialized) {
194
208
  this._tileLoadEventListener =
195
209
  this.tileProvider.tileLoadedEvent.addEventListener(event => this._handleTileLoaded(event));
196
210
  this._vectorPropertiesChangedListener =
197
211
  this.vectorProperties.propertyChanged.addEventListener(() => {
198
212
  this.reload();
199
213
  });
200
- this.featureProvider = new TileProviderFeatureProvider(this.name, {
214
+ this.featureProvider = new TileProviderFeatureProvider(this.name, { // XXX this overwrites
201
215
  tileProvider: this.tileProvider,
202
216
  vectorProperties: this.vectorProperties,
203
217
  });
204
218
  }
219
+ await super.initialize();
205
220
  }
206
221
 
207
222
 
@@ -261,15 +276,24 @@ class VectorTile extends FeatureLayer {
261
276
  }
262
277
 
263
278
  /**
264
- *
265
- * @returns {Array<Function>}
279
+ * @param {import("@vcmap/core").GlobalHider} globalHider
280
+ */
281
+ setGlobalHider(globalHider) {
282
+ super.setGlobalHider(globalHider);
283
+ this._setupFeatureVisibilityHandlers();
284
+ }
285
+
286
+ /**
287
+ * Sets up listeners for featureVisibility and global hider
266
288
  * @private
267
289
  */
268
290
  _setupFeatureVisibilityHandlers() {
269
291
  if (!this.tileProvider.trackFeaturesToTiles) {
270
- return [];
292
+ return;
271
293
  }
272
- return [
294
+ this._featureVisibilityListeners.forEach((cb) => { cb(); });
295
+
296
+ this._featureVisibilityListeners = [
273
297
  this.featureVisibility.changed.addEventListener(({ action, ids }) => {
274
298
  const tileIdsChanged = new Set();
275
299
  ids.forEach((id) => {
@@ -296,8 +320,10 @@ class VectorTile extends FeatureLayer {
296
320
  });
297
321
  this.updateTiles([...tileIdsChanged]);
298
322
  }),
323
+ ];
299
324
 
300
- this.globalHider.changed.addEventListener(({ action, ids }) => {
325
+ if (this.globalHider) {
326
+ this._featureVisibilityListeners.push(this.globalHider.changed.addEventListener(({ action, ids }) => {
301
327
  const tileIdsChanged = new Set();
302
328
  ids.forEach((id) => {
303
329
  const tileIds = this.tileProvider.featureIdToTileIds.get(id);
@@ -318,8 +344,8 @@ class VectorTile extends FeatureLayer {
318
344
  }
319
345
  });
320
346
  this.updateTiles([...tileIdsChanged]);
321
- }),
322
- ];
347
+ }));
348
+ }
323
349
  }
324
350
 
325
351
  /**
@@ -375,16 +401,16 @@ class VectorTile extends FeatureLayer {
375
401
  /**
376
402
  * @inheritDoc
377
403
  * @param {import("@vcmap/core").VcsMap} map
378
- * @returns {Array<VectorRasterTileCesium|VectorTileOpenlayers>}
404
+ * @returns {Array<VectorRasterTileCesiumImpl|VectorTileOpenlayersImpl>}
379
405
  */
380
406
  createImplementationsForMap(map) {
381
407
  if (map instanceof CesiumMap) {
382
- return [new VectorRasterTileCesium(map, this.getImplementationOptions())];
408
+ return [new VectorRasterTileCesiumImpl(map, this.getImplementationOptions())];
383
409
  }
384
410
 
385
- if (map instanceof Openlayers) {
411
+ if (map instanceof OpenlayersMap) {
386
412
  return [
387
- new VectorTileOpenlayers(map, this.getImplementationOptions()),
413
+ new VectorTileOpenlayersImpl(map, this.getImplementationOptions()),
388
414
  ];
389
415
  }
390
416
 
@@ -392,7 +418,7 @@ class VectorTile extends FeatureLayer {
392
418
  }
393
419
 
394
420
  /**
395
- * @param {(Reference|DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem|string)=} styleOptions
421
+ * @param {(DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem)=} styleOptions
396
422
  * @param {VectorStyleItem=} defaultStyle
397
423
  * @returns {import("@vcmap/core").StyleItem}
398
424
  */
@@ -407,8 +433,8 @@ class VectorTile extends FeatureLayer {
407
433
  */
408
434
  async activate() {
409
435
  await super.activate();
410
- this._featureVisibilityListener = this._setupFeatureVisibilityHandlers();
411
- if (this.tileProvider.trackFeaturesToTiles) {
436
+ this._setupFeatureVisibilityHandlers();
437
+ if (this.tileProvider.trackFeaturesToTiles && this.globalHider) {
412
438
  this.tileProvider.forEachFeature((feature) => {
413
439
  synchronizeFeatureVisibility(this.featureVisibility, this.globalHider, feature);
414
440
  });
@@ -421,7 +447,7 @@ class VectorTile extends FeatureLayer {
421
447
  */
422
448
  deactivate() {
423
449
  super.deactivate();
424
- this._featureVisibilityListener.forEach((cb) => { cb(); });
450
+ this._featureVisibilityListeners.forEach((cb) => { cb(); });
425
451
  }
426
452
 
427
453
  /**
@@ -429,7 +455,7 @@ class VectorTile extends FeatureLayer {
429
455
  * @api
430
456
  */
431
457
  destroy() {
432
- this._featureVisibilityListener.forEach((cb) => { cb(); });
458
+ this._featureVisibilityListeners.forEach((cb) => { cb(); });
433
459
  super.destroy();
434
460
  this._tileLoadEventListener();
435
461
  if (this.featureProvider) {
@@ -450,7 +476,7 @@ class VectorTile extends FeatureLayer {
450
476
  */
451
477
  toJSON() {
452
478
  const config = /** @type {VectorTileOptions} */ (super.toJSON());
453
- const defaultOptions = VectorTile.getDefaultOptions();
479
+ const defaultOptions = VectorTileLayer.getDefaultOptions();
454
480
 
455
481
  if (this._maxLevel !== defaultOptions.maxLevel) {
456
482
  config.maxLevel = this._maxLevel;
@@ -466,15 +492,12 @@ class VectorTile extends FeatureLayer {
466
492
  }
467
493
 
468
494
  if (this.tileProvider) {
469
- const tileProviderConfig = this.tileProvider.toJSON();
470
- config.tileProvider = tileProviderConfig;
471
- } else if (this._tileProviderOptions) {
472
- config.tileProvider = this._tileProviderOptions;
495
+ config.tileProvider = this.tileProvider.toJSON();
473
496
  }
474
497
 
475
498
  return config;
476
499
  }
477
500
  }
478
501
 
479
- VcsClassRegistry.registerClass(VectorTile.className, VectorTile);
480
- export default VectorTile;
502
+ layerClassRegistry.registerClass(VectorTileLayer.className, VectorTileLayer);
503
+ export default VectorTileLayer;
@@ -1,8 +1,8 @@
1
1
  import WFSFormat from 'ol/format/WFS.js';
2
- import axios from 'axios';
3
- import Vector from './vector.js';
2
+ import VectorLayer from './vectorLayer.js';
4
3
  import Projection from '../util/projection.js';
5
- import { VcsClassRegistry } from '../classRegistry.js';
4
+ import { layerClassRegistry } from '../classRegistry.js';
5
+ import { requestJson } from '../util/fetch.js';
6
6
 
7
7
  /**
8
8
  * @typedef {VectorOptions} WFSOptions
@@ -14,21 +14,20 @@ import { VcsClassRegistry } from '../classRegistry.js';
14
14
  */
15
15
 
16
16
  /**
17
- * WFS Vector Layer
17
+ * WfsLayer VectorLayer Layer
18
18
  * @class
19
- * @export
20
- * @extends {Vector}
19
+ * @extends {VectorLayer}
21
20
  * @api
22
21
  */
23
- class WFS extends Vector {
24
- static get className() { return 'vcs.vcm.layer.WFS'; }
22
+ class WFSLayer extends VectorLayer {
23
+ static get className() { return 'WFSLayer'; }
25
24
 
26
25
  /**
27
26
  * @returns {WFSOptions}
28
27
  */
29
28
  static getDefaultOptions() {
30
29
  return {
31
- ...Vector.getDefaultOptions(),
30
+ ...VectorLayer.getDefaultOptions(),
32
31
  featureType: [],
33
32
  featureNS: '',
34
33
  featurePrefix: '',
@@ -116,14 +115,14 @@ class WFS extends Vector {
116
115
  ...this.getFeaturesOptions,
117
116
  }));
118
117
  const postData = new XMLSerializer().serializeToString(requestDocument);
119
- this._dataFetchedPromise = axios.post(this.url, postData, {
118
+ this._dataFetchedPromise = requestJson(this.url, {
119
+ method: 'POST',
120
120
  headers: {
121
121
  'Content-Type': 'application/text+xml',
122
122
  },
123
+ body: JSON.stringify(postData),
123
124
  })
124
- .then((response) => {
125
- this._parseWFSData(response.data);
126
- })
125
+ .then(data => this._parseWFSData(data))
127
126
  .catch((err) => {
128
127
  this.getLogger().info(`Could not send request for loading layer content (${err.message})`);
129
128
  return Promise.reject(err);
@@ -131,8 +130,8 @@ class WFS extends Vector {
131
130
 
132
131
  return this._dataFetchedPromise;
133
132
  }
134
- this.getLogger().warning('Could not load WFS layer, no url is set');
135
- return Promise.reject(new Error('missing url in WFS layer'));
133
+ this.getLogger().warning('Could not load WFSLayer layer, no url is set');
134
+ return Promise.reject(new Error('missing url in WFSLayer layer'));
136
135
  }
137
136
 
138
137
  /**
@@ -161,5 +160,5 @@ class WFS extends Vector {
161
160
  }
162
161
  }
163
162
 
164
- VcsClassRegistry.registerClass(WFS.className, WFS);
165
- export default WFS;
163
+ layerClassRegistry.registerClass(WFSLayer.className, WFSLayer);
164
+ export default WFSLayer;
@@ -33,7 +33,7 @@ export function getWMSSource(options) {
33
33
  const maxZoom = options.maxLevel + 1;
34
34
  const resolutions = [];
35
35
  for (let z = 0; z < maxZoom; ++z) {
36
- // generate resolutions and matrixIds arrays for options WMTS
36
+ // generate resolutions and matrixIds arrays for options WmtsLayer
37
37
  resolutions.push(size / (2 ** z));
38
38
  }
39
39
  const tilingOptions = {
@@ -1,13 +1,13 @@
1
1
  import { check } from '@vcsuite/check';
2
2
  import { parseBoolean } from '@vcsuite/parsers';
3
3
  import RasterLayer from './rasterLayer.js';
4
- import WMSFeatureProvider from '../util/featureProvider/wmsFeatureProvider.js';
5
- import CesiumMap from '../maps/cesium.js';
6
- import WMSCesium from './cesium/wmsCesium.js';
7
- import Openlayers from '../maps/openlayers.js';
8
- import WMSOpenlayers from './openlayers/wmsOpenlayers.js';
4
+ import WMSFeatureProvider from '../featureProvider/wmsFeatureProvider.js';
5
+ import CesiumMap from '../map/cesiumMap.js';
6
+ import WmsCesiumImpl from './cesium/wmsCesiumImpl.js';
7
+ import OpenlayersMap from '../map/openlayersMap.js';
8
+ import WmsOpenlayersImpl from './openlayers/wmsOpenlayersImpl.js';
9
9
  import Extent from '../util/extent.js';
10
- import { VcsClassRegistry } from '../classRegistry.js';
10
+ import { layerClassRegistry } from '../classRegistry.js';
11
11
 
12
12
  /**
13
13
  * @typedef {RasterLayerImplementationOptions} WMSImplementationOptions
@@ -30,14 +30,13 @@ import { VcsClassRegistry } from '../classRegistry.js';
30
30
  */
31
31
 
32
32
  /**
33
- * WMS layer for Cesium and Openlayers
33
+ * WmsLayer layer for Cesium and OpenlayersMap
34
34
  * @class
35
- * @export
36
35
  * @extends {RasterLayer}
37
36
  * @api stable
38
37
  */
39
- class WMS extends RasterLayer {
40
- static get className() { return 'vcs.vcm.layer.WMS'; }
38
+ class WMSLayer extends RasterLayer {
39
+ static get className() { return 'WMSLayer'; }
41
40
 
42
41
  /**
43
42
  * @returns {WMSOptions}
@@ -59,7 +58,7 @@ class WMS extends RasterLayer {
59
58
  */
60
59
  constructor(options) {
61
60
  super(options);
62
- const defaultOptions = WMS.getDefaultOptions();
61
+ const defaultOptions = WMSLayer.getDefaultOptions();
63
62
 
64
63
  /** @type {string} */
65
64
  this.version = options.version || defaultOptions.version;
@@ -97,7 +96,7 @@ class WMS extends RasterLayer {
97
96
  this._featureInfoOptions = options.featureInfo || defaultOptions.featureInfo;
98
97
  this._supportedMaps = [
99
98
  CesiumMap.className,
100
- Openlayers.className,
99
+ OpenlayersMap.className,
101
100
  ];
102
101
  }
103
102
 
@@ -156,19 +155,19 @@ class WMS extends RasterLayer {
156
155
 
157
156
  /**
158
157
  * @param {import("@vcmap/core").VcsMap} map
159
- * @returns {Array<WMSCesium|WMSOpenlayers>}
158
+ * @returns {Array<WmsCesiumImpl|WmsOpenlayersImpl>}
160
159
  */
161
160
  createImplementationsForMap(map) {
162
161
  if (map instanceof CesiumMap) {
163
- return [new WMSCesium(map, this.getImplementationOptions())];
164
- } else if (map instanceof Openlayers) {
165
- return [new WMSOpenlayers(map, this.getImplementationOptions())];
162
+ return [new WmsCesiumImpl(map, this.getImplementationOptions())];
163
+ } else if (map instanceof OpenlayersMap) {
164
+ return [new WmsOpenlayersImpl(map, this.getImplementationOptions())];
166
165
  }
167
166
  return [];
168
167
  }
169
168
 
170
169
  /**
171
- * Sets the layers to request from the WMS
170
+ * Sets the layers to request from the WmsLayer
172
171
  * @param {string|Array<string>} layers - a layer name or an array of layer names
173
172
  * @returns {Promise<void>}
174
173
  * @api stable
@@ -194,7 +193,7 @@ class WMS extends RasterLayer {
194
193
  */
195
194
  toJSON() {
196
195
  const config = /** @type {WMSOptions} */ (super.toJSON());
197
- const defaultOptions = WMS.getDefaultOptions();
196
+ const defaultOptions = WMSLayer.getDefaultOptions();
198
197
 
199
198
  if (this.parameters.LAYERS) {
200
199
  config.layers = this.parameters.LAYERS;
@@ -266,5 +265,5 @@ class WMS extends RasterLayer {
266
265
  }
267
266
  }
268
267
 
269
- VcsClassRegistry.registerClass(WMS.className, WMS);
270
- export default WMS;
268
+ layerClassRegistry.registerClass(WMSLayer.className, WMSLayer);
269
+ export default WMSLayer;
@@ -1,16 +1,16 @@
1
1
  import { parseInteger } from '@vcsuite/parsers';
2
2
  import { getLogger } from '@vcsuite/logger';
3
3
  import RasterLayer from './rasterLayer.js';
4
- import Openlayers from '../maps/openlayers.js';
5
- import CesiumMap from '../maps/cesium.js';
6
- import WMTSOpenlayers from './openlayers/wmtsOpenlayers.js';
7
- import WMTSCesium from './cesium/wmtsCesium.js';
8
- import { VcsClassRegistry } from '../classRegistry.js';
4
+ import OpenlayersMap from '../map/openlayersMap.js';
5
+ import CesiumMap from '../map/cesiumMap.js';
6
+ import WmtsOpenlayersImpl from './openlayers/wmtsOpenlayersImpl.js';
7
+ import WmtsCesiumImpl from './cesium/wmtsCesiumImpl.js';
8
+ import { layerClassRegistry } from '../classRegistry.js';
9
9
 
10
10
  /**
11
11
  * @typedef {RasterLayerOptions} WMTSOptions
12
12
  * @property {string} layer
13
- * @property {string|undefined} style
13
+ * @property {string|undefined} [wmtsStyle]
14
14
  * @property {string|undefined} format
15
15
  * @property {string|undefined} tileMatrixSetID
16
16
  * @property {string|undefined} tileMatrixPrefix
@@ -47,7 +47,7 @@ function getMatrixIds(matrixIds, maxLevel, prefix) {
47
47
  if (matrixIds.length === (maxLevel + 1)) {
48
48
  return matrixIds;
49
49
  } else {
50
- getLogger('vcs.vcm.layer.cesium.WMTSCesium')
50
+ getLogger('WmtsCesiumImpl')
51
51
  .log('matrixIds must have the same length as maxLevel');
52
52
  }
53
53
  }
@@ -58,14 +58,13 @@ function getMatrixIds(matrixIds, maxLevel, prefix) {
58
58
 
59
59
 
60
60
  /**
61
- * WMTS layer
61
+ * WmtsLayer layer
62
62
  * @class
63
- * @export
64
63
  * @extends {RasterLayer}
65
64
  * @api stable
66
65
  */
67
- class WMTS extends RasterLayer {
68
- static get className() { return 'vcs.vcm.layer.WMTS'; }
66
+ class WMTSLayer extends RasterLayer {
67
+ static get className() { return 'WMTSLayer'; }
69
68
 
70
69
  /**
71
70
  * @returns {WMTSOptions}
@@ -77,7 +76,7 @@ class WMTS extends RasterLayer {
77
76
  numberOfLevelZeroTilesX: 1,
78
77
  numberOfLevelZeroTilesY: 1,
79
78
  layer: '',
80
- style: '',
79
+ wmtsStyle: '',
81
80
  format: '',
82
81
  tileMatrixPrefix: '',
83
82
  tileMatrixSetID: '',
@@ -91,12 +90,12 @@ class WMTS extends RasterLayer {
91
90
  * @param {WMTSOptions} options
92
91
  */
93
92
  constructor(options) {
94
- const defaultOptions = WMTS.getDefaultOptions();
93
+ const defaultOptions = WMTSLayer.getDefaultOptions();
95
94
  options.tilingSchema = options.tilingSchema || defaultOptions.tilingSchema;
96
95
  super(options);
97
96
 
98
97
  this._supportedMaps = [
99
- Openlayers.className,
98
+ OpenlayersMap.className,
100
99
  CesiumMap.className,
101
100
  ];
102
101
 
@@ -116,7 +115,7 @@ class WMTS extends RasterLayer {
116
115
  this.layer = options.layer || defaultOptions.layer;
117
116
 
118
117
  /** @type {string} */
119
- this.style = options.style || defaultOptions.style;
118
+ this.wmtsStyle = options.wmtsStyle || defaultOptions.wmtsStyle;
120
119
 
121
120
  /** @type {string} */
122
121
  this.format = options.format || defaultOptions.format;
@@ -145,7 +144,7 @@ class WMTS extends RasterLayer {
145
144
  return {
146
145
  ...super.getImplementationOptions(),
147
146
  layer: this.layer,
148
- style: this.style,
147
+ style: this.wmtsStyle,
149
148
  format: this.format,
150
149
  tileMatrixSetID: this.tileMatrixSetID,
151
150
  tileSize: this.tileSize,
@@ -159,15 +158,15 @@ class WMTS extends RasterLayer {
159
158
  /**
160
159
  * @inheritDoc
161
160
  * @param {import("@vcmap/core").VcsMap} map
162
- * @returns {Array<WMTSOpenlayers|WMTSCesium>}
161
+ * @returns {Array<WmtsOpenlayersImpl|WmtsCesiumImpl>}
163
162
  */
164
163
  createImplementationsForMap(map) {
165
- if (map instanceof Openlayers) {
166
- return [new WMTSOpenlayers(map, this.getImplementationOptions())];
164
+ if (map instanceof OpenlayersMap) {
165
+ return [new WmtsOpenlayersImpl(map, this.getImplementationOptions())];
167
166
  }
168
167
 
169
168
  if (map instanceof CesiumMap) {
170
- return [new WMTSCesium(map, this.getImplementationOptions())];
169
+ return [new WmtsCesiumImpl(map, this.getImplementationOptions())];
171
170
  }
172
171
  return [];
173
172
  }
@@ -178,7 +177,7 @@ class WMTS extends RasterLayer {
178
177
  */
179
178
  toJSON() {
180
179
  const config = /** @type {WMTSOptions} */ (super.toJSON());
181
- const defaultOptions = WMTS.getDefaultOptions();
180
+ const defaultOptions = WMTSLayer.getDefaultOptions();
182
181
 
183
182
  if (this.tilingSchema !== defaultOptions.tilingSchema) {
184
183
  config.tilingSchema = this.tilingSchema;
@@ -198,8 +197,8 @@ class WMTS extends RasterLayer {
198
197
  config.layer = this.layer;
199
198
  }
200
199
 
201
- if (this.style !== defaultOptions.style) {
202
- config.style = this.style;
200
+ if (this.wmtsStyle !== defaultOptions.wmtsStyle) {
201
+ config.wmtsStyle = this.wmtsStyle;
203
202
  }
204
203
 
205
204
  if (this.format !== defaultOptions.format) {
@@ -230,6 +229,6 @@ class WMTS extends RasterLayer {
230
229
  }
231
230
  }
232
231
 
233
- VcsClassRegistry.registerClass(WMTS.className, WMTS);
234
- export default WMTS;
232
+ layerClassRegistry.registerClass(WMTSLayer.className, WMTSLayer);
233
+ export default WMTSLayer;
235
234
 
@@ -2,10 +2,10 @@ import { Cartesian2 } from '@vcmap/cesium';
2
2
  import { unByKey } from 'ol/Observable.js';
3
3
  import OLMap from 'ol/Map.js';
4
4
  import { defaults as defaultInteractions } from 'ol/interaction.js';
5
- import VcsMap from './map.js';
5
+ import VcsMap from './vcsMap.js';
6
6
  import { vcsLayerName } from '../layer/layerSymbols.js';
7
7
  import { ModificationKeyType, PointerEventType, PointerKeyType } from '../interaction/interactionType.js';
8
- import { VcsClassRegistry } from '../classRegistry.js';
8
+ import { mapClassRegistry } from '../classRegistry.js';
9
9
 
10
10
  /**
11
11
  * @param {import("ol/Collection").default<import("ol/layer/Layer").default>} layers
@@ -32,15 +32,14 @@ export function ensureLayerInCollection(layers, layer, layerCollection) {
32
32
  }
33
33
 
34
34
  /**
35
- * Openlayers Map base map.
35
+ * OpenlayersMap Map base map.
36
36
  * @class
37
37
  * @abstract
38
38
  * @api
39
- * @export
40
39
  * @extends {VcsMap}
41
40
  */
42
41
  class BaseOLMap extends VcsMap {
43
- static get className() { return 'vcs.vcm.maps.BaseOLMap'; }
42
+ static get className() { return 'BaseOLMap'; }
44
43
 
45
44
  /**
46
45
  * @param {VcsMapOptions} options
@@ -253,5 +252,5 @@ class BaseOLMap extends VcsMap {
253
252
  }
254
253
  }
255
254
 
256
- VcsClassRegistry.registerClass(BaseOLMap.className, BaseOLMap);
255
+ mapClassRegistry.registerClass(BaseOLMap.className, BaseOLMap);
257
256
  export default BaseOLMap;