@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,29 +1,17 @@
|
|
|
1
|
-
import { check } from '@vcsuite/check';
|
|
1
|
+
import { check, checkMaybe } from '@vcsuite/check';
|
|
2
2
|
import { parseBoolean, parseInteger } from '@vcsuite/parsers';
|
|
3
|
-
import VcsObject from '../
|
|
3
|
+
import VcsObject from '../vcsObject.js';
|
|
4
4
|
import Extent from '../util/extent.js';
|
|
5
|
-
import { getGlobalHider } from './globalHider.js';
|
|
6
5
|
import { vcsLayerName } from './layerSymbols.js';
|
|
7
6
|
import LayerState from './layerState.js';
|
|
8
|
-
import VcsEvent from '../
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @typedef {Object} GenericFeature
|
|
14
|
-
* @property {number} longitude
|
|
15
|
-
* @property {number} latitude
|
|
16
|
-
* @property {number} height
|
|
17
|
-
* @property {string} layerName
|
|
18
|
-
* @property {string} layerClass
|
|
19
|
-
* @property {any} attributes
|
|
20
|
-
* @property {boolean} relativeToGround
|
|
21
|
-
*/
|
|
7
|
+
import VcsEvent from '../vcsEvent.js';
|
|
8
|
+
import { layerClassRegistry } from '../classRegistry.js';
|
|
9
|
+
import GlobalHider from './globalHider.js';
|
|
22
10
|
|
|
23
11
|
/**
|
|
24
12
|
* @typedef {import("@vcmap/core").Layer} SplitLayer
|
|
25
|
-
* @property {import("@vcmap/
|
|
26
|
-
* @property {VcsEvent<import("@vcmap/
|
|
13
|
+
* @property {import("@vcmap-cesium/engine").SplitDirection} splitDirection
|
|
14
|
+
* @property {VcsEvent<import("@vcmap-cesium/engine").SplitDirection>} splitDirectionChanged
|
|
27
15
|
*/
|
|
28
16
|
|
|
29
17
|
/**
|
|
@@ -38,11 +26,12 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
38
26
|
/**
|
|
39
27
|
* @typedef {VectorPropertiesOptions} VcsMeta
|
|
40
28
|
* @property {string|undefined} version - the version of the vcsMeta schema
|
|
41
|
-
* @property {VectorStyleItemOptions|DeclarativeStyleItemOptions|
|
|
29
|
+
* @property {VectorStyleItemOptions|DeclarativeStyleItemOptions|undefined} style
|
|
42
30
|
* @property {Array<string>|undefined} embeddedIcons
|
|
43
31
|
* @property {number|undefined} screenSpaceError
|
|
44
32
|
* @property {*|undefined} flightOptions
|
|
45
33
|
* @property {string|undefined} baseUrl
|
|
34
|
+
* @property {Object|undefined} [layerProperties] - the layers properties bag
|
|
46
35
|
* @api
|
|
47
36
|
*/
|
|
48
37
|
|
|
@@ -69,6 +58,12 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
69
58
|
* @api
|
|
70
59
|
*/
|
|
71
60
|
|
|
61
|
+
/**
|
|
62
|
+
* @typedef {LayerImplementationOptions} SplitLayerImplementationOptions
|
|
63
|
+
* @property {import("@vcmap-cesium/engine").SplitDirection} splitDirection
|
|
64
|
+
* @api
|
|
65
|
+
*/
|
|
66
|
+
|
|
72
67
|
/**
|
|
73
68
|
* Layer implementations for the {@link CesiumMap} map
|
|
74
69
|
* @namespace cesium
|
|
@@ -92,7 +87,7 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
92
87
|
* @type {string}
|
|
93
88
|
* @const
|
|
94
89
|
*/
|
|
95
|
-
export const vcsMetaVersion = '2.
|
|
90
|
+
export const vcsMetaVersion = '2.1';
|
|
96
91
|
|
|
97
92
|
/**
|
|
98
93
|
* Abstract base class for Layers.
|
|
@@ -100,20 +95,23 @@ export const vcsMetaVersion = '2.0';
|
|
|
100
95
|
* To receive implementation options, implement `geImplementationOptions`
|
|
101
96
|
* @abstract
|
|
102
97
|
* @class
|
|
103
|
-
* @export
|
|
104
98
|
* @extends {VcsObject}
|
|
105
99
|
* @api stable
|
|
106
100
|
*/
|
|
107
101
|
class Layer extends VcsObject {
|
|
108
102
|
/** @type {string} */
|
|
109
|
-
static get className() {
|
|
103
|
+
static get className() {
|
|
104
|
+
return 'Layer';
|
|
105
|
+
}
|
|
110
106
|
|
|
111
107
|
/**
|
|
112
108
|
* Symbol to declare a layers name on its visualizations, e.g. ol.layer.Layer, Cesium.Cesium3DTileset
|
|
113
109
|
* @type {symbol}
|
|
114
110
|
* @api
|
|
115
111
|
*/
|
|
116
|
-
static get vcsLayerNameSymbol() {
|
|
112
|
+
static get vcsLayerNameSymbol() {
|
|
113
|
+
return vcsLayerName;
|
|
114
|
+
}
|
|
117
115
|
|
|
118
116
|
/** @returns {LayerOptions} */
|
|
119
117
|
static getDefaultOptions() {
|
|
@@ -149,12 +147,18 @@ class Layer extends VcsObject {
|
|
|
149
147
|
* @type {boolean}
|
|
150
148
|
* @api
|
|
151
149
|
*/
|
|
152
|
-
this.activeOnStartup = parseBoolean(
|
|
150
|
+
this.activeOnStartup = parseBoolean(
|
|
151
|
+
options.activeOnStartup,
|
|
152
|
+
defaultOptions.activeOnStartup,
|
|
153
|
+
);
|
|
153
154
|
/**
|
|
154
155
|
* @type {boolean}
|
|
155
156
|
* @private
|
|
156
157
|
*/
|
|
157
|
-
this._allowPicking = parseBoolean(
|
|
158
|
+
this._allowPicking = parseBoolean(
|
|
159
|
+
options.allowPicking,
|
|
160
|
+
defaultOptions.allowPicking,
|
|
161
|
+
);
|
|
158
162
|
/**
|
|
159
163
|
* @type {LayerState}
|
|
160
164
|
* @private
|
|
@@ -188,16 +192,10 @@ class Layer extends VcsObject {
|
|
|
188
192
|
|
|
189
193
|
/**
|
|
190
194
|
* @type {string|Object}
|
|
191
|
-
* @
|
|
195
|
+
* @protected
|
|
192
196
|
*/
|
|
193
197
|
this._url = options.url;
|
|
194
198
|
|
|
195
|
-
/**
|
|
196
|
-
* @type {Function}
|
|
197
|
-
* @private
|
|
198
|
-
*/
|
|
199
|
-
this._localeChangedListener = null;
|
|
200
|
-
|
|
201
199
|
/**
|
|
202
200
|
* @type {number}
|
|
203
201
|
* @private
|
|
@@ -214,19 +212,26 @@ class Layer extends VcsObject {
|
|
|
214
212
|
/**
|
|
215
213
|
* array of object Ids which should be hidden within the context of the layers layerCollection, if this layer is active
|
|
216
214
|
* @type {Array.<string>}
|
|
215
|
+
* @private
|
|
217
216
|
* @api
|
|
218
217
|
*/
|
|
219
|
-
this.
|
|
220
|
-
options.hiddenObjectIds
|
|
221
|
-
defaultOptions.hiddenObjectIds;
|
|
218
|
+
this._hiddenObjectIds = Array.isArray(options.hiddenObjectIds)
|
|
219
|
+
? options.hiddenObjectIds
|
|
220
|
+
: defaultOptions.hiddenObjectIds;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* @type {import("@vcmap/core").GlobalHider|null}
|
|
224
|
+
* @private
|
|
225
|
+
*/
|
|
226
|
+
this._globalHider = null;
|
|
222
227
|
|
|
223
228
|
/**
|
|
224
229
|
* @type {Array<string|symbol>}
|
|
225
230
|
* @private
|
|
226
231
|
*/
|
|
227
|
-
this._exclusiveGroups = Array.isArray(options.exclusiveGroups)
|
|
228
|
-
options.exclusiveGroups.slice()
|
|
229
|
-
defaultOptions.exclusiveGroups;
|
|
232
|
+
this._exclusiveGroups = Array.isArray(options.exclusiveGroups)
|
|
233
|
+
? options.exclusiveGroups.slice()
|
|
234
|
+
: defaultOptions.exclusiveGroups;
|
|
230
235
|
|
|
231
236
|
/**
|
|
232
237
|
* event raised if the exclusives group of the layer changes. is passed the array of exclusive groups as its only argument
|
|
@@ -235,9 +240,6 @@ class Layer extends VcsObject {
|
|
|
235
240
|
*/
|
|
236
241
|
this.exclusiveGroupsChanged = new VcsEvent();
|
|
237
242
|
|
|
238
|
-
/** @type {import("@vcmap/core").GlobalHider} */
|
|
239
|
-
this.globalHider = getGlobalHider();
|
|
240
|
-
|
|
241
243
|
/**
|
|
242
244
|
* @type {CopyrightOptions|undefined}
|
|
243
245
|
*/
|
|
@@ -268,6 +270,12 @@ class Layer extends VcsObject {
|
|
|
268
270
|
* @api
|
|
269
271
|
*/
|
|
270
272
|
this.featureProvider = undefined;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* @type {string}
|
|
276
|
+
* @private
|
|
277
|
+
*/
|
|
278
|
+
this._locale = 'en';
|
|
271
279
|
}
|
|
272
280
|
|
|
273
281
|
/**
|
|
@@ -332,9 +340,8 @@ class Layer extends VcsObject {
|
|
|
332
340
|
if (typeof this._url === 'string') {
|
|
333
341
|
return this._url;
|
|
334
342
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
return this._url[locale];
|
|
343
|
+
if (this._url[this._locale]) {
|
|
344
|
+
return this._url[this._locale];
|
|
338
345
|
}
|
|
339
346
|
return Object.values(this._url)[0];
|
|
340
347
|
}
|
|
@@ -353,6 +360,45 @@ class Layer extends VcsObject {
|
|
|
353
360
|
}
|
|
354
361
|
}
|
|
355
362
|
|
|
363
|
+
/**
|
|
364
|
+
* @type {Array<string>}
|
|
365
|
+
*/
|
|
366
|
+
get hiddenObjectIds() {
|
|
367
|
+
return this._hiddenObjectIds;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* @param {Array<string>} hiddenObjectIds
|
|
372
|
+
*/
|
|
373
|
+
set hiddenObjectIds(hiddenObjectIds) {
|
|
374
|
+
check(hiddenObjectIds, [String]);
|
|
375
|
+
|
|
376
|
+
if (this._globalHider && this.active) {
|
|
377
|
+
this._globalHider.hideObjects(hiddenObjectIds);
|
|
378
|
+
}
|
|
379
|
+
this._hiddenObjectIds = hiddenObjectIds;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* @type {import("@vcmap/core").GlobalHider|null}
|
|
384
|
+
* @readonly
|
|
385
|
+
*/
|
|
386
|
+
get globalHider() {
|
|
387
|
+
return this._globalHider;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* @param {import("@vcmap/core").GlobalHider} globalHider
|
|
392
|
+
*/
|
|
393
|
+
setGlobalHider(globalHider) {
|
|
394
|
+
checkMaybe(globalHider, GlobalHider);
|
|
395
|
+
|
|
396
|
+
if (globalHider && this.active) {
|
|
397
|
+
globalHider.hideObjects(this.hiddenObjectIds);
|
|
398
|
+
}
|
|
399
|
+
this._globalHider = globalHider;
|
|
400
|
+
}
|
|
401
|
+
|
|
356
402
|
/**
|
|
357
403
|
* Indicates, that this layer is part of an exclusiveGroup
|
|
358
404
|
* @api
|
|
@@ -381,7 +427,7 @@ class Layer extends VcsObject {
|
|
|
381
427
|
|
|
382
428
|
if (
|
|
383
429
|
groups.length !== this._exclusiveGroups.length ||
|
|
384
|
-
!groups.every(g => this._exclusiveGroups.includes(g))
|
|
430
|
+
!groups.every((g) => this._exclusiveGroups.includes(g))
|
|
385
431
|
) {
|
|
386
432
|
this._exclusiveGroups = groups.slice();
|
|
387
433
|
this.exclusiveGroupsChanged.raiseEvent(groups);
|
|
@@ -392,7 +438,9 @@ class Layer extends VcsObject {
|
|
|
392
438
|
* @type {number}
|
|
393
439
|
* @api
|
|
394
440
|
*/
|
|
395
|
-
get zIndex() {
|
|
441
|
+
get zIndex() {
|
|
442
|
+
return this._zIndex;
|
|
443
|
+
}
|
|
396
444
|
|
|
397
445
|
/**
|
|
398
446
|
* @param {number} index
|
|
@@ -406,6 +454,33 @@ class Layer extends VcsObject {
|
|
|
406
454
|
}
|
|
407
455
|
}
|
|
408
456
|
|
|
457
|
+
/**
|
|
458
|
+
* returns the currently set locale. Can be used to provide locale specific URLs.
|
|
459
|
+
* @type {string}
|
|
460
|
+
*/
|
|
461
|
+
get locale() {
|
|
462
|
+
return this._locale;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* sets the locale and reloads the layer the if the URL is a locale aware Object.
|
|
467
|
+
* @param {string} value
|
|
468
|
+
*/
|
|
469
|
+
set locale(value) {
|
|
470
|
+
check(value, String);
|
|
471
|
+
|
|
472
|
+
if (this._locale !== value) {
|
|
473
|
+
this._locale = value;
|
|
474
|
+
if (
|
|
475
|
+
this._url &&
|
|
476
|
+
typeof this._url === 'object' &&
|
|
477
|
+
this._url[this._locale]
|
|
478
|
+
) {
|
|
479
|
+
this.reload();
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
409
484
|
/**
|
|
410
485
|
* creates an array of layer implementations for the given map.
|
|
411
486
|
* @param {import("@vcmap/core").VcsMap} map Map
|
|
@@ -501,25 +576,11 @@ class Layer extends VcsObject {
|
|
|
501
576
|
return null;
|
|
502
577
|
}
|
|
503
578
|
|
|
504
|
-
/**
|
|
505
|
-
* recreates the implementations on locale change, if the url of this layer is an Object
|
|
506
|
-
* @param {string} locale
|
|
507
|
-
* @private
|
|
508
|
-
*/
|
|
509
|
-
_handleLocaleChange(locale) {
|
|
510
|
-
if (this._url && typeof this._url === 'object' && this._url[locale]) {
|
|
511
|
-
this.reload();
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
|
|
515
579
|
/**
|
|
516
580
|
* initializes the layer, can be used to defer loading
|
|
517
581
|
* @returns {Promise<void>}
|
|
518
582
|
*/
|
|
519
583
|
initialize() {
|
|
520
|
-
if (!this.initialized) {
|
|
521
|
-
this._localeChangedListener = getLocaleChangedEvent().addEventListener(this._handleLocaleChange.bind(this));
|
|
522
|
-
}
|
|
523
584
|
this._initialized = true;
|
|
524
585
|
return Promise.resolve();
|
|
525
586
|
}
|
|
@@ -531,7 +592,9 @@ class Layer extends VcsObject {
|
|
|
531
592
|
* @returns {Promise<void>}
|
|
532
593
|
*/
|
|
533
594
|
async mapActivated(map) {
|
|
534
|
-
this.getLogger().debug(
|
|
595
|
+
this.getLogger().debug(
|
|
596
|
+
`Layer: ${this.name} mapActivated is called from Map: ${map.name}`,
|
|
597
|
+
);
|
|
535
598
|
this._activeMaps.add(map);
|
|
536
599
|
if (this.active || (this.loading && this.initialized)) {
|
|
537
600
|
await this._activateImplsForMap(map);
|
|
@@ -544,13 +607,14 @@ class Layer extends VcsObject {
|
|
|
544
607
|
* @param {import("@vcmap/core").VcsMap} map
|
|
545
608
|
*/
|
|
546
609
|
mapDeactivated(map) {
|
|
547
|
-
this.getLogger().debug(
|
|
610
|
+
this.getLogger().debug(
|
|
611
|
+
`Layer: ${this.name} mapDeactivated is called from Map: ${map.name}`,
|
|
612
|
+
);
|
|
548
613
|
this._activeMaps.delete(map);
|
|
549
614
|
if (this.active || this.loading) {
|
|
550
|
-
this.getImplementationsForMap(map)
|
|
551
|
-
.
|
|
552
|
-
|
|
553
|
-
});
|
|
615
|
+
this.getImplementationsForMap(map).forEach((impl) => {
|
|
616
|
+
impl.deactivate();
|
|
617
|
+
});
|
|
554
618
|
}
|
|
555
619
|
}
|
|
556
620
|
|
|
@@ -561,10 +625,9 @@ class Layer extends VcsObject {
|
|
|
561
625
|
*/
|
|
562
626
|
removedFromMap(map) {
|
|
563
627
|
this._activeMaps.delete(map);
|
|
564
|
-
this.getImplementationsForMap(map)
|
|
565
|
-
.
|
|
566
|
-
|
|
567
|
-
});
|
|
628
|
+
this.getImplementationsForMap(map).forEach((impl) => {
|
|
629
|
+
impl.destroy();
|
|
630
|
+
});
|
|
568
631
|
this._implementations.delete(map);
|
|
569
632
|
}
|
|
570
633
|
|
|
@@ -575,9 +638,11 @@ class Layer extends VcsObject {
|
|
|
575
638
|
* @api stable
|
|
576
639
|
*/
|
|
577
640
|
isSupported(map) {
|
|
578
|
-
return
|
|
641
|
+
return (
|
|
642
|
+
map &&
|
|
579
643
|
this._supportedMaps.includes(map.className) &&
|
|
580
|
-
(this.mapNames.length === 0 || this.mapNames.indexOf(map.name) >= 0)
|
|
644
|
+
(this.mapNames.length === 0 || this.mapNames.indexOf(map.name) >= 0)
|
|
645
|
+
);
|
|
581
646
|
}
|
|
582
647
|
|
|
583
648
|
/**
|
|
@@ -588,12 +653,16 @@ class Layer extends VcsObject {
|
|
|
588
653
|
async _activateImplsForMap(map) {
|
|
589
654
|
const impls = this.getImplementationsForMap(map);
|
|
590
655
|
try {
|
|
591
|
-
await Promise.all(impls.map(i => i.activate()));
|
|
656
|
+
await Promise.all(impls.map((i) => i.activate()));
|
|
592
657
|
} catch (err) {
|
|
593
|
-
this.getLogger().error(
|
|
658
|
+
this.getLogger().error(
|
|
659
|
+
`Layer ${this.name} could not activate impl for map ${map.name}`,
|
|
660
|
+
);
|
|
594
661
|
this.getLogger().error(err);
|
|
595
662
|
this._implementations.set(map, []);
|
|
596
|
-
impls.forEach((i) => {
|
|
663
|
+
impls.forEach((i) => {
|
|
664
|
+
i.destroy();
|
|
665
|
+
});
|
|
597
666
|
}
|
|
598
667
|
}
|
|
599
668
|
|
|
@@ -606,23 +675,31 @@ class Layer extends VcsObject {
|
|
|
606
675
|
try {
|
|
607
676
|
this.stateChanged.raiseEvent(LayerState.LOADING);
|
|
608
677
|
} catch (e) {
|
|
609
|
-
this.getLogger().debug(
|
|
678
|
+
this.getLogger().debug(
|
|
679
|
+
`Error on raising LayerState.LOADING event for layer ${this.name} : ${e.message}`,
|
|
680
|
+
);
|
|
610
681
|
}
|
|
611
682
|
await this.initialize();
|
|
612
683
|
if (this._state !== LayerState.LOADING) {
|
|
613
684
|
return;
|
|
614
685
|
}
|
|
615
686
|
|
|
616
|
-
await Promise.all(
|
|
687
|
+
await Promise.all(
|
|
688
|
+
[...this._activeMaps].map((m) => this._activateImplsForMap(m)),
|
|
689
|
+
);
|
|
617
690
|
if (this._state !== LayerState.LOADING) {
|
|
618
691
|
return;
|
|
619
692
|
}
|
|
620
|
-
|
|
693
|
+
if (this._globalHider) {
|
|
694
|
+
this._globalHider.hideObjects(this.hiddenObjectIds);
|
|
695
|
+
}
|
|
621
696
|
this._state = LayerState.ACTIVE;
|
|
622
697
|
try {
|
|
623
698
|
this.stateChanged.raiseEvent(LayerState.ACTIVE);
|
|
624
699
|
} catch (e) {
|
|
625
|
-
this.getLogger().debug(
|
|
700
|
+
this.getLogger().debug(
|
|
701
|
+
`Error on raising LayerState.ACTIVE event for layer ${this.name} : ${e.message}`,
|
|
702
|
+
);
|
|
626
703
|
}
|
|
627
704
|
this._loadingPromise = null;
|
|
628
705
|
}
|
|
@@ -641,11 +718,10 @@ class Layer extends VcsObject {
|
|
|
641
718
|
}
|
|
642
719
|
|
|
643
720
|
if (this._state === LayerState.INACTIVE) {
|
|
644
|
-
this._loadingPromise = this._activate()
|
|
645
|
-
.
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
});
|
|
721
|
+
this._loadingPromise = this._activate().catch((err) => {
|
|
722
|
+
this._state = LayerState.INACTIVE;
|
|
723
|
+
return Promise.reject(err);
|
|
724
|
+
});
|
|
649
725
|
return this._loadingPromise;
|
|
650
726
|
}
|
|
651
727
|
|
|
@@ -667,12 +743,16 @@ class Layer extends VcsObject {
|
|
|
667
743
|
impl.deactivate();
|
|
668
744
|
}
|
|
669
745
|
});
|
|
670
|
-
|
|
746
|
+
if (this._globalHider) {
|
|
747
|
+
this._globalHider.showObjects(this.hiddenObjectIds);
|
|
748
|
+
}
|
|
671
749
|
this._state = LayerState.INACTIVE;
|
|
672
750
|
try {
|
|
673
751
|
this.stateChanged.raiseEvent(LayerState.INACTIVE);
|
|
674
752
|
} catch (e) {
|
|
675
|
-
this.getLogger().debug(
|
|
753
|
+
this.getLogger().debug(
|
|
754
|
+
`Error on raising LayerState.INACTIVE event for layer ${this.name} : ${e.message}`,
|
|
755
|
+
);
|
|
676
756
|
}
|
|
677
757
|
}
|
|
678
758
|
}
|
|
@@ -731,15 +811,10 @@ class Layer extends VcsObject {
|
|
|
731
811
|
}
|
|
732
812
|
|
|
733
813
|
this._activeMaps.clear();
|
|
734
|
-
this.getImplementations()
|
|
735
|
-
.
|
|
736
|
-
|
|
737
|
-
});
|
|
814
|
+
this.getImplementations().forEach((impl) => {
|
|
815
|
+
impl.destroy();
|
|
816
|
+
});
|
|
738
817
|
|
|
739
|
-
if (this._localeChangedListener) {
|
|
740
|
-
this._localeChangedListener();
|
|
741
|
-
this._localeChangedListener = null;
|
|
742
|
-
}
|
|
743
818
|
this._initialized = false;
|
|
744
819
|
this._implementations.clear();
|
|
745
820
|
this.stateChanged.destroy();
|
|
@@ -748,5 +823,5 @@ class Layer extends VcsObject {
|
|
|
748
823
|
}
|
|
749
824
|
}
|
|
750
825
|
|
|
751
|
-
|
|
826
|
+
layerClassRegistry.registerClass(Layer.className, Layer);
|
|
752
827
|
export default Layer;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import VcsObject from '../
|
|
1
|
+
import VcsObject from '../vcsObject.js';
|
|
2
2
|
import LayerState from './layerState.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* represents an implementation for a Layer for a specific Map
|
|
6
6
|
* @class
|
|
7
|
-
* @export
|
|
8
7
|
* @extends {VcsObject}
|
|
9
8
|
* @abstract
|
|
10
9
|
* @api
|
|
11
10
|
* @template {import("@vcmap/core").VcsMap} T
|
|
12
11
|
*/
|
|
13
12
|
class LayerImplementation extends VcsObject {
|
|
14
|
-
static get className() {
|
|
13
|
+
static get className() {
|
|
14
|
+
return 'LayerImplementation';
|
|
15
|
+
}
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* @param {T} map
|
|
@@ -43,19 +44,25 @@ class LayerImplementation extends VcsObject {
|
|
|
43
44
|
* @type {boolean}
|
|
44
45
|
* @readonly
|
|
45
46
|
*/
|
|
46
|
-
get initialized() {
|
|
47
|
+
get initialized() {
|
|
48
|
+
return this._initialized;
|
|
49
|
+
}
|
|
47
50
|
|
|
48
51
|
/**
|
|
49
52
|
* @type {boolean}
|
|
50
53
|
* @api
|
|
51
54
|
*/
|
|
52
|
-
get active() {
|
|
55
|
+
get active() {
|
|
56
|
+
return this._state === LayerState.ACTIVE;
|
|
57
|
+
}
|
|
53
58
|
|
|
54
59
|
/**
|
|
55
60
|
* @type {boolean}
|
|
56
61
|
* @api
|
|
57
62
|
*/
|
|
58
|
-
get loading() {
|
|
63
|
+
get loading() {
|
|
64
|
+
return this._state === LayerState.LOADING;
|
|
65
|
+
}
|
|
59
66
|
|
|
60
67
|
/**
|
|
61
68
|
* interface to initialize this implementation, is used to setup elements which have to be created only once.
|
|
@@ -3,12 +3,12 @@ import { vcsLayerName } from '../layerSymbols.js';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @class
|
|
6
|
-
* @extends {LayerImplementation<import("@vcmap/core").
|
|
6
|
+
* @extends {LayerImplementation<import("@vcmap/core").ObliqueMap>}}
|
|
7
7
|
* @abstract
|
|
8
8
|
*/
|
|
9
|
-
class
|
|
9
|
+
class LayerObliqueImpl extends LayerImplementation {
|
|
10
10
|
/**
|
|
11
|
-
* @param {import("@vcmap/core").
|
|
11
|
+
* @param {import("@vcmap/core").ObliqueMap} map
|
|
12
12
|
* @param {LayerImplementationOptions} options
|
|
13
13
|
*/
|
|
14
14
|
constructor(map, options) {
|
|
@@ -59,7 +59,9 @@ class LayerOblique extends LayerImplementation {
|
|
|
59
59
|
* @returns {import("ol/layer").Layer<import("ol/source/Source").default>}
|
|
60
60
|
*/
|
|
61
61
|
// eslint-disable-next-line class-methods-use-this
|
|
62
|
-
getOLLayer() {
|
|
62
|
+
getOLLayer() {
|
|
63
|
+
throw new Error();
|
|
64
|
+
}
|
|
63
65
|
|
|
64
66
|
/**
|
|
65
67
|
* @inheritDoc
|
|
@@ -73,4 +75,4 @@ class LayerOblique extends LayerImplementation {
|
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
|
|
76
|
-
export default
|
|
78
|
+
export default LayerObliqueImpl;
|