@vcmap/core 5.0.0-rc.1 → 5.0.0-rc.10
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 +2208 -2072
- package/index.js +137 -131
- package/package.json +10 -22
- package/src/category/appBackedCategory.js +76 -0
- package/src/category/category.js +401 -0
- package/src/category/categoryCollection.js +145 -0
- package/src/cesium/cesium3DTileFeature.js +1 -1
- package/src/classRegistry.js +168 -0
- package/src/context.js +73 -0
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/abstractFeatureProvider.js +8 -8
- 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 +25 -17
- package/src/{vcs/vcm/interaction → interaction}/abstractInteraction.js +19 -17
- package/src/{vcs/vcm/interaction → interaction}/coordinateAtPixel.js +6 -9
- package/src/{vcs/vcm/interaction → interaction}/eventHandler.js +3 -3
- package/src/{vcs/vcm/interaction → interaction}/featureAtPixelInteraction.js +6 -19
- package/src/{vcs/vcm/interaction → interaction}/featureProviderInteraction.js +2 -13
- package/src/{vcs/vcm/interaction → interaction}/interactionChain.js +11 -31
- package/src/{vcs/vcm/interaction → interaction}/interactionType.js +0 -0
- package/src/{vcs/vcm/layer/cesium/cesiumTilesetCesium.js → layer/cesium/cesiumTilesetCesiumImpl.js} +8 -10
- package/src/{vcs/vcm/layer → layer}/cesium/clusterContext.js +0 -0
- package/src/{vcs/vcm/layer/cesium/dataSourceCesium.js → layer/cesium/dataSourceCesiumImpl.js} +5 -2
- package/src/{vcs/vcm/layer/cesium/openStreetMapCesium.js → layer/cesium/openStreetMapCesiumImpl.js} +6 -6
- package/src/{vcs/vcm/layer/cesium/rasterLayerCesium.js → layer/cesium/rasterLayerCesiumImpl.js} +5 -5
- package/src/{vcs/vcm/layer/cesium/singleImageCesium.js → layer/cesium/singleImageCesiumImpl.js} +5 -5
- package/src/{vcs/vcm/layer/cesium/terrainCesium.js → layer/cesium/terrainCesiumImpl.js} +4 -4
- package/src/{vcs/vcm/layer/cesium/tmsCesium.js → layer/cesium/tmsCesiumImpl.js} +6 -6
- package/src/{vcs/vcm/layer/cesium/vectorCesium.js → layer/cesium/vectorCesiumImpl.js} +3 -3
- package/src/{vcs/vcm/layer → layer}/cesium/vectorContext.js +0 -0
- package/src/{vcs/vcm/layer/cesium/vectorRasterTileCesium.js → layer/cesium/vectorRasterTileCesiumImpl.js} +5 -5
- package/src/{vcs/vcm/layer → layer}/cesium/vectorTileImageryProvider.js +1 -1
- package/src/{vcs/vcm/layer/cesium/wmsCesium.js → layer/cesium/wmsCesiumImpl.js} +6 -6
- package/src/{vcs/vcm/layer/cesium/wmtsCesium.js → layer/cesium/wmtsCesiumImpl.js} +6 -6
- package/src/{vcs/vcm/layer → layer}/cesium/x3dmHelper.js +0 -0
- package/src/{vcs/vcm/layer/cesiumTileset.js → layer/cesiumTilesetLayer.js} +38 -36
- package/src/{vcs/vcm/layer/czml.js → layer/czmlLayer.js} +14 -16
- package/src/{vcs/vcm/layer/dataSource.js → layer/dataSourceLayer.js} +13 -13
- package/src/{vcs/vcm/layer → layer}/featureLayer.js +17 -30
- package/src/{vcs/vcm/layer/featureStore.js → layer/featureStoreLayer.js} +53 -53
- package/src/{vcs/vcm/layer/featureStoreChanges.js → layer/featureStoreLayerChanges.js} +98 -82
- package/src/{vcs/vcm/layer/featureStoreState.js → layer/featureStoreLayerState.js} +1 -1
- package/src/{vcs/vcm/layer → layer}/featureVisibility.js +6 -5
- package/src/{vcs/vcm/layer → layer}/geojsonHelpers.js +15 -37
- package/src/{vcs/vcm/layer/geojson.js → layer/geojsonLayer.js} +19 -21
- package/src/{vcs/vcm/layer → layer}/globalHider.js +1 -11
- package/src/{vcs/vcm/layer → layer}/layer.js +11 -11
- package/src/{vcs/vcm/layer → layer}/layerImplementation.js +2 -2
- package/src/{vcs/vcm/layer → layer}/layerState.js +0 -0
- 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} +6 -6
- package/src/{vcs/vcm/layer/openStreetMap.js → layer/openStreetMapLayer.js} +32 -32
- package/src/{vcs/vcm/layer/openlayers/layerOpenlayers.js → layer/openlayers/layerOpenlayersImpl.js} +5 -5
- package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +27 -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 -6
- package/src/{vcs/vcm/layer/openlayers/tileDebugOpenlayers.js → layer/openlayers/tileDebugOpenlayersImpl.js} +5 -5
- package/src/{vcs/vcm/layer/openlayers/tmsOpenlayers.js → layer/openlayers/tmsOpenlayersImpl.js} +7 -7
- package/src/{vcs/vcm/layer/openlayers/vectorOpenlayers.js → layer/openlayers/vectorOpenlayersImpl.js} +6 -6
- package/src/{vcs/vcm/layer/openlayers/vectorTileOpenlayers.js → layer/openlayers/vectorTileOpenlayersImpl.js} +6 -6
- package/src/{vcs/vcm/layer/openlayers/wmsOpenlayers.js → layer/openlayers/wmsOpenlayersImpl.js} +7 -7
- package/src/{vcs/vcm/layer/openlayers/wmtsOpenlayers.js → layer/openlayers/wmtsOpenlayersImpl.js} +7 -7
- package/src/{vcs/vcm/layer/pointCloud.js → layer/pointCloudLayer.js} +26 -33
- package/src/{vcs/vcm/layer → layer}/rasterLayer.js +18 -18
- package/src/{vcs/vcm/layer/singleImage.js → layer/singleImageLayer.js} +20 -19
- package/src/{vcs/vcm/layer → layer}/terrainHelpers.js +13 -49
- package/src/{vcs/vcm/layer/terrain.js → layer/terrainLayer.js} +13 -13
- package/src/{vcs/vcm/layer → layer}/tileLoadedHelper.js +5 -5
- package/src/{vcs/vcm/layer → layer}/tileProvider/mvtTileProvider.js +22 -4
- package/src/layer/tileProvider/staticGeojsonTileProvider.js +82 -0
- package/src/{vcs/vcm/layer → layer}/tileProvider/tileProvider.js +16 -7
- package/src/{vcs/vcm/layer → layer}/tileProvider/urlTemplateTileProvider.js +20 -5
- package/src/{vcs/vcm/layer/tms.js → layer/tmsLayer.js} +19 -19
- package/src/{vcs/vcm/layer → layer}/vectorHelpers.js +5 -5
- package/src/{vcs/vcm/layer/vector.js → layer/vectorLayer.js} +38 -47
- package/src/{vcs/vcm/layer → layer}/vectorProperties.js +3 -3
- package/src/{vcs/vcm/layer → layer}/vectorSymbols.js +0 -0
- package/src/{vcs/vcm/layer/vectorTile.js → layer/vectorTileLayer.js} +32 -41
- package/src/{vcs/vcm/layer/wfs.js → layer/wfsLayer.js} +19 -19
- package/src/{vcs/vcm/layer → layer}/wmsHelpers.js +1 -1
- package/src/{vcs/vcm/layer/wms.js → layer/wmsLayer.js} +22 -22
- package/src/{vcs/vcm/layer/wmts.js → layer/wmtsLayer.js} +20 -20
- package/src/{vcs/vcm/maps → map}/baseOLMap.js +5 -5
- package/src/{vcs/vcm/maps → map}/cameraLimiter.js +11 -16
- package/src/{vcs/vcm/maps/cesium.js → map/cesiumMap.js} +21 -33
- package/src/{vcs/vcm/maps → map}/mapState.js +0 -0
- package/src/{vcs/vcm/maps/oblique.js → map/obliqueMap.js} +42 -56
- package/src/{vcs/vcm/maps/openlayers.js → map/openlayersMap.js} +17 -14
- package/src/{vcs/vcm/maps/map.js → map/vcsMap.js} +35 -20
- package/src/oblique/defaultObliqueCollection.js +62 -0
- package/src/{vcs/vcm/oblique → oblique}/helpers.js +13 -41
- package/src/{vcs/vcm/oblique/ObliqueCollection.js → oblique/obliqueCollection.js} +117 -36
- package/src/{vcs/vcm/oblique/ObliqueDataSet.js → oblique/obliqueDataSet.js} +67 -24
- package/src/{vcs/vcm/oblique/ObliqueImage.js → oblique/obliqueImage.js} +1 -1
- package/src/{vcs/vcm/oblique/ObliqueImageMeta.js → oblique/obliqueImageMeta.js} +4 -4
- package/src/{vcs/vcm/oblique/ObliqueProvider.js → oblique/obliqueProvider.js} +17 -11
- package/src/{vcs/vcm/oblique/ObliqueView.js → oblique/obliqueView.js} +31 -1
- package/src/{vcs/vcm/oblique/ObliqueViewDirection.js → oblique/obliqueViewDirection.js} +0 -0
- package/src/{vcs/vcm/oblique → oblique}/parseImageJson.js +20 -12
- package/src/ol/geom/circle.js +1 -1
- package/src/overrideClassRegistry.js +204 -0
- package/src/{vcs/vcm/util/style → style}/declarativeStyleItem.js +43 -19
- package/src/{vcs/vcm/util/style → style}/shapesCategory.js +0 -0
- package/src/style/styleFactory.js +29 -0
- package/src/{vcs/vcm/util/style → style}/styleHelpers.js +3 -3
- package/src/{vcs/vcm/util/style → style}/styleItem.js +23 -85
- package/src/{vcs/vcm/util/style → style}/vectorStyleItem.js +73 -81
- package/src/{vcs/vcm/util/style → style}/writeStyle.js +4 -7
- package/src/{vcs/vcm/util → util}/clipping/clippingObject.js +10 -10
- package/src/{vcs/vcm/util → util}/clipping/clippingObjectManager.js +2 -2
- package/src/{vcs/vcm/util → util}/clipping/clippingPlaneHelper.js +4 -4
- package/src/{vcs/vcm/util → util}/collection.js +1 -1
- package/src/{vcs/vcm/util → util}/dateTime.js +0 -0
- package/src/{vcs/vcm/util → util}/exclusiveManager.js +0 -0
- package/src/{vcs/vcm/util → util}/extent.js +18 -11
- 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 +3 -3
- 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 -1
- package/src/{vcs/vcm/util → util}/isMobile.js +0 -0
- package/src/{vcs/vcm/util → util}/layerCollection.js +11 -6
- package/src/{vcs/vcm/util → util}/locale.js +1 -1
- package/src/{vcs/vcm/util → util}/mapCollection.js +63 -21
- package/src/{vcs/vcm/util → util}/math.js +0 -0
- package/src/util/overrideCollection.js +224 -0
- package/src/{vcs/vcm/util → util}/projection.js +39 -24
- 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 +5 -5
- package/src/vcsApp.js +471 -0
- package/src/vcsAppContextHelpers.js +121 -0
- package/src/{vcs/vcm/event/vcsEvent.js → vcsEvent.js} +2 -2
- package/src/{vcs/vcm/object.js → vcsObject.js} +2 -10
- 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/featureconverter/extent3d.js +0 -154
- 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
|
|
@@ -33,18 +33,18 @@ export const defaultPointCloudStyle = new DeclarativeStyleItem({});
|
|
|
33
33
|
*
|
|
34
34
|
* @class
|
|
35
35
|
* @export
|
|
36
|
-
* @extends {
|
|
36
|
+
* @extends {CesiumTilesetLayer}
|
|
37
37
|
* @api stable
|
|
38
38
|
*/
|
|
39
|
-
class
|
|
40
|
-
static get className() { return '
|
|
39
|
+
class PointCloudLayer extends CesiumTilesetLayer {
|
|
40
|
+
static get className() { return 'PointCloudLayer'; }
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* @returns {PointCloudOptions}
|
|
44
44
|
*/
|
|
45
45
|
static getDefaultOptions() {
|
|
46
46
|
return {
|
|
47
|
-
...
|
|
47
|
+
...CesiumTilesetLayer.getDefaultOptions(),
|
|
48
48
|
pointSize: null,
|
|
49
49
|
};
|
|
50
50
|
}
|
|
@@ -55,7 +55,7 @@ class PointCloud extends CesiumTileset {
|
|
|
55
55
|
constructor(options) {
|
|
56
56
|
super(options);
|
|
57
57
|
|
|
58
|
-
const defaultOptions =
|
|
58
|
+
const defaultOptions = PointCloudLayer.getDefaultOptions();
|
|
59
59
|
/**
|
|
60
60
|
* The default point size to fall back on, if no point size is given. Uses Cesium default of 1 if null.
|
|
61
61
|
* @api
|
|
@@ -72,7 +72,7 @@ class PointCloud extends CesiumTileset {
|
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* @inheritDoc
|
|
75
|
-
* @param {(
|
|
75
|
+
* @param {(DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem)=} styleOptions
|
|
76
76
|
* @param {(VectorStyleItem|DeclarativeStyleItem)=} defaultStyle
|
|
77
77
|
* @returns {import("@vcmap/core").StyleItem}
|
|
78
78
|
*/
|
|
@@ -92,28 +92,21 @@ class PointCloud extends CesiumTileset {
|
|
|
92
92
|
set pointSize(size) {
|
|
93
93
|
checkMaybe(size, [Number, String]);
|
|
94
94
|
this._pointSize = size;
|
|
95
|
-
this.
|
|
96
|
-
/** @type {PointCloudCesium} */ (impl).updatePointSize(size);
|
|
97
|
-
});
|
|
95
|
+
/** @type {DeclarativeStyleItem} */ (this.style).pointSize = size?.toString();
|
|
98
96
|
}
|
|
99
97
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
getImplementationOptions() {
|
|
104
|
-
return {
|
|
105
|
-
...super.getImplementationOptions(),
|
|
106
|
-
pointSize: this.pointSize,
|
|
107
|
-
};
|
|
98
|
+
async initialize() {
|
|
99
|
+
await super.initialize();
|
|
100
|
+
this.pointSize = this._pointSize;
|
|
108
101
|
}
|
|
109
102
|
|
|
110
103
|
/**
|
|
111
104
|
* @param {import("@vcmap/core").VcsMap} map
|
|
112
|
-
* @returns {Array<
|
|
105
|
+
* @returns {Array<CesiumTilesetCesiumImpl>}
|
|
113
106
|
*/
|
|
114
107
|
createImplementationsForMap(map) {
|
|
115
108
|
if (map instanceof CesiumMap) {
|
|
116
|
-
return [new
|
|
109
|
+
return [new CesiumTilesetCesiumImpl(map, this.getImplementationOptions())];
|
|
117
110
|
}
|
|
118
111
|
|
|
119
112
|
return [];
|
|
@@ -129,8 +122,8 @@ class PointCloud extends CesiumTileset {
|
|
|
129
122
|
}
|
|
130
123
|
|
|
131
124
|
/**
|
|
132
|
-
* Sets a new declarative style. Cannot set a
|
|
133
|
-
* @param {
|
|
125
|
+
* Sets a new declarative style. Cannot set a VectorLayer style on PointCloudLayer layers.
|
|
126
|
+
* @param {import("ol/style/Style").default|import("ol/style/Style").StyleFunction|import("@vcmap/core").StyleItem} style
|
|
134
127
|
* @param {boolean=} silent
|
|
135
128
|
* @api
|
|
136
129
|
*/
|
|
@@ -146,9 +139,9 @@ class PointCloud extends CesiumTileset {
|
|
|
146
139
|
* @inheritDoc
|
|
147
140
|
* @returns {PointCloudOptions}
|
|
148
141
|
*/
|
|
149
|
-
|
|
150
|
-
const config = /** @type {PointCloudOptions} */ (super.
|
|
151
|
-
const defaultOptions =
|
|
142
|
+
toJSON() {
|
|
143
|
+
const config = /** @type {PointCloudOptions} */ (super.toJSON());
|
|
144
|
+
const defaultOptions = PointCloudLayer.getDefaultOptions();
|
|
152
145
|
|
|
153
146
|
if (this.defaultPointSize !== defaultOptions.pointSize) {
|
|
154
147
|
config.pointSize = this.defaultPointSize;
|
|
@@ -158,5 +151,5 @@ class PointCloud extends CesiumTileset {
|
|
|
158
151
|
}
|
|
159
152
|
}
|
|
160
153
|
|
|
161
|
-
|
|
162
|
-
export default
|
|
154
|
+
layerClassRegistry.registerClass(PointCloudLayer.className, PointCloudLayer);
|
|
155
|
+
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
|
|
|
@@ -118,7 +118,7 @@ export function calculateMinLevel(extent, tilingScheme, maxLevel, minLevel = 0)
|
|
|
118
118
|
* @abstract
|
|
119
119
|
*/
|
|
120
120
|
class RasterLayer extends Layer {
|
|
121
|
-
static get className() { return '
|
|
121
|
+
static get className() { return 'RasterLayer'; }
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
124
|
* @returns {RasterLayerOptions}
|
|
@@ -166,18 +166,18 @@ class RasterLayer extends Layer {
|
|
|
166
166
|
*/
|
|
167
167
|
this._opacity = parseNumberRange(options.opacity, defaultOptions.opacity, 0.0, 1.0);
|
|
168
168
|
|
|
169
|
-
/** @type {import("@vcmap/cesium").
|
|
170
|
-
this._splitDirection =
|
|
169
|
+
/** @type {import("@vcmap/cesium").SplitDirection} */
|
|
170
|
+
this._splitDirection = SplitDirection.NONE;
|
|
171
171
|
|
|
172
172
|
if (options.splitDirection) {
|
|
173
173
|
this._splitDirection = options.splitDirection === 'left' ?
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
SplitDirection.LEFT :
|
|
175
|
+
SplitDirection.RIGHT;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
179
|
* raised if the split direction changes, is passed the split direction as its only argument
|
|
180
|
-
* @type {VcsEvent<import("@vcmap/cesium").
|
|
180
|
+
* @type {VcsEvent<import("@vcmap/cesium").SplitDirection>}
|
|
181
181
|
* @api
|
|
182
182
|
*/
|
|
183
183
|
this.splitDirectionChanged = new VcsEvent();
|
|
@@ -186,12 +186,12 @@ class RasterLayer extends Layer {
|
|
|
186
186
|
/**
|
|
187
187
|
* The split directions of this layer
|
|
188
188
|
* @api
|
|
189
|
-
* @type {import("@vcmap/cesium").
|
|
189
|
+
* @type {import("@vcmap/cesium").SplitDirection}
|
|
190
190
|
*/
|
|
191
191
|
get splitDirection() { return this._splitDirection; }
|
|
192
192
|
|
|
193
193
|
/**
|
|
194
|
-
* @param {import("@vcmap/cesium").
|
|
194
|
+
* @param {import("@vcmap/cesium").SplitDirection} direction
|
|
195
195
|
*/
|
|
196
196
|
set splitDirection(direction) {
|
|
197
197
|
if (direction !== this._splitDirection) {
|
|
@@ -248,8 +248,8 @@ class RasterLayer extends Layer {
|
|
|
248
248
|
* @inheritDoc
|
|
249
249
|
* @returns {RasterLayerOptions}
|
|
250
250
|
*/
|
|
251
|
-
|
|
252
|
-
const config = /** @type {RasterLayerOptions} */ (super.
|
|
251
|
+
toJSON() {
|
|
252
|
+
const config = /** @type {RasterLayerOptions} */ (super.toJSON());
|
|
253
253
|
const defaultOptions = RasterLayer.getDefaultOptions();
|
|
254
254
|
|
|
255
255
|
if (this.extent.equals(new Extent())) {
|
|
@@ -272,8 +272,8 @@ class RasterLayer extends Layer {
|
|
|
272
272
|
config.opacity = this.opacity;
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
-
if (this._splitDirection !==
|
|
276
|
-
config.splitDirection = this._splitDirection ===
|
|
275
|
+
if (this._splitDirection !== SplitDirection.NONE) {
|
|
276
|
+
config.splitDirection = this._splitDirection === SplitDirection.RIGHT ?
|
|
277
277
|
'right' :
|
|
278
278
|
'left';
|
|
279
279
|
}
|
|
@@ -290,5 +290,5 @@ class RasterLayer extends Layer {
|
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
-
|
|
293
|
+
layerClassRegistry.registerClass(RasterLayer.className, RasterLayer);
|
|
294
294
|
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,14 @@ 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
25
|
* @export
|
|
25
26
|
* @extends {RasterLayer}
|
|
26
27
|
* @api stable
|
|
27
28
|
*/
|
|
28
|
-
class
|
|
29
|
-
static get className() { return '
|
|
29
|
+
class SingleImageLayer extends RasterLayer {
|
|
30
|
+
static get className() { return 'SingleImageLayer'; }
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* @returns {SingleImageOptions}
|
|
@@ -43,21 +44,21 @@ class SingleImage extends RasterLayer {
|
|
|
43
44
|
*/
|
|
44
45
|
constructor(options) {
|
|
45
46
|
super(options);
|
|
46
|
-
const defaultOptions =
|
|
47
|
+
const defaultOptions = SingleImageLayer.getDefaultOptions();
|
|
47
48
|
/** @type {string} */
|
|
48
49
|
this.credit = options.credit || defaultOptions.credit;
|
|
49
50
|
|
|
50
51
|
if (!this.extent.isValid()) {
|
|
51
52
|
this.getLogger().warning(`layer ${this.name} was constructed with an invalid extent, defaulting to global extent`);
|
|
52
53
|
this.extent = new Extent({
|
|
53
|
-
|
|
54
|
+
projection: wgs84Projection.toJSON(),
|
|
54
55
|
coordinates: [-180, -90, 180, 90],
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
this._supportedMaps = [
|
|
59
60
|
CesiumMap.className,
|
|
60
|
-
|
|
61
|
+
OpenlayersMap.className,
|
|
61
62
|
];
|
|
62
63
|
}
|
|
63
64
|
|
|
@@ -73,13 +74,13 @@ class SingleImage extends RasterLayer {
|
|
|
73
74
|
|
|
74
75
|
/**
|
|
75
76
|
* @param {import("@vcmap/core").VcsMap} map
|
|
76
|
-
* @returns {Array<
|
|
77
|
+
* @returns {Array<SingleImageOpenlayersImpl|SingleImageCesiumImpl>}
|
|
77
78
|
*/
|
|
78
79
|
createImplementationsForMap(map) {
|
|
79
80
|
if (map instanceof CesiumMap) {
|
|
80
|
-
return [new
|
|
81
|
-
} else if (map instanceof
|
|
82
|
-
return [new
|
|
81
|
+
return [new SingleImageCesiumImpl(map, this.getImplementationOptions())];
|
|
82
|
+
} else if (map instanceof OpenlayersMap) {
|
|
83
|
+
return [new SingleImageOpenlayersImpl(map, this.getImplementationOptions())];
|
|
83
84
|
}
|
|
84
85
|
return [];
|
|
85
86
|
}
|
|
@@ -103,8 +104,8 @@ class SingleImage extends RasterLayer {
|
|
|
103
104
|
* @inheritDoc
|
|
104
105
|
* @returns {SingleImageOptions}
|
|
105
106
|
*/
|
|
106
|
-
|
|
107
|
-
const config = /** @type {SingleImageOptions} */ (super.
|
|
107
|
+
toJSON() {
|
|
108
|
+
const config = /** @type {SingleImageOptions} */ (super.toJSON());
|
|
108
109
|
delete config.tilingSchema;
|
|
109
110
|
|
|
110
111
|
if (this.credit) {
|
|
@@ -115,5 +116,5 @@ class SingleImage extends RasterLayer {
|
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
|
|
118
|
-
|
|
119
|
-
export default
|
|
119
|
+
layerClassRegistry.registerClass(SingleImageLayer.className, SingleImageLayer);
|
|
120
|
+
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
|
|
@@ -25,8 +25,8 @@ import { VcsClassRegistry } from '../classRegistry.js';
|
|
|
25
25
|
* @extends {Layer}
|
|
26
26
|
* @api stable
|
|
27
27
|
*/
|
|
28
|
-
class
|
|
29
|
-
static get className() { return '
|
|
28
|
+
class TerrainLayer extends Layer {
|
|
29
|
+
static get className() { return 'TerrainLayer'; }
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* @returns {TerrainOptions}
|
|
@@ -44,7 +44,7 @@ class Terrain extends Layer {
|
|
|
44
44
|
*/
|
|
45
45
|
constructor(options) {
|
|
46
46
|
super(options);
|
|
47
|
-
const defaultOptions =
|
|
47
|
+
const defaultOptions = TerrainLayer.getDefaultOptions();
|
|
48
48
|
|
|
49
49
|
this._supportedMaps = [
|
|
50
50
|
CesiumMap.className,
|
|
@@ -77,11 +77,11 @@ class Terrain extends Layer {
|
|
|
77
77
|
/**
|
|
78
78
|
* @inheritDoc
|
|
79
79
|
* @param {import("@vcmap/core").VcsMap} map
|
|
80
|
-
* @returns {Array<
|
|
80
|
+
* @returns {Array<TerrainCesiumImpl>}
|
|
81
81
|
*/
|
|
82
82
|
createImplementationsForMap(map) {
|
|
83
83
|
if (map instanceof CesiumMap) {
|
|
84
|
-
return [new
|
|
84
|
+
return [new TerrainCesiumImpl(map, this.getImplementationOptions())];
|
|
85
85
|
}
|
|
86
86
|
return [];
|
|
87
87
|
}
|
|
@@ -104,9 +104,9 @@ class Terrain extends Layer {
|
|
|
104
104
|
/**
|
|
105
105
|
* @returns {TerrainOptions}
|
|
106
106
|
*/
|
|
107
|
-
|
|
108
|
-
const config = /** @type {TerrainOptions} */ (super.
|
|
109
|
-
const defaultOptions =
|
|
107
|
+
toJSON() {
|
|
108
|
+
const config = /** @type {TerrainOptions} */ (super.toJSON());
|
|
109
|
+
const defaultOptions = TerrainLayer.getDefaultOptions();
|
|
110
110
|
|
|
111
111
|
if (this.requestVertexNormals !== defaultOptions.requestVertexNormals) {
|
|
112
112
|
config.requestVertexNormals = this.requestVertexNormals;
|
|
@@ -118,5 +118,5 @@ class Terrain extends Layer {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
export default
|
|
121
|
+
layerClassRegistry.registerClass(TerrainLayer.className, TerrainLayer);
|
|
122
|
+
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
|
|
@@ -25,7 +26,7 @@ class MVTTileProvider extends TileProvider {
|
|
|
25
26
|
* @readonly
|
|
26
27
|
* @returns {string}
|
|
27
28
|
*/
|
|
28
|
-
static get className() { return '
|
|
29
|
+
static get className() { return 'MVTTileProvider'; }
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* @returns {MVTTileProviderOptions}
|
|
@@ -74,9 +75,9 @@ class MVTTileProvider extends TileProvider {
|
|
|
74
75
|
const url = getURL(this.url, x, y, z, rectangle);
|
|
75
76
|
const extent = rectangleToExtent(rectangle);
|
|
76
77
|
const center = getCenter(extent);
|
|
77
|
-
const
|
|
78
|
+
const data = await requestArrayBuffer(url);
|
|
78
79
|
const features = /** @type {Array<import("ol").Feature<import("ol/geom/Geometry").default>>} */
|
|
79
|
-
(this._MVTFormat.readFeatures(
|
|
80
|
+
(this._MVTFormat.readFeatures(data));
|
|
80
81
|
const sx = ((extent[2] - extent[0]) / 4096);
|
|
81
82
|
const sy = -((extent[3] - extent[1]) / 4096);
|
|
82
83
|
features.forEach((feature) => {
|
|
@@ -99,6 +100,23 @@ class MVTTileProvider extends TileProvider {
|
|
|
99
100
|
});
|
|
100
101
|
return features;
|
|
101
102
|
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @returns {MVTTileProviderOptions}
|
|
106
|
+
*/
|
|
107
|
+
toJSON() {
|
|
108
|
+
const config = /** @type {MVTTileProviderOptions} */ (super.toJSON());
|
|
109
|
+
|
|
110
|
+
if (this.url) {
|
|
111
|
+
config.url = this.url;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (this.idProperty) {
|
|
115
|
+
config.idProperty = this.idProperty;
|
|
116
|
+
}
|
|
117
|
+
return config;
|
|
118
|
+
}
|
|
102
119
|
}
|
|
103
120
|
|
|
104
121
|
export default MVTTileProvider;
|
|
122
|
+
tileProviderClassRegistry.registerClass(MVTTileProvider.className, MVTTileProvider);
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
* @export
|
|
18
|
+
* @api
|
|
19
|
+
*/
|
|
20
|
+
class StaticGeoJSONTileProvider extends TileProvider {
|
|
21
|
+
/**
|
|
22
|
+
* @readonly
|
|
23
|
+
* @returns {string}
|
|
24
|
+
*/
|
|
25
|
+
static get className() { return 'StaticGeoJSONTileProvider'; }
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @returns {StaticGeoJSONTileProviderOptions}
|
|
29
|
+
*/
|
|
30
|
+
static getDefaultOptions() {
|
|
31
|
+
return {
|
|
32
|
+
...TileProvider.getDefaultOptions(),
|
|
33
|
+
url: undefined,
|
|
34
|
+
baseLevels: [0],
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @param {StaticGeoJSONTileProviderOptions} options
|
|
40
|
+
*/
|
|
41
|
+
constructor(options) {
|
|
42
|
+
const defaultOptions = StaticGeoJSONTileProvider.getDefaultOptions();
|
|
43
|
+
options.baseLevels = defaultOptions.baseLevels;
|
|
44
|
+
super(options);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @type {string}
|
|
48
|
+
*/
|
|
49
|
+
this.url = options.url || defaultOptions.url;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @inheritDoc
|
|
55
|
+
* @param {number} x
|
|
56
|
+
* @param {number} y
|
|
57
|
+
* @param {number} z
|
|
58
|
+
* @returns {Promise<Array<import("ol").Feature<import("ol/geom/Geometry").default>>>}
|
|
59
|
+
*/
|
|
60
|
+
// eslint-disable-next-line no-unused-vars
|
|
61
|
+
async loader(x, y, z) {
|
|
62
|
+
const data = await requestJson(this.url);
|
|
63
|
+
const { features } = parseGeoJSON(data, { dynamicStyle: true });
|
|
64
|
+
return features;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @returns {StaticGeoJSONTileProviderOptions}
|
|
69
|
+
*/
|
|
70
|
+
toJSON() {
|
|
71
|
+
const config = /** @type {StaticGeoJSONTileProviderOptions} */ (super.toJSON());
|
|
72
|
+
delete config.baseLevels;
|
|
73
|
+
|
|
74
|
+
if (this.url) {
|
|
75
|
+
config.url = this.url;
|
|
76
|
+
}
|
|
77
|
+
return config;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export default StaticGeoJSONTileProvider;
|
|
82
|
+
tileProviderClassRegistry.registerClass(StaticGeoJSONTileProvider.className, StaticGeoJSONTileProvider);
|