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

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 (153) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +3 -2
  3. package/index.d.ts +2208 -2072
  4. package/index.js +137 -131
  5. package/package.json +10 -22
  6. package/src/category/appBackedCategory.js +76 -0
  7. package/src/category/category.js +401 -0
  8. package/src/category/categoryCollection.js +145 -0
  9. package/src/cesium/cesium3DTileFeature.js +1 -1
  10. package/src/classRegistry.js +168 -0
  11. package/src/context.js +73 -0
  12. package/src/{vcs/vcm/util/featureProvider → featureProvider}/abstractFeatureProvider.js +8 -8
  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 -17
  17. package/src/{vcs/vcm/interaction → interaction}/abstractInteraction.js +19 -17
  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 -31
  23. package/src/{vcs/vcm/interaction → interaction}/interactionType.js +0 -0
  24. package/src/{vcs/vcm/layer/cesium/cesiumTilesetCesium.js → layer/cesium/cesiumTilesetCesiumImpl.js} +8 -10
  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 -2
  27. package/src/{vcs/vcm/layer/cesium/openStreetMapCesium.js → layer/cesium/openStreetMapCesiumImpl.js} +6 -6
  28. package/src/{vcs/vcm/layer/cesium/rasterLayerCesium.js → layer/cesium/rasterLayerCesiumImpl.js} +5 -5
  29. package/src/{vcs/vcm/layer/cesium/singleImageCesium.js → layer/cesium/singleImageCesiumImpl.js} +5 -5
  30. package/src/{vcs/vcm/layer/cesium/terrainCesium.js → layer/cesium/terrainCesiumImpl.js} +4 -4
  31. package/src/{vcs/vcm/layer/cesium/tmsCesium.js → layer/cesium/tmsCesiumImpl.js} +6 -6
  32. package/src/{vcs/vcm/layer/cesium/vectorCesium.js → layer/cesium/vectorCesiumImpl.js} +3 -3
  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 -5
  35. package/src/{vcs/vcm/layer → layer}/cesium/vectorTileImageryProvider.js +1 -1
  36. package/src/{vcs/vcm/layer/cesium/wmsCesium.js → layer/cesium/wmsCesiumImpl.js} +6 -6
  37. package/src/{vcs/vcm/layer/cesium/wmtsCesium.js → layer/cesium/wmtsCesiumImpl.js} +6 -6
  38. package/src/{vcs/vcm/layer → layer}/cesium/x3dmHelper.js +0 -0
  39. package/src/{vcs/vcm/layer/cesiumTileset.js → layer/cesiumTilesetLayer.js} +38 -36
  40. package/src/{vcs/vcm/layer/czml.js → layer/czmlLayer.js} +14 -16
  41. package/src/{vcs/vcm/layer/dataSource.js → layer/dataSourceLayer.js} +13 -13
  42. package/src/{vcs/vcm/layer → layer}/featureLayer.js +17 -30
  43. package/src/{vcs/vcm/layer/featureStore.js → layer/featureStoreLayer.js} +53 -53
  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 -1
  46. package/src/{vcs/vcm/layer → layer}/featureVisibility.js +6 -5
  47. package/src/{vcs/vcm/layer → layer}/geojsonHelpers.js +15 -37
  48. package/src/{vcs/vcm/layer/geojson.js → layer/geojsonLayer.js} +19 -21
  49. package/src/{vcs/vcm/layer → layer}/globalHider.js +1 -11
  50. package/src/{vcs/vcm/layer → layer}/layer.js +11 -11
  51. package/src/{vcs/vcm/layer → layer}/layerImplementation.js +2 -2
  52. package/src/{vcs/vcm/layer → layer}/layerState.js +0 -0
  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} +6 -6
  57. package/src/{vcs/vcm/layer/openStreetMap.js → layer/openStreetMapLayer.js} +32 -32
  58. package/src/{vcs/vcm/layer/openlayers/layerOpenlayers.js → layer/openlayers/layerOpenlayersImpl.js} +5 -5
  59. package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +27 -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 -6
  62. package/src/{vcs/vcm/layer/openlayers/tileDebugOpenlayers.js → layer/openlayers/tileDebugOpenlayersImpl.js} +5 -5
  63. package/src/{vcs/vcm/layer/openlayers/tmsOpenlayers.js → layer/openlayers/tmsOpenlayersImpl.js} +7 -7
  64. package/src/{vcs/vcm/layer/openlayers/vectorOpenlayers.js → layer/openlayers/vectorOpenlayersImpl.js} +6 -6
  65. package/src/{vcs/vcm/layer/openlayers/vectorTileOpenlayers.js → layer/openlayers/vectorTileOpenlayersImpl.js} +6 -6
  66. package/src/{vcs/vcm/layer/openlayers/wmsOpenlayers.js → layer/openlayers/wmsOpenlayersImpl.js} +7 -7
  67. package/src/{vcs/vcm/layer/openlayers/wmtsOpenlayers.js → layer/openlayers/wmtsOpenlayersImpl.js} +7 -7
  68. package/src/{vcs/vcm/layer/pointCloud.js → layer/pointCloudLayer.js} +26 -33
  69. package/src/{vcs/vcm/layer → layer}/rasterLayer.js +18 -18
  70. package/src/{vcs/vcm/layer/singleImage.js → layer/singleImageLayer.js} +20 -19
  71. package/src/{vcs/vcm/layer → layer}/terrainHelpers.js +13 -49
  72. package/src/{vcs/vcm/layer/terrain.js → layer/terrainLayer.js} +13 -13
  73. package/src/{vcs/vcm/layer → layer}/tileLoadedHelper.js +5 -5
  74. package/src/{vcs/vcm/layer → layer}/tileProvider/mvtTileProvider.js +22 -4
  75. package/src/layer/tileProvider/staticGeojsonTileProvider.js +82 -0
  76. package/src/{vcs/vcm/layer → layer}/tileProvider/tileProvider.js +16 -7
  77. package/src/{vcs/vcm/layer → layer}/tileProvider/urlTemplateTileProvider.js +20 -5
  78. package/src/{vcs/vcm/layer/tms.js → layer/tmsLayer.js} +19 -19
  79. package/src/{vcs/vcm/layer → layer}/vectorHelpers.js +5 -5
  80. package/src/{vcs/vcm/layer/vector.js → layer/vectorLayer.js} +38 -47
  81. package/src/{vcs/vcm/layer → layer}/vectorProperties.js +3 -3
  82. package/src/{vcs/vcm/layer → layer}/vectorSymbols.js +0 -0
  83. package/src/{vcs/vcm/layer/vectorTile.js → layer/vectorTileLayer.js} +32 -41
  84. package/src/{vcs/vcm/layer/wfs.js → layer/wfsLayer.js} +19 -19
  85. package/src/{vcs/vcm/layer → layer}/wmsHelpers.js +1 -1
  86. package/src/{vcs/vcm/layer/wms.js → layer/wmsLayer.js} +22 -22
  87. package/src/{vcs/vcm/layer/wmts.js → layer/wmtsLayer.js} +20 -20
  88. package/src/{vcs/vcm/maps → map}/baseOLMap.js +5 -5
  89. package/src/{vcs/vcm/maps → map}/cameraLimiter.js +11 -16
  90. package/src/{vcs/vcm/maps/cesium.js → map/cesiumMap.js} +21 -33
  91. package/src/{vcs/vcm/maps → map}/mapState.js +0 -0
  92. package/src/{vcs/vcm/maps/oblique.js → map/obliqueMap.js} +42 -56
  93. package/src/{vcs/vcm/maps/openlayers.js → map/openlayersMap.js} +17 -14
  94. package/src/{vcs/vcm/maps/map.js → map/vcsMap.js} +35 -20
  95. package/src/oblique/defaultObliqueCollection.js +62 -0
  96. package/src/{vcs/vcm/oblique → oblique}/helpers.js +13 -41
  97. package/src/{vcs/vcm/oblique/ObliqueCollection.js → oblique/obliqueCollection.js} +117 -36
  98. package/src/{vcs/vcm/oblique/ObliqueDataSet.js → oblique/obliqueDataSet.js} +67 -24
  99. package/src/{vcs/vcm/oblique/ObliqueImage.js → oblique/obliqueImage.js} +1 -1
  100. package/src/{vcs/vcm/oblique/ObliqueImageMeta.js → oblique/obliqueImageMeta.js} +4 -4
  101. package/src/{vcs/vcm/oblique/ObliqueProvider.js → oblique/obliqueProvider.js} +17 -11
  102. package/src/{vcs/vcm/oblique/ObliqueView.js → oblique/obliqueView.js} +31 -1
  103. package/src/{vcs/vcm/oblique/ObliqueViewDirection.js → oblique/obliqueViewDirection.js} +0 -0
  104. package/src/{vcs/vcm/oblique → oblique}/parseImageJson.js +20 -12
  105. package/src/ol/geom/circle.js +1 -1
  106. package/src/overrideClassRegistry.js +204 -0
  107. package/src/{vcs/vcm/util/style → style}/declarativeStyleItem.js +43 -19
  108. package/src/{vcs/vcm/util/style → style}/shapesCategory.js +0 -0
  109. package/src/style/styleFactory.js +29 -0
  110. package/src/{vcs/vcm/util/style → style}/styleHelpers.js +3 -3
  111. package/src/{vcs/vcm/util/style → style}/styleItem.js +23 -85
  112. package/src/{vcs/vcm/util/style → style}/vectorStyleItem.js +73 -81
  113. package/src/{vcs/vcm/util/style → style}/writeStyle.js +4 -7
  114. package/src/{vcs/vcm/util → util}/clipping/clippingObject.js +10 -10
  115. package/src/{vcs/vcm/util → util}/clipping/clippingObjectManager.js +2 -2
  116. package/src/{vcs/vcm/util → util}/clipping/clippingPlaneHelper.js +4 -4
  117. package/src/{vcs/vcm/util → util}/collection.js +1 -1
  118. package/src/{vcs/vcm/util → util}/dateTime.js +0 -0
  119. package/src/{vcs/vcm/util → util}/exclusiveManager.js +0 -0
  120. package/src/{vcs/vcm/util → util}/extent.js +18 -11
  121. package/src/{vcs/vcm/util → util}/featureconverter/circleToCesium.js +0 -0
  122. package/src/{vcs/vcm/util → util}/featureconverter/convert.js +0 -0
  123. package/src/util/featureconverter/extent3D.js +181 -0
  124. package/src/{vcs/vcm/util → util}/featureconverter/featureconverterHelper.js +1 -1
  125. package/src/{vcs/vcm/util → util}/featureconverter/lineStringToCesium.js +0 -0
  126. package/src/{vcs/vcm/util → util}/featureconverter/pointToCesium.js +3 -3
  127. package/src/{vcs/vcm/util → util}/featureconverter/polygonToCesium.js +1 -1
  128. package/src/util/fetch.js +32 -0
  129. package/src/{vcs/vcm/util → util}/geometryHelpers.js +0 -0
  130. package/src/{vcs/vcm/util → util}/indexedCollection.js +24 -1
  131. package/src/{vcs/vcm/util → util}/isMobile.js +0 -0
  132. package/src/{vcs/vcm/util → util}/layerCollection.js +11 -6
  133. package/src/{vcs/vcm/util → util}/locale.js +1 -1
  134. package/src/{vcs/vcm/util → util}/mapCollection.js +63 -21
  135. package/src/{vcs/vcm/util → util}/math.js +0 -0
  136. package/src/util/overrideCollection.js +224 -0
  137. package/src/{vcs/vcm/util → util}/projection.js +39 -24
  138. package/src/{vcs/vcm/util → util}/splitScreen.js +10 -10
  139. package/src/{vcs/vcm/util → util}/urlHelpers.js +0 -0
  140. package/src/{vcs/vcm/util → util}/viewpoint.js +5 -5
  141. package/src/vcsApp.js +471 -0
  142. package/src/vcsAppContextHelpers.js +121 -0
  143. package/src/{vcs/vcm/event/vcsEvent.js → vcsEvent.js} +2 -2
  144. package/src/{vcs/vcm/object.js → vcsObject.js} +2 -10
  145. package/src/vcs/vcm/classRegistry.js +0 -106
  146. package/src/vcs/vcm/globalCollections.js +0 -11
  147. package/src/vcs/vcm/layer/buildings.js +0 -17
  148. package/src/vcs/vcm/layer/cesium/pointCloudCesium.js +0 -58
  149. package/src/vcs/vcm/layer/openlayers/openStreetMapOpenlayers.js +0 -27
  150. package/src/vcs/vcm/layer/tileProvider/staticGeojsonTileProvider.js +0 -67
  151. package/src/vcs/vcm/layer/tileProvider/tileProviderFactory.js +0 -28
  152. package/src/vcs/vcm/util/featureconverter/extent3d.js +0 -154
  153. package/src/vcs/vcm/util/style/styleFactory.js +0 -48
