@vcmap/core 5.0.0-rc.3 → 5.0.0-rc.30
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/LICENSE.md +1 -1
- package/README.md +12 -5
- package/build/postinstall.js +14 -3
- package/index.d.ts +3477 -2007
- package/index.js +169 -131
- package/package.json +25 -27
- package/src/category/category.js +483 -0
- package/src/category/categoryCollection.js +153 -0
- package/src/cesium/cesium3DTileFeature.js +2 -2
- package/src/cesium/cesium3DTilePointFeature.js +1 -1
- package/src/cesium/cesiumVcsCameraPrimitive.js +16 -8
- package/src/cesium/entity.js +29 -0
- package/src/cesium/wallpaperMaterial.js +5 -3
- package/src/classRegistry.js +169 -0
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/abstractFeatureProvider.js +49 -46
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/tileProviderFeatureProvider.js +13 -5
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/wmsFeatureProvider.js +56 -26
- package/src/{vcs/vcm/interaction → interaction}/abstractInteraction.js +33 -21
- package/src/{vcs/vcm/interaction → interaction}/coordinateAtPixel.js +40 -21
- package/src/{vcs/vcm/interaction → interaction}/eventHandler.js +131 -26
- package/src/{vcs/vcm/interaction → interaction}/featureAtPixelInteraction.js +108 -53
- package/src/interaction/featureProviderInteraction.js +58 -0
- package/src/{vcs/vcm/interaction → interaction}/interactionChain.js +40 -41
- package/src/{vcs/vcm/interaction → interaction}/interactionType.js +24 -31
- package/src/{vcs/vcm/layer/cesium/cesiumTilesetCesium.js → layer/cesium/cesiumTilesetCesiumImpl.js} +67 -55
- package/src/{vcs/vcm/layer → layer}/cesium/clusterContext.js +33 -8
- package/src/{vcs/vcm/layer/cesium/dataSourceCesium.js → layer/cesium/dataSourceCesiumImpl.js} +24 -13
- package/src/layer/cesium/openStreetMapCesiumImpl.js +32 -0
- package/src/{vcs/vcm/layer/cesium/rasterLayerCesium.js → layer/cesium/rasterLayerCesiumImpl.js} +12 -9
- package/src/{vcs/vcm/layer/cesium/singleImageCesium.js → layer/cesium/singleImageCesiumImpl.js} +19 -9
- package/src/{vcs/vcm/layer/cesium/terrainCesium.js → layer/cesium/terrainCesiumImpl.js} +6 -6
- package/src/{vcs/vcm/layer/cesium/tmsCesium.js → layer/cesium/tmsCesiumImpl.js} +21 -10
- package/src/{vcs/vcm/layer/cesium/vectorCesium.js → layer/cesium/vectorCesiumImpl.js} +93 -35
- package/src/layer/cesium/vectorContext.js +363 -0
- package/src/{vcs/vcm/layer/cesium/vectorRasterTileCesium.js → layer/cesium/vectorRasterTileCesiumImpl.js} +21 -13
- package/src/{vcs/vcm/layer → layer}/cesium/vectorTileImageryProvider.js +58 -21
- package/src/{vcs/vcm/layer/cesium/wmsCesium.js → layer/cesium/wmsCesiumImpl.js} +20 -9
- package/src/{vcs/vcm/layer/cesium/wmtsCesium.js → layer/cesium/wmtsCesiumImpl.js} +24 -13
- package/src/{vcs/vcm/layer → layer}/cesium/x3dmHelper.js +6 -3
- package/src/{vcs/vcm/layer/cesiumTileset.js → layer/cesiumTilesetLayer.js} +71 -108
- package/src/{vcs/vcm/layer/czml.js → layer/czmlLayer.js} +23 -20
- package/src/{vcs/vcm/layer/dataSource.js → layer/dataSourceLayer.js} +55 -90
- package/src/{vcs/vcm/layer → layer}/featureLayer.js +89 -74
- package/src/{vcs/vcm/layer/featureStore.js → layer/featureStoreLayer.js} +197 -150
- package/src/{vcs/vcm/layer/featureStoreChanges.js → layer/featureStoreLayerChanges.js} +150 -92
- package/src/{vcs/vcm/layer/featureStoreState.js → layer/featureStoreLayerState.js} +1 -2
- package/src/{vcs/vcm/layer → layer}/featureVisibility.js +114 -82
- package/src/{vcs/vcm/layer → layer}/geojsonHelpers.js +84 -69
- package/src/{vcs/vcm/layer/geojson.js → layer/geojsonLayer.js} +30 -27
- package/src/{vcs/vcm/layer → layer}/globalHider.js +25 -39
- package/src/{vcs/vcm/layer → layer}/layer.js +171 -96
- package/src/{vcs/vcm/layer → layer}/layerImplementation.js +13 -6
- package/src/{vcs/vcm/layer → layer}/layerState.js +0 -1
- package/src/{vcs/vcm/layer → layer}/layerSymbols.js +2 -1
- package/src/{vcs/vcm/layer/oblique/layerOblique.js → layer/oblique/layerObliqueImpl.js} +7 -5
- package/src/{vcs/vcm/layer → layer}/oblique/obliqueHelpers.js +76 -31
- package/src/{vcs/vcm/layer/oblique/vectorOblique.js → layer/oblique/vectorObliqueImpl.js} +198 -80
- package/src/{vcs/vcm/layer/openStreetMap.js → layer/openStreetMapLayer.js} +59 -40
- package/src/layer/openlayers/layerOpenlayersImpl.js +165 -0
- package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +28 -0
- package/src/layer/openlayers/rasterLayerOpenlayersImpl.js +44 -0
- package/src/{vcs/vcm/layer/openlayers/singleImageOpenlayers.js → layer/openlayers/singleImageOpenlayersImpl.js} +8 -7
- package/src/{vcs/vcm/layer/openlayers/tileDebugOpenlayers.js → layer/openlayers/tileDebugOpenlayersImpl.js} +7 -6
- package/src/{vcs/vcm/layer/openlayers/tmsOpenlayers.js → layer/openlayers/tmsOpenlayersImpl.js} +12 -10
- package/src/{vcs/vcm/layer/openlayers/vectorOpenlayers.js → layer/openlayers/vectorOpenlayersImpl.js} +21 -12
- package/src/{vcs/vcm/layer/openlayers/vectorTileOpenlayers.js → layer/openlayers/vectorTileOpenlayersImpl.js} +18 -12
- package/src/{vcs/vcm/layer/openlayers/wmsOpenlayers.js → layer/openlayers/wmsOpenlayersImpl.js} +9 -8
- package/src/{vcs/vcm/layer/openlayers/wmtsOpenlayers.js → layer/openlayers/wmtsOpenlayersImpl.js} +19 -12
- package/src/{vcs/vcm/layer/pointCloud.js → layer/pointCloudLayer.js} +42 -39
- package/src/{vcs/vcm/layer → layer}/rasterLayer.js +86 -37
- package/src/{vcs/vcm/layer/singleImage.js → layer/singleImageLayer.js} +25 -22
- package/src/layer/terrainHelpers.js +98 -0
- package/src/{vcs/vcm/layer/terrain.js → layer/terrainLayer.js} +26 -18
- package/src/{vcs/vcm/layer → layer}/tileLoadedHelper.js +13 -8
- package/src/{vcs/vcm/layer → layer}/tileProvider/mvtTileProvider.js +51 -8
- package/src/layer/tileProvider/staticGeojsonTileProvider.js +87 -0
- package/src/{vcs/vcm/layer → layer}/tileProvider/tileProvider.js +200 -89
- package/src/{vcs/vcm/layer → layer}/tileProvider/urlTemplateTileProvider.js +54 -13
- package/src/{vcs/vcm/layer/tms.js → layer/tmsLayer.js} +22 -22
- package/src/layer/vectorHelpers.js +129 -0
- package/src/{vcs/vcm/layer/vector.js → layer/vectorLayer.js} +124 -94
- package/src/{vcs/vcm/layer → layer}/vectorProperties.js +419 -107
- package/src/{vcs/vcm/layer → layer}/vectorSymbols.js +11 -1
- package/src/{vcs/vcm/layer/vectorTile.js → layer/vectorTileLayer.js} +181 -116
- package/src/{vcs/vcm/layer/wfs.js → layer/wfsLayer.js} +33 -23
- package/src/{vcs/vcm/layer → layer}/wmsHelpers.js +14 -7
- package/src/{vcs/vcm/layer/wms.js → layer/wmsLayer.js} +53 -32
- package/src/{vcs/vcm/layer/wmts.js → layer/wmtsLayer.js} +56 -42
- package/src/{vcs/vcm/maps → map}/baseOLMap.js +83 -35
- package/src/{vcs/vcm/maps → map}/cameraLimiter.js +75 -32
- package/src/{vcs/vcm/maps/cesium.js → map/cesiumMap.js} +429 -276
- package/src/{vcs/vcm/maps → map}/mapState.js +0 -1
- package/src/{vcs/vcm/maps/oblique.js → map/obliqueMap.js} +132 -97
- package/src/{vcs/vcm/maps/openlayers.js → map/openlayersMap.js} +69 -45
- package/src/{vcs/vcm/maps/map.js → map/vcsMap.js} +118 -46
- package/src/oblique/defaultObliqueCollection.js +62 -0
- package/src/{vcs/vcm/oblique → oblique}/helpers.js +221 -78
- package/src/{vcs/vcm/oblique/ObliqueCollection.js → oblique/obliqueCollection.js} +145 -54
- package/src/{vcs/vcm/oblique/ObliqueDataSet.js → oblique/obliqueDataSet.js} +62 -32
- package/src/{vcs/vcm/oblique/ObliqueImage.js → oblique/obliqueImage.js} +58 -26
- package/src/{vcs/vcm/oblique/ObliqueImageMeta.js → oblique/obliqueImageMeta.js} +9 -9
- package/src/{vcs/vcm/oblique/ObliqueProvider.js → oblique/obliqueProvider.js} +85 -35
- package/src/{vcs/vcm/oblique/ObliqueView.js → oblique/obliqueView.js} +45 -5
- package/src/{vcs/vcm/oblique/ObliqueViewDirection.js → oblique/obliqueViewDirection.js} +3 -5
- package/src/{vcs/vcm/oblique → oblique}/parseImageJson.js +62 -28
- package/src/ol/feature.js +34 -1
- package/src/ol/geom/circle.js +14 -5
- package/src/ol/geom/geometryCollection.js +14 -8
- package/src/ol/render/canvas/canvasTileRenderer.js +11 -10
- package/src/overrideClassRegistry.js +214 -0
- package/src/style/arcStyle.js +453 -0
- package/src/style/arrowStyle.js +304 -0
- package/src/{vcs/vcm/util/style → style}/declarativeStyleItem.js +147 -82
- package/src/{vcs/vcm/util/style → style}/shapesCategory.js +8 -8
- package/src/style/styleFactory.js +32 -0
- package/src/{vcs/vcm/util/style → style}/styleHelpers.js +24 -26
- package/src/style/styleItem.js +174 -0
- package/src/{vcs/vcm/util/style → style}/vectorStyleItem.js +230 -156
- package/src/{vcs/vcm/util/style → style}/writeStyle.js +7 -12
- package/src/{vcs/vcm/util → util}/clipping/clippingObject.js +84 -52
- package/src/{vcs/vcm/util → util}/clipping/clippingObjectManager.js +56 -23
- package/src/{vcs/vcm/util → util}/clipping/clippingPlaneHelper.js +149 -88
- package/src/{vcs/vcm/util → util}/collection.js +28 -10
- package/src/util/editor/createFeatureSession.js +195 -0
- package/src/util/editor/editFeaturesSession.js +325 -0
- package/src/util/editor/editGeometrySession.js +452 -0
- package/src/util/editor/editorHelpers.js +300 -0
- package/src/util/editor/editorSessionHelpers.js +132 -0
- package/src/util/editor/editorSymbols.js +21 -0
- package/src/util/editor/interactions/createBBoxInteraction.js +154 -0
- package/src/util/editor/interactions/createCircleInteraction.js +119 -0
- package/src/util/editor/interactions/createLineStringInteraction.js +119 -0
- package/src/util/editor/interactions/createPointInteraction.js +73 -0
- package/src/util/editor/interactions/createPolygonInteraction.js +136 -0
- package/src/util/editor/interactions/editFeaturesMouseOverInteraction.js +88 -0
- package/src/util/editor/interactions/editGeometryMouseOverInteraction.js +119 -0
- package/src/util/editor/interactions/ensureHandlerSelectionInteraction.js +50 -0
- package/src/util/editor/interactions/insertVertexInteraction.js +103 -0
- package/src/util/editor/interactions/mapInteractionController.js +119 -0
- package/src/util/editor/interactions/removeVertexInteraction.js +42 -0
- package/src/util/editor/interactions/selectFeatureMouseOverInteraction.js +152 -0
- package/src/util/editor/interactions/selectMultiFeatureInteraction.js +165 -0
- package/src/util/editor/interactions/selectSingleFeatureInteraction.js +120 -0
- package/src/util/editor/interactions/translateVertexInteraction.js +60 -0
- package/src/util/editor/selectFeaturesSession.js +303 -0
- package/src/util/editor/transformation/create2DHandlers.js +339 -0
- package/src/util/editor/transformation/create3DHandlers.js +678 -0
- package/src/util/editor/transformation/extrudeInteraction.js +106 -0
- package/src/util/editor/transformation/rotateInteraction.js +201 -0
- package/src/util/editor/transformation/scaleInteraction.js +201 -0
- package/src/util/editor/transformation/transformationHandler.js +178 -0
- package/src/util/editor/transformation/transformationTypes.js +88 -0
- package/src/util/editor/transformation/translateInteraction.js +263 -0
- package/src/util/editor/validateGeoemetry.js +24 -0
- package/src/{vcs/vcm/util → util}/exclusiveManager.js +6 -3
- package/src/{vcs/vcm/util → util}/extent.js +26 -20
- package/src/util/featureconverter/arcToCesium.js +121 -0
- package/src/{vcs/vcm/util → util}/featureconverter/circleToCesium.js +70 -37
- package/src/{vcs/vcm/util → util}/featureconverter/convert.js +94 -16
- package/src/util/featureconverter/extent3D.js +284 -0
- package/src/{vcs/vcm/util → util}/featureconverter/featureconverterHelper.js +253 -94
- package/src/util/featureconverter/lineStringToCesium.js +343 -0
- package/src/util/featureconverter/pointHelpers.js +413 -0
- package/src/{vcs/vcm/util → util}/featureconverter/pointToCesium.js +157 -107
- package/src/{vcs/vcm/util → util}/featureconverter/polygonToCesium.js +57 -24
- package/src/util/fetch.js +34 -0
- package/src/{vcs/vcm/util → util}/geometryHelpers.js +25 -17
- package/src/{vcs/vcm/util → util}/indexedCollection.js +27 -8
- package/src/{vcs/vcm/util → util}/isMobile.js +8 -2
- package/src/{vcs/vcm/util → util}/layerCollection.js +109 -19
- package/src/util/locale.js +12 -0
- package/src/{vcs/vcm/util → util}/mapCollection.js +170 -63
- package/src/util/math.js +193 -0
- package/src/util/overrideCollection.js +261 -0
- package/src/{vcs/vcm/util → util}/projection.js +23 -31
- package/src/{vcs/vcm/util → util}/urlHelpers.js +5 -3
- package/src/{vcs/vcm/util → util}/viewpoint.js +83 -57
- package/src/vcsApp.js +657 -0
- package/src/{vcs/vcm/event/vcsEvent.js → vcsEvent.js} +2 -3
- package/src/vcsModule.js +130 -0
- package/src/vcsModuleHelpers.js +136 -0
- package/src/{vcs/vcm/object.js → vcsObject.js} +3 -10
- package/tests/data/dynamicPointCzml.json +53 -0
- package/tests/data/oblique/imageData/imagev34.json +136 -0
- package/tests/data/oblique/imageData/imagev35.json +307 -0
- package/tests/data/oblique/imageData/imagev35PerImageSize.json +333 -0
- package/tests/data/oblique/tiledImageData/12/2199/1342.json +11056 -0
- package/tests/data/oblique/tiledImageData/12/2199/1343.json +11236 -0
- package/tests/data/oblique/tiledImageData/12/2199/1344.json +11077 -0
- package/tests/data/oblique/tiledImageData/12/2200/1342.json +11036 -0
- package/tests/data/oblique/tiledImageData/12/2200/1343.json +11277 -0
- package/tests/data/oblique/tiledImageData/12/2200/1344.json +11131 -0
- package/tests/data/oblique/tiledImageData/12/2201/1342.json +10870 -0
- package/tests/data/oblique/tiledImageData/12/2201/1343.json +11492 -0
- package/tests/data/oblique/tiledImageData/12/2201/1344.json +10909 -0
- package/tests/data/oblique/tiledImageData/image.json +70 -0
- package/tests/data/terrain/13/8800/6485.terrain +0 -0
- package/tests/data/terrain/13/8800/6486.terrain +0 -0
- package/tests/data/terrain/13/8801/6485.terrain +0 -0
- package/tests/data/terrain/13/8801/6486.terrain +0 -0
- package/tests/data/terrain/layer.json +127 -0
- package/tests/data/testGeoJSON.json +149 -0
- package/tests/data/tile.pbf +0 -0
- package/tests/unit/helpers/cesiumHelpers.js +326 -0
- package/tests/unit/helpers/getFileNameFromUrl.js +12 -0
- package/tests/unit/helpers/helpers.js +32 -0
- package/tests/unit/helpers/imageHelpers.js +24 -0
- package/tests/unit/helpers/importJSON.js +15 -0
- package/tests/unit/helpers/obliqueData.js +102 -0
- package/tests/unit/helpers/obliqueHelpers.js +115 -0
- package/tests/unit/helpers/openlayersHelpers.js +25 -0
- package/tests/unit/helpers/terrain/terrainData.js +47 -0
- package/src/vcs/vcm/classRegistry.js +0 -106
- package/src/vcs/vcm/globalCollections.js +0 -11
- package/src/vcs/vcm/interaction/featureProviderInteraction.js +0 -54
- package/src/vcs/vcm/layer/buildings.js +0 -17
- package/src/vcs/vcm/layer/cesium/openStreetMapCesium.js +0 -29
- package/src/vcs/vcm/layer/cesium/pointCloudCesium.js +0 -58
- package/src/vcs/vcm/layer/cesium/vectorContext.js +0 -167
- package/src/vcs/vcm/layer/openlayers/layerOpenlayers.js +0 -79
- package/src/vcs/vcm/layer/openlayers/openStreetMapOpenlayers.js +0 -27
- package/src/vcs/vcm/layer/openlayers/rasterLayerOpenlayers.js +0 -121
- package/src/vcs/vcm/layer/terrainHelpers.js +0 -119
- package/src/vcs/vcm/layer/tileProvider/staticGeojsonTileProvider.js +0 -67
- package/src/vcs/vcm/layer/tileProvider/tileProviderFactory.js +0 -28
- package/src/vcs/vcm/layer/vectorHelpers.js +0 -206
- package/src/vcs/vcm/util/dateTime.js +0 -60
- package/src/vcs/vcm/util/featureProvider/featureProviderHelpers.js +0 -51
- package/src/vcs/vcm/util/featureconverter/extent3d.js +0 -154
- package/src/vcs/vcm/util/featureconverter/lineStringToCesium.js +0 -171
- package/src/vcs/vcm/util/locale.js +0 -53
- package/src/vcs/vcm/util/math.js +0 -71
- package/src/vcs/vcm/util/splitScreen.js +0 -233
- package/src/vcs/vcm/util/style/styleFactory.js +0 -48
- package/src/vcs/vcm/util/style/styleItem.js +0 -243
- /package/src/{vcs/vcm/util/featureProvider → featureProvider}/featureProviderSymbols.js +0 -0
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Color,
|
|
3
|
+
Cesium3DTileFeature,
|
|
4
|
+
Cesium3DTilePointFeature,
|
|
5
|
+
Entity as CesiumEntity,
|
|
6
|
+
} from '@vcmap-cesium/engine';
|
|
2
7
|
import Feature from 'ol/Feature.js';
|
|
3
8
|
import Style from 'ol/style/Style.js';
|
|
4
9
|
|
|
5
|
-
import VectorStyleItem, { fromCesiumColor } from '../
|
|
6
|
-
import
|
|
7
|
-
import VcsEvent from '../event/vcsEvent.js';
|
|
10
|
+
import VectorStyleItem, { fromCesiumColor } from '../style/vectorStyleItem.js';
|
|
11
|
+
import VcsEvent from '../vcsEvent.js';
|
|
8
12
|
|
|
9
13
|
/**
|
|
10
14
|
* Set on an ol.Feature or Cesium.Cesium3DTileFeature to indicate its style before it was hidden or highlighted.
|
|
@@ -37,7 +41,7 @@ export const globalHidden = Symbol('globalHidden');
|
|
|
37
41
|
/**
|
|
38
42
|
* @typedef {Object} HighlightedObject
|
|
39
43
|
* @property {VectorStyleItem} style
|
|
40
|
-
* @property {Set<import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap/
|
|
44
|
+
* @property {Set<import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature>} features
|
|
41
45
|
*/
|
|
42
46
|
|
|
43
47
|
/**
|
|
@@ -48,42 +52,45 @@ export const globalHidden = Symbol('globalHidden');
|
|
|
48
52
|
*/
|
|
49
53
|
|
|
50
54
|
/**
|
|
51
|
-
* @param {import("@vcmap/
|
|
55
|
+
* @param {import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature} feature
|
|
52
56
|
* @returns {boolean}
|
|
53
57
|
*/
|
|
54
58
|
export function featureExists(feature) {
|
|
55
|
-
return
|
|
59
|
+
return (
|
|
60
|
+
feature &&
|
|
56
61
|
feature.content &&
|
|
57
62
|
!feature.content.isDestroyed() &&
|
|
58
|
-
!feature.content.batchTable.isDestroyed()
|
|
63
|
+
!feature.content.batchTable.isDestroyed()
|
|
64
|
+
);
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
/**
|
|
62
|
-
* @param {import("@vcmap/
|
|
68
|
+
* @param {import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Entity} feature
|
|
63
69
|
* @private
|
|
64
70
|
*/
|
|
65
71
|
export function hideFeature(feature) {
|
|
66
72
|
if (
|
|
67
|
-
(
|
|
68
|
-
|
|
69
|
-
featureExists(feature)
|
|
70
|
-
|
|
73
|
+
((feature instanceof Cesium3DTileFeature ||
|
|
74
|
+
feature instanceof Cesium3DTilePointFeature) &&
|
|
75
|
+
featureExists(feature)) ||
|
|
76
|
+
feature instanceof CesiumEntity
|
|
71
77
|
) {
|
|
72
78
|
feature.show = false;
|
|
73
79
|
} else if (feature instanceof Feature) {
|
|
74
|
-
feature.
|
|
80
|
+
feature.changed();
|
|
75
81
|
}
|
|
76
82
|
}
|
|
77
83
|
|
|
78
84
|
/**
|
|
79
85
|
* Caches the original style on the feature using the originalStyle symbol
|
|
80
|
-
* @param {import("@vcmap/
|
|
86
|
+
* @param {import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Entity} feature
|
|
81
87
|
* @private
|
|
82
88
|
*/
|
|
83
89
|
export function cacheOriginalStyle(feature) {
|
|
84
90
|
if (!Reflect.has(feature, originalStyle)) {
|
|
85
91
|
if (
|
|
86
|
-
(feature instanceof Cesium3DTileFeature ||
|
|
92
|
+
(feature instanceof Cesium3DTileFeature ||
|
|
93
|
+
feature instanceof Cesium3DTilePointFeature) &&
|
|
87
94
|
featureExists(feature)
|
|
88
95
|
) {
|
|
89
96
|
feature[originalStyle] = feature.color.clone();
|
|
@@ -94,45 +101,47 @@ export function cacheOriginalStyle(feature) {
|
|
|
94
101
|
}
|
|
95
102
|
|
|
96
103
|
/**
|
|
97
|
-
* @param {import("@vcmap/
|
|
104
|
+
* @param {import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Entity} feature
|
|
98
105
|
* @private
|
|
99
106
|
*/
|
|
100
107
|
export function resetOriginalStyle(feature) {
|
|
101
108
|
if (!(feature[globalHidden] || feature[hidden] || feature[highlighted])) {
|
|
102
109
|
const style = feature[originalStyle];
|
|
103
110
|
if (
|
|
104
|
-
(feature instanceof Cesium3DTileFeature ||
|
|
111
|
+
(feature instanceof Cesium3DTileFeature ||
|
|
112
|
+
feature instanceof Cesium3DTilePointFeature) &&
|
|
105
113
|
featureExists(feature)
|
|
106
114
|
) {
|
|
107
115
|
feature.color = style;
|
|
108
116
|
} else if (feature instanceof Feature) {
|
|
109
|
-
feature.
|
|
117
|
+
feature.changed();
|
|
110
118
|
}
|
|
111
119
|
delete feature[originalStyle];
|
|
112
120
|
}
|
|
113
121
|
}
|
|
114
122
|
|
|
115
123
|
/**
|
|
116
|
-
* @param {import("@vcmap/
|
|
124
|
+
* @param {import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Entity} feature
|
|
117
125
|
* @private
|
|
118
126
|
*/
|
|
119
127
|
export function highlightFeature(feature) {
|
|
120
128
|
if (!(feature[globalHidden] || feature[hidden])) {
|
|
121
129
|
const style = feature[highlighted];
|
|
122
130
|
if (
|
|
123
|
-
(feature instanceof Cesium3DTileFeature ||
|
|
131
|
+
(feature instanceof Cesium3DTileFeature ||
|
|
132
|
+
feature instanceof Cesium3DTilePointFeature) &&
|
|
124
133
|
featureExists(feature)
|
|
125
134
|
) {
|
|
126
135
|
feature.color = style.cesiumFillColor;
|
|
127
136
|
} else if (feature instanceof Feature) {
|
|
128
|
-
feature.
|
|
137
|
+
feature.changed();
|
|
129
138
|
}
|
|
130
139
|
}
|
|
131
140
|
}
|
|
132
141
|
|
|
133
142
|
/**
|
|
134
143
|
* Updates the cached original style
|
|
135
|
-
* @param {import("@vcmap/
|
|
144
|
+
* @param {import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature|import("ol").Feature<import("ol/geom/Geometry").default>} feature
|
|
136
145
|
* @private
|
|
137
146
|
*/
|
|
138
147
|
export function updateOriginalStyle(feature) {
|
|
@@ -146,7 +155,7 @@ export function updateOriginalStyle(feature) {
|
|
|
146
155
|
}
|
|
147
156
|
|
|
148
157
|
/**
|
|
149
|
-
* @param {import("@vcmap/
|
|
158
|
+
* @param {import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature|import("ol").Feature<import("ol/geom/Geometry").default>} feature
|
|
150
159
|
*/
|
|
151
160
|
function unhighlightFeature(feature) {
|
|
152
161
|
delete feature[highlighted];
|
|
@@ -154,7 +163,7 @@ function unhighlightFeature(feature) {
|
|
|
154
163
|
}
|
|
155
164
|
|
|
156
165
|
/**
|
|
157
|
-
* @param {import("@vcmap/
|
|
166
|
+
* @param {import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Entity} feature
|
|
158
167
|
* @param {symbol} symbol
|
|
159
168
|
* @private
|
|
160
169
|
*/
|
|
@@ -163,10 +172,10 @@ export function showFeature(feature, symbol) {
|
|
|
163
172
|
|
|
164
173
|
if (!(feature[hidden] || feature[globalHidden])) {
|
|
165
174
|
if (
|
|
166
|
-
(
|
|
167
|
-
|
|
168
|
-
featureExists(feature)
|
|
169
|
-
|
|
175
|
+
((feature instanceof Cesium3DTileFeature ||
|
|
176
|
+
feature instanceof Cesium3DTilePointFeature) &&
|
|
177
|
+
featureExists(feature)) ||
|
|
178
|
+
feature instanceof CesiumEntity
|
|
170
179
|
) {
|
|
171
180
|
feature.show = true;
|
|
172
181
|
}
|
|
@@ -181,7 +190,6 @@ export function showFeature(feature, symbol) {
|
|
|
181
190
|
/**
|
|
182
191
|
* Enumeration of feature visibility actions.
|
|
183
192
|
* @enum {number}
|
|
184
|
-
* @export
|
|
185
193
|
* @api
|
|
186
194
|
* @property {number} HIGHLIGHT
|
|
187
195
|
* @property {number} UNHIGHLIGHT
|
|
@@ -232,11 +240,14 @@ export function synchronizeFeatureVisibility(source, destination) {
|
|
|
232
240
|
}
|
|
233
241
|
|
|
234
242
|
/**
|
|
243
|
+
* FeatureVisibility handles the visibility and highlighting of features of a specific {@link FeatureLayer} or {@link DataSourceLayer}
|
|
244
|
+
* and its {@link FeatureLayerImplementation} resp. {@link DataSourceCesiumImpl}.
|
|
245
|
+
* The visibility is being synchronized with the {@link GlobalHider}.
|
|
235
246
|
* @class
|
|
236
247
|
*/
|
|
237
248
|
class FeatureVisibility {
|
|
238
249
|
constructor() {
|
|
239
|
-
/** @type {Object<string, Set<(import("@vcmap/
|
|
250
|
+
/** @type {Object<string, Set<(import("@vcmap-cesium/engine").Cesium3DTileFeature|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Entity)>>} */
|
|
240
251
|
this.hiddenObjects = {};
|
|
241
252
|
/** @type {Object<string, HighlightedObject>} */
|
|
242
253
|
this.highlightedObjects = {};
|
|
@@ -251,51 +262,58 @@ class FeatureVisibility {
|
|
|
251
262
|
}
|
|
252
263
|
|
|
253
264
|
/**
|
|
254
|
-
* highlights a number of features by ID (import("@vcmap/
|
|
255
|
-
* @param {Object<string, (VectorStyleItem|import("@vcmap/
|
|
265
|
+
* highlights a number of features by ID (import("@vcmap-cesium/engine").Cesium3DTileFeature|ol/Feature) with the given color.
|
|
266
|
+
* @param {Object<string, (VectorStyleItem|import("@vcmap-cesium/engine").Color|import("ol/style/Style").default)>} toHighlight
|
|
256
267
|
* @api stable
|
|
257
268
|
*/
|
|
258
269
|
highlight(toHighlight) {
|
|
259
270
|
const updatedIds = [];
|
|
260
|
-
Object.entries(toHighlight)
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
usedStyle = /** @type {VectorStyleItem} */ (usedStyle);
|
|
274
|
-
|
|
275
|
-
if (!this.highlightedObjects[id]) {
|
|
276
|
-
this.highlightedObjects[id] = {
|
|
277
|
-
style: usedStyle,
|
|
278
|
-
features: new Set(),
|
|
279
|
-
};
|
|
280
|
-
updatedIds.push(id);
|
|
281
|
-
// @ts-ignore
|
|
282
|
-
} else if (this.highlightedObjects[id].style !== usedStyle) {
|
|
283
|
-
this.highlightedObjects[id].style = usedStyle;
|
|
284
|
-
this.highlightedObjects[id].features.forEach((s, feature) => {
|
|
285
|
-
feature[highlighted] = usedStyle;
|
|
286
|
-
highlightFeature(feature);
|
|
287
|
-
});
|
|
271
|
+
Object.entries(toHighlight).forEach(([id, style]) => {
|
|
272
|
+
let usedStyle = style;
|
|
273
|
+
if (style instanceof Color) {
|
|
274
|
+
usedStyle = fromCesiumColor(style);
|
|
275
|
+
} else if (style instanceof Style) {
|
|
276
|
+
usedStyle = new VectorStyleItem({});
|
|
277
|
+
if (
|
|
278
|
+
style.getText() &&
|
|
279
|
+
style.getText().getText() &&
|
|
280
|
+
!Array.isArray(style.getText().getText())
|
|
281
|
+
) {
|
|
282
|
+
// getText can return a rich Text Array<string> We do not support this at the moment.
|
|
283
|
+
usedStyle.label = String(style.getText().getText());
|
|
288
284
|
}
|
|
289
|
-
|
|
285
|
+
usedStyle.style = style;
|
|
286
|
+
}
|
|
287
|
+
// eslint-disable-next-line no-self-assign
|
|
288
|
+
usedStyle = /** @type {VectorStyleItem} */ (usedStyle);
|
|
289
|
+
|
|
290
|
+
if (!this.highlightedObjects[id]) {
|
|
291
|
+
this.highlightedObjects[id] = {
|
|
292
|
+
style: usedStyle,
|
|
293
|
+
features: new Set(),
|
|
294
|
+
};
|
|
295
|
+
updatedIds.push(id);
|
|
296
|
+
// @ts-ignore
|
|
297
|
+
} else if (this.highlightedObjects[id].style !== usedStyle) {
|
|
298
|
+
this.highlightedObjects[id].style = usedStyle;
|
|
299
|
+
this.highlightedObjects[id].features.forEach((s, feature) => {
|
|
300
|
+
feature[highlighted] = usedStyle;
|
|
301
|
+
highlightFeature(feature);
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
});
|
|
290
305
|
|
|
291
306
|
if (updatedIds.length > 0) {
|
|
292
307
|
this.lastUpdated = Date.now();
|
|
293
|
-
this.changed.raiseEvent({
|
|
308
|
+
this.changed.raiseEvent({
|
|
309
|
+
action: FeatureVisibilityAction.HIGHLIGHT,
|
|
310
|
+
ids: updatedIds,
|
|
311
|
+
});
|
|
294
312
|
}
|
|
295
313
|
}
|
|
296
314
|
|
|
297
315
|
/**
|
|
298
|
-
* unhighlights a number of features given by the ID (import("@vcmap/
|
|
316
|
+
* unhighlights a number of features given by the ID (import("@vcmap-cesium/engine").Cesium3DTileFeature|import("ol").Feature<import("ol/geom/Geometry").default>)
|
|
299
317
|
* @param {Array<string>} toUnHighlight Array with IDS to unhighlight
|
|
300
318
|
* @api stable
|
|
301
319
|
*/
|
|
@@ -303,17 +321,19 @@ class FeatureVisibility {
|
|
|
303
321
|
const updatedIds = [];
|
|
304
322
|
toUnHighlight.forEach((id) => {
|
|
305
323
|
if (this.highlightedObjects[id]) {
|
|
306
|
-
this.highlightedObjects[id].features
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
});
|
|
324
|
+
this.highlightedObjects[id].features.forEach((f) => {
|
|
325
|
+
unhighlightFeature(f);
|
|
326
|
+
});
|
|
310
327
|
delete this.highlightedObjects[id];
|
|
311
328
|
updatedIds.push(id);
|
|
312
329
|
}
|
|
313
330
|
});
|
|
314
331
|
|
|
315
332
|
if (updatedIds.length > 0) {
|
|
316
|
-
this.changed.raiseEvent({
|
|
333
|
+
this.changed.raiseEvent({
|
|
334
|
+
action: FeatureVisibilityAction.UNHIGHLIGHT,
|
|
335
|
+
ids: updatedIds,
|
|
336
|
+
});
|
|
317
337
|
}
|
|
318
338
|
}
|
|
319
339
|
|
|
@@ -327,16 +347,19 @@ class FeatureVisibility {
|
|
|
327
347
|
|
|
328
348
|
/**
|
|
329
349
|
* @param {string|number} id
|
|
330
|
-
* @param {import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap/
|
|
350
|
+
* @param {import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Cesium3DTileFeature} feature
|
|
331
351
|
* @returns {boolean}
|
|
332
352
|
*/
|
|
333
353
|
hasHighlightFeature(id, feature) {
|
|
334
|
-
return
|
|
354
|
+
return (
|
|
355
|
+
this.highlightedObjects[id] &&
|
|
356
|
+
this.highlightedObjects[id].features.has(feature)
|
|
357
|
+
);
|
|
335
358
|
}
|
|
336
359
|
|
|
337
360
|
/**
|
|
338
361
|
* @param {string|number} id
|
|
339
|
-
* @param {import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap/
|
|
362
|
+
* @param {import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Cesium3DTileFeature} feature
|
|
340
363
|
*/
|
|
341
364
|
addHighlightFeature(id, feature) {
|
|
342
365
|
if (this.highlightedObjects[id]) {
|
|
@@ -363,7 +386,10 @@ class FeatureVisibility {
|
|
|
363
386
|
|
|
364
387
|
if (updatedIds.length > 0) {
|
|
365
388
|
this.lastUpdated = Date.now();
|
|
366
|
-
this.changed.raiseEvent({
|
|
389
|
+
this.changed.raiseEvent({
|
|
390
|
+
action: FeatureVisibilityAction.HIDE,
|
|
391
|
+
ids: updatedIds,
|
|
392
|
+
});
|
|
367
393
|
}
|
|
368
394
|
}
|
|
369
395
|
|
|
@@ -376,17 +402,19 @@ class FeatureVisibility {
|
|
|
376
402
|
const updatedIds = [];
|
|
377
403
|
unHide.forEach((id) => {
|
|
378
404
|
if (this.hiddenObjects[id]) {
|
|
379
|
-
this.hiddenObjects[id]
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
});
|
|
405
|
+
this.hiddenObjects[id].forEach((f) => {
|
|
406
|
+
showFeature(f, hidden);
|
|
407
|
+
});
|
|
383
408
|
delete this.hiddenObjects[id];
|
|
384
409
|
updatedIds.push(id);
|
|
385
410
|
}
|
|
386
411
|
});
|
|
387
412
|
|
|
388
413
|
if (updatedIds.length > 0) {
|
|
389
|
-
this.changed.raiseEvent({
|
|
414
|
+
this.changed.raiseEvent({
|
|
415
|
+
action: FeatureVisibilityAction.SHOW,
|
|
416
|
+
ids: updatedIds,
|
|
417
|
+
});
|
|
390
418
|
}
|
|
391
419
|
}
|
|
392
420
|
|
|
@@ -400,7 +428,7 @@ class FeatureVisibility {
|
|
|
400
428
|
|
|
401
429
|
/**
|
|
402
430
|
* @param {string|number} id
|
|
403
|
-
* @param {import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap/
|
|
431
|
+
* @param {import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Entity} feature
|
|
404
432
|
* @returns {boolean}
|
|
405
433
|
*/
|
|
406
434
|
hasHiddenFeature(id, feature) {
|
|
@@ -409,7 +437,7 @@ class FeatureVisibility {
|
|
|
409
437
|
|
|
410
438
|
/**
|
|
411
439
|
* @param {string|number} id
|
|
412
|
-
* @param {import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap/
|
|
440
|
+
* @param {import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Entity} feature
|
|
413
441
|
*/
|
|
414
442
|
addHiddenFeature(id, feature) {
|
|
415
443
|
if (this.hiddenObjects[id]) {
|
|
@@ -424,9 +452,13 @@ class FeatureVisibility {
|
|
|
424
452
|
* Clears all caches and removes cesium events.
|
|
425
453
|
*/
|
|
426
454
|
destroy() {
|
|
427
|
-
Object.values(this.hiddenObjects).forEach((s) => {
|
|
455
|
+
Object.values(this.hiddenObjects).forEach((s) => {
|
|
456
|
+
s.clear();
|
|
457
|
+
});
|
|
428
458
|
this.hiddenObjects = {};
|
|
429
|
-
Object.values(this.highlightedObjects).forEach(({ features }) => {
|
|
459
|
+
Object.values(this.highlightedObjects).forEach(({ features }) => {
|
|
460
|
+
features.clear();
|
|
461
|
+
});
|
|
430
462
|
this.highlightedObjects = {};
|
|
431
463
|
this.changed.destroy();
|
|
432
464
|
}
|