@vcmap/core 5.0.0-rc.3 → 5.0.0-rc.31
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 +3480 -2008
- 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} +83 -70
- 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} +8 -9
- 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 -112
- 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 +95 -0
- package/src/{vcs/vcm/layer/terrain.js → layer/terrainLayer.js} +28 -21
- 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 +64 -37
- package/src/{vcs/vcm/maps/cesium.js → map/cesiumMap.js} +431 -277
- 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} +151 -55
- package/src/{vcs/vcm/oblique/ObliqueDataSet.js → oblique/obliqueDataSet.js} +77 -46
- 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 +79 -49
- 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 +45 -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,13 +1,13 @@
|
|
|
1
|
-
import { Math as CesiumMath } from '@vcmap/
|
|
1
|
+
import { Math as CesiumMath } from '@vcmap-cesium/engine';
|
|
2
2
|
import View from 'ol/View.js';
|
|
3
3
|
import { getTransform } from 'ol/proj.js';
|
|
4
4
|
import { inAndOut } from 'ol/easing.js';
|
|
5
5
|
import { boundingExtent, containsXY } from 'ol/extent.js';
|
|
6
6
|
import { parseBoolean } from '@vcsuite/parsers';
|
|
7
|
-
import
|
|
7
|
+
import Viewpoint from '../util/viewpoint.js';
|
|
8
8
|
import BaseOLMap from './baseOLMap.js';
|
|
9
|
-
import VcsMap from './
|
|
10
|
-
import {
|
|
9
|
+
import VcsMap from './vcsMap.js';
|
|
10
|
+
import { mapClassRegistry } from '../classRegistry.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @typedef {VcsMapOptions} OpenlayersOptions
|
|
@@ -16,17 +16,18 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* OpenlayersMap Map Class (2D map)
|
|
20
20
|
* @class
|
|
21
|
-
* @export
|
|
22
21
|
* @extends {BaseOLMap}
|
|
23
22
|
* @api stable
|
|
24
23
|
*/
|
|
25
|
-
class
|
|
24
|
+
class OpenlayersMap extends BaseOLMap {
|
|
26
25
|
/**
|
|
27
26
|
* @type {string}
|
|
28
27
|
*/
|
|
29
|
-
static get className() {
|
|
28
|
+
static get className() {
|
|
29
|
+
return 'OpenlayersMap';
|
|
30
|
+
}
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* @returns {OpenlayersOptions}
|
|
@@ -44,10 +45,13 @@ class Openlayers extends BaseOLMap {
|
|
|
44
45
|
constructor(options) {
|
|
45
46
|
super(options);
|
|
46
47
|
|
|
47
|
-
const defaultOptions =
|
|
48
|
+
const defaultOptions = OpenlayersMap.getDefaultOptions();
|
|
48
49
|
|
|
49
50
|
/** @type {boolean} */
|
|
50
|
-
this.fixedNorthOrientation = parseBoolean(
|
|
51
|
+
this.fixedNorthOrientation = parseBoolean(
|
|
52
|
+
options.fixedNorthOrientation,
|
|
53
|
+
defaultOptions.fixedNorthOrientation,
|
|
54
|
+
);
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
/**
|
|
@@ -56,27 +60,29 @@ class Openlayers extends BaseOLMap {
|
|
|
56
60
|
async initialize() {
|
|
57
61
|
if (!this.initialized) {
|
|
58
62
|
await super.initialize();
|
|
59
|
-
this.olMap.setView(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
this.olMap.setView(
|
|
64
|
+
new View({
|
|
65
|
+
center: [1230922.6203948376, 6350766.117974091],
|
|
66
|
+
zoom: 13,
|
|
67
|
+
}),
|
|
68
|
+
);
|
|
63
69
|
this.initialized = true;
|
|
64
70
|
}
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
/**
|
|
68
74
|
* @inheritDoc
|
|
69
|
-
* @returns {Promise<
|
|
75
|
+
* @returns {Promise<Viewpoint>}
|
|
70
76
|
*/
|
|
71
|
-
async
|
|
72
|
-
return this.
|
|
77
|
+
async getViewpoint() {
|
|
78
|
+
return this.getViewpointSync();
|
|
73
79
|
}
|
|
74
80
|
|
|
75
81
|
/**
|
|
76
82
|
* @inheritDoc
|
|
77
|
-
* @returns {
|
|
83
|
+
* @returns {Viewpoint}
|
|
78
84
|
*/
|
|
79
|
-
|
|
85
|
+
getViewpointSync() {
|
|
80
86
|
const view = this.olMap.getView();
|
|
81
87
|
const coord = view.getCenter();
|
|
82
88
|
const toLatLon = getTransform(view.getProjection(), 'EPSG:4326');
|
|
@@ -87,20 +93,24 @@ class Openlayers extends BaseOLMap {
|
|
|
87
93
|
size.width = viewport.offsetWidth || 1;
|
|
88
94
|
const aspectRatio = size.width / size.height;
|
|
89
95
|
const fovy = Math.atan(Math.tan(fov * 0.5) / aspectRatio) * 2.0;
|
|
90
|
-
|
|
96
|
+
// error in TransformFunction type definition, remove undefined after openlayer fixed the type
|
|
97
|
+
const latlon = toLatLon(coord.slice(0, 2), undefined, undefined);
|
|
91
98
|
const metersPerUnit = view.getProjection().getMetersPerUnit();
|
|
92
99
|
|
|
93
100
|
const resolution = view.getResolution();
|
|
94
101
|
const visibleMapUnits = resolution * size.height;
|
|
95
|
-
const relativeCircumference = Math.cos(
|
|
96
|
-
|
|
97
|
-
|
|
102
|
+
const relativeCircumference = Math.cos(
|
|
103
|
+
Math.abs(CesiumMath.toRadians(latlon[1])),
|
|
104
|
+
);
|
|
105
|
+
const visibleMeters =
|
|
106
|
+
visibleMapUnits * metersPerUnit * relativeCircumference;
|
|
107
|
+
const height = Math.abs(visibleMeters / 2 / Math.tan(fovy / 2));
|
|
98
108
|
|
|
99
109
|
const heading = -CesiumMath.toDegrees(view.getRotation());
|
|
100
110
|
// don't add 0;
|
|
101
111
|
const groundPosition = latlon; // .concat([0]);
|
|
102
112
|
const pitch = -90;
|
|
103
|
-
return new
|
|
113
|
+
return new Viewpoint({
|
|
104
114
|
groundPosition,
|
|
105
115
|
pitch,
|
|
106
116
|
heading,
|
|
@@ -109,16 +119,17 @@ class Openlayers extends BaseOLMap {
|
|
|
109
119
|
}
|
|
110
120
|
|
|
111
121
|
/**
|
|
112
|
-
* @param {
|
|
122
|
+
* @param {Viewpoint} viewpoint
|
|
113
123
|
* @returns {Promise<void>}
|
|
114
124
|
* @inheritDoc
|
|
115
125
|
*/
|
|
116
|
-
|
|
126
|
+
gotoViewpoint(viewpoint) {
|
|
117
127
|
if (this.movementDisabled || !viewpoint.isValid()) {
|
|
118
128
|
return Promise.resolve();
|
|
119
129
|
}
|
|
130
|
+
let { heading } = viewpoint;
|
|
120
131
|
if (this.fixedNorthOrientation) {
|
|
121
|
-
|
|
132
|
+
heading = 0;
|
|
122
133
|
}
|
|
123
134
|
const view = this.olMap.getView();
|
|
124
135
|
const fromLatLon = getTransform('EPSG:4326', view.getProjection());
|
|
@@ -129,7 +140,8 @@ class Openlayers extends BaseOLMap {
|
|
|
129
140
|
coords = viewpoint.cameraPosition.slice(0, 2);
|
|
130
141
|
}
|
|
131
142
|
const { distance } = viewpoint;
|
|
132
|
-
|
|
143
|
+
// error in TransformFunction type definition, remove undefined after openlayer fixed the type
|
|
144
|
+
const center = fromLatLon(coords, undefined, undefined);
|
|
133
145
|
|
|
134
146
|
const fov = Math.PI / 3.0;
|
|
135
147
|
const viewport = this.olMap.getViewport();
|
|
@@ -140,30 +152,38 @@ class Openlayers extends BaseOLMap {
|
|
|
140
152
|
const fovy = Math.atan(Math.tan(fov * 0.5) / aspectRatio) * 2.0;
|
|
141
153
|
const visibleMeters = 2 * distance * Math.tan(fovy / 2);
|
|
142
154
|
const metersPerUnit = view.getProjection().getMetersPerUnit();
|
|
143
|
-
const relativeCircumference = Math.cos(
|
|
144
|
-
|
|
155
|
+
const relativeCircumference = Math.cos(
|
|
156
|
+
Math.abs(CesiumMath.toRadians(coords[1])),
|
|
157
|
+
);
|
|
158
|
+
const visibleMapUnits =
|
|
159
|
+
visibleMeters / metersPerUnit / relativeCircumference;
|
|
145
160
|
|
|
146
161
|
const resolution = visibleMapUnits / size.height;
|
|
147
162
|
|
|
148
163
|
if (viewpoint.animate) {
|
|
149
164
|
let rotation = 0;
|
|
150
|
-
if (!this.fixedNorthOrientation &&
|
|
151
|
-
rotation = -CesiumMath.toRadians(
|
|
165
|
+
if (!this.fixedNorthOrientation && heading != null) {
|
|
166
|
+
rotation = -CesiumMath.toRadians(heading);
|
|
152
167
|
}
|
|
153
168
|
return new Promise((resolve) => {
|
|
154
|
-
view.animate(
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
169
|
+
view.animate(
|
|
170
|
+
{
|
|
171
|
+
duration: viewpoint.duration ? viewpoint.duration * 1000 : 100,
|
|
172
|
+
center,
|
|
173
|
+
easing: inAndOut, // XXX map to viewpoint easingFunctionName?
|
|
174
|
+
resolution,
|
|
175
|
+
rotation,
|
|
176
|
+
},
|
|
177
|
+
() => {
|
|
178
|
+
resolve();
|
|
179
|
+
},
|
|
180
|
+
);
|
|
161
181
|
});
|
|
162
182
|
} else {
|
|
163
183
|
view.setCenter(center);
|
|
164
184
|
view.setResolution(resolution);
|
|
165
|
-
if (!this.fixedNorthOrientation &&
|
|
166
|
-
view.setRotation(-CesiumMath.toRadians(
|
|
185
|
+
if (!this.fixedNorthOrientation && heading != null) {
|
|
186
|
+
view.setRotation(-CesiumMath.toRadians(heading));
|
|
167
187
|
}
|
|
168
188
|
}
|
|
169
189
|
return Promise.resolve();
|
|
@@ -180,7 +200,11 @@ class Openlayers extends BaseOLMap {
|
|
|
180
200
|
const toLatLon = getTransform(view.getProjection(), 'EPSG:4326');
|
|
181
201
|
const topLeft = [extent[0], extent[3]];
|
|
182
202
|
const bottomRight = [extent[2], extent[1]];
|
|
183
|
-
|
|
203
|
+
// error in TransformFunction type definition, remove undefined after openlayer fixed the type
|
|
204
|
+
const bbox = [
|
|
205
|
+
toLatLon(topLeft, undefined, undefined),
|
|
206
|
+
toLatLon(bottomRight, undefined, undefined),
|
|
207
|
+
];
|
|
184
208
|
|
|
185
209
|
return containsXY(boundingExtent(bbox), coords[0], coords[1]);
|
|
186
210
|
}
|
|
@@ -192,7 +216,7 @@ class Openlayers extends BaseOLMap {
|
|
|
192
216
|
toJSON() {
|
|
193
217
|
const config = /** @type {OpenlayersOptions} */ (super.toJSON());
|
|
194
218
|
|
|
195
|
-
const defaultOptions =
|
|
219
|
+
const defaultOptions = OpenlayersMap.getDefaultOptions();
|
|
196
220
|
if (this.fixedNorthOrientation !== defaultOptions.fixedNorthOrientation) {
|
|
197
221
|
config.fixedNorthOrientation = this.fixedNorthOrientation;
|
|
198
222
|
}
|
|
@@ -201,5 +225,5 @@ class Openlayers extends BaseOLMap {
|
|
|
201
225
|
}
|
|
202
226
|
}
|
|
203
227
|
|
|
204
|
-
|
|
205
|
-
export default
|
|
228
|
+
mapClassRegistry.registerClass(OpenlayersMap.className, OpenlayersMap);
|
|
229
|
+
export default OpenlayersMap;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { v4 as uuidv4 } from 'uuid';
|
|
2
2
|
import { check, checkMaybe } from '@vcsuite/check';
|
|
3
|
-
import VcsObject from '../
|
|
3
|
+
import VcsObject from '../vcsObject.js';
|
|
4
4
|
import LayerCollection from '../util/layerCollection.js';
|
|
5
5
|
import MapState from './mapState.js';
|
|
6
6
|
import { vcsLayerName } from '../layer/layerSymbols.js';
|
|
7
|
-
import VcsEvent from '../
|
|
8
|
-
import {
|
|
7
|
+
import VcsEvent from '../vcsEvent.js';
|
|
8
|
+
import { mapClassRegistry } from '../classRegistry.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @namespace maps
|
|
@@ -31,6 +31,12 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
31
31
|
* @api stable
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* @typedef {Object} VcsMapRenderEvent
|
|
36
|
+
* @property {VcsMap} map
|
|
37
|
+
* @property {import("ol").MapEvent|CesiumMapEvent} originalEvent
|
|
38
|
+
*/
|
|
39
|
+
|
|
34
40
|
/**
|
|
35
41
|
* @type {Object}
|
|
36
42
|
*/
|
|
@@ -44,9 +50,13 @@ const specificLayerImpl = {};
|
|
|
44
50
|
* @api stable
|
|
45
51
|
*/
|
|
46
52
|
class VcsMap extends VcsObject {
|
|
47
|
-
static get className() {
|
|
53
|
+
static get className() {
|
|
54
|
+
return 'VcsMap';
|
|
55
|
+
}
|
|
48
56
|
|
|
49
|
-
static get specificLayerImpl() {
|
|
57
|
+
static get specificLayerImpl() {
|
|
58
|
+
return specificLayerImpl;
|
|
59
|
+
}
|
|
50
60
|
|
|
51
61
|
/**
|
|
52
62
|
* @returns {VcsMapOptions}
|
|
@@ -101,17 +111,9 @@ class VcsMap extends VcsObject {
|
|
|
101
111
|
* @type {Array<Function>}
|
|
102
112
|
* @private
|
|
103
113
|
*/
|
|
104
|
-
this._collectionListeners = [
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}),
|
|
108
|
-
this.layerCollection.added.addEventListener((layer) => {
|
|
109
|
-
this._layerAdded(layer);
|
|
110
|
-
}),
|
|
111
|
-
this.layerCollection.removed.addEventListener((layer) => {
|
|
112
|
-
this._layerRemoved(layer);
|
|
113
|
-
}),
|
|
114
|
-
];
|
|
114
|
+
this._collectionListeners = [];
|
|
115
|
+
|
|
116
|
+
this._setLayerCollectionListeners();
|
|
115
117
|
|
|
116
118
|
/** @type {boolean} */
|
|
117
119
|
this.initialized = false;
|
|
@@ -131,7 +133,7 @@ class VcsMap extends VcsObject {
|
|
|
131
133
|
this.fallbackMap = options.fallbackMap || null;
|
|
132
134
|
|
|
133
135
|
/**
|
|
134
|
-
* @type {Map<string, Set<import("@vcmap/
|
|
136
|
+
* @type {Map<string, Set<import("@vcmap-cesium/engine").CustomDataSource|import("@vcmap-cesium/engine").CzmlDataSource|import("@vcmap-cesium/engine").PrimitiveCollection|import("@vcmap-cesium/engine").Cesium3DTileset|import("@vcmap-cesium/engine").ImageryLayer|import("ol/layer/Layer").default<import("ol/source").Source>>>}
|
|
135
137
|
* @private
|
|
136
138
|
*/
|
|
137
139
|
this._visualizations = new Map();
|
|
@@ -155,11 +157,15 @@ class VcsMap extends VcsObject {
|
|
|
155
157
|
*/
|
|
156
158
|
this.pointerInteractionEvent = new VcsEvent();
|
|
157
159
|
/**
|
|
158
|
-
*
|
|
159
|
-
* @type {
|
|
160
|
-
* @api
|
|
160
|
+
* The split position to use on this map. Is set by the mapCollection
|
|
161
|
+
* @type {number}
|
|
161
162
|
*/
|
|
162
|
-
this.
|
|
163
|
+
this._splitPosition = 0.5;
|
|
164
|
+
/**
|
|
165
|
+
* @type {VcsEvent<VcsMapRenderEvent>}
|
|
166
|
+
* @private
|
|
167
|
+
*/
|
|
168
|
+
this._postRender = new VcsEvent();
|
|
163
169
|
}
|
|
164
170
|
|
|
165
171
|
/**
|
|
@@ -221,11 +227,63 @@ class VcsMap extends VcsObject {
|
|
|
221
227
|
l.mapActivated(this);
|
|
222
228
|
});
|
|
223
229
|
}
|
|
230
|
+
|
|
231
|
+
this._setLayerCollectionListeners();
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* @type {number}
|
|
236
|
+
*/
|
|
237
|
+
get splitPosition() {
|
|
238
|
+
return this._splitPosition;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* The splitPosition should always be aligned with the mapCollection's splitPosition.
|
|
243
|
+
* Use mapCollection to change splitPosition.
|
|
244
|
+
* @param {number} position
|
|
245
|
+
*/
|
|
246
|
+
set splitPosition(position) {
|
|
247
|
+
check(position, Number);
|
|
248
|
+
if (position < 0 || position > 1) {
|
|
249
|
+
throw new Error('Position must be between 0 and 1');
|
|
250
|
+
}
|
|
251
|
+
this._splitPosition = position;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* An event raised on the maps post render
|
|
256
|
+
* @type {VcsEvent<VcsMapRenderEvent>}
|
|
257
|
+
* @readonly
|
|
258
|
+
*/
|
|
259
|
+
get postRender() {
|
|
260
|
+
return this._postRender;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* @private
|
|
265
|
+
*/
|
|
266
|
+
_setLayerCollectionListeners() {
|
|
267
|
+
this._collectionListeners.forEach((cb) => {
|
|
268
|
+
cb();
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
this._collectionListeners = [
|
|
272
|
+
this.layerCollection.moved.addEventListener((layer) => {
|
|
273
|
+
this.indexChanged(layer);
|
|
274
|
+
}),
|
|
275
|
+
this.layerCollection.added.addEventListener((layer) => {
|
|
276
|
+
this._layerAdded(layer);
|
|
277
|
+
}),
|
|
278
|
+
this.layerCollection.removed.addEventListener((layer) => {
|
|
279
|
+
this._layerRemoved(layer);
|
|
280
|
+
}),
|
|
281
|
+
];
|
|
224
282
|
}
|
|
225
283
|
|
|
226
284
|
/**
|
|
227
285
|
* Determines whether this map can show this viewpoint. Returns true in any other map then {@link Oblique}
|
|
228
|
-
* @param {import("@vcmap/core").
|
|
286
|
+
* @param {import("@vcmap/core").Viewpoint} viewpoint
|
|
229
287
|
* @returns {Promise<boolean>}
|
|
230
288
|
* @api
|
|
231
289
|
*/
|
|
@@ -246,7 +304,8 @@ class VcsMap extends VcsObject {
|
|
|
246
304
|
this._target.removeChild(this.mapElement);
|
|
247
305
|
}
|
|
248
306
|
|
|
249
|
-
this._target =
|
|
307
|
+
this._target =
|
|
308
|
+
typeof target === 'string' ? document.getElementById(target) : target;
|
|
250
309
|
if (this._target) {
|
|
251
310
|
this._target.appendChild(this.mapElement);
|
|
252
311
|
}
|
|
@@ -288,7 +347,7 @@ class VcsMap extends VcsObject {
|
|
|
288
347
|
/**
|
|
289
348
|
* Validates a visualization. A visualization must have the vcsLayeName symbol set and a layer with said name must be
|
|
290
349
|
* part of the maps layerCollection.
|
|
291
|
-
* @param {import("@vcmap/
|
|
350
|
+
* @param {import("@vcmap-cesium/engine").CustomDataSource|import("@vcmap-cesium/engine").PrimitiveCollection|import("@vcmap-cesium/engine").Cesium3DTileset|import("@vcmap-cesium/engine").ImageryLayer|import("ol/layer/Layer").default<import("ol/source").Source>} item
|
|
292
351
|
* @returns {boolean}
|
|
293
352
|
*/
|
|
294
353
|
validateVisualization(item) {
|
|
@@ -303,11 +362,13 @@ class VcsMap extends VcsObject {
|
|
|
303
362
|
|
|
304
363
|
/**
|
|
305
364
|
* Adds a visualization to the visualizations map for its layer. The visualization must be valid, use validateVisualization first
|
|
306
|
-
* @param {import("@vcmap/
|
|
365
|
+
* @param {import("@vcmap-cesium/engine").CustomDataSource|import("@vcmap-cesium/engine").PrimitiveCollection|import("@vcmap-cesium/engine").Cesium3DTileset|import("@vcmap-cesium/engine").ImageryLayer|import("ol/layer/Layer").default<import("ol/source").Source>} item
|
|
307
366
|
*/
|
|
308
367
|
addVisualization(item) {
|
|
309
368
|
if (!this.validateVisualization(item)) {
|
|
310
|
-
throw new Error(
|
|
369
|
+
throw new Error(
|
|
370
|
+
'Visualization item is not valid, validate before adding',
|
|
371
|
+
);
|
|
311
372
|
}
|
|
312
373
|
const layerName = item[vcsLayerName];
|
|
313
374
|
if (!this._visualizations.has(layerName)) {
|
|
@@ -318,7 +379,7 @@ class VcsMap extends VcsObject {
|
|
|
318
379
|
|
|
319
380
|
/**
|
|
320
381
|
* Removes a visualization
|
|
321
|
-
* @param {import("@vcmap/
|
|
382
|
+
* @param {import("@vcmap-cesium/engine").PrimitiveCollection|import("@vcmap-cesium/engine").Cesium3DTileset|import("@vcmap-cesium/engine").ImageryLayer|import("ol/layer/Layer").default<import("ol/source").Source>|import("@vcmap-cesium/engine").CustomDataSource} item
|
|
322
383
|
*/
|
|
323
384
|
removeVisualization(item) {
|
|
324
385
|
const layerName = item[vcsLayerName];
|
|
@@ -334,7 +395,7 @@ class VcsMap extends VcsObject {
|
|
|
334
395
|
/**
|
|
335
396
|
* Gets the visualizations for a specific layer.
|
|
336
397
|
* @param {import("@vcmap/core").Layer} layer
|
|
337
|
-
* @returns {Set<import("@vcmap/
|
|
398
|
+
* @returns {Set<import("@vcmap-cesium/engine").PrimitiveCollection|import("@vcmap-cesium/engine").Cesium3DTileset|import("@vcmap-cesium/engine").ImageryLayer|import("ol/layer/Layer").default<import("ol/source").Source>|import("@vcmap-cesium/engine").CustomDataSource>}
|
|
338
399
|
* @api
|
|
339
400
|
*/
|
|
340
401
|
getVisualizationsForLayer(layer) {
|
|
@@ -343,12 +404,12 @@ class VcsMap extends VcsObject {
|
|
|
343
404
|
|
|
344
405
|
/**
|
|
345
406
|
* Get all visualizations added to this map.
|
|
346
|
-
* @returns {Array<import("@vcmap/
|
|
407
|
+
* @returns {Array<import("@vcmap-cesium/engine").PrimitiveCollection|import("@vcmap-cesium/engine").Cesium3DTileset|import("@vcmap-cesium/engine").ImageryLayer|import("ol/layer/Layer").default<import("ol/source").Source>|import("@vcmap-cesium/engine").CustomDataSource>}
|
|
347
408
|
* @api
|
|
348
409
|
*/
|
|
349
410
|
getVisualizations() {
|
|
350
411
|
return [...this._visualizations.values()]
|
|
351
|
-
.map(layerVisualizations => [...layerVisualizations])
|
|
412
|
+
.map((layerVisualizations) => [...layerVisualizations])
|
|
352
413
|
.flat();
|
|
353
414
|
}
|
|
354
415
|
|
|
@@ -368,7 +429,9 @@ class VcsMap extends VcsObject {
|
|
|
368
429
|
return;
|
|
369
430
|
}
|
|
370
431
|
this._state = MapState.ACTIVE;
|
|
371
|
-
await Promise.all(
|
|
432
|
+
await Promise.all(
|
|
433
|
+
[...this.layerCollection].map((layer) => layer.mapActivated(this)),
|
|
434
|
+
);
|
|
372
435
|
if (this._state !== MapState.ACTIVE) {
|
|
373
436
|
return;
|
|
374
437
|
}
|
|
@@ -392,7 +455,7 @@ class VcsMap extends VcsObject {
|
|
|
392
455
|
}
|
|
393
456
|
|
|
394
457
|
/**
|
|
395
|
-
* prevent all movement, including navigation controls,
|
|
458
|
+
* prevent all movement, including navigation controls, gotoViewpoint & setting of oblique images
|
|
396
459
|
* @param {boolean} prevent
|
|
397
460
|
* @api
|
|
398
461
|
*/
|
|
@@ -402,35 +465,35 @@ class VcsMap extends VcsObject {
|
|
|
402
465
|
|
|
403
466
|
/**
|
|
404
467
|
* sets the view to the given viewpoint
|
|
405
|
-
* @param {import("@vcmap/core").
|
|
468
|
+
* @param {import("@vcmap/core").Viewpoint} viewpoint
|
|
406
469
|
* @param {number=} optMaximumHeight during animation (can be used to get rid of the bunny hop)
|
|
407
|
-
*
|
|
470
|
+
* gotoViewpoint
|
|
408
471
|
* @returns {Promise<void>}
|
|
409
472
|
* @api stable
|
|
410
473
|
*/
|
|
411
474
|
// eslint-disable-next-line no-unused-vars,class-methods-use-this
|
|
412
|
-
|
|
475
|
+
gotoViewpoint(viewpoint, optMaximumHeight) {
|
|
413
476
|
return Promise.resolve();
|
|
414
477
|
}
|
|
415
478
|
|
|
416
479
|
// eslint-disable-next-line jsdoc/require-returns-check
|
|
417
480
|
/**
|
|
418
|
-
* Returns the most precise viewpoint possible in
|
|
481
|
+
* Returns the most precise viewpoint possible in ObliqueMap.
|
|
419
482
|
* @api
|
|
420
|
-
* @returns {Promise<import("@vcmap/core").
|
|
483
|
+
* @returns {Promise<import("@vcmap/core").Viewpoint|null>}
|
|
421
484
|
*/
|
|
422
485
|
// eslint-disable-next-line class-methods-use-this
|
|
423
|
-
async
|
|
486
|
+
async getViewpoint() {
|
|
424
487
|
return null;
|
|
425
488
|
}
|
|
426
489
|
|
|
427
490
|
/**
|
|
428
|
-
* Returns an approximate viewpoint in
|
|
491
|
+
* Returns an approximate viewpoint in ObliqueMap, not requesting terrain.
|
|
429
492
|
* @api
|
|
430
|
-
* @returns {import("@vcmap/core").
|
|
493
|
+
* @returns {import("@vcmap/core").Viewpoint|null}
|
|
431
494
|
*/
|
|
432
495
|
// eslint-disable-next-line class-methods-use-this
|
|
433
|
-
|
|
496
|
+
getViewpointSync() {
|
|
434
497
|
return null;
|
|
435
498
|
}
|
|
436
499
|
|
|
@@ -451,7 +514,9 @@ class VcsMap extends VcsObject {
|
|
|
451
514
|
* @api
|
|
452
515
|
*/
|
|
453
516
|
// eslint-disable-next-line no-unused-vars,class-methods-use-this
|
|
454
|
-
pointIsVisible(coords) {
|
|
517
|
+
pointIsVisible(coords) {
|
|
518
|
+
return false;
|
|
519
|
+
}
|
|
455
520
|
|
|
456
521
|
/**
|
|
457
522
|
* Requests this map to render when possible
|
|
@@ -486,16 +551,22 @@ class VcsMap extends VcsObject {
|
|
|
486
551
|
}
|
|
487
552
|
this._target = null;
|
|
488
553
|
|
|
489
|
-
this._collectionListeners.forEach((cb) => {
|
|
554
|
+
this._collectionListeners.forEach((cb) => {
|
|
555
|
+
cb();
|
|
556
|
+
});
|
|
490
557
|
this._collectionListeners = [];
|
|
491
558
|
|
|
492
|
-
|
|
559
|
+
if (this.layerCollection) {
|
|
560
|
+
[...this.layerCollection].forEach((l) => {
|
|
561
|
+
l.removedFromMap(this);
|
|
562
|
+
});
|
|
563
|
+
}
|
|
493
564
|
if (this.stateChanged) {
|
|
494
565
|
this.stateChanged.destroy();
|
|
495
566
|
this.stateChanged = null;
|
|
496
567
|
}
|
|
497
568
|
|
|
498
|
-
if (this.destroyLayerCollection) {
|
|
569
|
+
if (this.destroyLayerCollection && this.layerCollection) {
|
|
499
570
|
this.layerCollection.destroy();
|
|
500
571
|
}
|
|
501
572
|
|
|
@@ -504,8 +575,9 @@ class VcsMap extends VcsObject {
|
|
|
504
575
|
this.pointerInteractionEvent = null;
|
|
505
576
|
}
|
|
506
577
|
this._layerCollection = null;
|
|
578
|
+
this._postRender.destroy();
|
|
507
579
|
}
|
|
508
580
|
}
|
|
509
581
|
|
|
510
|
-
|
|
582
|
+
mapClassRegistry.registerClass(VcsMap.className, VcsMap);
|
|
511
583
|
export default VcsMap;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import ObliqueCollection from './obliqueCollection.js';
|
|
2
|
+
import ObliqueImage from './obliqueImage.js';
|
|
3
|
+
import ObliqueImageMeta from './obliqueImageMeta.js';
|
|
4
|
+
import { ObliqueViewDirection } from './obliqueViewDirection.js';
|
|
5
|
+
import { mercatorProjection } from '../util/projection.js';
|
|
6
|
+
|
|
7
|
+
const defaultMeta = new ObliqueImageMeta({
|
|
8
|
+
name: 'defaultObliqueMeta',
|
|
9
|
+
size: [512, 512],
|
|
10
|
+
tileSize: [512, 512],
|
|
11
|
+
tileResolution: [1],
|
|
12
|
+
projection: mercatorProjection,
|
|
13
|
+
format: 'png',
|
|
14
|
+
url: '',
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @type {symbol}
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
export const isDefaultImageSymbol = Symbol('isDefaultImage');
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* This is a special oblique collection wich is shown, if no other oblique collection is set on an ObliqueMap map.
|
|
25
|
+
* It will render a single image which indicates that no images can be loaded.
|
|
26
|
+
* @class
|
|
27
|
+
* @extends {ObliqueCollection}
|
|
28
|
+
*/
|
|
29
|
+
class DefaultObliqueCollection extends ObliqueCollection {
|
|
30
|
+
constructor() {
|
|
31
|
+
super({});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @param {import("ol/coordinate").Coordinate} mercatorCoordinate
|
|
36
|
+
* @param {ObliqueViewDirection} viewDirection
|
|
37
|
+
* @returns {ObliqueImage}
|
|
38
|
+
*/
|
|
39
|
+
// eslint-disable-next-line no-unused-vars
|
|
40
|
+
getImageForCoordinate(mercatorCoordinate, viewDirection) {
|
|
41
|
+
const groundCoordinates = [
|
|
42
|
+
[mercatorCoordinate[0] - 100, mercatorCoordinate[1] - 100, 0],
|
|
43
|
+
[mercatorCoordinate[0] + 100, mercatorCoordinate[1] - 100, 0],
|
|
44
|
+
[mercatorCoordinate[0] + 100, mercatorCoordinate[1] + 100, 0],
|
|
45
|
+
[mercatorCoordinate[0] - 100, mercatorCoordinate[1] + 100, 0],
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
const image = new ObliqueImage({
|
|
49
|
+
meta: defaultMeta,
|
|
50
|
+
viewDirection: ObliqueViewDirection.NORTH,
|
|
51
|
+
viewDirectionAngle: 0,
|
|
52
|
+
name: this.name,
|
|
53
|
+
groundCoordinates,
|
|
54
|
+
centerPointOnGround: mercatorCoordinate,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
image[isDefaultImageSymbol] = true;
|
|
58
|
+
return image;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default DefaultObliqueCollection;
|