@vcmap/core 6.0.0-rc.8 → 6.0.0
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/README.md +4 -1
- package/dist/cesium.d.ts +117 -0
- package/dist/index.d.ts +14 -6
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/ol.d.ts +1 -0
- package/dist/src/cesium/cesium3DTileFeature.d.ts +2 -1
- package/dist/src/cesium/cesium3DTileFeature.js +13 -1
- package/dist/src/cesium/cesium3DTileFeature.js.map +1 -1
- package/dist/src/cesium/cesium3DTilePointFeature.js +2 -0
- package/dist/src/cesium/cesium3DTilePointFeature.js.map +1 -1
- package/dist/src/cesium/entity.js +3 -0
- package/dist/src/cesium/entity.js.map +1 -1
- package/dist/src/interaction/featureAtPixelInteraction.d.ts +4 -12
- package/dist/src/interaction/featureAtPixelInteraction.js +6 -27
- package/dist/src/interaction/featureAtPixelInteraction.js.map +1 -1
- package/dist/src/layer/cesium/openStreetMapCesiumImpl.js +2 -4
- package/dist/src/layer/cesium/openStreetMapCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/rasterLayerCesiumImpl.d.ts +4 -0
- package/dist/src/layer/cesium/rasterLayerCesiumImpl.js +15 -0
- package/dist/src/layer/cesium/rasterLayerCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/singleImageCesiumImpl.js +2 -6
- package/dist/src/layer/cesium/singleImageCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/terrainCesiumImpl.js +3 -0
- package/dist/src/layer/cesium/terrainCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/tmsCesiumImpl.js +1 -4
- package/dist/src/layer/cesium/tmsCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/vcsTile/vcsChildTile.d.ts +12 -0
- package/dist/src/layer/cesium/vcsTile/vcsChildTile.js +18 -0
- package/dist/src/layer/cesium/vcsTile/vcsChildTile.js.map +1 -0
- package/dist/src/layer/cesium/vcsTile/vcsDebugTile.d.ts +21 -0
- package/dist/src/layer/cesium/vcsTile/vcsDebugTile.js +89 -0
- package/dist/src/layer/cesium/vcsTile/vcsDebugTile.js.map +1 -0
- package/dist/src/layer/cesium/vcsTile/vcsNoDataTile.d.ts +11 -0
- package/dist/src/layer/cesium/vcsTile/vcsNoDataTile.js +17 -0
- package/dist/src/layer/cesium/vcsTile/vcsNoDataTile.js.map +1 -0
- package/dist/src/layer/cesium/vcsTile/vcsQuadtreeTileProvider.d.ts +39 -0
- package/dist/src/layer/cesium/vcsTile/vcsQuadtreeTileProvider.js +192 -0
- package/dist/src/layer/cesium/vcsTile/vcsQuadtreeTileProvider.js.map +1 -0
- package/dist/src/layer/cesium/vcsTile/vcsTileHelpers.d.ts +52 -0
- package/dist/src/layer/cesium/vcsTile/vcsTileHelpers.js +73 -0
- package/dist/src/layer/cesium/vcsTile/vcsTileHelpers.js.map +1 -0
- package/dist/src/layer/cesium/vcsTile/vcsVectorTile.d.ts +23 -0
- package/dist/src/layer/cesium/vcsTile/vcsVectorTile.js +87 -0
- package/dist/src/layer/cesium/vcsTile/vcsVectorTile.js.map +1 -0
- package/dist/src/layer/cesium/vectorCesiumImpl.js +3 -3
- package/dist/src/layer/cesium/vectorCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/vectorContext.js +79 -14
- package/dist/src/layer/cesium/vectorContext.js.map +1 -1
- package/dist/src/layer/cesium/vectorTileCesiumImpl.d.ts +19 -0
- package/dist/src/layer/cesium/vectorTileCesiumImpl.js +63 -0
- package/dist/src/layer/cesium/vectorTileCesiumImpl.js.map +1 -0
- package/dist/src/layer/cesium/wmsCesiumImpl.js +1 -4
- package/dist/src/layer/cesium/wmsCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/wmtsCesiumImpl.js +1 -4
- package/dist/src/layer/cesium/wmtsCesiumImpl.js.map +1 -1
- package/dist/src/layer/layer.d.ts +5 -0
- package/dist/src/layer/layer.js +5 -0
- package/dist/src/layer/layer.js.map +1 -1
- package/dist/src/layer/openStreetMapLayer.d.ts +32 -2
- package/dist/src/layer/openStreetMapLayer.js +35 -1
- package/dist/src/layer/openStreetMapLayer.js.map +1 -1
- package/dist/src/layer/openlayers/openStreetMapOpenlayersImpl.js +2 -0
- package/dist/src/layer/openlayers/openStreetMapOpenlayersImpl.js.map +1 -1
- package/dist/src/layer/openlayers/rasterLayerOpenlayersImpl.d.ts +2 -0
- package/dist/src/layer/openlayers/rasterLayerOpenlayersImpl.js +4 -0
- package/dist/src/layer/openlayers/rasterLayerOpenlayersImpl.js.map +1 -1
- package/dist/src/layer/openlayers/singleImageOpenlayersImpl.js +2 -0
- package/dist/src/layer/openlayers/singleImageOpenlayersImpl.js.map +1 -1
- package/dist/src/layer/openlayers/tmsOpenlayersImpl.js +2 -0
- package/dist/src/layer/openlayers/tmsOpenlayersImpl.js.map +1 -1
- package/dist/src/layer/openlayers/vectorTileOpenlayersImpl.d.ts +1 -7
- package/dist/src/layer/openlayers/vectorTileOpenlayersImpl.js +3 -35
- package/dist/src/layer/openlayers/vectorTileOpenlayersImpl.js.map +1 -1
- package/dist/src/layer/openlayers/wmsOpenlayersImpl.js +4 -0
- package/dist/src/layer/openlayers/wmsOpenlayersImpl.js.map +1 -1
- package/dist/src/layer/openlayers/wmtsOpenlayersImpl.js +2 -0
- package/dist/src/layer/openlayers/wmtsOpenlayersImpl.js.map +1 -1
- package/dist/src/layer/pointCloudLayer.d.ts +0 -1
- package/dist/src/layer/pointCloudLayer.js +2 -3
- package/dist/src/layer/pointCloudLayer.js.map +1 -1
- package/dist/src/layer/rasterLayer.d.ts +44 -3
- package/dist/src/layer/rasterLayer.js +43 -0
- package/dist/src/layer/rasterLayer.js.map +1 -1
- package/dist/src/layer/tileProvider/mvtTileProvider.d.ts +0 -5
- package/dist/src/layer/tileProvider/mvtTileProvider.js +0 -12
- package/dist/src/layer/tileProvider/mvtTileProvider.js.map +1 -1
- package/dist/src/layer/tileProvider/staticFeatureTileProvider.d.ts +14 -0
- package/dist/src/layer/tileProvider/staticFeatureTileProvider.js +44 -0
- package/dist/src/layer/tileProvider/staticFeatureTileProvider.js.map +1 -0
- package/dist/src/layer/tileProvider/tileProvider.d.ts +8 -2
- package/dist/src/layer/tileProvider/tileProvider.js +17 -1
- package/dist/src/layer/tileProvider/tileProvider.js.map +1 -1
- package/dist/src/layer/vectorLayer.d.ts +1 -1
- package/dist/src/layer/vectorLayer.js.map +1 -1
- package/dist/src/layer/vectorTileLayer.d.ts +13 -3
- package/dist/src/layer/vectorTileLayer.js +43 -13
- package/dist/src/layer/vectorTileLayer.js.map +1 -1
- package/dist/src/map/cesiumMap.d.ts +8 -1
- package/dist/src/map/cesiumMap.js +17 -6
- package/dist/src/map/cesiumMap.js.map +1 -1
- package/dist/src/ol/feature.js +7 -0
- package/dist/src/ol/feature.js.map +1 -1
- package/dist/src/style/declarativeStyleItem.js +2 -68
- package/dist/src/style/declarativeStyleItem.js.map +1 -1
- package/dist/src/util/displayQuality/displayQuality.d.ts +1 -0
- package/dist/src/util/displayQuality/displayQuality.js +12 -1
- package/dist/src/util/displayQuality/displayQuality.js.map +1 -1
- package/dist/src/util/editor/createFeatureSession.d.ts +8 -4
- package/dist/src/util/editor/createFeatureSession.js +35 -11
- package/dist/src/util/editor/createFeatureSession.js.map +1 -1
- package/dist/src/util/editor/editGeometrySession.d.ts +2 -1
- package/dist/src/util/editor/editGeometrySession.js +33 -12
- package/dist/src/util/editor/editGeometrySession.js.map +1 -1
- package/dist/src/util/editor/editorHelpers.d.ts +1 -0
- package/dist/src/util/editor/editorHelpers.js +6 -0
- package/dist/src/util/editor/editorHelpers.js.map +1 -1
- package/dist/src/util/editor/editorSessionHelpers.d.ts +1 -6
- package/dist/src/util/editor/editorSessionHelpers.js +5 -16
- package/dist/src/util/editor/editorSessionHelpers.js.map +1 -1
- package/dist/src/util/editor/interactions/editGeometryMouseOverInteraction.js +3 -2
- package/dist/src/util/editor/interactions/editGeometryMouseOverInteraction.js.map +1 -1
- package/dist/src/util/editor/interactions/removeVertexInteraction.d.ts +1 -1
- package/dist/src/util/editor/interactions/removeVertexInteraction.js +2 -2
- package/dist/src/util/editor/interactions/removeVertexInteraction.js.map +1 -1
- package/dist/src/util/editor/interactions/segmentLengthInteraction.d.ts +16 -0
- package/dist/src/util/editor/interactions/segmentLengthInteraction.js +167 -0
- package/dist/src/util/editor/interactions/segmentLengthInteraction.js.map +1 -0
- package/dist/src/util/editor/interactions/translateVertexInteraction.js +2 -6
- package/dist/src/util/editor/interactions/translateVertexInteraction.js.map +1 -1
- package/dist/src/util/editor/interactions/translationSnapping.js +3 -2
- package/dist/src/util/editor/interactions/translationSnapping.js.map +1 -1
- package/dist/src/util/featureconverter/clampedPrimitive.d.ts +2 -2
- package/dist/src/util/featureconverter/clampedPrimitive.js +24 -2
- package/dist/src/util/featureconverter/clampedPrimitive.js.map +1 -1
- package/dist/src/util/featureconverter/convert.js +12 -3
- package/dist/src/util/featureconverter/convert.js.map +1 -1
- package/dist/src/util/geometryHelpers.d.ts +9 -1
- package/dist/src/util/geometryHelpers.js +54 -4
- package/dist/src/util/geometryHelpers.js.map +1 -1
- package/dist/src/util/math.d.ts +12 -0
- package/dist/src/util/math.js +21 -0
- package/dist/src/util/math.js.map +1 -1
- package/dist/src/util/projection.js +1 -1
- package/dist/src/util/projection.js.map +1 -1
- package/dist/tests/unit/helpers/cesiumHelpers.d.ts +2 -2
- package/dist/tests/unit/helpers/cesiumHelpers.js +2 -1
- package/dist/tests/unit/helpers/cesiumHelpers.js.map +1 -1
- package/index.ts +26 -2
- package/package.json +3 -3
- package/src/cesium/cesium.d.ts +117 -0
- package/src/cesium/cesium3DTileFeature.ts +20 -1
- package/src/cesium/cesium3DTilePointFeature.ts +3 -0
- package/src/cesium/entity.ts +7 -0
- package/src/interaction/featureAtPixelInteraction.ts +8 -39
- package/src/layer/cesium/openStreetMapCesiumImpl.ts +2 -4
- package/src/layer/cesium/rasterLayerCesiumImpl.ts +19 -0
- package/src/layer/cesium/singleImageCesiumImpl.ts +2 -6
- package/src/layer/cesium/terrainCesiumImpl.ts +3 -0
- package/src/layer/cesium/tmsCesiumImpl.ts +1 -4
- package/src/layer/cesium/vcsTile/vcsChildTile.ts +31 -0
- package/src/layer/cesium/vcsTile/vcsDebugTile.ts +154 -0
- package/src/layer/cesium/vcsTile/vcsNoDataTile.ts +30 -0
- package/src/layer/cesium/vcsTile/vcsQuadtreeTileProvider.ts +290 -0
- package/src/layer/cesium/vcsTile/vcsTileHelpers.ts +134 -0
- package/src/layer/cesium/vcsTile/vcsVectorTile.ts +149 -0
- package/src/layer/cesium/vectorCesiumImpl.ts +3 -3
- package/src/layer/cesium/vectorContext.ts +124 -18
- package/src/layer/cesium/vectorTileCesiumImpl.ts +91 -0
- package/src/layer/cesium/wmsCesiumImpl.ts +1 -4
- package/src/layer/cesium/wmtsCesiumImpl.ts +1 -4
- package/src/layer/layer.ts +5 -0
- package/src/layer/openStreetMapLayer.ts +64 -2
- package/src/layer/openlayers/openStreetMapOpenlayersImpl.ts +2 -0
- package/src/layer/openlayers/rasterLayerOpenlayersImpl.ts +6 -0
- package/src/layer/openlayers/singleImageOpenlayersImpl.ts +2 -0
- package/src/layer/openlayers/tmsOpenlayersImpl.ts +2 -0
- package/src/layer/openlayers/vectorTileOpenlayersImpl.ts +3 -37
- package/src/layer/openlayers/wmsOpenlayersImpl.ts +4 -0
- package/src/layer/openlayers/wmtsOpenlayersImpl.ts +2 -0
- package/src/layer/pointCloudLayer.ts +2 -3
- package/src/layer/rasterLayer.ts +81 -2
- package/src/layer/tileProvider/mvtTileProvider.ts +0 -18
- package/src/layer/tileProvider/staticFeatureTileProvider.ts +61 -0
- package/src/layer/tileProvider/tileProvider.ts +27 -2
- package/src/layer/vectorLayer.ts +1 -1
- package/src/layer/vectorTileLayer.ts +72 -17
- package/src/map/cesiumMap.ts +28 -6
- package/src/ol/feature.ts +10 -0
- package/src/ol/ol.d.ts +1 -0
- package/src/style/declarativeStyleItem.ts +2 -72
- package/src/util/displayQuality/displayQuality.ts +13 -1
- package/src/util/editor/createFeatureSession.ts +51 -13
- package/src/util/editor/editGeometrySession.ts +41 -10
- package/src/util/editor/editorHelpers.ts +13 -0
- package/src/util/editor/editorSessionHelpers.ts +6 -20
- package/src/util/editor/interactions/editGeometryMouseOverInteraction.ts +4 -4
- package/src/util/editor/interactions/removeVertexInteraction.ts +3 -4
- package/src/util/editor/interactions/segmentLengthInteraction.ts +227 -0
- package/src/util/editor/interactions/translateVertexInteraction.ts +3 -10
- package/src/util/editor/interactions/translationSnapping.ts +4 -4
- package/src/util/featureconverter/clampedPrimitive.ts +53 -5
- package/src/util/featureconverter/convert.ts +18 -2
- package/src/util/geometryHelpers.ts +63 -4
- package/src/util/math.ts +28 -0
- package/src/util/projection.ts +1 -1
|
@@ -31,6 +31,36 @@ export function setReferenceForPicking(
|
|
|
31
31
|
primitive.olFeature = feature;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
function getIndexOfPrimitive(
|
|
35
|
+
item: PrimitiveType,
|
|
36
|
+
collection: PrimitiveCollection,
|
|
37
|
+
): number {
|
|
38
|
+
const { length } = collection;
|
|
39
|
+
for (let i = 0; i < length; i++) {
|
|
40
|
+
const p = collection.get(i) as PrimitiveType;
|
|
41
|
+
if (p === item) {
|
|
42
|
+
return i;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return -1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function addPrimitiveAtIndex(
|
|
49
|
+
type: 'scaled' | 'primitive',
|
|
50
|
+
item: PrimitiveType,
|
|
51
|
+
collection: PrimitiveCollection,
|
|
52
|
+
indices: ConvertedIndices,
|
|
53
|
+
): PrimitiveType {
|
|
54
|
+
let index = indices[type];
|
|
55
|
+
if (index != null) {
|
|
56
|
+
if (index > collection.length) {
|
|
57
|
+
index = undefined;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return collection.add(item, index) as PrimitiveType;
|
|
62
|
+
}
|
|
63
|
+
|
|
34
64
|
/**
|
|
35
65
|
* Sets splitDirection on primitives. Currently only Model primitives support splitting.
|
|
36
66
|
*/
|
|
@@ -106,6 +136,10 @@ export interface CesiumVectorContext {
|
|
|
106
136
|
clear(): void;
|
|
107
137
|
}
|
|
108
138
|
|
|
139
|
+
type ConvertedItemIndex = { type: 'primitive' | 'scaled'; index: number };
|
|
140
|
+
|
|
141
|
+
type ConvertedIndices = { primitive?: number; scaled?: number };
|
|
142
|
+
|
|
109
143
|
export default class VectorContext implements CesiumVectorContext {
|
|
110
144
|
primitives = new PrimitiveCollection();
|
|
111
145
|
|
|
@@ -115,9 +149,13 @@ export default class VectorContext implements CesiumVectorContext {
|
|
|
115
149
|
|
|
116
150
|
labels: LabelCollection;
|
|
117
151
|
|
|
118
|
-
private _featureItems = new Map<
|
|
152
|
+
private _featureItems = new Map<
|
|
153
|
+
Feature,
|
|
154
|
+
(() => ConvertedItemIndex | void)[]
|
|
155
|
+
>();
|
|
119
156
|
|
|
120
|
-
private _convertingFeatures: Map<Feature, () => void> =
|
|
157
|
+
private _convertingFeatures: Map<Feature, (replace: boolean) => void> =
|
|
158
|
+
new Map();
|
|
121
159
|
|
|
122
160
|
splitDirection: SplitDirection;
|
|
123
161
|
|
|
@@ -157,26 +195,63 @@ export default class VectorContext implements CesiumVectorContext {
|
|
|
157
195
|
feature: Feature,
|
|
158
196
|
allowPicking: boolean,
|
|
159
197
|
items: ConvertedItem[],
|
|
198
|
+
indices: ConvertedIndices,
|
|
160
199
|
): void {
|
|
161
200
|
const removeItems = items
|
|
162
201
|
.map((item) => {
|
|
163
202
|
let instance: PrimitiveType | Label | Billboard | undefined;
|
|
164
|
-
let removeItem: (() => void) | undefined;
|
|
203
|
+
let removeItem: (() => ConvertedItemIndex | void) | undefined;
|
|
165
204
|
if (item.type === 'primitive') {
|
|
166
205
|
if (item.autoScale) {
|
|
167
|
-
instance =
|
|
206
|
+
instance = addPrimitiveAtIndex(
|
|
207
|
+
'scaled',
|
|
208
|
+
item.item,
|
|
209
|
+
this.scaledPrimitives,
|
|
210
|
+
indices,
|
|
211
|
+
);
|
|
212
|
+
|
|
168
213
|
if (instance) {
|
|
169
|
-
removeItem = ():
|
|
170
|
-
|
|
171
|
-
|
|
214
|
+
removeItem = (): ConvertedItemIndex | undefined => {
|
|
215
|
+
const currentIndex = getIndexOfPrimitive(
|
|
216
|
+
instance as PrimitiveType,
|
|
217
|
+
this.scaledPrimitives,
|
|
218
|
+
);
|
|
219
|
+
if (currentIndex > -1) {
|
|
220
|
+
this._scaledDirty.value =
|
|
221
|
+
this.scaledPrimitives.remove(instance);
|
|
222
|
+
|
|
223
|
+
return {
|
|
224
|
+
type: 'scaled',
|
|
225
|
+
index: currentIndex,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
return undefined;
|
|
172
229
|
};
|
|
173
230
|
this._scaledDirty.value = true;
|
|
174
231
|
}
|
|
175
232
|
} else {
|
|
176
|
-
instance =
|
|
233
|
+
instance = addPrimitiveAtIndex(
|
|
234
|
+
'primitive',
|
|
235
|
+
item.item,
|
|
236
|
+
this.primitives,
|
|
237
|
+
indices,
|
|
238
|
+
);
|
|
239
|
+
|
|
177
240
|
if (instance) {
|
|
178
|
-
removeItem = ():
|
|
179
|
-
|
|
241
|
+
removeItem = (): ConvertedItemIndex | undefined => {
|
|
242
|
+
const currentIndex = getIndexOfPrimitive(
|
|
243
|
+
instance as PrimitiveType,
|
|
244
|
+
this.primitives,
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
if (currentIndex > -1) {
|
|
248
|
+
this.primitives.remove(instance);
|
|
249
|
+
return {
|
|
250
|
+
type: 'primitive',
|
|
251
|
+
index: currentIndex,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
return undefined;
|
|
180
255
|
};
|
|
181
256
|
}
|
|
182
257
|
}
|
|
@@ -211,7 +286,7 @@ export default class VectorContext implements CesiumVectorContext {
|
|
|
211
286
|
}
|
|
212
287
|
return removeItem;
|
|
213
288
|
})
|
|
214
|
-
.filter((i)
|
|
289
|
+
.filter((i) => i != null);
|
|
215
290
|
|
|
216
291
|
this._featureItems.set(feature, removeItems);
|
|
217
292
|
}
|
|
@@ -222,10 +297,15 @@ export default class VectorContext implements CesiumVectorContext {
|
|
|
222
297
|
vectorProperties: VectorProperties,
|
|
223
298
|
scene: Scene,
|
|
224
299
|
): Promise<void> {
|
|
225
|
-
this._convertingFeatures.get(feature)?.();
|
|
300
|
+
this._convertingFeatures.get(feature)?.(true);
|
|
226
301
|
let deleted = false;
|
|
227
|
-
|
|
228
|
-
|
|
302
|
+
let replaced = false;
|
|
303
|
+
this._convertingFeatures.set(feature, (isReplacement?: boolean) => {
|
|
304
|
+
if (isReplacement) {
|
|
305
|
+
replaced = true;
|
|
306
|
+
} else {
|
|
307
|
+
deleted = true;
|
|
308
|
+
}
|
|
229
309
|
});
|
|
230
310
|
|
|
231
311
|
const convertedItems = await convert(
|
|
@@ -235,7 +315,32 @@ export default class VectorContext implements CesiumVectorContext {
|
|
|
235
315
|
scene,
|
|
236
316
|
);
|
|
237
317
|
|
|
238
|
-
|
|
318
|
+
if (replaced) {
|
|
319
|
+
convertedItems.forEach((item) => {
|
|
320
|
+
if (item.type === 'primitive') {
|
|
321
|
+
item.item.destroy();
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
const convertedIndices: ConvertedIndices =
|
|
328
|
+
this._featureItems
|
|
329
|
+
.get(feature)
|
|
330
|
+
?.map((removeItem) => removeItem())
|
|
331
|
+
?.filter((i) => i != null)
|
|
332
|
+
?.reduce((items, current) => {
|
|
333
|
+
const minIndex = items[current.type];
|
|
334
|
+
if (minIndex != null) {
|
|
335
|
+
items[current.type] =
|
|
336
|
+
current.index != null && current.index < minIndex
|
|
337
|
+
? current.index
|
|
338
|
+
: items[current.type];
|
|
339
|
+
} else {
|
|
340
|
+
items[current.type] = current.index;
|
|
341
|
+
}
|
|
342
|
+
return items;
|
|
343
|
+
}, {} as ConvertedIndices) ?? {};
|
|
239
344
|
this._featureItems.delete(feature);
|
|
240
345
|
|
|
241
346
|
if (deleted) {
|
|
@@ -249,12 +354,13 @@ export default class VectorContext implements CesiumVectorContext {
|
|
|
249
354
|
feature,
|
|
250
355
|
vectorProperties.getAllowPicking(feature),
|
|
251
356
|
convertedItems,
|
|
357
|
+
convertedIndices,
|
|
252
358
|
);
|
|
253
359
|
}
|
|
254
360
|
}
|
|
255
361
|
|
|
256
362
|
removeFeature(feature: Feature): void {
|
|
257
|
-
this._convertingFeatures.get(feature)?.();
|
|
363
|
+
this._convertingFeatures.get(feature)?.(false);
|
|
258
364
|
this._convertingFeatures.delete(feature);
|
|
259
365
|
this._featureItems.get(feature)?.forEach((removeItem) => removeItem());
|
|
260
366
|
this._featureItems.delete(feature);
|
|
@@ -275,7 +381,7 @@ export default class VectorContext implements CesiumVectorContext {
|
|
|
275
381
|
this.labels.removeAll();
|
|
276
382
|
this._featureItems.clear();
|
|
277
383
|
this._convertingFeatures.forEach((destroy) => {
|
|
278
|
-
destroy();
|
|
384
|
+
destroy(true);
|
|
279
385
|
});
|
|
280
386
|
this._convertingFeatures.clear();
|
|
281
387
|
}
|
|
@@ -294,7 +400,7 @@ export default class VectorContext implements CesiumVectorContext {
|
|
|
294
400
|
// @ts-ignore
|
|
295
401
|
this._rootCollection = null;
|
|
296
402
|
this._convertingFeatures.forEach((destroy) => {
|
|
297
|
-
destroy();
|
|
403
|
+
destroy(true);
|
|
298
404
|
});
|
|
299
405
|
this._convertingFeatures.clear();
|
|
300
406
|
this._featureItems.clear();
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PrimitiveCollection,
|
|
3
|
+
QuadtreePrimitive,
|
|
4
|
+
SplitDirection,
|
|
5
|
+
} from '@vcmap-cesium/engine';
|
|
6
|
+
import StyleItem from '../../style/styleItem.js';
|
|
7
|
+
import LayerImplementation from '../layerImplementation.js';
|
|
8
|
+
import type CesiumMap from '../../map/cesiumMap.js';
|
|
9
|
+
import {
|
|
10
|
+
VectorTileImplementation,
|
|
11
|
+
VectorTileImplementationOptions,
|
|
12
|
+
} from '../vectorTileLayer.js';
|
|
13
|
+
import { vcsLayerName } from '../layerSymbols.js';
|
|
14
|
+
import VcsQuadtreeTileProvider from './vcsTile/vcsQuadtreeTileProvider.js';
|
|
15
|
+
|
|
16
|
+
export default class VectorTileCesiumImpl
|
|
17
|
+
extends LayerImplementation<CesiumMap>
|
|
18
|
+
implements VectorTileImplementation
|
|
19
|
+
{
|
|
20
|
+
static get className(): string {
|
|
21
|
+
return 'VectorTileCesiumImpl';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
private _quadtreeProvider: VcsQuadtreeTileProvider;
|
|
25
|
+
|
|
26
|
+
private _quadtreePrimitive: QuadtreePrimitive;
|
|
27
|
+
|
|
28
|
+
private _primitiveCollection = new PrimitiveCollection();
|
|
29
|
+
|
|
30
|
+
constructor(map: CesiumMap, options: VectorTileImplementationOptions) {
|
|
31
|
+
super(map, options);
|
|
32
|
+
this._quadtreeProvider = new VcsQuadtreeTileProvider(
|
|
33
|
+
map,
|
|
34
|
+
this._primitiveCollection,
|
|
35
|
+
options,
|
|
36
|
+
);
|
|
37
|
+
this._quadtreePrimitive = new QuadtreePrimitive({
|
|
38
|
+
tileProvider: this._quadtreeProvider,
|
|
39
|
+
});
|
|
40
|
+
this._primitiveCollection.add(this._quadtreePrimitive);
|
|
41
|
+
this._primitiveCollection[vcsLayerName] = this.name;
|
|
42
|
+
this._primitiveCollection.show = false;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
updateTiles(_tiles: string[], featureVisibility: boolean): void {
|
|
46
|
+
if (!featureVisibility) {
|
|
47
|
+
this._quadtreePrimitive.invalidateAllTiles(); // XXX this we can do bette
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async initialize(): Promise<void> {
|
|
52
|
+
if (!this.initialized) {
|
|
53
|
+
this.map.addPrimitiveCollection(this._primitiveCollection);
|
|
54
|
+
}
|
|
55
|
+
await super.initialize();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async activate(): Promise<void> {
|
|
59
|
+
this._primitiveCollection.show = true;
|
|
60
|
+
return super.activate();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
deactivate(): void {
|
|
64
|
+
this._primitiveCollection.show = false;
|
|
65
|
+
super.deactivate();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
updateStyle(style: StyleItem, _silent?: boolean): void {
|
|
69
|
+
this._quadtreeProvider.updateStyle(style);
|
|
70
|
+
this._quadtreePrimitive.invalidateAllTiles();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
updateSplitDirection(direction: SplitDirection): void {
|
|
74
|
+
this._quadtreeProvider.updateSplitDirection(direction);
|
|
75
|
+
this._quadtreePrimitive.invalidateAllTiles();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
destroy(): void {
|
|
79
|
+
if (!this.isDestroyed) {
|
|
80
|
+
this._quadtreeProvider.destroy();
|
|
81
|
+
this._quadtreePrimitive.invalidateAllTiles();
|
|
82
|
+
if (this.map.initialized) {
|
|
83
|
+
this.map.removePrimitiveCollection(this._primitiveCollection);
|
|
84
|
+
} else {
|
|
85
|
+
this._primitiveCollection.destroy();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
super.destroy();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -65,10 +65,7 @@ class WmsCesiumImpl extends RasterLayerCesiumImpl {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
const imageryProvider = new WebMapServiceImageryProvider(options);
|
|
68
|
-
const layerOptions =
|
|
69
|
-
alpha: this.opacity,
|
|
70
|
-
splitDirection: this.splitDirection,
|
|
71
|
-
};
|
|
68
|
+
const layerOptions = this.getCesiumLayerOptions();
|
|
72
69
|
return Promise.resolve(
|
|
73
70
|
new CesiumImageryLayer(imageryProvider, layerOptions),
|
|
74
71
|
);
|
|
@@ -83,10 +83,7 @@ class WmtsCesiumImpl extends RasterLayerCesiumImpl {
|
|
|
83
83
|
options.tileMatrixLabels = this.matrixIds;
|
|
84
84
|
|
|
85
85
|
const imageryProvider = new WebMapTileServiceImageryProvider(options);
|
|
86
|
-
const layerOptions =
|
|
87
|
-
alpha: this.opacity,
|
|
88
|
-
splitDirection: this.splitDirection,
|
|
89
|
-
};
|
|
86
|
+
const layerOptions = this.getCesiumLayerOptions();
|
|
90
87
|
return Promise.resolve(
|
|
91
88
|
new CesiumImageryLayer(imageryProvider, layerOptions),
|
|
92
89
|
);
|
package/src/layer/layer.ts
CHANGED
|
@@ -106,6 +106,11 @@ class Layer<
|
|
|
106
106
|
|
|
107
107
|
private _initialized: boolean;
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* if provided, the layer will only be shown in the given MapNames.
|
|
111
|
+
* An empty array will show the layer in all configured maps.
|
|
112
|
+
* Changes require calling layer.redraw() to take effect.
|
|
113
|
+
*/
|
|
109
114
|
mapNames: string[];
|
|
110
115
|
|
|
111
116
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SplitDirection } from '@vcmap-cesium/engine';
|
|
1
|
+
import { ImageryLayer, SplitDirection } from '@vcmap-cesium/engine';
|
|
2
2
|
|
|
3
3
|
import { parseInteger, parseNumberRange } from '@vcsuite/parsers';
|
|
4
4
|
import Layer, { type LayerOptions, SplitLayer } from './layer.js';
|
|
@@ -29,6 +29,22 @@ export type OpenStreetMapOptions = LayerOptions & {
|
|
|
29
29
|
* @default 19
|
|
30
30
|
*/
|
|
31
31
|
maxLevel?: number;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* configures the visible level in the rendered map. Maps to Openlayers `minZoom` and Cesium `minimiumTerrainLevel`
|
|
35
|
+
*/
|
|
36
|
+
minRenderingLevel?: number;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* configures the visible level in the rendered map. Maps to Openlayers `maxZoom` and Cesium `maximumTerrainLevel`
|
|
40
|
+
*/
|
|
41
|
+
maxRenderingLevel?: number;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* can be used to forward options to the cesium ImageryLayer
|
|
45
|
+
* @see https://cesium.com/learn/cesiumjs/ref-doc/ImageryLayer.html#.ConstructorOptions
|
|
46
|
+
*/
|
|
47
|
+
imageryLayerOptions?: ImageryLayer.ConstructorOptions;
|
|
32
48
|
};
|
|
33
49
|
|
|
34
50
|
/**
|
|
@@ -48,6 +64,8 @@ class OpenStreetMapLayer
|
|
|
48
64
|
splitDirection: undefined,
|
|
49
65
|
opacity: 1,
|
|
50
66
|
maxLevel: 19,
|
|
67
|
+
minRenderingLevel: undefined,
|
|
68
|
+
maxRenderingLevel: undefined,
|
|
51
69
|
};
|
|
52
70
|
}
|
|
53
71
|
|
|
@@ -61,10 +79,30 @@ class OpenStreetMapLayer
|
|
|
61
79
|
splitDirectionChanged: VcsEvent<SplitDirection> = new VcsEvent();
|
|
62
80
|
|
|
63
81
|
/**
|
|
64
|
-
* The maximum level to load.
|
|
82
|
+
* The maximum level to load.
|
|
83
|
+
* Changes requires calling layer.redraw() to take effect.
|
|
65
84
|
*/
|
|
66
85
|
maxLevel: number;
|
|
67
86
|
|
|
87
|
+
/**
|
|
88
|
+
* defines the visible level in the rendered map, maps to Openlayers `minZoom` and Cesium `minimiumTerrainLevel`.
|
|
89
|
+
* Changes requires calling layer.redraw() to take effect.
|
|
90
|
+
*/
|
|
91
|
+
minRenderingLevel: number | undefined;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* defines the visible level in the rendered map, maps to Openlayers `minZoom` and Cesium `minimiumTerrainLevel`.
|
|
95
|
+
* Changes requires calling layer.redraw() to take effect.
|
|
96
|
+
*/
|
|
97
|
+
maxRenderingLevel: number | undefined;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* can be used to forward options to the cesium ImageryLayer
|
|
101
|
+
* @see https://cesium.com/learn/cesiumjs/ref-doc/ImageryLayer.html#.ConstructorOptions
|
|
102
|
+
* Changes requires calling layer.redraw() to take effect.
|
|
103
|
+
*/
|
|
104
|
+
imageryLayerOptions: ImageryLayer.ConstructorOptions | undefined;
|
|
105
|
+
|
|
68
106
|
protected _supportedMaps = [CesiumMap.className, OpenlayersMap.className];
|
|
69
107
|
|
|
70
108
|
constructor(options: OpenStreetMapOptions) {
|
|
@@ -86,6 +124,15 @@ class OpenStreetMapLayer
|
|
|
86
124
|
1.0,
|
|
87
125
|
);
|
|
88
126
|
this.maxLevel = parseInteger(options.maxLevel, defaultOptions.maxLevel);
|
|
127
|
+
this.minRenderingLevel = parseInteger(
|
|
128
|
+
options.minRenderingLevel,
|
|
129
|
+
defaultOptions.minRenderingLevel,
|
|
130
|
+
);
|
|
131
|
+
this.maxRenderingLevel = parseInteger(
|
|
132
|
+
options.maxRenderingLevel,
|
|
133
|
+
defaultOptions.maxRenderingLevel,
|
|
134
|
+
);
|
|
135
|
+
this.imageryLayerOptions = structuredClone(options.imageryLayerOptions);
|
|
89
136
|
}
|
|
90
137
|
|
|
91
138
|
get splitDirection(): SplitDirection {
|
|
@@ -126,7 +173,10 @@ class OpenStreetMapLayer
|
|
|
126
173
|
splitDirection: this.splitDirection,
|
|
127
174
|
minLevel: 0,
|
|
128
175
|
maxLevel: this.maxLevel,
|
|
176
|
+
minRenderingLevel: this.minRenderingLevel,
|
|
177
|
+
maxRenderingLevel: this.maxRenderingLevel,
|
|
129
178
|
tilingSchema: TilingScheme.GEOGRAPHIC,
|
|
179
|
+
imageryLayerOptions: this.imageryLayerOptions,
|
|
130
180
|
};
|
|
131
181
|
}
|
|
132
182
|
|
|
@@ -164,11 +214,23 @@ class OpenStreetMapLayer
|
|
|
164
214
|
config.maxLevel = this.maxLevel;
|
|
165
215
|
}
|
|
166
216
|
|
|
217
|
+
if (this.minRenderingLevel !== defaultOptions.minRenderingLevel) {
|
|
218
|
+
config.minRenderingLevel = this.minRenderingLevel;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (this.maxRenderingLevel !== defaultOptions.maxRenderingLevel) {
|
|
222
|
+
config.maxRenderingLevel = this.maxRenderingLevel;
|
|
223
|
+
}
|
|
224
|
+
|
|
167
225
|
if (this._splitDirection !== SplitDirection.NONE) {
|
|
168
226
|
config.splitDirection =
|
|
169
227
|
this._splitDirection === SplitDirection.RIGHT ? 'right' : 'left';
|
|
170
228
|
}
|
|
171
229
|
|
|
230
|
+
if (this.imageryLayerOptions !== defaultOptions.imageryLayerOptions) {
|
|
231
|
+
config.imageryLayerOptions = structuredClone(this.imageryLayerOptions);
|
|
232
|
+
}
|
|
233
|
+
|
|
172
234
|
return config;
|
|
173
235
|
}
|
|
174
236
|
|
|
@@ -19,6 +19,10 @@ class RasterLayerOpenlayersImpl
|
|
|
19
19
|
|
|
20
20
|
maxLevel: number;
|
|
21
21
|
|
|
22
|
+
minRenderingLevel: number | undefined;
|
|
23
|
+
|
|
24
|
+
maxRenderingLevel: number | undefined;
|
|
25
|
+
|
|
22
26
|
tilingSchema: TilingScheme;
|
|
23
27
|
|
|
24
28
|
extent: Extent;
|
|
@@ -29,6 +33,8 @@ class RasterLayerOpenlayersImpl
|
|
|
29
33
|
super(map, options);
|
|
30
34
|
this.minLevel = options.minLevel;
|
|
31
35
|
this.maxLevel = options.maxLevel;
|
|
36
|
+
this.minRenderingLevel = options.minRenderingLevel;
|
|
37
|
+
this.maxRenderingLevel = options.maxRenderingLevel;
|
|
32
38
|
this.tilingSchema = options.tilingSchema;
|
|
33
39
|
this.extent = options.extent as Extent;
|
|
34
40
|
this.opacity = options.opacity;
|
|
@@ -60,6 +60,8 @@ class TmsOpenlayersImpl extends RasterLayerOpenlayersImpl {
|
|
|
60
60
|
const tileOptions: TileOptions<XYZ> = {
|
|
61
61
|
source: new XYZ(sourceOptions),
|
|
62
62
|
opacity: this.opacity,
|
|
63
|
+
minZoom: this.minRenderingLevel,
|
|
64
|
+
maxZoom: this.maxRenderingLevel,
|
|
63
65
|
};
|
|
64
66
|
if (this.extent && this.extent.isValid()) {
|
|
65
67
|
tileOptions.extent =
|
|
@@ -32,13 +32,6 @@ class VectorTileOpenlayersImpl
|
|
|
32
32
|
|
|
33
33
|
tileSize: Size;
|
|
34
34
|
|
|
35
|
-
/**
|
|
36
|
-
* tiles to update on next TileRedraw
|
|
37
|
-
*/
|
|
38
|
-
private _tilesToUpdate: Set<string> = new Set();
|
|
39
|
-
|
|
40
|
-
private _reloadTimeout: number | undefined = undefined;
|
|
41
|
-
|
|
42
35
|
minLevel: number | undefined;
|
|
43
36
|
|
|
44
37
|
maxLevel: number | undefined;
|
|
@@ -107,45 +100,18 @@ class VectorTileOpenlayersImpl
|
|
|
107
100
|
}
|
|
108
101
|
|
|
109
102
|
/**
|
|
110
|
-
*
|
|
111
|
-
* rendering happens async
|
|
103
|
+
* refreshes the openlayers Layer, which will redraw the scene, seems to magically work
|
|
112
104
|
*/
|
|
113
105
|
updateTiles(tileIds: string[]): void {
|
|
114
106
|
if (tileIds.length > 0) {
|
|
115
|
-
|
|
116
|
-
this._tilesToUpdate.add(tileId);
|
|
117
|
-
});
|
|
118
|
-
if (this.source) {
|
|
119
|
-
if (!this._reloadTimeout) {
|
|
120
|
-
this._reloadTimeout = window.setTimeout(() => {
|
|
121
|
-
this._tilesToUpdate.forEach((tileId) => {
|
|
122
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
123
|
-
// @ts-ignore
|
|
124
|
-
const tCache = this.source.tileCache;
|
|
125
|
-
if (tCache.containsKey(tileId)) {
|
|
126
|
-
// change of key of tile (will trigger a reload)
|
|
127
|
-
const tile = tCache.get(tileId) as VectorTile<Feature>;
|
|
128
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
129
|
-
// @ts-ignore
|
|
130
|
-
tile.key = false;
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
this.source!.changed();
|
|
134
|
-
this._tilesToUpdate.clear();
|
|
135
|
-
this._reloadTimeout = undefined;
|
|
136
|
-
}, 0);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
107
|
+
this.olLayer?.changed();
|
|
139
108
|
}
|
|
140
109
|
}
|
|
141
110
|
|
|
142
111
|
// eslint-disable-next-line no-unused-vars
|
|
143
112
|
updateStyle(_style: StyleItem, _silent?: boolean): void {
|
|
144
113
|
if (this.initialized) {
|
|
145
|
-
|
|
146
|
-
this._reloadTimeout = undefined;
|
|
147
|
-
this._tilesToUpdate.clear();
|
|
148
|
-
this.source!.refresh();
|
|
114
|
+
this.olLayer?.changed();
|
|
149
115
|
}
|
|
150
116
|
}
|
|
151
117
|
|
|
@@ -46,6 +46,8 @@ class WmsOpenlayersImpl extends RasterLayerOpenlayersImpl {
|
|
|
46
46
|
headers: this.headers,
|
|
47
47
|
}),
|
|
48
48
|
opacity: this.opacity,
|
|
49
|
+
minZoom: this.minRenderingLevel,
|
|
50
|
+
maxZoom: this.maxRenderingLevel,
|
|
49
51
|
});
|
|
50
52
|
}
|
|
51
53
|
return new Tile({
|
|
@@ -62,6 +64,8 @@ class WmsOpenlayersImpl extends RasterLayerOpenlayersImpl {
|
|
|
62
64
|
headers: this.headers,
|
|
63
65
|
}),
|
|
64
66
|
opacity: this.opacity,
|
|
67
|
+
minZoom: this.minRenderingLevel,
|
|
68
|
+
maxZoom: this.maxRenderingLevel,
|
|
65
69
|
});
|
|
66
70
|
}
|
|
67
71
|
}
|
|
@@ -124,6 +124,8 @@ class WmtsOpenlayersImpl extends RasterLayerOpenlayersImpl {
|
|
|
124
124
|
Object.assign(wmtsOptions, this.openlayersOptions);
|
|
125
125
|
return new Tile({
|
|
126
126
|
opacity: this.opacity,
|
|
127
|
+
minZoom: this.minRenderingLevel,
|
|
128
|
+
maxZoom: this.maxRenderingLevel,
|
|
127
129
|
source: new WMTSSource(wmtsOptions),
|
|
128
130
|
});
|
|
129
131
|
}
|
|
@@ -6,6 +6,7 @@ import CesiumTilesetLayer, {
|
|
|
6
6
|
} from './cesiumTilesetLayer.js';
|
|
7
7
|
import DeclarativeStyleItem, {
|
|
8
8
|
DeclarativeStyleItemOptions,
|
|
9
|
+
defaultDeclarativeStyle,
|
|
9
10
|
} from '../style/declarativeStyleItem.js';
|
|
10
11
|
import VectorStyleItem, {
|
|
11
12
|
VectorStyleItemOptions,
|
|
@@ -20,8 +21,6 @@ export type PointCloudOptions = CesiumTilesetOptions & {
|
|
|
20
21
|
pointSize?: number | string;
|
|
21
22
|
};
|
|
22
23
|
|
|
23
|
-
export const defaultPointCloudStyle = new DeclarativeStyleItem({});
|
|
24
|
-
|
|
25
24
|
/**
|
|
26
25
|
* represents a specific PointCloudLayer layer for cesium.
|
|
27
26
|
* <h3>Config Parameter</h3>
|
|
@@ -71,7 +70,7 @@ class PointCloudLayer extends CesiumTilesetLayer {
|
|
|
71
70
|
): StyleItem {
|
|
72
71
|
return super.getStyleOrDefaultStyle(
|
|
73
72
|
styleOptions,
|
|
74
|
-
defaultStyle ||
|
|
73
|
+
defaultStyle || defaultDeclarativeStyle,
|
|
75
74
|
);
|
|
76
75
|
}
|
|
77
76
|
|