@@ -1,5 +1,5 @@
1
1
  import { boundingExtent, containsXY } from 'ol/extent.js';
2
- import { get as getProjection, getTransform, transform, transformExtent } from 'ol/proj.js';
2
+ import { getTransform, transform, transformExtent } from 'ol/proj.js';
3
3
  import { check } from '@vcsuite/check';
4
4
  import { parseBoolean, parseNumber } from '@vcsuite/parsers';
5
5
  import Extent from '../util/extent.js';
@@ -7,14 +7,14 @@ import { mercatorProjection, wgs84Projection } from '../util/projection.js';
7
7
  import { getResolutionOptions, getZoom } from '../layer/oblique/obliqueHelpers.js';
8
8
  import ViewPoint from '../util/viewpoint.js';
9
9
  import BaseOLMap from './baseOLMap.js';
10
- import VcsMap from './map.js';
11
- import VcsEvent from '../event/vcsEvent.js';
12
- import { obliqueCollectionCollection } from '../globalCollections.js';
13
- import { ObliqueViewDirection as ViewDirection } from '../oblique/ObliqueViewDirection.js';
14
- import ObliqueProvider from '../oblique/ObliqueProvider.js';
15
- import ObliqueCollection from '../oblique/ObliqueCollection.js';
10
+ import VcsMap from './vcsMap.js';
11
+ import VcsEvent from '../vcsEvent.js';
12
+ import { ObliqueViewDirection as ViewDirection } from '../oblique/obliqueViewDirection.js';
13
+ import ObliqueProvider from '../oblique/obliqueProvider.js';
14
+ import ObliqueCollection from '../oblique/obliqueCollection.js';
16
15
  import { transformFromImage } from '../oblique/helpers.js';
