@vcmap/core 5.0.0-rc.0 → 5.0.0-rc.4

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 (46) hide show
  1. package/index.d.ts +7470 -0
  2. package/index.js +2 -2
  3. package/package.json +3 -2
  4. package/src/vcs/vcm/interaction/coordinateAtPixel.js +1 -1
  5. package/src/vcs/vcm/layer/cesiumTileset.js +3 -3
  6. package/src/vcs/vcm/layer/czml.js +2 -2
  7. package/src/vcs/vcm/layer/dataSource.js +2 -2
  8. package/src/vcs/vcm/layer/featureLayer.js +2 -2
  9. package/src/vcs/vcm/layer/featureStore.js +4 -4
  10. package/src/vcs/vcm/layer/geojson.js +4 -4
  11. package/src/vcs/vcm/layer/layer.js +3 -3
  12. package/src/vcs/vcm/layer/oblique/obliqueHelpers.js +2 -2
  13. package/src/vcs/vcm/layer/openStreetMap.js +2 -2
  14. package/src/vcs/vcm/layer/pointCloud.js +2 -2
  15. package/src/vcs/vcm/layer/rasterLayer.js +2 -2
  16. package/src/vcs/vcm/layer/singleImage.js +4 -3
  17. package/src/vcs/vcm/layer/terrain.js +2 -2
  18. package/src/vcs/vcm/layer/terrainHelpers.js +4 -8
  19. package/src/vcs/vcm/layer/tileProvider/tileProvider.js +2 -2
  20. package/src/vcs/vcm/layer/tms.js +2 -2
  21. package/src/vcs/vcm/layer/vector.js +4 -4
  22. package/src/vcs/vcm/layer/vectorTile.js +3 -3
  23. package/src/vcs/vcm/layer/wfs.js +3 -3
  24. package/src/vcs/vcm/layer/wms.js +3 -3
  25. package/src/vcs/vcm/layer/wmts.js +2 -2
  26. package/src/vcs/vcm/maps/cameraLimiter.js +6 -6
  27. package/src/vcs/vcm/maps/cesium.js +3 -3
  28. package/src/vcs/vcm/maps/map.js +28 -13
  29. package/src/vcs/vcm/maps/oblique.js +10 -10
  30. package/src/vcs/vcm/maps/openlayers.js +2 -2
  31. package/src/vcs/vcm/object.js +2 -2
  32. package/src/vcs/vcm/oblique/ObliqueCollection.js +83 -31
  33. package/src/vcs/vcm/oblique/ObliqueDataSet.js +60 -17
  34. package/src/vcs/vcm/oblique/ObliqueImage.js +1 -1
  35. package/src/vcs/vcm/oblique/ObliqueImageMeta.js +2 -2
  36. package/src/vcs/vcm/oblique/ObliqueProvider.js +10 -7
  37. package/src/vcs/vcm/oblique/helpers.js +12 -40
  38. package/src/vcs/vcm/oblique/parseImageJson.js +17 -9
  39. package/src/vcs/vcm/util/extent.js +18 -11
  40. package/src/vcs/vcm/util/featureProvider/abstractFeatureProvider.js +2 -2
  41. package/src/vcs/vcm/util/featureProvider/wmsFeatureProvider.js +4 -4
  42. package/src/vcs/vcm/util/indexedCollection.js +23 -0
  43. package/src/vcs/vcm/util/layerCollection.js +10 -5
  44. package/src/vcs/vcm/util/projection.js +38 -4
  45. package/src/vcs/vcm/util/style/styleItem.js +17 -0
  46. package/src/vcs/vcm/util/viewpoint.js +6 -3
package/index.js CHANGED
@@ -84,7 +84,7 @@ export { default as WMS } from './src/vcs/vcm/layer/wms.js';
84
84
  export { getWMSSource } from './src/vcs/vcm/layer/wmsHelpers.js';
85
85
  export { default as WMTS } from './src/vcs/vcm/layer/wmts.js';
86
86
  export { default as BaseOLMap } from './src/vcs/vcm/maps/baseOLMap.js';
