@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
package/src/layer/wmsHelpers.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import { TrustedServers } from '@vcmap-cesium/engine';
|
|
2
|
+
import { getLogger } from '@vcsuite/logger';
|
|
1
3
|
import type { Size } from 'ol/size.js';
|
|
2
4
|
import TileWMS, { type Options as TileWMSOptions } from 'ol/source/TileWMS.js';
|
|
5
|
+
import ImageWMS, {
|
|
6
|
+
type Options as ImageWMSOptions,
|
|
7
|
+
} from 'ol/source/ImageWMS.js';
|
|
8
|
+
|
|
3
9
|
import { getTopLeft, getWidth } from 'ol/extent.js';
|
|
4
10
|
import TileGrid, {
|
|
5
11
|
type Options as TileGridOptions,
|
|
@@ -8,6 +14,8 @@ import { mercatorProjection, wgs84Projection } from '../util/projection.js';
|
|
|
8
14
|
import { isSameOrigin } from '../util/urlHelpers.js';
|
|
9
15
|
import type Extent from '../util/extent.js';
|
|
10
16
|
import { TilingScheme } from './rasterLayer.js';
|
|
17
|
+
import { getTileLoadFunction } from './openlayers/loadFunctionHelpers.js';
|
|
18
|
+
import { getInitForUrl, requestObjectUrl } from '../util/fetch.js';
|
|
11
19
|
|
|
12
20
|
export type WMSSourceOptions = {
|
|
13
21
|
url: string;
|
|
@@ -18,9 +26,23 @@ export type WMSSourceOptions = {
|
|
|
18
26
|
extent?: Extent;
|
|
19
27
|
parameters: Record<string, string>;
|
|
20
28
|
version: string;
|
|
29
|
+
headers?: Record<string, string>;
|
|
21
30
|
};
|
|
22
31
|
|
|
23
|
-
|
|
32
|
+
export function getProjectionFromWMSSourceOptions(
|
|
33
|
+
tilingSchema: TilingScheme,
|
|
34
|
+
version: string,
|
|
35
|
+
): string {
|
|
36
|
+
if (tilingSchema === 'geographic') {
|
|
37
|
+
if (version === '1.3.0') {
|
|
38
|
+
return 'CRS:84';
|
|
39
|
+
} else {
|
|
40
|
+
return 'EPSG:4326';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return 'EPSG:3857';
|
|
44
|
+
}
|
|
45
|
+
|
|
24
46
|
export function getWMSSource(options: WMSSourceOptions): TileWMS {
|
|
25
47
|
const projection =
|
|
26
48
|
options.tilingSchema === 'geographic'
|
|
@@ -55,18 +77,64 @@ export function getWMSSource(options: WMSSourceOptions): TileWMS {
|
|
|
55
77
|
url: options.url,
|
|
56
78
|
tileGrid: new TileGrid(tilingOptions),
|
|
57
79
|
params: options.parameters,
|
|
80
|
+
projection: getProjectionFromWMSSourceOptions(
|
|
81
|
+
options.tilingSchema,
|
|
82
|
+
options.version,
|
|
83
|
+
),
|
|
58
84
|
};
|
|
59
|
-
|
|
85
|
+
|
|
86
|
+
if (TrustedServers.contains(options.url)) {
|
|
87
|
+
sourceOptions.crossOrigin = 'use-credentials';
|
|
88
|
+
} else if (!isSameOrigin(options.url)) {
|
|
60
89
|
sourceOptions.crossOrigin = 'anonymous';
|
|
61
90
|
}
|
|
62
|
-
if (options.
|
|
63
|
-
|
|
64
|
-
sourceOptions.projection = 'CRS:84';
|
|
65
|
-
} else {
|
|
66
|
-
sourceOptions.projection = 'EPSG:4326';
|
|
67
|
-
}
|
|
68
|
-
} else {
|
|
69
|
-
sourceOptions.projection = 'EPSG:3857';
|
|
91
|
+
if (options.headers) {
|
|
92
|
+
sourceOptions.tileLoadFunction = getTileLoadFunction(options.headers);
|
|
70
93
|
}
|
|
71
94
|
return new TileWMS(sourceOptions);
|
|
72
95
|
}
|
|
96
|
+
|
|
97
|
+
export function getImageWMSSource(options: {
|
|
98
|
+
url: string;
|
|
99
|
+
parameters: Record<string, string>;
|
|
100
|
+
tilingSchema: TilingScheme;
|
|
101
|
+
version: string;
|
|
102
|
+
headers?: Record<string, string>;
|
|
103
|
+
}): ImageWMS {
|
|
104
|
+
const sourceOptions: ImageWMSOptions = {
|
|
105
|
+
url: options.url,
|
|
106
|
+
params: options.parameters,
|
|
107
|
+
projection: getProjectionFromWMSSourceOptions(
|
|
108
|
+
options.tilingSchema,
|
|
109
|
+
options.version,
|
|
110
|
+
),
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
if (TrustedServers.contains(options.url)) {
|
|
114
|
+
sourceOptions.crossOrigin = 'use-credentials';
|
|
115
|
+
} else if (!isSameOrigin(options.url)) {
|
|
116
|
+
sourceOptions.crossOrigin = 'anonymous';
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (options.headers) {
|
|
120
|
+
sourceOptions.imageLoadFunction = function imageLoadFunction(
|
|
121
|
+
image,
|
|
122
|
+
src,
|
|
123
|
+
): void {
|
|
124
|
+
const img = image.getImage() as HTMLImageElement;
|
|
125
|
+
const init = getInitForUrl(src, options.headers);
|
|
126
|
+
requestObjectUrl(src, init)
|
|
127
|
+
.then((blobUrl) => {
|
|
128
|
+
img.src = blobUrl;
|
|
129
|
+
img.onload = (): void => {
|
|
130
|
+
URL.revokeObjectURL(blobUrl);
|
|
131
|
+
};
|
|
132
|
+
})
|
|
133
|
+
.catch(() => {
|
|
134
|
+
getLogger('ImageWMSSource').error(`Could not load image: ${src}`);
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return new ImageWMS(sourceOptions);
|
|
140
|
+
}
|
package/src/layer/wmsLayer.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { check } from '@vcsuite/check';
|
|
1
|
+
import { check, oneOf } from '@vcsuite/check';
|
|
2
2
|
import { parseBoolean } from '@vcsuite/parsers';
|
|
3
3
|
import type { Size } from 'ol/size.js';
|
|
4
4
|
|
|
@@ -22,6 +22,7 @@ export type WMSImplementationOptions = RasterLayerImplementationOptions & {
|
|
|
22
22
|
highResolution: boolean;
|
|
23
23
|
tileSize: import('ol/size.js').Size;
|
|
24
24
|
version: string;
|
|
25
|
+
singleImage2d: boolean;
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
export type WMSOptions = RasterLayerOptions & {
|
|
@@ -50,6 +51,10 @@ export type WMSOptions = RasterLayerOptions & {
|
|
|
50
51
|
* use higher resolution images (sofar only in 3D)
|
|
51
52
|
*/
|
|
52
53
|
highResolution?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Use a single image in 2D
|
|
56
|
+
*/
|
|
57
|
+
singleImage2d?: boolean;
|
|
53
58
|
};
|
|
54
59
|
|
|
55
60
|
/**
|
|
@@ -81,6 +86,8 @@ class WMSLayer extends RasterLayer<WmsCesiumImpl | WmsOpenlayersImpl> {
|
|
|
81
86
|
|
|
82
87
|
highResolution: boolean;
|
|
83
88
|
|
|
89
|
+
singleImage2d: boolean;
|
|
90
|
+
|
|
84
91
|
private _featureInfoOptions: Partial<WMSFeatureProviderOptions> | undefined;
|
|
85
92
|
|
|
86
93
|
/**
|
|
@@ -127,6 +134,7 @@ class WMSLayer extends RasterLayer<WmsCesiumImpl | WmsOpenlayersImpl> {
|
|
|
127
134
|
this._featureInfoOptions =
|
|
128
135
|
options.featureInfo || defaultOptions.featureInfo;
|
|
129
136
|
this._supportedMaps = [CesiumMap.className, OpenlayersMap.className];
|
|
137
|
+
this.singleImage2d = parseBoolean(options.singleImage2d, false);
|
|
130
138
|
}
|
|
131
139
|
|
|
132
140
|
initialize(): Promise<void> {
|
|
@@ -171,6 +179,7 @@ class WMSLayer extends RasterLayer<WmsCesiumImpl | WmsOpenlayersImpl> {
|
|
|
171
179
|
parameters: this.parameters,
|
|
172
180
|
highResolution: this.highResolution,
|
|
173
181
|
tileSize: this.tileSize,
|
|
182
|
+
singleImage2d: this.singleImage2d,
|
|
174
183
|
};
|
|
175
184
|
}
|
|
176
185
|
|
|
@@ -190,7 +199,7 @@ class WMSLayer extends RasterLayer<WmsCesiumImpl | WmsOpenlayersImpl> {
|
|
|
190
199
|
* @param layers - a layer name or an array of layer names
|
|
191
200
|
*/
|
|
192
201
|
async setLayers(layers: string | string[]): Promise<void> {
|
|
193
|
-
check(layers,
|
|
202
|
+
check(layers, oneOf(String, [String]));
|
|
194
203
|
const layersArray = Array.isArray(layers) ? layers : [layers];
|
|
195
204
|
this.parameters.LAYERS = layersArray.join(',');
|
|
196
205
|
await this.forceRedraw();
|
package/src/map/cameraLimiter.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import deepEqual from 'fast-deep-equal';
|
|
1
2
|
import {
|
|
2
3
|
Camera,
|
|
3
4
|
Cartographic,
|
|
@@ -6,7 +7,7 @@ import {
|
|
|
6
7
|
sampleTerrain,
|
|
7
8
|
sampleTerrainMostDetailed,
|
|
8
9
|
} from '@vcmap-cesium/engine';
|
|
9
|
-
import {
|
|
10
|
+
import { check, maybe } from '@vcsuite/check';
|
|
10
11
|
import { parseInteger, parseNumber, parseEnumValue } from '@vcsuite/parsers';
|
|
11
12
|
import {
|
|
12
13
|
getTerrainProviderForUrl,
|
|
@@ -26,6 +27,10 @@ export type CameraLimiterOptions = {
|
|
|
26
27
|
* required if mode is distance.
|
|
27
28
|
*/
|
|
28
29
|
terrainUrl?: string;
|
|
30
|
+
/**
|
|
31
|
+
* if mode is distance this can be used to send headers with each request to the terrainUrl
|
|
32
|
+
*/
|
|
33
|
+
terrainRequestHeaders?: Record<string, string>;
|
|
29
34
|
/**
|
|
30
35
|
* @default 'height'
|
|
31
36
|
*/
|
|
@@ -53,6 +58,7 @@ class CameraLimiter {
|
|
|
53
58
|
return {
|
|
54
59
|
mode: CameraLimiterMode.HEIGHT,
|
|
55
60
|
terrainUrl: undefined,
|
|
61
|
+
terrainRequestHeaders: undefined,
|
|
56
62
|
limit: 200,
|
|
57
63
|
level: 12,
|
|
58
64
|
};
|
|
@@ -80,6 +86,8 @@ class CameraLimiter {
|
|
|
80
86
|
*/
|
|
81
87
|
lastCheckedPosition = new Cartographic();
|
|
82
88
|
|
|
89
|
+
terrainRequestHeaders?: Record<string, string>;
|
|
90
|
+
|
|
83
91
|
/**
|
|
84
92
|
* last updated terrain height
|
|
85
93
|
*/
|
|
@@ -101,6 +109,7 @@ class CameraLimiter {
|
|
|
101
109
|
options.level === null
|
|
102
110
|
? null
|
|
103
111
|
: parseInteger(options.level, defaultOptions.level as number);
|
|
112
|
+
this.terrainRequestHeaders = options.terrainRequestHeaders;
|
|
104
113
|
}
|
|
105
114
|
|
|
106
115
|
/**
|
|
@@ -111,7 +120,7 @@ class CameraLimiter {
|
|
|
111
120
|
}
|
|
112
121
|
|
|
113
122
|
set terrainUrl(url: string | undefined) {
|
|
114
|
-
|
|
123
|
+
check(url, maybe(String));
|
|
115
124
|
|
|
116
125
|
if (this._terrainUrl !== url) {
|
|
117
126
|
this._terrainUrl = url;
|
|
@@ -124,6 +133,7 @@ class CameraLimiter {
|
|
|
124
133
|
const terrainProvider = await getTerrainProviderForUrl(
|
|
125
134
|
this.terrainUrl as string,
|
|
126
135
|
{},
|
|
136
|
+
this.terrainRequestHeaders,
|
|
127
137
|
);
|
|
128
138
|
if (
|
|
129
139
|
this.level &&
|
|
@@ -140,6 +150,7 @@ class CameraLimiter {
|
|
|
140
150
|
const terrainProvider = await getTerrainProviderForUrl(
|
|
141
151
|
this.terrainUrl as string,
|
|
142
152
|
{},
|
|
153
|
+
this.terrainRequestHeaders,
|
|
143
154
|
);
|
|
144
155
|
return sampleTerrainMostDetailed(terrainProvider, [cameraCartographic]);
|
|
145
156
|
}
|
|
@@ -222,6 +233,14 @@ class CameraLimiter {
|
|
|
222
233
|
if (this.level !== defaultOptions.level) {
|
|
223
234
|
config.level = this.level;
|
|
224
235
|
}
|
|
236
|
+
if (
|
|
237
|
+
!deepEqual(
|
|
238
|
+
this.terrainRequestHeaders,
|
|
239
|
+
defaultOptions.terrainRequestHeaders,
|
|
240
|
+
)
|
|
241
|
+
) {
|
|
242
|
+
config.terrainRequestHeaders = this.terrainRequestHeaders;
|
|
243
|
+
}
|
|
225
244
|
return config;
|
|
226
245
|
}
|
|
227
246
|
}
|
package/src/map/cesiumMap.ts
CHANGED
|
@@ -36,10 +36,11 @@ import {
|
|
|
36
36
|
type EntityCluster,
|
|
37
37
|
type DataSource,
|
|
38
38
|
type Visualizer,
|
|
39
|
+
type ShadowMap,
|
|
39
40
|
} from '@vcmap-cesium/engine';
|
|
40
41
|
import type { Coordinate } from 'ol/coordinate.js';
|
|
41
42
|
|
|
42
|
-
import {
|
|
43
|
+
import { check, maybe } from '@vcsuite/check';
|
|
43
44
|
import { parseBoolean, parseInteger, parseNumber } from '@vcsuite/parsers';
|
|
44
45
|
import VcsMap, { type VcsMapOptions } from './vcsMap.js';
|
|
45
46
|
import Viewpoint from '../util/viewpoint.js';
|
|
@@ -55,6 +56,7 @@ import CameraLimiter, { CameraLimiterOptions } from './cameraLimiter.js';
|
|
|
55
56
|
import { mapClassRegistry } from '../classRegistry.js';
|
|
56
57
|
import type LayerCollection from '../util/layerCollection.js';
|
|
57
58
|
import type Layer from '../layer/layer.js';
|
|
59
|
+
import VcsEvent from '../vcsEvent.js';
|
|
58
60
|
|
|
59
61
|
export type CesiumMapOptions = VcsMapOptions & {
|
|
60
62
|
/**
|
|
@@ -327,6 +329,18 @@ class CesiumMap extends VcsMap<CesiumVisualisationType> {
|
|
|
327
329
|
|
|
328
330
|
defaultJDate: JulianDate;
|
|
329
331
|
|
|
332
|
+
/**
|
|
333
|
+
* The defaultShadowMap which is created when calling the constructor of the CesiumWidet in {@link initialize}. This is a reference, not a clone.
|
|
334
|
+
*/
|
|
335
|
+
private _defaultShadowMap: ShadowMap | null;
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* A cache of the shadowMap that is set, before {@link initialize} is called. It is applied as soon the instance is initialized.
|
|
339
|
+
*/
|
|
340
|
+
private _initialShadowMap: ShadowMap | null;
|
|
341
|
+
|
|
342
|
+
shadowMapChanged: VcsEvent<ShadowMap>;
|
|
343
|
+
|
|
330
344
|
webGLaa: boolean;
|
|
331
345
|
|
|
332
346
|
globeColor: Color;
|
|
@@ -383,6 +397,12 @@ class CesiumMap extends VcsMap<CesiumVisualisationType> {
|
|
|
383
397
|
|
|
384
398
|
this.defaultJDate = JulianDate.fromDate(new Date(2014, 6, 20, 13, 0, 0, 0));
|
|
385
399
|
|
|
400
|
+
this._defaultShadowMap = null;
|
|
401
|
+
|
|
402
|
+
this._initialShadowMap = null;
|
|
403
|
+
|
|
404
|
+
this.shadowMapChanged = new VcsEvent();
|
|
405
|
+
|
|
386
406
|
this.webGLaa = parseBoolean(options.webGLaa, defaultOptions.webGLaa);
|
|
387
407
|
|
|
388
408
|
this.useOriginalCesiumShader = parseBoolean(
|
|
@@ -459,7 +479,7 @@ class CesiumMap extends VcsMap<CesiumVisualisationType> {
|
|
|
459
479
|
}
|
|
460
480
|
|
|
461
481
|
set cameraLimiter(limiter: CameraLimiter | null) {
|
|
462
|
-
|
|
482
|
+
check(limiter, maybe(CameraLimiter));
|
|
463
483
|
|
|
464
484
|
if (this._cameraLimiter !== limiter) {
|
|
465
485
|
this._cameraLimiter = limiter;
|
|
@@ -732,6 +752,13 @@ class CesiumMap extends VcsMap<CesiumVisualisationType> {
|
|
|
732
752
|
},
|
|
733
753
|
),
|
|
734
754
|
);
|
|
755
|
+
|
|
756
|
+
this._defaultShadowMap = this._cesiumWidget.scene.shadowMap;
|
|
757
|
+
|
|
758
|
+
if (this._initialShadowMap) {
|
|
759
|
+
this.setShadowMap(this._initialShadowMap);
|
|
760
|
+
this._initialShadowMap = null;
|
|
761
|
+
}
|
|
735
762
|
}
|
|
736
763
|
return Promise.resolve();
|
|
737
764
|
}
|
|
@@ -1023,6 +1050,40 @@ class CesiumMap extends VcsMap<CesiumVisualisationType> {
|
|
|
1023
1050
|
}
|
|
1024
1051
|
}
|
|
1025
1052
|
|
|
1053
|
+
/**
|
|
1054
|
+
* Sets a shadow map on the scene of the cesiumMaps cesiumWidget. Raises an event if the shadow map changes. This function should be used to set the shadowMap instead of setting it directly on the scene.
|
|
1055
|
+
* @param shadowMap The shadowMap to assign to the scene of the cesium widget.
|
|
1056
|
+
*/
|
|
1057
|
+
setShadowMap(shadowMap: ShadowMap): void {
|
|
1058
|
+
if (!shadowMap) {
|
|
1059
|
+
return;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
if (!this._cesiumWidget) {
|
|
1063
|
+
this._initialShadowMap = shadowMap;
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
const { scene } = this._cesiumWidget;
|
|
1068
|
+
|
|
1069
|
+
if (scene.shadowMap !== shadowMap) {
|
|
1070
|
+
scene.shadowMap = shadowMap;
|
|
1071
|
+
this.shadowMapChanged.raiseEvent(shadowMap);
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
/**
|
|
1076
|
+
* Sets the default shadow map.
|
|
1077
|
+
*/
|
|
1078
|
+
setDefaultShadowMap(): void {
|
|
1079
|
+
if (!this._cesiumWidget || !this._defaultShadowMap) {
|
|
1080
|
+
this._initialShadowMap = null;
|
|
1081
|
+
return;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
this.setShadowMap(this._defaultShadowMap);
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1026
1087
|
/**
|
|
1027
1088
|
* returns the cesium Widget Object
|
|
1028
1089
|
*/
|
|
@@ -1380,6 +1441,10 @@ class CesiumMap extends VcsMap<CesiumVisualisationType> {
|
|
|
1380
1441
|
this._cesiumWidget = null;
|
|
1381
1442
|
}
|
|
1382
1443
|
|
|
1444
|
+
this._initialShadowMap = null;
|
|
1445
|
+
this._defaultShadowMap = null;
|
|
1446
|
+
this.shadowMapChanged.destroy();
|
|
1447
|
+
|
|
1383
1448
|
super.destroy();
|
|
1384
1449
|
}
|
|
1385
1450
|
}
|
package/src/map/vcsMap.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { MapEvent as OLMapEvent } from 'ol';
|
|
|
3
3
|
import type { Layer as OLLayer } from 'ol/layer.js';
|
|
4
4
|
import type { Coordinate } from 'ol/coordinate.js';
|
|
5
5
|
|
|
6
|
-
import { check,
|
|
6
|
+
import { check, maybe, oneOf } from '@vcsuite/check';
|
|
7
7
|
import VcsObject, { VcsObjectOptions } from '../vcsObject.js';
|
|
8
8
|
import LayerCollection from '../util/layerCollection.js';
|
|
9
9
|
import MapState from './mapState.js';
|
|
@@ -256,7 +256,7 @@ class VcsMap<
|
|
|
256
256
|
* Sets the map target.
|
|
257
257
|
*/
|
|
258
258
|
setTarget(target: string | HTMLElement | null): void {
|
|
259
|
-
|
|
259
|
+
check(target, maybe(oneOf(String, HTMLElement)));
|
|
260
260
|
|
|
261
261
|
if (this._target) {
|
|
262
262
|
this._target.removeChild(this.mapElement);
|
package/src/oblique/helpers.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint no-underscore-dangle: ["error", { "allow": ["_listeners", "_scopes", "_toRemove"] }] */
|
|
2
2
|
/* eslint-disable no-continue */
|
|
3
|
+
import { getLogger } from '@vcsuite/logger';
|
|
3
4
|
import {
|
|
4
5
|
boundingExtent,
|
|
5
6
|
getBottomLeft,
|
|
@@ -18,6 +19,7 @@ import Projection, {
|
|
|
18
19
|
wgs84Projection,
|
|
19
20
|
} from '../util/projection.js';
|
|
20
21
|
import type ObliqueImage from './obliqueImage.js';
|
|
22
|
+
import { isSameOrigin } from '../util/urlHelpers.js';
|
|
21
23
|
|
|
22
24
|
let scratchCartesian2A = new Cartesian2();
|
|
23
25
|
let scratchCartesian2B = new Cartesian2();
|
|
@@ -423,7 +425,7 @@ export type ImageTransformationOptions = {
|
|
|
423
425
|
* Always returns a Promise. When the input coordinates contain a height, it will use this height to compute the image coordinates
|
|
424
426
|
* When not, it will try to get the terrainHeight in case a terrain is defined and use the height from there, to compute the image coordinates
|
|
425
427
|
* @param image
|
|
426
|
-
* @param worldCoordinate if not in web
|
|
428
|
+
* @param worldCoordinate if not in web mercator, specify data-projection in options
|
|
427
429
|
* @param options
|
|
428
430
|
*/
|
|
429
431
|
export function transformToImage(
|
|
@@ -614,16 +616,6 @@ export async function transformFromImage(
|
|
|
614
616
|
}
|
|
615
617
|
|
|
616
618
|
export function hasSameOrigin(url: string): boolean {
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
if (parsedUrl.protocol === 'data:') {
|
|
621
|
-
return true;
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
return (
|
|
625
|
-
windowUrl.origin === parsedUrl.origin &&
|
|
626
|
-
windowUrl.port === parsedUrl.port &&
|
|
627
|
-
windowUrl.protocol === parsedUrl.protocol
|
|
628
|
-
);
|
|
619
|
+
getLogger('hasSameOrigin').deprecate('hasSameOrigin', 'isSameOrigin');
|
|
620
|
+
return isSameOrigin(url);
|
|
629
621
|
}
|
|
@@ -64,6 +64,7 @@ export type ObliqueVersion = {
|
|
|
64
64
|
|
|
65
65
|
export type ObliqueDataSetTerrainProviderOptions = TerrainProviderOptions & {
|
|
66
66
|
url: string;
|
|
67
|
+
headers?: Record<string, string>;
|
|
67
68
|
};
|
|
68
69
|
|
|
69
70
|
export type ObliqueCollectionOptions = VcsObjectOptions & {
|
|
@@ -280,6 +281,7 @@ class ObliqueCollection extends VcsObject {
|
|
|
280
281
|
dataSetOptions.url,
|
|
281
282
|
dataSetOptions.projection,
|
|
282
283
|
dataSetOptions.terrainProvider,
|
|
284
|
+
dataSetOptions.headers,
|
|
283
285
|
);
|
|
284
286
|
}
|
|
285
287
|
dataSet.imagesLoaded.addEventListener(({ images, tileCoordinate }) => {
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import VcsEvent from '../vcsEvent.js';
|
|
14
14
|
import { getTerrainProviderForUrl } from '../layer/terrainHelpers.js';
|
|
15
15
|
import Projection, { ProjectionOptions } from '../util/projection.js';
|
|
16
|
-
import { requestJson } from '../util/fetch.js';
|
|
16
|
+
import { getInitForUrl, requestJson } from '../util/fetch.js';
|
|
17
17
|
import type ObliqueImage from './obliqueImage.js';
|
|
18
18
|
import type {
|
|
19
19
|
ObliqueDataSetTerrainProviderOptions,
|
|
@@ -31,6 +31,7 @@ export type ObliqueDataSetOptions = {
|
|
|
31
31
|
url: string;
|
|
32
32
|
projection?: ProjectionOptions;
|
|
33
33
|
terrainProvider?: ObliqueDataSetTerrainProviderOptions;
|
|
34
|
+
headers?: Record<string, string>;
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
export enum DataState {
|
|
@@ -85,12 +86,15 @@ class ObliqueDataSet {
|
|
|
85
86
|
|
|
86
87
|
private _loadingPromise: Promise<void> | undefined = undefined;
|
|
87
88
|
|
|
89
|
+
private _headers?: Record<string, string>;
|
|
90
|
+
|
|
88
91
|
copyright: CopyrightOptions | undefined = undefined;
|
|
89
92
|
|
|
90
93
|
constructor(
|
|
91
94
|
url: string,
|
|
92
95
|
projection?: Projection | ProjectionOptions,
|
|
93
96
|
terrainProviderOptions?: ObliqueDataSetTerrainProviderOptions,
|
|
97
|
+
headers?: Record<string, string>,
|
|
94
98
|
) {
|
|
95
99
|
this.url = url;
|
|
96
100
|
if (!/\.json$/.test(this.url)) {
|
|
@@ -108,6 +112,8 @@ class ObliqueDataSet {
|
|
|
108
112
|
this._terrainProviderOptions = terrainProviderOptions
|
|
109
113
|
? { ...terrainProviderOptions }
|
|
110
114
|
: undefined;
|
|
115
|
+
|
|
116
|
+
this._headers = structuredClone(headers);
|
|
111
117
|
}
|
|
112
118
|
|
|
113
119
|
/**
|
|
@@ -131,7 +137,8 @@ class ObliqueDataSet {
|
|
|
131
137
|
async load(): Promise<void> {
|
|
132
138
|
if (!this._loadingPromise) {
|
|
133
139
|
this._state = DataState.LOADING;
|
|
134
|
-
|
|
140
|
+
const init = getInitForUrl(this.url, this._headers);
|
|
141
|
+
this._loadingPromise = requestJson<ObliqueImageJson>(this.url, init)
|
|
135
142
|
.then((data) => {
|
|
136
143
|
return this._initialize(data);
|
|
137
144
|
})
|
|
@@ -174,6 +181,7 @@ class ObliqueDataSet {
|
|
|
174
181
|
this._terrainProvider = await getTerrainProviderForUrl(
|
|
175
182
|
this._terrainProviderOptions.url,
|
|
176
183
|
terrainProviderOptions,
|
|
184
|
+
this._terrainProviderOptions.headers,
|
|
177
185
|
);
|
|
178
186
|
}
|
|
179
187
|
this._parseMetaData(json);
|
|
@@ -186,6 +194,7 @@ class ObliqueDataSet {
|
|
|
186
194
|
this.baseUrl,
|
|
187
195
|
this.projection,
|
|
188
196
|
this._terrainProvider,
|
|
197
|
+
this._headers,
|
|
189
198
|
);
|
|
190
199
|
const { version, buildNumber } = getVersionFromImageJson(json);
|
|
191
200
|
|
|
@@ -304,8 +313,10 @@ class ObliqueDataSet {
|
|
|
304
313
|
}
|
|
305
314
|
|
|
306
315
|
this._tiles.set(stringTileCoordinates, DataState.LOADING);
|
|
316
|
+
const init = getInitForUrl(this.url, this._headers);
|
|
307
317
|
const promise = requestJson<ObliqueImageJson>(
|
|
308
318
|
`${this.baseUrl}/${stringTileCoordinates}.json`,
|
|
319
|
+
init,
|
|
309
320
|
)
|
|
310
321
|
.then((data) => {
|
|
311
322
|
const images = parseImageData(data, this._imageMetas);
|
|
@@ -366,6 +377,9 @@ class ObliqueDataSet {
|
|
|
366
377
|
if (this._terrainProviderOptions) {
|
|
367
378
|
config.terrainProvider = { ...this._terrainProviderOptions };
|
|
368
379
|
}
|
|
380
|
+
if (this._headers) {
|
|
381
|
+
config.headers = this._headers;
|
|
382
|
+
}
|
|
369
383
|
return config;
|
|
370
384
|
}
|
|
371
385
|
}
|
|
@@ -17,6 +17,7 @@ export type ObliqueImageMetaOptions = {
|
|
|
17
17
|
terrainProvider?: CesiumTerrainProvider;
|
|
18
18
|
name: string;
|
|
19
19
|
format?: string;
|
|
20
|
+
headers?: Record<string, string>;
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
class ObliqueImageMeta {
|
|
@@ -64,6 +65,8 @@ class ObliqueImageMeta {
|
|
|
64
65
|
|
|
65
66
|
format: string;
|
|
66
67
|
|
|
68
|
+
headers?: Record<string, string>;
|
|
69
|
+
|
|
67
70
|
constructor(options: ObliqueImageMetaOptions) {
|
|
68
71
|
this.name = options.name;
|
|
69
72
|
this.principalPoint = options['principal-point'];
|
|
@@ -78,6 +81,7 @@ class ObliqueImageMeta {
|
|
|
78
81
|
this.url = options.url;
|
|
79
82
|
this.terrainProvider = options.terrainProvider;
|
|
80
83
|
this.format = options.format || 'jpg';
|
|
84
|
+
this.headers = options.headers;
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
+
import { TrustedServers } from '@vcmap-cesium/engine';
|
|
2
3
|
import type { ImageTile } from 'ol';
|
|
3
4
|
import type { Size } from 'ol/size.js';
|
|
4
5
|
import OLProjection from 'ol/proj/Projection.js';
|
|
@@ -8,8 +9,9 @@ import TileImage, {
|
|
|
8
9
|
type Options as TileImageOptions,
|
|
9
10
|
} from 'ol/source/TileImage.js';
|
|
10
11
|
import Tile from 'ol/layer/Tile.js';
|
|
11
|
-
import { hasSameOrigin } from './helpers.js';
|
|
12
12
|
import type ObliqueImageMeta from './obliqueImageMeta.js';
|
|
13
|
+
import { isSameOrigin } from '../util/urlHelpers.js';
|
|
14
|
+
import { getTileLoadFunction } from '../layer/openlayers/loadFunctionHelpers.js';
|
|
13
15
|
|
|
14
16
|
let defaultImage = '';
|
|
15
17
|
function getDefaultImage(): string {
|
|
@@ -61,6 +63,8 @@ class ObliqueView {
|
|
|
61
63
|
|
|
62
64
|
private _layer: Tile<TileImage> | undefined;
|
|
63
65
|
|
|
66
|
+
private _headers?: Record<string, string>;
|
|
67
|
+
|
|
64
68
|
constructor(imageMeta: ObliqueImageMeta, options: ObliqueViewOptions) {
|
|
65
69
|
this.size = imageMeta.size;
|
|
66
70
|
this.url = imageMeta.url;
|
|
@@ -69,6 +73,7 @@ class ObliqueView {
|
|
|
69
73
|
this.minZoom = options.minZoom;
|
|
70
74
|
this.maxZoom = options.maxZoom;
|
|
71
75
|
this.scaleFactor = options.scaleFactor;
|
|
76
|
+
this._headers = imageMeta.headers;
|
|
72
77
|
const { tileResolution } = imageMeta;
|
|
73
78
|
this.tileResolution = tileResolution.slice(
|
|
74
79
|
0,
|
|
@@ -106,9 +111,14 @@ class ObliqueView {
|
|
|
106
111
|
tileSize: this.tileSize,
|
|
107
112
|
}),
|
|
108
113
|
};
|
|
109
|
-
if (
|
|
114
|
+
if (TrustedServers.contains(this.url)) {
|
|
115
|
+
tileImageOptions.crossOrigin = 'use-credentials';
|
|
116
|
+
} else if (!isSameOrigin(this.url)) {
|
|
110
117
|
tileImageOptions.crossOrigin = 'anonymous';
|
|
111
118
|
}
|
|
119
|
+
if (this._headers) {
|
|
120
|
+
tileImageOptions.tileLoadFunction = getTileLoadFunction(this._headers);
|
|
121
|
+
}
|
|
112
122
|
|
|
113
123
|
this._tileImageSource = new TileImage(tileImageOptions);
|
|
114
124
|
|
|
@@ -47,16 +47,18 @@ export function getVersionFromImageJson(json: {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
|
-
* @param
|
|
51
|
-
* @param
|
|
52
|
-
* @param
|
|
53
|
-
* @param
|
|
50
|
+
* @param json
|
|
51
|
+
* @param url
|
|
52
|
+
* @param projection
|
|
53
|
+
* @param terrainProvider
|
|
54
|
+
* @param headers
|
|
54
55
|
*/
|
|
55
56
|
export function parseImageMeta(
|
|
56
57
|
json: ObliqueImageJson,
|
|
57
58
|
url: string,
|
|
58
59
|
projection?: Projection,
|
|
59
60
|
terrainProvider?: CesiumTerrainProvider,
|
|
61
|
+
headers?: Record<string, string>,
|
|
60
62
|
): ImageMeta[] {
|
|
61
63
|
let size: Size = [0, 0];
|
|
62
64
|
if (json.generalImageInfo.width && json.generalImageInfo.height) {
|
|
@@ -84,6 +86,7 @@ export function parseImageMeta(
|
|
|
84
86
|
projection: imageProjection,
|
|
85
87
|
url,
|
|
86
88
|
terrainProvider,
|
|
89
|
+
headers,
|
|
87
90
|
};
|
|
88
91
|
|
|
89
92
|
if (json.generalImageInfo.cameraParameter) {
|
package/src/ol/geojson.d.ts
CHANGED
|
@@ -11,8 +11,7 @@ declare module 'geojson' {
|
|
|
11
11
|
G extends Geometry | null = Geometry,
|
|
12
12
|
P = GeoJsonProperties,
|
|
13
13
|
> {
|
|
14
|
-
_id?: string
|
|
15
|
-
id?: string | number;
|
|
14
|
+
_id?: string;
|
|
16
15
|
radius?: G extends Point ? number : never;
|
|
17
16
|
vcsMeta?: VcsMeta;
|
|
18
17
|
state?: FeatureStoreLayerState;
|
package/src/ol/geom/circle.ts
CHANGED
|
@@ -26,7 +26,7 @@ Circle.prototype.setCoordinates = function setCoordinates(
|
|
|
26
26
|
coordinates: [Coordinate, Coordinate],
|
|
27
27
|
optLayout?: GeometryLayout,
|
|
28
28
|
): void {
|
|
29
|
-
check(coordinates, [[Number]]);
|
|
29
|
+
check(coordinates as [Coordinate, Coordinate], [[Number]]);
|
|
30
30
|
check(coordinates.length, 2);
|
|
31
31
|
|
|
32
32
|
const layout = optLayout || this.getLayout();
|