@vcmap/core 5.0.3 → 5.1.0-rc.2
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/geojson.d.ts +27 -0
- package/dist/index.d.ts +14 -4
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- 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 +17 -7
- 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 +3 -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 +18 -12
- 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/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();
|
|
@@ -4,12 +4,13 @@ import {
|
|
|
4
4
|
ConditionsExpression,
|
|
5
5
|
Expression,
|
|
6
6
|
Cesium3DTileStyle,
|
|
7
|
+
TrustedServers,
|
|
7
8
|
} from '@vcmap-cesium/engine';
|
|
8
9
|
import { is } from '@vcsuite/check';
|
|
9
10
|
|
|
10
11
|
import Style, { type StyleFunction } from 'ol/style/Style.js';
|
|
11
12
|
import Stroke from 'ol/style/Stroke.js';
|
|
12
|
-
import Icon from 'ol/style/Icon.js';
|
|
13
|
+
import Icon, { type Options as IconOptions } from 'ol/style/Icon.js';
|
|
13
14
|
import Circle, { type Options as CircleOptions } from 'ol/style/Circle.js';
|
|
14
15
|
import OLText from 'ol/style/Text.js';
|
|
15
16
|
import Fill from 'ol/style/Fill.js';
|
|
@@ -23,6 +24,7 @@ import {
|
|
|
23
24
|
} from './styleHelpers.js';
|
|
24
25
|
import { originalFeatureSymbol } from '../layer/vectorSymbols.js';
|
|
25
26
|
import { styleClassRegistry } from '../classRegistry.js';
|
|
27
|
+
import { isSameOrigin } from '../util/urlHelpers.js';
|
|
26
28
|
|
|
27
29
|
type DeclarativeStyleItemConditions = {
|
|
28
30
|
conditions: Array<string[] | string>;
|
|
@@ -300,7 +302,13 @@ class DeclarativeStyleItem extends StyleItem {
|
|
|
300
302
|
if (this.cesiumStyle.image) {
|
|
301
303
|
const src = this.cesiumStyle.image.evaluate(feature);
|
|
302
304
|
if (src) {
|
|
303
|
-
|
|
305
|
+
const iconOptions: IconOptions = { src };
|
|
306
|
+
if (TrustedServers.contains(src)) {
|
|
307
|
+
iconOptions.crossOrigin = 'use-credentials';
|
|
308
|
+
} else if (!isSameOrigin(src)) {
|
|
309
|
+
iconOptions.crossOrigin = 'anonymous';
|
|
310
|
+
}
|
|
311
|
+
style.setImage(new Icon(iconOptions));
|
|
304
312
|
}
|
|
305
313
|
} else {
|
|
306
314
|
const color =
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { is } from '@vcsuite/check';
|
|
1
|
+
import { is, oneOf } from '@vcsuite/check';
|
|
2
2
|
import StyleItem, { StyleItemOptions } from './styleItem.js';
|
|
3
3
|
import {
|
|
4
4
|
DeclarativeStyleItemOptions,
|
|
@@ -15,7 +15,7 @@ export function getStyleOrDefaultStyle(
|
|
|
15
15
|
| StyleItem,
|
|
16
16
|
defaultStyle?: StyleItem,
|
|
17
17
|
): StyleItem {
|
|
18
|
-
if (is(styleOptions,
|
|
18
|
+
if (is(styleOptions, oneOf(StyleItem, { type: String }))) {
|
|
19
19
|
if (styleOptions instanceof StyleItem) {
|
|
20
20
|
return styleOptions;
|
|
21
21
|
} else {
|
|
@@ -3,12 +3,12 @@ import Fill, { type Options as FillOptions } from 'ol/style/Fill.js';
|
|
|
3
3
|
import Stroke, { type Options as StrokeOptions } from 'ol/style/Stroke.js';
|
|
4
4
|
import OLText, { type Options as TextOptions } from 'ol/style/Text.js';
|
|
5
5
|
import Style from 'ol/style/Style.js';
|
|
6
|
-
import { Color } from '@vcmap-cesium/engine';
|
|
6
|
+
import { Color, TrustedServers } from '@vcmap-cesium/engine';
|
|
7
7
|
import type { Color as OLColor } from 'ol/color.js';
|
|
8
8
|
import type { Size } from 'ol/size.js';
|
|
9
9
|
import ImageStyle from 'ol/style/Image.js';
|
|
10
10
|
import Circle from 'ol/style/Circle.js';
|
|
11
|
-
import Icon from 'ol/style/Icon.js';
|
|
11
|
+
import Icon, { type Options as IconOptions } from 'ol/style/Icon.js';
|
|
12
12
|
import RegularShape from 'ol/style/RegularShape.js';
|
|
13
13
|
import { getLogger as getLoggerByName, type Logger } from '@vcsuite/logger';
|
|
14
14
|
import type {
|
|
@@ -17,6 +17,7 @@ import type {
|
|
|
17
17
|
VectorStyleItemOptions,
|
|
18
18
|
VectorStyleItemText,
|
|
19
19
|
} from './vectorStyleItem.js';
|
|
20
|
+
import { isSameOrigin } from '../util/urlHelpers.js';
|
|
20
21
|
|
|
21
22
|
function getLogger(): Logger {
|
|
22
23
|
return getLoggerByName('StyleHelpers');
|
|
@@ -535,13 +536,21 @@ export function getImageStyleFromOptions(
|
|
|
535
536
|
});
|
|
536
537
|
}
|
|
537
538
|
} else {
|
|
538
|
-
|
|
539
|
+
const iconOptions: IconOptions = {
|
|
539
540
|
src: options.src,
|
|
540
541
|
scale: options.scale,
|
|
541
542
|
opacity: options.opacity,
|
|
542
543
|
color: options.color,
|
|
543
544
|
anchor: options.anchor,
|
|
544
|
-
}
|
|
545
|
+
};
|
|
546
|
+
if (options.src) {
|
|
547
|
+
if (TrustedServers.contains(options.src)) {
|
|
548
|
+
iconOptions.crossOrigin = 'use-credentials';
|
|
549
|
+
} else if (!isSameOrigin(options.src)) {
|
|
550
|
+
iconOptions.crossOrigin = 'anonymous';
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
return new Icon(iconOptions);
|
|
545
554
|
}
|
|
546
555
|
}
|
|
547
556
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-template-curly-in-string,@typescript-eslint/ban-ts-comment */
|
|
2
2
|
import Stroke, { Options as StrokeOptions } from 'ol/style/Stroke.js';
|
|
3
|
-
import { Color, VerticalOrigin } from '@vcmap-cesium/engine';
|
|
3
|
+
import { Color, TrustedServers, VerticalOrigin } from '@vcmap-cesium/engine';
|
|
4
4
|
import Icon, { type Options as IconOptions } from 'ol/style/Icon.js';
|
|
5
5
|
import Style, { type StyleFunction } from 'ol/style/Style.js';
|
|
6
6
|
import OLText from 'ol/style/Text.js';
|
|
@@ -13,7 +13,7 @@ import { Color as OLColor } from 'ol/color.js';
|
|
|
13
13
|
import { ColorLike as OLColorLike } from 'ol/colorlike.js';
|
|
14
14
|
import type { Feature } from 'ol/index.js';
|
|
15
15
|
|
|
16
|
-
import { check,
|
|
16
|
+
import { check, maybe, oneOf, strict } from '@vcsuite/check';
|
|
17
17
|
import StyleItem, { StyleItemOptions } from './styleItem.js';
|
|
18
18
|
import {
|
|
19
19
|
parseColor,
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
} from './styleHelpers.js';
|
|
33
33
|
import { getShapeFromOptions } from './shapesCategory.js';
|
|
34
34
|
import { styleClassRegistry } from '../classRegistry.js';
|
|
35
|
+
import { isSameOrigin } from '../util/urlHelpers.js';
|
|
35
36
|
|
|
36
37
|
export type ColorType = OLColor | OLColorLike;
|
|
37
38
|
export type VectorStyleItemPattern = {
|
|
@@ -148,9 +149,19 @@ class VectorStyleItem extends StyleItem {
|
|
|
148
149
|
this._cesiumColor = new Color();
|
|
149
150
|
this._image = undefined;
|
|
150
151
|
if (options.image) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
if (options.image.radius) {
|
|
153
|
+
this._image = getShapeFromOptions({ ...options.image });
|
|
154
|
+
} else {
|
|
155
|
+
const iconOptions: IconOptions = { ...(options.image as IconOptions) };
|
|
156
|
+
if (iconOptions.src) {
|
|
157
|
+
if (TrustedServers.contains(iconOptions.src)) {
|
|
158
|
+
iconOptions.crossOrigin = 'use-credentials';
|
|
159
|
+
} else if (!isSameOrigin(iconOptions.src)) {
|
|
160
|
+
iconOptions.crossOrigin = 'anonymous';
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
this._image = new Icon(iconOptions);
|
|
164
|
+
}
|
|
154
165
|
}
|
|
155
166
|
|
|
156
167
|
this._style = new Style({
|
|
@@ -172,7 +183,7 @@ class VectorStyleItem extends StyleItem {
|
|
|
172
183
|
try {
|
|
173
184
|
option.color = parseColor(option.color as ColorType);
|
|
174
185
|
check(option.color, [Number]);
|
|
175
|
-
check(option.color.length,
|
|
186
|
+
check(option.color.length, oneOf(3, 4));
|
|
176
187
|
} catch (e) {
|
|
177
188
|
this.getLogger().error((e as Error).message);
|
|
178
189
|
option.color = [255, 255, 255, 0.4];
|
|
@@ -306,15 +317,16 @@ class VectorStyleItem extends StyleItem {
|
|
|
306
317
|
return;
|
|
307
318
|
}
|
|
308
319
|
if (patternOptions) {
|
|
309
|
-
|
|
320
|
+
check(
|
|
310
321
|
patternOptions,
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
322
|
+
maybe(
|
|
323
|
+
strict({
|
|
324
|
+
color: oneOf(String, [Number]),
|
|
325
|
+
width: Number,
|
|
326
|
+
type: Number,
|
|
327
|
+
size: maybe(Number),
|
|
328
|
+
}),
|
|
329
|
+
),
|
|
318
330
|
);
|
|
319
331
|
this._fillOptions.pattern = patternOptions;
|
|
320
332
|
} else {
|
|
@@ -330,7 +342,7 @@ class VectorStyleItem extends StyleItem {
|
|
|
330
342
|
set stroke(stroke: Stroke | undefined) {
|
|
331
343
|
this.exclude.stroke = false;
|
|
332
344
|
if (this._style instanceof Style) {
|
|
333
|
-
|
|
345
|
+
check(stroke, maybe(Stroke));
|
|
334
346
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
335
347
|
// @ts-ignore // bug in ol
|
|
336
348
|
this._style.setStroke(stroke);
|
|
@@ -346,7 +358,7 @@ class VectorStyleItem extends StyleItem {
|
|
|
346
358
|
}
|
|
347
359
|
|
|
348
360
|
set label(label: string | undefined) {
|
|
349
|
-
|
|
361
|
+
check(label, maybe(String));
|
|
350
362
|
if (!label) {
|
|
351
363
|
this._label = undefined;
|
|
352
364
|
} else {
|
|
@@ -363,7 +375,7 @@ class VectorStyleItem extends StyleItem {
|
|
|
363
375
|
|
|
364
376
|
set text(text: OLText | undefined) {
|
|
365
377
|
if (this._style instanceof Style) {
|
|
366
|
-
|
|
378
|
+
check(text, maybe(OLText));
|
|
367
379
|
this._text = text;
|
|
368
380
|
this._text?.setText?.(this._label);
|
|
369
381
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -381,7 +393,7 @@ class VectorStyleItem extends StyleItem {
|
|
|
381
393
|
set image(image: OLImage | undefined) {
|
|
382
394
|
this.exclude.image = false;
|
|
383
395
|
if (this._style instanceof Style) {
|
|
384
|
-
|
|
396
|
+
check(image, maybe(OLImage));
|
|
385
397
|
this._image = image;
|
|
386
398
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
387
399
|
// @ts-ignore // bug in ol
|
|
@@ -397,7 +409,7 @@ class VectorStyleItem extends StyleItem {
|
|
|
397
409
|
}
|
|
398
410
|
|
|
399
411
|
set style(style: Style | StyleFunction) {
|
|
400
|
-
|
|
412
|
+
check(style, maybe(oneOf(Style, Function)));
|
|
401
413
|
if (style instanceof Style) {
|
|
402
414
|
this._stroke = style.getStroke();
|
|
403
415
|
this._fill = style.getFill();
|
|
@@ -816,7 +828,7 @@ class VectorStyleItem extends StyleItem {
|
|
|
816
828
|
* @param section - one of fill, stroke, image
|
|
817
829
|
*/
|
|
818
830
|
unset(section: keyof VectorStyleItemExclusion): void {
|
|
819
|
-
check(section, Object.keys(this.exclude));
|
|
831
|
+
check(section, oneOf(...Object.keys(this.exclude)));
|
|
820
832
|
if (section === 'fill') {
|
|
821
833
|
this.fillColor = undefined;
|
|
822
834
|
} else {
|
|
@@ -18,7 +18,7 @@ import Feature from 'ol/Feature.js';
|
|
|
18
18
|
import LineString from 'ol/geom/LineString.js';
|
|
19
19
|
import { offset } from 'ol/sphere.js';
|
|
20
20
|
import Polygon from 'ol/geom/Polygon.js';
|
|
21
|
-
import { check,
|
|
21
|
+
import { check, maybe, optional } from '@vcsuite/check';
|
|
22
22
|
import Projection, {
|
|
23
23
|
mercatorProjection,
|
|
24
24
|
wgs84Projection,
|
|
@@ -159,7 +159,7 @@ export function createClippingPlaneCollection(
|
|
|
159
159
|
): ClippingPlaneCollection | null {
|
|
160
160
|
check(feature, Feature);
|
|
161
161
|
check(options, Object);
|
|
162
|
-
|
|
162
|
+
check(transformMatrix, optional(Matrix4));
|
|
163
163
|
|
|
164
164
|
const clippingPlanes = [];
|
|
165
165
|
const geometry = feature.getGeometry() as Geometry;
|
|
@@ -457,7 +457,7 @@ export function getClippingOptions(
|
|
|
457
457
|
feature?: Feature,
|
|
458
458
|
infinite = false,
|
|
459
459
|
): ClippingPlaneCreationOptions {
|
|
460
|
-
|
|
460
|
+
check(feature, maybe(Feature));
|
|
461
461
|
check(infinite, Boolean);
|
|
462
462
|
|
|
463
463
|
const vertical = feature
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { check } from '@vcsuite/check';
|
|
1
|
+
import { check, ofEnum } from '@vcsuite/check';
|
|
2
2
|
import { Feature } from 'ol';
|
|
3
3
|
import type { Geometry } from 'ol/geom.js';
|
|
4
4
|
import VcsEvent from '../../vcsEvent.js';
|
|
@@ -21,12 +21,13 @@ import geometryIsValid from './validateGeoemetry.js';
|
|
|
21
21
|
import ObliqueMap from '../../map/obliqueMap.js';
|
|
22
22
|
import { cursorMap } from './interactions/editGeometryMouseOverInteraction.js';
|
|
23
23
|
|
|
24
|
-
export type CreateFeatureSession<T extends GeometryType> =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
export type CreateFeatureSession<T extends GeometryType> =
|
|
25
|
+
EditorSession<SessionType.CREATE> & {
|
|
26
|
+
geometryType: T;
|
|
27
|
+
featureCreated: VcsEvent<Feature<GeometryToType<T>>>;
|
|
28
|
+
creationFinished: VcsEvent<Feature<GeometryToType<T>> | null>;
|
|
29
|
+
finish(): void;
|
|
30
|
+
};
|
|
30
31
|
|
|
31
32
|
type InteractionOfGeometryType<T extends GeometryType> =
|
|
32
33
|
T extends GeometryType.Point
|
|
@@ -94,7 +95,7 @@ function startCreateFeatureSession<T extends GeometryType>(
|
|
|
94
95
|
): CreateFeatureSession<T> {
|
|
95
96
|
check(app, VcsApp);
|
|
96
97
|
check(layer, VectorLayer);
|
|
97
|
-
check(geometryType,
|
|
98
|
+
check(geometryType, ofEnum(GeometryType));
|
|
98
99
|
|
|
99
100
|
const {
|
|
100
101
|
interactionChain,
|
|
@@ -77,7 +77,7 @@ function clearAllowPicking(
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
export type EditFeaturesSession = EditorSession & {
|
|
80
|
+
export type EditFeaturesSession = EditorSession<SessionType.EDIT_FEATURES> & {
|
|
81
81
|
readonly mode: TransformationMode;
|
|
82
82
|
/**
|
|
83
83
|
* Function for rotating features. Takes angle in radians as parameter.
|
|
@@ -31,7 +31,7 @@ import MapInteractionController from './interactions/mapInteractionController.js
|
|
|
31
31
|
import type VectorLayer from '../../layer/vectorLayer.js';
|
|
32
32
|
import type VcsApp from '../../vcsApp.js';
|
|
33
33
|
|
|
34
|
-
export type EditGeometrySession = EditorSession & {
|
|
34
|
+
export type EditGeometrySession = EditorSession<SessionType.EDIT_GEOMETRY> & {
|
|
35
35
|
setFeature(feature: Feature): void;
|
|
36
36
|
feature: Feature | null;
|
|
37
37
|
};
|
|
@@ -22,8 +22,8 @@ export enum SessionType {
|
|
|
22
22
|
* event handler.
|
|
23
23
|
* A stopped session will be destroyed and can no longer be used.
|
|
24
24
|
*/
|
|
25
|
-
export type EditorSession = {
|
|
26
|
-
type:
|
|
25
|
+
export type EditorSession<T extends SessionType = SessionType> = {
|
|
26
|
+
type: T;
|
|
27
27
|
stop(): void;
|
|
28
28
|
stopped: VcsEvent<void>;
|
|
29
29
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { check } from '@vcsuite/check';
|
|
1
|
+
import { check, ofEnum } from '@vcsuite/check';
|
|
2
2
|
import { Circle, Fill, Style, Stroke } from 'ol/style.js';
|
|
3
3
|
import type { Feature } from 'ol/index.js';
|
|
4
4
|
import { createSync } from '../../layer/vectorSymbols.js';
|
|
@@ -117,7 +117,7 @@ export function getDefaultHighlightStyle(): Style {
|
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
type SelectFeaturesSession = EditorSession & {
|
|
120
|
+
export type SelectFeaturesSession = EditorSession<SessionType.SELECT> & {
|
|
121
121
|
currentFeatures: Feature[];
|
|
122
122
|
firstFeature: Feature | null;
|
|
123
123
|
featuresChanged: VcsEvent<Feature[]>;
|
|
@@ -298,7 +298,7 @@ function startSelectFeaturesSession(
|
|
|
298
298
|
return currentSelectionMode;
|
|
299
299
|
},
|
|
300
300
|
setMode(newMode: SelectionMode): void {
|
|
301
|
-
check(newMode,
|
|
301
|
+
check(newMode, ofEnum(SelectionMode));
|
|
302
302
|
|
|
303
303
|
createSelectInteraction(newMode);
|
|
304
304
|
modeChanged.raiseEvent(currentSelectionMode);
|
|
@@ -33,10 +33,14 @@ export function getGeometryOptions(
|
|
|
33
33
|
coords: Coordinate[],
|
|
34
34
|
_geometry: LineString,
|
|
35
35
|
positionHeightAdjustment: number,
|
|
36
|
+
perPositionHeight: boolean,
|
|
37
|
+
groundLevelOrMinHeight: number,
|
|
36
38
|
): { positions: Cartesian3[]; arcType: ArcType } {
|
|
37
39
|
const positions = coords.map((coord) => {
|
|
38
40
|
const wgs84Coords = Projection.mercatorToWgs84(coord);
|
|
39
|
-
if (
|
|
41
|
+
if (!perPositionHeight && groundLevelOrMinHeight) {
|
|
42
|
+
wgs84Coords[2] = groundLevelOrMinHeight;
|
|
43
|
+
} else if (wgs84Coords[2] != null) {
|
|
40
44
|
wgs84Coords[2] += positionHeightAdjustment;
|
|
41
45
|
}
|
|
42
46
|
return Cartesian3.fromDegrees(
|