87
- export { Mode, default as CameraLimiter } from './src/vcs/vcm/maps/cameraLimiter.js';
87
+ export { CameraLimiterMode, default as CameraLimiter } from './src/vcs/vcm/maps/cameraLimiter.js';
88
88
  export { default as CesiumMap } from './src/vcs/vcm/maps/cesium.js';
89
89
  export { default as VcsMap } from './src/vcs/vcm/maps/map.js';
90
90
  export { default as MapState } from './src/vcs/vcm/maps/mapState.js';
@@ -98,7 +98,7 @@ export { default as ObliqueImageMeta } from './src/vcs/vcm/oblique/ObliqueImageM
98
98
  export { default as ObliqueProvider } from './src/vcs/vcm/oblique/ObliqueProvider.js';
99
99
  export { default as ObliqueView } from './src/vcs/vcm/oblique/ObliqueView.js';
100
100
  export { ObliqueViewDirection, obliqueViewDirectionNames, getDirectionName } from './src/vcs/vcm/oblique/ObliqueViewDirection.js';
101
- export { sortRealWordEdgeCoordinates, checkLineIntersection, transformCWIFC, transformToImage, transformFromImage, hasSameOrigin, destroyCesiumEvent } from './src/vcs/vcm/oblique/helpers.js';
101
+ export { sortRealWordEdgeCoordinates, checkLineIntersection, transformCWIFC, transformToImage, transformFromImage, hasSameOrigin } from './src/vcs/vcm/oblique/helpers.js';
102
102
  export { getVersionFromImageJson, parseImageMeta, parseImageData, parseLegacyImageData } from './src/vcs/vcm/oblique/parseImageJson.js';
103
103
  export { default as ClippingObject } from './src/vcs/vcm/util/clipping/clippingObject.js';
104
104
  export { default as ClippingObjectManager } from './src/vcs/vcm/util/clipping/clippingObjectManager.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vcmap/core",
3
- "version": "5.0.0-rc.0",
3
+ "version": "5.0.0-rc.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -28,7 +28,8 @@
28
28
  "src/",
29
29
  "LICENSE.md",
30
30
  "README.md",
31
- "index.js"
31
+ "index.js",
32
+ "index.d.ts"
32
33
  ],
33
34
  "author": "Virtual City Systems",
34
35
  "license": "MIT",
