@vcmap/core 5.0.0-rc.18 → 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.
- package/index.d.ts +21 -2
- package/index.js +2 -2
- package/package.json +1 -1
- package/src/context.js +18 -1
- package/src/layer/wmtsLayer.js +6 -6
- package/src/util/featureconverter/pointToCesium.js +6 -3
- package/src/util/layerCollection.js +7 -0
package/index.d.ts
CHANGED
|
@@ -163,6 +163,19 @@ export interface VcsAppConfig {
|
|
|
163
163
|
obliqueCollections?: ObliqueCollectionOptions[];
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
+
/**
|
|
167
|
+
* The id of the volatile context. Objects with this id shall never be serialized.
|
|
168
|
+
*/
|
|
169
|
+
export const volatileContextId: string;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* This marks an object as "volatile". This ensures, that an object added to the {@see VcsApp}
|
|
173
|
+
* will never be serialized into a context, regardless of the current dynamic context. Typical use case is a scratch layer
|
|
174
|
+
* which represents temporary features.
|
|
175
|
+
* @param object - the object to mark as volatile
|
|
176
|
+
*/
|
|
177
|
+
export function markVolatile(object: VcsObject | any): void;
|
|
178
|
+
|
|
166
179
|
export class Context {
|
|
167
180
|
constructor(config: VcsAppConfig);
|
|
168
181
|
readonly id: string;
|
|
@@ -4790,7 +4803,7 @@ export class WMSLayer extends RasterLayer {
|
|
|
4790
4803
|
|
|
4791
4804
|
export interface WMTSOptions extends RasterLayerOptions {
|
|
4792
4805
|
layer: string;
|
|
4793
|
-
|
|
4806
|
+
wmtsStyle?: string | undefined;
|
|
4794
4807
|
format?: string | undefined;
|
|
4795
4808
|
tileMatrixSetID?: string | undefined;
|
|
4796
4809
|
tileMatrixPrefix?: string | undefined;
|
|
@@ -4822,7 +4835,7 @@ export class WMTSLayer extends RasterLayer {
|
|
|
4822
4835
|
numberOfLevelZeroTilesX: number;
|
|
4823
4836
|
numberOfLevelZeroTilesY: number;
|
|
4824
4837
|
layer: string;
|
|
4825
|
-
|
|
4838
|
+
wmtsStyle: string;
|
|
4826
4839
|
format: string;
|
|
4827
4840
|
tileMatrixPrefix: string;
|
|
4828
4841
|
tileMatrixSetID: string;
|
|
@@ -7058,6 +7071,12 @@ export class IndexedCollection<T extends any> extends Collection<T> {
|
|
|
7058
7071
|
destroy(): void;
|
|
7059
7072
|
}
|
|
7060
7073
|
|
|
7074
|
+
/**
|
|
7075
|
+
* The largest integer zindex which can be safely assigned to a layer (equal to Number.MAX_SAFE_INTEGER)
|
|
7076
|
+
* You should use this to ensure layers are always rendered on top.
|
|
7077
|
+
*/
|
|
7078
|
+
export const maxZIndex: number;
|
|
7079
|
+
|
|
7061
7080
|
/**
|
|
7062
7081
|
* A collection of layers. Manages rendering order and layer exclusivity. Emits state changes for convenience. Passed to
|
|
7063
7082
|
* {@link Map} for layers available to said map. Layers must have unique names.
|
package/index.js
CHANGED
|
@@ -11,7 +11,7 @@ export { default as AppBackedCategory } from './src/category/appBackedCategory.j
|
|
|
11
11
|
export { default as Category } from './src/category/category.js';
|
|
12
12
|
export { default as CategoryCollection } from './src/category/categoryCollection.js';
|
|
13
13
|
export { layerClassRegistry, tileProviderClassRegistry, featureProviderClassRegistry, mapClassRegistry, styleClassRegistry, categoryClassRegistry, getObjectFromClassRegistry, default as ClassRegistry } from './src/classRegistry.js';
|
|
14
|
-
export { default as Context } from './src/context.js';
|
|
14
|
+
export { volatileContextId, markVolatile, default as Context } from './src/context.js';
|
|
15
15
|
export { default as AbstractFeatureProvider } from './src/featureProvider/abstractFeatureProvider.js';
|
|
16
16
|
export { getGenericFeatureFromProvidedFeature } from './src/featureProvider/featureProviderHelpers.js';
|
|
17
17
|
export { isProvidedFeature, showProvidedFeature } from './src/featureProvider/featureProviderSymbols.js';
|
|
@@ -130,7 +130,7 @@ export { requestUrl, requestJson, requestArrayBuffer } from './src/util/fetch.js
|
|
|
130
130
|
export { getFlatCoordinatesFromSimpleGeometry, getFlatCoordinatesFromGeometry, circleFromCenterRadius, convertGeometryToPolygon, enforceEndingVertex, removeEndingVertex, removeEndingVertexFromGeometry, enforceRightHand } from './src/util/geometryHelpers.js';
|
|
131
131
|
export { default as IndexedCollection } from './src/util/indexedCollection.js';
|
|
132
132
|
export { isMobile } from './src/util/isMobile.js';
|
|
133
|
-
export { default as LayerCollection } from './src/util/layerCollection.js';
|
|
133
|
+
export { maxZIndex, default as LayerCollection } from './src/util/layerCollection.js';
|
|
134
134
|
export { detectBrowserLocale } from './src/util/locale.js';
|
|
135
135
|
export { default as MapCollection } from './src/util/mapCollection.js';
|
|
136
136
|
export { coordinateAtDistance, initialBearingBetweenCoords, cartesian2DDistance, cartesian3DDistance } from './src/util/math.js';
|
package/package.json
CHANGED
package/src/context.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { v5 as uuidv5 } from 'uuid';
|
|
1
|
+
import { v5 as uuidv5, v4 as uuidv4 } from 'uuid';
|
|
2
|
+
import { contextIdSymbol } from './vcsAppContextHelpers.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @typedef {Object} VcsAppConfig
|
|
@@ -19,6 +20,22 @@ import { v5 as uuidv5 } from 'uuid';
|
|
|
19
20
|
*/
|
|
20
21
|
const uniqueNamespace = '9c27cc2d-552f-4637-9194-09329ed4c1dc';
|
|
21
22
|
|
|
23
|
+
/**
|
|
24
|
+
* The id of the volatile context. Objects with this id shall never be serialized.
|
|
25
|
+
* @type {string}
|
|
26
|
+
*/
|
|
27
|
+
export const volatileContextId = uuidv4();
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* This marks an object as "volatile". This ensures, that an object added to the {@see VcsApp}
|
|
31
|
+
* will never be serialized into a context, regardless of the current dynamic context. Typical use case is a scratch layer
|
|
32
|
+
* which represents temporary features.
|
|
33
|
+
* @param {import("@vcmap/core").VcsObject|Object} object - the object to mark as volatile
|
|
34
|
+
*/
|
|
35
|
+
export function markVolatile(object) {
|
|
36
|
+
object[contextIdSymbol] = volatileContextId;
|
|
37
|
+
}
|
|
38
|
+
|
|
22
39
|
/**
|
|
23
40
|
* @class
|
|
24
41
|
*/
|
package/src/layer/wmtsLayer.js
CHANGED
|
@@ -10,7 +10,7 @@ import { layerClassRegistry } from '../classRegistry.js';
|
|
|
10
10
|
/**
|
|
11
11
|
* @typedef {RasterLayerOptions} WMTSOptions
|
|
12
12
|
* @property {string} layer
|
|
13
|
-
* @property {string|undefined}
|
|
13
|
+
* @property {string|undefined} [wmtsStyle]
|
|
14
14
|
* @property {string|undefined} format
|
|
15
15
|
* @property {string|undefined} tileMatrixSetID
|
|
16
16
|
* @property {string|undefined} tileMatrixPrefix
|
|
@@ -76,7 +76,7 @@ class WMTSLayer extends RasterLayer {
|
|
|
76
76
|
numberOfLevelZeroTilesX: 1,
|
|
77
77
|
numberOfLevelZeroTilesY: 1,
|
|
78
78
|
layer: '',
|
|
79
|
-
|
|
79
|
+
wmtsStyle: '',
|
|
80
80
|
format: '',
|
|
81
81
|
tileMatrixPrefix: '',
|
|
82
82
|
tileMatrixSetID: '',
|
|
@@ -115,7 +115,7 @@ class WMTSLayer extends RasterLayer {
|
|
|
115
115
|
this.layer = options.layer || defaultOptions.layer;
|
|
116
116
|
|
|
117
117
|
/** @type {string} */
|
|
118
|
-
this.
|
|
118
|
+
this.wmtsStyle = options.wmtsStyle || defaultOptions.wmtsStyle;
|
|
119
119
|
|
|
120
120
|
/** @type {string} */
|
|
121
121
|
this.format = options.format || defaultOptions.format;
|
|
@@ -144,7 +144,7 @@ class WMTSLayer extends RasterLayer {
|
|
|
144
144
|
return {
|
|
145
145
|
...super.getImplementationOptions(),
|
|
146
146
|
layer: this.layer,
|
|
147
|
-
style: this.
|
|
147
|
+
style: this.wmtsStyle,
|
|
148
148
|
format: this.format,
|
|
149
149
|
tileMatrixSetID: this.tileMatrixSetID,
|
|
150
150
|
tileSize: this.tileSize,
|
|
@@ -197,8 +197,8 @@ class WMTSLayer extends RasterLayer {
|
|
|
197
197
|
config.layer = this.layer;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
if (this.
|
|
201
|
-
config.
|
|
200
|
+
if (this.wmtsStyle !== defaultOptions.wmtsStyle) {
|
|
201
|
+
config.wmtsStyle = this.wmtsStyle;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
if (this.format !== defaultOptions.format) {
|
|
@@ -107,9 +107,13 @@ export function getLabelOptions(feature, style, heightReference, vectorPropertie
|
|
|
107
107
|
|
|
108
108
|
options.heightReference = heightReference;
|
|
109
109
|
|
|
110
|
-
const offsetX = textStyle.getOffsetX()
|
|
111
|
-
const offsetY = textStyle.getOffsetY()
|
|
110
|
+
const offsetX = textStyle.getOffsetX() ?? 0;
|
|
111
|
+
const offsetY = textStyle.getOffsetY() ?? 0;
|
|
112
112
|
options.pixelOffset = new Cartesian2(offsetX, offsetY);
|
|
113
|
+
const scale = textStyle.getScale();
|
|
114
|
+
if (scale) {
|
|
115
|
+
options.scale = Array.isArray(scale) ? scale[0] : scale;
|
|
116
|
+
}
|
|
113
117
|
|
|
114
118
|
const font = textStyle.getFont();
|
|
115
119
|
if (font) {
|
|
@@ -171,7 +175,6 @@ export function getLabelOptions(feature, style, heightReference, vectorPropertie
|
|
|
171
175
|
options.verticalOrigin = verticalOrigin;
|
|
172
176
|
options.eyeOffset = vectorProperties.getEyeOffset(feature);
|
|
173
177
|
options.scaleByDistance = vectorProperties.getScaleByDistance(feature);
|
|
174
|
-
|
|
175
178
|
return options;
|
|
176
179
|
}
|
|
177
180
|
return null;
|
|
@@ -5,6 +5,13 @@ import LayerState from '../layer/layerState.js';
|
|
|
5
5
|
import VcsEvent from '../vcsEvent.js';
|
|
6
6
|
import GlobalHider from '../layer/globalHider.js';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* The largest integer zindex which can be safely assigned to a layer (equal to Number.MAX_SAFE_INTEGER)
|
|
10
|
+
* You should use this to ensure layers are always rendered on top.
|
|
11
|
+
* @type {number}
|
|
12
|
+
*/
|
|
13
|
+
export const maxZIndex = Number.MAX_SAFE_INTEGER;
|
|
14
|
+
|
|
8
15
|
/**
|
|
9
16
|
* A collection of layers. Manages rendering order and layer exclusivity. Emits state changes for convenience. Passed to
|
|
10
17
|
* {@link Map} for layers available to said map. Layers must have unique names.
|