@vcmap/core 6.2.3 → 6.3.0-rc.1
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/dist/index.d.ts +3 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/src/category/category.d.ts +1 -1
- package/dist/src/category/category.js +3 -4
- package/dist/src/category/category.js.map +1 -1
- package/dist/src/featureProvider/abstractFeatureProvider.d.ts +1 -1
- package/dist/src/featureProvider/abstractFeatureProvider.js +3 -4
- package/dist/src/featureProvider/abstractFeatureProvider.js.map +1 -1
- package/dist/src/featureProvider/wmsFeatureProvider.d.ts +1 -1
- package/dist/src/featureProvider/wmsFeatureProvider.js +3 -4
- package/dist/src/featureProvider/wmsFeatureProvider.js.map +1 -1
- package/dist/src/interaction/coordinateAtPixel.js +4 -6
- package/dist/src/interaction/coordinateAtPixel.js.map +1 -1
- package/dist/src/interaction/ensurePositionInteraction.d.ts +14 -0
- package/dist/src/interaction/ensurePositionInteraction.js +42 -0
- package/dist/src/interaction/ensurePositionInteraction.js.map +1 -0
- package/dist/src/interaction/eventHandler.d.ts +3 -0
- package/dist/src/interaction/eventHandler.js +10 -1
- package/dist/src/interaction/eventHandler.js.map +1 -1
- package/dist/src/interaction/featureAtPixelInteraction.js +29 -17
- package/dist/src/interaction/featureAtPixelInteraction.js.map +1 -1
- package/dist/src/interaction/panoramaImageSelection.js +2 -2
- package/dist/src/interaction/panoramaImageSelection.js.map +1 -1
- package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.d.ts +3 -3
- package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/rasterLayerCesiumImpl.d.ts +3 -3
- package/dist/src/layer/cesium/rasterLayerCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/terrainCesiumImpl.d.ts +3 -3
- package/dist/src/layer/cesium/terrainCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/vectorContext.js +1 -1
- package/dist/src/layer/cesium/vectorContext.js.map +1 -1
- package/dist/src/layer/cesiumTilesetLayer.d.ts +1 -1
- package/dist/src/layer/cesiumTilesetLayer.js +7 -7
- package/dist/src/layer/cesiumTilesetLayer.js.map +1 -1
- package/dist/src/layer/cogLayer.d.ts +1 -1
- package/dist/src/layer/cogLayer.js +3 -4
- package/dist/src/layer/cogLayer.js.map +1 -1
- package/dist/src/layer/czmlLayer.d.ts +1 -1
- package/dist/src/layer/czmlLayer.js +4 -4
- package/dist/src/layer/czmlLayer.js.map +1 -1
- package/dist/src/layer/featureLayer.d.ts +1 -6
- package/dist/src/layer/featureLayer.js +3 -10
- package/dist/src/layer/featureLayer.js.map +1 -1
- package/dist/src/layer/featureStoreLayer.d.ts +3 -2
- package/dist/src/layer/featureStoreLayer.js +5 -5
- package/dist/src/layer/featureStoreLayer.js.map +1 -1
- package/dist/src/layer/flatGeobufLayer.d.ts +2 -0
- package/dist/src/layer/flatGeobufLayer.js +8 -0
- package/dist/src/layer/flatGeobufLayer.js.map +1 -1
- package/dist/src/layer/geojsonLayer.d.ts +1 -1
- package/dist/src/layer/geojsonLayer.js +5 -12
- package/dist/src/layer/geojsonLayer.js.map +1 -1
- package/dist/src/layer/layer.d.ts +21 -7
- package/dist/src/layer/layer.js +107 -33
- package/dist/src/layer/layer.js.map +1 -1
- package/dist/src/layer/openStreetMapLayer.d.ts +1 -1
- package/dist/src/layer/openStreetMapLayer.js +11 -6
- package/dist/src/layer/openStreetMapLayer.js.map +1 -1
- package/dist/src/layer/panorama/vectorPanoramaImpl.d.ts +38 -0
- package/dist/src/layer/panorama/vectorPanoramaImpl.js +164 -0
- package/dist/src/layer/panorama/vectorPanoramaImpl.js.map +1 -0
- package/dist/src/layer/panoramaDatasetLayer.d.ts +5 -3
- package/dist/src/layer/panoramaDatasetLayer.js +13 -7
- package/dist/src/layer/panoramaDatasetLayer.js.map +1 -1
- package/dist/src/layer/pointCloudLayer.d.ts +1 -5
- package/dist/src/layer/pointCloudLayer.js +3 -15
- package/dist/src/layer/pointCloudLayer.js.map +1 -1
- package/dist/src/layer/rasterLayer.d.ts +1 -1
- package/dist/src/layer/rasterLayer.js +4 -4
- package/dist/src/layer/rasterLayer.js.map +1 -1
- package/dist/src/layer/singleImageLayer.d.ts +1 -1
- package/dist/src/layer/singleImageLayer.js +3 -3
- package/dist/src/layer/singleImageLayer.js.map +1 -1
- package/dist/src/layer/terrainLayer.d.ts +1 -1
- package/dist/src/layer/terrainLayer.js +8 -6
- package/dist/src/layer/terrainLayer.js.map +1 -1
- package/dist/src/layer/tileProvider/flatGeobufTileProvider.d.ts +1 -1
- package/dist/src/layer/tileProvider/flatGeobufTileProvider.js +4 -3
- package/dist/src/layer/tileProvider/flatGeobufTileProvider.js.map +1 -1
- package/dist/src/layer/tileProvider/mvtTileProvider.d.ts +1 -1
- package/dist/src/layer/tileProvider/mvtTileProvider.js +3 -3
- package/dist/src/layer/tileProvider/mvtTileProvider.js.map +1 -1
- package/dist/src/layer/tileProvider/staticFeatureTileProvider.d.ts +1 -1
- package/dist/src/layer/tileProvider/staticFeatureTileProvider.js +3 -3
- package/dist/src/layer/tileProvider/staticFeatureTileProvider.js.map +1 -1
- package/dist/src/layer/tileProvider/staticGeojsonTileProvider.d.ts +1 -1
- package/dist/src/layer/tileProvider/staticGeojsonTileProvider.js +7 -4
- package/dist/src/layer/tileProvider/staticGeojsonTileProvider.js.map +1 -1
- package/dist/src/layer/tileProvider/tileProvider.d.ts +1 -1
- package/dist/src/layer/tileProvider/tileProvider.js +3 -4
- package/dist/src/layer/tileProvider/tileProvider.js.map +1 -1
- package/dist/src/layer/tileProvider/urlTemplateTileProvider.d.ts +1 -1
- package/dist/src/layer/tileProvider/urlTemplateTileProvider.js +3 -3
- package/dist/src/layer/tileProvider/urlTemplateTileProvider.js.map +1 -1
- package/dist/src/layer/tmsLayer.d.ts +1 -1
- package/dist/src/layer/tmsLayer.js +3 -10
- package/dist/src/layer/tmsLayer.js.map +1 -1
- package/dist/src/layer/vectorLayer.d.ts +11 -5
- package/dist/src/layer/vectorLayer.js +19 -8
- package/dist/src/layer/vectorLayer.js.map +1 -1
- package/dist/src/layer/vectorTileLayer.d.ts +1 -1
- package/dist/src/layer/vectorTileLayer.js +4 -5
- package/dist/src/layer/vectorTileLayer.js.map +1 -1
- package/dist/src/layer/wfsLayer.d.ts +1 -1
- package/dist/src/layer/wfsLayer.js +5 -4
- package/dist/src/layer/wfsLayer.js.map +1 -1
- package/dist/src/layer/wmsLayer.d.ts +1 -1
- package/dist/src/layer/wmsLayer.js +3 -4
- package/dist/src/layer/wmsLayer.js.map +1 -1
- package/dist/src/layer/wmtsLayer.d.ts +1 -1
- package/dist/src/layer/wmtsLayer.js +3 -10
- package/dist/src/layer/wmtsLayer.js.map +1 -1
- package/dist/src/map/baseCesiumMap.d.ts +69 -0
- package/dist/src/map/baseCesiumMap.js +381 -0
- package/dist/src/map/baseCesiumMap.js.map +1 -0
- package/dist/src/map/cesiumMap.d.ts +6 -98
- package/dist/src/map/cesiumMap.js +32 -258
- package/dist/src/map/cesiumMap.js.map +1 -1
- package/dist/src/map/obliqueMap.d.ts +1 -1
- package/dist/src/map/obliqueMap.js +3 -4
- package/dist/src/map/obliqueMap.js.map +1 -1
- package/dist/src/map/openlayersMap.d.ts +1 -1
- package/dist/src/map/openlayersMap.js +3 -4
- package/dist/src/map/openlayersMap.js.map +1 -1
- package/dist/src/map/panoramaMap.d.ts +17 -29
- package/dist/src/map/panoramaMap.js +56 -100
- package/dist/src/map/panoramaMap.js.map +1 -1
- package/dist/src/map/vcsMap.d.ts +15 -2
- package/dist/src/map/vcsMap.js +26 -3
- package/dist/src/map/vcsMap.js.map +1 -1
- package/dist/src/oblique/obliqueCollection.d.ts +1 -1
- package/dist/src/oblique/obliqueCollection.js +3 -4
- package/dist/src/oblique/obliqueCollection.js.map +1 -1
- package/dist/src/panorama/panoramaCameraController.d.ts +4 -0
- package/dist/src/panorama/panoramaCameraController.js +8 -0
- package/dist/src/panorama/panoramaCameraController.js.map +1 -1
- package/dist/src/panorama/panoramaImage.d.ts +10 -1
- package/dist/src/panorama/panoramaImage.js +9 -4
- package/dist/src/panorama/panoramaImage.js.map +1 -1
- package/dist/src/panorama/panoramaImageView.d.ts +6 -1
- package/dist/src/panorama/panoramaImageView.js +11 -2
- package/dist/src/panorama/panoramaImageView.js.map +1 -1
- package/dist/src/panorama/panoramaTileMaterial.d.ts +6 -0
- package/dist/src/panorama/panoramaTileMaterial.js +14 -0
- package/dist/src/panorama/panoramaTileMaterial.js.map +1 -1
- package/dist/src/panorama/panoramaTileMaterialFS.shader.d.ts +1 -1
- package/dist/src/panorama/panoramaTileMaterialFS.shader.js +16 -1
- package/dist/src/panorama/panoramaTileMaterialFS.shader.js.map +1 -1
- package/dist/src/panorama/panoramaTilePrimitiveCollection.d.ts +6 -0
- package/dist/src/panorama/panoramaTilePrimitiveCollection.js +28 -0
- package/dist/src/panorama/panoramaTilePrimitiveCollection.js.map +1 -1
- package/dist/src/util/clipping/clippingPolygonObject.d.ts +1 -1
- package/dist/src/util/clipping/clippingPolygonObject.js +3 -4
- package/dist/src/util/clipping/clippingPolygonObject.js.map +1 -1
- package/dist/src/util/displayQuality/displayQuality.js +4 -4
- package/dist/src/util/displayQuality/displayQuality.js.map +1 -1
- package/dist/src/util/editor/createFeatureSession.js +3 -1
- package/dist/src/util/editor/createFeatureSession.js.map +1 -1
- package/dist/src/util/editor/editFeaturesSession.js +9 -2
- package/dist/src/util/editor/editFeaturesSession.js.map +1 -1
- package/dist/src/util/editor/editGeometrySession.js +3 -1
- package/dist/src/util/editor/editGeometrySession.js.map +1 -1
- package/dist/src/util/editor/editorSessionHelpers.d.ts +3 -3
- package/dist/src/util/editor/editorSessionHelpers.js +4 -2
- package/dist/src/util/editor/editorSessionHelpers.js.map +1 -1
- package/dist/src/util/editor/interactions/creationSnapping.js +4 -1
- package/dist/src/util/editor/interactions/creationSnapping.js.map +1 -1
- package/dist/src/util/editor/interactions/ensureHandlerSelectionInteraction.js +2 -2
- package/dist/src/util/editor/interactions/ensureHandlerSelectionInteraction.js.map +1 -1
- package/dist/src/util/editor/interactions/layerSnapping.js +4 -1
- package/dist/src/util/editor/interactions/layerSnapping.js.map +1 -1
- package/dist/src/util/editor/interactions/mapInteractionController.js +12 -1
- package/dist/src/util/editor/interactions/mapInteractionController.js.map +1 -1
- package/dist/src/util/editor/interactions/translationSnapping.js +4 -2
- package/dist/src/util/editor/interactions/translationSnapping.js.map +1 -1
- package/dist/src/util/editor/selectFeaturesSession.js +1 -1
- package/dist/src/util/editor/selectFeaturesSession.js.map +1 -1
- package/dist/src/util/editor/transformation/create3DHandlers.d.ts +2 -2
- package/dist/src/util/editor/transformation/create3DHandlers.js.map +1 -1
- package/dist/src/util/editor/transformation/transformationHandler.js +5 -2
- package/dist/src/util/editor/transformation/transformationHandler.js.map +1 -1
- package/dist/src/util/editor/transformation/translateInteraction.js +2 -2
- package/dist/src/util/editor/transformation/translateInteraction.js.map +1 -1
- package/dist/src/util/flight/flightInstance.d.ts +1 -1
- package/dist/src/util/flight/flightInstance.js +3 -4
- package/dist/src/util/flight/flightInstance.js.map +1 -1
- package/dist/src/util/mapCollection.d.ts +5 -0
- package/dist/src/util/mapCollection.js +14 -0
- package/dist/src/util/mapCollection.js.map +1 -1
- package/dist/src/util/renderScreenshot.js +2 -3
- package/dist/src/util/renderScreenshot.js.map +1 -1
- package/dist/src/util/viewpoint.js +1 -1
- package/dist/src/util/viewpoint.js.map +1 -1
- package/dist/src/vcsObject.d.ts +2 -1
- package/dist/src/vcsObject.js +9 -1
- package/dist/src/vcsObject.js.map +1 -1
- package/dist/src/vectorCluster/vectorClusterGroup.d.ts +1 -1
- package/dist/src/vectorCluster/vectorClusterGroup.js +3 -4
- package/dist/src/vectorCluster/vectorClusterGroup.js.map +1 -1
- package/dist/src/vectorCluster/vectorClusterStyleItem.d.ts +1 -1
- package/dist/src/vectorCluster/vectorClusterStyleItem.js +3 -4
- package/dist/src/vectorCluster/vectorClusterStyleItem.js.map +1 -1
- package/dist/tests/unit/helpers/cesiumHelpers.d.ts +11 -1
- package/dist/tests/unit/helpers/cesiumHelpers.js +19 -2
- package/dist/tests/unit/helpers/cesiumHelpers.js.map +1 -1
- package/dist/tests/unit/helpers/panoramaHelpers.js +1 -1
- package/dist/tests/unit/helpers/panoramaHelpers.js.map +1 -1
- package/index.ts +3 -5
- package/package.json +2 -2
- package/src/category/category.ts +3 -4
- package/src/featureProvider/abstractFeatureProvider.ts +5 -4
- package/src/featureProvider/wmsFeatureProvider.ts +8 -4
- package/src/interaction/coordinateAtPixel.ts +4 -6
- package/src/interaction/ensurePositionInteraction.ts +50 -0
- package/src/interaction/eventHandler.ts +12 -1
- package/src/interaction/featureAtPixelInteraction.ts +39 -29
- package/src/interaction/panoramaImageSelection.ts +4 -2
- package/src/layer/cesium/cesiumTilesetCesiumImpl.ts +3 -3
- package/src/layer/cesium/rasterLayerCesiumImpl.ts +3 -3
- package/src/layer/cesium/terrainCesiumImpl.ts +3 -3
- package/src/layer/cesium/vectorContext.ts +1 -1
- package/src/layer/cesiumTilesetLayer.ts +9 -7
- package/src/layer/cogLayer.ts +5 -5
- package/src/layer/czmlLayer.ts +4 -4
- package/src/layer/featureLayer.ts +5 -16
- package/src/layer/featureStoreLayer.ts +11 -5
- package/src/layer/flatGeobufLayer.ts +12 -0
- package/src/layer/geojsonLayer.ts +5 -12
- package/src/layer/layer.ts +148 -36
- package/src/layer/openStreetMapLayer.ts +13 -6
- package/src/layer/panorama/vectorPanoramaImpl.ts +238 -0
- package/src/layer/panoramaDatasetLayer.ts +25 -10
- package/src/layer/pointCloudLayer.ts +5 -20
- package/src/layer/rasterLayer.ts +4 -4
- package/src/layer/singleImageLayer.ts +5 -3
- package/src/layer/terrainLayer.ts +9 -6
- package/src/layer/tileProvider/flatGeobufTileProvider.ts +6 -3
- package/src/layer/tileProvider/mvtTileProvider.ts +7 -3
- package/src/layer/tileProvider/staticFeatureTileProvider.ts +5 -3
- package/src/layer/tileProvider/staticGeojsonTileProvider.ts +11 -4
- package/src/layer/tileProvider/tileProvider.ts +5 -4
- package/src/layer/tileProvider/urlTemplateTileProvider.ts +7 -3
- package/src/layer/tmsLayer.ts +3 -10
- package/src/layer/vectorLayer.ts +25 -9
- package/src/layer/vectorTileLayer.ts +6 -6
- package/src/layer/wfsLayer.ts +7 -4
- package/src/layer/wmsLayer.ts +3 -4
- package/src/layer/wmtsLayer.ts +3 -10
- package/src/map/baseCesiumMap.ts +576 -0
- package/src/map/cesiumMap.ts +103 -446
- package/src/map/obliqueMap.ts +3 -4
- package/src/map/openlayersMap.ts +5 -5
- package/src/map/panoramaMap.ts +74 -139
- package/src/map/vcsMap.ts +44 -4
- package/src/oblique/obliqueCollection.ts +5 -4
- package/src/panorama/panoramaCameraController.ts +13 -1
- package/src/panorama/panoramaImage.ts +17 -3
- package/src/panorama/panoramaImageView.ts +29 -3
- package/src/panorama/panoramaTileMaterial.ts +20 -0
- package/src/panorama/panoramaTileMaterialFS.glsl +16 -1
- package/src/panorama/panoramaTilePrimitiveCollection.ts +34 -0
- package/src/util/clipping/clippingPolygonObject.ts +5 -4
- package/src/util/displayQuality/displayQuality.ts +4 -4
- package/src/util/editor/createFeatureSession.ts +4 -1
- package/src/util/editor/editFeaturesSession.ts +14 -4
- package/src/util/editor/editGeometrySession.ts +3 -1
- package/src/util/editor/editorSessionHelpers.ts +5 -3
- package/src/util/editor/interactions/creationSnapping.ts +7 -1
- package/src/util/editor/interactions/ensureHandlerSelectionInteraction.ts +2 -2
- package/src/util/editor/interactions/layerSnapping.ts +7 -1
- package/src/util/editor/interactions/mapInteractionController.ts +12 -2
- package/src/util/editor/interactions/translationSnapping.ts +6 -4
- package/src/util/editor/selectFeaturesSession.ts +1 -1
- package/src/util/editor/transformation/create3DHandlers.ts +2 -2
- package/src/util/editor/transformation/transformationHandler.ts +5 -3
- package/src/util/editor/transformation/translateInteraction.ts +4 -4
- package/src/util/flight/flightInstance.ts +6 -5
- package/src/util/mapCollection.ts +18 -0
- package/src/util/renderScreenshot.ts +4 -8
- package/src/util/viewpoint.ts +2 -2
- package/src/vcsObject.ts +10 -1
- package/src/vectorCluster/vectorClusterGroup.ts +7 -4
- package/src/vectorCluster/vectorClusterStyleItem.ts +8 -4
- package/dist/src/map/cesiumMapHelpers.d.ts +0 -7
- package/dist/src/map/cesiumMapHelpers.js +0 -144
- package/dist/src/map/cesiumMapHelpers.js.map +0 -1
- package/src/map/cesiumMapHelpers.ts +0 -219
|
@@ -69,9 +69,9 @@ class FlightInstance extends VcsObject {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
constructor(options: FlightInstanceOptions) {
|
|
72
|
-
super(options);
|
|
73
|
-
|
|
74
72
|
const defaultOptions = FlightInstance.getDefaultOptions();
|
|
73
|
+
super({ ...defaultOptions, ...options });
|
|
74
|
+
|
|
75
75
|
const anchorsArray = (options.anchors ?? defaultOptions.anchors!)
|
|
76
76
|
.map(anchorFromGeojsonFeature)
|
|
77
77
|
.filter((a): a is FlightAnchor => !!a);
|
|
@@ -205,15 +205,16 @@ class FlightInstance extends VcsObject {
|
|
|
205
205
|
* returns an options object for this flight. if this flight was configured via an URL, only the url will be configured.
|
|
206
206
|
* @returns
|
|
207
207
|
*/
|
|
208
|
-
toJSON(
|
|
209
|
-
|
|
208
|
+
toJSON(
|
|
209
|
+
defaultOptions = FlightInstance.getDefaultOptions(),
|
|
210
|
+
): FlightInstanceOptions {
|
|
211
|
+
const config = super.toJSON(defaultOptions) as FlightInstanceOptions;
|
|
210
212
|
|
|
211
213
|
if (this._url) {
|
|
212
214
|
config.url = this._url;
|
|
213
215
|
return config;
|
|
214
216
|
}
|
|
215
217
|
|
|
216
|
-
const defaultOptions = FlightInstance.getDefaultOptions();
|
|
217
218
|
if (this._multiplier !== defaultOptions.multiplier) {
|
|
218
219
|
config.multiplier = this._multiplier;
|
|
219
220
|
}
|
|
@@ -22,6 +22,7 @@ import PanoramaImageSelection from '../interaction/panoramaImageSelection.js';
|
|
|
22
22
|
import type { PanoramaImage } from '../panorama/panoramaImage.js';
|
|
23
23
|
import type PanoramaMap from '../map/panoramaMap.js';
|
|
24
24
|
import PanoramaFeatureHighlight from '../interaction/panoramaFeatureHighlight.js';
|
|
25
|
+
import { EventType } from '../interaction/interactionType.js';
|
|
25
26
|
|
|
26
27
|
export type MapCollectionInitializationError = {
|
|
27
28
|
error: Error;
|
|
@@ -258,6 +259,23 @@ class MapCollection extends Collection<VcsMap> {
|
|
|
258
259
|
return this._exclusiveMapControls?.id;
|
|
259
260
|
}
|
|
260
261
|
|
|
262
|
+
/**
|
|
263
|
+
* Indicates whether panorama image selection is paused.
|
|
264
|
+
*/
|
|
265
|
+
get pausePanoramaImageSelection(): boolean {
|
|
266
|
+
return (
|
|
267
|
+
this._panoramaImageSelection.active === EventType.NONE &&
|
|
268
|
+
this._panoramaTileHighlight.active === EventType.NONE
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
set pausePanoramaImageSelection(paused: boolean) {
|
|
273
|
+
check(paused, Boolean);
|
|
274
|
+
const active = paused ? false : undefined;
|
|
275
|
+
this._panoramaImageSelection.setActive(active);
|
|
276
|
+
this._panoramaTileHighlight.setActive(active);
|
|
277
|
+
}
|
|
278
|
+
|
|
261
279
|
/**
|
|
262
280
|
* Adds a map to the collection. This will set the collections target
|
|
263
281
|
* and the collections on the map.
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import type { Size } from 'ol/size.js';
|
|
2
2
|
import { getLogger } from '@vcsuite/logger';
|
|
3
|
-
import CesiumMap from '../map/cesiumMap.js';
|
|
4
3
|
import OpenlayersMap from '../map/openlayersMap.js';
|
|
5
4
|
import ObliqueMap from '../map/obliqueMap.js';
|
|
6
|
-
import PanoramaMap from '../map/panoramaMap.js';
|
|
7
5
|
import type VcsApp from '../vcsApp.js';
|
|
6
|
+
import BaseCesiumMap from '../map/baseCesiumMap.js';
|
|
8
7
|
/**
|
|
9
8
|
* Prepares the cesium map for the screenshot
|
|
10
9
|
* @param map - The cesium map
|
|
11
10
|
* @param scale - The factor to scale the map according to the required resolution
|
|
12
11
|
* @returns The function to reset the applied scale.
|
|
13
12
|
*/
|
|
14
|
-
function prepareCesiumMap(
|
|
15
|
-
map: CesiumMap | PanoramaMap,
|
|
16
|
-
scale: number,
|
|
17
|
-
): () => void {
|
|
13
|
+
function prepareCesiumMap(map: BaseCesiumMap, scale: number): () => void {
|
|
18
14
|
const viewer = map.getCesiumWidget()!;
|
|
19
15
|
const { resolutionScale } = viewer;
|
|
20
16
|
viewer.resolutionScale = scale;
|
|
@@ -64,7 +60,7 @@ function prepareOlMap(
|
|
|
64
60
|
* @returns A promise that resolves to the canvas element.
|
|
65
61
|
*/
|
|
66
62
|
async function getImageFromCesium(
|
|
67
|
-
map:
|
|
63
|
+
map: BaseCesiumMap,
|
|
68
64
|
): Promise<HTMLCanvasElement> {
|
|
69
65
|
const { scene } = map.getCesiumWidget()!;
|
|
70
66
|
|
|
@@ -167,7 +163,7 @@ export default async function renderScreenshot(
|
|
|
167
163
|
let resetMap: () => void;
|
|
168
164
|
const map = app.maps.activeMap;
|
|
169
165
|
|
|
170
|
-
if (map instanceof
|
|
166
|
+
if (map instanceof BaseCesiumMap) {
|
|
171
167
|
const { canvas } = map.getCesiumWidget()!.scene;
|
|
172
168
|
const canvasWidth = canvas.width;
|
|
173
169
|
const canvasHeight = canvas.height;
|
package/src/util/viewpoint.ts
CHANGED
|
@@ -182,9 +182,9 @@ class Viewpoint extends VcsObject {
|
|
|
182
182
|
* @param options
|
|
183
183
|
*/
|
|
184
184
|
constructor(options: ViewpointOptions) {
|
|
185
|
-
super(options);
|
|
186
|
-
|
|
187
185
|
const defaultOptions = Viewpoint.getDefaultOptions();
|
|
186
|
+
super({ ...defaultOptions, ...options });
|
|
187
|
+
|
|
188
188
|
this.cameraPosition = null;
|
|
189
189
|
if (
|
|
190
190
|
Array.isArray(options.cameraPosition) &&
|
package/src/vcsObject.ts
CHANGED
|
@@ -25,6 +25,14 @@ class VcsObject {
|
|
|
25
25
|
return 'VcsObject';
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
static getDefaultOptions(): VcsObjectOptions {
|
|
29
|
+
return {
|
|
30
|
+
type: undefined,
|
|
31
|
+
name: undefined,
|
|
32
|
+
properties: {},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
28
36
|
/**
|
|
29
37
|
* unique Name
|
|
30
38
|
*/
|
|
@@ -50,7 +58,8 @@ class VcsObject {
|
|
|
50
58
|
return getLogger(this.className);
|
|
51
59
|
}
|
|
52
60
|
|
|
53
|
-
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
62
|
+
toJSON(_defaultOptions?: VcsObjectOptions): VcsObjectOptions {
|
|
54
63
|
const config: VcsObjectOptions = {
|
|
55
64
|
type: this.className,
|
|
56
65
|
name: this.name,
|
|
@@ -135,8 +135,8 @@ export default class VectorClusterGroup extends VcsObject {
|
|
|
135
135
|
clusterDistance: number;
|
|
136
136
|
|
|
137
137
|
constructor(options: VectorClusterGroupOptions) {
|
|
138
|
-
super(options);
|
|
139
138
|
const defaultOptions = VectorClusterGroup.getDefaultOptions();
|
|
139
|
+
super({ ...defaultOptions, ...options });
|
|
140
140
|
|
|
141
141
|
this._style = getStyleOrDefaultStyle(
|
|
142
142
|
options.style,
|
|
@@ -445,9 +445,12 @@ export default class VectorClusterGroup extends VcsObject {
|
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
447
|
|
|
448
|
-
toJSON(
|
|
449
|
-
|
|
450
|
-
|
|
448
|
+
toJSON(
|
|
449
|
+
defaultOptions = VectorClusterGroup.getDefaultOptions(),
|
|
450
|
+
): VectorClusterGroupOptions {
|
|
451
|
+
const config: Partial<VectorClusterGroupOptions> = super.toJSON(
|
|
452
|
+
defaultOptions,
|
|
453
|
+
);
|
|
451
454
|
|
|
452
455
|
if (!this.style.equals(new VectorClusterStyleItem({}))) {
|
|
453
456
|
config.style = this.style.toJSON();
|
|
@@ -99,8 +99,8 @@ export default class VectorClusterStyleItem extends VcsObject {
|
|
|
99
99
|
styleChanged = new VcsEvent<void>();
|
|
100
100
|
|
|
101
101
|
constructor(options: VectorClusterStyleItemOptions) {
|
|
102
|
-
super(options);
|
|
103
102
|
const defaultOptions = VectorClusterStyleItem.getDefaultOptions();
|
|
103
|
+
super({ ...defaultOptions, ...options });
|
|
104
104
|
|
|
105
105
|
const configTemplate = Array.isArray(options.template)
|
|
106
106
|
? options.template.join('')
|
|
@@ -336,9 +336,13 @@ export default class VectorClusterStyleItem extends VcsObject {
|
|
|
336
336
|
this._styleCache.clear();
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
toJSON(
|
|
340
|
-
|
|
341
|
-
|
|
339
|
+
toJSON(
|
|
340
|
+
defaultOptions = VectorClusterStyleItem.getDefaultOptions(),
|
|
341
|
+
): VectorClusterStyleItemOptions {
|
|
342
|
+
const config: Partial<VectorClusterStyleItemOptions> = super.toJSON(
|
|
343
|
+
defaultOptions,
|
|
344
|
+
);
|
|
345
|
+
|
|
342
346
|
if (this.template !== defaultOptions.template) {
|
|
343
347
|
config.template = this.template;
|
|
344
348
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Camera, Scene, ScreenSpaceEventHandler } from '@vcmap-cesium/engine';
|
|
2
|
-
import { Cartesian3 } from '@vcmap-cesium/engine';
|
|
3
|
-
import Viewpoint from '../util/viewpoint.js';
|
|
4
|
-
import type VcsMap from './vcsMap.js';
|
|
5
|
-
export declare function setupCesiumInteractions(map: VcsMap, scene: Scene, screenSpaceEventHandler: ScreenSpaceEventHandler): () => void;
|
|
6
|
-
export declare function getViewpointFromScene(scene: Scene): Viewpoint;
|
|
7
|
-
export declare function getResolution(cartesian: Cartesian3, camera: Camera, mapElement: HTMLElement, latitude?: number): number;
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { Cartesian3, Cartographic, Ellipsoid, KeyboardEventModifier, Math as CesiumMath, Ray, ScreenSpaceEventType, } from '@vcmap-cesium/engine';
|
|
2
|
-
import { ModificationKeyType, PointerEventType, PointerKeyType, } from '../interaction/interactionType.js';
|
|
3
|
-
import Viewpoint from '../util/viewpoint.js';
|
|
4
|
-
function raisePointerInteraction(map, key, pointer, pointerEvent, csEvent, screenSpaceEventHandler) {
|
|
5
|
-
const multipleTouch =
|
|
6
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
7
|
-
(screenSpaceEventHandler?._positions?.length ?? 0) > 1;
|
|
8
|
-
const windowPosition = csEvent
|
|
9
|
-
.position
|
|
10
|
-
? csEvent.position
|
|
11
|
-
: csEvent.endPosition;
|
|
12
|
-
map.pointerInteractionEvent.raiseEvent({
|
|
13
|
-
map,
|
|
14
|
-
windowPosition,
|
|
15
|
-
key,
|
|
16
|
-
pointer,
|
|
17
|
-
multipleTouch,
|
|
18
|
-
pointerEvent,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
export function setupCesiumInteractions(map, scene, screenSpaceEventHandler) {
|
|
22
|
-
const mods = [
|
|
23
|
-
{
|
|
24
|
-
csModifier: KeyboardEventModifier.ALT,
|
|
25
|
-
vcsModifier: ModificationKeyType.ALT,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
csModifier: KeyboardEventModifier.CTRL,
|
|
29
|
-
vcsModifier: ModificationKeyType.CTRL,
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
csModifier: KeyboardEventModifier.SHIFT,
|
|
33
|
-
vcsModifier: ModificationKeyType.SHIFT,
|
|
34
|
-
},
|
|
35
|
-
{ csModifier: undefined, vcsModifier: ModificationKeyType.NONE },
|
|
36
|
-
];
|
|
37
|
-
const types = [
|
|
38
|
-
{
|
|
39
|
-
type: ScreenSpaceEventType.LEFT_DOWN,
|
|
40
|
-
pointerEvent: PointerEventType.DOWN,
|
|
41
|
-
pointer: PointerKeyType.LEFT,
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
type: ScreenSpaceEventType.LEFT_UP,
|
|
45
|
-
pointerEvent: PointerEventType.UP,
|
|
46
|
-
pointer: PointerKeyType.LEFT,
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
type: ScreenSpaceEventType.RIGHT_DOWN,
|
|
50
|
-
pointerEvent: PointerEventType.DOWN,
|
|
51
|
-
pointer: PointerKeyType.RIGHT,
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
type: ScreenSpaceEventType.RIGHT_UP,
|
|
55
|
-
pointerEvent: PointerEventType.UP,
|
|
56
|
-
pointer: PointerKeyType.RIGHT,
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
type: ScreenSpaceEventType.MIDDLE_DOWN,
|
|
60
|
-
pointerEvent: PointerEventType.DOWN,
|
|
61
|
-
pointer: PointerKeyType.MIDDLE,
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
type: ScreenSpaceEventType.MIDDLE_UP,
|
|
65
|
-
pointerEvent: PointerEventType.UP,
|
|
66
|
-
pointer: PointerKeyType.MIDDLE,
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
type: ScreenSpaceEventType.MOUSE_MOVE,
|
|
70
|
-
pointerEvent: PointerEventType.MOVE,
|
|
71
|
-
pointer: PointerKeyType.ALL,
|
|
72
|
-
},
|
|
73
|
-
];
|
|
74
|
-
let lastEventFrameNumber = 0;
|
|
75
|
-
const screenSpaceListeners = types
|
|
76
|
-
.map(({ pointerEvent, pointer, type }) => {
|
|
77
|
-
return mods.map(({ csModifier, vcsModifier }) => {
|
|
78
|
-
const handler = type === ScreenSpaceEventType.MOUSE_MOVE
|
|
79
|
-
? (csEvent) => {
|
|
80
|
-
if (scene.frameState.frameNumber !== lastEventFrameNumber) {
|
|
81
|
-
lastEventFrameNumber = scene.frameState.frameNumber;
|
|
82
|
-
raisePointerInteraction(map, vcsModifier, pointer, pointerEvent, csEvent, screenSpaceEventHandler);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
: (csEvent) => {
|
|
86
|
-
raisePointerInteraction(map, vcsModifier, pointer, pointerEvent, csEvent, screenSpaceEventHandler);
|
|
87
|
-
};
|
|
88
|
-
screenSpaceEventHandler.setInputAction?.(handler, type, csModifier);
|
|
89
|
-
return () => {
|
|
90
|
-
screenSpaceEventHandler.removeInputAction?.(type, csModifier);
|
|
91
|
-
};
|
|
92
|
-
});
|
|
93
|
-
})
|
|
94
|
-
.flat();
|
|
95
|
-
return () => {
|
|
96
|
-
screenSpaceListeners.forEach((removeListener) => {
|
|
97
|
-
removeListener();
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
export function getViewpointFromScene(scene) {
|
|
102
|
-
const cam = scene.camera;
|
|
103
|
-
const cameraPositionCartesian = cam.position;
|
|
104
|
-
let groundPosition;
|
|
105
|
-
let distance;
|
|
106
|
-
const groundPositionCartesian = scene.globe?.pick(new Ray(cam.position, cam.direction), scene);
|
|
107
|
-
if (groundPositionCartesian) {
|
|
108
|
-
distance = Cartesian3.distance(groundPositionCartesian, cameraPositionCartesian);
|
|
109
|
-
const groundPositionCartographic = Ellipsoid.WGS84.cartesianToCartographic(groundPositionCartesian);
|
|
110
|
-
groundPosition = [
|
|
111
|
-
CesiumMath.toDegrees(groundPositionCartographic.longitude),
|
|
112
|
-
CesiumMath.toDegrees(groundPositionCartographic.latitude),
|
|
113
|
-
groundPositionCartographic.height,
|
|
114
|
-
];
|
|
115
|
-
}
|
|
116
|
-
const cameraPositionCartographic = cam.positionCartographic;
|
|
117
|
-
const cameraPosition = [
|
|
118
|
-
CesiumMath.toDegrees(cameraPositionCartographic.longitude),
|
|
119
|
-
CesiumMath.toDegrees(cameraPositionCartographic.latitude),
|
|
120
|
-
cameraPositionCartographic.height,
|
|
121
|
-
];
|
|
122
|
-
return new Viewpoint({
|
|
123
|
-
groundPosition,
|
|
124
|
-
cameraPosition,
|
|
125
|
-
distance,
|
|
126
|
-
heading: CesiumMath.toDegrees(cam.heading),
|
|
127
|
-
pitch: CesiumMath.toDegrees(cam.pitch),
|
|
128
|
-
roll: CesiumMath.toDegrees(cam.roll),
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
export function getResolution(cartesian, camera, mapElement, latitude) {
|
|
132
|
-
const distance = Cartesian3.distance(cartesian, camera.position);
|
|
133
|
-
const usedLatitude = latitude ?? Cartographic.fromCartesian(cartesian).latitude;
|
|
134
|
-
const fov = Math.PI / 3.0;
|
|
135
|
-
const width = mapElement.offsetWidth;
|
|
136
|
-
const height = mapElement.offsetHeight;
|
|
137
|
-
const aspectRatio = width / height;
|
|
138
|
-
const fovy = Math.atan(Math.tan(fov * 0.5) / aspectRatio) * 2.0;
|
|
139
|
-
const visibleMeters = 2 * distance * Math.tan(fovy / 2);
|
|
140
|
-
const relativeCircumference = Math.cos(Math.abs(usedLatitude));
|
|
141
|
-
const visibleMapUnits = visibleMeters / relativeCircumference;
|
|
142
|
-
return visibleMapUnits / height;
|
|
143
|
-
}
|
|
144
|
-
//# sourceMappingURL=cesiumMapHelpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cesiumMapHelpers.js","sourceRoot":"","sources":["../../../src/map/cesiumMapHelpers.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,UAAU,EACV,YAAY,EACZ,SAAS,EACT,qBAAqB,EACrB,IAAI,IAAI,UAAU,EAClB,GAAG,EACH,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,GACf,MAAM,mCAAmC,CAAC;AAC3C,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAG7C,SAAS,uBAAuB,CAC9B,GAAW,EACX,GAAwB,EACxB,OAAe,EACf,YAA8B,EAC9B,OAEuC,EACvC,uBAAgD;IAEhD,MAAM,aAAa;IACjB,gDAAgD;IAChD,CAAC,uBAAuB,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;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@@ -1,219 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
Camera,
|
|
3
|
-
Scene,
|
|
4
|
-
ScreenSpaceEventHandler,
|
|
5
|
-
} from '@vcmap-cesium/engine';
|
|
6
|
-
import {
|
|
7
|
-
Cartesian3,
|
|
8
|
-
Cartographic,
|
|
9
|
-
Ellipsoid,
|
|
10
|
-
KeyboardEventModifier,
|
|
11
|
-
Math as CesiumMath,
|
|
12
|
-
Ray,
|
|
13
|
-
ScreenSpaceEventType,
|
|
14
|
-
} from '@vcmap-cesium/engine';
|
|
15
|
-
import {
|
|
16
|
-
ModificationKeyType,
|
|
17
|
-
PointerEventType,
|
|
18
|
-
PointerKeyType,
|
|
19
|
-
} from '../interaction/interactionType.js';
|
|
20
|
-
import Viewpoint from '../util/viewpoint.js';
|
|
21
|
-
import type VcsMap from './vcsMap.js';
|
|
22
|
-
|
|
23
|
-
function raisePointerInteraction(
|
|
24
|
-
map: VcsMap,
|
|
25
|
-
key: ModificationKeyType,
|
|
26
|
-
pointer: number,
|
|
27
|
-
pointerEvent: PointerEventType,
|
|
28
|
-
csEvent:
|
|
29
|
-
| ScreenSpaceEventHandler.PositionedEvent
|
|
30
|
-
| ScreenSpaceEventHandler.MotionEvent,
|
|
31
|
-
screenSpaceEventHandler: ScreenSpaceEventHandler,
|
|
32
|
-
): void {
|
|
33
|
-
const multipleTouch =
|
|
34
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
35
|
-
(screenSpaceEventHandler?._positions?.length ?? 0) > 1;
|
|
36
|
-
const windowPosition = (csEvent as ScreenSpaceEventHandler.PositionedEvent)
|
|
37
|
-
.position
|
|
38
|
-
? (csEvent as ScreenSpaceEventHandler.PositionedEvent).position
|
|
39
|
-
: (csEvent as ScreenSpaceEventHandler.MotionEvent).endPosition;
|
|
40
|
-
|
|
41
|
-
map.pointerInteractionEvent.raiseEvent({
|
|
42
|
-
map,
|
|
43
|
-
windowPosition,
|
|
44
|
-
key,
|
|
45
|
-
pointer,
|
|
46
|
-
multipleTouch,
|
|
47
|
-
pointerEvent,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function setupCesiumInteractions(
|
|
52
|
-
map: VcsMap,
|
|
53
|
-
scene: Scene,
|
|
54
|
-
screenSpaceEventHandler: ScreenSpaceEventHandler,
|
|
55
|
-
): () => void {
|
|
56
|
-
const mods = [
|
|
57
|
-
{
|
|
58
|
-
csModifier: KeyboardEventModifier.ALT,
|
|
59
|
-
vcsModifier: ModificationKeyType.ALT,
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
csModifier: KeyboardEventModifier.CTRL,
|
|
63
|
-
vcsModifier: ModificationKeyType.CTRL,
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
csModifier: KeyboardEventModifier.SHIFT,
|
|
67
|
-
vcsModifier: ModificationKeyType.SHIFT,
|
|
68
|
-
},
|
|
69
|
-
{ csModifier: undefined, vcsModifier: ModificationKeyType.NONE },
|
|
70
|
-
];
|
|
71
|
-
|
|
72
|
-
const types = [
|
|
73
|
-
{
|
|
74
|
-
type: ScreenSpaceEventType.LEFT_DOWN,
|
|
75
|
-
pointerEvent: PointerEventType.DOWN,
|
|
76
|
-
pointer: PointerKeyType.LEFT,
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
type: ScreenSpaceEventType.LEFT_UP,
|
|
80
|
-
pointerEvent: PointerEventType.UP,
|
|
81
|
-
pointer: PointerKeyType.LEFT,
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
type: ScreenSpaceEventType.RIGHT_DOWN,
|
|
85
|
-
pointerEvent: PointerEventType.DOWN,
|
|
86
|
-
pointer: PointerKeyType.RIGHT,
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
type: ScreenSpaceEventType.RIGHT_UP,
|
|
90
|
-
pointerEvent: PointerEventType.UP,
|
|
91
|
-
pointer: PointerKeyType.RIGHT,
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
type: ScreenSpaceEventType.MIDDLE_DOWN,
|
|
95
|
-
pointerEvent: PointerEventType.DOWN,
|
|
96
|
-
pointer: PointerKeyType.MIDDLE,
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
type: ScreenSpaceEventType.MIDDLE_UP,
|
|
100
|
-
pointerEvent: PointerEventType.UP,
|
|
101
|
-
pointer: PointerKeyType.MIDDLE,
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
type: ScreenSpaceEventType.MOUSE_MOVE,
|
|
105
|
-
pointerEvent: PointerEventType.MOVE,
|
|
106
|
-
pointer: PointerKeyType.ALL,
|
|
107
|
-
},
|
|
108
|
-
];
|
|
109
|
-
let lastEventFrameNumber = 0;
|
|
110
|
-
const screenSpaceListeners = types
|
|
111
|
-
.map(({ pointerEvent, pointer, type }) => {
|
|
112
|
-
return mods.map(({ csModifier, vcsModifier }) => {
|
|
113
|
-
const handler:
|
|
114
|
-
| ScreenSpaceEventHandler.PositionedEventCallback
|
|
115
|
-
| ScreenSpaceEventHandler.MotionEventCallback =
|
|
116
|
-
type === ScreenSpaceEventType.MOUSE_MOVE
|
|
117
|
-
? (csEvent: ScreenSpaceEventHandler.MotionEvent): void => {
|
|
118
|
-
if (scene.frameState.frameNumber !== lastEventFrameNumber) {
|
|
119
|
-
lastEventFrameNumber = scene.frameState.frameNumber;
|
|
120
|
-
raisePointerInteraction(
|
|
121
|
-
map,
|
|
122
|
-
vcsModifier,
|
|
123
|
-
pointer,
|
|
124
|
-
pointerEvent,
|
|
125
|
-
csEvent,
|
|
126
|
-
screenSpaceEventHandler,
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
: (csEvent: ScreenSpaceEventHandler.PositionedEvent): void => {
|
|
131
|
-
raisePointerInteraction(
|
|
132
|
-
map,
|
|
133
|
-
vcsModifier,
|
|
134
|
-
pointer,
|
|
135
|
-
pointerEvent,
|
|
136
|
-
csEvent,
|
|
137
|
-
screenSpaceEventHandler,
|
|
138
|
-
);
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
screenSpaceEventHandler.setInputAction?.(handler, type, csModifier);
|
|
142
|
-
return (): void => {
|
|
143
|
-
screenSpaceEventHandler.removeInputAction?.(type, csModifier);
|
|
144
|
-
};
|
|
145
|
-
});
|
|
146
|
-
})
|
|
147
|
-
.flat();
|
|
148
|
-
|
|
149
|
-
return (): void => {
|
|
150
|
-
screenSpaceListeners.forEach((removeListener) => {
|
|
151
|
-
removeListener();
|
|
152
|
-
});
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export function getViewpointFromScene(scene: Scene): Viewpoint {
|
|
157
|
-
const cam = scene.camera;
|
|
158
|
-
const cameraPositionCartesian = cam.position;
|
|
159
|
-
let groundPosition;
|
|
160
|
-
let distance;
|
|
161
|
-
|
|
162
|
-
const groundPositionCartesian = scene.globe?.pick(
|
|
163
|
-
new Ray(cam.position, cam.direction),
|
|
164
|
-
scene,
|
|
165
|
-
);
|
|
166
|
-
|
|
167
|
-
if (groundPositionCartesian) {
|
|
168
|
-
distance = Cartesian3.distance(
|
|
169
|
-
groundPositionCartesian,
|
|
170
|
-
cameraPositionCartesian,
|
|
171
|
-
);
|
|
172
|
-
const groundPositionCartographic = Ellipsoid.WGS84.cartesianToCartographic(
|
|
173
|
-
groundPositionCartesian,
|
|
174
|
-
);
|
|
175
|
-
groundPosition = [
|
|
176
|
-
CesiumMath.toDegrees(groundPositionCartographic.longitude),
|
|
177
|
-
CesiumMath.toDegrees(groundPositionCartographic.latitude),
|
|
178
|
-
groundPositionCartographic.height,
|
|
179
|
-
];
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
const cameraPositionCartographic = cam.positionCartographic;
|
|
183
|
-
const cameraPosition = [
|
|
184
|
-
CesiumMath.toDegrees(cameraPositionCartographic.longitude),
|
|
185
|
-
CesiumMath.toDegrees(cameraPositionCartographic.latitude),
|
|
186
|
-
cameraPositionCartographic.height,
|
|
187
|
-
];
|
|
188
|
-
|
|
189
|
-
return new Viewpoint({
|
|
190
|
-
groundPosition,
|
|
191
|
-
cameraPosition,
|
|
192
|
-
distance,
|
|
193
|
-
heading: CesiumMath.toDegrees(cam.heading),
|
|
194
|
-
pitch: CesiumMath.toDegrees(cam.pitch),
|
|
195
|
-
roll: CesiumMath.toDegrees(cam.roll),
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export function getResolution(
|
|
200
|
-
cartesian: Cartesian3,
|
|
201
|
-
camera: Camera,
|
|
202
|
-
mapElement: HTMLElement,
|
|
203
|
-
latitude?: number,
|
|
204
|
-
): number {
|
|
205
|
-
const distance = Cartesian3.distance(cartesian, camera.position);
|
|
206
|
-
const usedLatitude =
|
|
207
|
-
latitude ?? Cartographic.fromCartesian(cartesian).latitude;
|
|
208
|
-
|
|
209
|
-
const fov = Math.PI / 3.0;
|
|
210
|
-
const width = mapElement.offsetWidth;
|
|
211
|
-
const height = mapElement.offsetHeight;
|
|
212
|
-
const aspectRatio = width / height;
|
|
213
|
-
const fovy = Math.atan(Math.tan(fov * 0.5) / aspectRatio) * 2.0;
|
|
214
|
-
const visibleMeters = 2 * distance * Math.tan(fovy / 2);
|
|
215
|
-
const relativeCircumference = Math.cos(Math.abs(usedLatitude));
|
|
216
|
-
const visibleMapUnits = visibleMeters / relativeCircumference;
|
|
217
|
-
|
|
218
|
-
return visibleMapUnits / height;
|
|
219
|
-
}
|