@vcmap/core 5.0.0-rc.28 → 5.0.0-rc.29
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 +9 -3
- package/build/postinstall.js +13 -2
- package/index.d.ts +155 -106
- package/package.json +9 -4
- package/src/category/category.js +71 -32
- package/src/category/categoryCollection.js +27 -18
- package/src/cesium/cesiumVcsCameraPrimitive.js +13 -5
- package/src/cesium/entity.js +3 -1
- package/src/cesium/wallpaperMaterial.js +4 -2
- package/src/classRegistry.js +11 -4
- package/src/featureProvider/abstractFeatureProvider.js +43 -22
- package/src/featureProvider/tileProviderFeatureProvider.js +11 -5
- package/src/featureProvider/wmsFeatureProvider.js +37 -15
- package/src/interaction/abstractInteraction.js +5 -1
- package/src/interaction/coordinateAtPixel.js +34 -12
- package/src/interaction/eventHandler.js +63 -23
- package/src/interaction/featureAtPixelInteraction.js +96 -32
- package/src/interaction/featureProviderInteraction.js +23 -8
- package/src/interaction/interactionChain.js +19 -9
- package/src/interaction/interactionType.js +23 -26
- package/src/layer/cesium/cesiumTilesetCesiumImpl.js +45 -15
- package/src/layer/cesium/clusterContext.js +10 -3
- package/src/layer/cesium/dataSourceCesiumImpl.js +13 -4
- package/src/layer/cesium/openStreetMapCesiumImpl.js +7 -3
- package/src/layer/cesium/rasterLayerCesiumImpl.js +6 -2
- package/src/layer/cesium/singleImageCesiumImpl.js +14 -3
- package/src/layer/cesium/terrainCesiumImpl.js +3 -2
- package/src/layer/cesium/tmsCesiumImpl.js +15 -3
- package/src/layer/cesium/vectorCesiumImpl.js +69 -25
- package/src/layer/cesium/vectorContext.js +25 -5
- package/src/layer/cesium/vectorRasterTileCesiumImpl.js +15 -5
- package/src/layer/cesium/vectorTileImageryProvider.js +51 -13
- package/src/layer/cesium/wmsCesiumImpl.js +15 -3
- package/src/layer/cesium/wmtsCesiumImpl.js +18 -6
- package/src/layer/cesium/x3dmHelper.js +4 -1
- package/src/layer/cesiumTilesetLayer.js +55 -26
- package/src/layer/czmlLayer.js +11 -5
- package/src/layer/dataSourceLayer.js +25 -17
- package/src/layer/featureLayer.js +33 -18
- package/src/layer/featureStoreLayer.js +161 -99
- package/src/layer/featureStoreLayerChanges.js +57 -17
- package/src/layer/featureVisibility.js +89 -59
- package/src/layer/geojsonHelpers.js +70 -29
- package/src/layer/geojsonLayer.js +17 -11
- package/src/layer/globalHider.js +14 -4
- package/src/layer/layer.js +77 -44
- package/src/layer/layerImplementation.js +12 -4
- package/src/layer/oblique/layerObliqueImpl.js +3 -1
- package/src/layer/oblique/obliqueHelpers.js +75 -30
- package/src/layer/oblique/vectorObliqueImpl.js +175 -69
- package/src/layer/openStreetMapLayer.js +34 -20
- package/src/layer/openlayers/layerOpenlayersImpl.js +37 -15
- package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +3 -1
- package/src/layer/openlayers/rasterLayerOpenlayersImpl.js +3 -1
- package/src/layer/openlayers/singleImageOpenlayersImpl.js +3 -1
- package/src/layer/openlayers/tileDebugOpenlayersImpl.js +3 -1
- package/src/layer/openlayers/tmsOpenlayersImpl.js +6 -3
- package/src/layer/openlayers/vectorOpenlayersImpl.js +14 -4
- package/src/layer/openlayers/vectorTileOpenlayersImpl.js +12 -5
- package/src/layer/openlayers/wmsOpenlayersImpl.js +3 -1
- package/src/layer/openlayers/wmtsOpenlayersImpl.js +12 -5
- package/src/layer/pointCloudLayer.js +21 -10
- package/src/layer/rasterLayer.js +73 -22
- package/src/layer/singleImageLayer.js +10 -7
- package/src/layer/terrainHelpers.js +30 -19
- package/src/layer/terrainLayer.js +16 -7
- package/src/layer/tileLoadedHelper.js +9 -4
- package/src/layer/tileProvider/mvtTileProvider.js +10 -4
- package/src/layer/tileProvider/staticGeojsonTileProvider.js +10 -4
- package/src/layer/tileProvider/tileProvider.js +163 -87
- package/src/layer/tileProvider/urlTemplateTileProvider.js +10 -4
- package/src/layer/tmsLayer.js +7 -6
- package/src/layer/vectorHelpers.js +34 -25
- package/src/layer/vectorLayer.js +77 -36
- package/src/layer/vectorProperties.js +245 -74
- package/src/layer/vectorSymbols.js +3 -1
- package/src/layer/vectorTileLayer.js +121 -70
- package/src/layer/wfsLayer.js +19 -8
- package/src/layer/wmsHelpers.js +11 -6
- package/src/layer/wmsLayer.js +36 -14
- package/src/layer/wmtsLayer.js +35 -20
- package/src/map/baseOLMap.js +57 -31
- package/src/map/cameraLimiter.js +67 -18
- package/src/map/cesiumMap.js +307 -95
- package/src/map/obliqueMap.js +84 -34
- package/src/map/openlayersMap.js +40 -19
- package/src/map/vcsMap.js +21 -8
- package/src/oblique/helpers.js +212 -64
- package/src/oblique/obliqueCollection.js +111 -48
- package/src/oblique/obliqueDataSet.js +53 -21
- package/src/oblique/obliqueImage.js +50 -17
- package/src/oblique/obliqueImageMeta.js +7 -6
- package/src/oblique/obliqueProvider.js +75 -27
- package/src/oblique/obliqueView.js +18 -7
- package/src/oblique/obliqueViewDirection.js +3 -2
- package/src/oblique/parseImageJson.js +57 -23
- package/src/ol/feature.js +8 -3
- package/src/ol/geom/circle.js +12 -3
- package/src/ol/geom/geometryCollection.js +11 -4
- package/src/ol/render/canvas/canvasTileRenderer.js +11 -9
- package/src/overrideClassRegistry.js +13 -3
- package/src/style/arcStyle.js +129 -36
- package/src/style/arrowStyle.js +57 -22
- package/src/style/declarativeStyleItem.js +107 -62
- package/src/style/shapesCategory.js +8 -6
- package/src/style/styleFactory.js +4 -1
- package/src/style/styleHelpers.js +17 -8
- package/src/style/styleItem.js +28 -10
- package/src/style/vectorStyleItem.js +160 -74
- package/src/style/writeStyle.js +5 -7
- package/src/util/clipping/clippingObject.js +72 -38
- package/src/util/clipping/clippingObjectManager.js +53 -19
- package/src/util/clipping/clippingPlaneHelper.js +120 -53
- package/src/util/collection.js +12 -6
- package/src/util/editor/createFeatureSession.js +21 -6
- package/src/util/editor/editFeaturesSession.js +41 -15
- package/src/util/editor/editGeometrySession.js +55 -30
- package/src/util/editor/editorHelpers.js +114 -29
- package/src/util/editor/editorSessionHelpers.js +8 -3
- package/src/util/editor/interactions/createBBoxInteraction.js +11 -3
- package/src/util/editor/interactions/createCircleInteraction.js +7 -2
- package/src/util/editor/interactions/createLineStringInteraction.js +7 -2
- package/src/util/editor/interactions/createPolygonInteraction.js +7 -2
- package/src/util/editor/interactions/editFeaturesMouseOverInteraction.js +7 -5
- package/src/util/editor/interactions/editGeometryMouseOverInteraction.js +8 -3
- package/src/util/editor/interactions/ensureHandlerSelectionInteraction.js +4 -2
- package/src/util/editor/interactions/insertVertexInteraction.js +17 -6
- package/src/util/editor/interactions/mapInteractionController.js +31 -14
- package/src/util/editor/interactions/removeVertexInteraction.js +4 -1
- package/src/util/editor/interactions/selectFeatureMouseOverInteraction.js +19 -10
- package/src/util/editor/interactions/selectMultiFeatureInteraction.js +33 -20
- package/src/util/editor/interactions/selectSingleFeatureInteraction.js +14 -8
- package/src/util/editor/selectFeaturesSession.js +37 -21
- package/src/util/editor/transformation/create2DHandlers.js +82 -37
- package/src/util/editor/transformation/create3DHandlers.js +187 -84
- package/src/util/editor/transformation/extrudeInteraction.js +20 -5
- package/src/util/editor/transformation/rotateInteraction.js +29 -16
- package/src/util/editor/transformation/scaleInteraction.js +31 -15
- package/src/util/editor/transformation/transformationHandler.js +23 -8
- package/src/util/editor/transformation/transformationTypes.js +8 -4
- package/src/util/editor/transformation/translateInteraction.js +86 -32
- package/src/util/editor/validateGeoemetry.js +3 -1
- package/src/util/exclusiveManager.js +6 -3
- package/src/util/extent.js +20 -10
- package/src/util/featureconverter/arcToCesium.js +46 -12
- package/src/util/featureconverter/circleToCesium.js +61 -27
- package/src/util/featureconverter/convert.js +85 -13
- package/src/util/featureconverter/extent3D.js +69 -28
- package/src/util/featureconverter/featureconverterHelper.js +232 -79
- package/src/util/featureconverter/lineStringToCesium.js +107 -35
- package/src/util/featureconverter/pointHelpers.js +117 -45
- package/src/util/featureconverter/pointToCesium.js +128 -31
- package/src/util/featureconverter/polygonToCesium.js +50 -16
- package/src/util/fetch.js +3 -1
- package/src/util/geometryHelpers.js +15 -10
- package/src/util/indexedCollection.js +7 -3
- package/src/util/isMobile.js +8 -2
- package/src/util/layerCollection.js +28 -12
- package/src/util/mapCollection.js +37 -18
- package/src/util/math.js +35 -19
- package/src/util/overrideCollection.js +57 -32
- package/src/util/projection.js +21 -5
- package/src/util/urlHelpers.js +5 -3
- package/src/util/viewpoint.js +66 -33
- package/src/vcsApp.js +133 -69
- package/src/vcsModule.js +3 -2
- package/src/vcsModuleHelpers.js +24 -9
- package/src/vcsObject.js +3 -2
- package/tests/data/dynamicPointCzml.json +24 -35
- package/tests/data/oblique/imageData/imagev34.json +56 -272
- package/tests/data/oblique/imageData/imagev35.json +272 -19
- package/tests/data/oblique/imageData/imagev35PerImageSize.json +299 -19
- package/tests/data/oblique/tiledImageData/12/2199/1342.json +11056 -1
- package/tests/data/oblique/tiledImageData/12/2199/1343.json +11236 -1
- package/tests/data/oblique/tiledImageData/12/2199/1344.json +11077 -1
- package/tests/data/oblique/tiledImageData/12/2200/1342.json +11036 -1
- package/tests/data/oblique/tiledImageData/12/2200/1343.json +11277 -1
- package/tests/data/oblique/tiledImageData/12/2200/1344.json +11131 -1
- package/tests/data/oblique/tiledImageData/12/2201/1342.json +10870 -1
- package/tests/data/oblique/tiledImageData/12/2201/1343.json +11492 -1
- package/tests/data/oblique/tiledImageData/12/2201/1344.json +10909 -1
- package/tests/data/oblique/tiledImageData/image.json +70 -1
- package/tests/data/terrain/layer.json +121 -130
- package/tests/data/testGeoJSON.json +4 -16
- package/tests/unit/helpers/cesiumHelpers.js +58 -33
- package/tests/unit/helpers/helpers.js +10 -2
- package/tests/unit/helpers/imageHelpers.js +8 -4
- package/tests/unit/helpers/obliqueData.js +39 -13
- package/tests/unit/helpers/obliqueHelpers.js +12 -9
- package/tests/unit/helpers/openlayersHelpers.js +4 -1
- package/tests/unit/helpers/terrain/terrainData.js +8 -7
|
@@ -41,7 +41,12 @@ export function getExtentFromTileset(cesium3DTileset) {
|
|
|
41
41
|
CesiumMath.toDegrees(scratchNE.longitude),
|
|
42
42
|
CesiumMath.toDegrees(scratchNE.latitude),
|
|
43
43
|
]);
|
|
44
|
-
return /** @type {import("ol/extent").Extent} */ ([
|
|
44
|
+
return /** @type {import("ol/extent").Extent} */ ([
|
|
45
|
+
mercatorSW[0],
|
|
46
|
+
mercatorSW[1],
|
|
47
|
+
mercatorNE[0],
|
|
48
|
+
mercatorNE[1],
|
|
49
|
+
]);
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
const { center, radius } = cesium3DTileset.boundingSphere;
|
|
@@ -64,7 +69,9 @@ export function getExtentFromTileset(cesium3DTileset) {
|
|
|
64
69
|
*/
|
|
65
70
|
class CesiumTilesetCesiumImpl extends LayerImplementation {
|
|
66
71
|
/** @type {string} */
|
|
67
|
-
static get className() {
|
|
72
|
+
static get className() {
|
|
73
|
+
return 'CesiumTilesetCesiumImpl';
|
|
74
|
+
}
|
|
68
75
|
|
|
69
76
|
/**
|
|
70
77
|
* @param {import("@vcmap/core").CesiumMap} map
|
|
@@ -122,7 +129,9 @@ class CesiumTilesetCesiumImpl extends LayerImplementation {
|
|
|
122
129
|
});
|
|
123
130
|
}
|
|
124
131
|
this.cesium3DTileset[vcsLayerName] = this.name;
|
|
125
|
-
this.cesium3DTileset.tileVisible.addEventListener(
|
|
132
|
+
this.cesium3DTileset.tileVisible.addEventListener(
|
|
133
|
+
this.applyStyle.bind(this),
|
|
134
|
+
);
|
|
126
135
|
this.cesium3DTileset.tileUnload.addEventListener((tile) => {
|
|
127
136
|
delete tile[cesiumTilesetLastUpdated];
|
|
128
137
|
});
|
|
@@ -130,7 +139,9 @@ class CesiumTilesetCesiumImpl extends LayerImplementation {
|
|
|
130
139
|
this._initializedPromise = this.cesium3DTileset.readyPromise;
|
|
131
140
|
|
|
132
141
|
await this._initializedPromise;
|
|
133
|
-
this._originalOrigin = Cartesian3.clone(
|
|
142
|
+
this._originalOrigin = Cartesian3.clone(
|
|
143
|
+
this.cesium3DTileset.boundingSphere.center,
|
|
144
|
+
);
|
|
134
145
|
|
|
135
146
|
if (this.modelMatrix) {
|
|
136
147
|
this.cesium3DTileset.modelMatrix = this.modelMatrix;
|
|
@@ -155,12 +166,18 @@ class CesiumTilesetCesiumImpl extends LayerImplementation {
|
|
|
155
166
|
if (!this.offset) {
|
|
156
167
|
this.cesium3DTileset.modelMatrix = Matrix4.IDENTITY;
|
|
157
168
|
} else {
|
|
158
|
-
const cartographicCenter = Cartographic.fromCartesian(
|
|
169
|
+
const cartographicCenter = Cartographic.fromCartesian(
|
|
170
|
+
this._originalOrigin,
|
|
171
|
+
);
|
|
159
172
|
cartographicCenter.longitude += CesiumMath.toRadians(this.offset[0]);
|
|
160
173
|
cartographicCenter.latitude += CesiumMath.toRadians(this.offset[1]);
|
|
161
174
|
cartographicCenter.height += this.offset[2];
|
|
162
175
|
const offset = Cartographic.toCartesian(cartographicCenter);
|
|
163
|
-
const translation = Cartesian3.subtract(
|
|
176
|
+
const translation = Cartesian3.subtract(
|
|
177
|
+
offset,
|
|
178
|
+
this._originalOrigin,
|
|
179
|
+
offset,
|
|
180
|
+
);
|
|
164
181
|
this.cesium3DTileset.modelMatrix = Matrix4.fromTranslation(translation);
|
|
165
182
|
}
|
|
166
183
|
}
|
|
@@ -225,17 +242,24 @@ class CesiumTilesetCesiumImpl extends LayerImplementation {
|
|
|
225
242
|
if (this._onStyleChangeRemover) {
|
|
226
243
|
this._onStyleChangeRemover();
|
|
227
244
|
}
|
|
228
|
-
this._onStyleChangeRemover = this.style.styleChanged.addEventListener(
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
245
|
+
this._onStyleChangeRemover = this.style.styleChanged.addEventListener(
|
|
246
|
+
() => {
|
|
247
|
+
this.cesium3DTileset.makeStyleDirty();
|
|
248
|
+
this._styleLastUpdated = Date.now();
|
|
249
|
+
},
|
|
250
|
+
);
|
|
232
251
|
this._styleLastUpdated = Date.now();
|
|
233
252
|
this.cesium3DTileset.readyPromise.then(() => {
|
|
234
253
|
if (this.cesium3DTileset.colorBlendMode !== this.style.colorBlendMode) {
|
|
235
254
|
// we only support replace and mix mode if the _3DTILESDIFFUSE Flag is set in the tileset
|
|
236
|
-
if (
|
|
237
|
-
|
|
238
|
-
|
|
255
|
+
if (
|
|
256
|
+
this.style.colorBlendMode !== Cesium3DTileColorBlendMode.HIGHLIGHT
|
|
257
|
+
) {
|
|
258
|
+
if (
|
|
259
|
+
this.cesium3DTileset.extras &&
|
|
260
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
261
|
+
this.cesium3DTileset.extras._3DTILESDIFFUSE
|
|
262
|
+
) {
|
|
239
263
|
this.cesium3DTileset.colorBlendMode = this.style.colorBlendMode;
|
|
240
264
|
}
|
|
241
265
|
} else {
|
|
@@ -295,11 +319,17 @@ class CesiumTilesetCesiumImpl extends LayerImplementation {
|
|
|
295
319
|
this.featureVisibility.addHighlightFeature(id, feature);
|
|
296
320
|
}
|
|
297
321
|
|
|
298
|
-
if (
|
|
322
|
+
if (
|
|
323
|
+
this.featureVisibility.hiddenObjects[id] &&
|
|
324
|
+
!this.featureVisibility.hasHiddenFeature(id, feature)
|
|
325
|
+
) {
|
|
299
326
|
this.featureVisibility.addHiddenFeature(id, feature);
|
|
300
327
|
}
|
|
301
328
|
|
|
302
|
-
if (
|
|
329
|
+
if (
|
|
330
|
+
this.globalHider.hiddenObjects[id] &&
|
|
331
|
+
!this.globalHider.hasFeature(id, feature)
|
|
332
|
+
) {
|
|
303
333
|
this.globalHider.addFeature(id, feature);
|
|
304
334
|
}
|
|
305
335
|
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
removeFeatureFromMap,
|
|
3
|
+
addPrimitiveToContext,
|
|
4
|
+
removeArrayFromCollection,
|
|
5
|
+
} from './vectorContext.js';
|
|
2
6
|
|
|
3
7
|
/**
|
|
4
8
|
* @class
|
|
@@ -39,7 +43,10 @@ class ClusterContext {
|
|
|
39
43
|
*/
|
|
40
44
|
addBillboards(billboardOptions, feature, allowPicking) {
|
|
41
45
|
addPrimitiveToContext(
|
|
42
|
-
billboardOptions.map(billboard => ({
|
|
46
|
+
billboardOptions.map((billboard) => ({
|
|
47
|
+
billboard,
|
|
48
|
+
position: billboard.position,
|
|
49
|
+
})),
|
|
43
50
|
feature,
|
|
44
51
|
allowPicking,
|
|
45
52
|
this.entities,
|
|
@@ -54,7 +61,7 @@ class ClusterContext {
|
|
|
54
61
|
*/
|
|
55
62
|
addLabels(labelOptions, feature, allowPicking) {
|
|
56
63
|
addPrimitiveToContext(
|
|
57
|
-
labelOptions.map(label => ({ label, position: label.position })),
|
|
64
|
+
labelOptions.map((label) => ({ label, position: label.position })),
|
|
58
65
|
feature,
|
|
59
66
|
allowPicking,
|
|
60
67
|
this.entities,
|
|
@@ -18,8 +18,12 @@ function synchronizeEntityCollections(source, destination) {
|
|
|
18
18
|
destination.add(entity);
|
|
19
19
|
});
|
|
20
20
|
return source.collectionChanged.addEventListener((c, added, removed) => {
|
|
21
|
-
added.forEach((e) => {
|
|
22
|
-
|
|
21
|
+
added.forEach((e) => {
|
|
22
|
+
destination.add(e);
|
|
23
|
+
});
|
|
24
|
+
removed.forEach((e) => {
|
|
25
|
+
destination.remove(e);
|
|
26
|
+
});
|
|
23
27
|
});
|
|
24
28
|
}
|
|
25
29
|
|
|
@@ -29,7 +33,9 @@ function synchronizeEntityCollections(source, destination) {
|
|
|
29
33
|
*/
|
|
30
34
|
class DataSourceCesiumImpl extends LayerImplementation {
|
|
31
35
|
/** @type {string} */
|
|
32
|
-
static get className() {
|
|
36
|
+
static get className() {
|
|
37
|
+
return 'DataSourceCesiumImpl';
|
|
38
|
+
}
|
|
33
39
|
|
|
34
40
|
/**
|
|
35
41
|
* @param {import("@vcmap/core").CesiumMap} map
|
|
@@ -64,7 +70,10 @@ class DataSourceCesiumImpl extends LayerImplementation {
|
|
|
64
70
|
*/
|
|
65
71
|
async initialize() {
|
|
66
72
|
if (!this.initialized) {
|
|
67
|
-
this._collectionListener = synchronizeEntityCollections(
|
|
73
|
+
this._collectionListener = synchronizeEntityCollections(
|
|
74
|
+
this.entities,
|
|
75
|
+
this.dataSource.entities,
|
|
76
|
+
);
|
|
68
77
|
await this.map.addDataSource(this.dataSource);
|
|
69
78
|
}
|
|
70
79
|
await super.initialize();
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
OpenStreetMapImageryProvider,
|
|
3
|
+
ImageryLayer as CesiumImageryLayer,
|
|
4
|
+
} from '@vcmap-cesium/engine';
|
|
2
5
|
import RasterLayerCesiumImpl from './rasterLayerCesiumImpl.js';
|
|
3
6
|
|
|
4
7
|
/**
|
|
@@ -7,7 +10,9 @@ import RasterLayerCesiumImpl from './rasterLayerCesiumImpl.js';
|
|
|
7
10
|
* @extends {RasterLayerCesiumImpl}
|
|
8
11
|
*/
|
|
9
12
|
class OpenStreetMapCesiumImpl extends RasterLayerCesiumImpl {
|
|
10
|
-
static get className() {
|
|
13
|
+
static get className() {
|
|
14
|
+
return 'OpenStreetMapCesiumImpl';
|
|
15
|
+
}
|
|
11
16
|
|
|
12
17
|
/**
|
|
13
18
|
* @inheritDoc
|
|
@@ -24,5 +29,4 @@ class OpenStreetMapCesiumImpl extends RasterLayerCesiumImpl {
|
|
|
24
29
|
}
|
|
25
30
|
}
|
|
26
31
|
|
|
27
|
-
|
|
28
32
|
export default OpenStreetMapCesiumImpl;
|
|
@@ -8,7 +8,9 @@ import LayerImplementation from '../layerImplementation.js';
|
|
|
8
8
|
* @implements {RasterLayerImplementation}
|
|
9
9
|
*/
|
|
10
10
|
class RasterLayerCesiumImpl extends LayerImplementation {
|
|
11
|
-
static get className() {
|
|
11
|
+
static get className() {
|
|
12
|
+
return 'RasterLayerCesiumImpl';
|
|
13
|
+
}
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* @param {import("@vcmap/core").CesiumMap} map
|
|
@@ -61,7 +63,9 @@ class RasterLayerCesiumImpl extends LayerImplementation {
|
|
|
61
63
|
* @returns {import("@vcmap-cesium/engine").ImageryLayer}
|
|
62
64
|
*/
|
|
63
65
|
// eslint-disable-next-line class-methods-use-this
|
|
64
|
-
getCesiumLayer() {
|
|
66
|
+
getCesiumLayer() {
|
|
67
|
+
throw new Error('implementation error');
|
|
68
|
+
}
|
|
65
69
|
|
|
66
70
|
/**
|
|
67
71
|
* @inheritDoc
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Rectangle,
|
|
3
|
+
SingleTileImageryProvider,
|
|
4
|
+
ImageryLayer,
|
|
5
|
+
} from '@vcmap-cesium/engine';
|
|
2
6
|
import RasterLayerCesiumImpl from './rasterLayerCesiumImpl.js';
|
|
3
7
|
import { wgs84Projection } from '../../util/projection.js';
|
|
4
8
|
|
|
@@ -8,7 +12,9 @@ import { wgs84Projection } from '../../util/projection.js';
|
|
|
8
12
|
* @extends {RasterLayerCesiumImpl}
|
|
9
13
|
*/
|
|
10
14
|
class SingleImageCesiumImpl extends RasterLayerCesiumImpl {
|
|
11
|
-
static get className() {
|
|
15
|
+
static get className() {
|
|
16
|
+
return 'SingleImageCesiumImpl';
|
|
17
|
+
}
|
|
12
18
|
|
|
13
19
|
/**
|
|
14
20
|
* @param {import("@vcmap/core").CesiumMap} map
|
|
@@ -31,7 +37,12 @@ class SingleImageCesiumImpl extends RasterLayerCesiumImpl {
|
|
|
31
37
|
|
|
32
38
|
const extent = this.extent.getCoordinatesInProjection(wgs84Projection);
|
|
33
39
|
if (extent) {
|
|
34
|
-
options.rectangle = Rectangle.fromDegrees(
|
|
40
|
+
options.rectangle = Rectangle.fromDegrees(
|
|
41
|
+
extent[0],
|
|
42
|
+
extent[1],
|
|
43
|
+
extent[2],
|
|
44
|
+
extent[3],
|
|
45
|
+
);
|
|
35
46
|
}
|
|
36
47
|
|
|
37
48
|
const imageryProvider = new SingleTileImageryProvider(options);
|
|
@@ -2,14 +2,15 @@ import LayerImplementation from '../layerImplementation.js';
|
|
|
2
2
|
import { vcsLayerName } from '../layerSymbols.js';
|
|
3
3
|
import { getTerrainProviderForUrl } from '../terrainHelpers.js';
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* TerrainLayer implementation for {@link CesiumMap}
|
|
8
7
|
* @class
|
|
9
8
|
* @extends {LayerImplementation<import("@vcmap/core").CesiumMap>}}
|
|
10
9
|
*/
|
|
11
10
|
class TerrainCesiumImpl extends LayerImplementation {
|
|
12
|
-
static get className() {
|
|
11
|
+
static get className() {
|
|
12
|
+
return 'TerrainCesiumImpl';
|
|
13
|
+
}
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* @param {import("@vcmap/core").CesiumMap} map
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Rectangle,
|
|
3
|
+
GeographicTilingScheme,
|
|
4
|
+
TileMapServiceImageryProvider,
|
|
5
|
+
ImageryLayer as CesiumImageryLayer,
|
|
6
|
+
} from '@vcmap-cesium/engine';
|
|
2
7
|
import RasterLayerCesiumImpl from './rasterLayerCesiumImpl.js';
|
|
3
8
|
import { wgs84Projection } from '../../util/projection.js';
|
|
4
9
|
import { TilingScheme } from '../rasterLayer.js';
|
|
@@ -9,7 +14,9 @@ import { TilingScheme } from '../rasterLayer.js';
|
|
|
9
14
|
* @extends {RasterLayerCesiumImpl}
|
|
10
15
|
*/
|
|
11
16
|
class TmsCesiumImpl extends RasterLayerCesiumImpl {
|
|
12
|
-
static get className() {
|
|
17
|
+
static get className() {
|
|
18
|
+
return 'TmsCesiumImpl';
|
|
19
|
+
}
|
|
13
20
|
|
|
14
21
|
/**
|
|
15
22
|
* @param {import("@vcmap/core").CesiumMap} map
|
|
@@ -35,7 +42,12 @@ class TmsCesiumImpl extends RasterLayerCesiumImpl {
|
|
|
35
42
|
|
|
36
43
|
if (this.extent && this.extent.isValid()) {
|
|
37
44
|
const extent = this.extent.getCoordinatesInProjection(wgs84Projection);
|
|
38
|
-
options.rectangle = Rectangle.fromDegrees(
|
|
45
|
+
options.rectangle = Rectangle.fromDegrees(
|
|
46
|
+
extent[0],
|
|
47
|
+
extent[1],
|
|
48
|
+
extent[2],
|
|
49
|
+
extent[3],
|
|
50
|
+
);
|
|
39
51
|
}
|
|
40
52
|
if (this.tilingSchema === TilingScheme.GEOGRAPHIC) {
|
|
41
53
|
options.tilingScheme = new GeographicTilingScheme();
|
|
@@ -14,7 +14,9 @@ import { synchronizeFeatureVisibilityWithSource } from '../vectorHelpers.js';
|
|
|
14
14
|
* @implements {FeatureLayerImplementation}
|
|
15
15
|
*/
|
|
16
16
|
class VectorCesiumImpl extends LayerImplementation {
|
|
17
|
-
static get className() {
|
|
17
|
+
static get className() {
|
|
18
|
+
return 'VectorCesiumImpl';
|
|
19
|
+
}
|
|
18
20
|
|
|
19
21
|
/**
|
|
20
22
|
* @param {import("@vcmap/core").CesiumMap} map
|
|
@@ -80,23 +82,37 @@ class VectorCesiumImpl extends LayerImplementation {
|
|
|
80
82
|
* @private
|
|
81
83
|
*/
|
|
82
84
|
_addListeners() {
|
|
83
|
-
this._olListeners.push(
|
|
84
|
-
.on('addfeature', (event) => {
|
|
85
|
-
this._addFeature(
|
|
86
|
-
|
|
85
|
+
this._olListeners.push(
|
|
86
|
+
this.source.on('addfeature', (event) => {
|
|
87
|
+
this._addFeature(
|
|
88
|
+
/** @type {import("ol/source/Vector").VectorSourceEvent} */ (event)
|
|
89
|
+
.feature,
|
|
90
|
+
);
|
|
91
|
+
}),
|
|
92
|
+
);
|
|
87
93
|
|
|
88
|
-
this._olListeners.push(
|
|
89
|
-
.on('removefeature', (event) => {
|
|
90
|
-
this._removeFeature(
|
|
91
|
-
|
|
94
|
+
this._olListeners.push(
|
|
95
|
+
this.source.on('removefeature', (event) => {
|
|
96
|
+
this._removeFeature(
|
|
97
|
+
/** @type {import("ol/source/Vector").VectorSourceEvent} */ (event)
|
|
98
|
+
.feature,
|
|
99
|
+
);
|
|
100
|
+
}),
|
|
101
|
+
);
|
|
92
102
|
|
|
93
|
-
this._olListeners.push(
|
|
94
|
-
.on('changefeature', (event) => {
|
|
95
|
-
this._featureChanged(
|
|
96
|
-
|
|
103
|
+
this._olListeners.push(
|
|
104
|
+
this.source.on('changefeature', (event) => {
|
|
105
|
+
this._featureChanged(
|
|
106
|
+
/** @type {import("ol/source/Vector").VectorSourceEvent} */ (event)
|
|
107
|
+
.feature,
|
|
108
|
+
);
|
|
109
|
+
}),
|
|
110
|
+
);
|
|
97
111
|
|
|
98
112
|
this._removeVectorPropertiesChangeHandler =
|
|
99
|
-
this.vectorProperties.propertyChanged.addEventListener(
|
|
113
|
+
this.vectorProperties.propertyChanged.addEventListener(
|
|
114
|
+
this.refresh.bind(this),
|
|
115
|
+
);
|
|
100
116
|
}
|
|
101
117
|
|
|
102
118
|
/**
|
|
@@ -105,8 +121,15 @@ class VectorCesiumImpl extends LayerImplementation {
|
|
|
105
121
|
* @protected
|
|
106
122
|
*/
|
|
107
123
|
async _setupContext(cesiumMap) {
|
|
108
|
-
const rootCollection =
|
|
109
|
-
|
|
124
|
+
const rootCollection =
|
|
125
|
+
/** @type {import("@vcmap-cesium/engine").PrimitiveCollection} */ (
|
|
126
|
+
this._rootCollection
|
|
127
|
+
);
|
|
128
|
+
this._context = new VectorContext(
|
|
129
|
+
cesiumMap,
|
|
130
|
+
rootCollection,
|
|
131
|
+
this.splitDirection,
|
|
132
|
+
);
|
|
110
133
|
cesiumMap.addPrimitiveCollection(rootCollection);
|
|
111
134
|
}
|
|
112
135
|
|
|
@@ -133,7 +156,9 @@ class VectorCesiumImpl extends LayerImplementation {
|
|
|
133
156
|
*/
|
|
134
157
|
_addFeatures(features) {
|
|
135
158
|
// TODO we should make this non-blocking to better handle larger data sets check in RIWA Impl
|
|
136
|
-
features.forEach((f) => {
|
|
159
|
+
features.forEach((f) => {
|
|
160
|
+
this._addFeature(f);
|
|
161
|
+
});
|
|
137
162
|
}
|
|
138
163
|
|
|
139
164
|
/**
|
|
@@ -142,8 +167,15 @@ class VectorCesiumImpl extends LayerImplementation {
|
|
|
142
167
|
* @private
|
|
143
168
|
*/
|
|
144
169
|
_addFeature(feature) {
|
|
145
|
-
if (this.active) {
|
|
146
|
-
|
|
170
|
+
if (this.active) {
|
|
171
|
+
// XXX cluster check here? or on init?
|
|
172
|
+
convert(
|
|
173
|
+
feature,
|
|
174
|
+
this.style.style,
|
|
175
|
+
this.vectorProperties,
|
|
176
|
+
this._context,
|
|
177
|
+
this._scene,
|
|
178
|
+
);
|
|
147
179
|
} else {
|
|
148
180
|
this._featureToAdd.add(feature);
|
|
149
181
|
}
|
|
@@ -193,7 +225,11 @@ class VectorCesiumImpl extends LayerImplementation {
|
|
|
193
225
|
this._rootCollection.show = true;
|
|
194
226
|
if (this._featureVisibilityListeners.length === 0) {
|
|
195
227
|
this._featureVisibilityListeners =
|
|
196
|
-
synchronizeFeatureVisibilityWithSource(
|
|
228
|
+
synchronizeFeatureVisibilityWithSource(
|
|
229
|
+
this.featureVisibility,
|
|
230
|
+
this.source,
|
|
231
|
+
this.globalHider,
|
|
232
|
+
);
|
|
197
233
|
}
|
|
198
234
|
}
|
|
199
235
|
}
|
|
@@ -205,7 +241,9 @@ class VectorCesiumImpl extends LayerImplementation {
|
|
|
205
241
|
deactivate() {
|
|
206
242
|
super.deactivate();
|
|
207
243
|
this._rootCollection.show = false;
|
|
208
|
-
this._featureVisibilityListeners.forEach((cb) => {
|
|
244
|
+
this._featureVisibilityListeners.forEach((cb) => {
|
|
245
|
+
cb();
|
|
246
|
+
});
|
|
209
247
|
this._featureVisibilityListeners = [];
|
|
210
248
|
}
|
|
211
249
|
|
|
@@ -216,7 +254,7 @@ class VectorCesiumImpl extends LayerImplementation {
|
|
|
216
254
|
updateStyle(style, silent) {
|
|
217
255
|
this.style = style;
|
|
218
256
|
if (this.initialized && !silent) {
|
|
219
|
-
const features = this.source.getFeatures().filter(f => !f.getStyle());
|
|
257
|
+
const features = this.source.getFeatures().filter((f) => !f.getStyle());
|
|
220
258
|
features.forEach((f) => {
|
|
221
259
|
this._featureChanged(f);
|
|
222
260
|
});
|
|
@@ -237,7 +275,9 @@ class VectorCesiumImpl extends LayerImplementation {
|
|
|
237
275
|
* @protected
|
|
238
276
|
*/
|
|
239
277
|
_destroyCollection() {
|
|
240
|
-
this.map.removePrimitiveCollection(
|
|
278
|
+
this.map.removePrimitiveCollection(
|
|
279
|
+
/** @type {undefined} */ (this._rootCollection),
|
|
280
|
+
); // cast to undefined do to missing inheritance
|
|
241
281
|
}
|
|
242
282
|
|
|
243
283
|
/**
|
|
@@ -251,10 +291,14 @@ class VectorCesiumImpl extends LayerImplementation {
|
|
|
251
291
|
this._context = null;
|
|
252
292
|
this._scene = null;
|
|
253
293
|
this._removeVectorPropertiesChangeHandler();
|
|
254
|
-
this._olListeners.forEach((listener) => {
|
|
294
|
+
this._olListeners.forEach((listener) => {
|
|
295
|
+
unByKey(listener);
|
|
296
|
+
});
|
|
255
297
|
this._olListeners = [];
|
|
256
298
|
this._featureToAdd.clear();
|
|
257
|
-
this._featureVisibilityListeners.forEach((cb) => {
|
|
299
|
+
this._featureVisibilityListeners.forEach((cb) => {
|
|
300
|
+
cb();
|
|
301
|
+
});
|
|
258
302
|
this._featureVisibilityListeners = [];
|
|
259
303
|
this.source = null;
|
|
260
304
|
this.vectorProperties = null;
|
|
@@ -43,7 +43,11 @@ export function removeArrayFromCollection(collection, array) {
|
|
|
43
43
|
* @param {import("@vcmap-cesium/engine").PrimitiveCollection|import("@vcmap-cesium/engine").BillboardCollection|import("@vcmap-cesium/engine").LabelCollection|import("@vcmap-cesium/engine").EntityCollection} primitiveCollection
|
|
44
44
|
* @returns {boolean} - if a feature was removed from the map
|
|
45
45
|
*/
|
|
46
|
-
export function removeFeatureFromMap(
|
|
46
|
+
export function removeFeatureFromMap(
|
|
47
|
+
feature,
|
|
48
|
+
featuresMap,
|
|
49
|
+
primitiveCollection,
|
|
50
|
+
) {
|
|
47
51
|
removeArrayFromCollection(primitiveCollection, featuresMap.get(feature));
|
|
48
52
|
return featuresMap.delete(feature);
|
|
49
53
|
}
|
|
@@ -117,7 +121,11 @@ const scratchCenter = new Cartesian3();
|
|
|
117
121
|
* @param {{value: boolean}}dirtyRef
|
|
118
122
|
* @returns {function():void}
|
|
119
123
|
*/
|
|
120
|
-
export function setupScalingPrimitiveCollection(
|
|
124
|
+
export function setupScalingPrimitiveCollection(
|
|
125
|
+
map,
|
|
126
|
+
primitiveCollection,
|
|
127
|
+
dirtyRef,
|
|
128
|
+
) {
|
|
121
129
|
let cachedVP = new Viewpoint({});
|
|
122
130
|
return map.getScene().postRender.addEventListener(() => {
|
|
123
131
|
const { length } = primitiveCollection;
|
|
@@ -137,7 +145,11 @@ export function setupScalingPrimitiveCollection(map, primitiveCollection, dirtyR
|
|
|
137
145
|
const center = Matrix4.getTranslation(modelMatrix, scratchCenter);
|
|
138
146
|
const res = map.getCurrentResolutionFromCartesian(center);
|
|
139
147
|
if (primitive[scaleSymbol] !== res) {
|
|
140
|
-
primitive.modelMatrix = Matrix4.setScale(
|
|
148
|
+
primitive.modelMatrix = Matrix4.setScale(
|
|
149
|
+
modelMatrix,
|
|
150
|
+
new Cartesian3(res, res, res),
|
|
151
|
+
new Matrix4(),
|
|
152
|
+
);
|
|
141
153
|
primitive[scaleSymbol] = res;
|
|
142
154
|
}
|
|
143
155
|
}
|
|
@@ -188,7 +200,11 @@ class VectorContext {
|
|
|
188
200
|
this._rootCollection.add(this.labels);
|
|
189
201
|
|
|
190
202
|
this._scaledDirty = { value: true };
|
|
191
|
-
this._postRenderListener = setupScalingPrimitiveCollection(
|
|
203
|
+
this._postRenderListener = setupScalingPrimitiveCollection(
|
|
204
|
+
map,
|
|
205
|
+
this.scaledPrimitives,
|
|
206
|
+
this._scaledDirty,
|
|
207
|
+
);
|
|
192
208
|
}
|
|
193
209
|
|
|
194
210
|
/**
|
|
@@ -261,7 +277,11 @@ class VectorContext {
|
|
|
261
277
|
*/
|
|
262
278
|
removeFeature(feature) {
|
|
263
279
|
removeFeatureFromMap(feature, this.featureToPrimitiveMap, this.primitives);
|
|
264
|
-
this._scaledDirty.value = removeFeatureFromMap(
|
|
280
|
+
this._scaledDirty.value = removeFeatureFromMap(
|
|
281
|
+
feature,
|
|
282
|
+
this.featureToScaledPrimitiveMap,
|
|
283
|
+
this.scaledPrimitives,
|
|
284
|
+
);
|
|
265
285
|
removeFeatureFromMap(feature, this.featureToBillboardMap, this.billboards);
|
|
266
286
|
removeFeatureFromMap(feature, this.featureToLabelMap, this.labels);
|
|
267
287
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ImageryLayer as CesiumImageryLayer,
|
|
3
|
+
Rectangle,
|
|
4
|
+
} from '@vcmap-cesium/engine';
|
|
2
5
|
import VectorTileImageryProvider from './vectorTileImageryProvider.js';
|
|
3
6
|
import RasterLayerCesiumImpl from './rasterLayerCesiumImpl.js';
|
|
4
7
|
import { wgs84Projection } from '../../util/projection.js';
|
|
@@ -63,14 +66,21 @@ class VectorRasterTileCesiumImpl extends RasterLayerCesiumImpl {
|
|
|
63
66
|
};
|
|
64
67
|
if (this.extent && this.extent.isValid()) {
|
|
65
68
|
const extent = this.extent.getCoordinatesInProjection(wgs84Projection);
|
|
66
|
-
layerOptions.rectangle = Rectangle.fromDegrees(
|
|
69
|
+
layerOptions.rectangle = Rectangle.fromDegrees(
|
|
70
|
+
extent[0],
|
|
71
|
+
extent[1],
|
|
72
|
+
extent[2],
|
|
73
|
+
extent[3],
|
|
74
|
+
);
|
|
67
75
|
}
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
const imageryLayer = new CesiumImageryLayer(
|
|
77
|
+
// @ts-ignore
|
|
78
|
+
this.imageryProvider,
|
|
79
|
+
layerOptions,
|
|
80
|
+
);
|
|
70
81
|
return imageryLayer;
|
|
71
82
|
}
|
|
72
83
|
|
|
73
|
-
|
|
74
84
|
/**
|
|
75
85
|
* reloads the tiles
|
|
76
86
|
* @private
|