@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,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SplitDirection, WebMercatorTilingScheme, GeographicTilingScheme, Cartographic } from '@vcmap/cesium';
|
|
2
2
|
import { getBottomLeft, getBottomRight, getTopLeft, getTopRight } from 'ol/extent.js';
|
|
3
3
|
|
|
4
4
|
import { parseInteger, parseNumberRange, parseEnumValue } from '@vcsuite/parsers';
|
|
5
5
|
import { wgs84Projection } from '../util/projection.js';
|
|
6
6
|
import Layer from './layer.js';
|
|
7
|
-
import VcsEvent from '../
|
|
7
|
+
import VcsEvent from '../vcsEvent.js';
|
|
8
8
|
import Extent from '../util/extent.js';
|
|
9
|
-
import {
|
|
9
|
+
import { layerClassRegistry } from '../classRegistry.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @typedef {LayerOptions} RasterLayerOptions
|
|
@@ -24,14 +24,14 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
24
24
|
* @property {number} maxLevel
|
|
25
25
|
* @property {string} tilingSchema
|
|
26
26
|
* @property {number} opacity
|
|
27
|
-
* @property {import("@vcmap/cesium").
|
|
27
|
+
* @property {import("@vcmap/cesium").SplitDirection} splitDirection
|
|
28
28
|
* @property {Extent|undefined} extent
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* @typedef {import("@vcmap/core").LayerImplementation<import("@vcmap/core").VcsMap>} RasterLayerImplementation
|
|
33
33
|
* @property {function(number):void} updateOpacity
|
|
34
|
-
* @property {function(import("@vcmap/cesium").
|
|
34
|
+
* @property {function(import("@vcmap/cesium").SplitDirection):void} updateSplitDirection
|
|
35
35
|
* @api
|
|
36
36
|
*/
|
|
37
37
|
|
|
@@ -41,7 +41,6 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
41
41
|
* @api
|
|
42
42
|
* @property {string} GEOGRAPHIC
|
|
43
43
|
* @property {string} MERCATOR
|
|
44
|
-
* @export
|
|
45
44
|
*/
|
|
46
45
|
export const TilingScheme = {
|
|
47
46
|
GEOGRAPHIC: 'geographic',
|
|
@@ -112,13 +111,12 @@ export function calculateMinLevel(extent, tilingScheme, maxLevel, minLevel = 0)
|
|
|
112
111
|
* This abstract class allows for automatic loading scheme determination
|
|
113
112
|
* for raster layers
|
|
114
113
|
* @class
|
|
115
|
-
* @export
|
|
116
114
|
* @extends {Layer}
|
|
117
115
|
* @implements {SplitLayer}
|
|
118
116
|
* @abstract
|
|
119
117
|
*/
|
|
120
118
|
class RasterLayer extends Layer {
|
|
121
|
-
static get className() { return '
|
|
119
|
+
static get className() { return 'RasterLayer'; }
|
|
122
120
|
|
|
123
121
|
/**
|
|
124
122
|
* @returns {RasterLayerOptions}
|
|
@@ -166,18 +164,18 @@ class RasterLayer extends Layer {
|
|
|
166
164
|
*/
|
|
167
165
|
this._opacity = parseNumberRange(options.opacity, defaultOptions.opacity, 0.0, 1.0);
|
|
168
166
|
|
|
169
|
-
/** @type {import("@vcmap/cesium").
|
|
170
|
-
this._splitDirection =
|
|
167
|
+
/** @type {import("@vcmap/cesium").SplitDirection} */
|
|
168
|
+
this._splitDirection = SplitDirection.NONE;
|
|
171
169
|
|
|
172
170
|
if (options.splitDirection) {
|
|
173
171
|
this._splitDirection = options.splitDirection === 'left' ?
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
SplitDirection.LEFT :
|
|
173
|
+
SplitDirection.RIGHT;
|
|
176
174
|
}
|
|
177
175
|
|
|
178
176
|
/**
|
|
179
177
|
* raised if the split direction changes, is passed the split direction as its only argument
|
|
180
|
-
* @type {VcsEvent<import("@vcmap/cesium").
|
|
178
|
+
* @type {VcsEvent<import("@vcmap/cesium").SplitDirection>}
|
|
181
179
|
* @api
|
|
182
180
|
*/
|
|
183
181
|
this.splitDirectionChanged = new VcsEvent();
|
|
@@ -186,12 +184,12 @@ class RasterLayer extends Layer {
|
|
|
186
184
|
/**
|
|
187
185
|
* The split directions of this layer
|
|
188
186
|
* @api
|
|
189
|
-
* @type {import("@vcmap/cesium").
|
|
187
|
+
* @type {import("@vcmap/cesium").SplitDirection}
|
|
190
188
|
*/
|
|
191
189
|
get splitDirection() { return this._splitDirection; }
|
|
192
190
|
|
|
193
191
|
/**
|
|
194
|
-
* @param {import("@vcmap/cesium").
|
|
192
|
+
* @param {import("@vcmap/cesium").SplitDirection} direction
|
|
195
193
|
*/
|
|
196
194
|
set splitDirection(direction) {
|
|
197
195
|
if (direction !== this._splitDirection) {
|
|
@@ -272,8 +270,8 @@ class RasterLayer extends Layer {
|
|
|
272
270
|
config.opacity = this.opacity;
|
|
273
271
|
}
|
|
274
272
|
|
|
275
|
-
if (this._splitDirection !==
|
|
276
|
-
config.splitDirection = this._splitDirection ===
|
|
273
|
+
if (this._splitDirection !== SplitDirection.NONE) {
|
|
274
|
+
config.splitDirection = this._splitDirection === SplitDirection.RIGHT ?
|
|
277
275
|
'right' :
|
|
278
276
|
'left';
|
|
279
277
|
}
|
|
@@ -290,5 +288,5 @@ class RasterLayer extends Layer {
|
|
|
290
288
|
}
|
|
291
289
|
}
|
|
292
290
|
|
|
293
|
-
|
|
291
|
+
layerClassRegistry.registerClass(RasterLayer.className, RasterLayer);
|
|
294
292
|
export default RasterLayer;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { check } from '@vcsuite/check';
|
|
2
2
|
import RasterLayer from './rasterLayer.js';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import CesiumMap from '../
|
|
6
|
-
import
|
|
3
|
+
import SingleImageCesiumImpl from './cesium/singleImageCesiumImpl.js';
|
|
4
|
+
import SingleImageOpenlayersImpl from './openlayers/singleImageOpenlayersImpl.js';
|
|
5
|
+
import CesiumMap from '../map/cesiumMap.js';
|
|
6
|
+
import OpenlayersMap from '../map/openlayersMap.js';
|
|
7
7
|
import Extent from '../util/extent.js';
|
|
8
|
-
import {
|
|
8
|
+
import { layerClassRegistry } from '../classRegistry.js';
|
|
9
|
+
import { wgs84Projection } from '../util/projection.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* @typedef {RasterLayerOptions} SingleImageOptions
|
|
@@ -19,14 +20,13 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
19
20
|
*/
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
|
-
* Image layer for Cesium and
|
|
23
|
+
* Image layer for Cesium and OpenlayersMap
|
|
23
24
|
* @class
|
|
24
|
-
* @export
|
|
25
25
|
* @extends {RasterLayer}
|
|
26
26
|
* @api stable
|
|
27
27
|
*/
|
|
28
|
-
class
|
|
29
|
-
static get className() { return '
|
|
28
|
+
class SingleImageLayer extends RasterLayer {
|
|
29
|
+
static get className() { return 'SingleImageLayer'; }
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* @returns {SingleImageOptions}
|
|
@@ -43,21 +43,21 @@ class SingleImage extends RasterLayer {
|
|
|
43
43
|
*/
|
|
44
44
|
constructor(options) {
|
|
45
45
|
super(options);
|
|
46
|
-
const defaultOptions =
|
|
46
|
+
const defaultOptions = SingleImageLayer.getDefaultOptions();
|
|
47
47
|
/** @type {string} */
|
|
48
48
|
this.credit = options.credit || defaultOptions.credit;
|
|
49
49
|
|
|
50
50
|
if (!this.extent.isValid()) {
|
|
51
51
|
this.getLogger().warning(`layer ${this.name} was constructed with an invalid extent, defaulting to global extent`);
|
|
52
52
|
this.extent = new Extent({
|
|
53
|
-
|
|
53
|
+
projection: wgs84Projection.toJSON(),
|
|
54
54
|
coordinates: [-180, -90, 180, 90],
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
this._supportedMaps = [
|
|
59
59
|
CesiumMap.className,
|
|
60
|
-
|
|
60
|
+
OpenlayersMap.className,
|
|
61
61
|
];
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -73,13 +73,13 @@ class SingleImage extends RasterLayer {
|
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* @param {import("@vcmap/core").VcsMap} map
|
|
76
|
-
* @returns {Array<
|
|
76
|
+
* @returns {Array<SingleImageOpenlayersImpl|SingleImageCesiumImpl>}
|
|
77
77
|
*/
|
|
78
78
|
createImplementationsForMap(map) {
|
|
79
79
|
if (map instanceof CesiumMap) {
|
|
80
|
-
return [new
|
|
81
|
-
} else if (map instanceof
|
|
82
|
-
return [new
|
|
80
|
+
return [new SingleImageCesiumImpl(map, this.getImplementationOptions())];
|
|
81
|
+
} else if (map instanceof OpenlayersMap) {
|
|
82
|
+
return [new SingleImageOpenlayersImpl(map, this.getImplementationOptions())];
|
|
83
83
|
}
|
|
84
84
|
return [];
|
|
85
85
|
}
|
|
@@ -115,5 +115,5 @@ class SingleImage extends RasterLayer {
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
export default
|
|
118
|
+
layerClassRegistry.registerClass(SingleImageLayer.className, SingleImageLayer);
|
|
119
|
+
export default SingleImageLayer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CesiumTerrainProvider, Cartographic, Cartesian2, sampleTerrainMostDetailed
|
|
1
|
+
import { CesiumTerrainProvider, Cartographic, Cartesian2, sampleTerrainMostDetailed } from '@vcmap/cesium';
|
|
2
2
|
import { getTransform } from 'ol/proj.js';
|
|
3
|
-
import
|
|
3
|
+
import { wgs84Projection } from '../util/projection.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {Object} TerrainProviderOptions
|
|
@@ -26,7 +26,7 @@ export function getTerrainProviderForUrl(options) {
|
|
|
26
26
|
}
|
|
27
27
|
let terrainProvider = terrainProviders[options.url];
|
|
28
28
|
if ((options.requestVertexNormals !== undefined &&
|
|
29
|
-
|
|
29
|
+
terrainProvider.requestVertexNormals !== options.requestVertexNormals) ||
|
|
30
30
|
(options.requestWaterMask !== undefined &&
|
|
31
31
|
terrainProvider.requestWaterMask !== options.requestWaterMask)) {
|
|
32
32
|
terrainProviders[options.url] = new CesiumTerrainProvider(options);
|
|
@@ -35,52 +35,18 @@ export function getTerrainProviderForUrl(options) {
|
|
|
35
35
|
return terrainProvider;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
/**
|
|
39
|
-
* @param {import("@vcmap/cesium").CesiumTerrainProvider} terrainProvider
|
|
40
|
-
* @param {Array<import("@vcmap/cesium").Cartographic>} positions
|
|
41
|
-
* @returns {Promise<Array<import("@vcmap/cesium").Cartographic>>}
|
|
42
|
-
*/
|
|
43
|
-
export function sampleCesiumTerrainMostDetailed(terrainProvider, positions) {
|
|
44
|
-
return new Promise((resolve, reject) => {
|
|
45
|
-
sampleTerrainMostDetailed(terrainProvider, positions)
|
|
46
|
-
.then((updatedPositions) => {
|
|
47
|
-
resolve(updatedPositions);
|
|
48
|
-
}, reject);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* updates the height of the positions in place.
|
|
54
|
-
* @param {import("@vcmap/cesium").CesiumTerrainProvider} terrainProvider
|
|
55
|
-
* @param {number} level
|
|
56
|
-
* @param {Array<import("@vcmap/cesium").Cartographic>} positions
|
|
57
|
-
* @returns {Promise<Array<import("@vcmap/cesium").Cartographic>>}
|
|
58
|
-
*/
|
|
59
|
-
export function sampleCesiumTerrain(terrainProvider, level, positions) {
|
|
60
|
-
return new Promise((resolve, reject) => {
|
|
61
|
-
sampleTerrain(terrainProvider, level, positions)
|
|
62
|
-
.then((updatedPositions) => {
|
|
63
|
-
resolve(updatedPositions);
|
|
64
|
-
}, reject);
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
38
|
/**
|
|
69
39
|
* changes input coordinate Array in place, new height can also be accessed by coordinates[x][2]
|
|
70
40
|
* @param {import("@vcmap/cesium").CesiumTerrainProvider} terrainProvider
|
|
71
41
|
* @param {Array<import("ol/coordinate").Coordinate>} coordinates
|
|
72
|
-
* @param {
|
|
42
|
+
* @param {import("@vcmap/core").Projection=} optSourceProjection - if input is not WGS84
|
|
73
43
|
* @param {Array<import("ol/coordinate").Coordinate>=} result
|
|
74
44
|
* @returns {Promise<Array<import("ol/coordinate").Coordinate>>}
|
|
75
45
|
*/
|
|
76
46
|
export function getHeightFromTerrainProvider(terrainProvider, coordinates, optSourceProjection, result) {
|
|
77
|
-
const
|
|
78
|
-
optSourceProjection.proj :
|
|
79
|
-
optSourceProjection;
|
|
80
|
-
|
|
81
|
-
const sourceTransformer = usedProj ?
|
|
47
|
+
const sourceTransformer = optSourceProjection ?
|
|
82
48
|
getTransform(
|
|
83
|
-
|
|
49
|
+
optSourceProjection.proj,
|
|
84
50
|
wgs84Projection.proj,
|
|
85
51
|
) :
|
|
86
52
|
null;
|
|
@@ -93,15 +59,13 @@ export function getHeightFromTerrainProvider(terrainProvider, coordinates, optSo
|
|
|
93
59
|
});
|
|
94
60
|
|
|
95
61
|
const outArray = result || coordinates.map(c => c.slice());
|
|
96
|
-
return
|
|
97
|
-
|
|
98
|
-
.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}, reject);
|
|
104
|
-
});
|
|
62
|
+
return sampleTerrainMostDetailed(terrainProvider, positions)
|
|
63
|
+
.then((updatedPositions) => {
|
|
64
|
+
updatedPositions.forEach((position, index) => {
|
|
65
|
+
outArray[index][2] = position.height || 0;
|
|
66
|
+
});
|
|
67
|
+
return outArray;
|
|
68
|
+
});
|
|
105
69
|
}
|
|
106
70
|
|
|
107
71
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { parseBoolean } from '@vcsuite/parsers';
|
|
2
2
|
import Layer from './layer.js';
|
|
3
3
|
import { getHeightFromTerrainProvider, getTerrainProviderForUrl } from './terrainHelpers.js';
|
|
4
|
-
import CesiumMap from '../
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
4
|
+
import CesiumMap from '../map/cesiumMap.js';
|
|
5
|
+
import TerrainCesiumImpl from './cesium/terrainCesiumImpl.js';
|
|
6
|
+
import { layerClassRegistry } from '../classRegistry.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @typedef {LayerOptions} TerrainOptions
|
|
@@ -21,12 +21,11 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
21
21
|
/**
|
|
22
22
|
* represents a terrain layer.
|
|
23
23
|
* @class
|
|
24
|
-
* @export
|
|
25
24
|
* @extends {Layer}
|
|
26
25
|
* @api stable
|
|
27
26
|
*/
|
|
28
|
-
class
|
|
29
|
-
static get className() { return '
|
|
27
|
+
class TerrainLayer extends Layer {
|
|
28
|
+
static get className() { return 'TerrainLayer'; }
|
|
30
29
|
|
|
31
30
|
/**
|
|
32
31
|
* @returns {TerrainOptions}
|
|
@@ -44,7 +43,7 @@ class Terrain extends Layer {
|
|
|
44
43
|
*/
|
|
45
44
|
constructor(options) {
|
|
46
45
|
super(options);
|
|
47
|
-
const defaultOptions =
|
|
46
|
+
const defaultOptions = TerrainLayer.getDefaultOptions();
|
|
48
47
|
|
|
49
48
|
this._supportedMaps = [
|
|
50
49
|
CesiumMap.className,
|
|
@@ -77,11 +76,11 @@ class Terrain extends Layer {
|
|
|
77
76
|
/**
|
|
78
77
|
* @inheritDoc
|
|
79
78
|
* @param {import("@vcmap/core").VcsMap} map
|
|
80
|
-
* @returns {Array<
|
|
79
|
+
* @returns {Array<TerrainCesiumImpl>}
|
|
81
80
|
*/
|
|
82
81
|
createImplementationsForMap(map) {
|
|
83
82
|
if (map instanceof CesiumMap) {
|
|
84
|
-
return [new
|
|
83
|
+
return [new TerrainCesiumImpl(map, this.getImplementationOptions())];
|
|
85
84
|
}
|
|
86
85
|
return [];
|
|
87
86
|
}
|
|
@@ -106,7 +105,7 @@ class Terrain extends Layer {
|
|
|
106
105
|
*/
|
|
107
106
|
toJSON() {
|
|
108
107
|
const config = /** @type {TerrainOptions} */ (super.toJSON());
|
|
109
|
-
const defaultOptions =
|
|
108
|
+
const defaultOptions = TerrainLayer.getDefaultOptions();
|
|
110
109
|
|
|
111
110
|
if (this.requestVertexNormals !== defaultOptions.requestVertexNormals) {
|
|
112
111
|
config.requestVertexNormals = this.requestVertexNormals;
|
|
@@ -118,5 +117,5 @@ class Terrain extends Layer {
|
|
|
118
117
|
}
|
|
119
118
|
}
|
|
120
119
|
|
|
121
|
-
|
|
122
|
-
export default
|
|
120
|
+
layerClassRegistry.registerClass(TerrainLayer.className, TerrainLayer);
|
|
121
|
+
export default TerrainLayer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import CesiumTilesetCesiumImpl from './cesium/cesiumTilesetCesiumImpl.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @param {
|
|
4
|
+
* @param {CesiumTilesetCesiumImpl} impl
|
|
5
5
|
* @param {number=} timeout
|
|
6
6
|
* @returns {Promise<void>}
|
|
7
7
|
*/
|
|
@@ -26,13 +26,13 @@ function waitForImplTilesLoaded(impl, timeout) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* @param {import("@vcmap/core").
|
|
29
|
+
* @param {import("@vcmap/core").CesiumTilesetLayer|import("@vcmap/core").FeatureStoreLayer} layer
|
|
30
30
|
* @param {number=} timeout
|
|
31
31
|
* @returns {Promise<void>}
|
|
32
32
|
*/
|
|
33
33
|
export async function tiledLayerLoaded(layer, timeout) {
|
|
34
|
-
const impls = /** @type {Array<
|
|
35
|
-
(layer.getImplementations().filter(i => i instanceof
|
|
34
|
+
const impls = /** @type {Array<CesiumTilesetCesiumImpl>} */
|
|
35
|
+
(layer.getImplementations().filter(i => i instanceof CesiumTilesetCesiumImpl));
|
|
36
36
|
if (!layer.active || impls.every(i => i.cesium3DTileset.tilesLoaded)) {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
1
|
import MVT from 'ol/format/MVT.js';
|
|
3
2
|
import Feature from 'ol/Feature.js';
|
|
4
3
|
import { getCenter } from 'ol/extent.js';
|
|
5
4
|
import TileProvider, { rectangleToExtent } from './tileProvider.js';
|
|
6
5
|
import { getURL } from './urlTemplateTileProvider.js';
|
|
6
|
+
import { requestArrayBuffer } from '../../util/fetch.js';
|
|
7
|
+
import { tileProviderClassRegistry } from '../../classRegistry.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* @typedef {TileProviderOptions} MVTTileProviderOptions
|
|
@@ -17,7 +18,6 @@ import { getURL } from './urlTemplateTileProvider.js';
|
|
|
17
18
|
*
|
|
18
19
|
* @class
|
|
19
20
|
* @extends {TileProvider}
|
|
20
|
-
* @export
|
|
21
21
|
* @api
|
|
22
22
|
*/
|
|
23
23
|
class MVTTileProvider extends TileProvider {
|
|
@@ -25,7 +25,7 @@ class MVTTileProvider extends TileProvider {
|
|
|
25
25
|
* @readonly
|
|
26
26
|
* @returns {string}
|
|
27
27
|
*/
|
|
28
|
-
static get className() { return '
|
|
28
|
+
static get className() { return 'MVTTileProvider'; }
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* @returns {MVTTileProviderOptions}
|
|
@@ -62,6 +62,26 @@ class MVTTileProvider extends TileProvider {
|
|
|
62
62
|
this._MVTFormat = new MVT({ featureClass: Feature });
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
/**
|
|
66
|
+
* @type {string}
|
|
67
|
+
*/
|
|
68
|
+
get locale() {
|
|
69
|
+
return super.locale;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* sets the locale and clears the Cache if the URL is a locale aware Object.
|
|
74
|
+
* @param {string} value
|
|
75
|
+
*/
|
|
76
|
+
set locale(value) {
|
|
77
|
+
if (this.locale !== value) {
|
|
78
|
+
super.locale = value;
|
|
79
|
+
if (this.url.includes('{locale}')) {
|
|
80
|
+
this.clearCache();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
65
85
|
/**
|
|
66
86
|
* @inheritDoc
|
|
67
87
|
* @param {number} x
|
|
@@ -71,12 +91,12 @@ class MVTTileProvider extends TileProvider {
|
|
|
71
91
|
*/
|
|
72
92
|
async loader(x, y, z) {
|
|
73
93
|
const rectangle = this.tilingScheme.tileXYToRectangle(x, y, z);
|
|
74
|
-
const url = getURL(this.url, x, y, z, rectangle);
|
|
94
|
+
const url = getURL(this.url, x, y, z, rectangle, this.locale);
|
|
75
95
|
const extent = rectangleToExtent(rectangle);
|
|
76
96
|
const center = getCenter(extent);
|
|
77
|
-
const
|
|
97
|
+
const data = await requestArrayBuffer(url);
|
|
78
98
|
const features = /** @type {Array<import("ol").Feature<import("ol/geom/Geometry").default>>} */
|
|
79
|
-
(this._MVTFormat.readFeatures(
|
|
99
|
+
(this._MVTFormat.readFeatures(data));
|
|
80
100
|
const sx = ((extent[2] - extent[0]) / 4096);
|
|
81
101
|
const sy = -((extent[3] - extent[1]) / 4096);
|
|
82
102
|
features.forEach((feature) => {
|
|
@@ -99,6 +119,23 @@ class MVTTileProvider extends TileProvider {
|
|
|
99
119
|
});
|
|
100
120
|
return features;
|
|
101
121
|
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @returns {MVTTileProviderOptions}
|
|
125
|
+
*/
|
|
126
|
+
toJSON() {
|
|
127
|
+
const config = /** @type {MVTTileProviderOptions} */ (super.toJSON());
|
|
128
|
+
|
|
129
|
+
if (this.url) {
|
|
130
|
+
config.url = this.url;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (this.idProperty) {
|
|
134
|
+
config.idProperty = this.idProperty;
|
|
135
|
+
}
|
|
136
|
+
return config;
|
|
137
|
+
}
|
|
102
138
|
}
|
|
103
139
|
|
|
104
140
|
export default MVTTileProvider;
|
|
141
|
+
tileProviderClassRegistry.registerClass(MVTTileProvider.className, MVTTileProvider);
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { parseGeoJSON } from '../geojsonHelpers.js';
|
|
2
|
+
import TileProvider from './tileProvider.js';
|
|
3
|
+
import { requestJson } from '../../util/fetch.js';
|
|
4
|
+
import { tileProviderClassRegistry } from '../../classRegistry.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {TileProviderOptions} StaticGeoJSONTileProviderOptions
|
|
8
|
+
* @property {string} url - url to the geojson
|
|
9
|
+
* @api
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Loads the provided geojson url and tiles the content in memory, data is only requested once
|
|
14
|
+
*
|
|
15
|
+
* @class
|
|
16
|
+
* @extends {TileProvider}
|
|
17
|
+
* @api
|
|
18
|
+
*/
|
|
19
|
+
class StaticGeoJSONTileProvider extends TileProvider {
|
|
20
|
+
/**
|
|
21
|
+
* @readonly
|
|
22
|
+
* @returns {string}
|
|
23
|
+
*/
|
|
24
|
+
static get className() { return 'StaticGeoJSONTileProvider'; }
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @returns {StaticGeoJSONTileProviderOptions}
|
|
28
|
+
*/
|
|
29
|
+
static getDefaultOptions() {
|
|
30
|
+
return {
|
|
31
|
+
...TileProvider.getDefaultOptions(),
|
|
32
|
+
url: undefined,
|
|
33
|
+
baseLevels: [0],
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param {StaticGeoJSONTileProviderOptions} options
|
|
39
|
+
*/
|
|
40
|
+
constructor(options) {
|
|
41
|
+
const defaultOptions = StaticGeoJSONTileProvider.getDefaultOptions();
|
|
42
|
+
options.baseLevels = defaultOptions.baseLevels;
|
|
43
|
+
super(options);
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @type {string}
|
|
47
|
+
*/
|
|
48
|
+
this.url = options.url || defaultOptions.url;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @inheritDoc
|
|
54
|
+
* @param {number} x
|
|
55
|
+
* @param {number} y
|
|
56
|
+
* @param {number} z
|
|
57
|
+
* @returns {Promise<Array<import("ol").Feature<import("ol/geom/Geometry").default>>>}
|
|
58
|
+
*/
|
|
59
|
+
// eslint-disable-next-line no-unused-vars
|
|
60
|
+
async loader(x, y, z) {
|
|
61
|
+
const data = await requestJson(this.url);
|
|
62
|
+
const { features } = parseGeoJSON(data, { dynamicStyle: true });
|
|
63
|
+
return features;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @returns {StaticGeoJSONTileProviderOptions}
|
|
68
|
+
*/
|
|
69
|
+
toJSON() {
|
|
70
|
+
const config = /** @type {StaticGeoJSONTileProviderOptions} */ (super.toJSON());
|
|
71
|
+
delete config.baseLevels;
|
|
72
|
+
|
|
73
|
+
if (this.url) {
|
|
74
|
+
config.url = this.url;
|
|
75
|
+
}
|
|
76
|
+
return config;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default StaticGeoJSONTileProvider;
|
|
81
|
+
tileProviderClassRegistry.registerClass(StaticGeoJSONTileProvider.className, StaticGeoJSONTileProvider);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { v4 as uuidv4 } from 'uuid';
|
|
2
2
|
import RBush from 'rbush';
|
|
3
|
+
import { check } from '@vcsuite/check';
|
|
3
4
|
import { Rectangle, Math as CesiumMath, WebMercatorTilingScheme, Cartographic } from '@vcmap/cesium';
|
|
4
5
|
import LRUCache from 'ol/structs/LRUCache.js';
|
|
5
6
|
import { buffer, createOrUpdateFromCoordinate } from 'ol/extent.js';
|
|
@@ -10,8 +11,9 @@ import {
|
|
|
10
11
|
wgs84Projection,
|
|
11
12
|
wgs84ToMercatorTransformer,
|
|
12
13
|
} from '../../util/projection.js';
|
|
13
|
-
import VcsObject from '../../
|
|
14
|
-
import VcsEvent from '../../
|
|
14
|
+
import VcsObject from '../../vcsObject.js';
|
|
15
|
+
import VcsEvent from '../../vcsEvent.js';
|
|
16
|
+
import { tileProviderClassRegistry } from '../../classRegistry.js';
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* @typedef {Object} tileProviderRTreeEntry
|
|
@@ -74,7 +76,6 @@ export function rectangleToExtent(rectangle) {
|
|
|
74
76
|
*
|
|
75
77
|
* @class
|
|
76
78
|
* @extends {VcsObject}
|
|
77
|
-
* @export
|
|
78
79
|
* @api
|
|
79
80
|
*/
|
|
80
81
|
class TileProvider extends VcsObject {
|
|
@@ -82,7 +83,7 @@ class TileProvider extends VcsObject {
|
|
|
82
83
|
* @readonly
|
|
83
84
|
* @returns {string}
|
|
84
85
|
*/
|
|
85
|
-
static get className() { return '
|
|
86
|
+
static get className() { return 'TileProvider'; }
|
|
86
87
|
|
|
87
88
|
/**
|
|
88
89
|
* @returns {TileProviderOptions}
|
|
@@ -176,6 +177,12 @@ class TileProvider extends VcsObject {
|
|
|
176
177
|
* @api
|
|
177
178
|
*/
|
|
178
179
|
this.tileLoadedEvent = new VcsEvent();
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @type {string}
|
|
183
|
+
* @private
|
|
184
|
+
*/
|
|
185
|
+
this._locale = 'en';
|
|
179
186
|
}
|
|
180
187
|
|
|
181
188
|
/**
|
|
@@ -188,6 +195,26 @@ class TileProvider extends VcsObject {
|
|
|
188
195
|
return this._tileCacheSize;
|
|
189
196
|
}
|
|
190
197
|
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @type {string}
|
|
201
|
+
*/
|
|
202
|
+
get locale() {
|
|
203
|
+
return this._locale;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* sets the locale and reloads the layer the if the URL is a locale aware Object.
|
|
208
|
+
* @param {string} value
|
|
209
|
+
*/
|
|
210
|
+
set locale(value) {
|
|
211
|
+
check(value, String);
|
|
212
|
+
if (this._locale !== value) {
|
|
213
|
+
this._locale = value;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
|
|
191
218
|
/**
|
|
192
219
|
* @param {number} value
|
|
193
220
|
* @returns {Promise<*>}
|
|
@@ -494,7 +521,7 @@ class TileProvider extends VcsObject {
|
|
|
494
521
|
}
|
|
495
522
|
|
|
496
523
|
/**
|
|
497
|
-
* Public API to load features from a source (for example a rest API, or
|
|
524
|
+
* Public API to load features from a source (for example a rest API, or WfsLayer)
|
|
498
525
|
*
|
|
499
526
|
* Can be used to write custom TileProvider to provide an interface to a "feature Source"
|
|
500
527
|
* Can also be used to manipulate the features, for example setting an ID Prefix or filter the features.
|
|
@@ -538,13 +565,20 @@ class TileProvider extends VcsObject {
|
|
|
538
565
|
config.tileCacheSize = this.tileCacheSize;
|
|
539
566
|
}
|
|
540
567
|
|
|
541
|
-
if (
|
|
568
|
+
if (!(
|
|
569
|
+
this.baseLevels.length === defaultOptions.baseLevels.length &&
|
|
570
|
+
this.baseLevels.every(level => defaultOptions.baseLevels.includes(level))
|
|
571
|
+
)) {
|
|
542
572
|
config.baseLevels = this.baseLevels.slice();
|
|
543
573
|
}
|
|
544
574
|
|
|
545
575
|
if (defaultOptions.trackFeaturesToTiles !== this.trackFeaturesToTiles) {
|
|
546
576
|
config.trackFeaturesToTiles = this.trackFeaturesToTiles;
|
|
547
577
|
}
|
|
578
|
+
|
|
579
|
+
if (defaultOptions.allowTileAggregation !== this.allowTileAggregation) {
|
|
580
|
+
config.allowTileAggregation = this.allowTileAggregation;
|
|
581
|
+
}
|
|
548
582
|
return config;
|
|
549
583
|
}
|
|
550
584
|
|
|
@@ -582,3 +616,4 @@ class TileProvider extends VcsObject {
|
|
|
582
616
|
}
|
|
583
617
|
|
|
584
618
|
export default TileProvider;
|
|
619
|
+
tileProviderClassRegistry.registerClass(TileProvider.className, TileProvider);
|