@vcmap/core 5.0.0-rc.3 → 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.
- package/index.d.ts +8 -3
- package/index.js +1 -1
- package/package.json +1 -1
- package/src/vcs/vcm/layer/cesiumTileset.js +1 -1
- package/src/vcs/vcm/layer/featureStore.js +1 -1
- package/src/vcs/vcm/layer/singleImage.js +2 -1
- package/src/vcs/vcm/layer/vector.js +1 -1
- package/src/vcs/vcm/maps/cameraLimiter.js +5 -5
- package/src/vcs/vcm/maps/map.js +26 -11
- package/src/vcs/vcm/maps/oblique.js +2 -2
- package/src/vcs/vcm/object.js +1 -1
- package/src/vcs/vcm/util/extent.js +7 -10
package/index.d.ts
CHANGED
|
@@ -4731,7 +4731,7 @@ export interface CameraLimiterOptions {
|
|
|
4731
4731
|
/**
|
|
4732
4732
|
* Enumeration of camera limiter modes.
|
|
4733
4733
|
*/
|
|
4734
|
-
export const enum
|
|
4734
|
+
export const enum CameraLimiterMode {
|
|
4735
4735
|
HEIGHT,
|
|
4736
4736
|
DISTANCE
|
|
4737
4737
|
}
|
|
@@ -4745,7 +4745,7 @@ export class CameraLimiter {
|
|
|
4745
4745
|
/**
|
|
4746
4746
|
* The mode to use. When using DISTANCE mode, be sure to have a terrainProvider set.
|
|
4747
4747
|
*/
|
|
4748
|
-
mode:
|
|
4748
|
+
mode: CameraLimiterMode;
|
|
4749
4749
|
/**
|
|
4750
4750
|
* The minimum height/distance to the terrain the camera must maintain
|
|
4751
4751
|
*/
|
|
@@ -6179,11 +6179,16 @@ export class ExclusiveManager {
|
|
|
6179
6179
|
|
|
6180
6180
|
/**
|
|
6181
6181
|
*/
|
|
6182
|
-
export interface ExtentOptions
|
|
6182
|
+
export interface ExtentOptions {
|
|
6183
|
+
type?: string;
|
|
6183
6184
|
/**
|
|
6184
6185
|
* if not specified, the extent of the projection is used
|
|
6185
6186
|
*/
|
|
6186
6187
|
coordinates?: import("ol/extent").Extent | undefined;
|
|
6188
|
+
/**
|
|
6189
|
+
* if not specified the default projection is assumed
|
|
6190
|
+
*/
|
|
6191
|
+
projection?: ProjectionOptions;
|
|
6187
6192
|
}
|
|
6188
6193
|
|
|
6189
6194
|
/**
|
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 {
|
|
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';
|
package/package.json
CHANGED
|
@@ -266,7 +266,7 @@ class CesiumTileset extends FeatureLayer {
|
|
|
266
266
|
const threeDimExtent = getExtentFromTileset(impl.cesium3DTileset);
|
|
267
267
|
|
|
268
268
|
const actualExtent = new Extent({
|
|
269
|
-
|
|
269
|
+
projection: mercatorProjection.toJSON(),
|
|
270
270
|
coordinates: threeDimExtent,
|
|
271
271
|
});
|
|
272
272
|
|
|
@@ -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
|
-
|
|
54
|
+
projection: wgs84Projection.toJSON(),
|
|
54
55
|
coordinates: [-180, -90, 180, 90],
|
|
55
56
|
});
|
|
56
57
|
}
|
|
@@ -538,7 +538,7 @@ class Vector extends FeatureLayer {
|
|
|
538
538
|
return metaExtent;
|
|
539
539
|
}
|
|
540
540
|
const extent = new Extent({
|
|
541
|
-
|
|
541
|
+
projection: mercatorProjection.toJSON(),
|
|
542
542
|
coordinates: this.source.getExtent(),
|
|
543
543
|
});
|
|
544
544
|
if (extent.isValid()) {
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
* @property {string} HEIGHT
|
|
24
24
|
* @property {string} DISTANCE
|
|
25
25
|
*/
|
|
26
|
-
export const
|
|
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:
|
|
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 {
|
|
59
|
+
* @type {CameraLimiterMode}
|
|
60
60
|
* @api
|
|
61
61
|
*/
|
|
62
|
-
this.mode = parseEnumValue(options.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 ===
|
|
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;
|
package/src/vcs/vcm/maps/map.js
CHANGED
|
@@ -101,17 +101,9 @@ class VcsMap extends VcsObject {
|
|
|
101
101
|
* @type {Array<Function>}
|
|
102
102
|
* @private
|
|
103
103
|
*/
|
|
104
|
-
this._collectionListeners = [
|
|
105
|
-
|
|
106
|
-
|
|
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
|
/**
|
|
@@ -295,12 +295,12 @@ class Oblique extends BaseOLMap {
|
|
|
295
295
|
const coords = boundingExtent(image.groundCoordinates);
|
|
296
296
|
return new Extent({
|
|
297
297
|
coordinates: transformExtent(coords, image.meta.projection.proj, mercatorProjection.proj),
|
|
298
|
-
|
|
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
|
-
|
|
303
|
+
projection: mercatorProjection.toJSON(),
|
|
304
304
|
});
|
|
305
305
|
}
|
|
306
306
|
|
package/src/vcs/vcm/object.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import Projection from './projection.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @typedef {
|
|
5
|
-
* @property {
|
|
4
|
+
* @typedef {Object} ExtentOptions
|
|
5
|
+
* @property {string} [type]
|
|
6
|
+
* @property {import("ol/extent").Extent|undefined} [coordinates] - if not specified, the extent of the projection is used
|
|
7
|
+
* @property {ProjectionOptions} [projection] - if not specified the default projection is assumed
|
|
6
8
|
* @api
|
|
7
9
|
*/
|
|
8
10
|
|
|
@@ -45,12 +47,7 @@ class Extent {
|
|
|
45
47
|
*/
|
|
46
48
|
constructor(options = {}) {
|
|
47
49
|
/** @type {Projection} */
|
|
48
|
-
this.projection = new Projection(
|
|
49
|
-
epsg: options.epsg,
|
|
50
|
-
proj4: options.proj4,
|
|
51
|
-
alias: options.alias,
|
|
52
|
-
prefix: options.prefix,
|
|
53
|
-
});
|
|
50
|
+
this.projection = new Projection(options.projection);
|
|
54
51
|
|
|
55
52
|
/** @type {import("ol/extent").Extent|null} */
|
|
56
53
|
this.extent = options.coordinates || this.projection.proj.getExtent();
|
|
@@ -87,7 +84,7 @@ class Extent {
|
|
|
87
84
|
toJSON() {
|
|
88
85
|
return {
|
|
89
86
|
coordinates: this.extent.slice(),
|
|
90
|
-
|
|
87
|
+
projection: this.projection.toJSON(),
|
|
91
88
|
type: Extent.className,
|
|
92
89
|
};
|
|
93
90
|
}
|
|
@@ -122,7 +119,7 @@ class Extent {
|
|
|
122
119
|
* @api
|
|
123
120
|
*/
|
|
124
121
|
static validateOptions(options) {
|
|
125
|
-
return Projection.validateOptions(options) && checkExtentValidity(options.coordinates);
|
|
122
|
+
return Projection.validateOptions(options.projection || {}) && checkExtentValidity(options.coordinates);
|
|
126
123
|
}
|
|
127
124
|
|
|
128
125
|
/**
|