@vcmap/core 5.0.0-rc.1 → 5.0.0-rc.12

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 (185) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +3 -2
  3. package/index.d.ts +2085 -1969
  4. package/index.js +137 -131
  5. package/package.json +14 -22
  6. package/src/category/appBackedCategory.js +76 -0
  7. package/src/category/category.js +417 -0
  8. package/src/category/categoryCollection.js +145 -0
  9. package/src/cesium/cesium3DTileFeature.js +1 -1
  10. package/src/classRegistry.js +162 -0
  11. package/src/context.js +72 -0
  12. package/src/{vcs/vcm/util/featureProvider → featureProvider}/abstractFeatureProvider.js +8 -9
  13. package/src/{vcs/vcm/util/featureProvider → featureProvider}/featureProviderHelpers.js +4 -5
  14. package/src/{vcs/vcm/util/featureProvider → featureProvider}/featureProviderSymbols.js +0 -0
  15. package/src/{vcs/vcm/util/featureProvider → featureProvider}/tileProviderFeatureProvider.js +4 -2
  16. package/src/{vcs/vcm/util/featureProvider → featureProvider}/wmsFeatureProvider.js +25 -18
  17. package/src/{vcs/vcm/interaction → interaction}/abstractInteraction.js +19 -18
  18. package/src/{vcs/vcm/interaction → interaction}/coordinateAtPixel.js +6 -9
  19. package/src/{vcs/vcm/interaction → interaction}/eventHandler.js +3 -3
  20. package/src/{vcs/vcm/interaction → interaction}/featureAtPixelInteraction.js +6 -19
  21. package/src/{vcs/vcm/interaction → interaction}/featureProviderInteraction.js +2 -13
  22. package/src/{vcs/vcm/interaction → interaction}/interactionChain.js +11 -32
  23. package/src/{vcs/vcm/interaction → interaction}/interactionType.js +1 -5
  24. package/src/{vcs/vcm/layer/cesium/cesiumTilesetCesium.js → layer/cesium/cesiumTilesetCesiumImpl.js} +10 -13
  25. package/src/{vcs/vcm/layer → layer}/cesium/clusterContext.js +0 -0
  26. package/src/{vcs/vcm/layer/cesium/dataSourceCesium.js → layer/cesium/dataSourceCesiumImpl.js} +5 -3
  27. package/src/{vcs/vcm/layer/cesium/openStreetMapCesium.js → layer/cesium/openStreetMapCesiumImpl.js} +6 -7
  28. package/src/{vcs/vcm/layer/cesium/rasterLayerCesium.js → layer/cesium/rasterLayerCesiumImpl.js} +5 -6
  29. package/src/{vcs/vcm/layer/cesium/singleImageCesium.js → layer/cesium/singleImageCesiumImpl.js} +5 -6
  30. package/src/{vcs/vcm/layer/cesium/terrainCesium.js → layer/cesium/terrainCesiumImpl.js} +4 -5
  31. package/src/{vcs/vcm/layer/cesium/tmsCesium.js → layer/cesium/tmsCesiumImpl.js} +6 -7
  32. package/src/{vcs/vcm/layer/cesium/vectorCesium.js → layer/cesium/vectorCesiumImpl.js} +6 -7
  33. package/src/{vcs/vcm/layer → layer}/cesium/vectorContext.js +0 -0
  34. package/src/{vcs/vcm/layer/cesium/vectorRasterTileCesium.js → layer/cesium/vectorRasterTileCesiumImpl.js} +5 -6
  35. package/src/{vcs/vcm/layer → layer}/cesium/vectorTileImageryProvider.js +1 -2
  36. package/src/{vcs/vcm/layer/cesium/wmsCesium.js → layer/cesium/wmsCesiumImpl.js} +6 -7
  37. package/src/{vcs/vcm/layer/cesium/wmtsCesium.js → layer/cesium/wmtsCesiumImpl.js} +6 -7
  38. package/src/{vcs/vcm/layer → layer}/cesium/x3dmHelper.js +0 -0
  39. package/src/{vcs/vcm/layer/cesiumTileset.js → layer/cesiumTilesetLayer.js} +38 -37
  40. package/src/{vcs/vcm/layer/czml.js → layer/czmlLayer.js} +14 -17
  41. package/src/{vcs/vcm/layer/dataSource.js → layer/dataSourceLayer.js} +38 -29
  42. package/src/{vcs/vcm/layer → layer}/featureLayer.js +27 -31
  43. package/src/{vcs/vcm/layer/featureStore.js → layer/featureStoreLayer.js} +54 -54
  44. package/src/{vcs/vcm/layer/featureStoreChanges.js → layer/featureStoreLayerChanges.js} +98 -82
  45. package/src/{vcs/vcm/layer/featureStoreState.js → layer/featureStoreLayerState.js} +1 -2
  46. package/src/{vcs/vcm/layer → layer}/featureVisibility.js +9 -6
  47. package/src/{vcs/vcm/layer → layer}/geojsonHelpers.js +15 -41
  48. package/src/{vcs/vcm/layer/geojson.js → layer/geojsonLayer.js} +19 -22
  49. package/src/{vcs/vcm/layer → layer}/globalHider.js +8 -32
  50. package/src/{vcs/vcm/layer → layer}/layer.js +63 -20
  51. package/src/{vcs/vcm/layer → layer}/layerImplementation.js +2 -3
  52. package/src/{vcs/vcm/layer → layer}/layerState.js +0 -1
  53. package/src/{vcs/vcm/layer → layer}/layerSymbols.js +0 -0
  54. package/src/{vcs/vcm/layer/oblique/layerOblique.js → layer/oblique/layerObliqueImpl.js} +4 -4
  55. package/src/{vcs/vcm/layer → layer}/oblique/obliqueHelpers.js +2 -2
  56. package/src/{vcs/vcm/layer/oblique/vectorOblique.js → layer/oblique/vectorObliqueImpl.js} +7 -9
  57. package/src/{vcs/vcm/layer/openStreetMap.js → layer/openStreetMapLayer.js} +32 -33
  58. package/src/{vcs/vcm/layer/openlayers/layerOpenlayers.js → layer/openlayers/layerOpenlayersImpl.js} +5 -6
  59. package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +26 -0
  60. package/src/{vcs/vcm/layer/openlayers/rasterLayerOpenlayers.js → layer/openlayers/rasterLayerOpenlayersImpl.js} +15 -14
  61. package/src/{vcs/vcm/layer/openlayers/singleImageOpenlayers.js → layer/openlayers/singleImageOpenlayersImpl.js} +6 -7
  62. package/src/{vcs/vcm/layer/openlayers/tileDebugOpenlayers.js → layer/openlayers/tileDebugOpenlayersImpl.js} +5 -6
  63. package/src/{vcs/vcm/layer/openlayers/tmsOpenlayers.js → layer/openlayers/tmsOpenlayersImpl.js} +7 -8
  64. package/src/{vcs/vcm/layer/openlayers/vectorOpenlayers.js → layer/openlayers/vectorOpenlayersImpl.js} +8 -9
  65. package/src/{vcs/vcm/layer/openlayers/vectorTileOpenlayers.js → layer/openlayers/vectorTileOpenlayersImpl.js} +6 -7
  66. package/src/{vcs/vcm/layer/openlayers/wmsOpenlayers.js → layer/openlayers/wmsOpenlayersImpl.js} +7 -8
  67. package/src/{vcs/vcm/layer/openlayers/wmtsOpenlayers.js → layer/openlayers/wmtsOpenlayersImpl.js} +7 -8
  68. package/src/{vcs/vcm/layer/pointCloud.js → layer/pointCloudLayer.js} +26 -34
  69. package/src/{vcs/vcm/layer → layer}/rasterLayer.js +18 -20
  70. package/src/{vcs/vcm/layer/singleImage.js → layer/singleImageLayer.js} +20 -20
  71. package/src/{vcs/vcm/layer → layer}/terrainHelpers.js +13 -49
  72. package/src/{vcs/vcm/layer/terrain.js → layer/terrainLayer.js} +13 -14
  73. package/src/{vcs/vcm/layer → layer}/tileLoadedHelper.js +5 -5
  74. package/src/{vcs/vcm/layer → layer}/tileProvider/mvtTileProvider.js +22 -5
  75. package/src/layer/tileProvider/staticGeojsonTileProvider.js +81 -0
  76. package/src/{vcs/vcm/layer → layer}/tileProvider/tileProvider.js +16 -8
  77. package/src/{vcs/vcm/layer → layer}/tileProvider/urlTemplateTileProvider.js +20 -6
  78. package/src/{vcs/vcm/layer/tms.js → layer/tmsLayer.js} +19 -20
  79. package/src/{vcs/vcm/layer → layer}/vectorHelpers.js +5 -5
  80. package/src/{vcs/vcm/layer/vector.js → layer/vectorLayer.js} +38 -48
  81. package/src/{vcs/vcm/layer → layer}/vectorProperties.js +3 -4
  82. package/src/{vcs/vcm/layer → layer}/vectorSymbols.js +0 -0
  83. package/src/{vcs/vcm/layer/vectorTile.js → layer/vectorTileLayer.js} +55 -54
  84. package/src/{vcs/vcm/layer/wfs.js → layer/wfsLayer.js} +19 -20
  85. package/src/{vcs/vcm/layer → layer}/wmsHelpers.js +1 -1
  86. package/src/{vcs/vcm/layer/wms.js → layer/wmsLayer.js} +22 -23
  87. package/src/{vcs/vcm/layer/wmts.js → layer/wmtsLayer.js} +20 -21
  88. package/src/{vcs/vcm/maps → map}/baseOLMap.js +5 -6
  89. package/src/{vcs/vcm/maps → map}/cameraLimiter.js +11 -17
  90. package/src/{vcs/vcm/maps/cesium.js → map/cesiumMap.js} +21 -34
  91. package/src/{vcs/vcm/maps → map}/mapState.js +0 -1
  92. package/src/{vcs/vcm/maps/oblique.js → map/obliqueMap.js} +42 -57
  93. package/src/{vcs/vcm/maps/openlayers.js → map/openlayersMap.js} +17 -15
  94. package/src/{vcs/vcm/maps/map.js → map/vcsMap.js} +41 -22
  95. package/src/oblique/defaultObliqueCollection.js +62 -0
  96. package/src/{vcs/vcm/oblique → oblique}/helpers.js +13 -44
  97. package/src/{vcs/vcm/oblique/ObliqueCollection.js → oblique/obliqueCollection.js} +117 -37
  98. package/src/{vcs/vcm/oblique/ObliqueDataSet.js → oblique/obliqueDataSet.js} +67 -26
  99. package/src/{vcs/vcm/oblique/ObliqueImage.js → oblique/obliqueImage.js} +1 -2
  100. package/src/{vcs/vcm/oblique/ObliqueImageMeta.js → oblique/obliqueImageMeta.js} +4 -5
  101. package/src/{vcs/vcm/oblique/ObliqueProvider.js → oblique/obliqueProvider.js} +17 -12
  102. package/src/{vcs/vcm/oblique/ObliqueView.js → oblique/obliqueView.js} +31 -2
  103. package/src/{vcs/vcm/oblique/ObliqueViewDirection.js → oblique/obliqueViewDirection.js} +0 -3
  104. package/src/{vcs/vcm/oblique → oblique}/parseImageJson.js +20 -12
  105. package/src/ol/geom/circle.js +1 -1
  106. package/src/ol/render/canvas/canvasTileRenderer.js +0 -1
  107. package/src/overrideClassRegistry.js +204 -0
  108. package/src/{vcs/vcm/util/style → style}/declarativeStyleItem.js +43 -20
  109. package/src/{vcs/vcm/util/style → style}/shapesCategory.js +0 -2
  110. package/src/style/styleFactory.js +29 -0
  111. package/src/{vcs/vcm/util/style → style}/styleHelpers.js +3 -14
  112. package/src/{vcs/vcm/util/style → style}/styleItem.js +23 -86
  113. package/src/{vcs/vcm/util/style → style}/vectorStyleItem.js +73 -85
  114. package/src/{vcs/vcm/util/style → style}/writeStyle.js +4 -7
  115. package/src/{vcs/vcm/util → util}/clipping/clippingObject.js +10 -12
  116. package/src/{vcs/vcm/util → util}/clipping/clippingObjectManager.js +2 -3
  117. package/src/{vcs/vcm/util → util}/clipping/clippingPlaneHelper.js +4 -8
  118. package/src/{vcs/vcm/util → util}/collection.js +16 -4
  119. package/src/{vcs/vcm/util → util}/dateTime.js +0 -0
  120. package/src/{vcs/vcm/util → util}/exclusiveManager.js +0 -0
  121. package/src/{vcs/vcm/util → util}/extent.js +18 -12
  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 +3 -3
  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 +49 -12
  134. package/src/{vcs/vcm/util → util}/locale.js +1 -1
  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 +39 -29
  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 +5 -9
  142. package/src/vcsApp.js +471 -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} +2 -10
  146. package/tests/data/buildings/tileset.json +428 -0
  147. package/tests/data/dynamicPointCzml.json +64 -0
  148. package/tests/data/oblique/imageData/imagev34.json +352 -0
  149. package/tests/data/oblique/imageData/imagev35.json +54 -0
  150. package/tests/data/oblique/imageData/imagev35PerImageSize.json +53 -0
  151. package/tests/data/oblique/tiledImageData/12/2199/1342.json +1 -0
  152. package/tests/data/oblique/tiledImageData/12/2199/1343.json +1 -0
  153. package/tests/data/oblique/tiledImageData/12/2199/1344.json +1 -0
  154. package/tests/data/oblique/tiledImageData/12/2200/1342.json +1 -0
  155. package/tests/data/oblique/tiledImageData/12/2200/1343.json +1 -0
  156. package/tests/data/oblique/tiledImageData/12/2200/1344.json +1 -0
  157. package/tests/data/oblique/tiledImageData/12/2201/1342.json +1 -0
  158. package/tests/data/oblique/tiledImageData/12/2201/1343.json +1 -0
  159. package/tests/data/oblique/tiledImageData/12/2201/1344.json +1 -0
  160. package/tests/data/oblique/tiledImageData/image.json +1 -0
  161. package/tests/data/terrain/13/8800/6485.terrain +0 -0
  162. package/tests/data/terrain/13/8800/6486.terrain +0 -0
  163. package/tests/data/terrain/13/8801/6485.terrain +0 -0
  164. package/tests/data/terrain/13/8801/6486.terrain +0 -0
  165. package/tests/data/terrain/layer.json +136 -0
  166. package/tests/data/testGeoJSON.json +161 -0
  167. package/tests/data/tile.pbf +0 -0
  168. package/tests/unit/helpers/cesiumHelpers.js +272 -0
  169. package/tests/unit/helpers/getFileNameFromUrl.js +12 -0
  170. package/tests/unit/helpers/helpers.js +11 -0
  171. package/tests/unit/helpers/imageHelpers.js +20 -0
  172. package/tests/unit/helpers/importJSON.js +15 -0
  173. package/tests/unit/helpers/obliqueData.js +76 -0
  174. package/tests/unit/helpers/obliqueHelpers.js +112 -0
  175. package/tests/unit/helpers/openlayersHelpers.js +22 -0
  176. package/tests/unit/helpers/terrain/terrainData.js +46 -0
  177. package/src/vcs/vcm/classRegistry.js +0 -106
  178. package/src/vcs/vcm/globalCollections.js +0 -11
  179. package/src/vcs/vcm/layer/buildings.js +0 -17
  180. package/src/vcs/vcm/layer/cesium/pointCloudCesium.js +0 -58
  181. package/src/vcs/vcm/layer/openlayers/openStreetMapOpenlayers.js +0 -27
  182. package/src/vcs/vcm/layer/tileProvider/staticGeojsonTileProvider.js +0 -67
  183. package/src/vcs/vcm/layer/tileProvider/tileProviderFactory.js +0 -28
  184. package/src/vcs/vcm/util/featureconverter/extent3d.js +0 -154
  185. 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,13 @@ 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);
