@vcmap/core 5.0.2 → 5.1.0-rc.1
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/dist/cesium.d.ts +257 -0
- package/dist/geojson.d.ts +27 -0
- package/dist/index.d.ts +15 -2
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/ol.d.ts +138 -0
- package/dist/src/classRegistry.js +2 -2
- package/dist/src/classRegistry.js.map +1 -1
- package/dist/src/featureProvider/abstractFeatureProvider.d.ts +2 -1
- package/dist/src/featureProvider/abstractFeatureProvider.js +2 -1
- package/dist/src/featureProvider/abstractFeatureProvider.js.map +1 -1
- package/dist/src/featureProvider/tileProviderFeatureProvider.d.ts +1 -1
- package/dist/src/featureProvider/tileProviderFeatureProvider.js +2 -2
- package/dist/src/featureProvider/tileProviderFeatureProvider.js.map +1 -1
- package/dist/src/featureProvider/wmsFeatureProvider.d.ts +1 -1
- package/dist/src/featureProvider/wmsFeatureProvider.js +4 -3
- package/dist/src/featureProvider/wmsFeatureProvider.js.map +1 -1
- package/dist/src/interaction/eventHandler.js +3 -3
- package/dist/src/interaction/eventHandler.js.map +1 -1
- package/dist/src/interaction/featureProviderInteraction.js +1 -1
- package/dist/src/interaction/featureProviderInteraction.js.map +1 -1
- package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.d.ts +4 -1
- package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.js +31 -2
- package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/resourceHelper.d.ts +2 -0
- package/dist/src/layer/cesium/resourceHelper.js +12 -0
- package/dist/src/layer/cesium/resourceHelper.js.map +1 -0
- package/dist/src/layer/cesium/singleImageCesiumImpl.js +2 -1
- package/dist/src/layer/cesium/singleImageCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/terrainCesiumImpl.js +1 -1
- package/dist/src/layer/cesium/terrainCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/tmsCesiumImpl.js +2 -1
- package/dist/src/layer/cesium/tmsCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/vectorRasterTileCesiumImpl.js +1 -0
- package/dist/src/layer/cesium/vectorRasterTileCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/vectorTileImageryProvider.d.ts +2 -0
- package/dist/src/layer/cesium/vectorTileImageryProvider.js +3 -1
- package/dist/src/layer/cesium/vectorTileImageryProvider.js.map +1 -1
- package/dist/src/layer/cesium/wmsCesiumImpl.js +2 -1
- package/dist/src/layer/cesium/wmsCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/wmtsCesiumImpl.js +2 -1
- package/dist/src/layer/cesium/wmtsCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesiumTilesetLayer.d.ts +5 -1
- package/dist/src/layer/cesiumTilesetLayer.js +17 -7
- package/dist/src/layer/cesiumTilesetLayer.js.map +1 -1
- package/dist/src/layer/czmlLayer.js +2 -1
- package/dist/src/layer/czmlLayer.js.map +1 -1
- package/dist/src/layer/featureLayer.js +2 -2
- package/dist/src/layer/featureLayer.js.map +1 -1
- package/dist/src/layer/featureStoreLayer.js +8 -5
- package/dist/src/layer/featureStoreLayer.js.map +1 -1
- package/dist/src/layer/featureStoreLayerChanges.d.ts +20 -8
- package/dist/src/layer/featureStoreLayerChanges.js +26 -26
- package/dist/src/layer/featureStoreLayerChanges.js.map +1 -1
- package/dist/src/layer/featureStoreLayerState.d.ts +1 -5
- package/dist/src/layer/featureStoreLayerState.js +0 -9
- package/dist/src/layer/featureStoreLayerState.js.map +1 -1
- package/dist/src/layer/geojsonLayer.js +3 -2
- package/dist/src/layer/geojsonLayer.js.map +1 -1
- package/dist/src/layer/layer.d.ts +15 -0
- package/dist/src/layer/layer.js +30 -4
- package/dist/src/layer/layer.js.map +1 -1
- package/dist/src/layer/layerImplementation.d.ts +1 -0
- package/dist/src/layer/layerImplementation.js +2 -0
- package/dist/src/layer/layerImplementation.js.map +1 -1
- package/dist/src/layer/oblique/vectorObliqueImpl.js +9 -6
- package/dist/src/layer/oblique/vectorObliqueImpl.js.map +1 -1
- package/dist/src/layer/openlayers/loadFunctionHelpers.d.ts +2 -0
- package/dist/src/layer/openlayers/loadFunctionHelpers.js +20 -0
- package/dist/src/layer/openlayers/loadFunctionHelpers.js.map +1 -0
- package/dist/src/layer/openlayers/singleImageOpenlayersImpl.js +25 -1
- package/dist/src/layer/openlayers/singleImageOpenlayersImpl.js.map +1 -1
- package/dist/src/layer/openlayers/tmsOpenlayersImpl.js +9 -1
- package/dist/src/layer/openlayers/tmsOpenlayersImpl.js.map +1 -1
- package/dist/src/layer/openlayers/vectorTileOpenlayersImpl.js +1 -1
- package/dist/src/layer/openlayers/vectorTileOpenlayersImpl.js.map +1 -1
- package/dist/src/layer/openlayers/wmsOpenlayersImpl.d.ts +4 -1
- package/dist/src/layer/openlayers/wmsOpenlayersImpl.js +20 -1
- package/dist/src/layer/openlayers/wmsOpenlayersImpl.js.map +1 -1
- package/dist/src/layer/openlayers/wmtsOpenlayersImpl.js +9 -1
- package/dist/src/layer/openlayers/wmtsOpenlayersImpl.js.map +1 -1
- package/dist/src/layer/pointCloudLayer.js +2 -2
- package/dist/src/layer/pointCloudLayer.js.map +1 -1
- package/dist/src/layer/terrainHelpers.d.ts +3 -3
- package/dist/src/layer/terrainHelpers.js +12 -7
- package/dist/src/layer/terrainHelpers.js.map +1 -1
- package/dist/src/layer/terrainLayer.js +1 -1
- package/dist/src/layer/terrainLayer.js.map +1 -1
- package/dist/src/layer/tileProvider/mvtTileProvider.d.ts +1 -1
- package/dist/src/layer/tileProvider/mvtTileProvider.js +4 -3
- package/dist/src/layer/tileProvider/mvtTileProvider.js.map +1 -1
- package/dist/src/layer/tileProvider/staticGeojsonTileProvider.d.ts +1 -1
- package/dist/src/layer/tileProvider/staticGeojsonTileProvider.js +4 -3
- package/dist/src/layer/tileProvider/staticGeojsonTileProvider.js.map +1 -1
- package/dist/src/layer/tileProvider/tileProvider.d.ts +14 -11
- package/dist/src/layer/tileProvider/tileProvider.js +23 -20
- package/dist/src/layer/tileProvider/tileProvider.js.map +1 -1
- package/dist/src/layer/tileProvider/urlTemplateTileProvider.d.ts +1 -1
- package/dist/src/layer/tileProvider/urlTemplateTileProvider.js +4 -3
- package/dist/src/layer/tileProvider/urlTemplateTileProvider.js.map +1 -1
- package/dist/src/layer/vectorLayer.d.ts +1 -2
- package/dist/src/layer/vectorLayer.js +3 -3
- package/dist/src/layer/vectorLayer.js.map +1 -1
- package/dist/src/layer/vectorProperties.d.ts +11 -16
- package/dist/src/layer/vectorProperties.js +16 -13
- package/dist/src/layer/vectorProperties.js.map +1 -1
- package/dist/src/layer/wfsLayer.js +9 -6
- package/dist/src/layer/wfsLayer.js.map +1 -1
- package/dist/src/layer/wmsHelpers.d.ts +10 -0
- package/dist/src/layer/wmsHelpers.js +53 -12
- package/dist/src/layer/wmsHelpers.js.map +1 -1
- package/dist/src/layer/wmsLayer.d.ts +6 -0
- package/dist/src/layer/wmsLayer.js +5 -2
- package/dist/src/layer/wmsLayer.js.map +1 -1
- package/dist/src/map/cameraLimiter.d.ts +5 -0
- package/dist/src/map/cameraLimiter.js +11 -4
- package/dist/src/map/cameraLimiter.js.map +1 -1
- package/dist/src/map/cesiumMap.d.ts +20 -1
- package/dist/src/map/cesiumMap.js +51 -2
- package/dist/src/map/cesiumMap.js.map +1 -1
- package/dist/src/map/vcsMap.js +2 -2
- package/dist/src/map/vcsMap.js.map +1 -1
- package/dist/src/oblique/helpers.d.ts +1 -1
- package/dist/src/oblique/helpers.js +5 -9
- package/dist/src/oblique/helpers.js.map +1 -1
- package/dist/src/oblique/obliqueCollection.d.ts +1 -0
- package/dist/src/oblique/obliqueCollection.js +1 -1
- package/dist/src/oblique/obliqueCollection.js.map +1 -1
- package/dist/src/oblique/obliqueDataSet.d.ts +3 -1
- package/dist/src/oblique/obliqueDataSet.js +13 -6
- package/dist/src/oblique/obliqueDataSet.js.map +1 -1
- package/dist/src/oblique/obliqueImageMeta.d.ts +2 -0
- package/dist/src/oblique/obliqueImageMeta.js +2 -0
- package/dist/src/oblique/obliqueImageMeta.js.map +1 -1
- package/dist/src/oblique/obliqueView.d.ts +1 -0
- package/dist/src/oblique/obliqueView.js +12 -2
- package/dist/src/oblique/obliqueView.js.map +1 -1
- package/dist/src/oblique/parseImageJson.d.ts +6 -5
- package/dist/src/oblique/parseImageJson.js +7 -5
- package/dist/src/oblique/parseImageJson.js.map +1 -1
- package/dist/src/ol/geom/circle.js.map +1 -1
- package/dist/src/style/declarativeStyleItem.js +10 -2
- package/dist/src/style/declarativeStyleItem.js.map +1 -1
- package/dist/src/style/styleFactory.js +2 -2
- package/dist/src/style/styleFactory.js.map +1 -1
- package/dist/src/style/styleHelpers.js +13 -3
- package/dist/src/style/styleHelpers.js.map +1 -1
- package/dist/src/style/vectorStyleItem.js +29 -16
- package/dist/src/style/vectorStyleItem.js.map +1 -1
- package/dist/src/util/clipping/clippingPlaneHelper.js +3 -3
- package/dist/src/util/clipping/clippingPlaneHelper.js.map +1 -1
- package/dist/src/util/editor/createFeatureSession.d.ts +2 -2
- package/dist/src/util/editor/createFeatureSession.js +2 -2
- package/dist/src/util/editor/createFeatureSession.js.map +1 -1
- package/dist/src/util/editor/editFeaturesSession.d.ts +2 -2
- package/dist/src/util/editor/editGeometrySession.d.ts +2 -2
- package/dist/src/util/editor/editorSessionHelpers.d.ts +2 -2
- package/dist/src/util/editor/selectFeaturesSession.d.ts +2 -2
- package/dist/src/util/editor/selectFeaturesSession.js +2 -2
- package/dist/src/util/editor/selectFeaturesSession.js.map +1 -1
- package/dist/src/util/featureconverter/arcToCesium.d.ts +1 -1
- package/dist/src/util/featureconverter/arcToCesium.js +5 -2
- package/dist/src/util/featureconverter/arcToCesium.js.map +1 -1
- package/dist/src/util/featureconverter/circleToCesium.d.ts +4 -2
- package/dist/src/util/featureconverter/circleToCesium.js +8 -3
- package/dist/src/util/featureconverter/circleToCesium.js.map +1 -1
- package/dist/src/util/featureconverter/extent3D.js.map +1 -1
- package/dist/src/util/featureconverter/featureconverterHelper.js +2 -2
- package/dist/src/util/featureconverter/featureconverterHelper.js.map +1 -1
- package/dist/src/util/featureconverter/lineStringToCesium.d.ts +3 -1
- package/dist/src/util/featureconverter/lineStringToCesium.js +7 -2
- package/dist/src/util/featureconverter/lineStringToCesium.js.map +1 -1
- package/dist/src/util/featureconverter/pointToCesium.js +1 -1
- package/dist/src/util/featureconverter/pointToCesium.js.map +1 -1
- package/dist/src/util/featureconverter/polygonToCesium.d.ts +3 -3
- package/dist/src/util/featureconverter/polygonToCesium.js +9 -15
- package/dist/src/util/featureconverter/polygonToCesium.js.map +1 -1
- package/dist/src/util/fetch.d.ts +2 -0
- package/dist/src/util/fetch.js +16 -0
- package/dist/src/util/fetch.js.map +1 -1
- package/dist/src/util/flight/flightAnchor.d.ts +23 -0
- package/dist/src/util/flight/flightAnchor.js +152 -0
- package/dist/src/util/flight/flightAnchor.js.map +1 -0
- package/dist/src/util/flight/flightCollection.d.ts +25 -0
- package/dist/src/util/flight/flightCollection.js +63 -0
- package/dist/src/util/flight/flightCollection.js.map +1 -0
- package/dist/src/util/flight/flightHelpers.d.ts +29 -0
- package/dist/src/util/flight/flightHelpers.js +134 -0
- package/dist/src/util/flight/flightHelpers.js.map +1 -0
- package/dist/src/util/flight/flightInstance.d.ts +57 -0
- package/dist/src/util/flight/flightInstance.js +166 -0
- package/dist/src/util/flight/flightInstance.js.map +1 -0
- package/dist/src/util/flight/flightPlayer.d.ts +30 -0
- package/dist/src/util/flight/flightPlayer.js +247 -0
- package/dist/src/util/flight/flightPlayer.js.map +1 -0
- package/dist/src/util/flight/flightVisualizer.d.ts +18 -0
- package/dist/src/util/flight/flightVisualizer.js +151 -0
- package/dist/src/util/flight/flightVisualizer.js.map +1 -0
- package/dist/src/util/hiddenObjects.d.ts +8 -0
- package/dist/src/util/hiddenObjects.js +17 -0
- package/dist/src/util/hiddenObjects.js.map +1 -0
- package/dist/src/util/mapCollection.js +2 -2
- package/dist/src/util/mapCollection.js.map +1 -1
- package/dist/src/util/overrideCollection.d.ts +8 -3
- package/dist/src/util/overrideCollection.js +17 -0
- package/dist/src/util/overrideCollection.js.map +1 -1
- package/dist/src/util/projection.js +5 -2
- package/dist/src/util/projection.js.map +1 -1
- package/dist/src/util/viewpoint.d.ts +1 -0
- package/dist/src/util/viewpoint.js +24 -7
- package/dist/src/util/viewpoint.js.map +1 -1
- package/dist/src/vcsApp.d.ts +10 -3
- package/dist/src/vcsApp.js +34 -15
- package/dist/src/vcsApp.js.map +1 -1
- package/dist/src/vcsModule.d.ts +4 -0
- package/dist/src/vcsModule.js.map +1 -1
- package/dist/tests/unit/helpers/cesiumHelpers.d.ts +2 -2
- package/dist/tests/unit/helpers/cesiumHelpers.js +2 -1
- package/dist/tests/unit/helpers/cesiumHelpers.js.map +1 -1
- package/dist/tests/unit/helpers/terrain/terrainData.d.ts +7 -0
- package/dist/tests/unit/helpers/terrain/terrainData.js +2 -2
- package/dist/tests/unit/helpers/terrain/terrainData.js.map +1 -1
- package/index.ts +39 -1
- package/package.json +4 -2
- package/src/classRegistry.ts +2 -2
- package/src/featureProvider/abstractFeatureProvider.ts +2 -0
- package/src/featureProvider/tileProviderFeatureProvider.ts +2 -0
- package/src/featureProvider/wmsFeatureProvider.ts +4 -2
- package/src/interaction/eventHandler.ts +3 -3
- package/src/interaction/featureProviderInteraction.ts +1 -0
- package/src/layer/cesium/cesiumTilesetCesiumImpl.ts +44 -5
- package/src/layer/cesium/resourceHelper.ts +15 -0
- package/src/layer/cesium/singleImageCesiumImpl.ts +2 -1
- package/src/layer/cesium/terrainCesiumImpl.ts +2 -1
- package/src/layer/cesium/tmsCesiumImpl.ts +2 -1
- package/src/layer/cesium/vectorRasterTileCesiumImpl.ts +1 -0
- package/src/layer/cesium/vectorTileImageryProvider.ts +10 -1
- package/src/layer/cesium/wmsCesiumImpl.ts +2 -1
- package/src/layer/cesium/wmtsCesiumImpl.ts +4 -2
- package/src/layer/cesiumTilesetLayer.ts +25 -7
- package/src/layer/czmlLayer.ts +2 -1
- package/src/layer/featureLayer.ts +2 -2
- package/src/layer/featureStoreLayer.ts +8 -8
- package/src/layer/featureStoreLayerChanges.ts +63 -45
- package/src/layer/featureStoreLayerState.ts +6 -5
- package/src/layer/geojsonLayer.ts +3 -3
- package/src/layer/layer.ts +41 -4
- package/src/layer/layerImplementation.ts +3 -0
- package/src/layer/oblique/vectorObliqueImpl.ts +9 -8
- package/src/layer/openlayers/loadFunctionHelpers.ts +24 -0
- package/src/layer/openlayers/singleImageOpenlayersImpl.ts +25 -1
- package/src/layer/openlayers/tmsOpenlayersImpl.ts +8 -1
- package/src/layer/openlayers/vectorTileOpenlayersImpl.ts +1 -0
- package/src/layer/openlayers/wmsOpenlayersImpl.ts +23 -2
- package/src/layer/openlayers/wmtsOpenlayersImpl.ts +8 -1
- package/src/layer/pointCloudLayer.ts +2 -2
- package/src/layer/terrainHelpers.ts +19 -6
- package/src/layer/terrainLayer.ts +8 -4
- package/src/layer/tileProvider/mvtTileProvider.ts +9 -3
- package/src/layer/tileProvider/staticGeojsonTileProvider.ts +9 -3
- package/src/layer/tileProvider/tileProvider.ts +49 -13
- package/src/layer/tileProvider/urlTemplateTileProvider.ts +10 -3
- package/src/layer/vectorLayer.ts +9 -9
- package/src/layer/vectorProperties.ts +46 -22
- package/src/layer/wfsLayer.ts +9 -6
- package/src/layer/wmsHelpers.ts +78 -10
- package/src/layer/wmsLayer.ts +11 -2
- package/src/map/cameraLimiter.ts +21 -2
- package/src/map/cesiumMap.ts +67 -2
- package/src/map/vcsMap.ts +2 -2
- package/src/oblique/helpers.ts +5 -13
- package/src/oblique/obliqueCollection.ts +2 -0
- package/src/oblique/obliqueDataSet.ts +16 -2
- package/src/oblique/obliqueImageMeta.ts +4 -0
- package/src/oblique/obliqueView.ts +12 -2
- package/src/oblique/parseImageJson.ts +7 -4
- package/src/ol/geojson.d.ts +1 -2
- package/src/ol/geom/circle.ts +1 -1
- package/src/style/declarativeStyleItem.ts +10 -2
- package/src/style/styleFactory.ts +2 -2
- package/src/style/styleHelpers.ts +13 -4
- package/src/style/vectorStyleItem.ts +32 -20
- package/src/util/clipping/clippingPlaneHelper.ts +3 -3
- package/src/util/editor/createFeatureSession.ts +9 -8
- package/src/util/editor/editFeaturesSession.ts +1 -1
- package/src/util/editor/editGeometrySession.ts +1 -1
- package/src/util/editor/editorSessionHelpers.ts +2 -2
- package/src/util/editor/selectFeaturesSession.ts +3 -3
- package/src/util/featureconverter/arcToCesium.ts +5 -1
- package/src/util/featureconverter/circleToCesium.ts +8 -2
- package/src/util/featureconverter/extent3D.ts +1 -1
- package/src/util/featureconverter/featureconverterHelper.ts +3 -5
- package/src/util/featureconverter/lineStringToCesium.ts +8 -1
- package/src/util/featureconverter/pointToCesium.ts +1 -1
- package/src/util/featureconverter/polygonToCesium.ts +6 -15
- package/src/util/fetch.ts +25 -0
- package/src/util/flight/flightAnchor.ts +195 -0
- package/src/util/flight/flightCollection.ts +78 -0
- package/src/util/flight/flightHelpers.ts +208 -0
- package/src/util/flight/flightInstance.ts +240 -0
- package/src/util/flight/flightPlayer.ts +326 -0
- package/src/util/flight/flightVisualizer.ts +202 -0
- package/src/util/hiddenObjects.ts +35 -0
- package/src/util/mapCollection.ts +2 -2
- package/src/util/overrideCollection.ts +26 -3
- package/src/util/projection.ts +5 -2
- package/src/util/viewpoint.ts +27 -7
- package/src/vcsApp.ts +56 -15
- package/src/vcsModule.ts +4 -0
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import type { Coordinate } from 'ol/coordinate.js';
|
|
8
8
|
import { getTransform } from 'ol/proj.js';
|
|
9
9
|
import Projection, { wgs84Projection } from '../util/projection.js';
|
|
10
|
+
import { getResourceOrUrl } from './cesium/resourceHelper.js';
|
|
10
11
|
|
|
11
12
|
export type TerrainProviderOptions = {
|
|
12
13
|
requestVertexNormals?: boolean;
|
|
@@ -15,16 +16,16 @@ export type TerrainProviderOptions = {
|
|
|
15
16
|
|
|
16
17
|
const terrainProviders: Record<string, CesiumTerrainProvider> = {};
|
|
17
18
|
|
|
18
|
-
/**
|
|
19
|
-
* @param url
|
|
20
|
-
* @param options
|
|
21
|
-
*/
|
|
22
19
|
export async function getTerrainProviderForUrl(
|
|
23
20
|
url: string,
|
|
24
21
|
options: TerrainProviderOptions,
|
|
22
|
+
headers?: Record<string, string>,
|
|
25
23
|
): Promise<CesiumTerrainProvider> {
|
|
26
24
|
if (!terrainProviders[url]) {
|
|
27
|
-
terrainProviders[url] = await CesiumTerrainProvider.fromUrl(
|
|
25
|
+
terrainProviders[url] = await CesiumTerrainProvider.fromUrl(
|
|
26
|
+
getResourceOrUrl(url, headers),
|
|
27
|
+
options,
|
|
28
|
+
);
|
|
28
29
|
return terrainProviders[url];
|
|
29
30
|
}
|
|
30
31
|
let terrainProvider = terrainProviders[url];
|
|
@@ -34,12 +35,24 @@ export async function getTerrainProviderForUrl(
|
|
|
34
35
|
(options.requestWaterMask !== undefined &&
|
|
35
36
|
terrainProvider.requestWaterMask !== options.requestWaterMask)
|
|
36
37
|
) {
|
|
37
|
-
terrainProviders[url] = await CesiumTerrainProvider.fromUrl(
|
|
38
|
+
terrainProviders[url] = await CesiumTerrainProvider.fromUrl(
|
|
39
|
+
getResourceOrUrl(url, headers),
|
|
40
|
+
options,
|
|
41
|
+
);
|
|
38
42
|
terrainProvider = terrainProviders[url];
|
|
39
43
|
}
|
|
40
44
|
return terrainProvider;
|
|
41
45
|
}
|
|
42
46
|
|
|
47
|
+
/**
|
|
48
|
+
* cleans the terrainProvider Cache, used for testing
|
|
49
|
+
*/
|
|
50
|
+
export function cleanCachedTerrainProviders(): void {
|
|
51
|
+
Object.keys(terrainProviders).forEach((key) => {
|
|
52
|
+
delete terrainProviders[key];
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
43
56
|
/**
|
|
44
57
|
* changes input coordinate Array in place, new height can also be accessed by coordinates[x][2]
|
|
45
58
|
* @param terrainProvider
|
|
@@ -78,10 +78,14 @@ class TerrainLayer extends Layer<TerrainCesiumImpl> {
|
|
|
78
78
|
async getHeightForWGS84Coordinates(
|
|
79
79
|
coords: Coordinate[],
|
|
80
80
|
): Promise<Coordinate[]> {
|
|
81
|
-
const terrainProvider = await getTerrainProviderForUrl(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
const terrainProvider = await getTerrainProviderForUrl(
|
|
82
|
+
this.url,
|
|
83
|
+
{
|
|
84
|
+
requestVertexNormals: this.requestVertexNormals,
|
|
85
|
+
requestWaterMask: this.requestWaterMask,
|
|
86
|
+
},
|
|
87
|
+
this.headers,
|
|
88
|
+
);
|
|
85
89
|
return getHeightFromTerrainProvider(
|
|
86
90
|
terrainProvider,
|
|
87
91
|
coords,
|
|
@@ -7,7 +7,7 @@ import TileProvider, {
|
|
|
7
7
|
TileProviderOptions,
|
|
8
8
|
} from './tileProvider.js';
|
|
9
9
|
import { getURL } from './urlTemplateTileProvider.js';
|
|
10
|
-
import { requestArrayBuffer } from '../../util/fetch.js';
|
|
10
|
+
import { getInitForUrl, requestArrayBuffer } from '../../util/fetch.js';
|
|
11
11
|
import { tileProviderClassRegistry } from '../../classRegistry.js';
|
|
12
12
|
|
|
13
13
|
export type MVTTileProviderOptions = TileProviderOptions & {
|
|
@@ -68,12 +68,18 @@ class MVTTileProvider extends TileProvider {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
async loader(
|
|
71
|
+
async loader(
|
|
72
|
+
x: number,
|
|
73
|
+
y: number,
|
|
74
|
+
z: number,
|
|
75
|
+
headers?: Record<string, string>,
|
|
76
|
+
): Promise<Feature[]> {
|
|
72
77
|
const rectangle = this.tilingScheme.tileXYToRectangle(x, y, z);
|
|
73
78
|
const url = getURL(this.url, x, y, z, rectangle, this.locale);
|
|
74
79
|
const extent = rectangleToExtent(rectangle);
|
|
75
80
|
const center = getCenter(extent);
|
|
76
|
-
const
|
|
81
|
+
const init = getInitForUrl(this.url, headers);
|
|
82
|
+
const data = await requestArrayBuffer(url, init);
|
|
77
83
|
const features = this._MVTFormat.readFeatures(data) as Feature[];
|
|
78
84
|
const sx = (extent[2] - extent[0]) / 4096;
|
|
79
85
|
const sy = -((extent[3] - extent[1]) / 4096);
|
|
@@ -2,7 +2,7 @@ import type { GeoJSONObject } from 'ol/format/GeoJSON.js';
|
|
|
2
2
|
import type { Feature } from 'ol/index.js';
|
|
3
3
|
import { parseGeoJSON } from '../geojsonHelpers.js';
|
|
4
4
|
import TileProvider, { TileProviderOptions } from './tileProvider.js';
|
|
5
|
-
import { requestJson } from '../../util/fetch.js';
|
|
5
|
+
import { getInitForUrl, requestJson } from '../../util/fetch.js';
|
|
6
6
|
import { tileProviderClassRegistry } from '../../classRegistry.js';
|
|
7
7
|
|
|
8
8
|
export type StaticGeoJSONTileProviderOptions = TileProviderOptions & {
|
|
@@ -36,8 +36,14 @@ class StaticGeoJSONTileProvider extends TileProvider {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// eslint-disable-next-line no-unused-vars
|
|
39
|
-
async loader(
|
|
40
|
-
|
|
39
|
+
async loader(
|
|
40
|
+
_x: number,
|
|
41
|
+
_y: number,
|
|
42
|
+
_z: number,
|
|
43
|
+
headers?: Record<string, string>,
|
|
44
|
+
): Promise<Feature[]> {
|
|
45
|
+
const init = getInitForUrl(this.url, headers);
|
|
46
|
+
const data = await requestJson<GeoJSONObject>(this.url, init);
|
|
41
47
|
const { features } = parseGeoJSON(data, { dynamicStyle: true });
|
|
42
48
|
return features;
|
|
43
49
|
}
|
|
@@ -363,6 +363,7 @@ class TileProvider extends VcsObject {
|
|
|
363
363
|
private async _getRtreeForBaseTile(
|
|
364
364
|
baseLevel: number,
|
|
365
365
|
tileCenter: Cartographic,
|
|
366
|
+
headers?: Record<string, string>,
|
|
366
367
|
): Promise<TileProviderRtree | null> {
|
|
367
368
|
const baseTile = this.tilingScheme.positionToTileXY(tileCenter, baseLevel);
|
|
368
369
|
const baseTileCacheKey = this.getCacheKey(
|
|
@@ -372,7 +373,12 @@ class TileProvider extends VcsObject {
|
|
|
372
373
|
);
|
|
373
374
|
if (this.cache.has(baseLevel)) {
|
|
374
375
|
if (!this.cache.get(baseLevel)!.containsKey(baseTileCacheKey)) {
|
|
375
|
-
const featuresPromise = this.loader(
|
|
376
|
+
const featuresPromise = this.loader(
|
|
377
|
+
baseTile.x,
|
|
378
|
+
baseTile.y,
|
|
379
|
+
baseLevel,
|
|
380
|
+
headers,
|
|
381
|
+
);
|
|
376
382
|
// eslint-disable-next-line no-void
|
|
377
383
|
void this._addTilePromiseToCache(
|
|
378
384
|
featuresPromise,
|
|
@@ -388,12 +394,14 @@ class TileProvider extends VcsObject {
|
|
|
388
394
|
/**
|
|
389
395
|
* returns the features intersecting this coordinate. Depending on the resolution a buffer around the coordinate is requested.
|
|
390
396
|
* The Buffer has the size of the resolution.
|
|
391
|
-
* @param
|
|
392
|
-
* @param
|
|
397
|
+
* @param coordinate in mercator
|
|
398
|
+
* @param resolution in m per pixel
|
|
399
|
+
* @param headers optional request headers to be sent with the server request
|
|
393
400
|
*/
|
|
394
401
|
async getFeaturesByCoordinate(
|
|
395
402
|
coordinate: Coordinate,
|
|
396
403
|
resolution: number,
|
|
404
|
+
headers?: Record<string, string>,
|
|
397
405
|
): Promise<Feature[]> {
|
|
398
406
|
const extent = createOrUpdateFromCoordinate(coordinate);
|
|
399
407
|
buffer(extent, resolution, extent);
|
|
@@ -406,7 +414,11 @@ class TileProvider extends VcsObject {
|
|
|
406
414
|
resolution,
|
|
407
415
|
cartographic.latitude,
|
|
408
416
|
);
|
|
409
|
-
const rtree = await this._getRtreeForBaseTile(
|
|
417
|
+
const rtree = await this._getRtreeForBaseTile(
|
|
418
|
+
baseLevel,
|
|
419
|
+
cartographic,
|
|
420
|
+
headers,
|
|
421
|
+
);
|
|
410
422
|
if (rtree) {
|
|
411
423
|
const features = rtree
|
|
412
424
|
.search({
|
|
@@ -423,20 +435,26 @@ class TileProvider extends VcsObject {
|
|
|
423
435
|
|
|
424
436
|
/**
|
|
425
437
|
* returns features for the requested Tile.
|
|
426
|
-
* @param
|
|
427
|
-
* @param
|
|
428
|
-
* @param
|
|
438
|
+
* @param x
|
|
439
|
+
* @param y
|
|
440
|
+
* @param level - if the level is not a base level, will use the closest match
|
|
441
|
+
* @param headers optional request headers to be sent with the server request
|
|
429
442
|
*/
|
|
430
443
|
async getFeaturesForTile(
|
|
431
444
|
x: number,
|
|
432
445
|
y: number,
|
|
433
446
|
level: number,
|
|
447
|
+
headers?: Record<string, string>,
|
|
434
448
|
): Promise<Feature[]> {
|
|
435
449
|
const rectangle = this.tilingScheme.tileXYToRectangle(x, y, level);
|
|
436
450
|
const tileCenter = Rectangle.center(rectangle);
|
|
437
451
|
const baseLevel = this.getBaseLevel(level);
|
|
438
452
|
if (baseLevel != null) {
|
|
439
|
-
const rtree = await this._getRtreeForBaseTile(
|
|
453
|
+
const rtree = await this._getRtreeForBaseTile(
|
|
454
|
+
baseLevel,
|
|
455
|
+
tileCenter,
|
|
456
|
+
headers,
|
|
457
|
+
);
|
|
440
458
|
if (rtree) {
|
|
441
459
|
if (level === baseLevel) {
|
|
442
460
|
return rtree.all().map((item) => item.value);
|
|
@@ -462,21 +480,29 @@ class TileProvider extends VcsObject {
|
|
|
462
480
|
const childNorth = x * 2;
|
|
463
481
|
const childWest = y * 2;
|
|
464
482
|
return [
|
|
465
|
-
...(await this.getFeaturesForTile(
|
|
483
|
+
...(await this.getFeaturesForTile(
|
|
484
|
+
childNorth,
|
|
485
|
+
childWest,
|
|
486
|
+
childLevel,
|
|
487
|
+
headers,
|
|
488
|
+
)),
|
|
466
489
|
...(await this.getFeaturesForTile(
|
|
467
490
|
childNorth + 1,
|
|
468
491
|
childWest,
|
|
469
492
|
childLevel,
|
|
493
|
+
headers,
|
|
470
494
|
)),
|
|
471
495
|
...(await this.getFeaturesForTile(
|
|
472
496
|
childNorth + 1,
|
|
473
497
|
childWest + 1,
|
|
474
498
|
childLevel,
|
|
499
|
+
headers,
|
|
475
500
|
)),
|
|
476
501
|
...(await this.getFeaturesForTile(
|
|
477
502
|
childNorth,
|
|
478
503
|
childWest + 1,
|
|
479
504
|
childLevel,
|
|
505
|
+
headers,
|
|
480
506
|
)),
|
|
481
507
|
];
|
|
482
508
|
}
|
|
@@ -485,12 +511,14 @@ class TileProvider extends VcsObject {
|
|
|
485
511
|
|
|
486
512
|
/**
|
|
487
513
|
* Retrieves all features which intersect the given extent. Will load all intersecting tiles.
|
|
488
|
-
* @param
|
|
489
|
-
* @param
|
|
514
|
+
* @param extent
|
|
515
|
+
* @param level - Optional level to request. Will use highest level if omitted. If the provided level is not a base level, will use the closest match.
|
|
516
|
+
* @param headers Optional request headers to be sent with the server request
|
|
490
517
|
*/
|
|
491
518
|
async getFeaturesForExtent(
|
|
492
519
|
extent: Extent,
|
|
493
520
|
level?: number,
|
|
521
|
+
headers?: Record<string, string>,
|
|
494
522
|
): Promise<Feature[]> {
|
|
495
523
|
let usedLevel = level != null ? level : this.baseLevels[0];
|
|
496
524
|
usedLevel = this.getBaseLevel(usedLevel) as number;
|
|
@@ -512,7 +540,9 @@ class TileProvider extends VcsObject {
|
|
|
512
540
|
}
|
|
513
541
|
|
|
514
542
|
const features = await Promise.all(
|
|
515
|
-
tileCoordinates.map(([x, y]) =>
|
|
543
|
+
tileCoordinates.map(([x, y]) =>
|
|
544
|
+
this.getFeaturesForTile(x, y, usedLevel, headers),
|
|
545
|
+
),
|
|
516
546
|
);
|
|
517
547
|
const mercatorExtent =
|
|
518
548
|
extent.getCoordinatesInProjection(mercatorProjection);
|
|
@@ -559,7 +589,12 @@ class TileProvider extends VcsObject {
|
|
|
559
589
|
* });
|
|
560
590
|
*/
|
|
561
591
|
// eslint-disable-next-line class-methods-use-this,no-unused-vars
|
|
562
|
-
loader(
|
|
592
|
+
loader(
|
|
593
|
+
_x: number,
|
|
594
|
+
_y: number,
|
|
595
|
+
_z: number,
|
|
596
|
+
_headers?: Record<string, string>,
|
|
597
|
+
): Promise<Feature[]> {
|
|
563
598
|
return Promise.resolve([]);
|
|
564
599
|
}
|
|
565
600
|
|
|
@@ -589,6 +624,7 @@ class TileProvider extends VcsObject {
|
|
|
589
624
|
if (defaultOptions.allowTileAggregation !== this.allowTileAggregation) {
|
|
590
625
|
config.allowTileAggregation = this.allowTileAggregation;
|
|
591
626
|
}
|
|
627
|
+
|
|
592
628
|
return config;
|
|
593
629
|
}
|
|
594
630
|
|
|
@@ -3,7 +3,7 @@ import { Math as CesiumMath, Rectangle } from '@vcmap-cesium/engine';
|
|
|
3
3
|
import type { Feature } from 'ol/index.js';
|
|
4
4
|
import { parseGeoJSON } from '../geojsonHelpers.js';
|
|
5
5
|
import TileProvider, { TileProviderOptions } from './tileProvider.js';
|
|
6
|
-
import { requestJson } from '../../util/fetch.js';
|
|
6
|
+
import { getInitForUrl, requestJson } from '../../util/fetch.js';
|
|
7
7
|
import { tileProviderClassRegistry } from '../../classRegistry.js';
|
|
8
8
|
|
|
9
9
|
export type URLTemplateTileProviderOptions = TileProviderOptions & {
|
|
@@ -94,10 +94,17 @@ class URLTemplateTileProvider extends TileProvider {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
async loader(
|
|
97
|
+
async loader(
|
|
98
|
+
x: number,
|
|
99
|
+
y: number,
|
|
100
|
+
z: number,
|
|
101
|
+
headers?: Record<string, string>,
|
|
102
|
+
): Promise<Feature[]> {
|
|
98
103
|
const rectangle = this.tilingScheme.tileXYToRectangle(x, y, z);
|
|
99
104
|
const url = getURL(this.url, x, y, z, rectangle, this.locale);
|
|
100
|
-
|
|
105
|
+
|
|
106
|
+
const init = getInitForUrl(this.url, headers);
|
|
107
|
+
const data = await requestJson<GeoJSONObject>(url, init);
|
|
101
108
|
const { features } = parseGeoJSON(data, { dynamicStyle: true });
|
|
102
109
|
return features;
|
|
103
110
|
}
|
package/src/layer/vectorLayer.ts
CHANGED
|
@@ -16,7 +16,7 @@ import type {
|
|
|
16
16
|
} from '@vcmap-cesium/engine';
|
|
17
17
|
|
|
18
18
|
import { v4 as uuidv4 } from 'uuid';
|
|
19
|
-
import { check } from '@vcsuite/check';
|
|
19
|
+
import { check, oneOf } from '@vcsuite/check';
|
|
20
20
|
import { parseBoolean } from '@vcsuite/parsers';
|
|
21
21
|
import Projection, {
|
|
22
22
|
getDefaultProjection,
|
|
@@ -78,7 +78,12 @@ export type VectorOptions = FeatureLayerOptions & {
|
|
|
78
78
|
|
|
79
79
|
export type VectorGeometryFactoryType = {
|
|
80
80
|
getCoordinates(geom: SimpleGeometry[]): Coordinate[];
|
|
81
|
-
getGeometryOptions(
|
|
81
|
+
getGeometryOptions(
|
|
82
|
+
geom: SimpleGeometry,
|
|
83
|
+
num: number,
|
|
84
|
+
perPositionHeight: boolean,
|
|
85
|
+
groundLevelOrMinHeight: number,
|
|
86
|
+
): unknown;
|
|
82
87
|
createSolidGeometries(
|
|
83
88
|
obj: unknown,
|
|
84
89
|
num: number,
|
|
@@ -101,11 +106,6 @@ export type VectorGeometryFactoryType = {
|
|
|
101
106
|
style: Style,
|
|
102
107
|
): GroundPolylineGeometry[];
|
|
103
108
|
createLineGeometries(obj: unknown, style: Style): PolylineGeometry[];
|
|
104
|
-
createLineGeometries(
|
|
105
|
-
obj: unknown,
|
|
106
|
-
style: Style,
|
|
107
|
-
groundLevel?: number,
|
|
108
|
-
): PolylineGeometry[];
|
|
109
109
|
};
|
|
110
110
|
|
|
111
111
|
export type VectorHeightInfo = {
|
|
@@ -415,7 +415,7 @@ class VectorLayer
|
|
|
415
415
|
* sets the highlightstyle of this layer
|
|
416
416
|
*/
|
|
417
417
|
setHighlightStyle(style: Style | StyleFunction | VectorStyleItem): void {
|
|
418
|
-
check(style,
|
|
418
|
+
check(style, oneOf(Style, VectorStyleItem, Function));
|
|
419
419
|
if (style instanceof VectorStyleItem) {
|
|
420
420
|
this.highlightStyle = style;
|
|
421
421
|
} else {
|
|
@@ -500,7 +500,7 @@ class VectorLayer
|
|
|
500
500
|
* feature geometries are always in EPSG 3857 mercator coordinate system
|
|
501
501
|
*/
|
|
502
502
|
getFeaturesById(ids: (string | number)[]): Feature[] {
|
|
503
|
-
check(ids, [
|
|
503
|
+
check(ids, [oneOf(String, Number)]);
|
|
504
504
|
return ids
|
|
505
505
|
.map((id) => this.getFeatureById(id))
|
|
506
506
|
.filter((f) => f != null) as Feature[];
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
NearFarScalar,
|
|
11
11
|
type SphereGeometry,
|
|
12
12
|
} from '@vcmap-cesium/engine';
|
|
13
|
-
import { check,
|
|
13
|
+
import { check, maybe, ofEnum } from '@vcsuite/check';
|
|
14
14
|
import type { Coordinate } from 'ol/coordinate.js';
|
|
15
15
|
import type { Color } from 'ol/color.js';
|
|
16
16
|
import type { ColorLike } from 'ol/colorlike.js';
|
|
@@ -24,10 +24,12 @@ import { getLogger as getLoggerByName, type Logger } from '@vcsuite/logger';
|
|
|
24
24
|
import VcsEvent from '../vcsEvent.js';
|
|
25
25
|
import { DeclarativeStyleItemOptions } from '../style/declarativeStyleItem.js';
|
|
26
26
|
import { VectorStyleItemOptions } from '../style/vectorStyleItem.js';
|
|
27
|
+
import type { FlightInstanceMeta } from '../util/flight/flightInstance.js';
|
|
27
28
|
|
|
28
29
|
function getLogger(): Logger {
|
|
29
30
|
return getLoggerByName('VectorProperties');
|
|
30
31
|
}
|
|
32
|
+
|
|
31
33
|
export enum PrimitiveOptionsType {
|
|
32
34
|
CYLINDER = 'cylinder',
|
|
33
35
|
SPHERE = 'sphere',
|
|
@@ -72,11 +74,18 @@ export function vectorPropertiesOfType<T extends PrimitiveOptionsType>(
|
|
|
72
74
|
return options.type === type;
|
|
73
75
|
}
|
|
74
76
|
|
|
77
|
+
export type AltitudeModeType =
|
|
78
|
+
| 'absolute'
|
|
79
|
+
| 'relativeToGround'
|
|
80
|
+
| 'clampToGround';
|
|
81
|
+
|
|
82
|
+
export type ClassificationTypeType = 'both' | 'terrain' | 'cesium3DTile';
|
|
83
|
+
|
|
75
84
|
export type VectorPropertiesOptions = {
|
|
76
85
|
/**
|
|
77
86
|
* (3D) Either "relativeToGround", "clampToGround" or 'absolute'
|
|
78
87
|
*/
|
|
79
|
-
altitudeMode?:
|
|
88
|
+
altitudeMode?: AltitudeModeType;
|
|
80
89
|
/**
|
|
81
90
|
* if the features are pickable
|
|
82
91
|
*/
|
|
@@ -84,7 +93,7 @@ export type VectorPropertiesOptions = {
|
|
|
84
93
|
/**
|
|
85
94
|
* (3D) the cesium classification type for this layer. one of 'both', 'terrain' or 'cesium3DTile'
|
|
86
95
|
*/
|
|
87
|
-
classificationType?:
|
|
96
|
+
classificationType?: ClassificationTypeType;
|
|
88
97
|
/**
|
|
89
98
|
* (3D) Array with 4 numbers by which features are being scaled based on distance see <a href="https://cesium.com/docs/cesiumjs-ref-doc/Billboard.html#scaleByDistance"> here </a>
|
|
90
99
|
*/
|
|
@@ -152,7 +161,7 @@ export type VcsMeta = VectorPropertiesOptions & {
|
|
|
152
161
|
style?: VectorStyleItemOptions | DeclarativeStyleItemOptions;
|
|
153
162
|
embeddedIcons?: string[];
|
|
154
163
|
screenSpaceError?: number;
|
|
155
|
-
flightOptions?:
|
|
164
|
+
flightOptions?: FlightInstanceMeta;
|
|
156
165
|
baseUrl?: string;
|
|
157
166
|
/**
|
|
158
167
|
* the layers properties bag
|
|
@@ -181,13 +190,16 @@ export type VectorPropertiesPrimitive = VectorPropertiesBaseOptions & {
|
|
|
181
190
|
*/
|
|
182
191
|
export const vcsMetaVersion = '2.1';
|
|
183
192
|
|
|
184
|
-
export const AltitudeModeCesium = {
|
|
193
|
+
export const AltitudeModeCesium: Record<AltitudeModeType, HeightReference> = {
|
|
185
194
|
clampToGround: HeightReference.CLAMP_TO_GROUND,
|
|
186
195
|
absolute: HeightReference.NONE,
|
|
187
196
|
relativeToGround: HeightReference.RELATIVE_TO_GROUND,
|
|
188
197
|
};
|
|
189
198
|
|
|
190
|
-
export const ClassificationTypeCesium
|
|
199
|
+
export const ClassificationTypeCesium: Record<
|
|
200
|
+
ClassificationTypeType,
|
|
201
|
+
ClassificationType
|
|
202
|
+
> = {
|
|
191
203
|
both: ClassificationType.BOTH,
|
|
192
204
|
cesium3DTile: ClassificationType.CESIUM_3D_TILE,
|
|
193
205
|
terrain: ClassificationType.TERRAIN,
|
|
@@ -246,19 +258,27 @@ export function parseStoreyHeights(
|
|
|
246
258
|
return defaultStoreyHeights;
|
|
247
259
|
}
|
|
248
260
|
|
|
249
|
-
export function getAltitudeModeOptions(
|
|
250
|
-
|
|
261
|
+
export function getAltitudeModeOptions(
|
|
262
|
+
altitudeMode: HeightReference,
|
|
263
|
+
): AltitudeModeType {
|
|
264
|
+
for (const [key, mode] of Object.entries(AltitudeModeCesium) as [
|
|
265
|
+
AltitudeModeType,
|
|
266
|
+
HeightReference,
|
|
267
|
+
][]) {
|
|
251
268
|
if (mode === altitudeMode) {
|
|
252
269
|
return key;
|
|
253
270
|
}
|
|
254
271
|
}
|
|
255
|
-
throw new Error(`
|
|
272
|
+
throw new Error(`Unknown altitude mode ${altitudeMode}`);
|
|
256
273
|
}
|
|
257
274
|
|
|
258
275
|
export function getClassificationTypeOptions(
|
|
259
276
|
classificationType?: ClassificationType,
|
|
260
|
-
):
|
|
261
|
-
for (const [key, mode] of Object.entries(ClassificationTypeCesium)
|
|
277
|
+
): ClassificationTypeType | undefined {
|
|
278
|
+
for (const [key, mode] of Object.entries(ClassificationTypeCesium) as [
|
|
279
|
+
ClassificationTypeType,
|
|
280
|
+
ClassificationType,
|
|
281
|
+
][]) {
|
|
262
282
|
if (mode === classificationType) {
|
|
263
283
|
return key;
|
|
264
284
|
}
|
|
@@ -484,7 +504,7 @@ class VectorProperties {
|
|
|
484
504
|
|
|
485
505
|
set altitudeMode(altitudeMode: HeightReference) {
|
|
486
506
|
if (altitudeMode !== this._altitudeMode) {
|
|
487
|
-
check(altitudeMode,
|
|
507
|
+
check(altitudeMode, ofEnum(HeightReference));
|
|
488
508
|
this._altitudeMode = altitudeMode;
|
|
489
509
|
this.propertyChanged.raiseEvent(['altitudeMode']);
|
|
490
510
|
}
|
|
@@ -521,7 +541,7 @@ class VectorProperties {
|
|
|
521
541
|
|
|
522
542
|
set classificationType(classificationType: ClassificationType | undefined) {
|
|
523
543
|
if (classificationType !== this._classificationType) {
|
|
524
|
-
|
|
544
|
+
check(classificationType, maybe(ofEnum(ClassificationType)));
|
|
525
545
|
this._classificationType = classificationType;
|
|
526
546
|
this.propertyChanged.raiseEvent(['classificationType']);
|
|
527
547
|
}
|
|
@@ -541,7 +561,7 @@ class VectorProperties {
|
|
|
541
561
|
|
|
542
562
|
set scaleByDistance(value: NearFarScalar | undefined) {
|
|
543
563
|
if (!NearFarScalar.equals(value, this._scaleByDistance)) {
|
|
544
|
-
|
|
564
|
+
check(value, maybe(NearFarScalar));
|
|
545
565
|
this._scaleByDistance = value;
|
|
546
566
|
this.propertyChanged.raiseEvent(['scaleByDistance']);
|
|
547
567
|
}
|
|
@@ -560,7 +580,7 @@ class VectorProperties {
|
|
|
560
580
|
|
|
561
581
|
set eyeOffset(value: Cartesian3 | undefined) {
|
|
562
582
|
if (!Cartesian3.equals(this.eyeOffset, value)) {
|
|
563
|
-
|
|
583
|
+
check(value, maybe(Cartesian3));
|
|
564
584
|
this._eyeOffset = value;
|
|
565
585
|
this.propertyChanged.raiseEvent(['eyeOffset']);
|
|
566
586
|
}
|
|
@@ -624,7 +644,7 @@ class VectorProperties {
|
|
|
624
644
|
|
|
625
645
|
set groundLevel(value: number | undefined) {
|
|
626
646
|
if (value !== this._groundLevel) {
|
|
627
|
-
|
|
647
|
+
check(value, maybe(Number));
|
|
628
648
|
this._groundLevel = value;
|
|
629
649
|
this.propertyChanged.raiseEvent(['groundLevel']);
|
|
630
650
|
}
|
|
@@ -731,7 +751,7 @@ class VectorProperties {
|
|
|
731
751
|
}
|
|
732
752
|
|
|
733
753
|
set modelUrl(value: string | undefined) {
|
|
734
|
-
|
|
754
|
+
check(value, maybe(String));
|
|
735
755
|
|
|
736
756
|
if (this._modelUrl !== value) {
|
|
737
757
|
this._modelUrl = value;
|
|
@@ -855,7 +875,7 @@ class VectorProperties {
|
|
|
855
875
|
}
|
|
856
876
|
|
|
857
877
|
set modelOptions(modelOptions: Record<string, unknown> | undefined) {
|
|
858
|
-
|
|
878
|
+
check(modelOptions, maybe(Object));
|
|
859
879
|
|
|
860
880
|
if (this._modelOptions !== modelOptions) {
|
|
861
881
|
this._modelOptions = modelOptions;
|
|
@@ -885,7 +905,7 @@ class VectorProperties {
|
|
|
885
905
|
}
|
|
886
906
|
|
|
887
907
|
set modelAutoScale(value: boolean) {
|
|
888
|
-
|
|
908
|
+
check(value, maybe(Boolean));
|
|
889
909
|
|
|
890
910
|
const booleanValue = !!value;
|
|
891
911
|
if (this._modelAutoScale !== booleanValue) {
|
|
@@ -906,7 +926,7 @@ class VectorProperties {
|
|
|
906
926
|
}
|
|
907
927
|
|
|
908
928
|
set baseUrl(value: string | undefined) {
|
|
909
|
-
|
|
929
|
+
check(value, maybe(String));
|
|
910
930
|
|
|
911
931
|
if (this._baseUrl !== value) {
|
|
912
932
|
this._baseUrl = value;
|
|
@@ -924,7 +944,7 @@ class VectorProperties {
|
|
|
924
944
|
}
|
|
925
945
|
|
|
926
946
|
set primitiveOptions(value: VectorPropertiesPrimitiveOptions | undefined) {
|
|
927
|
-
|
|
947
|
+
check(value, maybe(Object));
|
|
928
948
|
|
|
929
949
|
if (this._primitiveOptions !== value) {
|
|
930
950
|
this._primitiveOptions = value;
|
|
@@ -1282,11 +1302,15 @@ class VectorProperties {
|
|
|
1282
1302
|
/**
|
|
1283
1303
|
* The common vector properties for the input features.
|
|
1284
1304
|
* @param features Features for which the vector property values should be returned.
|
|
1285
|
-
* @returns The common vector properties for the features. When a/all feature(s) does not has a property set, the layer or, if not set, the default value is returned. If features have different values for a property, the property key is not added to the returned obeject.
|
|
1305
|
+
* @returns The common vector properties for the features. When a/all feature(s) does not has a property set, the layer or, if not set, the default value is returned. If features have different values for a property, the property key is not added to the returned obeject. If feature array is empty, an empty object is returned.
|
|
1286
1306
|
*/
|
|
1287
1307
|
getValuesForFeatures(features: Feature[]): VectorPropertiesOptions {
|
|
1288
1308
|
const values: VectorPropertiesOptions = {};
|
|
1289
1309
|
|
|
1310
|
+
if (!features.length) {
|
|
1311
|
+
return values;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1290
1314
|
/**
|
|
1291
1315
|
* Checks if all the values of the array are equal using fast-deep-equal.
|
|
1292
1316
|
* @param propertyValues An array of values for a specific property from different features.
|
package/src/layer/wfsLayer.ts
CHANGED
|
@@ -2,7 +2,7 @@ import WFSFormat from 'ol/format/WFS.js';
|
|
|
2
2
|
import VectorLayer, { VectorOptions } from './vectorLayer.js';
|
|
3
3
|
import Projection from '../util/projection.js';
|
|
4
4
|
import { layerClassRegistry } from '../classRegistry.js';
|
|
5
|
-
import { requestUrl } from '../util/fetch.js';
|
|
5
|
+
import { getInitForUrl, requestUrl } from '../util/fetch.js';
|
|
6
6
|
|
|
7
7
|
export type WFSOptions = VectorOptions & {
|
|
8
8
|
/**
|
|
@@ -125,13 +125,16 @@ class WFSLayer extends VectorLayer {
|
|
|
125
125
|
...this.getFeaturesOptions,
|
|
126
126
|
});
|
|
127
127
|
const postData = new XMLSerializer().serializeToString(requestDocument);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
const init = getInitForUrl(this.url, this.headers);
|
|
129
|
+
init.method = 'POST';
|
|
130
|
+
init.body = postData;
|
|
131
|
+
init.headers = {
|
|
132
|
+
...init.headers,
|
|
133
|
+
...{
|
|
131
134
|
'Content-Type': 'application/text+xml',
|
|
132
135
|
},
|
|
133
|
-
|
|
134
|
-
|
|
136
|
+
};
|
|
137
|
+
this._dataFetchedPromise = requestUrl(this.url, init)
|
|
135
138
|
.then((response) => response.text())
|
|
136
139
|
.then((data) => this._parseWFSData(data))
|
|
137
140
|
.catch((err) => {
|