@@ -85,7 +85,7 @@ class CoordinateAtPixel extends AbstractInteraction {
85
85
  if (Number.isFinite(pixel[0]) && Number.isFinite(pixel[1])) {
86
86
  return transformFromImage(image, pixel, {
87
87
  dontUseTerrain: !!move,
88
- dataProjection: mercatorProjection.proj,
88
+ dataProjection: mercatorProjection,
89
89
  }).then((coordinates) => {
90
90
  event.obliqueParameters = { pixel };
91
91
  event.position = coordinates.coords;
@@ -266,7 +266,7 @@ class CesiumTileset extends FeatureLayer {
266
266
  const threeDimExtent = getExtentFromTileset(impl.cesium3DTileset);
267
267
 
268
268
  const actualExtent = new Extent({
269
- ...mercatorProjection.getConfigObject(),
269
+ projection: mercatorProjection.toJSON(),
270
270
  coordinates: threeDimExtent,
271
271
  });
272
272
 
@@ -309,9 +309,9 @@ class CesiumTileset extends FeatureLayer {
309
309
  /**
310
310
  * @returns {CesiumTilesetOptions}
311
311
  */
312
- getConfigObject() {
312
+ toJSON() {
313
313
  /** @type {CesiumTilesetOptions} */
314
- const config = super.getConfigObject();
314
+ const config = super.toJSON();
315
315
  const defaultOptions = CesiumTileset.getDefaultOptions();
316
316
  if (this.highlightStyle) {
317
317
  config.highlightStyle = this.highlightStyle[referenceableStyleSymbol] ?
@@ -102,8 +102,8 @@ class Czml extends DataSource {
102
102
  * @inheritDoc
103
103
  * @returns {CzmlOptions}
104
104
  */
105
- getConfigObject() {
106
- const config = /** @type {CzmlOptions} */ (super.getConfigObject());
105
+ toJSON() {
106
+ const config = /** @type {CzmlOptions} */ (super.toJSON());
107
107
  if (this.sourceUri) {
108
108
  config.sourceUri = this.sourceUri;
109
109
  }
@@ -235,8 +235,8 @@ class DataSource extends Layer {
235
235
  * @inheritDoc
236
236
  * @returns {DataSourceOptions}
237
237
  */
238
- getConfigObject() {
239
- const config = /** @type {DataSourceOptions} */ (super.getConfigObject());
238
+ toJSON() {
239
+ const config = /** @type {DataSourceOptions} */ (super.toJSON());
240
240
  if (Object.keys(this._genericFeatureProperties).length > 0) {
241
241
  config.genericFeatureProperties = { ...this._genericFeatureProperties };
242
242
  }
@@ -229,8 +229,8 @@ class FeatureLayer extends Layer {
229
229
  /**
230
230
  * @returns {FeatureLayerOptions}
231
231
  */
232
- getConfigObject() {
233
- const config = /** @type {FeatureLayerOptions} */ (super.getConfigObject());
232
+ toJSON() {
233
+ const config = /** @type {FeatureLayerOptions} */ (super.toJSON());
234
234
  if (!this.getStyleOrDefaultStyle().equals(this._style)) {
235
235
  if (this._style[referenceableStyleSymbol]) {
236
236
  config.style = this.style.getReference();
@@ -93,7 +93,7 @@ class FeatureStore extends Vector {
93
93
  featureType: 'simple',
94
94
  features: [],
95
95
  ...Vector.getDefaultOptions(),
96
- projection: mercatorProjection.getConfigObject(),
96
+ projection: mercatorProjection.toJSON(),
97
97
  staticRepresentation: {},
98
98
  hiddenStaticFeatureIds: [],
99
99
  vcsMeta: {
@@ -497,7 +497,7 @@ class FeatureStore extends Vector {
497
497
  }
498
498
 
499
499
  const actualExtent = new Extent({
500
- ...mercatorProjection.getConfigObject(),
500
+ projection: mercatorProjection.toJSON(),
501
501
  coordinates: mercatorExtent,
502
502
  });
503
503
 
@@ -596,8 +596,8 @@ class FeatureStore extends Vector {
596
596
  * @inheritDoc
597
597
  * @returns {FeatureStoreOptions}
598
598
  */
599
- getConfigObject() {
600
- const config = /** @type {FeatureStoreOptions} */ (super.getConfigObject());
599
+ toJSON() {
600
+ const config = /** @type {FeatureStoreOptions} */ (super.toJSON());
601
601
  const defaultOptions = FeatureStore.getDefaultOptions();
602
602
 
603
603
  delete config.projection;
@@ -33,7 +33,7 @@ class GeoJSON extends Vector {
33
33
  static getDefaultOptions() {
34
34
  return {
35
35
  ...Vector.getDefaultOptions(),
36
- projection: wgs84Projection.getConfigObject(),
36
+ projection: wgs84Projection.toJSON(),
37
37
  features: undefined,
38
38
  };
39
39
  }
@@ -149,13 +149,13 @@ class GeoJSON extends Vector {
149
149
  * @inheritDoc
150
150
  * @returns {GeoJSONOptions}
151
151
  */
152
- getConfigObject() {
153
- const config = /** @type {GeoJSONOptions} */ (super.getConfigObject());
152
+ toJSON() {
153
+ const config = /** @type {GeoJSONOptions} */ (super.toJSON());
154
154
  const defaultOptions = GeoJSON.getDefaultOptions();
155
155
 
156
156
  const defaultProjection = new Projection(defaultOptions.projection);
157
157
  if (!this.projection.equals(defaultProjection)) {
158
- config.projection = this.projection.getConfigObject();
158
+ config.projection = this.projection.toJSON();
159
159
  } else {
160
160
  delete config.projection;
161
161
  }
@@ -680,9 +680,9 @@ class Layer extends VcsObject {
680
680
  /**
681
681
  * @returns {LayerOptions}
682
682
  */
683
- getConfigObject() {
683
+ toJSON() {
684
684
  /** @type {LayerOptions} */
685
- const config = super.getConfigObject();
685
+ const config = super.toJSON();
686
686
  const defaultOptions = Layer.getDefaultOptions();
687
687
 
688
688
  if (this.activeOnStartup !== defaultOptions.activeOnStartup) {
@@ -706,7 +706,7 @@ class Layer extends VcsObject {
706
706
  }
707
707
 
708
708
  if (this.extent && this.extent.isValid()) {
709
- config.extent = this.extent.getConfigObject();
709
+ config.extent = this.extent.toJSON();
710
710
  }
711
711
 
712
712
  if (this._exclusiveGroups.length > 0) {
@@ -91,7 +91,7 @@ export async function mercatorGeometryToImageGeometry(inputSourceGeometry, desti
91
91
  const coordinates = sourceGeometry.getCoordinates();
92
92
  /** type {Array.<import("ol/coordinate").Coordinate>} */
93
93
  const flattenCoordinates = getFlatCoordinatesFromGeometry(sourceGeometry, coordinates);
94
- let transformer = getTransform(mercatorProjection.proj, image.meta.projection);
94
+ let transformer = getTransform(mercatorProjection.proj, image.meta.projection.proj);
95
95
 
96
96
  let updatedPositions = [];
97
97
  if (image.meta.terrainProvider) {
@@ -99,7 +99,7 @@ export async function mercatorGeometryToImageGeometry(inputSourceGeometry, desti
99
99
  Projection.mercatorToWgs84(coord, true);
100
100
  return Cartographic.fromDegrees(coord[0], coord[1]);
101
101
  });
102
- transformer = getTransform(wgs84Projection.proj, image.meta.projection);
102
+ transformer = getTransform(wgs84Projection.proj, image.meta.projection.proj);
103
103
  updatedPositions = await sampleTerrainMostDetailed(image.meta.terrainProvider, cartographicCoordinates);
104
104
  }
105
105
 
@@ -160,8 +160,8 @@ class OpenStreetMap extends Layer {
160
160
  * @inheritDoc
161
161
  * @returns {OpenStreetMapOptions}
162
162
  */
163
- getConfigObject() {
164
- const config = /** @type {OpenStreetMapOptions} */ (super.getConfigObject());
163
+ toJSON() {
164
+ const config = /** @type {OpenStreetMapOptions} */ (super.toJSON());
165
165
  const defaultOptions = OpenStreetMap.getDefaultOptions();
166
166
 
167
167
  if (this._splitDirection !== ImagerySplitDirection.NONE) {
@@ -146,8 +146,8 @@ class PointCloud extends CesiumTileset {
146
146
  * @inheritDoc
147
147
  * @returns {PointCloudOptions}
148
148
  */
149
- getConfigObject() {
150
- const config = /** @type {PointCloudOptions} */ (super.getConfigObject());
149
+ toJSON() {
150
+ const config = /** @type {PointCloudOptions} */ (super.toJSON());
151
151
  const defaultOptions = PointCloud.getDefaultOptions();
152
152
 
153
153
  if (this.defaultPointSize !== defaultOptions.pointSize) {
@@ -248,8 +248,8 @@ class RasterLayer extends Layer {
248
248
  * @inheritDoc
249
249
  * @returns {RasterLayerOptions}
250
250
  */
251
- getConfigObject() {
252
- const config = /** @type {RasterLayerOptions} */ (super.getConfigObject());
251
+ toJSON() {
252
+ const config = /** @type {RasterLayerOptions} */ (super.toJSON());
253
253
  const defaultOptions = RasterLayer.getDefaultOptions();
254
254
 
255
255
  if (this.extent.equals(new Extent())) {
@@ -6,6 +6,7 @@ import CesiumMap from '../maps/cesium.js';
6
6
  import Openlayers from '../maps/openlayers.js';
7
7
  import Extent from '../util/extent.js';
8
8
  import { VcsClassRegistry } from '../classRegistry.js';
9
+ import { wgs84Projection } from '../util/projection.js';
9
10
 
10
11
  /**
11
12
  * @typedef {RasterLayerOptions} SingleImageOptions
@@ -50,7 +51,7 @@ class SingleImage extends RasterLayer {
50
51
  if (!this.extent.isValid()) {
51
52
  this.getLogger().warning(`layer ${this.name} was constructed with an invalid extent, defaulting to global extent`);
52
53
  this.extent = new Extent({
53
- epsg: 'EPSG:4326',
54
+ projection: wgs84Projection.toJSON(),
54
55
  coordinates: [-180, -90, 180, 90],
55
56
  });
56
57
  }
@@ -103,8 +104,8 @@ class SingleImage extends RasterLayer {
103
104
  * @inheritDoc
104
105
  * @returns {SingleImageOptions}
105
106
  */
106
- getConfigObject() {
107
- const config = /** @type {SingleImageOptions} */ (super.getConfigObject());
107
+ toJSON() {
108
+ const config = /** @type {SingleImageOptions} */ (super.toJSON());
108
109
  delete config.tilingSchema;
109
110
 
110
111
  if (this.credit) {
@@ -104,8 +104,8 @@ class Terrain extends Layer {
104
104
  /**
105
105
  * @returns {TerrainOptions}
106
106
  */
107
- getConfigObject() {
108
- const config = /** @type {TerrainOptions} */ (super.getConfigObject());
107
+ toJSON() {
108
+ const config = /** @type {TerrainOptions} */ (super.toJSON());
109
109
  const defaultOptions = Terrain.getDefaultOptions();
110
110
 
111
111
  if (this.requestVertexNormals !== defaultOptions.requestVertexNormals) {
@@ -1,6 +1,6 @@
1
1
  import { CesiumTerrainProvider, Cartographic, Cartesian2, sampleTerrainMostDetailed, sampleTerrain } from '@vcmap/cesium';
2
2
  import { getTransform } from 'ol/proj.js';
3
- import Projection, { wgs84Projection } from '../util/projection.js';
3
+ import { wgs84Projection } from '../util/projection.js';
4
4
 
5
5
  /**
6
6
  * @typedef {Object} TerrainProviderOptions
@@ -69,18 +69,14 @@ export function sampleCesiumTerrain(terrainProvider, level, positions) {
69
69
  * changes input coordinate Array in place, new height can also be accessed by coordinates[x][2]
70
70
  * @param {import("@vcmap/cesium").CesiumTerrainProvider} terrainProvider
71
71
  * @param {Array<import("ol/coordinate").Coordinate>} coordinates
72
- * @param {(import("@vcmap/core").Projection|import("ol/proj/Projection").default)=} optSourceProjection - if input is not WGS84
72
+ * @param {import("@vcmap/core").Projection=} optSourceProjection - if input is not WGS84
73
73
  * @param {Array<import("ol/coordinate").Coordinate>=} result
74
74
  * @returns {Promise<Array<import("ol/coordinate").Coordinate>>}
75
75
  */
76
76
  export function getHeightFromTerrainProvider(terrainProvider, coordinates, optSourceProjection, result) {
77
- const usedProj = optSourceProjection instanceof Projection ?
78
- optSourceProjection.proj :
79
- optSourceProjection;
80
-
81
- const sourceTransformer = usedProj ?
77
+ const sourceTransformer = optSourceProjection ?
82
78
  getTransform(
83
- usedProj,
79
+ optSourceProjection.proj,
84
80
  wgs84Projection.proj,
85
81
  ) :
86
82
  null;
@@ -530,8 +530,8 @@ class TileProvider extends VcsObject {
530
530
  * @returns {TileProviderOptions}
531
531
  * @api
532
532
  */
533
- getConfigObject() {
534
- const config = /** @type {TileProviderOptions} */ (super.getConfigObject());
533
+ toJSON() {
534
+ const config = /** @type {TileProviderOptions} */ (super.toJSON());
535
535
  const defaultOptions = TileProvider.getDefaultOptions();
536
536
 
537
537
  if (defaultOptions.tileCacheSize !== this.tileCacheSize) {
@@ -92,8 +92,8 @@ class TMS extends RasterLayer {
92
92
  * @inheritDoc
93
93
  * @returns {TMSOptions}
94
94
  */
95
- getConfigObject() {
96
- const config = /** @type {TMSOptions} */ (super.getConfigObject());
95
+ toJSON() {
96
+ const config = /** @type {TMSOptions} */ (super.toJSON());
97
97
  const defaultOptions = TMS.getDefaultOptions();
98
98
 
99
99
  if (this.tilingSchema !== defaultOptions.tilingSchema) {
@@ -538,7 +538,7 @@ class Vector extends FeatureLayer {
538
538
  return metaExtent;
539
539
  }
540
540
  const extent = new Extent({
541
- ...mercatorProjection.getConfigObject(),
541
+ projection: mercatorProjection.toJSON(),
542
542
  coordinates: this.source.getExtent(),
543
543
  });
544
544
  if (extent.isValid()) {
@@ -573,12 +573,12 @@ class Vector extends FeatureLayer {
573
573
  /**
574
574
  * @returns {VectorOptions}
575
575
  */
576
- getConfigObject() {
577
- const config = /** @type {VectorOptions} */ (super.getConfigObject());
576
+ toJSON() {
577
+ const config = /** @type {VectorOptions} */ (super.toJSON());
578
578
  const defaultOptions = Vector.getDefaultOptions();
579
579
 
580
580
  if (this.projection.epsg !== getDefaultProjection().epsg) {
581
- config.projection = this.projection.getConfigObject();
581
+ config.projection = this.projection.toJSON();
582
582
  }
583
583
 
584
584
  if (this.maxResolution !== defaultOptions.maxResolution) {
@@ -448,8 +448,8 @@ class VectorTile extends FeatureLayer {
448
448
  * @inheritDoc
449
449
  * @returns {VectorTileOptions}
450
450
  */
451
- getConfigObject() {
452
- const config = /** @type {VectorTileOptions} */ (super.getConfigObject());
451
+ toJSON() {
452
+ const config = /** @type {VectorTileOptions} */ (super.toJSON());
453
453
  const defaultOptions = VectorTile.getDefaultOptions();
454
454
 
455
455
  if (this._maxLevel !== defaultOptions.maxLevel) {
@@ -466,7 +466,7 @@ class VectorTile extends FeatureLayer {
466
466
  }
467
467
 
468
468
  if (this.tileProvider) {
469
- const tileProviderConfig = this.tileProvider.getConfigObject();
469
+ const tileProviderConfig = this.tileProvider.toJSON();
470
470
  config.tileProvider = tileProviderConfig;
471
471
  } else if (this._tileProviderOptions) {
472
472
  config.tileProvider = this._tileProviderOptions;
@@ -40,7 +40,7 @@ class WFS extends Vector {
40
40
  * @param {WFSOptions} options
41
41
  */
42
42
  constructor(options) {
43
- const proj = new Projection(options.projection).getConfigObject();
43
+ const proj = new Projection(options.projection).toJSON();
44
44
  proj.alias = [`http://www.opengis.net/gml/srs/epsg.xml#${/** @type {string} */ (proj.epsg).match(/\d+/)[0]}`];
45
45
  options.projection = proj;
46
46
  super(options);
@@ -148,8 +148,8 @@ class WFS extends Vector {
148
148
  * @inheritDoc
149
149
  * @returns {WFSOptions}
150
150
  */
151
- getConfigObject() {
152
- const config = /** @type {WFSOptions} */ (super.getConfigObject());
151
+ toJSON() {
152
+ const config = /** @type {WFSOptions} */ (super.toJSON());
153
153
 
154
154
  config.featureType = this.featureType.slice();
155
155
  config.featureNS = this.featureNS;
@@ -192,8 +192,8 @@ class WMS extends RasterLayer {
192
192
  /**
193
193
  * @returns {WMSOptions}
194
194
  */
195
- getConfigObject() {
196
- const config = /** @type {WMSOptions} */ (super.getConfigObject());
195
+ toJSON() {
196
+ const config = /** @type {WMSOptions} */ (super.toJSON());
197
197
  const defaultOptions = WMS.getDefaultOptions();
198
198
 
199
199
  if (this.parameters.LAYERS) {
@@ -229,7 +229,7 @@ class WMS extends RasterLayer {
229
229
  }
230
230
 
231
231
  if (this.featureProvider && this.featureProvider instanceof WMSFeatureProvider) {
232
- const featureInfoConfig = this.featureProvider.getConfigObject();
232
+ const featureInfoConfig = this.featureProvider.toJSON();
233
233
  if (this.tileSize[0] === featureInfoConfig.tileSize[0] || this.tileSize[1] === featureInfoConfig.tileSize[1]) {
234
234
  delete featureInfoConfig.tileSize;
235
235
  }
@@ -176,8 +176,8 @@ class WMTS extends RasterLayer {
176
176
  * @inheritDoc
177
177
  * @returns {WMTSOptions}
178
178
  */
179
- getConfigObject() {
180
- const config = /** @type {WMTSOptions} */ (super.getConfigObject());
179
+ toJSON() {
180
+ const config = /** @type {WMTSOptions} */ (super.toJSON());
181
181
  const defaultOptions = WMTS.getDefaultOptions();
182
182
 
183
183
  if (this.tilingSchema !== defaultOptions.tilingSchema) {
@@ -23,7 +23,7 @@ import {
23
23
  * @property {string} HEIGHT
24
24
  * @property {string} DISTANCE
25
25
  */
26
- export const Mode = {
26
+ export const CameraLimiterMode = {
27
27
  HEIGHT: 'height',
28
28
  DISTANCE: 'distance',
29
29
  };
@@ -42,7 +42,7 @@ class CameraLimiter {
42
42
  */
43
43
  static getDefaultOptions() {
44
44
  return {
45
- mode: Mode.HEIGHT,
45
+ mode: CameraLimiterMode.HEIGHT,
46
46
  terrainUrl: undefined,
47
47
  limit: 200,
48
48
  level: 12,
@@ -56,10 +56,10 @@ class CameraLimiter {
56
56
  const defaultOptions = CameraLimiter.getDefaultOptions();
57
57
  /**
58
58
  * The mode to use. When using DISTANCE mode, be sure to have a terrainProvider set.
59
- * @type {Mode}
59
+ * @type {CameraLimiterMode}
60
60
  * @api
61
61
  */
62
- this.mode = parseEnumValue(options.mode, Mode, defaultOptions.mode);
62
+ this.mode = parseEnumValue(options.mode, CameraLimiterMode, defaultOptions.mode);
63
63
  /**
64
64
  * @type {string|null}
65
65
  * @private
@@ -170,7 +170,7 @@ class CameraLimiter {
170
170
  let promise = Promise.resolve();
171
171
  const cameraCartographic = Cartographic.fromCartesian(camera.position);
172
172
  if (cameraCartographic) {
173
- if (this.mode === Mode.DISTANCE && this._terrainProvider) {
173
+ if (this.mode === CameraLimiterMode.DISTANCE && this._terrainProvider) {
174
174
  promise = this._updateTerrainHeight(cameraCartographic);
175
175
  if (this._terrainHeight && (cameraCartographic.height - this._terrainHeight) < this.limit) {
176
176
  const newHeight = this._terrainHeight + this.limit;
@@ -194,7 +194,7 @@ class CameraLimiter {
194
194
  /**
195
195
  * @returns {CameraLimiterOptions}
196
196
  */
197
- getConfigObject() {
197
+ toJSON() {
198
198
  const config = {};
199
199
  const defaultOptions = CameraLimiter.getDefaultOptions();
200
200
  if (this.terrainUrl) {
@@ -1096,8 +1096,8 @@ class CesiumMap extends VcsMap {
1096
1096
  * @returns {CesiumMapOptions}
1097
1097
  * @api
1098
1098
  */
1099
- getConfigObject() {
1100
- const config = /** @type {CesiumMapOptions} */ (super.getConfigObject());
1099
+ toJSON() {
1100
+ const config = /** @type {CesiumMapOptions} */ (super.toJSON());
1101
1101
  const defaultOptions = CesiumMap.getDefaultOptions();
1102
1102
 
1103
1103
  if (this.enableLightning !== defaultOptions.enableLightning) {
@@ -1117,7 +1117,7 @@ class CesiumMap extends VcsMap {
1117
1117
  }
1118
1118
 
1119
1119
  if (this._cameraLimiter) {
1120
- config.cameraLimiter = this._cameraLimiter.getConfigObject();
1120
+ config.cameraLimiter = this._cameraLimiter.toJSON();
1121
1121
  } else if (this._cameraLimiterOptions && !this.initialized) {
1122
1122
  config.cameraLimiter = this._cameraLimiterOptions;
1123
1123
  }
@@ -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
  /**
@@ -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
  }
@@ -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';
@@ -243,7 +243,7 @@ class Oblique extends BaseOLMap {
243
243
  get collection() { return this._obliqueProvider.collection; }
244
244
 
245
245
  /**
246
- * @type {import("@vcmap/cesium").Event}
246
+ * @type {import("@vcmap/core").VcsEvent<import("@vcmap/core").ObliqueImage>}
247
247
  * @readonly
248
248
  * @api
249
249
  */
@@ -294,13 +294,13 @@ class Oblique extends BaseOLMap {
294
294
  if (image) {
295
295
  const coords = boundingExtent(image.groundCoordinates);
296
296
  return new Extent({
297
- coordinates: transformExtent(coords, image.meta.projection, mercatorProjection.proj),
298
- epsg: 'EPSG:3857',
297
+ coordinates: transformExtent(coords, image.meta.projection.proj, mercatorProjection.proj),
298
+ projection: mercatorProjection.toJSON(),
299
299
  });
300
300
  }
301
301
  return new Extent({
302
302
  coordinates: [-18924313.4349, -15538711.0963, 18924313.4349, 15538711.0963],
303
- epsg: 'EPSG:3857',
303
+ projection: mercatorProjection.toJSON(),
304
304
  });
305
305
  }
306
306
 
@@ -399,7 +399,7 @@ class Oblique extends BaseOLMap {
399
399
  return null;
400
400
  }
401
401
 
402
- const transformationOptions = { dataProjection: getProjection('EPSG:4326') };
402
+ const transformationOptions = { dataProjection: wgs84Projection };
403
403
  const { coords } = await transformFromImage(image, viewCenter, transformationOptions);
404
404
  return this._computeViewpointInternal(coords);
405
405
  }
@@ -421,7 +421,7 @@ class Oblique extends BaseOLMap {
421
421
 
422
422
  const gpInternalProjection = image.transformImage2RealWorld(gpImageCoordinates, image.averageHeight);
423
423
 
424
- const transfrom = getTransform(image.meta.projection, wgs84Projection.proj);
424
+ const transfrom = getTransform(image.meta.projection.proj, wgs84Projection.proj);
425
425
  const gpWGS84 = transfrom(gpInternalProjection.slice(0, 2));
426
426
  return this._computeViewpointInternal(gpWGS84);
427
427
  }
@@ -489,7 +489,7 @@ class Oblique extends BaseOLMap {
489
489
  const bl = image.transformImage2RealWorld([extent[0], extent[1]]);
490
490
  const ur = image.transformImage2RealWorld([extent[2], extent[3]]);
491
491
  const bbox = [bl[0], bl[1], ur[0], ur[1]];
492
- const transformedBbox = transformExtent(bbox, image.meta.projection, wgs84Projection.proj);
492
+ const transformedBbox = transformExtent(bbox, image.meta.projection.proj, wgs84Projection.proj);
493
493
  return containsXY(transformedBbox, coords[0], coords[1]);
494
494
  }
495
495
 
@@ -497,8 +497,8 @@ class Oblique extends BaseOLMap {
497
497
  * @returns {ObliqueOptions}
498
498
  * @api
499
499
  */
500
- getConfigObject() {
501
- const config = /** @type {ObliqueOptions} */ (super.getConfigObject());
500
+ toJSON() {
501
+ const config = /** @type {ObliqueOptions} */ (super.toJSON());
502
502
  const defaultOptions = Oblique.getDefaultOptions();
503
503
 
504
504
  if (this.mapChangeEvent === 'movened') {
@@ -189,8 +189,8 @@ class Openlayers extends BaseOLMap {
189
189
  * @returns {OpenlayersOptions}
190
190
  * @api
191
191
  */
192
- getConfigObject() {
193
- const config = /** @type {OpenlayersOptions} */ (super.getConfigObject());
192
+ toJSON() {
193
+ const config = /** @type {OpenlayersOptions} */ (super.toJSON());
194
194
 
195
195
  const defaultOptions = Openlayers.getDefaultOptions();
196
196
  if (this.fixedNorthOrientation !== defaultOptions.fixedNorthOrientation) {