146
141
 
147
142
  /**
148
143
  * @type {number|undefined}
@@ -160,7 +155,7 @@ class VectorTile extends FeatureLayer {
160
155
  * @type {Array<Function>}
161
156
  * @private
162
157
  */
163
- this._featureVisibilityListener = [];
158
+ this._featureVisibilityListeners = [];
164
159
 
165
160
  /**
166
161
  * @type {Function}
@@ -187,21 +182,19 @@ class VectorTile extends FeatureLayer {
187
182
  * @returns {Promise<void>}
188
183
  */
189
184
  async initialize() {
190
- await super.initialize();
191
- if (!this.tileProvider) {
192
- this.tileProvider = await tileProviderFactory(this._tileProviderOptions);
193
- // this.tileProvider = await tileProviderFactory(this._tileProviderOptions);
185
+ if (!this.initialized) {
194
186
  this._tileLoadEventListener =
195
187
  this.tileProvider.tileLoadedEvent.addEventListener(event => this._handleTileLoaded(event));
196
188
  this._vectorPropertiesChangedListener =
197
189
  this.vectorProperties.propertyChanged.addEventListener(() => {
198
190
  this.reload();
199
191
  });
200
- this.featureProvider = new TileProviderFeatureProvider(this.name, {
192
+ this.featureProvider = new TileProviderFeatureProvider(this.name, { // XXX this overwrites
201
193
  tileProvider: this.tileProvider,
202
194
  vectorProperties: this.vectorProperties,
203
195
  });
204
196
  }
197
+ await super.initialize();
205
198
  }
206
199
 
207
200
 
@@ -261,15 +254,24 @@ class VectorTile extends FeatureLayer {
261
254
  }
262
255
 
263
256
  /**
264
- *
265
- * @returns {Array<Function>}
257
+ * @param {import("@vcmap/core").GlobalHider} globalHider
258
+ */
259
+ setGlobalHider(globalHider) {
260
+ super.setGlobalHider(globalHider);
261
+ this._setupFeatureVisibilityHandlers();
262
+ }
263
+
264
+ /**
265
+ * Sets up listeners for featureVisibility and global hider
266
266
  * @private
267
267
  */
268
268
  _setupFeatureVisibilityHandlers() {
269
269
  if (!this.tileProvider.trackFeaturesToTiles) {
270
- return [];
270
+ return;
271
271
  }
272
- return [
272
+ this._featureVisibilityListeners.forEach((cb) => { cb(); });
273
+
274
+ this._featureVisibilityListeners = [
273
275
  this.featureVisibility.changed.addEventListener(({ action, ids }) => {
274
276
  const tileIdsChanged = new Set();
275
277
  ids.forEach((id) => {
@@ -296,8 +298,10 @@ class VectorTile extends FeatureLayer {
296
298
  });
297
299
  this.updateTiles([...tileIdsChanged]);
298
300
  }),
301
+ ];
299
302
 
300
- this.globalHider.changed.addEventListener(({ action, ids }) => {
303
+ if (this.globalHider) {
304
+ this._featureVisibilityListeners.push(this.globalHider.changed.addEventListener(({ action, ids }) => {
301
305
  const tileIdsChanged = new Set();
302
306
  ids.forEach((id) => {
303
307
  const tileIds = this.tileProvider.featureIdToTileIds.get(id);
@@ -318,8 +322,8 @@ class VectorTile extends FeatureLayer {
318
322
  }
319
323
  });
320
324
  this.updateTiles([...tileIdsChanged]);
321
- }),
322
- ];
325
+ }));
326
+ }
323
327
  }
324
328
 
325
329
  /**
@@ -375,16 +379,16 @@ class VectorTile extends FeatureLayer {
375
379
  /**
376
380
  * @inheritDoc
377
381
  * @param {import("@vcmap/core").VcsMap} map
378
- * @returns {Array<VectorRasterTileCesium|VectorTileOpenlayers>}
382
+ * @returns {Array<VectorRasterTileCesiumImpl|VectorTileOpenlayersImpl>}
379
383
  */
380
384
  createImplementationsForMap(map) {
381
385
  if (map instanceof CesiumMap) {
382
- return [new VectorRasterTileCesium(map, this.getImplementationOptions())];
386
+ return [new VectorRasterTileCesiumImpl(map, this.getImplementationOptions())];
383
387
  }
384
388
 
385
- if (map instanceof Openlayers) {
389
+ if (map instanceof OpenlayersMap) {
386
390
  return [
387
- new VectorTileOpenlayers(map, this.getImplementationOptions()),
391
+ new VectorTileOpenlayersImpl(map, this.getImplementationOptions()),
388
392
  ];
389
393
  }
390
394
 
@@ -392,7 +396,7 @@ class VectorTile extends FeatureLayer {
392
396
  }
393
397
 
394
398
  /**
395
- * @param {(Reference|DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem|string)=} styleOptions
399
+ * @param {(DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem)=} styleOptions
396
400
  * @param {VectorStyleItem=} defaultStyle
397
401
  * @returns {import("@vcmap/core").StyleItem}
398
402
  */
@@ -407,8 +411,8 @@ class VectorTile extends FeatureLayer {
407
411
  */
408
412
  async activate() {
409
413
  await super.activate();
410
- this._featureVisibilityListener = this._setupFeatureVisibilityHandlers();
411
- if (this.tileProvider.trackFeaturesToTiles) {
414
+ this._setupFeatureVisibilityHandlers();
415
+ if (this.tileProvider.trackFeaturesToTiles && this.globalHider) {
412
416
  this.tileProvider.forEachFeature((feature) => {
413
417
  synchronizeFeatureVisibility(this.featureVisibility, this.globalHider, feature);
414
418
  });
@@ -421,7 +425,7 @@ class VectorTile extends FeatureLayer {
421
425
  */
422
426
  deactivate() {
423
427
  super.deactivate();
424
- this._featureVisibilityListener.forEach((cb) => { cb(); });
428
+ this._featureVisibilityListeners.forEach((cb) => { cb(); });
425
429
  }
426
430
 
427
431
  /**
@@ -429,7 +433,7 @@ class VectorTile extends FeatureLayer {
429
433
  * @api
430
434
  */
431
435
  destroy() {
432
- this._featureVisibilityListener.forEach((cb) => { cb(); });
436
+ this._featureVisibilityListeners.forEach((cb) => { cb(); });
433
437
  super.destroy();
434
438
  this._tileLoadEventListener();
435
439
  if (this.featureProvider) {
@@ -448,9 +452,9 @@ class VectorTile extends FeatureLayer {
448
452
  * @inheritDoc
449
453
  * @returns {VectorTileOptions}
450
454
  */
451
- getConfigObject() {
452
- const config = /** @type {VectorTileOptions} */ (super.getConfigObject());
453
- const defaultOptions = VectorTile.getDefaultOptions();
455
+ toJSON() {
456
+ const config = /** @type {VectorTileOptions} */ (super.toJSON());
457
+ const defaultOptions = VectorTileLayer.getDefaultOptions();
454
458
 
455
459
  if (this._maxLevel !== defaultOptions.maxLevel) {
456
460
  config.maxLevel = this._maxLevel;
@@ -466,15 +470,12 @@ class VectorTile extends FeatureLayer {
466
470
  }
467
471
 
468
472
  if (this.tileProvider) {
469
- const tileProviderConfig = this.tileProvider.getConfigObject();
470
- config.tileProvider = tileProviderConfig;
471
- } else if (this._tileProviderOptions) {
472
- config.tileProvider = this._tileProviderOptions;
473
+ config.tileProvider = this.tileProvider.toJSON();
473
474
  }
474
475
 
475
476
  return config;
476
477
  }
477
478
  }
478
479
 
479
- VcsClassRegistry.registerClass(VectorTile.className, VectorTile);
480
- export default VectorTile;
480
+ layerClassRegistry.registerClass(VectorTileLayer.className, VectorTileLayer);
481
+ 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: '',
@@ -40,7 +39,7 @@ class WFS extends Vector {
40
39
  * @param {WFSOptions} options
41
40
  */
42
41
  constructor(options) {
43
- const proj = new Projection(options.projection).getConfigObject();
42
+ const proj = new Projection(options.projection).toJSON();
44
43
  proj.alias = [`http://www.opengis.net/gml/srs/epsg.xml#${/** @type {string} */ (proj.epsg).match(/\d+/)[0]}`];
45
44
  options.projection = proj;
46
45
  super(options);
@@ -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
  /**
@@ -148,8 +147,8 @@ class WFS extends Vector {
148
147
  * @inheritDoc
149
148
  * @returns {WFSOptions}
150
149
  */
151
- getConfigObject() {
152
- const config = /** @type {WFSOptions} */ (super.getConfigObject());
150
+ toJSON() {
151
+ const config = /** @type {WFSOptions} */ (super.toJSON());
153
152
 
154
153
  config.featureType = this.featureType.slice();
155
154
  config.featureNS = this.featureNS;
@@ -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
@@ -192,9 +191,9 @@ class WMS extends RasterLayer {
192
191
  /**
193
192
  * @returns {WMSOptions}
194
193
  */
195
- getConfigObject() {
196
- const config = /** @type {WMSOptions} */ (super.getConfigObject());
197
- const defaultOptions = WMS.getDefaultOptions();
194
+ toJSON() {
195
+ const config = /** @type {WMSOptions} */ (super.toJSON());
196
+ const defaultOptions = WMSLayer.getDefaultOptions();
198
197
 
199
198
  if (this.parameters.LAYERS) {
200
199
  config.layers = this.parameters.LAYERS;
@@ -229,7 +228,7 @@ class WMS extends RasterLayer {
229
228
  }
230
229
 
231
230
  if (this.featureProvider && this.featureProvider instanceof WMSFeatureProvider) {
232
- const featureInfoConfig = this.featureProvider.getConfigObject();
231
+ const featureInfoConfig = this.featureProvider.toJSON();
233
232
  if (this.tileSize[0] === featureInfoConfig.tileSize[0] || this.tileSize[1] === featureInfoConfig.tileSize[1]) {
234
233
  delete featureInfoConfig.tileSize;
235
234
  }
@@ -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,11 +1,11 @@
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
@@ -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}
@@ -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
 
@@ -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
  }
@@ -176,9 +175,9 @@ class WMTS extends RasterLayer {
176
175
  * @inheritDoc
177
176
  * @returns {WMTSOptions}
178
177
  */
179
- getConfigObject() {
180
- const config = /** @type {WMTSOptions} */ (super.getConfigObject());
181
- const defaultOptions = WMTS.getDefaultOptions();
178
+ toJSON() {
179
+ const config = /** @type {WMTSOptions} */ (super.toJSON());
180
+ const defaultOptions = WMTSLayer.getDefaultOptions();
182
181
 
183
182
  if (this.tilingSchema !== defaultOptions.tilingSchema) {
184
183
  config.tilingSchema = this.tilingSchema;
@@ -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;