@vcmap/core 5.0.0-rc.2 → 5.0.0-rc.22
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 +2567 -1914
- package/index.js +154 -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 +27 -19
- package/src/{vcs/vcm/interaction → interaction}/coordinateAtPixel.js +7 -10
- package/src/{vcs/vcm/interaction → interaction}/eventHandler.js +55 -4
- 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 +23 -34
- 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} +6 -4
- 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 +1 -1
- package/src/{vcs/vcm/layer/cesiumTileset.js → layer/cesiumTilesetLayer.js} +31 -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} +18 -12
- 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} +7 -8
- 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} +8 -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 +6 -7
- 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 +8 -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} +42 -44
- package/src/{vcs/vcm/maps → map}/mapState.js +0 -1
- package/src/{vcs/vcm/maps/oblique.js → map/obliqueMap.js} +59 -74
- package/src/{vcs/vcm/maps/openlayers.js → map/openlayersMap.js} +24 -22
- package/src/{vcs/vcm/maps/map.js → map/vcsMap.js} +48 -29
- 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} +19 -14
- 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 +2 -2
- package/src/ol/geom/geometryCollection.js +3 -4
- package/src/ol/render/canvas/canvasTileRenderer.js +0 -1
- package/src/overrideClassRegistry.js +204 -0
- package/src/{vcs/vcm/util/style → style}/declarativeStyleItem.js +37 -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 +6 -12
- package/src/{vcs/vcm/util → util}/collection.js +16 -4
- package/src/util/editor/createFeatureSession.js +182 -0
- package/src/util/editor/editGeometrySession.js +401 -0
- package/src/util/editor/editorHelpers.js +109 -0
- package/src/util/editor/editorSessionHelpers.js +107 -0
- package/src/util/editor/editorSymbols.js +10 -0
- package/src/util/editor/interactions/createBBoxInteraction.js +140 -0
- package/src/util/editor/interactions/createCircleInteraction.js +110 -0
- package/src/util/editor/interactions/createLineStringInteraction.js +108 -0
- package/src/util/editor/interactions/createPointInteraction.js +66 -0
- package/src/util/editor/interactions/createPolygonInteraction.js +125 -0
- package/src/util/editor/interactions/editGeometryMouseOverInteraction.js +133 -0
- package/src/util/editor/interactions/insertVertexInteraction.js +92 -0
- package/src/util/editor/interactions/mapInteractionController.js +99 -0
- package/src/util/editor/interactions/removeVertexInteraction.js +39 -0
- package/src/util/editor/interactions/selectSingleFeatureInteraction.js +95 -0
- package/src/util/editor/interactions/translateVertexInteraction.js +61 -0
- package/src/util/editor/validateGeoemetry.js +22 -0
- 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 +1 -2
- package/src/{vcs/vcm/util → util}/featureconverter/convert.js +0 -0
- package/src/util/featureconverter/extent3D.js +180 -0
- package/src/{vcs/vcm/util → util}/featureconverter/featureconverterHelper.js +11 -5
- package/src/{vcs/vcm/util → util}/featureconverter/lineStringToCesium.js +1 -2
- package/src/{vcs/vcm/util → util}/featureconverter/pointToCesium.js +10 -8
- package/src/{vcs/vcm/util → util}/featureconverter/polygonToCesium.js +2 -3
- 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 +102 -45
- package/src/{vcs/vcm/util → util}/math.js +9 -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 +11 -11
- package/src/{vcs/vcm/util → util}/urlHelpers.js +0 -0
- package/src/{vcs/vcm/util → util}/viewpoint.js +17 -21
- 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 +289 -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,10 +1,10 @@
|
|
|
1
1
|
import { checkMaybe } from '@vcsuite/check';
|
|
2
|
-
import
|
|
3
|
-
import DeclarativeStyleItem from '../
|
|
4
|
-
import VectorStyleItem from '../
|
|
5
|
-
import CesiumMap from '../
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
2
|
+
import CesiumTilesetLayer from './cesiumTilesetLayer.js';
|
|
3
|
+
import DeclarativeStyleItem from '../style/declarativeStyleItem.js';
|
|
4
|
+
import VectorStyleItem from '../style/vectorStyleItem.js';
|
|
5
|
+
import CesiumMap from '../map/cesiumMap.js';
|
|
6
|
+
import CesiumTilesetCesiumImpl from './cesium/cesiumTilesetCesiumImpl.js';
|
|
7
|
+
import { layerClassRegistry } from '../classRegistry.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @typedef {CesiumTilesetOptions} PointCloudOptions
|
|
@@ -24,7 +24,7 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
24
24
|
export const defaultPointCloudStyle = new DeclarativeStyleItem({});
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* represents a specific
|
|
27
|
+
* represents a specific PointCloudLayer layer for cesium.
|
|
28
28
|
* <h3>Config Parameter</h3>
|
|
29
29
|
* <ul>
|
|
30
30
|
* <li>url: string: url to the p3dm dataset
|
|
@@ -32,19 +32,18 @@ export const defaultPointCloudStyle = new DeclarativeStyleItem({});
|
|
|
32
32
|
* </ul>
|
|
33
33
|
*
|
|
34
34
|
* @class
|
|
35
|
-
* @
|
|
36
|
-
* @extends {CesiumTileset}
|
|
35
|
+
* @extends {CesiumTilesetLayer}
|
|
37
36
|
* @api stable
|
|
38
37
|
*/
|
|
39
|
-
class
|
|
40
|
-
static get className() { return '
|
|
38
|
+
class PointCloudLayer extends CesiumTilesetLayer {
|
|
39
|
+
static get className() { return 'PointCloudLayer'; }
|
|
41
40
|
|
|
42
41
|
/**
|
|
43
42
|
* @returns {PointCloudOptions}
|
|
44
43
|
*/
|
|
45
44
|
static getDefaultOptions() {
|
|
46
45
|
return {
|
|
47
|
-
...
|
|
46
|
+
...CesiumTilesetLayer.getDefaultOptions(),
|
|
48
47
|
pointSize: null,
|
|
49
48
|
};
|
|
50
49
|
}
|
|
@@ -55,7 +54,7 @@ class PointCloud extends CesiumTileset {
|
|
|
55
54
|
constructor(options) {
|
|
56
55
|
super(options);
|
|
57
56
|
|
|
58
|
-
const defaultOptions =
|
|
57
|
+
const defaultOptions = PointCloudLayer.getDefaultOptions();
|
|
59
58
|
/**
|
|
60
59
|
* The default point size to fall back on, if no point size is given. Uses Cesium default of 1 if null.
|
|
61
60
|
* @api
|
|
@@ -72,7 +71,7 @@ class PointCloud extends CesiumTileset {
|
|
|
72
71
|
|
|
73
72
|
/**
|
|
74
73
|
* @inheritDoc
|
|
75
|
-
* @param {(
|
|
74
|
+
* @param {(DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem)=} styleOptions
|
|
76
75
|
* @param {(VectorStyleItem|DeclarativeStyleItem)=} defaultStyle
|
|
77
76
|
* @returns {import("@vcmap/core").StyleItem}
|
|
78
77
|
*/
|
|
@@ -92,28 +91,21 @@ class PointCloud extends CesiumTileset {
|
|
|
92
91
|
set pointSize(size) {
|
|
93
92
|
checkMaybe(size, [Number, String]);
|
|
94
93
|
this._pointSize = size;
|
|
95
|
-
this.
|
|
96
|
-
/** @type {PointCloudCesium} */ (impl).updatePointSize(size);
|
|
97
|
-
});
|
|
94
|
+
/** @type {DeclarativeStyleItem} */ (this.style).pointSize = size?.toString();
|
|
98
95
|
}
|
|
99
96
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
getImplementationOptions() {
|
|
104
|
-
return {
|
|
105
|
-
...super.getImplementationOptions(),
|
|
106
|
-
pointSize: this.pointSize,
|
|
107
|
-
};
|
|
97
|
+
async initialize() {
|
|
98
|
+
await super.initialize();
|
|
99
|
+
this.pointSize = this._pointSize;
|
|
108
100
|
}
|
|
109
101
|
|
|
110
102
|
/**
|
|
111
103
|
* @param {import("@vcmap/core").VcsMap} map
|
|
112
|
-
* @returns {Array<
|
|
104
|
+
* @returns {Array<CesiumTilesetCesiumImpl>}
|
|
113
105
|
*/
|
|
114
106
|
createImplementationsForMap(map) {
|
|
115
107
|
if (map instanceof CesiumMap) {
|
|
116
|
-
return [new
|
|
108
|
+
return [new CesiumTilesetCesiumImpl(map, this.getImplementationOptions())];
|
|
117
109
|
}
|
|
118
110
|
|
|
119
111
|
return [];
|
|
@@ -129,8 +121,8 @@ class PointCloud extends CesiumTileset {
|
|
|
129
121
|
}
|
|
130
122
|
|
|
131
123
|
/**
|
|
132
|
-
* Sets a new declarative style. Cannot set a
|
|
133
|
-
* @param {
|
|
124
|
+
* Sets a new declarative style. Cannot set a VectorLayer style on PointCloudLayer layers.
|
|
125
|
+
* @param {import("ol/style/Style").default|import("ol/style/Style").StyleFunction|import("@vcmap/core").StyleItem} style
|
|
134
126
|
* @param {boolean=} silent
|
|
135
127
|
* @api
|
|
136
128
|
*/
|
|
@@ -148,7 +140,7 @@ class PointCloud extends CesiumTileset {
|
|
|
148
140
|
*/
|
|
149
141
|
toJSON() {
|
|
150
142
|
const config = /** @type {PointCloudOptions} */ (super.toJSON());
|
|
151
|
-
const defaultOptions =
|
|
143
|
+
const defaultOptions = PointCloudLayer.getDefaultOptions();
|
|
152
144
|
|
|
153
145
|
if (this.defaultPointSize !== defaultOptions.pointSize) {
|
|
154
146
|
config.pointSize = this.defaultPointSize;
|
|
@@ -158,5 +150,5 @@ class PointCloud extends CesiumTileset {
|
|
|
158
150
|
}
|
|
159
151
|
}
|
|
160
152
|
|
|
161
|
-
|
|
162
|
-
export default
|
|
153
|
+
layerClassRegistry.registerClass(PointCloudLayer.className, PointCloudLayer);
|
|
154
|
+
export default PointCloudLayer;
|
|
@@ -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);
|