@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,18 +1,17 @@
1
- import { ImagerySplitDirection, Matrix4 } from '@vcmap/cesium';
1
+ import { SplitDirection, Matrix4 } from '@vcmap/cesium';
2
2
 
3
3
  import { checkMaybe } from '@vcsuite/check';
4
4
  import { parseInteger } from '@vcsuite/parsers';
5
5
  import getJSONObjectFromObject from './cesium/x3dmHelper.js';
6
- import VectorStyleItem from '../util/style/vectorStyleItem.js';
6
+ import VectorStyleItem from '../style/vectorStyleItem.js';
7
7
  import FeatureLayer from './featureLayer.js';
8
- import CesiumTilesetCesium, { getExtentFromTileset } from './cesium/cesiumTilesetCesium.js';
9
- import CesiumMap from '../maps/cesium.js';
10
- import VcsEvent from '../event/vcsEvent.js';
8
+ import CesiumTilesetCesiumImpl, { getExtentFromTileset } from './cesium/cesiumTilesetCesiumImpl.js';
9
+ import CesiumMap from '../map/cesiumMap.js';
10
+ import VcsEvent from '../vcsEvent.js';
11
11
  import Extent from '../util/extent.js';
12
12
  import { mercatorProjection } from '../util/projection.js';
13
13
  import { isMobile } from '../util/isMobile.js';
14
- import { referenceableStyleSymbol } from '../util/style/styleItem.js';
15
- import { VcsClassRegistry } from '../classRegistry.js';
14
+ import { layerClassRegistry } from '../classRegistry.js';
16
15
 
17
16
  /**
18
17
  * @typedef {LayerOptions} CesiumTilesetOptions
@@ -37,7 +36,7 @@ import { VcsClassRegistry } from '../classRegistry.js';
37
36
  /**
38
37
  * @typedef {FeatureLayerImplementationOptions} CesiumTilesetImplementationOptions
39
38
  * @property {Object|undefined} tilesetOptions
40
- * @property {import("@vcmap/cesium").ImagerySplitDirection} splitDirection
39
+ * @property {import("@vcmap/cesium").SplitDirection} splitDirection
41
40
  * @property {Array<CesiumTilesetTilesetProperties>|undefined} tilesetProperties
42
41
  * @property {import("@vcmap/cesium").Matrix4|undefined} modelMatrix
43
42
  * @property {import("ol/coordinate").Coordinate|undefined} offset
@@ -50,11 +49,10 @@ import { VcsClassRegistry } from '../classRegistry.js';
50
49
  * @extends {FeatureLayer}
51
50
  * @implements {SplitLayer}
52
51
  * @api stable
53
- * @export
54
52
  */
