@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,16 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
Rectangle,
|
|
3
|
+
WebMapTileServiceImageryProvider,
|
|
4
|
+
ImageryLayer as CesiumImageryLayer,
|
|
5
|
+
} from '@vcmap-cesium/engine';
|
|
6
|
+
import RasterLayerCesiumImpl from './rasterLayerCesiumImpl.js';
|
|
3
7
|
import { wgs84Projection } from '../../util/projection.js';
|
|
4
8
|
import { getTilingScheme } from '../rasterLayer.js';
|
|
5
9
|
|
|
6
10
|
/**
|
|
7
|
-
* represents a specific
|
|
11
|
+
* represents a specific WmtsLayer Implementation for {@link CesiumMap}.
|
|
8
12
|
* @class
|
|
9
|
-
* @
|
|
10
|
-
* @extends {RasterLayerCesium}
|
|
13
|
+
* @extends {RasterLayerCesiumImpl}
|
|
11
14
|
*/
|
|
12
|
-
class
|
|
13
|
-
static get className() {
|
|
15
|
+
class WmtsCesiumImpl extends RasterLayerCesiumImpl {
|
|
16
|
+
static get className() {
|
|
17
|
+
return 'WmtsCesiumImpl';
|
|
18
|
+
}
|
|
14
19
|
|
|
15
20
|
/**
|
|
16
21
|
* @param {import("@vcmap/core").CesiumMap} map
|
|
@@ -60,13 +65,15 @@ class WMTSCesium extends RasterLayerCesium {
|
|
|
60
65
|
this.matrixIds = options.matrixIds;
|
|
61
66
|
}
|
|
62
67
|
|
|
63
|
-
|
|
64
68
|
/**
|
|
65
|
-
* @returns {import("@vcmap/
|
|
69
|
+
* @returns {import("@vcmap-cesium/engine").ImageryLayer}
|
|
66
70
|
*/
|
|
67
71
|
getCesiumLayer() {
|
|
68
72
|
// This is a bug in Cesium, they cant cope with {Layer} placeholder..
|
|
69
|
-
const url =
|
|
73
|
+
const url =
|
|
74
|
+
this.url.indexOf('{Layer}') !== -1
|
|
75
|
+
? this.url.replace('{Layer}', this.layer)
|
|
76
|
+
: this.url;
|
|
70
77
|
const extent = this.extent.getCoordinatesInProjection(wgs84Projection);
|
|
71
78
|
const options = {
|
|
72
79
|
url,
|
|
@@ -75,12 +82,16 @@ class WMTSCesium extends RasterLayerCesium {
|
|
|
75
82
|
format: this.format,
|
|
76
83
|
tileMatrixSetID: this.tileMatrixSetID,
|
|
77
84
|
maximumLevel: this.maxLevel,
|
|
78
|
-
rectangle: Rectangle.fromDegrees(
|
|
85
|
+
rectangle: Rectangle.fromDegrees(
|
|
86
|
+
extent[0],
|
|
87
|
+
extent[1],
|
|
88
|
+
extent[2],
|
|
89
|
+
extent[3],
|
|
90
|
+
),
|
|
79
91
|
tileWidth: this.tileSize[0],
|
|
80
92
|
tileHeight: this.tileSize[1],
|
|
81
93
|
};
|
|
82
94
|
|
|
83
|
-
|
|
84
95
|
options.tilingScheme = getTilingScheme({
|
|
85
96
|
tilingSchema: this.tilingSchema,
|
|
86
97
|
numberOfLevelZeroTilesX: this.numberOfLevelZeroTilesX,
|
|
@@ -98,4 +109,4 @@ class WMTSCesium extends RasterLayerCesium {
|
|
|
98
109
|
}
|
|
99
110
|
}
|
|
100
111
|
|
|
101
|
-
export default
|
|
112
|
+
export default WmtsCesiumImpl;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @param {import("@vcmap/
|
|
2
|
+
* @param {import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature} feature
|
|
3
3
|
* @returns {Object}
|
|
4
4
|
*/
|
|
5
5
|
export default function getJSONObjectFromObject(feature) {
|
|
6
|
-
const properties = feature.
|
|
6
|
+
const properties = feature.getPropertyIds();
|
|
7
7
|
const JSONObject = {};
|
|
8
8
|
for (let i = 0; i < properties.length; i++) {
|
|
9
9
|
JSONObject[properties[i]] = feature.getProperty(properties[i]);
|
|
@@ -17,6 +17,9 @@ export default function getJSONObjectFromObject(feature) {
|
|
|
17
17
|
JSONObject.gmlId = JSONObject.id;
|
|
18
18
|
}
|
|
19
19
|
// @ts-ignore
|
|
20
|
-
JSONObject.clickedPosition = feature.clickedPosition
|
|
20
|
+
JSONObject.clickedPosition = feature.clickedPosition
|
|
21
|
+
? // @ts-ignore
|
|
22
|
+
feature.clickedPosition
|
|
23
|
+
: {};
|
|
21
24
|
return JSONObject;
|
|
22
25
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Matrix4 } from '@vcmap-cesium/engine';
|
|
2
2
|
|
|
3
3
|
import { checkMaybe } from '@vcsuite/check';
|
|
4
4
|
import { parseInteger } from '@vcsuite/parsers';
|
|
5
5
|
import getJSONObjectFromObject from './cesium/x3dmHelper.js';
|
|
6
|
-
import VectorStyleItem from '../
|
|
6
|
+
import VectorStyleItem from '../style/vectorStyleItem.js';
|
|
7
7
|
import FeatureLayer from './featureLayer.js';
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
import CesiumTilesetCesiumImpl, {
|
|
9
|
+
getExtentFromTileset,
|
|
10
|
+
} from './cesium/cesiumTilesetCesiumImpl.js';
|
|
11
|
+
import CesiumMap from '../map/cesiumMap.js';
|
|
11
12
|
import Extent from '../util/extent.js';
|
|
12
13
|
import { mercatorProjection } from '../util/projection.js';
|
|
13
14
|
import { isMobile } from '../util/isMobile.js';
|
|
14
|
-
import {
|
|
15
|
-
import { VcsClassRegistry } from '../classRegistry.js';
|
|
15
|
+
import { layerClassRegistry } from '../classRegistry.js';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @typedef {LayerOptions} CesiumTilesetOptions
|
|
@@ -22,7 +22,6 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
22
22
|
* @property {Object|undefined} tilesetOptions
|
|
23
23
|
* @property {import("@vcmap/core").VectorStyleItem|VectorStyleItemOptions|undefined} highlightStyle
|
|
24
24
|
* @property {import("@vcmap/core").FeatureVisibility|undefined} featureVisibility
|
|
25
|
-
* @property {string|undefined} splitDirection - either 'left' or 'right', if omitted none is applied
|
|
26
25
|
* @property {import("ol/coordinate").Coordinate|undefined} offset - an offset of x, y, z. x and y in degrees longitude/latitude respectively
|
|
27
26
|
* @api
|
|
28
27
|
*/
|
|
@@ -37,9 +36,8 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
37
36
|
/**
|
|
38
37
|
* @typedef {FeatureLayerImplementationOptions} CesiumTilesetImplementationOptions
|
|
39
38
|
* @property {Object|undefined} tilesetOptions
|
|
40
|
-
* @property {import("@vcmap/cesium").ImagerySplitDirection} splitDirection
|
|
41
39
|
* @property {Array<CesiumTilesetTilesetProperties>|undefined} tilesetProperties
|
|
42
|
-
* @property {import("@vcmap/
|
|
40
|
+
* @property {import("@vcmap-cesium/engine").Matrix4|undefined} modelMatrix
|
|
43
41
|
* @property {import("ol/coordinate").Coordinate|undefined} offset
|
|
44
42
|
* @api
|
|
45
43
|
*/
|
|
@@ -48,13 +46,13 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
48
46
|
* represents a specific Building layer for cesium.
|
|
49
47
|
* @class
|
|
50
48
|
* @extends {FeatureLayer}
|
|
51
|
-
* @implements {SplitLayer}
|
|
52
49
|
* @api stable
|
|
53
|
-
* @export
|
|
54
50
|
*/
|
|
55
|
-
class
|
|
51
|
+
class CesiumTilesetLayer extends FeatureLayer {
|
|
56
52
|
/** @type {string} */
|
|
57
|
-
static get className() {
|
|
53
|
+
static get className() {
|
|
54
|
+
return 'CesiumTilesetLayer';
|
|
55
|
+
}
|
|
58
56
|
|
|
59
57
|
/**
|
|
60
58
|
* @returns {CesiumTilesetOptions}
|
|
@@ -67,7 +65,6 @@ class CesiumTileset extends FeatureLayer {
|
|
|
67
65
|
screenSpaceErrorMobile: 32,
|
|
68
66
|
maximumMemoryUsage: 16,
|
|
69
67
|
tilesetOptions: {},
|
|
70
|
-
splitDirection: undefined,
|
|
71
68
|
offset: undefined,
|
|
72
69
|
};
|
|
73
70
|
}
|
|
@@ -77,10 +74,8 @@ class CesiumTileset extends FeatureLayer {
|
|
|
77
74
|
*/
|
|
78
75
|
constructor(options) {
|
|
79
76
|
super(options);
|
|
80
|
-
this._supportedMaps = [
|
|
81
|
-
|
|
82
|
-
];
|
|
83
|
-
const defaultOptions = CesiumTileset.getDefaultOptions();
|
|
77
|
+
this._supportedMaps = [CesiumMap.className];
|
|
78
|
+
const defaultOptions = CesiumTilesetLayer.getDefaultOptions();
|
|
84
79
|
if (this.url && !/\.json$/.test(this.url)) {
|
|
85
80
|
this.url = `${this.url.replace(/\/$/, '')}/tileset.json`;
|
|
86
81
|
}
|
|
@@ -88,47 +83,46 @@ class CesiumTileset extends FeatureLayer {
|
|
|
88
83
|
/** @type {VectorStyleItem} */
|
|
89
84
|
this.highlightStyle = null;
|
|
90
85
|
if (options.highlightStyle) {
|
|
91
|
-
this.highlightStyle =
|
|
92
|
-
options.highlightStyle
|
|
93
|
-
|
|
86
|
+
this.highlightStyle =
|
|
87
|
+
options.highlightStyle instanceof VectorStyleItem
|
|
88
|
+
? options.highlightStyle
|
|
89
|
+
: new VectorStyleItem(
|
|
90
|
+
/** @type {VectorStyleItemOptions} */ (options.highlightStyle),
|
|
91
|
+
);
|
|
94
92
|
}
|
|
95
93
|
/** @type {number} */
|
|
96
|
-
this.screenSpaceError = parseInteger(
|
|
94
|
+
this.screenSpaceError = parseInteger(
|
|
95
|
+
options.screenSpaceError,
|
|
96
|
+
defaultOptions.screenSpaceError,
|
|
97
|
+
);
|
|
97
98
|
|
|
98
99
|
/** @type {number} */
|
|
99
|
-
this.screenSpaceErrorMobile = parseInteger(
|
|
100
|
+
this.screenSpaceErrorMobile = parseInteger(
|
|
101
|
+
options.screenSpaceErrorMobile,
|
|
102
|
+
defaultOptions.screenSpaceErrorMobile,
|
|
103
|
+
);
|
|
100
104
|
|
|
101
105
|
/** @type {number} */
|
|
102
|
-
this.maximumMemoryUsage = parseInteger(
|
|
106
|
+
this.maximumMemoryUsage = parseInteger(
|
|
107
|
+
options.maximumMemoryUsage,
|
|
108
|
+
defaultOptions.maximumMemoryUsage,
|
|
109
|
+
);
|
|
103
110
|
|
|
104
|
-
const tilesetOptions =
|
|
111
|
+
const tilesetOptions =
|
|
112
|
+
options.tilesetOptions || defaultOptions.tilesetOptions;
|
|
105
113
|
|
|
106
114
|
/** @type {!Object} */
|
|
107
115
|
this.tilesetOptions = {
|
|
108
116
|
url: this.url,
|
|
109
|
-
maximumScreenSpaceError: isMobile()
|
|
117
|
+
maximumScreenSpaceError: isMobile()
|
|
118
|
+
? this.screenSpaceErrorMobile
|
|
119
|
+
: this.screenSpaceError,
|
|
110
120
|
maximumMemoryUsage: this.maximumMemoryUsage,
|
|
111
121
|
...tilesetOptions,
|
|
112
122
|
};
|
|
113
123
|
|
|
114
|
-
/** @type {import("@vcmap/cesium").ImagerySplitDirection} */
|
|
115
|
-
this._splitDirection = ImagerySplitDirection.NONE;
|
|
116
|
-
|
|
117
|
-
if (options.splitDirection) {
|
|
118
|
-
this._splitDirection = options.splitDirection === 'left' ?
|
|
119
|
-
ImagerySplitDirection.LEFT :
|
|
120
|
-
ImagerySplitDirection.RIGHT;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* raised if the split direction changes, is passed the split direction as its only argument
|
|
125
|
-
* @type {VcsEvent<import("@vcmap/cesium").ImagerySplitDirection>}
|
|
126
|
-
* @api
|
|
127
|
-
*/
|
|
128
|
-
this.splitDirectionChanged = new VcsEvent();
|
|
129
|
-
|
|
130
124
|
/**
|
|
131
|
-
* @type {import("@vcmap/
|
|
125
|
+
* @type {import("@vcmap-cesium/engine").Matrix4|undefined}
|
|
132
126
|
* @private
|
|
133
127
|
*/
|
|
134
128
|
this._modelMatrix = undefined;
|
|
@@ -144,23 +138,24 @@ class CesiumTileset extends FeatureLayer {
|
|
|
144
138
|
* A model matrix to apply to each cesium3DTileset created from this layer.
|
|
145
139
|
* This will overwrite any modelMatrix calculated by the offset property.
|
|
146
140
|
* @api
|
|
147
|
-
* @returns {import("@vcmap/
|
|
141
|
+
* @returns {import("@vcmap-cesium/engine").Matrix4|undefined}
|
|
148
142
|
*/
|
|
149
143
|
get modelMatrix() {
|
|
150
144
|
return this._modelMatrix;
|
|
151
145
|
}
|
|
152
146
|
|
|
153
147
|
/**
|
|
154
|
-
* @param {import("@vcmap/
|
|
148
|
+
* @param {import("@vcmap-cesium/engine").Matrix4|undefined} modelMatrix
|
|
155
149
|
*/
|
|
156
150
|
set modelMatrix(modelMatrix) {
|
|
157
151
|
checkMaybe(modelMatrix, Matrix4);
|
|
158
152
|
|
|
159
153
|
this._modelMatrix = modelMatrix;
|
|
160
|
-
this.getImplementations()
|
|
161
|
-
|
|
154
|
+
this.getImplementations().forEach(
|
|
155
|
+
/** @param {CesiumTilesetCesiumImpl} impl */ (impl) => {
|
|
162
156
|
impl.updateModelMatrix(modelMatrix);
|
|
163
|
-
}
|
|
157
|
+
},
|
|
158
|
+
);
|
|
164
159
|
}
|
|
165
160
|
|
|
166
161
|
/**
|
|
@@ -181,29 +176,11 @@ class CesiumTileset extends FeatureLayer {
|
|
|
181
176
|
checkMaybe(offset, [Number]);
|
|
182
177
|
|
|
183
178
|
this._offset = offset;
|
|
184
|
-
this.getImplementations()
|
|
185
|
-
|
|
179
|
+
this.getImplementations().forEach(
|
|
180
|
+
/** @param {CesiumTilesetCesiumImpl} impl */ (impl) => {
|
|
186
181
|
impl.updateOffset(offset);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* @api
|
|
192
|
-
* @type {import("@vcmap/cesium").ImagerySplitDirection}
|
|
193
|
-
*/
|
|
194
|
-
get splitDirection() { return this._splitDirection; }
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* @param {import("@vcmap/cesium").ImagerySplitDirection} direction
|
|
198
|
-
*/
|
|
199
|
-
set splitDirection(direction) {
|
|
200
|
-
if (direction !== this._splitDirection) {
|
|
201
|
-
this.getImplementations().forEach((impl) => {
|
|
202
|
-
/** @type {CesiumTilesetCesium} */ (impl).updateSplitDirection(direction);
|
|
203
|
-
});
|
|
204
|
-
this._splitDirection = direction;
|
|
205
|
-
this.splitDirectionChanged.raiseEvent(this._splitDirection);
|
|
206
|
-
}
|
|
182
|
+
},
|
|
183
|
+
);
|
|
207
184
|
}
|
|
208
185
|
|
|
209
186
|
/**
|
|
@@ -214,7 +191,6 @@ class CesiumTileset extends FeatureLayer {
|
|
|
214
191
|
return {
|
|
215
192
|
...super.getImplementationOptions(),
|
|
216
193
|
tilesetOptions: this.tilesetOptions,
|
|
217
|
-
splitDirection: this.splitDirection,
|
|
218
194
|
modelMatrix: this.modelMatrix,
|
|
219
195
|
offset: this.offset,
|
|
220
196
|
};
|
|
@@ -223,18 +199,20 @@ class CesiumTileset extends FeatureLayer {
|
|
|
223
199
|
/**
|
|
224
200
|
* @inheritDoc
|
|
225
201
|
* @param {import("@vcmap/core").VcsMap} map
|
|
226
|
-
* @returns {Array<
|
|
202
|
+
* @returns {Array<CesiumTilesetCesiumImpl>}
|
|
227
203
|
*/
|
|
228
204
|
createImplementationsForMap(map) {
|
|
229
205
|
if (map instanceof CesiumMap) {
|
|
230
|
-
return [
|
|
206
|
+
return [
|
|
207
|
+
new CesiumTilesetCesiumImpl(map, this.getImplementationOptions()),
|
|
208
|
+
];
|
|
231
209
|
}
|
|
232
210
|
return [];
|
|
233
211
|
}
|
|
234
212
|
|
|
235
213
|
/**
|
|
236
214
|
* @inheritDoc
|
|
237
|
-
* @param {import("@vcmap/
|
|
215
|
+
* @param {import("@vcmap-cesium/engine").Cesium3DTileFeature|import("@vcmap-cesium/engine").Cesium3DTilePointFeature} object
|
|
238
216
|
* @returns {?Object}
|
|
239
217
|
*/
|
|
240
218
|
objectClickedHandler(object) {
|
|
@@ -261,12 +239,14 @@ class CesiumTileset extends FeatureLayer {
|
|
|
261
239
|
if (metaExtent) {
|
|
262
240
|
return metaExtent;
|
|
263
241
|
}
|
|
264
|
-
const impl = /** @type {
|
|
242
|
+
const impl = /** @type {CesiumTilesetCesiumImpl} */ (
|
|
243
|
+
this.getImplementations()[0]
|
|
244
|
+
);
|
|
265
245
|
if (impl) {
|
|
266
246
|
const threeDimExtent = getExtentFromTileset(impl.cesium3DTileset);
|
|
267
247
|
|
|
268
248
|
const actualExtent = new Extent({
|
|
269
|
-
|
|
249
|
+
projection: mercatorProjection.toJSON(),
|
|
270
250
|
coordinates: threeDimExtent,
|
|
271
251
|
});
|
|
272
252
|
|
|
@@ -278,32 +258,19 @@ class CesiumTileset extends FeatureLayer {
|
|
|
278
258
|
return null;
|
|
279
259
|
}
|
|
280
260
|
|
|
281
|
-
// TODO type params
|
|
282
|
-
getGenericFeatureFromClickedObject(object) {
|
|
283
|
-
const attributes = { ...this.genericFeatureProperties, ...object.attributes || object };
|
|
284
|
-
return {
|
|
285
|
-
layerName: this.name,
|
|
286
|
-
layerClass: this.className,
|
|
287
|
-
attributes,
|
|
288
|
-
longitude: object.clickedPosition.longitude,
|
|
289
|
-
latitude: object.clickedPosition.latitude,
|
|
290
|
-
height: object.clickedPosition.height + this.balloonHeightOffset,
|
|
291
|
-
relativeToGround: false,
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
|
|
295
261
|
/**
|
|
296
262
|
* set the maximum screenspace error of this layer
|
|
297
263
|
* @param {number} value
|
|
298
264
|
* @api stable
|
|
299
265
|
*/
|
|
300
266
|
setMaximumScreenSpaceError(value) {
|
|
301
|
-
this.getImplementations()
|
|
302
|
-
|
|
267
|
+
this.getImplementations().forEach(
|
|
268
|
+
/** @param {CesiumTilesetCesiumImpl} impl */ (impl) => {
|
|
303
269
|
if (impl.cesium3DTileset) {
|
|
304
270
|
impl.cesium3DTileset.maximumScreenSpaceError = value;
|
|
305
271
|
}
|
|
306
|
-
}
|
|
272
|
+
},
|
|
273
|
+
);
|
|
307
274
|
}
|
|
308
275
|
|
|
309
276
|
/**
|
|
@@ -312,11 +279,9 @@ class CesiumTileset extends FeatureLayer {
|
|
|
312
279
|
toJSON() {
|
|
313
280
|
/** @type {CesiumTilesetOptions} */
|
|
314
281
|
const config = super.toJSON();
|
|
315
|
-
const defaultOptions =
|
|
282
|
+
const defaultOptions = CesiumTilesetLayer.getDefaultOptions();
|
|
316
283
|
if (this.highlightStyle) {
|
|
317
|
-
config.highlightStyle = this.highlightStyle
|
|
318
|
-
this.highlightStyle.getReference() :
|
|
319
|
-
this.highlightStyle.getOptions();
|
|
284
|
+
config.highlightStyle = this.highlightStyle.toJSON();
|
|
320
285
|
}
|
|
321
286
|
|
|
322
287
|
if (this.screenSpaceError !== defaultOptions.screenSpaceError) {
|
|
@@ -336,7 +301,9 @@ class CesiumTileset extends FeatureLayer {
|
|
|
336
301
|
delete tilesetOptions.url;
|
|
337
302
|
}
|
|
338
303
|
|
|
339
|
-
const usedScreenSpaceError = isMobile()
|
|
304
|
+
const usedScreenSpaceError = isMobile()
|
|
305
|
+
? this.screenSpaceErrorMobile
|
|
306
|
+
: this.screenSpaceError;
|
|
340
307
|
if (tilesetOptions.maximumScreenSpaceError === usedScreenSpaceError) {
|
|
341
308
|
delete tilesetOptions.maximumScreenSpaceError;
|
|
342
309
|
}
|
|
@@ -349,12 +316,6 @@ class CesiumTileset extends FeatureLayer {
|
|
|
349
316
|
config.tilesetOptions = tilesetOptions;
|
|
350
317
|
}
|
|
351
318
|
|
|
352
|
-
if (this._splitDirection !== ImagerySplitDirection.NONE) {
|
|
353
|
-
config.splitDirection = this._splitDirection === ImagerySplitDirection.RIGHT ?
|
|
354
|
-
'right' :
|
|
355
|
-
'left';
|
|
356
|
-
}
|
|
357
|
-
|
|
358
319
|
if (Array.isArray(this.offset)) {
|
|
359
320
|
config.offset = this.offset.slice();
|
|
360
321
|
}
|
|
@@ -368,9 +329,11 @@ class CesiumTileset extends FeatureLayer {
|
|
|
368
329
|
*/
|
|
369
330
|
destroy() {
|
|
370
331
|
super.destroy();
|
|
371
|
-
this.splitDirectionChanged.destroy();
|
|
372
332
|
}
|
|
373
333
|
}
|
|
374
334
|
|
|
375
|
-
|
|
376
|
-
|
|
335
|
+
layerClassRegistry.registerClass(
|
|
336
|
+
CesiumTilesetLayer.className,
|
|
337
|
+
CesiumTilesetLayer,
|
|
338
|
+
);
|
|
339
|
+
export default CesiumTilesetLayer;
|
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import { CzmlDataSource } from '@vcmap/
|
|
1
|
+
import { CzmlDataSource } from '@vcmap-cesium/engine';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import DataSourceLayer from './dataSourceLayer.js';
|
|
4
4
|
import { vcsLayerName } from './layerSymbols.js';
|
|
5
|
-
import {
|
|
5
|
+
import { layerClassRegistry } from '../classRegistry.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* @typedef {
|
|
8
|
+
* @typedef {LayerOptions} CzmlOptions
|
|
9
9
|
* @property {string|undefined} sourceUri
|
|
10
10
|
* @api
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @class
|
|
15
|
-
* @
|
|
16
|
-
* @extends {DataSource}
|
|
15
|
+
* @extends {DataSourceLayer}
|
|
17
16
|
*/
|
|
18
|
-
class
|
|
19
|
-
static get className() {
|
|
17
|
+
class CzmlLayer extends DataSourceLayer {
|
|
18
|
+
static get className() {
|
|
19
|
+
return 'CzmlLayer';
|
|
20
|
+
}
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* @returns {CzmlOptions}
|
|
23
24
|
*/
|
|
24
25
|
static getDefaultOptions() {
|
|
25
26
|
return {
|
|
26
|
-
...
|
|
27
|
+
...DataSourceLayer.getDefaultOptions(),
|
|
27
28
|
sourceUri: undefined,
|
|
28
29
|
};
|
|
29
30
|
}
|
|
@@ -36,7 +37,7 @@ class Czml extends DataSource {
|
|
|
36
37
|
this.dataSource = new CzmlDataSource();
|
|
37
38
|
this.entities = this.dataSource.entities;
|
|
38
39
|
|
|
39
|
-
const defaultOptions =
|
|
40
|
+
const defaultOptions = CzmlLayer.getDefaultOptions();
|
|
40
41
|
/** @type {string|null} */
|
|
41
42
|
this.sourceUri = options.sourceUri || defaultOptions.sourceUri;
|
|
42
43
|
/** @type {Function} */
|
|
@@ -44,14 +45,14 @@ class Czml extends DataSource {
|
|
|
44
45
|
/** @type {Function} */
|
|
45
46
|
this._loadedReject = () => {};
|
|
46
47
|
/**
|
|
47
|
-
* A Promise resolving with the
|
|
48
|
+
* A Promise resolving with the DataSourceLayer on load
|
|
48
49
|
* @type {Promise<void>}
|
|
49
50
|
* @api stable
|
|
50
51
|
*/
|
|
51
|
-
this.loaded = new Promise((
|
|
52
|
+
this.loaded = new Promise((resolve, reject) => {
|
|
52
53
|
this._loadedResolve = resolve;
|
|
53
54
|
this._loadedReject = reject;
|
|
54
|
-
})
|
|
55
|
+
});
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
/**
|
|
@@ -77,11 +78,13 @@ class Czml extends DataSource {
|
|
|
77
78
|
* @private
|
|
78
79
|
*/
|
|
79
80
|
async _loadData() {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
await /** @type {import("@vcmap-cesium/engine").CzmlDataSource} */ (
|
|
82
|
+
this.dataSource
|
|
83
|
+
).load(
|
|
84
|
+
this.url,
|
|
85
|
+
this.sourceUri ? { sourceUri: this.sourceUri } : undefined,
|
|
86
|
+
);
|
|
87
|
+
|
|
85
88
|
this.entities.values.forEach((entity) => {
|
|
86
89
|
entity[vcsLayerName] = this.name;
|
|
87
90
|
});
|
|
@@ -137,5 +140,5 @@ class Czml extends DataSource {
|
|
|
137
140
|
}
|
|
138
141
|
}
|
|
139
142
|
|
|
140
|
-
|
|
141
|
-
export default
|
|
143
|
+
layerClassRegistry.registerClass(CzmlLayer.className, CzmlLayer);
|
|
144
|
+
export default CzmlLayer;
|