@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,9 +1,8 @@
|
|
|
1
|
-
import { EasingFunction } from '@vcmap/
|
|
1
|
+
import { EasingFunction } from '@vcmap-cesium/engine';
|
|
2
2
|
import { parseBoolean, parseNumber } from '@vcsuite/parsers';
|
|
3
3
|
import Projection, { wgs84Projection } from './projection.js';
|
|
4
|
-
import VcsObject from '../
|
|
4
|
+
import VcsObject from '../vcsObject.js';
|
|
5
5
|
import Extent from './extent.js';
|
|
6
|
-
import { VcsClassRegistry } from '../classRegistry.js';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* compares two numeric properties
|
|
@@ -11,7 +10,6 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
11
10
|
* @param {number} right
|
|
12
11
|
* @param {number} epsilon
|
|
13
12
|
* @returns {boolean}
|
|
14
|
-
* @export
|
|
15
13
|
*/
|
|
16
14
|
export function propertyEqualsEpsilon(left, right, epsilon) {
|
|
17
15
|
return Math.abs(left - right) <= epsilon;
|
|
@@ -23,29 +21,29 @@ export function propertyEqualsEpsilon(left, right, epsilon) {
|
|
|
23
21
|
* @param {number} right angle in degree
|
|
24
22
|
* @param {number} epsilon in degree
|
|
25
23
|
* @returns {boolean}
|
|
26
|
-
* @export
|
|
27
24
|
*/
|
|
28
25
|
export function angleEqualsEpsilon(left, right, epsilon) {
|
|
29
|
-
const diff =
|
|
26
|
+
const diff = left - right - Math.trunc((left - right) / 360) * 360;
|
|
30
27
|
return Math.abs(diff) <= epsilon;
|
|
31
28
|
}
|
|
32
29
|
|
|
33
|
-
|
|
34
30
|
/**
|
|
35
31
|
* compares two coordinates componentwise
|
|
36
32
|
* @param {import("ol/coordinate").Coordinate} left
|
|
37
33
|
* @param {import("ol/coordinate").Coordinate} right
|
|
38
34
|
* @param {number} epsilon
|
|
39
35
|
* @returns {boolean}
|
|
40
|
-
* @export
|
|
41
36
|
*/
|
|
42
37
|
export function coordinateEqualsEpsilon(left, right, epsilon) {
|
|
43
|
-
return
|
|
44
|
-
left
|
|
38
|
+
return (
|
|
39
|
+
left !== null &&
|
|
40
|
+
right !== null &&
|
|
41
|
+
left.every((val, idx) => propertyEqualsEpsilon(val, right[idx], epsilon))
|
|
42
|
+
);
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
/**
|
|
48
|
-
* @typedef {VcsObjectOptions}
|
|
46
|
+
* @typedef {VcsObjectOptions} ViewpointOptions
|
|
49
47
|
* @property {import("ol/coordinate").Coordinate|undefined} cameraPosition - ol3 coordinate array with xyz coordinates (z value is mandatory)
|
|
50
48
|
* @property {import("ol/coordinate").Coordinate|undefined} groundPosition - ol3 coordinate array with xyz coordinates (z value is optional)
|
|
51
49
|
* @property {number|undefined} distance - distance between the camera position and the target
|
|
@@ -61,15 +59,16 @@ export function coordinateEqualsEpsilon(left, right, epsilon) {
|
|
|
61
59
|
/**
|
|
62
60
|
* A Viewpoint Object
|
|
63
61
|
* @class
|
|
64
|
-
* @export
|
|
65
62
|
* @extends {VcsObject}
|
|
66
63
|
* @api stable
|
|
67
64
|
*/
|
|
68
|
-
class
|
|
69
|
-
static get className() {
|
|
65
|
+
class Viewpoint extends VcsObject {
|
|
66
|
+
static get className() {
|
|
67
|
+
return 'Viewpoint';
|
|
68
|
+
}
|
|
70
69
|
|
|
71
70
|
/**
|
|
72
|
-
* @param {
|
|
71
|
+
* @param {ViewpointOptions} options
|
|
73
72
|
*/
|
|
74
73
|
constructor(options) {
|
|
75
74
|
super(options);
|
|
@@ -81,8 +80,11 @@ class ViewPoint extends VcsObject {
|
|
|
81
80
|
* @api
|
|
82
81
|
*/
|
|
83
82
|
this.cameraPosition = null;
|
|
84
|
-
if (
|
|
85
|
-
|
|
83
|
+
if (
|
|
84
|
+
Array.isArray(options.cameraPosition) &&
|
|
85
|
+
options.cameraPosition.length === 3
|
|
86
|
+
) {
|
|
87
|
+
this.cameraPosition = options.cameraPosition.map((c) => Number(c));
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
/**
|
|
@@ -93,7 +95,7 @@ class ViewPoint extends VcsObject {
|
|
|
93
95
|
*/
|
|
94
96
|
this.groundPosition = null;
|
|
95
97
|
if (Array.isArray(options.groundPosition)) {
|
|
96
|
-
this.groundPosition = options.groundPosition.map(c => Number(c));
|
|
98
|
+
this.groundPosition = options.groundPosition.map((c) => Number(c));
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
/**
|
|
@@ -102,7 +104,10 @@ class ViewPoint extends VcsObject {
|
|
|
102
104
|
* @type {?number}
|
|
103
105
|
* @api
|
|
104
106
|
*/
|
|
105
|
-
this.distance = parseNumber(
|
|
107
|
+
this.distance = parseNumber(
|
|
108
|
+
options.distance,
|
|
109
|
+
this.cameraPosition ? this.cameraPosition[2] : 1000,
|
|
110
|
+
);
|
|
106
111
|
|
|
107
112
|
/**
|
|
108
113
|
* heading, angle between 0 and 360 degree 0° = North, 90° = east ...
|
|
@@ -147,16 +152,18 @@ class ViewPoint extends VcsObject {
|
|
|
147
152
|
|
|
148
153
|
/**
|
|
149
154
|
* The current easing function
|
|
150
|
-
* @type {import("@vcmap/
|
|
155
|
+
* @type {import("@vcmap-cesium/engine").EasingFunction.Callback|null}
|
|
151
156
|
* @api
|
|
152
157
|
* @readonly
|
|
153
158
|
*/
|
|
154
159
|
get easingFunction() {
|
|
155
|
-
return this.easingFunctionName
|
|
160
|
+
return this.easingFunctionName
|
|
161
|
+
? EasingFunction[this.easingFunctionName]
|
|
162
|
+
: null;
|
|
156
163
|
}
|
|
157
164
|
|
|
158
165
|
/**
|
|
159
|
-
* @returns {
|
|
166
|
+
* @returns {ViewpointOptions} returns a options object. This object can be used to reconstruct a new viewpoint
|
|
160
167
|
* @api stable
|
|
161
168
|
*/
|
|
162
169
|
toJSON() {
|
|
@@ -176,11 +183,11 @@ class ViewPoint extends VcsObject {
|
|
|
176
183
|
|
|
177
184
|
/**
|
|
178
185
|
* clones the viewpoint
|
|
179
|
-
* @returns {
|
|
186
|
+
* @returns {Viewpoint} viewpoint
|
|
180
187
|
* @api stable
|
|
181
188
|
*/
|
|
182
189
|
clone() {
|
|
183
|
-
return new
|
|
190
|
+
return new Viewpoint(this.toJSON());
|
|
184
191
|
}
|
|
185
192
|
|
|
186
193
|
/**
|
|
@@ -189,7 +196,10 @@ class ViewPoint extends VcsObject {
|
|
|
189
196
|
* @api stable
|
|
190
197
|
*/
|
|
191
198
|
toString() {
|
|
192
|
-
const stringRep =
|
|
199
|
+
const stringRep =
|
|
200
|
+
`Viewpoint: [Ground:${String(
|
|
201
|
+
this.groundPosition ? this.groundPosition : null,
|
|
202
|
+
)}]` +
|
|
193
203
|
`[Camera:${String(this.cameraPosition ? this.cameraPosition : null)}]` +
|
|
194
204
|
`[Distance:${this.distance}]` +
|
|
195
205
|
`[heading:${this.distance}]` +
|
|
@@ -201,13 +211,14 @@ class ViewPoint extends VcsObject {
|
|
|
201
211
|
/**
|
|
202
212
|
* Creates a viewpoint based on an extent
|
|
203
213
|
* @param {import("ol/extent").Extent|Extent} extent
|
|
204
|
-
* @returns {?
|
|
214
|
+
* @returns {?Viewpoint}
|
|
205
215
|
* @api
|
|
206
216
|
*/
|
|
207
|
-
static
|
|
208
|
-
const extentCoordinates =
|
|
209
|
-
extent
|
|
210
|
-
|
|
217
|
+
static createViewpointFromExtent(extent) {
|
|
218
|
+
const extentCoordinates =
|
|
219
|
+
extent instanceof Extent
|
|
220
|
+
? extent.getCoordinatesInProjection(wgs84Projection)
|
|
221
|
+
: extent;
|
|
211
222
|
|
|
212
223
|
if (extentCoordinates && extentCoordinates.length === 4) {
|
|
213
224
|
const minx = extentCoordinates[0];
|
|
@@ -221,10 +232,10 @@ class ViewPoint extends VcsObject {
|
|
|
221
232
|
if (delta < 0.001) {
|
|
222
233
|
distance = 400;
|
|
223
234
|
} else {
|
|
224
|
-
distance =
|
|
235
|
+
distance = delta * 300000;
|
|
225
236
|
}
|
|
226
237
|
|
|
227
|
-
return new
|
|
238
|
+
return new Viewpoint({
|
|
228
239
|
name: 'viewpointFromExtend',
|
|
229
240
|
distance,
|
|
230
241
|
groundPosition: center,
|
|
@@ -238,18 +249,18 @@ class ViewPoint extends VcsObject {
|
|
|
238
249
|
}
|
|
239
250
|
|
|
240
251
|
/**
|
|
241
|
-
* creates a new
|
|
252
|
+
* creates a new Viewpoint Object from url Paramter
|
|
242
253
|
* @param {Object} urlParameter
|
|
243
|
-
* @returns {
|
|
254
|
+
* @returns {Viewpoint}
|
|
244
255
|
*/
|
|
245
256
|
static parseURLparameter(urlParameter) {
|
|
246
257
|
let { cameraPosition, groundPosition } = urlParameter;
|
|
247
258
|
if (cameraPosition != null) {
|
|
248
|
-
cameraPosition = cameraPosition.split(',').map(c => Number(c));
|
|
259
|
+
cameraPosition = cameraPosition.split(',').map((c) => Number(c));
|
|
249
260
|
}
|
|
250
261
|
|
|
251
262
|
if (groundPosition != null) {
|
|
252
|
-
groundPosition = groundPosition.split(',').map(c => Number(c));
|
|
263
|
+
groundPosition = groundPosition.split(',').map((c) => Number(c));
|
|
253
264
|
}
|
|
254
265
|
|
|
255
266
|
if (urlParameter.epsg != null) {
|
|
@@ -257,10 +268,18 @@ class ViewPoint extends VcsObject {
|
|
|
257
268
|
const srcProjection = new Projection({ epsg, proj4: proj4String });
|
|
258
269
|
const destProjection = wgs84Projection;
|
|
259
270
|
if (groundPosition) {
|
|
260
|
-
groundPosition = Projection.transform(
|
|
271
|
+
groundPosition = Projection.transform(
|
|
272
|
+
destProjection,
|
|
273
|
+
srcProjection,
|
|
274
|
+
groundPosition,
|
|
275
|
+
);
|
|
261
276
|
}
|
|
262
277
|
if (cameraPosition) {
|
|
263
|
-
cameraPosition = Projection.transform(
|
|
278
|
+
cameraPosition = Projection.transform(
|
|
279
|
+
destProjection,
|
|
280
|
+
srcProjection,
|
|
281
|
+
cameraPosition,
|
|
282
|
+
);
|
|
264
283
|
}
|
|
265
284
|
}
|
|
266
285
|
|
|
@@ -273,7 +292,7 @@ class ViewPoint extends VcsObject {
|
|
|
273
292
|
roll: Number(urlParameter.roll),
|
|
274
293
|
};
|
|
275
294
|
|
|
276
|
-
return new
|
|
295
|
+
return new Viewpoint(options);
|
|
277
296
|
}
|
|
278
297
|
|
|
279
298
|
/**
|
|
@@ -283,15 +302,17 @@ class ViewPoint extends VcsObject {
|
|
|
283
302
|
* @returns {boolean}
|
|
284
303
|
*/
|
|
285
304
|
isValid() {
|
|
286
|
-
const hasCamera =
|
|
305
|
+
const hasCamera =
|
|
306
|
+
this.cameraPosition &&
|
|
287
307
|
Array.isArray(this.cameraPosition) &&
|
|
288
308
|
this.cameraPosition.length === 3 &&
|
|
289
|
-
this.cameraPosition.every(position => Number.isFinite(position));
|
|
290
|
-
const hasGround =
|
|
309
|
+
this.cameraPosition.every((position) => Number.isFinite(position));
|
|
310
|
+
const hasGround =
|
|
311
|
+
this.groundPosition &&
|
|
291
312
|
Array.isArray(this.groundPosition) &&
|
|
292
313
|
this.groundPosition.length > 1 &&
|
|
293
314
|
this.groundPosition.length < 4 &&
|
|
294
|
-
this.groundPosition.every(position => Number.isFinite(position));
|
|
315
|
+
this.groundPosition.every((position) => Number.isFinite(position));
|
|
295
316
|
if (!hasGround && !hasCamera) {
|
|
296
317
|
return false;
|
|
297
318
|
}
|
|
@@ -312,25 +333,30 @@ class ViewPoint extends VcsObject {
|
|
|
312
333
|
|
|
313
334
|
/**
|
|
314
335
|
* compares the provided Viewpoint with this viewpoint componentwise
|
|
315
|
-
* @param {
|
|
336
|
+
* @param {Viewpoint} other
|
|
316
337
|
* @param {number} [epsilon=0]
|
|
317
338
|
* @returns {boolean}
|
|
318
339
|
*/
|
|
319
340
|
equals(other, epsilon = 0) {
|
|
320
|
-
return
|
|
321
|
-
other
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
coordinateEqualsEpsilon(
|
|
328
|
-
|
|
329
|
-
|
|
341
|
+
return (
|
|
342
|
+
other === this ||
|
|
343
|
+
(other !== null &&
|
|
344
|
+
propertyEqualsEpsilon(other.distance, this.distance, epsilon) &&
|
|
345
|
+
angleEqualsEpsilon(other.heading, this.heading, epsilon) &&
|
|
346
|
+
angleEqualsEpsilon(other.pitch, this.pitch, epsilon) &&
|
|
347
|
+
angleEqualsEpsilon(other.roll, this.roll, epsilon) &&
|
|
348
|
+
(coordinateEqualsEpsilon(
|
|
349
|
+
other.cameraPosition,
|
|
350
|
+
this.cameraPosition,
|
|
351
|
+
epsilon,
|
|
352
|
+
) ||
|
|
353
|
+
coordinateEqualsEpsilon(
|
|
354
|
+
other.groundPosition,
|
|
355
|
+
this.groundPosition,
|
|
356
|
+
epsilon,
|
|
357
|
+
)))
|
|
330
358
|
);
|
|
331
359
|
}
|
|
332
360
|
}
|
|
333
361
|
|
|
334
|
-
export default
|
|
335
|
-
|
|
336
|
-
VcsClassRegistry.registerClass(ViewPoint.className, ViewPoint);
|
|
362
|
+
export default Viewpoint;
|