17
- import { VcsClassRegistry } from '../classRegistry.js';
16
+ import { mapClassRegistry } from '../classRegistry.js';
17
+ import DefaultObliqueCollection from '../oblique/defaultObliqueCollection.js';
18
18
 
19
19
  /**
20
20
  * @typedef {Object} ObliqueClickParameters
@@ -28,7 +28,6 @@ import { VcsClassRegistry } from '../classRegistry.js';
28
28
  * @property {boolean} [changeOnMoveEnd=false]
29
29
  * @property {number} [switchThreshold=0]
30
30
  * @property {boolean} [switchOnEdge=true]
31
- * @property {string|undefined} defaultCollectionName
32
31
  * @api
33
32
  */
34
33
 
@@ -39,6 +38,8 @@ const defaultHeadings = {
39
38
  [ViewDirection.WEST]: 270,
40
39
  };
41
40
 
41
+ const defaultCollection = new DefaultObliqueCollection();
42
+
42
43
  /**
43
44
  * returns the direction which matches the heading of the viewpoint
44
45
  * @param {ViewPoint} viewpoint
@@ -72,15 +73,15 @@ export function getMercatorViewpointCenter(viewpoint) {
72
73
  }
73
74
 
74
75
  /**
75
- * Oblique Map Class (2D map with oblique imagery)
76
+ * ObliqueMap Map Class (2D map with oblique imagery)
76
77
  *
77
78
  * @class
78
79
  * @export
79
80
  * @extends {BaseOLMap}
80
81
  * @api stable
81
82
  */
