@vcmap/core 5.0.0-rc.2 → 5.0.0-rc.20
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 +3 -2
- package/index.d.ts +2221 -1992
- package/index.js +137 -131
- package/package.json +16 -23
- package/src/category/appBackedCategory.js +89 -0
- package/src/category/category.js +444 -0
- package/src/category/categoryCollection.js +145 -0
- package/src/cesium/cesium3DTileFeature.js +1 -1
- package/src/cesium/entity.js +27 -0
- package/src/classRegistry.js +162 -0
- package/src/context.js +89 -0
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/abstractFeatureProvider.js +6 -7
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/featureProviderHelpers.js +4 -5
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/featureProviderSymbols.js +0 -0
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/tileProviderFeatureProvider.js +4 -2
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/wmsFeatureProvider.js +22 -14
- package/src/{vcs/vcm/interaction → interaction}/abstractInteraction.js +20 -19
- package/src/{vcs/vcm/interaction → interaction}/coordinateAtPixel.js +7 -10
- package/src/{vcs/vcm/interaction → interaction}/eventHandler.js +3 -3
- package/src/{vcs/vcm/interaction → interaction}/featureAtPixelInteraction.js +17 -26
- package/src/{vcs/vcm/interaction → interaction}/featureProviderInteraction.js +3 -14
- package/src/{vcs/vcm/interaction → interaction}/interactionChain.js +11 -32
- package/src/{vcs/vcm/interaction → interaction}/interactionType.js +1 -5
- package/src/{vcs/vcm/layer/cesium/cesiumTilesetCesium.js → layer/cesium/cesiumTilesetCesiumImpl.js} +10 -13
- package/src/{vcs/vcm/layer → layer}/cesium/clusterContext.js +0 -0
- package/src/{vcs/vcm/layer/cesium/dataSourceCesium.js → layer/cesium/dataSourceCesiumImpl.js} +5 -3
- package/src/{vcs/vcm/layer/cesium/openStreetMapCesium.js → layer/cesium/openStreetMapCesiumImpl.js} +6 -7
- package/src/{vcs/vcm/layer/cesium/rasterLayerCesium.js → layer/cesium/rasterLayerCesiumImpl.js} +5 -6
- package/src/{vcs/vcm/layer/cesium/singleImageCesium.js → layer/cesium/singleImageCesiumImpl.js} +5 -6
- package/src/{vcs/vcm/layer/cesium/terrainCesium.js → layer/cesium/terrainCesiumImpl.js} +4 -5
- package/src/{vcs/vcm/layer/cesium/tmsCesium.js → layer/cesium/tmsCesiumImpl.js} +6 -7
- package/src/{vcs/vcm/layer/cesium/vectorCesium.js → layer/cesium/vectorCesiumImpl.js} +6 -7
- package/src/{vcs/vcm/layer → layer}/cesium/vectorContext.js +0 -0
- package/src/{vcs/vcm/layer/cesium/vectorRasterTileCesium.js → layer/cesium/vectorRasterTileCesiumImpl.js} +5 -6
- package/src/{vcs/vcm/layer → layer}/cesium/vectorTileImageryProvider.js +1 -2
- package/src/{vcs/vcm/layer/cesium/wmsCesium.js → layer/cesium/wmsCesiumImpl.js} +6 -7
- package/src/{vcs/vcm/layer/cesium/wmtsCesium.js → layer/cesium/wmtsCesiumImpl.js} +6 -7
- package/src/{vcs/vcm/layer → layer}/cesium/x3dmHelper.js +0 -0
- package/src/{vcs/vcm/layer/cesiumTileset.js → layer/cesiumTilesetLayer.js} +36 -35
- package/src/{vcs/vcm/layer/czml.js → layer/czmlLayer.js} +12 -15
- package/src/{vcs/vcm/layer/dataSource.js → layer/dataSourceLayer.js} +36 -27
- package/src/{vcs/vcm/layer → layer}/featureLayer.js +25 -29
- package/src/{vcs/vcm/layer/featureStore.js → layer/featureStoreLayer.js} +51 -51
- package/src/{vcs/vcm/layer/featureStoreChanges.js → layer/featureStoreLayerChanges.js} +100 -82
- package/src/{vcs/vcm/layer/featureStoreState.js → layer/featureStoreLayerState.js} +1 -2
- package/src/{vcs/vcm/layer → layer}/featureVisibility.js +9 -6
- package/src/{vcs/vcm/layer → layer}/geojsonHelpers.js +15 -41
- package/src/{vcs/vcm/layer/geojson.js → layer/geojsonLayer.js} +15 -18
- package/src/{vcs/vcm/layer → layer}/globalHider.js +8 -32
- package/src/{vcs/vcm/layer → layer}/layer.js +92 -46
- package/src/{vcs/vcm/layer → layer}/layerImplementation.js +2 -3
- package/src/{vcs/vcm/layer → layer}/layerState.js +0 -1
- package/src/{vcs/vcm/layer → layer}/layerSymbols.js +0 -0
- package/src/{vcs/vcm/layer/oblique/layerOblique.js → layer/oblique/layerObliqueImpl.js} +4 -4
- package/src/{vcs/vcm/layer → layer}/oblique/obliqueHelpers.js +2 -2
- package/src/{vcs/vcm/layer/oblique/vectorOblique.js → layer/oblique/vectorObliqueImpl.js} +7 -9
- package/src/{vcs/vcm/layer/openStreetMap.js → layer/openStreetMapLayer.js} +30 -31
- package/src/{vcs/vcm/layer/openlayers/layerOpenlayers.js → layer/openlayers/layerOpenlayersImpl.js} +5 -6
- package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +26 -0
- package/src/{vcs/vcm/layer/openlayers/rasterLayerOpenlayers.js → layer/openlayers/rasterLayerOpenlayersImpl.js} +15 -14
- package/src/{vcs/vcm/layer/openlayers/singleImageOpenlayers.js → layer/openlayers/singleImageOpenlayersImpl.js} +6 -7
- package/src/{vcs/vcm/layer/openlayers/tileDebugOpenlayers.js → layer/openlayers/tileDebugOpenlayersImpl.js} +5 -6
- package/src/{vcs/vcm/layer/openlayers/tmsOpenlayers.js → layer/openlayers/tmsOpenlayersImpl.js} +7 -8
- package/src/{vcs/vcm/layer/openlayers/vectorOpenlayers.js → layer/openlayers/vectorOpenlayersImpl.js} +8 -9
- package/src/{vcs/vcm/layer/openlayers/vectorTileOpenlayers.js → layer/openlayers/vectorTileOpenlayersImpl.js} +6 -7
- package/src/{vcs/vcm/layer/openlayers/wmsOpenlayers.js → layer/openlayers/wmsOpenlayersImpl.js} +7 -8
- package/src/{vcs/vcm/layer/openlayers/wmtsOpenlayers.js → layer/openlayers/wmtsOpenlayersImpl.js} +7 -8
- package/src/{vcs/vcm/layer/pointCloud.js → layer/pointCloudLayer.js} +24 -32
- package/src/{vcs/vcm/layer → layer}/rasterLayer.js +16 -18
- package/src/{vcs/vcm/layer/singleImage.js → layer/singleImageLayer.js} +18 -18
- package/src/{vcs/vcm/layer → layer}/terrainHelpers.js +13 -49
- package/src/{vcs/vcm/layer/terrain.js → layer/terrainLayer.js} +11 -12
- package/src/{vcs/vcm/layer → layer}/tileLoadedHelper.js +5 -5
- package/src/{vcs/vcm/layer → layer}/tileProvider/mvtTileProvider.js +43 -6
- package/src/layer/tileProvider/staticGeojsonTileProvider.js +81 -0
- package/src/{vcs/vcm/layer → layer}/tileProvider/tileProvider.js +41 -6
- package/src/{vcs/vcm/layer → layer}/tileProvider/urlTemplateTileProvider.js +46 -11
- package/src/{vcs/vcm/layer/tms.js → layer/tmsLayer.js} +17 -18
- package/src/{vcs/vcm/layer → layer}/vectorHelpers.js +5 -5
- package/src/{vcs/vcm/layer/vector.js → layer/vectorLayer.js} +35 -45
- package/src/{vcs/vcm/layer → layer}/vectorProperties.js +3 -4
- package/src/{vcs/vcm/layer → layer}/vectorSymbols.js +0 -0
- package/src/{vcs/vcm/layer/vectorTile.js → layer/vectorTileLayer.js} +75 -52
- package/src/{vcs/vcm/layer/wfs.js → layer/wfsLayer.js} +16 -17
- package/src/{vcs/vcm/layer → layer}/wmsHelpers.js +1 -1
- package/src/{vcs/vcm/layer/wms.js → layer/wmsLayer.js} +19 -20
- package/src/{vcs/vcm/layer/wmts.js → layer/wmtsLayer.js} +24 -25
- package/src/{vcs/vcm/maps → map}/baseOLMap.js +5 -6
- package/src/{vcs/vcm/maps → map}/cameraLimiter.js +10 -16
- package/src/{vcs/vcm/maps/cesium.js → map/cesiumMap.js} +18 -31
- package/src/{vcs/vcm/maps → map}/mapState.js +0 -1
- package/src/{vcs/vcm/maps/oblique.js → map/obliqueMap.js} +40 -55
- package/src/{vcs/vcm/maps/openlayers.js → map/openlayersMap.js} +15 -13
- package/src/{vcs/vcm/maps/map.js → map/vcsMap.js} +39 -20
- package/src/oblique/defaultObliqueCollection.js +62 -0
- package/src/{vcs/vcm/oblique → oblique}/helpers.js +13 -44
- package/src/{vcs/vcm/oblique/ObliqueCollection.js → oblique/obliqueCollection.js} +117 -37
- package/src/{vcs/vcm/oblique/ObliqueDataSet.js → oblique/obliqueDataSet.js} +67 -26
- package/src/{vcs/vcm/oblique/ObliqueImage.js → oblique/obliqueImage.js} +1 -2
- package/src/{vcs/vcm/oblique/ObliqueImageMeta.js → oblique/obliqueImageMeta.js} +4 -5
- package/src/{vcs/vcm/oblique/ObliqueProvider.js → oblique/obliqueProvider.js} +17 -12
- package/src/{vcs/vcm/oblique/ObliqueView.js → oblique/obliqueView.js} +31 -2
- package/src/{vcs/vcm/oblique/ObliqueViewDirection.js → oblique/obliqueViewDirection.js} +0 -3
- package/src/{vcs/vcm/oblique → oblique}/parseImageJson.js +20 -12
- package/src/ol/geom/circle.js +1 -1
- package/src/ol/render/canvas/canvasTileRenderer.js +0 -1
- package/src/overrideClassRegistry.js +204 -0
- package/src/{vcs/vcm/util/style → style}/declarativeStyleItem.js +43 -20
- package/src/{vcs/vcm/util/style → style}/shapesCategory.js +0 -2
- package/src/style/styleFactory.js +29 -0
- package/src/{vcs/vcm/util/style → style}/styleHelpers.js +3 -14
- package/src/{vcs/vcm/util/style → style}/styleItem.js +18 -105
- package/src/{vcs/vcm/util/style → style}/vectorStyleItem.js +73 -85
- package/src/{vcs/vcm/util/style → style}/writeStyle.js +4 -7
- package/src/{vcs/vcm/util → util}/clipping/clippingObject.js +10 -12
- package/src/{vcs/vcm/util → util}/clipping/clippingObjectManager.js +2 -3
- package/src/{vcs/vcm/util → util}/clipping/clippingPlaneHelper.js +4 -8
- package/src/{vcs/vcm/util → util}/collection.js +16 -4
- package/src/{vcs/vcm/util → util}/exclusiveManager.js +0 -0
- package/src/{vcs/vcm/util → util}/extent.js +16 -10
- package/src/{vcs/vcm/util → util}/featureconverter/circleToCesium.js +0 -0
- package/src/{vcs/vcm/util → util}/featureconverter/convert.js +0 -0
- package/src/util/featureconverter/extent3D.js +181 -0
- package/src/{vcs/vcm/util → util}/featureconverter/featureconverterHelper.js +1 -1
- package/src/{vcs/vcm/util → util}/featureconverter/lineStringToCesium.js +0 -0
- package/src/{vcs/vcm/util → util}/featureconverter/pointToCesium.js +9 -6
- package/src/{vcs/vcm/util → util}/featureconverter/polygonToCesium.js +1 -1
- package/src/util/fetch.js +32 -0
- package/src/{vcs/vcm/util → util}/geometryHelpers.js +0 -0
- package/src/{vcs/vcm/util → util}/indexedCollection.js +24 -2
- package/src/{vcs/vcm/util → util}/isMobile.js +0 -0
- package/src/{vcs/vcm/util → util}/layerCollection.js +89 -12
- package/src/util/locale.js +12 -0
- package/src/{vcs/vcm/util → util}/mapCollection.js +91 -34
- package/src/{vcs/vcm/util → util}/math.js +0 -0
- package/src/util/overrideCollection.js +223 -0
- package/src/{vcs/vcm/util → util}/projection.js +38 -28
- package/src/{vcs/vcm/util → util}/splitScreen.js +10 -10
- package/src/{vcs/vcm/util → util}/urlHelpers.js +0 -0
- package/src/{vcs/vcm/util → util}/viewpoint.js +2 -6
- package/src/vcsApp.js +571 -0
- package/src/vcsAppContextHelpers.js +121 -0
- package/src/{vcs/vcm/event/vcsEvent.js → vcsEvent.js} +2 -3
- package/src/{vcs/vcm/object.js → vcsObject.js} +1 -9
- package/tests/data/dynamicPointCzml.json +64 -0
- package/tests/data/oblique/imageData/imagev34.json +352 -0
- package/tests/data/oblique/imageData/imagev35.json +54 -0
- package/tests/data/oblique/imageData/imagev35PerImageSize.json +53 -0
- package/tests/data/oblique/tiledImageData/12/2199/1342.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2199/1343.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2199/1344.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2200/1342.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2200/1343.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2200/1344.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2201/1342.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2201/1343.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2201/1344.json +1 -0
- package/tests/data/oblique/tiledImageData/image.json +1 -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 +136 -0
- package/tests/data/testGeoJSON.json +161 -0
- package/tests/data/tile.pbf +0 -0
- package/tests/unit/helpers/cesiumHelpers.js +290 -0
- package/tests/unit/helpers/getFileNameFromUrl.js +12 -0
- package/tests/unit/helpers/helpers.js +11 -0
- package/tests/unit/helpers/imageHelpers.js +20 -0
- package/tests/unit/helpers/importJSON.js +15 -0
- package/tests/unit/helpers/obliqueData.js +76 -0
- package/tests/unit/helpers/obliqueHelpers.js +112 -0
- package/tests/unit/helpers/openlayersHelpers.js +22 -0
- package/tests/unit/helpers/terrain/terrainData.js +46 -0
- package/src/vcs/vcm/classRegistry.js +0 -106
- package/src/vcs/vcm/globalCollections.js +0 -11
- package/src/vcs/vcm/layer/buildings.js +0 -17
- package/src/vcs/vcm/layer/cesium/pointCloudCesium.js +0 -58
- package/src/vcs/vcm/layer/openlayers/openStreetMapOpenlayers.js +0 -27
- package/src/vcs/vcm/layer/tileProvider/staticGeojsonTileProvider.js +0 -67
- package/src/vcs/vcm/layer/tileProvider/tileProviderFactory.js +0 -28
- package/src/vcs/vcm/util/dateTime.js +0 -60
- package/src/vcs/vcm/util/featureconverter/extent3d.js +0 -154
- package/src/vcs/vcm/util/locale.js +0 -53
- package/src/vcs/vcm/util/style/styleFactory.js +0 -48
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SplitDirection, Matrix4 } from '@vcmap/cesium';
|
|
2
2
|
|
|
3
3
|
import { checkMaybe } from '@vcsuite/check';
|
|
4
4
|
import { parseInteger } from '@vcsuite/parsers';
|
|
5
5
|
import getJSONObjectFromObject from './cesium/x3dmHelper.js';
|
|
6
|
-
import VectorStyleItem from '../
|
|
6
|
+
import VectorStyleItem from '../style/vectorStyleItem.js';
|
|
7
7
|
import FeatureLayer from './featureLayer.js';
|
|
8
|
-
import
|
|
9
|
-
import CesiumMap from '../
|
|
10
|
-
import VcsEvent from '../
|
|
8
|
+
import CesiumTilesetCesiumImpl, { getExtentFromTileset } from './cesium/cesiumTilesetCesiumImpl.js';
|
|
9
|
+
import CesiumMap from '../map/cesiumMap.js';
|
|
10
|
+
import VcsEvent from '../vcsEvent.js';
|
|
11
11
|
import Extent from '../util/extent.js';
|
|
12
12
|
import { mercatorProjection } from '../util/projection.js';
|
|
13
13
|
import { isMobile } from '../util/isMobile.js';
|
|
14
|
-
import {
|
|
15
|
-
import { VcsClassRegistry } from '../classRegistry.js';
|
|
14
|
+
import { layerClassRegistry } from '../classRegistry.js';
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* @typedef {LayerOptions} CesiumTilesetOptions
|
|
@@ -37,7 +36,7 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
37
36
|
/**
|
|
38
37
|
* @typedef {FeatureLayerImplementationOptions} CesiumTilesetImplementationOptions
|
|
39
38
|
* @property {Object|undefined} tilesetOptions
|
|
40
|
-
* @property {import("@vcmap/cesium").
|
|
39
|
+
* @property {import("@vcmap/cesium").SplitDirection} splitDirection
|
|
41
40
|
* @property {Array<CesiumTilesetTilesetProperties>|undefined} tilesetProperties
|
|
42
41
|
* @property {import("@vcmap/cesium").Matrix4|undefined} modelMatrix
|
|
43
42
|
* @property {import("ol/coordinate").Coordinate|undefined} offset
|
|
@@ -50,11 +49,10 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
50
49
|
* @extends {FeatureLayer}
|
|
51
50
|
* @implements {SplitLayer}
|
|
52
51
|
* @api stable
|
|
53
|
-
* @export
|
|
54
52
|
*/
|
|
55
|
-
class
|
|
53
|
+
class CesiumTilesetLayer extends FeatureLayer {
|
|
56
54
|
/** @type {string} */
|
|
57
|
-
static get className() { return '
|
|
55
|
+
static get className() { return 'CesiumTilesetLayer'; }
|
|
58
56
|
|
|
59
57
|
/**
|
|
60
58
|
* @returns {CesiumTilesetOptions}
|
|
@@ -80,7 +78,7 @@ class CesiumTileset extends FeatureLayer {
|
|
|
80
78
|
this._supportedMaps = [
|
|
81
79
|
CesiumMap.className,
|
|
82
80
|
];
|
|
83
|
-
const defaultOptions =
|
|
81
|
+
const defaultOptions = CesiumTilesetLayer.getDefaultOptions();
|
|
84
82
|
if (this.url && !/\.json$/.test(this.url)) {
|
|
85
83
|
this.url = `${this.url.replace(/\/$/, '')}/tileset.json`;
|
|
86
84
|
}
|
|
@@ -111,18 +109,18 @@ class CesiumTileset extends FeatureLayer {
|
|
|
111
109
|
...tilesetOptions,
|
|
112
110
|
};
|
|
113
111
|
|
|
114
|
-
/** @type {import("@vcmap/cesium").
|
|
115
|
-
this._splitDirection =
|
|
112
|
+
/** @type {import("@vcmap/cesium").SplitDirection} */
|
|
113
|
+
this._splitDirection = SplitDirection.NONE;
|
|
116
114
|
|
|
117
115
|
if (options.splitDirection) {
|
|
118
116
|
this._splitDirection = options.splitDirection === 'left' ?
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
SplitDirection.LEFT :
|
|
118
|
+
SplitDirection.RIGHT;
|
|
121
119
|
}
|
|
122
120
|
|
|
123
121
|
/**
|
|
124
122
|
* raised if the split direction changes, is passed the split direction as its only argument
|
|
125
|
-
* @type {VcsEvent<import("@vcmap/cesium").
|
|
123
|
+
* @type {VcsEvent<import("@vcmap/cesium").SplitDirection>}
|
|
126
124
|
* @api
|
|
127
125
|
*/
|
|
128
126
|
this.splitDirectionChanged = new VcsEvent();
|
|
@@ -158,7 +156,7 @@ class CesiumTileset extends FeatureLayer {
|
|
|
158
156
|
|
|
159
157
|
this._modelMatrix = modelMatrix;
|
|
160
158
|
this.getImplementations()
|
|
161
|
-
.forEach(/** @param {
|
|
159
|
+
.forEach(/** @param {CesiumTilesetCesiumImpl} impl */ (impl) => {
|
|
162
160
|
impl.updateModelMatrix(modelMatrix);
|
|
163
161
|
});
|
|
164
162
|
}
|
|
@@ -182,30 +180,35 @@ class CesiumTileset extends FeatureLayer {
|
|
|
182
180
|
|
|
183
181
|
this._offset = offset;
|
|
184
182
|
this.getImplementations()
|
|
185
|
-
.forEach(/** @param {
|
|
183
|
+
.forEach(/** @param {CesiumTilesetCesiumImpl} impl */ (impl) => {
|
|
186
184
|
impl.updateOffset(offset);
|
|
187
185
|
});
|
|
188
186
|
}
|
|
189
187
|
|
|
190
188
|
/**
|
|
191
189
|
* @api
|
|
192
|
-
* @type {import("@vcmap/cesium").
|
|
190
|
+
* @type {import("@vcmap/cesium").SplitDirection}
|
|
193
191
|
*/
|
|
194
192
|
get splitDirection() { return this._splitDirection; }
|
|
195
193
|
|
|
196
194
|
/**
|
|
197
|
-
* @param {import("@vcmap/cesium").
|
|
195
|
+
* @param {import("@vcmap/cesium").SplitDirection} direction
|
|
198
196
|
*/
|
|
199
197
|
set splitDirection(direction) {
|
|
200
198
|
if (direction !== this._splitDirection) {
|
|
201
199
|
this.getImplementations().forEach((impl) => {
|
|
202
|
-
/** @type {
|
|
200
|
+
/** @type {CesiumTilesetCesiumImpl} */ (impl).updateSplitDirection(direction);
|
|
203
201
|
});
|
|
204
202
|
this._splitDirection = direction;
|
|
205
203
|
this.splitDirectionChanged.raiseEvent(this._splitDirection);
|
|
206
204
|
}
|
|
207
205
|
}
|
|
208
206
|
|
|
207
|
+
async initialize() {
|
|
208
|
+
await this.style.cesiumStyle.readyPromise;
|
|
209
|
+
return super.initialize();
|
|
210
|
+
}
|
|
211
|
+
|
|
209
212
|
/**
|
|
210
213
|
* @inheritDoc
|
|
211
214
|
* @returns {CesiumTilesetImplementationOptions}
|
|
@@ -223,11 +226,11 @@ class CesiumTileset extends FeatureLayer {
|
|
|
223
226
|
/**
|
|
224
227
|
* @inheritDoc
|
|
225
228
|
* @param {import("@vcmap/core").VcsMap} map
|
|
226
|
-
* @returns {Array<
|
|
229
|
+
* @returns {Array<CesiumTilesetCesiumImpl>}
|
|
227
230
|
*/
|
|
228
231
|
createImplementationsForMap(map) {
|
|
229
232
|
if (map instanceof CesiumMap) {
|
|
230
|
-
return [new
|
|
233
|
+
return [new CesiumTilesetCesiumImpl(map, this.getImplementationOptions())];
|
|
231
234
|
}
|
|
232
235
|
return [];
|
|
233
236
|
}
|
|
@@ -261,12 +264,12 @@ class CesiumTileset extends FeatureLayer {
|
|
|
261
264
|
if (metaExtent) {
|
|
262
265
|
return metaExtent;
|
|
263
266
|
}
|
|
264
|
-
const impl = /** @type {
|
|
267
|
+
const impl = /** @type {CesiumTilesetCesiumImpl} */ (this.getImplementations()[0]);
|
|
265
268
|
if (impl) {
|
|
266
269
|
const threeDimExtent = getExtentFromTileset(impl.cesium3DTileset);
|
|
267
270
|
|
|
268
271
|
const actualExtent = new Extent({
|
|
269
|
-
|
|
272
|
+
projection: mercatorProjection.toJSON(),
|
|
270
273
|
coordinates: threeDimExtent,
|
|
271
274
|
});
|
|
272
275
|
|
|
@@ -299,7 +302,7 @@ class CesiumTileset extends FeatureLayer {
|
|
|
299
302
|
*/
|
|
300
303
|
setMaximumScreenSpaceError(value) {
|
|
301
304
|
this.getImplementations()
|
|
302
|
-
.forEach(/** @param {
|
|
305
|
+
.forEach(/** @param {CesiumTilesetCesiumImpl} impl */(impl) => {
|
|
303
306
|
if (impl.cesium3DTileset) {
|
|
304
307
|
impl.cesium3DTileset.maximumScreenSpaceError = value;
|
|
305
308
|
}
|
|
@@ -312,11 +315,9 @@ class CesiumTileset extends FeatureLayer {
|
|
|
312
315
|
toJSON() {
|
|
313
316
|
/** @type {CesiumTilesetOptions} */
|
|
314
317
|
const config = super.toJSON();
|
|
315
|
-
const defaultOptions =
|
|
318
|
+
const defaultOptions = CesiumTilesetLayer.getDefaultOptions();
|
|
316
319
|
if (this.highlightStyle) {
|
|
317
|
-
config.highlightStyle = this.highlightStyle
|
|
318
|
-
this.highlightStyle.getReference() :
|
|
319
|
-
this.highlightStyle.getOptions();
|
|
320
|
+
config.highlightStyle = this.highlightStyle.toJSON();
|
|
320
321
|
}
|
|
321
322
|
|
|
322
323
|
if (this.screenSpaceError !== defaultOptions.screenSpaceError) {
|
|
@@ -349,8 +350,8 @@ class CesiumTileset extends FeatureLayer {
|
|
|
349
350
|
config.tilesetOptions = tilesetOptions;
|
|
350
351
|
}
|
|
351
352
|
|
|
352
|
-
if (this._splitDirection !==
|
|
353
|
-
config.splitDirection = this._splitDirection ===
|
|
353
|
+
if (this._splitDirection !== SplitDirection.NONE) {
|
|
354
|
+
config.splitDirection = this._splitDirection === SplitDirection.RIGHT ?
|
|
354
355
|
'right' :
|
|
355
356
|
'left';
|
|
356
357
|
}
|
|
@@ -372,5 +373,5 @@ class CesiumTileset extends FeatureLayer {
|
|
|
372
373
|
}
|
|
373
374
|
}
|
|
374
375
|
|
|
375
|
-
|
|
376
|
-
export default
|
|
376
|
+
layerClassRegistry.registerClass(CesiumTilesetLayer.className, CesiumTilesetLayer);
|
|
377
|
+
export default CesiumTilesetLayer;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CzmlDataSource } from '@vcmap/cesium';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import DataSourceLayer from './dataSourceLayer.js';
|
|
4
4
|
import { vcsLayerName } from './layerSymbols.js';
|
|
5
|
-
import {
|
|
5
|
+
import { layerClassRegistry } from '../classRegistry.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @typedef {DataSourceOptions} CzmlOptions
|
|
@@ -12,18 +12,17 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @class
|
|
15
|
-
* @
|
|
16
|
-
* @extends {DataSource}
|
|
15
|
+
* @extends {DataSourceLayer}
|
|
17
16
|
*/
|
|
18
|
-
class
|
|
19
|
-
static get className() { return '
|
|
17
|
+
class CzmlLayer extends DataSourceLayer {
|
|
18
|
+
static get className() { return 'CzmlLayer'; }
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* @returns {CzmlOptions}
|
|
23
22
|
*/
|
|
24
23
|
static getDefaultOptions() {
|
|
25
24
|
return {
|
|
26
|
-
...
|
|
25
|
+
...DataSourceLayer.getDefaultOptions(),
|
|
27
26
|
sourceUri: undefined,
|
|
28
27
|
};
|
|
29
28
|
}
|
|
@@ -36,7 +35,7 @@ class Czml extends DataSource {
|
|
|
36
35
|
this.dataSource = new CzmlDataSource();
|
|
37
36
|
this.entities = this.dataSource.entities;
|
|
38
37
|
|
|
39
|
-
const defaultOptions =
|
|
38
|
+
const defaultOptions = CzmlLayer.getDefaultOptions();
|
|
40
39
|
/** @type {string|null} */
|
|
41
40
|
this.sourceUri = options.sourceUri || defaultOptions.sourceUri;
|
|
42
41
|
/** @type {Function} */
|
|
@@ -44,7 +43,7 @@ class Czml extends DataSource {
|
|
|
44
43
|
/** @type {Function} */
|
|
45
44
|
this._loadedReject = () => {};
|
|
46
45
|
/**
|
|
47
|
-
* A Promise resolving with the
|
|
46
|
+
* A Promise resolving with the DataSourceLayer on load
|
|
48
47
|
* @type {Promise<void>}
|
|
49
48
|
* @api stable
|
|
50
49
|
*/
|
|
@@ -77,11 +76,9 @@ class Czml extends DataSource {
|
|
|
77
76
|
* @private
|
|
78
77
|
*/
|
|
79
78
|
async _loadData() {
|
|
80
|
-
|
|
79
|
+
await /** @type {import("@vcmap/cesium").CzmlDataSource} */ (this.dataSource)
|
|
81
80
|
.load(this.url, this.sourceUri ? { sourceUri: this.sourceUri } : undefined);
|
|
82
|
-
|
|
83
|
-
loaded.then(resolve, reject);
|
|
84
|
-
});
|
|
81
|
+
|
|
85
82
|
this.entities.values.forEach((entity) => {
|
|
86
83
|
entity[vcsLayerName] = this.name;
|
|
87
84
|
});
|
|
@@ -137,5 +134,5 @@ class Czml extends DataSource {
|
|
|
137
134
|
}
|
|
138
135
|
}
|
|
139
136
|
|
|
140
|
-
|
|
141
|
-
export default
|
|
137
|
+
layerClassRegistry.registerClass(CzmlLayer.className, CzmlLayer);
|
|
138
|
+
export default CzmlLayer;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { EntityCollection } from '@vcmap/cesium';
|
|
2
2
|
import Layer from './layer.js';
|
|
3
|
-
import CesiumMap from '../
|
|
4
|
-
import
|
|
3
|
+
import CesiumMap from '../map/cesiumMap.js';
|
|
4
|
+
import DataSourceCesiumImpl from './cesium/dataSourceCesiumImpl.js';
|
|
5
5
|
import { vcsLayerName } from './layerSymbols.js';
|
|
6
6
|
import FeatureVisibility, { FeatureVisibilityAction } from './featureVisibility.js';
|
|
7
|
-
import {
|
|
8
|
-
import { VcsClassRegistry } from '../classRegistry.js';
|
|
7
|
+
import { layerClassRegistry } from '../classRegistry.js';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* @typedef {LayerOptions} DataSourceOptions
|
|
@@ -30,12 +29,11 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
30
29
|
/**
|
|
31
30
|
* Represents a layer of Cesium.Entity
|
|
32
31
|
* @class
|
|
33
|
-
* @export
|
|
34
32
|
* @extends {Layer}
|
|
35
33
|
* @api stable
|
|
36
34
|
*/
|
|
37
|
-
class
|
|
38
|
-
static get className() { return '
|
|
35
|
+
class DataSourceLayer extends Layer {
|
|
36
|
+
static get className() { return 'DataSourceLayer'; }
|
|
39
37
|
|
|
40
38
|
/**
|
|
41
39
|
* @returns {DataSourceOptions}
|
|
@@ -52,7 +50,7 @@ class DataSource extends Layer {
|
|
|
52
50
|
*/
|
|
53
51
|
constructor(options) {
|
|
54
52
|
super(options);
|
|
55
|
-
const defaultOptions =
|
|
53
|
+
const defaultOptions = DataSourceLayer.getDefaultOptions();
|
|
56
54
|
/**
|
|
57
55
|
* The entities of this layer. Use the `addEntity` API to add Enitities to ensure interoperability with vcm interfaces
|
|
58
56
|
* @type {import("@vcmap/cesium").EntityCollection}
|
|
@@ -86,12 +84,21 @@ class DataSource extends Layer {
|
|
|
86
84
|
];
|
|
87
85
|
}
|
|
88
86
|
|
|
87
|
+
/**
|
|
88
|
+
* @param {import("@vcmap/core").GlobalHider} globalHider
|
|
89
|
+
*/
|
|
90
|
+
setGlobalHider(globalHider) {
|
|
91
|
+
super.setGlobalHider(globalHider);
|
|
92
|
+
this._setUpFeatureVisibility();
|
|
93
|
+
}
|
|
94
|
+
|
|
89
95
|
/**
|
|
90
96
|
* Sets up listeners for featureVisibility and global hider
|
|
91
97
|
* @private
|
|
92
98
|
*/
|
|
93
99
|
_setUpFeatureVisibility() {
|
|
94
|
-
|
|
100
|
+
this._featureVisibilityListeners.forEach((cb) => { cb(); });
|
|
101
|
+
|
|
95
102
|
this._featureVisibilityListeners = [
|
|
96
103
|
this.featureVisibility.changed.addEventListener(({ action, ids }) => {
|
|
97
104
|
if (action === FeatureVisibilityAction.HIDE) {
|
|
@@ -103,28 +110,30 @@ class DataSource extends Layer {
|
|
|
103
110
|
});
|
|
104
111
|
} // highlight is _possible_ but very tricky with all the possible entity values with potential materials
|
|
105
112
|
}),
|
|
106
|
-
globalHider.changed.addEventListener(({ action, ids }) => {
|
|
107
|
-
if (action === FeatureVisibilityAction.HIDE) {
|
|
108
|
-
ids.forEach((id) => {
|
|
109
|
-
const entity = this.entities.getById(id);
|
|
110
|
-
if (entity) {
|
|
111
|
-
globalHider.addFeature(id, entity);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}),
|
|
116
113
|
this.entities.collectionChanged.addEventListener((c, added) => {
|
|
117
114
|
added.forEach((entity) => {
|
|
118
115
|
if (this.featureVisibility.hiddenObjects[entity.id]) {
|
|
119
116
|
this.featureVisibility.addHiddenFeature(entity.id, entity);
|
|
120
117
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
globalHider.addFeature(entity.id, entity);
|
|
118
|
+
if (this.globalHider && this.globalHider.hiddenObjects[entity.id]) {
|
|
119
|
+
this.globalHider.addFeature(entity.id, entity);
|
|
124
120
|
}
|
|
125
121
|
});
|
|
126
122
|
}),
|
|
127
123
|
];
|
|
124
|
+
|
|
125
|
+
if (this.globalHider) {
|
|
126
|
+
this._featureVisibilityListeners.push(this.globalHider.changed.addEventListener(({ action, ids }) => {
|
|
127
|
+
if (action === FeatureVisibilityAction.HIDE) {
|
|
128
|
+
ids.forEach((id) => {
|
|
129
|
+
const entity = this.entities.getById(id);
|
|
130
|
+
if (entity) {
|
|
131
|
+
this.globalHider.addFeature(id, entity);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
128
137
|
}
|
|
129
138
|
|
|
130
139
|
/**
|
|
@@ -151,11 +160,11 @@ class DataSource extends Layer {
|
|
|
151
160
|
|
|
152
161
|
/**
|
|
153
162
|
* @param {CesiumMap} map
|
|
154
|
-
* @returns {Array<
|
|
163
|
+
* @returns {Array<DataSourceCesiumImpl>}
|
|
155
164
|
*/
|
|
156
165
|
createImplementationsForMap(map) {
|
|
157
166
|
if (map instanceof CesiumMap) {
|
|
158
|
-
return [new
|
|
167
|
+
return [new DataSourceCesiumImpl(map, this.getImplementationOptions())];
|
|
159
168
|
}
|
|
160
169
|
return [];
|
|
161
170
|
}
|
|
@@ -183,7 +192,7 @@ class DataSource extends Layer {
|
|
|
183
192
|
*/
|
|
184
193
|
flyToEntity(id) {
|
|
185
194
|
this.getImplementations().forEach((impl) => {
|
|
186
|
-
/** @type {
|
|
195
|
+
/** @type {DataSourceCesiumImpl} */ (impl).flyToEntity(id);
|
|
187
196
|
});
|
|
188
197
|
}
|
|
189
198
|
|
|
@@ -255,5 +264,5 @@ class DataSource extends Layer {
|
|
|
255
264
|
}
|
|
256
265
|
}
|
|
257
266
|
|
|
258
|
-
|
|
259
|
-
export default
|
|
267
|
+
layerClassRegistry.registerClass(DataSourceLayer.className, DataSourceLayer);
|
|
268
|
+
export default DataSourceLayer;
|
|
@@ -3,18 +3,16 @@ import Style from 'ol/style/Style.js';
|
|
|
3
3
|
import { check } from '@vcsuite/check';
|
|
4
4
|
import { parseInteger } from '@vcsuite/parsers';
|
|
5
5
|
import Layer from './layer.js';
|
|
6
|
-
import StyleItem
|
|
7
|
-
import VectorStyleItem from '../
|
|
6
|
+
import StyleItem from '../style/styleItem.js';
|
|
7
|
+
import VectorStyleItem from '../style/vectorStyleItem.js';
|
|
8
8
|
import FeatureVisibility from './featureVisibility.js';
|
|
9
|
-
import { getStyleOrDefaultStyle } from '../
|
|
10
|
-
import VcsEvent from '../
|
|
11
|
-
import {
|
|
12
|
-
import { VcsClassRegistry } from '../classRegistry.js';
|
|
9
|
+
import { getStyleOrDefaultStyle } from '../style/styleFactory.js';
|
|
10
|
+
import VcsEvent from '../vcsEvent.js';
|
|
11
|
+
import { layerClassRegistry } from '../classRegistry.js';
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* @typedef {LayerOptions} FeatureLayerOptions
|
|
16
|
-
* @property {DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem|
|
|
17
|
-
* @property {string|undefined} activeStyleName - vcs:undocumented
|
|
15
|
+
* @property {DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem|undefined} style
|
|
18
16
|
* @property {Object|undefined} genericFeatureProperties - properties to add to generic features, eg for display in the balloon
|
|
19
17
|
* @property {number} [balloonHeightOffset=10]
|
|
20
18
|
* @property {FeatureVisibility|undefined} featureVisibility - vcs:undocumented
|
|
@@ -23,6 +21,7 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
23
21
|
|
|
24
22
|
/**
|
|
25
23
|
* @typedef {LayerImplementationOptions} FeatureLayerImplementationOptions
|
|
24
|
+
* @property {GlobalHider} globalHider
|
|
26
25
|
* @property {FeatureVisibility} featureVisibility
|
|
27
26
|
* @property {import("@vcmap/core").StyleItem} style
|
|
28
27
|
* @api
|
|
@@ -42,16 +41,15 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
42
41
|
*/
|
|
43
42
|
|
|
44
43
|
/**
|
|
45
|
-
* Base class for all layers representing features, e.g.
|
|
44
|
+
* Base class for all layers representing features, e.g. VectorLayer, Buildings, POIs
|
|
46
45
|
* @class
|
|
47
46
|
* @abstract
|
|
48
47
|
* @extends {Layer}
|
|
49
|
-
* @export
|
|
50
48
|
* @api
|
|
51
49
|
*/
|
|
52
50
|
class FeatureLayer extends Layer {
|
|
53
51
|
/** @type {string} */
|
|
54
|
-
static get className() { return '
|
|
52
|
+
static get className() { return 'FeatureLayer'; }
|
|
55
53
|
|
|
56
54
|
/**
|
|
57
55
|
* @returns {FeatureLayerOptions}
|
|
@@ -76,7 +74,7 @@ class FeatureLayer extends Layer {
|
|
|
76
74
|
* @type {import("@vcmap/core").StyleItem}
|
|
77
75
|
* @private
|
|
78
76
|
*/
|
|
79
|
-
this._style = this.getStyleOrDefaultStyle(options.
|
|
77
|
+
this._style = this.getStyleOrDefaultStyle(options.style);
|
|
80
78
|
/**
|
|
81
79
|
* @type {import("@vcmap/core").StyleItem}
|
|
82
80
|
* @private
|
|
@@ -143,11 +141,20 @@ class FeatureLayer extends Layer {
|
|
|
143
141
|
getImplementationOptions() {
|
|
144
142
|
return {
|
|
145
143
|
...super.getImplementationOptions(),
|
|
144
|
+
globalHider: this.globalHider,
|
|
146
145
|
featureVisibility: this.featureVisibility,
|
|
147
146
|
style: this.style,
|
|
148
147
|
};
|
|
149
148
|
}
|
|
150
149
|
|
|
150
|
+
/**
|
|
151
|
+
* @param {import("@vcmap/core").GlobalHider} globalHider
|
|
152
|
+
*/
|
|
153
|
+
setGlobalHider(globalHider) {
|
|
154
|
+
super.setGlobalHider(globalHider);
|
|
155
|
+
this.forceRedraw();
|
|
156
|
+
}
|
|
157
|
+
|
|
151
158
|
/**
|
|
152
159
|
* @param {Object|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap/cesium").Cesium3DTilePointFeature|import("@vcmap/cesium").Cesium3DTileFeature|DataSourcePickedObject} object
|
|
153
160
|
* @returns {?Object}
|
|
@@ -180,7 +187,7 @@ class FeatureLayer extends Layer {
|
|
|
180
187
|
}
|
|
181
188
|
|
|
182
189
|
/**
|
|
183
|
-
* @param {(
|
|
190
|
+
* @param {(DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem)=} styleOptions
|
|
184
191
|
* @param {(import("@vcmap/core").VectorStyleItem|import("@vcmap/core").DeclarativeStyleItem)=} defaultStyle
|
|
185
192
|
* @returns {import("@vcmap/core").StyleItem}
|
|
186
193
|
*/
|
|
@@ -191,21 +198,14 @@ class FeatureLayer extends Layer {
|
|
|
191
198
|
|
|
192
199
|
/**
|
|
193
200
|
* Sets the style based on a styleName on a layer
|
|
194
|
-
* @param {
|
|
201
|
+
* @param {import("ol/style/Style").default|import("ol/style/Style").StyleFunction|import("@vcmap/core").StyleItem} style
|
|
195
202
|
* @param {boolean=} silent
|
|
196
203
|
* @api
|
|
197
204
|
*/
|
|
198
205
|
setStyle(style, silent) {
|
|
199
|
-
check(style, [Style, StyleItem, Function
|
|
206
|
+
check(style, [Style, StyleItem, Function]);
|
|
200
207
|
|
|
201
|
-
if (
|
|
202
|
-
const styleItem = styleCollection.getByKey(style);
|
|
203
|
-
if (!styleItem) {
|
|
204
|
-
this.getLogger().warning(`could not find style with name ${style}`);
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
this._style = styleItem;
|
|
208
|
-
} else if (style instanceof StyleItem) {
|
|
208
|
+
if (style instanceof StyleItem) {
|
|
209
209
|
this._style = style;
|
|
210
210
|
} else {
|
|
211
211
|
this._style = new VectorStyleItem({});
|
|
@@ -232,11 +232,7 @@ class FeatureLayer extends Layer {
|
|
|
232
232
|
toJSON() {
|
|
233
233
|
const config = /** @type {FeatureLayerOptions} */ (super.toJSON());
|
|
234
234
|
if (!this.getStyleOrDefaultStyle().equals(this._style)) {
|
|
235
|
-
|
|
236
|
-
config.style = this.style.getReference();
|
|
237
|
-
} else {
|
|
238
|
-
config.style = this.style.getOptions();
|
|
239
|
-
}
|
|
235
|
+
config.style = this.style.toJSON();
|
|
240
236
|
}
|
|
241
237
|
|
|
242
238
|
if (Object.keys(this._genericFeatureProperties).length > 0) {
|
|
@@ -257,5 +253,5 @@ class FeatureLayer extends Layer {
|
|
|
257
253
|
}
|
|
258
254
|
}
|
|
259
255
|
|
|
260
|
-
|
|
256
|
+
layerClassRegistry.registerClass(FeatureLayer.className, FeatureLayer);
|
|
261
257
|
export default FeatureLayer;
|