55
- class CesiumTileset extends FeatureLayer {
53
+ class CesiumTilesetLayer extends FeatureLayer {
56
54
  /** @type {string} */
57
- static get className() { return 'vcs.vcm.layer.CesiumTileset'; }
55
+ static get className() { return 'CesiumTilesetLayer'; }
58
56
 
59
57
  /**
60
58
  * @returns {CesiumTilesetOptions}
@@ -80,7 +78,7 @@ class CesiumTileset extends FeatureLayer {
80
78
  this._supportedMaps = [
81
79
  CesiumMap.className,
82
80
  ];
83
- const defaultOptions = CesiumTileset.getDefaultOptions();
81
+ const defaultOptions = CesiumTilesetLayer.getDefaultOptions();
84
82
  if (this.url && !/\.json$/.test(this.url)) {
85
83
  this.url = `${this.url.replace(/\/$/, '')}/tileset.json`;
86
84
  }
@@ -111,18 +109,18 @@ class CesiumTileset extends FeatureLayer {
111
109
  ...tilesetOptions,
112
110
  };
113
111
 
114
- /** @type {import("@vcmap/cesium").ImagerySplitDirection} */
115
- this._splitDirection = ImagerySplitDirection.NONE;
112
+ /** @type {import("@vcmap/cesium").SplitDirection} */
113
+ this._splitDirection = SplitDirection.NONE;
116
114
 
117
115
  if (options.splitDirection) {
118
116
  this._splitDirection = options.splitDirection === 'left' ?
119
- ImagerySplitDirection.LEFT :
120
- ImagerySplitDirection.RIGHT;
117
+ SplitDirection.LEFT :
118
+ SplitDirection.RIGHT;
121
119
  }
122
120
 
123
121
  /**
124
122
  * raised if the split direction changes, is passed the split direction as its only argument
125
- * @type {VcsEvent<import("@vcmap/cesium").ImagerySplitDirection>}
123
+ * @type {VcsEvent<import("@vcmap/cesium").SplitDirection>}
126
124
  * @api
127
125
  */
128
126
  this.splitDirectionChanged = new VcsEvent();
@@ -158,7 +156,7 @@ class CesiumTileset extends FeatureLayer {
158
156
 
159
157
  this._modelMatrix = modelMatrix;
160
158
  this.getImplementations()
161
- .forEach(/** @param {CesiumTilesetCesium} impl */ (impl) => {
159
+ .forEach(/** @param {CesiumTilesetCesiumImpl} impl */ (impl) => {
162
160
  impl.updateModelMatrix(modelMatrix);
163
161
  });
164
162
  }
@@ -182,30 +180,35 @@ class CesiumTileset extends FeatureLayer {
182
180
 
183
181
  this._offset = offset;
184
182
  this.getImplementations()
185
- .forEach(/** @param {CesiumTilesetCesium} impl */ (impl) => {
183
+ .forEach(/** @param {CesiumTilesetCesiumImpl} impl */ (impl) => {
186
184
  impl.updateOffset(offset);
187
185
  });
188
186
  }
189
187
 
190
188
  /**
191
189
  * @api
192
- * @type {import("@vcmap/cesium").ImagerySplitDirection}
190
+ * @type {import("@vcmap/cesium").SplitDirection}
193
191
  */
194
192
  get splitDirection() { return this._splitDirection; }
195
193
 
196
194
  /**
197
- * @param {import("@vcmap/cesium").ImagerySplitDirection} direction
195
+ * @param {import("@vcmap/cesium").SplitDirection} direction
198
196
  */
199
197
  set splitDirection(direction) {
200
198
  if (direction !== this._splitDirection) {
201
199
  this.getImplementations().forEach((impl) => {
202
- /** @type {CesiumTilesetCesium} */ (impl).updateSplitDirection(direction);
200
+ /** @type {CesiumTilesetCesiumImpl} */ (impl).updateSplitDirection(direction);
203
201
  });
204
202
  this._splitDirection = direction;
205
203
  this.splitDirectionChanged.raiseEvent(this._splitDirection);
206
204
  }
207
205
  }
208
206
 
207
+ async initialize() {
208
+ await this.style.cesiumStyle.readyPromise;
209
+ return super.initialize();
210
+ }
211
+
209
212
  /**
210
213
  * @inheritDoc
211
214
  * @returns {CesiumTilesetImplementationOptions}
@@ -223,11 +226,11 @@ class CesiumTileset extends FeatureLayer {
223
226
  /**
224
227
  * @inheritDoc
225
228
  * @param {import("@vcmap/core").VcsMap} map
226
- * @returns {Array<CesiumTilesetCesium>}
229
+ * @returns {Array<CesiumTilesetCesiumImpl>}
227
230
  */
228
231
  createImplementationsForMap(map) {
229
232
  if (map instanceof CesiumMap) {
230
- return [new CesiumTilesetCesium(map, this.getImplementationOptions())];
233
+ return [new CesiumTilesetCesiumImpl(map, this.getImplementationOptions())];
231
234
  }
232
235
  return [];
233
236
  }
@@ -261,12 +264,12 @@ class CesiumTileset extends FeatureLayer {
261
264
  if (metaExtent) {
262
265
  return metaExtent;
263
266
  }
264
- const impl = /** @type {CesiumTilesetCesium} */ (this.getImplementations()[0]);
267
+ const impl = /** @type {CesiumTilesetCesiumImpl} */ (this.getImplementations()[0]);
265
268
  if (impl) {
266
269
  const threeDimExtent = getExtentFromTileset(impl.cesium3DTileset);
267
270
 
268
271
  const actualExtent = new Extent({
269
- ...mercatorProjection.toJSON(),
272
+ projection: mercatorProjection.toJSON(),
270
273
  coordinates: threeDimExtent,
271
274
  });
272
275
 
@@ -299,7 +302,7 @@ class CesiumTileset extends FeatureLayer {
299
302
  */
300
303
  setMaximumScreenSpaceError(value) {
301
304
  this.getImplementations()
302
- .forEach(/** @param {CesiumTilesetCesium} impl */(impl) => {
305
+ .forEach(/** @param {CesiumTilesetCesiumImpl} impl */(impl) => {
303
306
  if (impl.cesium3DTileset) {
304
307
  impl.cesium3DTileset.maximumScreenSpaceError = value;
305
308
  }
@@ -312,11 +315,9 @@ class CesiumTileset extends FeatureLayer {
312
315
  toJSON() {
313
316
  /** @type {CesiumTilesetOptions} */
314
317
  const config = super.toJSON();
315
- const defaultOptions = CesiumTileset.getDefaultOptions();
318
+ const defaultOptions = CesiumTilesetLayer.getDefaultOptions();
316
319
  if (this.highlightStyle) {
317
- config.highlightStyle = this.highlightStyle[referenceableStyleSymbol] ?
318
- this.highlightStyle.getReference() :
319
- this.highlightStyle.getOptions();
320
+ config.highlightStyle = this.highlightStyle.toJSON();
320
321
  }
321
322
 
322
323
  if (this.screenSpaceError !== defaultOptions.screenSpaceError) {
@@ -349,8 +350,8 @@ class CesiumTileset extends FeatureLayer {
349
350
  config.tilesetOptions = tilesetOptions;
350
351
  }
351
352
 
352
- if (this._splitDirection !== ImagerySplitDirection.NONE) {
353
- config.splitDirection = this._splitDirection === ImagerySplitDirection.RIGHT ?
353
+ if (this._splitDirection !== SplitDirection.NONE) {
354
+ config.splitDirection = this._splitDirection === SplitDirection.RIGHT ?
354
355
  'right' :
355
356
  'left';
356
357
  }
@@ -372,5 +373,5 @@ class CesiumTileset extends FeatureLayer {
372
373
  }
373
374
  }
374
375
 
375
- VcsClassRegistry.registerClass(CesiumTileset.className, CesiumTileset);
376
- export default CesiumTileset;
376
+ layerClassRegistry.registerClass(CesiumTilesetLayer.className, CesiumTilesetLayer);
377
+ export default CesiumTilesetLayer;
@@ -1,8 +1,8 @@
1
1
  import { CzmlDataSource } from '@vcmap/cesium';
2
2
 
3
- import DataSource from './dataSource.js';
3
+ import DataSourceLayer from './dataSourceLayer.js';
4
4
  import { vcsLayerName } from './layerSymbols.js';
5
- import { VcsClassRegistry } from '../classRegistry.js';
5
+ import { layerClassRegistry } from '../classRegistry.js';
6
6
 
7
7
  /**
8
8
  * @typedef {DataSourceOptions} CzmlOptions
@@ -12,18 +12,17 @@ import { VcsClassRegistry } from '../classRegistry.js';
12
12
 
13
13
  /**
14
14
  * @class
15
- * @export
16
- * @extends {DataSource}
15
+ * @extends {DataSourceLayer}
17
16
  */
18
- class Czml extends DataSource {
19
- static get className() { return 'vcs.vcm.layer.Czml'; }
17
+ class CzmlLayer extends DataSourceLayer {
18
+ static get className() { return 'CzmlLayer'; }
20
19
 
21
20
  /**
22
21
  * @returns {CzmlOptions}
23
22
  */
24
23
  static getDefaultOptions() {
25
24
  return {
26
- ...DataSource.getDefaultOptions(),
25
+ ...DataSourceLayer.getDefaultOptions(),
27
26
  sourceUri: undefined,
28
27
  };
29
28
  }
@@ -36,7 +35,7 @@ class Czml extends DataSource {
36
35
  this.dataSource = new CzmlDataSource();
37
36
  this.entities = this.dataSource.entities;
38
37
 
39
- const defaultOptions = Czml.getDefaultOptions();
38
+ const defaultOptions = CzmlLayer.getDefaultOptions();
40
39
  /** @type {string|null} */
41
40
  this.sourceUri = options.sourceUri || defaultOptions.sourceUri;
42
41
  /** @type {Function} */
@@ -44,7 +43,7 @@ class Czml extends DataSource {
44
43
  /** @type {Function} */
45
44
  this._loadedReject = () => {};
46
45
  /**
47
- * A Promise resolving with the DataSource on load
46
+ * A Promise resolving with the DataSourceLayer on load
48
47
  * @type {Promise<void>}
49
48
  * @api stable
50
49
  */
@@ -77,11 +76,9 @@ class Czml extends DataSource {
77
76
  * @private
78
77
  */
79
78
  async _loadData() {
80
- const loaded = /** @type {import("@vcmap/cesium").CzmlDataSource} */ (this.dataSource)
79
+ await /** @type {import("@vcmap/cesium").CzmlDataSource} */ (this.dataSource)
81
80
  .load(this.url, this.sourceUri ? { sourceUri: this.sourceUri } : undefined);
82
- await new Promise((resolve, reject) => {
83
- loaded.then(resolve, reject);
84
- });
81
+
85
82
  this.entities.values.forEach((entity) => {
86
83
  entity[vcsLayerName] = this.name;
87
84
  });
@@ -137,5 +134,5 @@ class Czml extends DataSource {
137
134
  }
138
135
  }
139
136
 
140
- VcsClassRegistry.registerClass(Czml.className, Czml);
141
- export default Czml;
137
+ layerClassRegistry.registerClass(CzmlLayer.className, CzmlLayer);
138
+ export default CzmlLayer;
@@ -1,11 +1,10 @@
1
1
  import { EntityCollection } from '@vcmap/cesium';
2
2
  import Layer from './layer.js';
3
- import CesiumMap from '../maps/cesium.js';
4
- import DataSourceCesium from './cesium/dataSourceCesium.js';
3
+ import CesiumMap from '../map/cesiumMap.js';
4
+ import DataSourceCesiumImpl from './cesium/dataSourceCesiumImpl.js';
5
5
  import { vcsLayerName } from './layerSymbols.js';
6
6
  import FeatureVisibility, { FeatureVisibilityAction } from './featureVisibility.js';
7
- import { getGlobalHider } from './globalHider.js';
8
- import { VcsClassRegistry } from '../classRegistry.js';
7
+ import { layerClassRegistry } from '../classRegistry.js';
9
8
 
10
9
  /**
11
10
  * @typedef {LayerOptions} DataSourceOptions
@@ -30,12 +29,11 @@ import { VcsClassRegistry } from '../classRegistry.js';
30
29
  /**
31
30
  * Represents a layer of Cesium.Entity
32
31
  * @class
33
- * @export
34
32
  * @extends {Layer}
35
33
  * @api stable
36
34
  */
37
- class DataSource extends Layer {
38
- static get className() { return 'vcs.vcm.layer.DataSource'; }
35
+ class DataSourceLayer extends Layer {
36
+ static get className() { return 'DataSourceLayer'; }
39
37
 
40
38
  /**
41
39
  * @returns {DataSourceOptions}
@@ -52,7 +50,7 @@ class DataSource extends Layer {
52
50
  */
53
51
  constructor(options) {
54
52
  super(options);
55
- const defaultOptions = DataSource.getDefaultOptions();
53
+ const defaultOptions = DataSourceLayer.getDefaultOptions();
56
54
  /**
57
55
  * The entities of this layer. Use the `addEntity` API to add Enitities to ensure interoperability with vcm interfaces
58
56
  * @type {import("@vcmap/cesium").EntityCollection}
@@ -86,12 +84,21 @@ class DataSource extends Layer {
86
84
  ];
87
85
  }
88
86
 
87
+ /**
88
+ * @param {import("@vcmap/core").GlobalHider} globalHider
89
+ */
90
+ setGlobalHider(globalHider) {
91
+ super.setGlobalHider(globalHider);
92
+ this._setUpFeatureVisibility();
93
+ }
94
+
89
95
  /**
90
96
  * Sets up listeners for featureVisibility and global hider
91
97
  * @private
92
98
  */
93
99
  _setUpFeatureVisibility() {
94
- const globalHider = getGlobalHider();
100
+ this._featureVisibilityListeners.forEach((cb) => { cb(); });
101
+
95
102
  this._featureVisibilityListeners = [
96
103
  this.featureVisibility.changed.addEventListener(({ action, ids }) => {
97
104
  if (action === FeatureVisibilityAction.HIDE) {
@@ -103,28 +110,30 @@ class DataSource extends Layer {
103
110
  });
104
111
  } // highlight is _possible_ but very tricky with all the possible entity values with potential materials
105
112
  }),
106
- globalHider.changed.addEventListener(({ action, ids }) => {
107
- if (action === FeatureVisibilityAction.HIDE) {
108
- ids.forEach((id) => {
109
- const entity = this.entities.getById(id);
110
- if (entity) {
111
- globalHider.addFeature(id, entity);
112
- }
113
- });
114
- }
115
- }),
116
113
  this.entities.collectionChanged.addEventListener((c, added) => {
117
114
  added.forEach((entity) => {
118
115
  if (this.featureVisibility.hiddenObjects[entity.id]) {
119
116
  this.featureVisibility.addHiddenFeature(entity.id, entity);
120
117
  }
121
-
122
- if (globalHider.hiddenObjects[entity.id]) {
123
- globalHider.addFeature(entity.id, entity);
118
+ if (this.globalHider && this.globalHider.hiddenObjects[entity.id]) {
119
+ this.globalHider.addFeature(entity.id, entity);
124
120
  }
125
121
  });
126
122
  }),
127
123
  ];
124
+
125
+ if (this.globalHider) {
126
+ this._featureVisibilityListeners.push(this.globalHider.changed.addEventListener(({ action, ids }) => {
127
+ if (action === FeatureVisibilityAction.HIDE) {
128
+ ids.forEach((id) => {
129
+ const entity = this.entities.getById(id);
130
+ if (entity) {
131
+ this.globalHider.addFeature(id, entity);
132
+ }
133
+ });
134
+ }
135
+ }));
136
+ }
128
137
  }
129
138
 
130
139
  /**
@@ -151,11 +160,11 @@ class DataSource extends Layer {
151
160
 
152
161
  /**
153
162
  * @param {CesiumMap} map
154
- * @returns {Array<DataSourceCesium>}
163
+ * @returns {Array<DataSourceCesiumImpl>}
155
164
  */
156
165
  createImplementationsForMap(map) {
157
166
  if (map instanceof CesiumMap) {
158
- return [new DataSourceCesium(map, this.getImplementationOptions())];
167
+ return [new DataSourceCesiumImpl(map, this.getImplementationOptions())];
159
168
  }
160
169
  return [];
161
170
  }
@@ -183,7 +192,7 @@ class DataSource extends Layer {
183
192
  */
184
193
  flyToEntity(id) {
185
194
  this.getImplementations().forEach((impl) => {
186
- /** @type {DataSourceCesium} */ (impl).flyToEntity(id);
195
+ /** @type {DataSourceCesiumImpl} */ (impl).flyToEntity(id);
187
196
  });
188
197
  }
189
198
 
@@ -255,5 +264,5 @@ class DataSource extends Layer {
255
264
  }
256
265
  }
257
266
 
258
- VcsClassRegistry.registerClass(DataSource.className, DataSource);
259
- export default DataSource;
267
+ layerClassRegistry.registerClass(DataSourceLayer.className, DataSourceLayer);
268
+ export default DataSourceLayer;
@@ -3,18 +3,16 @@ import Style from 'ol/style/Style.js';
3
3
  import { check } from '@vcsuite/check';
4
4
  import { parseInteger } from '@vcsuite/parsers';
5
5
  import Layer from './layer.js';
6
- import StyleItem, { referenceableStyleSymbol } from '../util/style/styleItem.js';
7
- import VectorStyleItem from '../util/style/vectorStyleItem.js';
6
+ import StyleItem from '../style/styleItem.js';
7
+ import VectorStyleItem from '../style/vectorStyleItem.js';
8
8
  import FeatureVisibility from './featureVisibility.js';
9
- import { getStyleOrDefaultStyle } from '../util/style/styleFactory.js';
10
- import VcsEvent from '../event/vcsEvent.js';
11
- import { styleCollection } from '../globalCollections.js';
12
- import { VcsClassRegistry } from '../classRegistry.js';
9
+ import { getStyleOrDefaultStyle } from '../style/styleFactory.js';
10
+ import VcsEvent from '../vcsEvent.js';
11
+ import { layerClassRegistry } from '../classRegistry.js';
13
12
 
14
13
  /**
15
14
  * @typedef {LayerOptions} FeatureLayerOptions
16
- * @property {DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem|string|undefined} style
17
- * @property {string|undefined} activeStyleName - vcs:undocumented
15
+ * @property {DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem|undefined} style
18
16
  * @property {Object|undefined} genericFeatureProperties - properties to add to generic features, eg for display in the balloon
19
17
  * @property {number} [balloonHeightOffset=10]
20
18
  * @property {FeatureVisibility|undefined} featureVisibility - vcs:undocumented
@@ -23,6 +21,7 @@ import { VcsClassRegistry } from '../classRegistry.js';
23
21
 
24
22
  /**
25
23
  * @typedef {LayerImplementationOptions} FeatureLayerImplementationOptions
24
+ * @property {GlobalHider} globalHider
26
25
  * @property {FeatureVisibility} featureVisibility
27
26
  * @property {import("@vcmap/core").StyleItem} style
28
27
  * @api
@@ -42,16 +41,15 @@ import { VcsClassRegistry } from '../classRegistry.js';
42
41
  */
43
42
 
44
43
  /**
45
- * Base class for all layers representing features, e.g. Vector, Buildings, POIs
44
+ * Base class for all layers representing features, e.g. VectorLayer, Buildings, POIs
46
45
  * @class
47
46
  * @abstract
48
47
  * @extends {Layer}
49
- * @export
50
48
  * @api
51
49
  */
52
50
  class FeatureLayer extends Layer {
53
51
  /** @type {string} */
54
- static get className() { return 'vcs.vcm.layer.FeatureLayer'; }
52
+ static get className() { return 'FeatureLayer'; }
55
53
 
56
54
  /**
57
55
  * @returns {FeatureLayerOptions}
@@ -76,7 +74,7 @@ class FeatureLayer extends Layer {
76
74
  * @type {import("@vcmap/core").StyleItem}
77
75
  * @private
78
76
  */
79
- this._style = this.getStyleOrDefaultStyle(options.activeStyleName || options.style);
77
+ this._style = this.getStyleOrDefaultStyle(options.style);
80
78
  /**
81
79
  * @type {import("@vcmap/core").StyleItem}
82
80
  * @private
@@ -143,11 +141,20 @@ class FeatureLayer extends Layer {
143
141
  getImplementationOptions() {
144
142
  return {
145
143
  ...super.getImplementationOptions(),
144
+ globalHider: this.globalHider,
146
145
  featureVisibility: this.featureVisibility,
147
146
  style: this.style,
148
147
  };
149
148
  }
150
149
 
150
+ /**
151
+ * @param {import("@vcmap/core").GlobalHider} globalHider
152
+ */
153
+ setGlobalHider(globalHider) {
154
+ super.setGlobalHider(globalHider);
155
+ this.forceRedraw();
156
+ }
157
+
151
158
  /**
152
159
  * @param {Object|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap/cesium").Cesium3DTilePointFeature|import("@vcmap/cesium").Cesium3DTileFeature|DataSourcePickedObject} object
153
160
  * @returns {?Object}
@@ -180,7 +187,7 @@ class FeatureLayer extends Layer {
180
187
  }
181
188
 
182
189
  /**
183
- * @param {(Reference|DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem|string)=} styleOptions
190
+ * @param {(DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem)=} styleOptions
184
191
  * @param {(import("@vcmap/core").VectorStyleItem|import("@vcmap/core").DeclarativeStyleItem)=} defaultStyle
185
192
  * @returns {import("@vcmap/core").StyleItem}
186
193
  */
@@ -191,21 +198,14 @@ class FeatureLayer extends Layer {
191
198
 
192
199
  /**
193
200
  * Sets the style based on a styleName on a layer
194
- * @param {string|import("ol/style/Style").default|import("ol/style/Style").StyleFunction|import("@vcmap/core").StyleItem} style
201
+ * @param {import("ol/style/Style").default|import("ol/style/Style").StyleFunction|import("@vcmap/core").StyleItem} style
195
202
  * @param {boolean=} silent
196
203
  * @api
197
204
  */
198
205
  setStyle(style, silent) {
199
- check(style, [Style, StyleItem, Function, String]);
206
+ check(style, [Style, StyleItem, Function]);
200
207
 
201
- if (typeof style === 'string') {
202
- const styleItem = styleCollection.getByKey(style);
203
- if (!styleItem) {
204
- this.getLogger().warning(`could not find style with name ${style}`);
205
- return;
206
- }
207
- this._style = styleItem;
208
- } else if (style instanceof StyleItem) {
208
+ if (style instanceof StyleItem) {
209
209
  this._style = style;
210
210
  } else {
211
211
  this._style = new VectorStyleItem({});
@@ -232,11 +232,7 @@ class FeatureLayer extends Layer {
232
232
  toJSON() {
233
233
  const config = /** @type {FeatureLayerOptions} */ (super.toJSON());
234
234
  if (!this.getStyleOrDefaultStyle().equals(this._style)) {
235
- if (this._style[referenceableStyleSymbol]) {
236
- config.style = this.style.getReference();
237
- } else {
238
- config.style = this.style.getOptions();
239
- }
235
+ config.style = this.style.toJSON();
240
236
  }
241
237
 
242
238
  if (Object.keys(this._genericFeatureProperties).length > 0) {
@@ -257,5 +253,5 @@ class FeatureLayer extends Layer {
257
253
  }
258
254
  }
259
255
 
260
- VcsClassRegistry.registerClass(FeatureLayer.className, FeatureLayer);
256
+ layerClassRegistry.registerClass(FeatureLayer.className, FeatureLayer);
261
257
  export default FeatureLayer;