82
- class Oblique extends BaseOLMap {
83
- static get className() { return 'vcs.vcm.maps.Oblique'; }
83
+ class ObliqueMap extends BaseOLMap {
84
+ static get className() { return 'ObliqueMap'; }
84
85
 
85
86
  /**
86
87
  * @returns {ObliqueOptions}
@@ -91,22 +92,12 @@ class Oblique extends BaseOLMap {
91
92
  changeOnMoveEnd: false,
92
93
  switchThreshold: 0,
93
94
  switchOnEdge: true,
94
- defaultCollectionName: undefined,
95
95
  };
96
96
  }
97
97
 
98
- /**
99
- * @param {ObliqueOptions} options
100
- */
101
98
  constructor(options) {
102
99
  super(options);
103
- const defaultOptions = Oblique.getDefaultOptions();
104
- /**
105
- * @type {string|undefined}
106
- * @private
107
- */
108
- this._defaultCollectionName = options.defaultCollectionName || defaultOptions.defaultCollectionName;
109
-
100
+ const defaultOptions = ObliqueMap.getDefaultOptions();
110
101
  /**
111
102
  * @type {ObliqueCollection|null}
112
103
  * @private
@@ -139,6 +130,11 @@ class Oblique extends BaseOLMap {
139
130
  * @api
140
131
  */
141
132
  this.collectionChanged = new VcsEvent();
133
+ /**
134
+ * @type {function():void}
135
+ * @private
136
+ */
137
+ this._activeCollectionDestroyedListener = () => {};
142
138
  }
143
139
 
144
140
  /**
@@ -209,9 +205,7 @@ class Oblique extends BaseOLMap {
209
205
  this.switchEnabled = this._switchEnabled;
210
206
  let collectionToLoad = this._loadingCollection;
211
207
  if (!collectionToLoad) {
212
- collectionToLoad = this._defaultCollectionName ?
213
- obliqueCollectionCollection.getByKey(this._defaultCollectionName) :
214
- [...obliqueCollectionCollection][0];
208
+ collectionToLoad = defaultCollection;
215
209
  }
216
210
  if (collectionToLoad) {
217
211
  await this._setCollection(collectionToLoad);
@@ -243,7 +237,7 @@ class Oblique extends BaseOLMap {
243
237
  get collection() { return this._obliqueProvider.collection; }
244
238
 
245
239
  /**
246
- * @type {import("@vcmap/cesium").Event}
240
+ * @type {import("@vcmap/core").VcsEvent<import("@vcmap/core").ObliqueImage>}
247
241
  * @readonly
248
242
  * @api
249
243
  */
@@ -294,26 +288,16 @@ class Oblique extends BaseOLMap {
294
288
  if (image) {
295
289
  const coords = boundingExtent(image.groundCoordinates);
296
290
  return new Extent({
297
- coordinates: transformExtent(coords, image.meta.projection, mercatorProjection.proj),
298
- epsg: 'EPSG:3857',
291
+ coordinates: transformExtent(coords, image.meta.projection.proj, mercatorProjection.proj),
292
+ projection: mercatorProjection.toJSON(),
299
293
  });
300
294
  }
301
295
  return new Extent({
302
296
  coordinates: [-18924313.4349, -15538711.0963, 18924313.4349, 15538711.0963],
303
- epsg: 'EPSG:3857',
297
+ projection: mercatorProjection.toJSON(),
304
298
  });
305
299
  }
306
300
 
307
- /**
308
- * @returns {import("@vcmap/core").ObliqueImage}
309
- * @api
310
- * @deprecated 4.0
311
- */
312
- getCurrentImage() {
313
- this.getLogger().deprecate('getCurrentImage', 'access the currentImage property');
314
- return this._obliqueProvider ? this._obliqueProvider.currentImage : null;
315
- }
316
-
317
301
  deactivate() {
318
302
  super.deactivate();
319
303
  this._obliqueProvider.deactivate();
@@ -333,11 +317,11 @@ class Oblique extends BaseOLMap {
333
317
  return;
334
318
  }
335
319
 
336
- if (!this.initializedPromise) { // TODO add collection to obliqueCollections?
337
- this._defaultCollectionName = obliqueCollection.name;
320
+ this._loadingCollection = obliqueCollection;
321
+ if (!this.initializedPromise) {
338
322
  return;
339
323
  }
340
- this._loadingCollection = obliqueCollection;
324
+
341
325
  await this.initializedPromise;
342
326
  if (this._loadingCollection !== obliqueCollection) {
343
327
  return;
@@ -354,6 +338,10 @@ class Oblique extends BaseOLMap {
354
338
  */
355
339
  async _setCollection(obliqueCollection, viewpoint) {
356
340
  this._loadingCollection = obliqueCollection;
341
+ this._activeCollectionDestroyedListener();
342
+ this._activeCollectionDestroyedListener = obliqueCollection.destroyed.addEventListener(() => {
343
+ this._setCollection(defaultCollection);
344
+ });
357
345
  await obliqueCollection.load();
358
346
  const vp = viewpoint || await this.getViewPoint();
359
347
  if (this._loadingCollection !== obliqueCollection) {
@@ -399,7 +387,7 @@ class Oblique extends BaseOLMap {
399
387
  return null;
400
388
  }
401
389
 
402
- const transformationOptions = { dataProjection: getProjection('EPSG:4326') };
390
+ const transformationOptions = { dataProjection: wgs84Projection };
403
391
  const { coords } = await transformFromImage(image, viewCenter, transformationOptions);
404
392
  return this._computeViewpointInternal(coords);
405
393
  }
@@ -421,8 +409,9 @@ class Oblique extends BaseOLMap {
421
409
 
422
410
  const gpInternalProjection = image.transformImage2RealWorld(gpImageCoordinates, image.averageHeight);
423
411
 
424
- const transfrom = getTransform(image.meta.projection, wgs84Projection.proj);
425
- const gpWGS84 = transfrom(gpInternalProjection.slice(0, 2));
412
+ const transfrom = getTransform(image.meta.projection.proj, wgs84Projection.proj);
413
+ // getText can return a rich Text Array<string> We do not support this at the moment.
414
+ const gpWGS84 = transfrom(gpInternalProjection.slice(0, 2), undefined, undefined);
426
415
  return this._computeViewpointInternal(gpWGS84);
427
416
  }
428
417
 
@@ -489,7 +478,7 @@ class Oblique extends BaseOLMap {
489
478
  const bl = image.transformImage2RealWorld([extent[0], extent[1]]);
490
479
  const ur = image.transformImage2RealWorld([extent[2], extent[3]]);
491
480
  const bbox = [bl[0], bl[1], ur[0], ur[1]];
492
- const transformedBbox = transformExtent(bbox, image.meta.projection, wgs84Projection.proj);
481
+ const transformedBbox = transformExtent(bbox, image.meta.projection.proj, wgs84Projection.proj);
493
482
  return containsXY(transformedBbox, coords[0], coords[1]);
494
483
  }
495
484
 
@@ -497,9 +486,9 @@ class Oblique extends BaseOLMap {
497
486
  * @returns {ObliqueOptions}
498
487
  * @api
499
488
  */
500
- getConfigObject() {
501
- const config = /** @type {ObliqueOptions} */ (super.getConfigObject());
502
- const defaultOptions = Oblique.getDefaultOptions();
489
+ toJSON() {
490
+ const config = /** @type {ObliqueOptions} */ (super.toJSON());
491
+ const defaultOptions = ObliqueMap.getDefaultOptions();
503
492
 
504
493
  if (this.mapChangeEvent === 'movened') {
505
494
  config.changeOnMoveEnd = true;
@@ -513,10 +502,6 @@ class Oblique extends BaseOLMap {
513
502
  config.switchOnEdge = this.switchEnabled;
514
503
  }
515
504
 
516
- if (this._defaultCollectionName !== defaultOptions.defaultCollectionName) {
517
- config.defaultCollectionName = this._defaultCollectionName;
518
- }
519
-
520
505
  return config;
521
506
  }
522
507
 
@@ -528,9 +513,10 @@ class Oblique extends BaseOLMap {
528
513
  this._obliqueProvider.destroy();
529
514
  }
530
515
  this.collectionChanged.destroy();
516
+ this._activeCollectionDestroyedListener();
531
517
  super.destroy();
532
518
  }
533
519
  }
534
520
 
535
- VcsClassRegistry.registerClass(Oblique.className, Oblique);
536
- export default Oblique;
521
+ mapClassRegistry.registerClass(ObliqueMap.className, ObliqueMap);
522
+ export default ObliqueMap;
@@ -6,8 +6,8 @@ import { boundingExtent, containsXY } from 'ol/extent.js';
6
6
  import { parseBoolean } from '@vcsuite/parsers';
7
7
  import ViewPoint from '../util/viewpoint.js';
8
8
  import BaseOLMap from './baseOLMap.js';
9
- import VcsMap from './map.js';
10
- import { VcsClassRegistry } from '../classRegistry.js';
9
+ import VcsMap from './vcsMap.js';
10
+ import { mapClassRegistry } from '../classRegistry.js';
11
11
 
12
12
  /**
13
13
  * @typedef {VcsMapOptions} OpenlayersOptions
@@ -16,17 +16,17 @@ import { VcsClassRegistry } from '../classRegistry.js';
16
16
  */
17
17
 
18
18
  /**
19
- * Openlayers Map Class (2D map)
19
+ * OpenlayersMap Map Class (2D map)
20
20
  * @class
21
21
  * @export
22
22
  * @extends {BaseOLMap}
23
23
  * @api stable
24
24
  */
25
- class Openlayers extends BaseOLMap {
25
+ class OpenlayersMap extends BaseOLMap {
26
26
  /**
27
27
  * @type {string}
28
28
  */
29
- static get className() { return 'vcs.vcm.maps.Openlayers'; }
29
+ static get className() { return 'OpenlayersMap'; }
30
30
 
31
31
  /**
32
32
  * @returns {OpenlayersOptions}
@@ -44,7 +44,7 @@ class Openlayers extends BaseOLMap {
44
44
  constructor(options) {
45
45
  super(options);
46
46
 
47
- const defaultOptions = Openlayers.getDefaultOptions();
47
+ const defaultOptions = OpenlayersMap.getDefaultOptions();
48
48
 
49
49
  /** @type {boolean} */
50
50
  this.fixedNorthOrientation = parseBoolean(options.fixedNorthOrientation, defaultOptions.fixedNorthOrientation);
@@ -87,7 +87,8 @@ class Openlayers extends BaseOLMap {
87
87
  size.width = viewport.offsetWidth || 1;
88
88
  const aspectRatio = size.width / size.height;
89
89
  const fovy = Math.atan(Math.tan(fov * 0.5) / aspectRatio) * 2.0;
90
- const latlon = toLatLon(coord.slice(0, 2));
90
+ // error in TransformFunction type definition, remove undefined after openlayer fixed the type
91
+ const latlon = toLatLon(coord.slice(0, 2), undefined, undefined);
91
92
  const metersPerUnit = view.getProjection().getMetersPerUnit();
92
93
 
93
94
  const resolution = view.getResolution();
@@ -129,7 +130,8 @@ class Openlayers extends BaseOLMap {
129
130
  coords = viewpoint.cameraPosition.slice(0, 2);
130
131
  }
131
132
  const { distance } = viewpoint;
132
- const center = fromLatLon(coords);
133
+ // error in TransformFunction type definition, remove undefined after openlayer fixed the type
134
+ const center = fromLatLon(coords, undefined, undefined);
133
135
 
134
136
  const fov = Math.PI / 3.0;
135
137
  const viewport = this.olMap.getViewport();
@@ -180,7 +182,8 @@ class Openlayers extends BaseOLMap {
180
182
  const toLatLon = getTransform(view.getProjection(), 'EPSG:4326');
181
183
  const topLeft = [extent[0], extent[3]];
182
184
  const bottomRight = [extent[2], extent[1]];
183
- const bbox = [toLatLon(topLeft), toLatLon(bottomRight)];
185
+ // error in TransformFunction type definition, remove undefined after openlayer fixed the type
186
+ const bbox = [toLatLon(topLeft, undefined, undefined), toLatLon(bottomRight, undefined, undefined)];
184
187
 
185
188
  return containsXY(boundingExtent(bbox), coords[0], coords[1]);
186
189
  }
@@ -189,10 +192,10 @@ class Openlayers extends BaseOLMap {
189
192
  * @returns {OpenlayersOptions}
190
193
  * @api
191
194
  */
192
- getConfigObject() {
193
- const config = /** @type {OpenlayersOptions} */ (super.getConfigObject());
195
+ toJSON() {
196
+ const config = /** @type {OpenlayersOptions} */ (super.toJSON());
194
197
 
195
- const defaultOptions = Openlayers.getDefaultOptions();
198
+ const defaultOptions = OpenlayersMap.getDefaultOptions();
196
199
  if (this.fixedNorthOrientation !== defaultOptions.fixedNorthOrientation) {
197
200
  config.fixedNorthOrientation = this.fixedNorthOrientation;
198
201
  }
@@ -201,5 +204,5 @@ class Openlayers extends BaseOLMap {
201
204
  }
202
205
  }
203
206
 
204
- VcsClassRegistry.registerClass(Openlayers.className, Openlayers);
205
- export default Openlayers;
207
+ mapClassRegistry.registerClass(OpenlayersMap.className, OpenlayersMap);
208
+ export default OpenlayersMap;
@@ -1,11 +1,11 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
2
  import { check, checkMaybe } from '@vcsuite/check';
3
- import VcsObject from '../object.js';
3
+ import VcsObject from '../vcsObject.js';
4
4
  import LayerCollection from '../util/layerCollection.js';
5
5
  import MapState from './mapState.js';
6
6
  import { vcsLayerName } from '../layer/layerSymbols.js';
7
- import VcsEvent from '../event/vcsEvent.js';
8
- import { VcsClassRegistry } from '../classRegistry.js';
7
+ import VcsEvent from '../vcsEvent.js';
8
+ import { mapClassRegistry } from '../classRegistry.js';
9
9
 
10
10
  /**
11
11
  * @namespace maps
@@ -44,7 +44,7 @@ const specificLayerImpl = {};
44
44
  * @api stable
45
45
  */
46
46
  class VcsMap extends VcsObject {
47
- static get className() { return 'vcs.vcm.maps.VcsMap'; }
47
+ static get className() { return 'VcsMap'; }
48
48
 
49
49
  static get specificLayerImpl() { return specificLayerImpl; }
50
50
 
@@ -101,17 +101,9 @@ class VcsMap extends VcsObject {
101
101
  * @type {Array<Function>}
102
102
  * @private
103
103
  */
104
- this._collectionListeners = [
105
- this.layerCollection.moved.addEventListener((layer) => {
106
- this.indexChanged(layer);
107
- }),
108
- this.layerCollection.added.addEventListener((layer) => {
109
- this._layerAdded(layer);
110
- }),
111
- this.layerCollection.removed.addEventListener((layer) => {
112
- this._layerRemoved(layer);
113
- }),
114
- ];
104
+ this._collectionListeners = [];
105
+
106
+ this._setLayerCollectionListeners();
115
107
 
116
108
  /** @type {boolean} */
117
109
  this.initialized = false;
@@ -221,6 +213,29 @@ class VcsMap extends VcsObject {
221
213
  l.mapActivated(this);
222
214
  });
223
215
  }
216
+
217
+ this._setLayerCollectionListeners();
218
+ }
219
+
220
+ /**
221
+ * @private
222
+ */
223
+ _setLayerCollectionListeners() {
224
+ this._collectionListeners.forEach((cb) => {
225
+ cb();
226
+ });
227
+
228
+ this._collectionListeners = [
229
+ this.layerCollection.moved.addEventListener((layer) => {
230
+ this.indexChanged(layer);
231
+ }),
232
+ this.layerCollection.added.addEventListener((layer) => {
233
+ this._layerAdded(layer);
234
+ }),
235
+ this.layerCollection.removed.addEventListener((layer) => {
236
+ this._layerRemoved(layer);
237
+ }),
238
+ ];
224
239
  }
225
240
 
226
241
  /**
@@ -415,7 +430,7 @@ class VcsMap extends VcsObject {
415
430
 
416
431
  // eslint-disable-next-line jsdoc/require-returns-check
417
432
  /**
418
- * Returns the most precise viewpoint possible in Oblique.
433
+ * Returns the most precise viewpoint possible in ObliqueMap.
419
434
  * @api
420
435
  * @returns {Promise<import("@vcmap/core").ViewPoint|null>}
421
436
  */
@@ -425,7 +440,7 @@ class VcsMap extends VcsObject {
425
440
  }
426
441
 
427
442
  /**
428
- * Returns an approximate viewpoint in Oblique, not requesting terrain.
443
+ * Returns an approximate viewpoint in ObliqueMap, not requesting terrain.
429
444
  * @api
430
445
  * @returns {import("@vcmap/core").ViewPoint|null}
431
446
  */
@@ -464,8 +479,8 @@ class VcsMap extends VcsObject {
464
479
  * @returns {VcsMapOptions}
465
480
  * @api
466
481
  */
467
- getConfigObject() {
468
- const config = /** @type {VcsMapOptions} */ (super.getConfigObject());
482
+ toJSON() {
483
+ const config = /** @type {VcsMapOptions} */ (super.toJSON());
469
484
  if (this.fallbackMap) {
470
485
  config.fallbackMap = this.fallbackMap;
471
486
  }
@@ -507,5 +522,5 @@ class VcsMap extends VcsObject {
507
522
  }
508
523
  }
509
524
 
510
- VcsClassRegistry.registerClass(VcsMap.className, VcsMap);
525
+ mapClassRegistry.registerClass(VcsMap.className, VcsMap);
511
526
  export default VcsMap;
@@ -0,0 +1,62 @@
1
+ import ObliqueCollection from './obliqueCollection.js';
2
+ import ObliqueImage from './obliqueImage.js';
3
+ import ObliqueImageMeta from './obliqueImageMeta.js';
4
+ import { ObliqueViewDirection } from './obliqueViewDirection.js';
5
+ import { mercatorProjection } from '../util/projection.js';
6
+
7
+ const defaultMeta = new ObliqueImageMeta({
8
+ name: 'defaultObliqueMeta',
9
+ size: [512, 512],
10
+ tileSize: [512, 512],
11
+ tileResolution: [1],
12
+ projection: mercatorProjection,
13
+ format: 'png',
14
+ url: '',
15
+ });
16
+
17
+ /**
18
+ * @type {symbol}
19
+ * @private
20
+ */
21
+ export const isDefaultImageSymbol = Symbol('isDefaultImage');
22
+
23
+ /**
24
+ * This is a special oblique collection wich is shown, if no other oblique collection is set on an ObliqueMap map.
25
+ * It will render a single image which indicates that no images can be loaded.
26
+ * @class
27
+ * @extends {ObliqueCollection}
28
+ */
29
+ class DefaultObliqueCollection extends ObliqueCollection {
30
+ constructor() {
31
+ super({});
32
+ }
33
+
34
+ /**
35
+ * @param {import("ol/coordinate").Coordinate} mercatorCoordinate
36
+ * @param {ObliqueViewDirection} viewDirection
37
+ * @returns {ObliqueImage}
38
+ */
39
+ // eslint-disable-next-line no-unused-vars
40
+ getImageForCoordinate(mercatorCoordinate, viewDirection) {
41
+ const groundCoordinates = [
42
+ [mercatorCoordinate[0] - 100, mercatorCoordinate[1] - 100, 0],
43
+ [mercatorCoordinate[0] + 100, mercatorCoordinate[1] - 100, 0],
44
+ [mercatorCoordinate[0] + 100, mercatorCoordinate[1] + 100, 0],
45
+ [mercatorCoordinate[0] - 100, mercatorCoordinate[1] + 100, 0],
46
+ ];
47
+
48
+ const image = new ObliqueImage({
49
+ meta: defaultMeta,
50
+ viewDirection: ObliqueViewDirection.NORTH,
51
+ viewDirectionAngle: 0,
52
+ name: this.name,
53
+ groundCoordinates,
54
+ centerPointOnGround: mercatorCoordinate,
55
+ });
56
+
57
+ image[isDefaultImageSymbol] = true;
58
+ return image;
59
+ }
60
+ }
61
+
62
+ export default DefaultObliqueCollection;
@@ -1,11 +1,12 @@
1
1
  /* eslint no-underscore-dangle: ["error", { "allow": ["_listeners", "_scopes", "_toRemove"] }] */
2
2
  /* eslint-disable no-continue */
3
3
  import { boundingExtent, getBottomLeft, getBottomRight, getTopLeft, getTopRight } from 'ol/extent.js';
4
- import { get as getProjection, transform } from 'ol/proj.js';
4
+ import { transform } from 'ol/proj.js';
5
5
  import { Cartesian2 } from '@vcmap/cesium';
6
- import { ObliqueViewDirection } from './ObliqueViewDirection.js';
6
+ import { ObliqueViewDirection } from './obliqueViewDirection.js';
7
7
  import { getHeightFromTerrainProvider } from '../layer/terrainHelpers.js';
8
8
  import { cartesian2DDistance } from '../util/math.js';
9
+ import { mercatorProjection, wgs84Projection } from '../util/projection.js';
9
10
 
10
11
  /**
11
12
  * @type {import("@vcmap/cesium").Cartesian2}
@@ -292,7 +293,7 @@ export function transformCWIFC(inputOrigin, inputTarget, originIsImage, coordina
292
293
  /**
293
294
  * @typedef {Object} ImageTransformationOptions
294
295
  * @property {boolean|undefined} [dontUseTerrain]
295
- * @property {import("ol/proj/Projection").default|undefined} [dataProjection] - the projection of the input/output coordinates, assumes image source projection
296
+ * @property {import("@vcmap/core").Projection|undefined} [dataProjection] - the projection of the input/output coordinates, assumes image source projection
296
297
  * @property {number|undefined} [terrainErrorThreshold=1] - the transformToWorld process iterativly calculates a new Height Value from the terrainProvider until the difference to the new height value is smaller
297
298
  * @property {number|undefined} [terrainErrorCountThreshold=3] - how often the transformToWorld process iterativly calculates a new Height Value from the terrainProvider
298
299
  * @api
@@ -313,8 +314,8 @@ export function transformToImage(image, worldCoordinate, options = {}) {
313
314
  gpInternalCoordinates = worldCoordinate;
314
315
  } else {
315
316
  gpInternalCoordinates = options.dataProjection ?
316
- transform(worldCoordinate, options.dataProjection, image.meta.projection) :
317
- transform(worldCoordinate, 'EPSG:3857', image.meta.projection);
317
+ transform(worldCoordinate, options.dataProjection.proj, image.meta.projection.proj) :
318
+ transform(worldCoordinate, mercatorProjection.proj, image.meta.projection.proj);
318
319
  }
319
320
 
320
321
  function useAverageHeight() {
@@ -369,14 +370,14 @@ function pickTerrain(pickTerrainOptions) {
369
370
  count,
370
371
  height,
371
372
  } = pickTerrainOptions;
372
- const wgs84Projection = getProjection('EPSG:4326');
373
+
373
374
  return getHeightFromTerrainProvider(image.meta.terrainProvider, [worldCoordinate])
374
375
  .then(([worldCoordinateWithHeights]) => {
375
376
  if (worldCoordinateWithHeights[2] != null) {
376
377
  const newWorldCoords = transform(
377
378
  image.transformImage2RealWorld(imageCoordinate, worldCoordinateWithHeights[2]),
378
- image.meta.projection,
379
- wgs84Projection,
379
+ image.meta.projection.proj,
380
+ wgs84Projection.proj,
380
381
  );
381
382
  newWorldCoords[2] = worldCoordinateWithHeights[2];
382
383
  if (
@@ -406,11 +407,10 @@ function pickTerrain(pickTerrainOptions) {
406
407
  * @export
407
408
  */
408
409
  export async function transformFromImage(image, imageCoordinate, options = {}) {
409
- const wgs84Projection = getProjection('EPSG:4326');
410
410
  const initialWorldCoords = transform(
411
411
  image.transformImage2RealWorld(imageCoordinate, image.averageHeight),
412
- image.meta.projection,
413
- wgs84Projection,
412
+ image.meta.projection.proj,
413
+ wgs84Projection.proj,
414
414
  );
415
415
 
416
416
  const terrainErrorThreshold = options.terrainErrorThreshold || 1;
@@ -430,8 +430,8 @@ export async function transformFromImage(image, imageCoordinate, options = {}) {
430
430
  }
431
431
 
432
432
  coordsObj.coords = options.dataProjection ?
433
- transform(coordsObj.coords, wgs84Projection, options.dataProjection) :
434
- transform(coordsObj.coords, wgs84Projection, getProjection('EPSG:3857'));
433
+ transform(coordsObj.coords, wgs84Projection.proj, options.dataProjection.proj) :
434
+ transform(coordsObj.coords, wgs84Projection.proj, mercatorProjection.proj);
435
435
  return coordsObj;
436
436
  }
437
437
 
@@ -453,31 +453,3 @@ export function hasSameOrigin(url) {
453
453
  const uri = new URL(url);
454
454
  return currentUri.host.toLowerCase() === uri.host.toLocaleLowerCase();
455
455
  }
456
-
457
- /**
458
- * destroys a cesium Event Emitter, (removes all listeners)
459
- * @param {import("@vcmap/cesium").Event} cesiumEvent
460
- */
461
- export function destroyCesiumEvent(cesiumEvent) {
462
- // @ts-ignore
463
- for (let i = 0; i < cesiumEvent._listeners.length; i++) {
464
- // @ts-ignore
465
- cesiumEvent._listeners[i] = undefined;
466
- }
467
- // @ts-ignore
468
- for (let i = 0; i < cesiumEvent._scopes.length; i++) {
469
- // @ts-ignore
470
- cesiumEvent._scopes[i] = undefined;
471
- }
472
- // @ts-ignore
473
- for (let i = 0; i < cesiumEvent._toRemove.length; i++) {
474
- // @ts-ignore
475
- cesiumEvent._toRemove[i] = undefined;
476
- }
477
- // @ts-ignore
478
- cesiumEvent._listeners.length = 0;
479
- // @ts-ignore
480
- cesiumEvent._scopes.length = 0;
481
- // @ts-ignore
482
- cesiumEvent._toRemove.length = 0;
483
- }