@vcmap/core 5.0.0-rc.0 → 5.0.0-rc.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/README.md +3 -2
- package/index.d.ts +7578 -0
- package/index.js +137 -131
- package/package.json +16 -23
- package/src/category/appBackedCategory.js +76 -0
- package/src/category/category.js +401 -0
- package/src/category/categoryCollection.js +145 -0
- package/src/cesium/cesium3DTileFeature.js +1 -1
- package/src/classRegistry.js +162 -0
- package/src/context.js +72 -0
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/abstractFeatureProvider.js +8 -9
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/featureProviderHelpers.js +4 -5
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/featureProviderSymbols.js +0 -0
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/tileProviderFeatureProvider.js +4 -2
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/wmsFeatureProvider.js +25 -18
- package/src/{vcs/vcm/interaction → interaction}/abstractInteraction.js +19 -18
- package/src/{vcs/vcm/interaction → interaction}/coordinateAtPixel.js +6 -9
- package/src/{vcs/vcm/interaction → interaction}/eventHandler.js +3 -3
- package/src/{vcs/vcm/interaction → interaction}/featureAtPixelInteraction.js +6 -19
- package/src/{vcs/vcm/interaction → interaction}/featureProviderInteraction.js +2 -13
- package/src/{vcs/vcm/interaction → interaction}/interactionChain.js +11 -32
- package/src/{vcs/vcm/interaction → interaction}/interactionType.js +1 -5
- package/src/{vcs/vcm/layer/cesium/cesiumTilesetCesium.js → layer/cesium/cesiumTilesetCesiumImpl.js} +8 -11
- package/src/{vcs/vcm/layer → layer}/cesium/clusterContext.js +0 -0
- package/src/{vcs/vcm/layer/cesium/dataSourceCesium.js → layer/cesium/dataSourceCesiumImpl.js} +5 -3
- package/src/{vcs/vcm/layer/cesium/openStreetMapCesium.js → layer/cesium/openStreetMapCesiumImpl.js} +6 -7
- package/src/{vcs/vcm/layer/cesium/rasterLayerCesium.js → layer/cesium/rasterLayerCesiumImpl.js} +5 -6
- package/src/{vcs/vcm/layer/cesium/singleImageCesium.js → layer/cesium/singleImageCesiumImpl.js} +5 -6
- package/src/{vcs/vcm/layer/cesium/terrainCesium.js → layer/cesium/terrainCesiumImpl.js} +4 -5
- package/src/{vcs/vcm/layer/cesium/tmsCesium.js → layer/cesium/tmsCesiumImpl.js} +6 -7
- package/src/{vcs/vcm/layer/cesium/vectorCesium.js → layer/cesium/vectorCesiumImpl.js} +3 -4
- package/src/{vcs/vcm/layer → layer}/cesium/vectorContext.js +0 -0
- package/src/{vcs/vcm/layer/cesium/vectorRasterTileCesium.js → layer/cesium/vectorRasterTileCesiumImpl.js} +5 -6
- package/src/{vcs/vcm/layer → layer}/cesium/vectorTileImageryProvider.js +1 -2
- package/src/{vcs/vcm/layer/cesium/wmsCesium.js → layer/cesium/wmsCesiumImpl.js} +6 -7
- package/src/{vcs/vcm/layer/cesium/wmtsCesium.js → layer/cesium/wmtsCesiumImpl.js} +6 -7
- package/src/{vcs/vcm/layer → layer}/cesium/x3dmHelper.js +0 -0
- package/src/{vcs/vcm/layer/cesiumTileset.js → layer/cesiumTilesetLayer.js} +38 -37
- package/src/{vcs/vcm/layer/czml.js → layer/czmlLayer.js} +14 -17
- package/src/{vcs/vcm/layer/dataSource.js → layer/dataSourceLayer.js} +13 -14
- package/src/{vcs/vcm/layer → layer}/featureLayer.js +17 -31
- package/src/{vcs/vcm/layer/featureStore.js → layer/featureStoreLayer.js} +53 -54
- package/src/{vcs/vcm/layer/featureStoreChanges.js → layer/featureStoreLayerChanges.js} +98 -82
- package/src/{vcs/vcm/layer/featureStoreState.js → layer/featureStoreLayerState.js} +1 -2
- package/src/{vcs/vcm/layer → layer}/featureVisibility.js +6 -6
- package/src/{vcs/vcm/layer → layer}/geojsonHelpers.js +15 -41
- package/src/{vcs/vcm/layer/geojson.js → layer/geojsonLayer.js} +19 -22
- package/src/{vcs/vcm/layer → layer}/globalHider.js +1 -12
- package/src/{vcs/vcm/layer → layer}/layer.js +11 -12
- package/src/{vcs/vcm/layer → layer}/layerImplementation.js +2 -3
- package/src/{vcs/vcm/layer → layer}/layerState.js +0 -1
- package/src/{vcs/vcm/layer → layer}/layerSymbols.js +0 -0
- package/src/{vcs/vcm/layer/oblique/layerOblique.js → layer/oblique/layerObliqueImpl.js} +4 -4
- package/src/{vcs/vcm/layer → layer}/oblique/obliqueHelpers.js +2 -2
- package/src/{vcs/vcm/layer/oblique/vectorOblique.js → layer/oblique/vectorObliqueImpl.js} +6 -7
- package/src/{vcs/vcm/layer/openStreetMap.js → layer/openStreetMapLayer.js} +32 -33
- package/src/{vcs/vcm/layer/openlayers/layerOpenlayers.js → layer/openlayers/layerOpenlayersImpl.js} +5 -6
- package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +26 -0
- package/src/{vcs/vcm/layer/openlayers/rasterLayerOpenlayers.js → layer/openlayers/rasterLayerOpenlayersImpl.js} +15 -14
- package/src/{vcs/vcm/layer/openlayers/singleImageOpenlayers.js → layer/openlayers/singleImageOpenlayersImpl.js} +6 -7
- package/src/{vcs/vcm/layer/openlayers/tileDebugOpenlayers.js → layer/openlayers/tileDebugOpenlayersImpl.js} +5 -6
- package/src/{vcs/vcm/layer/openlayers/tmsOpenlayers.js → layer/openlayers/tmsOpenlayersImpl.js} +7 -8
- package/src/{vcs/vcm/layer/openlayers/vectorOpenlayers.js → layer/openlayers/vectorOpenlayersImpl.js} +6 -7
- package/src/{vcs/vcm/layer/openlayers/vectorTileOpenlayers.js → layer/openlayers/vectorTileOpenlayersImpl.js} +6 -7
- package/src/{vcs/vcm/layer/openlayers/wmsOpenlayers.js → layer/openlayers/wmsOpenlayersImpl.js} +7 -8
- package/src/{vcs/vcm/layer/openlayers/wmtsOpenlayers.js → layer/openlayers/wmtsOpenlayersImpl.js} +7 -8
- package/src/{vcs/vcm/layer/pointCloud.js → layer/pointCloudLayer.js} +26 -34
- package/src/{vcs/vcm/layer → layer}/rasterLayer.js +18 -20
- package/src/{vcs/vcm/layer/singleImage.js → layer/singleImageLayer.js} +20 -20
- package/src/{vcs/vcm/layer → layer}/terrainHelpers.js +13 -49
- package/src/{vcs/vcm/layer/terrain.js → layer/terrainLayer.js} +13 -14
- package/src/{vcs/vcm/layer → layer}/tileLoadedHelper.js +5 -5
- package/src/{vcs/vcm/layer → layer}/tileProvider/mvtTileProvider.js +22 -5
- package/src/layer/tileProvider/staticGeojsonTileProvider.js +81 -0
- package/src/{vcs/vcm/layer → layer}/tileProvider/tileProvider.js +16 -8
- package/src/{vcs/vcm/layer → layer}/tileProvider/urlTemplateTileProvider.js +20 -6
- package/src/{vcs/vcm/layer/tms.js → layer/tmsLayer.js} +19 -20
- package/src/{vcs/vcm/layer → layer}/vectorHelpers.js +5 -5
- package/src/{vcs/vcm/layer/vector.js → layer/vectorLayer.js} +38 -48
- package/src/{vcs/vcm/layer → layer}/vectorProperties.js +3 -4
- package/src/{vcs/vcm/layer → layer}/vectorSymbols.js +0 -0
- package/src/{vcs/vcm/layer/vectorTile.js → layer/vectorTileLayer.js} +32 -42
- package/src/{vcs/vcm/layer/wfs.js → layer/wfsLayer.js} +19 -20
- package/src/{vcs/vcm/layer → layer}/wmsHelpers.js +1 -1
- package/src/{vcs/vcm/layer/wms.js → layer/wmsLayer.js} +22 -23
- package/src/{vcs/vcm/layer/wmts.js → layer/wmtsLayer.js} +20 -21
- package/src/{vcs/vcm/maps → map}/baseOLMap.js +5 -6
- package/src/{vcs/vcm/maps → map}/cameraLimiter.js +11 -17
- package/src/{vcs/vcm/maps/cesium.js → map/cesiumMap.js} +21 -34
- package/src/{vcs/vcm/maps → map}/mapState.js +0 -1
- package/src/{vcs/vcm/maps/oblique.js → map/obliqueMap.js} +42 -57
- package/src/{vcs/vcm/maps/openlayers.js → map/openlayersMap.js} +17 -15
- package/src/{vcs/vcm/maps/map.js → map/vcsMap.js} +41 -22
- package/src/oblique/defaultObliqueCollection.js +62 -0
- package/src/{vcs/vcm/oblique → oblique}/helpers.js +13 -44
- package/src/{vcs/vcm/oblique/ObliqueCollection.js → oblique/obliqueCollection.js} +117 -37
- package/src/{vcs/vcm/oblique/ObliqueDataSet.js → oblique/obliqueDataSet.js} +67 -26
- package/src/{vcs/vcm/oblique/ObliqueImage.js → oblique/obliqueImage.js} +1 -2
- package/src/{vcs/vcm/oblique/ObliqueImageMeta.js → oblique/obliqueImageMeta.js} +4 -5
- package/src/{vcs/vcm/oblique/ObliqueProvider.js → oblique/obliqueProvider.js} +17 -12
- package/src/{vcs/vcm/oblique/ObliqueView.js → oblique/obliqueView.js} +31 -2
- package/src/{vcs/vcm/oblique/ObliqueViewDirection.js → oblique/obliqueViewDirection.js} +0 -3
- package/src/{vcs/vcm/oblique → oblique}/parseImageJson.js +20 -12
- package/src/ol/geom/circle.js +1 -1
- package/src/ol/render/canvas/canvasTileRenderer.js +0 -1
- package/src/overrideClassRegistry.js +204 -0
- package/src/{vcs/vcm/util/style → style}/declarativeStyleItem.js +43 -20
- package/src/{vcs/vcm/util/style → style}/shapesCategory.js +0 -2
- package/src/style/styleFactory.js +29 -0
- package/src/{vcs/vcm/util/style → style}/styleHelpers.js +3 -14
- package/src/{vcs/vcm/util/style → style}/styleItem.js +23 -86
- package/src/{vcs/vcm/util/style → style}/vectorStyleItem.js +73 -85
- package/src/{vcs/vcm/util/style → style}/writeStyle.js +4 -7
- package/src/{vcs/vcm/util → util}/clipping/clippingObject.js +10 -12
- package/src/{vcs/vcm/util → util}/clipping/clippingObjectManager.js +2 -3
- package/src/{vcs/vcm/util → util}/clipping/clippingPlaneHelper.js +4 -8
- package/src/{vcs/vcm/util → util}/collection.js +16 -4
- package/src/{vcs/vcm/util → util}/dateTime.js +0 -0
- package/src/{vcs/vcm/util → util}/exclusiveManager.js +0 -0
- package/src/{vcs/vcm/util → util}/extent.js +18 -12
- package/src/{vcs/vcm/util → util}/featureconverter/circleToCesium.js +0 -0
- package/src/{vcs/vcm/util → util}/featureconverter/convert.js +0 -0
- package/src/util/featureconverter/extent3D.js +181 -0
- package/src/{vcs/vcm/util → util}/featureconverter/featureconverterHelper.js +1 -1
- package/src/{vcs/vcm/util → util}/featureconverter/lineStringToCesium.js +0 -0
- package/src/{vcs/vcm/util → util}/featureconverter/pointToCesium.js +3 -3
- package/src/{vcs/vcm/util → util}/featureconverter/polygonToCesium.js +1 -1
- package/src/util/fetch.js +32 -0
- package/src/{vcs/vcm/util → util}/geometryHelpers.js +0 -0
- package/src/{vcs/vcm/util → util}/indexedCollection.js +24 -2
- package/src/{vcs/vcm/util → util}/isMobile.js +0 -0
- package/src/{vcs/vcm/util → util}/layerCollection.js +16 -12
- package/src/{vcs/vcm/util → util}/locale.js +1 -1
- package/src/{vcs/vcm/util → util}/mapCollection.js +91 -34
- package/src/{vcs/vcm/util → util}/math.js +0 -0
- package/src/util/overrideCollection.js +223 -0
- package/src/{vcs/vcm/util → util}/projection.js +39 -29
- package/src/{vcs/vcm/util → util}/splitScreen.js +10 -10
- package/src/{vcs/vcm/util → util}/urlHelpers.js +0 -0
- package/src/{vcs/vcm/util → util}/viewpoint.js +5 -9
- package/src/vcsApp.js +471 -0
- package/src/vcsAppContextHelpers.js +121 -0
- package/src/{vcs/vcm/event/vcsEvent.js → vcsEvent.js} +2 -3
- package/src/{vcs/vcm/object.js → vcsObject.js} +2 -10
- package/tests/data/buildings/tileset.json +428 -0
- package/tests/data/dynamicPointCzml.json +64 -0
- package/tests/data/oblique/imageData/imagev34.json +352 -0
- package/tests/data/oblique/imageData/imagev35.json +54 -0
- package/tests/data/oblique/imageData/imagev35PerImageSize.json +53 -0
- package/tests/data/oblique/tiledImageData/12/2199/1342.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2199/1343.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2199/1344.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2200/1342.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2200/1343.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2200/1344.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2201/1342.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2201/1343.json +1 -0
- package/tests/data/oblique/tiledImageData/12/2201/1344.json +1 -0
- package/tests/data/oblique/tiledImageData/image.json +1 -0
- package/tests/data/terrain/13/8800/6485.terrain +0 -0
- package/tests/data/terrain/13/8800/6486.terrain +0 -0
- package/tests/data/terrain/13/8801/6485.terrain +0 -0
- package/tests/data/terrain/13/8801/6486.terrain +0 -0
- package/tests/data/terrain/layer.json +136 -0
- package/tests/data/testGeoJSON.json +161 -0
- package/tests/data/tile.pbf +0 -0
- package/tests/unit/helpers/cesiumHelpers.js +272 -0
- package/tests/unit/helpers/getFileNameFromUrl.js +12 -0
- package/tests/unit/helpers/helpers.js +11 -0
- package/tests/unit/helpers/imageHelpers.js +20 -0
- package/tests/unit/helpers/importJSON.js +15 -0
- package/tests/unit/helpers/obliqueData.js +76 -0
- package/tests/unit/helpers/obliqueHelpers.js +112 -0
- package/tests/unit/helpers/openlayersHelpers.js +22 -0
- package/tests/unit/helpers/terrain/terrainData.js +46 -0
- package/src/vcs/vcm/classRegistry.js +0 -106
- package/src/vcs/vcm/globalCollections.js +0 -11
- package/src/vcs/vcm/layer/buildings.js +0 -17
- package/src/vcs/vcm/layer/cesium/pointCloudCesium.js +0 -58
- package/src/vcs/vcm/layer/openlayers/openStreetMapOpenlayers.js +0 -27
- package/src/vcs/vcm/layer/tileProvider/staticGeojsonTileProvider.js +0 -67
- package/src/vcs/vcm/layer/tileProvider/tileProviderFactory.js +0 -28
- package/src/vcs/vcm/util/featureconverter/extent3d.js +0 -154
- package/src/vcs/vcm/util/style/styleFactory.js +0 -48
package/src/context.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { v4 as uuidv4, v5 as uuidv5 } from 'uuid';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {Object} VcsAppConfig
|
|
5
|
+
* @property {string|undefined} [id]
|
|
6
|
+
* @property {Array<LayerOptions>} [layers]
|
|
7
|
+
* @property {Array<VcsMapOptions>} [maps]
|
|
8
|
+
* @property {Array<StyleItemOptions>} [styles]
|
|
9
|
+
* @property {Array<ViewPointOptions>} [viewpoints]
|
|
10
|
+
* @property {string} [startingViewPointName]
|
|
11
|
+
* @property {string} [startingMapName]
|
|
12
|
+
* @property {ProjectionOptions} [projection]
|
|
13
|
+
* @property {Array<{ name: string, items: Array<Object> }>} [categories]
|
|
14
|
+
* @property {Array<ObliqueCollectionOptions>} [obliqueCollections]
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @type {string}
|
|
19
|
+
*/
|
|
20
|
+
const uuidNamespace = uuidv4();
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @class
|
|
24
|
+
*/
|
|
25
|
+
class Context {
|
|
26
|
+
/**
|
|
27
|
+
* @param {VcsAppConfig} config
|
|
28
|
+
*/
|
|
29
|
+
constructor(config) {
|
|
30
|
+
/**
|
|
31
|
+
* @type {VcsAppConfig}
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
this._config = config;
|
|
35
|
+
/**
|
|
36
|
+
* @type {string}
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
39
|
+
this._checkSum = uuidv5(JSON.stringify(config), uuidNamespace);
|
|
40
|
+
/**
|
|
41
|
+
* @type {string}
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
this._id = config.id || this._checkSum;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @type {string}
|
|
49
|
+
* @readonly
|
|
50
|
+
*/
|
|
51
|
+
get id() {
|
|
52
|
+
return this._id;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @type {string}
|
|
57
|
+
* @readonly
|
|
58
|
+
*/
|
|
59
|
+
get checkSum() {
|
|
60
|
+
return this._checkSum;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @type {VcsAppConfig}
|
|
65
|
+
* @readonly
|
|
66
|
+
*/
|
|
67
|
+
get config() {
|
|
68
|
+
return JSON.parse(JSON.stringify(this._config));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export default Context;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { v4 as uuidv4 } from 'uuid';
|
|
2
2
|
import { parseBoolean } from '@vcsuite/parsers';
|
|
3
|
-
import { vcsLayerName } from '
|
|
4
|
-
import VcsObject from '
|
|
3
|
+
import { vcsLayerName } from '../layer/layerSymbols.js';
|
|
4
|
+
import VcsObject from '../vcsObject.js';
|
|
5
5
|
import { getStyleOrDefaultStyle } from '../style/styleFactory.js';
|
|
6
6
|
import { defaultVectorStyle } from '../style/vectorStyleItem.js';
|
|
7
|
-
import VectorProperties from '
|
|
7
|
+
import VectorProperties from '../layer/vectorProperties.js';
|
|
8
8
|
import { isProvidedFeature, showProvidedFeature } from './featureProviderSymbols.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -22,14 +22,13 @@ import { isProvidedFeature, showProvidedFeature } from './featureProviderSymbols
|
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* An abstract class providing features for {@link Layer}s which cannot provide features directly, but can provide features for
|
|
25
|
-
* a given location, e.g.
|
|
25
|
+
* a given location, e.g. WmsLayer with a getFeatureInfo configuration. In this case, a feature provider can be created for this layer.
|
|
26
26
|
* @class
|
|
27
|
-
* @export
|
|
28
27
|
* @abstract
|
|
29
28
|
* @api
|
|
30
29
|
*/
|
|
31
30
|
class AbstractFeatureProvider extends VcsObject {
|
|
32
|
-
static get className() { return '
|
|
31
|
+
static get className() { return 'AbstractFeatureProvider'; }
|
|
33
32
|
|
|
34
33
|
/**
|
|
35
34
|
* @returns {AbstractFeatureProviderOptions}
|
|
@@ -154,9 +153,9 @@ class AbstractFeatureProvider extends VcsObject {
|
|
|
154
153
|
* @returns {AbstractFeatureProviderOptions}
|
|
155
154
|
* @api
|
|
156
155
|
*/
|
|
157
|
-
|
|
156
|
+
toJSON() {
|
|
158
157
|
const config =
|
|
159
|
-
/** @type {AbstractFeatureProviderOptions} */ (super.
|
|
158
|
+
/** @type {AbstractFeatureProviderOptions} */ (super.toJSON());
|
|
160
159
|
|
|
161
160
|
const defaultOptions = AbstractFeatureProvider.getDefaultOptions();
|
|
162
161
|
delete config.name; // the name is irrelevant, since its the layers name
|
|
@@ -170,7 +169,7 @@ class AbstractFeatureProvider extends VcsObject {
|
|
|
170
169
|
}
|
|
171
170
|
|
|
172
171
|
if (this.style) {
|
|
173
|
-
config.style = this.style.
|
|
172
|
+
config.style = this.style.toJSON();
|
|
174
173
|
}
|
|
175
174
|
|
|
176
175
|
const vectorPropertiesConfig = this.vectorProperties
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getCenter } from 'ol/extent.js';
|
|
2
|
-
import Projection from '../projection.js';
|
|
3
|
-
import
|
|
2
|
+
import Projection from '../util/projection.js';
|
|
3
|
+
import Extent3D from '../util/featureconverter/extent3D.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @param {VectorClickedObject} feature
|
|
@@ -32,9 +32,8 @@ export function getGenericFeatureFromProvidedFeature(feature, layer) {
|
|
|
32
32
|
|
|
33
33
|
let heightOffset = clickedPosition.height;
|
|
34
34
|
if (!isModel) {
|
|
35
|
-
const extent =
|
|
36
|
-
|
|
37
|
-
heightOffset = max;
|
|
35
|
+
const extent = Extent3D.fromGeometry(geometry);
|
|
36
|
+
heightOffset = Number.isFinite(extent.maxZ) ? extent.maxZ : 0;
|
|
38
37
|
}
|
|
39
38
|
const relativeToGround = !isModel && feature.get('olcs_altitudeMode') === 'relativeToGround';
|
|
40
39
|
|
|
File without changes
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import AbstractFeatureProvider from './abstractFeatureProvider.js';
|
|
2
|
+
import { featureProviderClassRegistry } from '../classRegistry.js';
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -12,7 +13,7 @@ import AbstractFeatureProvider from './abstractFeatureProvider.js';
|
|
|
12
13
|
* @extends {AbstractFeatureProvider}
|
|
13
14
|
*/
|
|
14
15
|
class TileProviderFeatureProvider extends AbstractFeatureProvider {
|
|
15
|
-
static get className() { return '
|
|
16
|
+
static get className() { return 'TileProviderFeatureProvider'; }
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* @param {string} layerName
|
|
@@ -26,7 +27,7 @@ class TileProviderFeatureProvider extends AbstractFeatureProvider {
|
|
|
26
27
|
* @type {Array<string>}
|
|
27
28
|
* @api
|
|
28
29
|
*/
|
|
29
|
-
this.mapTypes = ['
|
|
30
|
+
this.mapTypes = ['CesiumMap'];
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* TileProvider
|
|
@@ -60,3 +61,4 @@ class TileProviderFeatureProvider extends AbstractFeatureProvider {
|
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
export default TileProviderFeatureProvider;
|
|
64
|
+
featureProviderClassRegistry.registerClass(TileProviderFeatureProvider.className, TileProviderFeatureProvider);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
1
|
import GML2 from 'ol/format/GML2.js';
|
|
3
2
|
import WFS from 'ol/format/WFS.js';
|
|
4
3
|
import GeoJSON from 'ol/format/GeoJSON.js';
|
|
@@ -7,14 +6,16 @@ import Point from 'ol/geom/Point.js';
|
|
|
7
6
|
import { getTransform } from 'ol/proj.js';
|
|
8
7
|
import { parseInteger } from '@vcsuite/parsers';
|
|
9
8
|
import AbstractFeatureProvider from './abstractFeatureProvider.js';
|
|
10
|
-
import Projection, { mercatorProjection } from '../projection.js';
|
|
11
|
-
import { getWMSSource } from '
|
|
12
|
-
import Extent from '../extent.js';
|
|
9
|
+
import Projection, { mercatorProjection } from '../util/projection.js';
|
|
10
|
+
import { getWMSSource } from '../layer/wmsHelpers.js';
|
|
11
|
+
import Extent from '../util/extent.js';
|
|
12
|
+
import { requestJson } from '../util/fetch.js';
|
|
13
|
+
import { featureProviderClassRegistry } from '../classRegistry.js';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* @typedef {AbstractFeatureProviderOptions} WMSFeatureProviderOptions
|
|
16
17
|
* @property {string|undefined} [responseType='text/xml'] - the response type for the feature info
|
|
17
|
-
* @property {Object|undefined} formatOptions - format options for the
|
|
18
|
+
* @property {Object|undefined} formatOptions - format options for the GeojsonLayer, WfsLayer or GML format. To overwrite the gmlFormat option in WfsLayer format, use 'GML', 'GML2' or 'GML3' as string
|
|
18
19
|
* @property {ProjectionOptions|undefined} projection - the projection of the data, if not encoded in the response
|
|
19
20
|
* @property {string} url
|
|
20
21
|
* @property {string} [tilingSchema='geographic'] - either "geographic" or "mercator"
|
|
@@ -67,11 +68,10 @@ export function getFormat(responseType, options = {}) {
|
|
|
67
68
|
|
|
68
69
|
/**
|
|
69
70
|
* @class
|
|
70
|
-
* @export
|
|
71
71
|
* @extends {AbstractFeatureProvider}
|
|
72
72
|
*/
|
|
73
73
|
class WMSFeatureProvider extends AbstractFeatureProvider {
|
|
74
|
-
static get className() { return '
|
|
74
|
+
static get className() { return 'WMSFeatureProvider'; }
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* @returns {WMSFeatureProviderOptions}
|
|
@@ -124,7 +124,7 @@ class WMSFeatureProvider extends AbstractFeatureProvider {
|
|
|
124
124
|
version: options.version || defaultOptions.version,
|
|
125
125
|
};
|
|
126
126
|
/**
|
|
127
|
-
* The
|
|
127
|
+
* The WmsLayer Source used to generate getFeatureInfo urls
|
|
128
128
|
* @type {import("ol/source/TileWMS").default}
|
|
129
129
|
* @api
|
|
130
130
|
*/
|
|
@@ -155,12 +155,11 @@ class WMSFeatureProvider extends AbstractFeatureProvider {
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
|
-
* @param {import("
|
|
158
|
+
* @param {import("ol/format/GeoJSON").GeoJSONObject} data
|
|
159
159
|
* @param {import("ol/coordinate").Coordinate} coordinate
|
|
160
160
|
* @returns {Array<import("ol").Feature<import("ol/geom/Geometry").default>>}
|
|
161
161
|
*/
|
|
162
|
-
featureResponseCallback(
|
|
163
|
-
const { data } = response;
|
|
162
|
+
featureResponseCallback(data, coordinate) {
|
|
164
163
|
/** @type {Array<import("ol").Feature<import("ol/geom/Geometry").default>>} */
|
|
165
164
|
let features;
|
|
166
165
|
|
|
@@ -199,7 +198,8 @@ class WMSFeatureProvider extends AbstractFeatureProvider {
|
|
|
199
198
|
let coords = coordinate;
|
|
200
199
|
if (projection) {
|
|
201
200
|
const transform = getTransform(mercatorProjection.proj, projection);
|
|
202
|
-
|
|
201
|
+
// error in TransformFunction type definition, remove undefined after openlayer fixed the type
|
|
202
|
+
coords = transform(coordinate.slice(), undefined, undefined);
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
const metersPerUnit = 111194.87428468118;
|
|
@@ -211,8 +211,14 @@ class WMSFeatureProvider extends AbstractFeatureProvider {
|
|
|
211
211
|
);
|
|
212
212
|
|
|
213
213
|
if (url) {
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
let data;
|
|
215
|
+
try {
|
|
216
|
+
data = await requestJson(url);
|
|
217
|
+
} catch (ex) {
|
|
218
|
+
this.getLogger().error(`Failed fetching WMS FeatureInfo ${url}`);
|
|
219
|
+
return [];
|
|
220
|
+
}
|
|
221
|
+
return this.featureResponseCallback(data, coordinate)
|
|
216
222
|
.map(f => this.getProviderFeature(f));
|
|
217
223
|
}
|
|
218
224
|
return [];
|
|
@@ -222,8 +228,8 @@ class WMSFeatureProvider extends AbstractFeatureProvider {
|
|
|
222
228
|
* @inheritDoc
|
|
223
229
|
* @returns {WMSFeatureProviderOptions}
|
|
224
230
|
*/
|
|
225
|
-
|
|
226
|
-
const config = /** @type {WMSFeatureProviderOptions} */ (super.
|
|
231
|
+
toJSON() {
|
|
232
|
+
const config = /** @type {WMSFeatureProviderOptions} */ (super.toJSON());
|
|
227
233
|
const defaultOptions = WMSFeatureProvider.getDefaultOptions();
|
|
228
234
|
if (this.featureInfoResponseType !== defaultOptions.responseType) {
|
|
229
235
|
config.responseType = this.featureInfoResponseType;
|
|
@@ -234,7 +240,7 @@ class WMSFeatureProvider extends AbstractFeatureProvider {
|
|
|
234
240
|
}
|
|
235
241
|
|
|
236
242
|
if (this.projection !== defaultOptions.projection) {
|
|
237
|
-
config.projection = this.projection.
|
|
243
|
+
config.projection = this.projection.toJSON();
|
|
238
244
|
}
|
|
239
245
|
|
|
240
246
|
config.url = this._wmsSourceOptions.url;
|
|
@@ -259,7 +265,7 @@ class WMSFeatureProvider extends AbstractFeatureProvider {
|
|
|
259
265
|
config.tileSize = this._wmsSourceOptions.tileSize.slice();
|
|
260
266
|
}
|
|
261
267
|
if (this.extent) {
|
|
262
|
-
config.extent = this.extent.
|
|
268
|
+
config.extent = this.extent.toJSON();
|
|
263
269
|
}
|
|
264
270
|
|
|
265
271
|
return config;
|
|
@@ -278,3 +284,4 @@ class WMSFeatureProvider extends AbstractFeatureProvider {
|
|
|
278
284
|
}
|
|
279
285
|
|
|
280
286
|
export default WMSFeatureProvider;
|
|
287
|
+
featureProviderClassRegistry.registerClass(WMSFeatureProvider.className, WMSFeatureProvider);
|
|
@@ -22,12 +22,20 @@ import { EventType, ModificationKeyType, PointerKeyType } from './interactionTyp
|
|
|
22
22
|
/**
|
|
23
23
|
* An abstract interface for all interactions
|
|
24
24
|
* @class
|
|
25
|
-
* @export
|
|
26
25
|
* @abstract
|
|
27
26
|
* @api
|
|
28
27
|
*/
|
|
29
28
|
class AbstractInteraction {
|
|
30
|
-
|
|
29
|
+
/**
|
|
30
|
+
* @param {number} [defaultActive=EventType.NONE] - A bitmask representing the default {@link EventType} to listen to
|
|
31
|
+
* @param {number} [defaultModificationKey=ModificationKeyType.NONE] - A bitmask representing the default {@link ModificationKeyType} keys to listen to
|
|
32
|
+
* @param {number} [defaultPointerKey=PointerKeyType.LEFT] - A bitmask representing the {@link PointerKeyType} pointer key to listen to
|
|
33
|
+
*/
|
|
34
|
+
constructor(
|
|
35
|
+
defaultActive = EventType.NONE,
|
|
36
|
+
defaultModificationKey = ModificationKeyType.NONE,
|
|
37
|
+
defaultPointerKey = PointerKeyType.LEFT,
|
|
38
|
+
) {
|
|
31
39
|
/**
|
|
32
40
|
* A unique identifier for this interaction
|
|
33
41
|
* @type {string}
|
|
@@ -36,13 +44,10 @@ class AbstractInteraction {
|
|
|
36
44
|
this.id = uuidv4();
|
|
37
45
|
|
|
38
46
|
/**
|
|
39
|
-
* A bitmask representing the default events to listen to
|
|
40
|
-
* {@link EventType}, default is NONE
|
|
41
47
|
* @type {number}
|
|
42
|
-
* @
|
|
43
|
-
* @api
|
|
48
|
+
* @private
|
|
44
49
|
*/
|
|
45
|
-
this._defaultActive =
|
|
50
|
+
this._defaultActive = defaultActive;
|
|
46
51
|
|
|
47
52
|
/**
|
|
48
53
|
* The current active bitmask for {@link EventType}
|
|
@@ -52,13 +57,10 @@ class AbstractInteraction {
|
|
|
52
57
|
this.active = this._defaultActive;
|
|
53
58
|
|
|
54
59
|
/**
|
|
55
|
-
* The default bitmask for modification keys to listen to,
|
|
56
|
-
* {@link ModificationKeyType} default is NONE
|
|
57
60
|
* @type {number}
|
|
58
|
-
* @
|
|
59
|
-
* @api
|
|
61
|
+
* @private
|
|
60
62
|
*/
|
|
61
|
-
this._defaultModificationKey =
|
|
63
|
+
this._defaultModificationKey = defaultModificationKey;
|
|
62
64
|
|
|
63
65
|
/**
|
|
64
66
|
* The current active {@link ModificationKeyType}
|
|
@@ -68,11 +70,10 @@ class AbstractInteraction {
|
|
|
68
70
|
this.modificationKey = this._defaultModificationKey;
|
|
69
71
|
|
|
70
72
|
/**
|
|
71
|
-
* default bitmask for pointer key {@link PointerKeyType}, starting value is LEFT
|
|
72
73
|
* @type {number}
|
|
73
|
-
* @
|
|
74
|
+
* @private
|
|
74
75
|
*/
|
|
75
|
-
this._defaultPointerKey =
|
|
76
|
+
this._defaultPointerKey = defaultPointerKey;
|
|
76
77
|
|
|
77
78
|
/**
|
|
78
79
|
* The currently active {@link PointerKeyType}
|
|
@@ -114,7 +115,7 @@ class AbstractInteraction {
|
|
|
114
115
|
}
|
|
115
116
|
|
|
116
117
|
/**
|
|
117
|
-
* Sets the modification key to listen to
|
|
118
|
+
* Sets the modification key to listen to or the default modification key if none is provided.
|
|
118
119
|
* @param {number=} mod
|
|
119
120
|
* @api
|
|
120
121
|
*/
|
|
@@ -127,8 +128,8 @@ class AbstractInteraction {
|
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
/**
|
|
130
|
-
* Sets the pointer key for this interaction
|
|
131
|
-
* @param {number} pointer
|
|
131
|
+
* Sets the pointer key for this interaction or the default pointer if none is provided.
|
|
132
|
+
* @param {number=} pointer
|
|
132
133
|
* @api
|
|
133
134
|
*/
|
|
134
135
|
setPointer(pointer) {
|
|
@@ -10,7 +10,7 @@ import { transformFromImage } from '../oblique/helpers.js';
|
|
|
10
10
|
*/
|
|
11
11
|
class CoordinateAtPixel extends AbstractInteraction {
|
|
12
12
|
constructor() {
|
|
13
|
-
super();
|
|
13
|
+
super(EventType.ALL, ModificationKeyType.ALL);
|
|
14
14
|
/**
|
|
15
15
|
* @type {import("@vcmap/cesium").Cartographic}
|
|
16
16
|
* @private
|
|
@@ -22,9 +22,6 @@ class CoordinateAtPixel extends AbstractInteraction {
|
|
|
22
22
|
*/
|
|
23
23
|
this._scratchCartesian = new Cartesian3();
|
|
24
24
|
|
|
25
|
-
this._defaultActive = EventType.ALL;
|
|
26
|
-
this._defaultModificationKey = ModificationKeyType.ALL;
|
|
27
|
-
|
|
28
25
|
this.setActive();
|
|
29
26
|
}
|
|
30
27
|
|
|
@@ -35,9 +32,9 @@ class CoordinateAtPixel extends AbstractInteraction {
|
|
|
35
32
|
*/
|
|
36
33
|
// eslint-disable-next-line class-methods-use-this
|
|
37
34
|
async pipe(event) {
|
|
38
|
-
if (event.map.className === '
|
|
35
|
+
if (event.map.className === 'CesiumMap') {
|
|
39
36
|
return this._cesiumHandler(event);
|
|
40
|
-
} else if (event.map.className === '
|
|
37
|
+
} else if (event.map.className === 'ObliqueMap') {
|
|
41
38
|
return CoordinateAtPixel.obliqueHandler(event);
|
|
42
39
|
}
|
|
43
40
|
return event;
|
|
@@ -74,10 +71,10 @@ class CoordinateAtPixel extends AbstractInteraction {
|
|
|
74
71
|
* @private
|
|
75
72
|
*/
|
|
76
73
|
static obliqueHandler(event) {
|
|
77
|
-
const obliqueMap = /** @type {import("@vcmap/core").
|
|
74
|
+
const obliqueMap = /** @type {import("@vcmap/core").ObliqueMap} */ (event.map);
|
|
78
75
|
const image = obliqueMap.currentImage;
|
|
79
76
|
if (image) {
|
|
80
|
-
// don't use
|
|
77
|
+
// don't use TerrainLayer for coordinate Transformation if the event is a move or drag event,
|
|
81
78
|
// to avoid requesting the terrain each mousemove...
|
|
82
79
|
// XXX but what about DRAGSTART and DRAGEND? this could be usefull, no?
|
|
83
80
|
const move = event.type & (EventType.MOVE ^ EventType.DRAGEVENTS);
|
|
@@ -85,7 +82,7 @@ class CoordinateAtPixel extends AbstractInteraction {
|
|
|
85
82
|
if (Number.isFinite(pixel[0]) && Number.isFinite(pixel[1])) {
|
|
86
83
|
return transformFromImage(image, pixel, {
|
|
87
84
|
dontUseTerrain: !!move,
|
|
88
|
-
dataProjection: mercatorProjection
|
|
85
|
+
dataProjection: mercatorProjection,
|
|
89
86
|
}).then((coordinates) => {
|
|
90
87
|
event.obliqueParameters = { pixel };
|
|
91
88
|
event.position = coordinates.coords;
|
|
@@ -9,7 +9,7 @@ import CoordinateAtPixel from './coordinateAtPixel.js';
|
|
|
9
9
|
import FeatureAtPixelInteraction from './featureAtPixelInteraction.js';
|
|
10
10
|
import { EventType, PointerEventType } from './interactionType.js';
|
|
11
11
|
import FeatureProviderInteraction from './featureProviderInteraction.js';
|
|
12
|
-
import VcsEvent from '../
|
|
12
|
+
import VcsEvent from '../vcsEvent.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @namespace interaction
|
|
@@ -31,7 +31,7 @@ import VcsEvent from '../event/vcsEvent.js';
|
|
|
31
31
|
* @property {import("@vcmap/core").ModificationKeyType} key
|
|
32
32
|
* @property {import("@vcmap/core").PointerKeyType} pointer
|
|
33
33
|
* @property {import("ol/coordinate").Coordinate|undefined} position - position in web mercator coordinates
|
|
34
|
-
* @property {import("ol/coordinate").Coordinate|undefined} positionOrPixel - position in web mercator coordinates or image coordinates in
|
|
34
|
+
* @property {import("ol/coordinate").Coordinate|undefined} positionOrPixel - position in web mercator coordinates or image coordinates in ObliqueMap Map Mode
|
|
35
35
|
* @property {boolean|undefined} multipleTouch - vcs:undocumented
|
|
36
36
|
* @property {number|null|undefined} time - vcs:undocumented
|
|
37
37
|
*/
|
|
@@ -47,7 +47,7 @@ import VcsEvent from '../event/vcsEvent.js';
|
|
|
47
47
|
* @returns {import("@vcsuite/logger").Logger}
|
|
48
48
|
*/
|
|
49
49
|
function getLogger() {
|
|
50
|
-
return getLoggerByName('
|
|
50
|
+
return getLoggerByName('EventHandler');
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
@@ -12,7 +12,7 @@ import { originalFeatureSymbol } from '../layer/vectorSymbols.js';
|
|
|
12
12
|
*/
|
|
13
13
|
class FeatureAtPixelInteraction extends AbstractInteraction {
|
|
14
14
|
constructor() {
|
|
15
|
-
super();
|
|
15
|
+
super(EventType.ALL ^ EventType.MOVE, ModificationKeyType.ALL);
|
|
16
16
|
/**
|
|
17
17
|
* @type {EventType|number}
|
|
18
18
|
* @private
|
|
@@ -47,19 +47,6 @@ class FeatureAtPixelInteraction extends AbstractInteraction {
|
|
|
47
47
|
*/
|
|
48
48
|
this.hitTolerance = 10;
|
|
49
49
|
|
|
50
|
-
/**
|
|
51
|
-
* @inheritDoc
|
|
52
|
-
* @type {ModificationKeyType|number}
|
|
53
|
-
* @protected
|
|
54
|
-
*/
|
|
55
|
-
this._defaultModificationKey = ModificationKeyType.ALL;
|
|
56
|
-
/**
|
|
57
|
-
* @inheritDoc
|
|
58
|
-
* @type {ModificationKeyType|number}
|
|
59
|
-
* @protected
|
|
60
|
-
*/
|
|
61
|
-
this._defaultActive = EventType.ALL ^ EventType.MOVE;
|
|
62
|
-
|
|
63
50
|
/**
|
|
64
51
|
* @type {import("ol").Feature<import("ol/geom/Geometry").default>|Object|null}
|
|
65
52
|
* @private
|
|
@@ -113,11 +100,11 @@ class FeatureAtPixelInteraction extends AbstractInteraction {
|
|
|
113
100
|
this._draggingFeature = null;
|
|
114
101
|
}
|
|
115
102
|
|
|
116
|
-
if (event.map.className === '
|
|
103
|
+
if (event.map.className === 'OpenlayersMap') {
|
|
117
104
|
await this._openlayersHandler(event);
|
|
118
|
-
} else if (event.map.className === '
|
|
105
|
+
} else if (event.map.className === 'ObliqueMap') {
|
|
119
106
|
await this._obliqueHandler(event);
|
|
120
|
-
} else if (event.map.className === '
|
|
107
|
+
} else if (event.map.className === 'CesiumMap') {
|
|
121
108
|
await this._cesiumHandler(event);
|
|
122
109
|
}
|
|
123
110
|
if (event.type & EventType.DRAGSTART && event.feature) {
|
|
@@ -152,7 +139,7 @@ class FeatureAtPixelInteraction extends AbstractInteraction {
|
|
|
152
139
|
let found = null;
|
|
153
140
|
/** @type {null|import("ol/layer/Layer").default} */
|
|
154
141
|
let foundLayer = null;
|
|
155
|
-
/** @type {import("@vcmap/core").
|
|
142
|
+
/** @type {import("@vcmap/core").OpenlayersMap} */ (event.map).olMap
|
|
156
143
|
.forEachFeatureAtPixel([event.windowPosition.x, event.windowPosition.y], (feat, layer) => {
|
|
157
144
|
if (feat && (feat.get('olcs_allowPicking') == null || feat.get('olcs_allowPicking') === true)) {
|
|
158
145
|
found = /** @type {import("ol").Feature<import("ol/geom/Geometry").default>} */ (feat);
|
|
@@ -180,7 +167,7 @@ class FeatureAtPixelInteraction extends AbstractInteraction {
|
|
|
180
167
|
let found = null;
|
|
181
168
|
/** @type {null|import("ol/layer/Layer").default} */
|
|
182
169
|
let foundLayer = null;
|
|
183
|
-
/** @type {import("@vcmap/core").
|
|
170
|
+
/** @type {import("@vcmap/core").ObliqueMap} */ (event.map).olMap
|
|
184
171
|
.forEachFeatureAtPixel([event.windowPosition.x, event.windowPosition.y], (feat, layer) => {
|
|
185
172
|
if (feat) {
|
|
186
173
|
found = feat[originalFeatureSymbol] || feat;
|
|
@@ -7,19 +7,8 @@ import { EventType, ModificationKeyType } from './interactionType.js';
|
|
|
7
7
|
*/
|
|
8
8
|
class FeatureProviderInteraction extends AbstractInteraction {
|
|
9
9
|
constructor() {
|
|
10
|
-
super();
|
|
11
|
-
|
|
12
|
-
* @inheritDoc
|
|
13
|
-
* @type {ModificationKeyType|number}
|
|
14
|
-
* @protected
|
|
15
|
-
*/
|
|
16
|
-
this._defaultModificationKey = ModificationKeyType.ALL;
|
|
17
|
-
/**
|
|
18
|
-
* @inheritDoc
|
|
19
|
-
* @type {ModificationKeyType|number}
|
|
20
|
-
* @protected
|
|
21
|
-
*/
|
|
22
|
-
this._defaultActive = EventType.CLICK;
|
|
10
|
+
super(EventType.CLICK, ModificationKeyType.ALL);
|
|
11
|
+
|
|
23
12
|
this.setActive();
|
|
24
13
|
}
|
|
25
14
|
|
|
@@ -4,38 +4,19 @@ import { EventType, ModificationKeyType, PointerKeyType } from './interactionTyp
|
|
|
4
4
|
/**
|
|
5
5
|
* @class
|
|
6
6
|
* @extends {AbstractInteraction}
|
|
7
|
-
* @export
|
|
8
7
|
*/
|
|
9
8
|
class InteractionChain extends AbstractInteraction {
|
|
10
9
|
/**
|
|
11
10
|
* @param {Array<AbstractInteraction>=} chain
|
|
12
11
|
*/
|
|
13
12
|
constructor(chain) {
|
|
14
|
-
super();
|
|
13
|
+
super(EventType.ALL, ModificationKeyType.ALL, PointerKeyType.ALL);
|
|
15
14
|
/**
|
|
16
15
|
* The interactions to handle one after the other
|
|
17
16
|
* @type {Array<AbstractInteraction>}
|
|
18
17
|
* @api
|
|
19
18
|
*/
|
|
20
19
|
this.chain = chain || [];
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
* @type {EventType}
|
|
24
|
-
* @protected
|
|
25
|
-
*/
|
|
26
|
-
this._defaultActive = EventType.ALL;
|
|
27
|
-
/**
|
|
28
|
-
* @inheritDoc
|
|
29
|
-
* @type {ModificationKeyType}
|
|
30
|
-
* @protected
|
|
31
|
-
*/
|
|
32
|
-
this._defaultModificationKey = ModificationKeyType.ALL;
|
|
33
|
-
/**
|
|
34
|
-
* @inheritDoc
|
|
35
|
-
* @type {PointerKeyType}
|
|
36
|
-
* @protected
|
|
37
|
-
*/
|
|
38
|
-
this._defaultPointerKey = PointerKeyType.ALL;
|
|
39
20
|
this.setActive();
|
|
40
21
|
}
|
|
41
22
|
|
|
@@ -72,8 +53,8 @@ class InteractionChain extends AbstractInteraction {
|
|
|
72
53
|
* @param {InteractionEvent} event
|
|
73
54
|
* @returns {Promise<InteractionEvent>}
|
|
74
55
|
*/
|
|
75
|
-
pipe(event) {
|
|
76
|
-
let
|
|
56
|
+
async pipe(event) {
|
|
57
|
+
let pipedEvent = event;
|
|
77
58
|
const chainLength = this.chain.length;
|
|
78
59
|
for (let i = 0; i < chainLength; i++) {
|
|
79
60
|
const interaction = this.chain[i];
|
|
@@ -82,16 +63,14 @@ class InteractionChain extends AbstractInteraction {
|
|
|
82
63
|
(interaction.modificationKey & event.key) &&
|
|
83
64
|
(interaction.pointerKey & event.pointer)
|
|
84
65
|
) {
|
|
85
|
-
// eslint-disable-next-line
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return this.pipe(pipedEvent);
|
|
91
|
-
}.bind(interaction));
|
|
66
|
+
// eslint-disable-next-line no-await-in-loop
|
|
67
|
+
pipedEvent = await interaction.pipe(pipedEvent);
|
|
68
|
+
if (pipedEvent.stopPropagation) {
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
92
71
|
}
|
|
93
72
|
}
|
|
94
|
-
return
|
|
73
|
+
return pipedEvent;
|
|
95
74
|
}
|
|
96
75
|
|
|
97
76
|
/**
|
|
@@ -99,7 +78,7 @@ class InteractionChain extends AbstractInteraction {
|
|
|
99
78
|
* @override
|
|
100
79
|
*/
|
|
101
80
|
setModification() {
|
|
102
|
-
|
|
81
|
+
super.setModification();
|
|
103
82
|
}
|
|
104
83
|
|
|
105
84
|
/**
|
|
@@ -107,7 +86,7 @@ class InteractionChain extends AbstractInteraction {
|
|
|
107
86
|
* @override
|
|
108
87
|
*/
|
|
109
88
|
setPointer() {
|
|
110
|
-
|
|
89
|
+
super.setPointer();
|
|
111
90
|
}
|
|
112
91
|
|
|
113
92
|
/**
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
let nextBit = 1;
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Provides
|
|
4
|
+
* Provides information to other interaction plugins for creating bitmasks
|
|
5
5
|
* @class
|
|
6
|
-
* @export
|
|
7
6
|
*/
|
|
8
7
|
export class BitCounter {
|
|
9
8
|
/**
|
|
@@ -19,7 +18,6 @@ export class BitCounter {
|
|
|
19
18
|
/**
|
|
20
19
|
* Enumeration of modification key types
|
|
21
20
|
* @enum {number}
|
|
22
|
-
* @export
|
|
23
21
|
* @property {number} NONE
|
|
24
22
|
* @property {number} ALT
|
|
25
23
|
* @property {number} CTRL
|
|
@@ -53,7 +51,6 @@ ModificationKeyType.ALL = ModificationKeyType.NONE |
|
|
|
53
51
|
* @property {number} DRAGEVENTS
|
|
54
52
|
* @property {number} CLICKMOVE
|
|
55
53
|
* @property {number} ALL
|
|
56
|
-
* @export
|
|
57
54
|
* @api
|
|
58
55
|
*/
|
|
59
56
|
export const EventType = {
|
|
@@ -85,7 +82,6 @@ EventType.ALL = Object.values(EventType)
|
|
|
85
82
|
* @property {number} RIGHT
|
|
86
83
|
* @property {number} MIDDLE
|
|
87
84
|
* @property {number} ALL
|
|
88
|
-
* @export
|
|
89
85
|
* @api
|
|
90
86
|
*/
|
|
91
87
|
export const PointerKeyType = {
|