@vcmap/core 5.0.0-rc.28 → 5.0.0-rc.29
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/README.md +9 -3
- package/build/postinstall.js +13 -2
- package/index.d.ts +155 -106
- package/package.json +9 -4
- package/src/category/category.js +71 -32
- package/src/category/categoryCollection.js +27 -18
- package/src/cesium/cesiumVcsCameraPrimitive.js +13 -5
- package/src/cesium/entity.js +3 -1
- package/src/cesium/wallpaperMaterial.js +4 -2
- package/src/classRegistry.js +11 -4
- package/src/featureProvider/abstractFeatureProvider.js +43 -22
- package/src/featureProvider/tileProviderFeatureProvider.js +11 -5
- package/src/featureProvider/wmsFeatureProvider.js +37 -15
- package/src/interaction/abstractInteraction.js +5 -1
- package/src/interaction/coordinateAtPixel.js +34 -12
- package/src/interaction/eventHandler.js +63 -23
- package/src/interaction/featureAtPixelInteraction.js +96 -32
- package/src/interaction/featureProviderInteraction.js +23 -8
- package/src/interaction/interactionChain.js +19 -9
- package/src/interaction/interactionType.js +23 -26
- package/src/layer/cesium/cesiumTilesetCesiumImpl.js +45 -15
- package/src/layer/cesium/clusterContext.js +10 -3
- package/src/layer/cesium/dataSourceCesiumImpl.js +13 -4
- package/src/layer/cesium/openStreetMapCesiumImpl.js +7 -3
- package/src/layer/cesium/rasterLayerCesiumImpl.js +6 -2
- package/src/layer/cesium/singleImageCesiumImpl.js +14 -3
- package/src/layer/cesium/terrainCesiumImpl.js +3 -2
- package/src/layer/cesium/tmsCesiumImpl.js +15 -3
- package/src/layer/cesium/vectorCesiumImpl.js +69 -25
- package/src/layer/cesium/vectorContext.js +25 -5
- package/src/layer/cesium/vectorRasterTileCesiumImpl.js +15 -5
- package/src/layer/cesium/vectorTileImageryProvider.js +51 -13
- package/src/layer/cesium/wmsCesiumImpl.js +15 -3
- package/src/layer/cesium/wmtsCesiumImpl.js +18 -6
- package/src/layer/cesium/x3dmHelper.js +4 -1
- package/src/layer/cesiumTilesetLayer.js +55 -26
- package/src/layer/czmlLayer.js +11 -5
- package/src/layer/dataSourceLayer.js +25 -17
- package/src/layer/featureLayer.js +33 -18
- package/src/layer/featureStoreLayer.js +161 -99
- package/src/layer/featureStoreLayerChanges.js +57 -17
- package/src/layer/featureVisibility.js +89 -59
- package/src/layer/geojsonHelpers.js +70 -29
- package/src/layer/geojsonLayer.js +17 -11
- package/src/layer/globalHider.js +14 -4
- package/src/layer/layer.js +77 -44
- package/src/layer/layerImplementation.js +12 -4
- package/src/layer/oblique/layerObliqueImpl.js +3 -1
- package/src/layer/oblique/obliqueHelpers.js +75 -30
- package/src/layer/oblique/vectorObliqueImpl.js +175 -69
- package/src/layer/openStreetMapLayer.js +34 -20
- package/src/layer/openlayers/layerOpenlayersImpl.js +37 -15
- package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +3 -1
- package/src/layer/openlayers/rasterLayerOpenlayersImpl.js +3 -1
- package/src/layer/openlayers/singleImageOpenlayersImpl.js +3 -1
- package/src/layer/openlayers/tileDebugOpenlayersImpl.js +3 -1
- package/src/layer/openlayers/tmsOpenlayersImpl.js +6 -3
- package/src/layer/openlayers/vectorOpenlayersImpl.js +14 -4
- package/src/layer/openlayers/vectorTileOpenlayersImpl.js +12 -5
- package/src/layer/openlayers/wmsOpenlayersImpl.js +3 -1
- package/src/layer/openlayers/wmtsOpenlayersImpl.js +12 -5
- package/src/layer/pointCloudLayer.js +21 -10
- package/src/layer/rasterLayer.js +73 -22
- package/src/layer/singleImageLayer.js +10 -7
- package/src/layer/terrainHelpers.js +30 -19
- package/src/layer/terrainLayer.js +16 -7
- package/src/layer/tileLoadedHelper.js +9 -4
- package/src/layer/tileProvider/mvtTileProvider.js +10 -4
- package/src/layer/tileProvider/staticGeojsonTileProvider.js +10 -4
- package/src/layer/tileProvider/tileProvider.js +163 -87
- package/src/layer/tileProvider/urlTemplateTileProvider.js +10 -4
- package/src/layer/tmsLayer.js +7 -6
- package/src/layer/vectorHelpers.js +34 -25
- package/src/layer/vectorLayer.js +77 -36
- package/src/layer/vectorProperties.js +245 -74
- package/src/layer/vectorSymbols.js +3 -1
- package/src/layer/vectorTileLayer.js +121 -70
- package/src/layer/wfsLayer.js +19 -8
- package/src/layer/wmsHelpers.js +11 -6
- package/src/layer/wmsLayer.js +36 -14
- package/src/layer/wmtsLayer.js +35 -20
- package/src/map/baseOLMap.js +57 -31
- package/src/map/cameraLimiter.js +67 -18
- package/src/map/cesiumMap.js +307 -95
- package/src/map/obliqueMap.js +84 -34
- package/src/map/openlayersMap.js +40 -19
- package/src/map/vcsMap.js +21 -8
- package/src/oblique/helpers.js +212 -64
- package/src/oblique/obliqueCollection.js +111 -48
- package/src/oblique/obliqueDataSet.js +53 -21
- package/src/oblique/obliqueImage.js +50 -17
- package/src/oblique/obliqueImageMeta.js +7 -6
- package/src/oblique/obliqueProvider.js +75 -27
- package/src/oblique/obliqueView.js +18 -7
- package/src/oblique/obliqueViewDirection.js +3 -2
- package/src/oblique/parseImageJson.js +57 -23
- package/src/ol/feature.js +8 -3
- package/src/ol/geom/circle.js +12 -3
- package/src/ol/geom/geometryCollection.js +11 -4
- package/src/ol/render/canvas/canvasTileRenderer.js +11 -9
- package/src/overrideClassRegistry.js +13 -3
- package/src/style/arcStyle.js +129 -36
- package/src/style/arrowStyle.js +57 -22
- package/src/style/declarativeStyleItem.js +107 -62
- package/src/style/shapesCategory.js +8 -6
- package/src/style/styleFactory.js +4 -1
- package/src/style/styleHelpers.js +17 -8
- package/src/style/styleItem.js +28 -10
- package/src/style/vectorStyleItem.js +160 -74
- package/src/style/writeStyle.js +5 -7
- package/src/util/clipping/clippingObject.js +72 -38
- package/src/util/clipping/clippingObjectManager.js +53 -19
- package/src/util/clipping/clippingPlaneHelper.js +120 -53
- package/src/util/collection.js +12 -6
- package/src/util/editor/createFeatureSession.js +21 -6
- package/src/util/editor/editFeaturesSession.js +41 -15
- package/src/util/editor/editGeometrySession.js +55 -30
- package/src/util/editor/editorHelpers.js +114 -29
- package/src/util/editor/editorSessionHelpers.js +8 -3
- package/src/util/editor/interactions/createBBoxInteraction.js +11 -3
- package/src/util/editor/interactions/createCircleInteraction.js +7 -2
- package/src/util/editor/interactions/createLineStringInteraction.js +7 -2
- package/src/util/editor/interactions/createPolygonInteraction.js +7 -2
- package/src/util/editor/interactions/editFeaturesMouseOverInteraction.js +7 -5
- package/src/util/editor/interactions/editGeometryMouseOverInteraction.js +8 -3
- package/src/util/editor/interactions/ensureHandlerSelectionInteraction.js +4 -2
- package/src/util/editor/interactions/insertVertexInteraction.js +17 -6
- package/src/util/editor/interactions/mapInteractionController.js +31 -14
- package/src/util/editor/interactions/removeVertexInteraction.js +4 -1
- package/src/util/editor/interactions/selectFeatureMouseOverInteraction.js +19 -10
- package/src/util/editor/interactions/selectMultiFeatureInteraction.js +33 -20
- package/src/util/editor/interactions/selectSingleFeatureInteraction.js +14 -8
- package/src/util/editor/selectFeaturesSession.js +37 -21
- package/src/util/editor/transformation/create2DHandlers.js +82 -37
- package/src/util/editor/transformation/create3DHandlers.js +187 -84
- package/src/util/editor/transformation/extrudeInteraction.js +20 -5
- package/src/util/editor/transformation/rotateInteraction.js +29 -16
- package/src/util/editor/transformation/scaleInteraction.js +31 -15
- package/src/util/editor/transformation/transformationHandler.js +23 -8
- package/src/util/editor/transformation/transformationTypes.js +8 -4
- package/src/util/editor/transformation/translateInteraction.js +86 -32
- package/src/util/editor/validateGeoemetry.js +3 -1
- package/src/util/exclusiveManager.js +6 -3
- package/src/util/extent.js +20 -10
- package/src/util/featureconverter/arcToCesium.js +46 -12
- package/src/util/featureconverter/circleToCesium.js +61 -27
- package/src/util/featureconverter/convert.js +85 -13
- package/src/util/featureconverter/extent3D.js +69 -28
- package/src/util/featureconverter/featureconverterHelper.js +232 -79
- package/src/util/featureconverter/lineStringToCesium.js +107 -35
- package/src/util/featureconverter/pointHelpers.js +117 -45
- package/src/util/featureconverter/pointToCesium.js +128 -31
- package/src/util/featureconverter/polygonToCesium.js +50 -16
- package/src/util/fetch.js +3 -1
- package/src/util/geometryHelpers.js +15 -10
- package/src/util/indexedCollection.js +7 -3
- package/src/util/isMobile.js +8 -2
- package/src/util/layerCollection.js +28 -12
- package/src/util/mapCollection.js +37 -18
- package/src/util/math.js +35 -19
- package/src/util/overrideCollection.js +57 -32
- package/src/util/projection.js +21 -5
- package/src/util/urlHelpers.js +5 -3
- package/src/util/viewpoint.js +66 -33
- package/src/vcsApp.js +133 -69
- package/src/vcsModule.js +3 -2
- package/src/vcsModuleHelpers.js +24 -9
- package/src/vcsObject.js +3 -2
- package/tests/data/dynamicPointCzml.json +24 -35
- package/tests/data/oblique/imageData/imagev34.json +56 -272
- package/tests/data/oblique/imageData/imagev35.json +272 -19
- package/tests/data/oblique/imageData/imagev35PerImageSize.json +299 -19
- package/tests/data/oblique/tiledImageData/12/2199/1342.json +11056 -1
- package/tests/data/oblique/tiledImageData/12/2199/1343.json +11236 -1
- package/tests/data/oblique/tiledImageData/12/2199/1344.json +11077 -1
- package/tests/data/oblique/tiledImageData/12/2200/1342.json +11036 -1
- package/tests/data/oblique/tiledImageData/12/2200/1343.json +11277 -1
- package/tests/data/oblique/tiledImageData/12/2200/1344.json +11131 -1
- package/tests/data/oblique/tiledImageData/12/2201/1342.json +10870 -1
- package/tests/data/oblique/tiledImageData/12/2201/1343.json +11492 -1
- package/tests/data/oblique/tiledImageData/12/2201/1344.json +10909 -1
- package/tests/data/oblique/tiledImageData/image.json +70 -1
- package/tests/data/terrain/layer.json +121 -130
- package/tests/data/testGeoJSON.json +4 -16
- package/tests/unit/helpers/cesiumHelpers.js +58 -33
- package/tests/unit/helpers/helpers.js +10 -2
- package/tests/unit/helpers/imageHelpers.js +8 -4
- package/tests/unit/helpers/obliqueData.js +39 -13
- package/tests/unit/helpers/obliqueHelpers.js +12 -9
- package/tests/unit/helpers/openlayersHelpers.js +4 -1
- package/tests/unit/helpers/terrain/terrainData.js +8 -7
|
@@ -7,7 +7,11 @@ import AbstractInteraction from './abstractInteraction.js';
|
|
|
7
7
|
import InteractionChain from './interactionChain.js';
|
|
8
8
|
import CoordinateAtPixel from './coordinateAtPixel.js';
|
|
9
9
|
import FeatureAtPixelInteraction from './featureAtPixelInteraction.js';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
EventType,
|
|
12
|
+
ModificationKeyType,
|
|
13
|
+
PointerEventType,
|
|
14
|
+
} from './interactionType.js';
|
|
11
15
|
import FeatureProviderInteraction from './featureProviderInteraction.js';
|
|
12
16
|
import VcsEvent from '../vcsEvent.js';
|
|
13
17
|
|
|
@@ -180,21 +184,27 @@ class EventHandler {
|
|
|
180
184
|
* @readonly
|
|
181
185
|
* @api
|
|
182
186
|
*/
|
|
183
|
-
get positionInteraction() {
|
|
187
|
+
get positionInteraction() {
|
|
188
|
+
return this._positionInteraction;
|
|
189
|
+
}
|
|
184
190
|
|
|
185
191
|
/**
|
|
186
192
|
* @type {FeatureAtPixelInteraction}
|
|
187
193
|
* @readonly
|
|
188
194
|
* @api
|
|
189
195
|
*/
|
|
190
|
-
get featureInteraction() {
|
|
196
|
+
get featureInteraction() {
|
|
197
|
+
return this._featureInteraction;
|
|
198
|
+
}
|
|
191
199
|
|
|
192
200
|
/**
|
|
193
201
|
* @api
|
|
194
202
|
* @readonly
|
|
195
203
|
* @type {FeatureProviderInteraction}
|
|
196
204
|
*/
|
|
197
|
-
get featureProviderInteraction() {
|
|
205
|
+
get featureProviderInteraction() {
|
|
206
|
+
return this._featureProviderInteraction;
|
|
207
|
+
}
|
|
198
208
|
|
|
199
209
|
/**
|
|
200
210
|
* A copy of all the EventHandler interactions
|
|
@@ -202,14 +212,18 @@ class EventHandler {
|
|
|
202
212
|
* @type {AbstractInteraction[]}
|
|
203
213
|
* @api
|
|
204
214
|
*/
|
|
205
|
-
get interactions() {
|
|
215
|
+
get interactions() {
|
|
216
|
+
return this._interactionChain.chain.slice();
|
|
217
|
+
}
|
|
206
218
|
|
|
207
219
|
/**
|
|
208
220
|
* An event called, when the modifier changes. Order of precedence, if more then one key is pressed: SHIFT, ALT, CTRL
|
|
209
221
|
* @type {VcsEvent<ModificationKeyType>}
|
|
210
222
|
* @readonly
|
|
211
223
|
*/
|
|
212
|
-
get modifierChanged() {
|
|
224
|
+
get modifierChanged() {
|
|
225
|
+
return this._modifierChanged;
|
|
226
|
+
}
|
|
213
227
|
|
|
214
228
|
/**
|
|
215
229
|
* Add a dynamic interaction to the interaction chain. This is the default methodology for
|
|
@@ -244,7 +258,11 @@ class EventHandler {
|
|
|
244
258
|
};
|
|
245
259
|
}
|
|
246
260
|
this.exclusiveAdded.raiseEvent();
|
|
247
|
-
return this._exclusiveUnListen.bind(
|
|
261
|
+
return this._exclusiveUnListen.bind(
|
|
262
|
+
this,
|
|
263
|
+
interaction,
|
|
264
|
+
this._exclusiveInteraction.id,
|
|
265
|
+
);
|
|
248
266
|
}
|
|
249
267
|
|
|
250
268
|
/**
|
|
@@ -254,12 +272,12 @@ class EventHandler {
|
|
|
254
272
|
removeExclusive() {
|
|
255
273
|
if (this._exclusiveInteraction) {
|
|
256
274
|
this._exclusiveInteraction.interactions
|
|
257
|
-
.filter(i => i)
|
|
275
|
+
.filter((i) => i)
|
|
258
276
|
.forEach((i) => {
|
|
259
277
|
this._interactionChain.removeInteraction(i);
|
|
260
278
|
});
|
|
261
279
|
this._exclusiveInteraction.cb
|
|
262
|
-
.filter(cb => cb)
|
|
280
|
+
.filter((cb) => cb)
|
|
263
281
|
.forEach((cb) => {
|
|
264
282
|
cb();
|
|
265
283
|
});
|
|
@@ -276,17 +294,21 @@ class EventHandler {
|
|
|
276
294
|
* @private
|
|
277
295
|
*/
|
|
278
296
|
_exclusiveUnListen(interaction, id) {
|
|
279
|
-
if (
|
|
297
|
+
if (
|
|
298
|
+
!this._exclusiveInteraction ||
|
|
299
|
+
(this._exclusiveInteraction && this._exclusiveInteraction.id !== id)
|
|
300
|
+
) {
|
|
280
301
|
return 0;
|
|
281
302
|
}
|
|
282
303
|
const removed = this._interactionChain.removeInteraction(interaction);
|
|
283
|
-
const index = this._exclusiveInteraction.interactions
|
|
284
|
-
|
|
304
|
+
const index = this._exclusiveInteraction.interactions.findIndex(
|
|
305
|
+
(candidate) => candidate && candidate.id === interaction.id,
|
|
306
|
+
);
|
|
285
307
|
if (index > -1) {
|
|
286
308
|
this._exclusiveInteraction.interactions.splice(index, 1, undefined);
|
|
287
309
|
this._exclusiveInteraction.cb.splice(index, 1, undefined);
|
|
288
310
|
}
|
|
289
|
-
if (this._exclusiveInteraction.interactions.every(i => i === undefined)) {
|
|
311
|
+
if (this._exclusiveInteraction.interactions.every((i) => i === undefined)) {
|
|
290
312
|
this._exclusiveInteraction = null;
|
|
291
313
|
}
|
|
292
314
|
if (removed > -1) {
|
|
@@ -308,7 +330,8 @@ class EventHandler {
|
|
|
308
330
|
check(index, Number);
|
|
309
331
|
|
|
310
332
|
this._interactionChain.addInteraction(interaction, index);
|
|
311
|
-
return () =>
|
|
333
|
+
return () =>
|
|
334
|
+
this._interactionChain.removeInteraction(interaction) !== -1 ? 1 : 0;
|
|
312
335
|
}
|
|
313
336
|
|
|
314
337
|
/**
|
|
@@ -368,13 +391,19 @@ class EventHandler {
|
|
|
368
391
|
if (
|
|
369
392
|
this._lastClick.time &&
|
|
370
393
|
Date.now() - this._lastClick.time < this.clickDuration &&
|
|
371
|
-
Cartesian2.distanceSquared(
|
|
394
|
+
Cartesian2.distanceSquared(
|
|
395
|
+
this._lastClick.windowPosition,
|
|
396
|
+
actualEvent.windowPosition,
|
|
397
|
+
) < 12
|
|
372
398
|
) {
|
|
373
399
|
this._lastClick.time = null;
|
|
374
400
|
actualEvent.type = EventType.DBLCLICK;
|
|
375
401
|
} else {
|
|
376
402
|
this._lastClick.time = Date.now();
|
|
377
|
-
Cartesian2.clone(
|
|
403
|
+
Cartesian2.clone(
|
|
404
|
+
actualEvent.windowPosition,
|
|
405
|
+
this._lastClick.windowPosition,
|
|
406
|
+
);
|
|
378
407
|
actualEvent.type = EventType.CLICK;
|
|
379
408
|
}
|
|
380
409
|
this._startChain(actualEvent);
|
|
@@ -395,7 +424,10 @@ class EventHandler {
|
|
|
395
424
|
actualEvent.key = this._dragging.key;
|
|
396
425
|
actualEvent.pointer = this._dragging.pointer;
|
|
397
426
|
this._startChain(actualEvent, true);
|
|
398
|
-
} else if (
|
|
427
|
+
} else if (
|
|
428
|
+
!this._dragging &&
|
|
429
|
+
Date.now() - this._lastDown.time > this.dragDuration
|
|
430
|
+
) {
|
|
399
431
|
actualEvent = { type: EventType.DRAGSTART, ...this._lastDown };
|
|
400
432
|
this._dragging = actualEvent;
|
|
401
433
|
this._startChain(actualEvent, true);
|
|
@@ -417,15 +449,23 @@ class EventHandler {
|
|
|
417
449
|
}
|
|
418
450
|
|
|
419
451
|
if (
|
|
420
|
-
this._lastKeyEventModifiers.get(ModificationKeyType.SHIFT) !==
|
|
421
|
-
|
|
422
|
-
this._lastKeyEventModifiers.get(ModificationKeyType.
|
|
452
|
+
this._lastKeyEventModifiers.get(ModificationKeyType.SHIFT) !==
|
|
453
|
+
event.shiftKey ||
|
|
454
|
+
this._lastKeyEventModifiers.get(ModificationKeyType.ALT) !==
|
|
455
|
+
event.altKey ||
|
|
456
|
+
this._lastKeyEventModifiers.get(ModificationKeyType.CTRL) !==
|
|
457
|
+
event.ctrlKey
|
|
423
458
|
) {
|
|
424
|
-
this._lastKeyEventModifiers.set(
|
|
459
|
+
this._lastKeyEventModifiers.set(
|
|
460
|
+
ModificationKeyType.SHIFT,
|
|
461
|
+
event.shiftKey,
|
|
462
|
+
);
|
|
425
463
|
this._lastKeyEventModifiers.set(ModificationKeyType.ALT, event.altKey);
|
|
426
464
|
this._lastKeyEventModifiers.set(ModificationKeyType.CTRL, event.ctrlKey);
|
|
427
|
-
const modifier =
|
|
428
|
-
|
|
465
|
+
const modifier =
|
|
466
|
+
[...this._lastKeyEventModifiers.keys()].find((k) =>
|
|
467
|
+
this._lastKeyEventModifiers.get(k),
|
|
468
|
+
) || ModificationKeyType.NONE;
|
|
429
469
|
|
|
430
470
|
if (modifier !== this._lastDispatchedModifier) {
|
|
431
471
|
this._interactionChain.modifierChanged(modifier);
|
|
@@ -9,7 +9,11 @@ import {
|
|
|
9
9
|
|
|
10
10
|
import AbstractInteraction from './abstractInteraction.js';
|
|
11
11
|
import Projection from '../util/projection.js';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
EventType,
|
|
14
|
+
ModificationKeyType,
|
|
15
|
+
PointerKeyType,
|
|
16
|
+
} from './interactionType.js';
|
|
13
17
|
import { vcsLayerName } from '../layer/layerSymbols.js';
|
|
14
18
|
import { originalFeatureSymbol } from '../layer/vectorSymbols.js';
|
|
15
19
|
|
|
@@ -19,7 +23,11 @@ import { originalFeatureSymbol } from '../layer/vectorSymbols.js';
|
|
|
19
23
|
*/
|
|
20
24
|
class FeatureAtPixelInteraction extends AbstractInteraction {
|
|
21
25
|
constructor() {
|
|
22
|
-
super(
|
|
26
|
+
super(
|
|
27
|
+
EventType.ALL ^ EventType.MOVE,
|
|
28
|
+
ModificationKeyType.ALL,
|
|
29
|
+
PointerKeyType.ALL,
|
|
30
|
+
);
|
|
23
31
|
/**
|
|
24
32
|
* @type {EventType|number}
|
|
25
33
|
* @private
|
|
@@ -67,7 +75,9 @@ class FeatureAtPixelInteraction extends AbstractInteraction {
|
|
|
67
75
|
* @type {number}
|
|
68
76
|
* @api
|
|
69
77
|
*/
|
|
70
|
-
get pickPosition() {
|
|
78
|
+
get pickPosition() {
|
|
79
|
+
return this._pickPosition;
|
|
80
|
+
}
|
|
71
81
|
|
|
72
82
|
/**
|
|
73
83
|
* @param {number} position
|
|
@@ -81,7 +91,9 @@ class FeatureAtPixelInteraction extends AbstractInteraction {
|
|
|
81
91
|
* @type {number}
|
|
82
92
|
* @api
|
|
83
93
|
*/
|
|
84
|
-
get excludedPickPositionEvents() {
|
|
94
|
+
get excludedPickPositionEvents() {
|
|
95
|
+
return ~this._pickPositionMask;
|
|
96
|
+
}
|
|
85
97
|
|
|
86
98
|
/**
|
|
87
99
|
* @param {number} position
|
|
@@ -146,14 +158,26 @@ class FeatureAtPixelInteraction extends AbstractInteraction {
|
|
|
146
158
|
let found = null;
|
|
147
159
|
/** @type {null|import("ol/layer/Layer").default} */
|
|
148
160
|
let foundLayer = null;
|
|
149
|
-
/** @type {import("@vcmap/core").OpenlayersMap} */ (
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
161
|
+
/** @type {import("@vcmap/core").OpenlayersMap} */ (
|
|
162
|
+
event.map
|
|
163
|
+
).olMap.forEachFeatureAtPixel(
|
|
164
|
+
[event.windowPosition.x, event.windowPosition.y],
|
|
165
|
+
(feat, layer) => {
|
|
166
|
+
if (
|
|
167
|
+
feat &&
|
|
168
|
+
(feat.get('olcs_allowPicking') == null ||
|
|
169
|
+
feat.get('olcs_allowPicking') === true)
|
|
170
|
+
) {
|
|
171
|
+
found =
|
|
172
|
+
/** @type {import("ol").Feature<import("ol/geom/Geometry").default>} */ (
|
|
173
|
+
feat
|
|
174
|
+
);
|
|
153
175
|
foundLayer = layer;
|
|
154
176
|
}
|
|
155
177
|
return true;
|
|
156
|
-
},
|
|
178
|
+
},
|
|
179
|
+
{ hitTolerance: this.hitTolerance },
|
|
180
|
+
);
|
|
157
181
|
if (found && foundLayer) {
|
|
158
182
|
event.feature = found;
|
|
159
183
|
if (found.get('features')) {
|
|
@@ -174,14 +198,19 @@ class FeatureAtPixelInteraction extends AbstractInteraction {
|
|
|
174
198
|
let found = null;
|
|
175
199
|
/** @type {null|import("ol/layer/Layer").default} */
|
|
176
200
|
let foundLayer = null;
|
|
177
|
-
/** @type {import("@vcmap/core").ObliqueMap} */ (
|
|
178
|
-
|
|
201
|
+
/** @type {import("@vcmap/core").ObliqueMap} */ (
|
|
202
|
+
event.map
|
|
203
|
+
).olMap.forEachFeatureAtPixel(
|
|
204
|
+
[event.windowPosition.x, event.windowPosition.y],
|
|
205
|
+
(feat, layer) => {
|
|
179
206
|
if (feat) {
|
|
180
207
|
found = feat[originalFeatureSymbol] || feat;
|
|
181
208
|
}
|
|
182
209
|
foundLayer = layer;
|
|
183
210
|
return true;
|
|
184
|
-
},
|
|
211
|
+
},
|
|
212
|
+
{ hitTolerance: this.hitTolerance },
|
|
213
|
+
);
|
|
185
214
|
|
|
186
215
|
if (found && foundLayer) {
|
|
187
216
|
event.feature = found;
|
|
@@ -199,10 +228,16 @@ class FeatureAtPixelInteraction extends AbstractInteraction {
|
|
|
199
228
|
* @private
|
|
200
229
|
*/
|
|
201
230
|
_cesiumHandler(event) {
|
|
202
|
-
const cesiumMap = /** @type {import("@vcmap/core").CesiumMap} */ (
|
|
231
|
+
const cesiumMap = /** @type {import("@vcmap/core").CesiumMap} */ (
|
|
232
|
+
event.map
|
|
233
|
+
);
|
|
203
234
|
const scene = cesiumMap.getScene();
|
|
204
235
|
|
|
205
|
-
const object = scene.pick(
|
|
236
|
+
const object = scene.pick(
|
|
237
|
+
event.windowPosition,
|
|
238
|
+
this.hitTolerance,
|
|
239
|
+
this.hitTolerance,
|
|
240
|
+
);
|
|
206
241
|
|
|
207
242
|
let scratchCartographic = new Cartographic();
|
|
208
243
|
let scratchCartesian = new Cartesian3();
|
|
@@ -215,40 +250,62 @@ class FeatureAtPixelInteraction extends AbstractInteraction {
|
|
|
215
250
|
return Promise.resolve(event);
|
|
216
251
|
}
|
|
217
252
|
if (this.pullPickedPosition && event.ray) {
|
|
218
|
-
scratchPullCartesian = Cartesian3
|
|
219
|
-
|
|
253
|
+
scratchPullCartesian = Cartesian3.multiplyByScalar(
|
|
254
|
+
event.ray.direction,
|
|
255
|
+
this.pullPickedPosition,
|
|
256
|
+
scratchPullCartesian,
|
|
257
|
+
);
|
|
220
258
|
|
|
221
|
-
scratchCartesian = Cartesian3.subtract(
|
|
259
|
+
scratchCartesian = Cartesian3.subtract(
|
|
260
|
+
scratchCartesian,
|
|
261
|
+
scratchPullCartesian,
|
|
262
|
+
scratchCartesian,
|
|
263
|
+
);
|
|
222
264
|
}
|
|
223
|
-
scratchCartographic = Cartographic
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
265
|
+
scratchCartographic = Cartographic.fromCartesian(
|
|
266
|
+
scratchCartesian,
|
|
267
|
+
scene.globe.ellipsoid,
|
|
268
|
+
scratchCartographic,
|
|
269
|
+
);
|
|
270
|
+
event.position = Projection.wgs84ToMercator(
|
|
271
|
+
[
|
|
272
|
+
CesiumMath.toDegrees(scratchCartographic.longitude),
|
|
273
|
+
CesiumMath.toDegrees(scratchCartographic.latitude),
|
|
274
|
+
scratchCartographic.height,
|
|
275
|
+
],
|
|
276
|
+
true,
|
|
277
|
+
);
|
|
230
278
|
event.positionOrPixel = event.position;
|
|
231
279
|
scene.pickTranslucentDepth = pickTranslucentDepth;
|
|
232
280
|
return Promise.resolve(event);
|
|
233
281
|
};
|
|
234
282
|
|
|
235
283
|
if (object) {
|
|
236
|
-
if (object.primitive && object.primitive.olFeature) {
|
|
284
|
+
if (object.primitive && object.primitive.olFeature) {
|
|
285
|
+
// vector & vectorCluster
|
|
237
286
|
event.feature = object.primitive.olFeature;
|
|
238
287
|
} else if (
|
|
239
288
|
object.primitive &&
|
|
240
289
|
object.primitive[vcsLayerName] &&
|
|
241
|
-
(object instanceof Cesium3DTileFeature ||
|
|
242
|
-
|
|
290
|
+
(object instanceof Cesium3DTileFeature ||
|
|
291
|
+
object instanceof Cesium3DTilePointFeature)
|
|
292
|
+
) {
|
|
293
|
+
// building
|
|
243
294
|
event.feature = object;
|
|
244
295
|
const symbols = Object.getOwnPropertySymbols(object.primitive);
|
|
245
296
|
const symbolLength = symbols.length;
|
|
246
297
|
for (let i = 0; i < symbolLength; i++) {
|
|
247
298
|
event.feature[symbols[i]] = object.primitive[symbols[i]];
|
|
248
299
|
}
|
|
249
|
-
} else if (object.id && object.id.olFeature) {
|
|
300
|
+
} else if (object.id && object.id.olFeature) {
|
|
301
|
+
// cluster size === 1
|
|
250
302
|
event.feature = object.id.olFeature;
|
|
251
|
-
} else if (
|
|
303
|
+
} else if (
|
|
304
|
+
object.id &&
|
|
305
|
+
object.id[vcsLayerName] &&
|
|
306
|
+
object.id instanceof Entity
|
|
307
|
+
) {
|
|
308
|
+
// entity
|
|
252
309
|
event.feature = object.id;
|
|
253
310
|
}
|
|
254
311
|
|
|
@@ -260,13 +317,20 @@ class FeatureAtPixelInteraction extends AbstractInteraction {
|
|
|
260
317
|
if (
|
|
261
318
|
object.primitive &&
|
|
262
319
|
this.pickTranslucent &&
|
|
263
|
-
!(
|
|
264
|
-
|
|
320
|
+
!(
|
|
321
|
+
object.primitive.pointCloudShading &&
|
|
322
|
+
object.primitive.pointCloudShading.attenuation
|
|
323
|
+
)
|
|
324
|
+
) {
|
|
325
|
+
// XXX should this always be on, also for non vector?
|
|
265
326
|
scene.pickTranslucentDepth = true;
|
|
266
327
|
scene.render(cesiumMap.getCesiumWidget().clock.currentTime);
|
|
267
328
|
event.exactPosition = true;
|
|
268
329
|
}
|
|
269
|
-
scratchCartesian = scene.pickPosition(
|
|
330
|
+
scratchCartesian = scene.pickPosition(
|
|
331
|
+
event.windowPosition,
|
|
332
|
+
scratchCartesian,
|
|
333
|
+
);
|
|
270
334
|
return handlePick();
|
|
271
335
|
}
|
|
272
336
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import AbstractInteraction from './abstractInteraction.js';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
EventType,
|
|
4
|
+
ModificationKeyType,
|
|
5
|
+
PointerKeyType,
|
|
6
|
+
} from './interactionType.js';
|
|
3
7
|
|
|
4
8
|
/**
|
|
5
9
|
* @class
|
|
@@ -20,16 +24,27 @@ class FeatureProviderInteraction extends AbstractInteraction {
|
|
|
20
24
|
// eslint-disable-next-line class-methods-use-this
|
|
21
25
|
async pipe(event) {
|
|
22
26
|
if (!event.feature) {
|
|
23
|
-
const layersWithProvider = [...event.map.layerCollection]
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
const layersWithProvider = [...event.map.layerCollection].filter((l) => {
|
|
28
|
+
return (
|
|
29
|
+
l.featureProvider &&
|
|
30
|
+
l.active &&
|
|
31
|
+
l.isSupported(event.map) &&
|
|
32
|
+
l.featureProvider.isSupported(event.map)
|
|
33
|
+
);
|
|
34
|
+
});
|
|
27
35
|
|
|
28
36
|
if (layersWithProvider.length > 0) {
|
|
29
37
|
const resolution = event.map.getCurrentResolution(event.position);
|
|
30
|
-
const features = (
|
|
31
|
-
.all(
|
|
32
|
-
|
|
38
|
+
const features = (
|
|
39
|
+
await Promise.all(
|
|
40
|
+
layersWithProvider.map((l) =>
|
|
41
|
+
l.featureProvider.getFeaturesByCoordinate(
|
|
42
|
+
event.position,
|
|
43
|
+
resolution,
|
|
44
|
+
),
|
|
45
|
+
),
|
|
46
|
+
)
|
|
47
|
+
).flat();
|
|
33
48
|
|
|
34
49
|
if (features.length > 0) {
|
|
35
50
|
event.feature = features[0];
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import AbstractInteraction from './abstractInteraction.js';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
EventType,
|
|
4
|
+
ModificationKeyType,
|
|
5
|
+
PointerKeyType,
|
|
6
|
+
} from './interactionType.js';
|
|
3
7
|
|
|
4
8
|
/**
|
|
5
9
|
* @class
|
|
@@ -41,7 +45,9 @@ class InteractionChain extends AbstractInteraction {
|
|
|
41
45
|
* @api
|
|
42
46
|
*/
|
|
43
47
|
removeInteraction(interaction) {
|
|
44
|
-
const index = this.chain.findIndex(
|
|
48
|
+
const index = this.chain.findIndex(
|
|
49
|
+
(candidate) => candidate.id === interaction.id,
|
|
50
|
+
);
|
|
45
51
|
if (index > -1) {
|
|
46
52
|
this.chain.splice(index, 1);
|
|
47
53
|
}
|
|
@@ -60,9 +66,9 @@ class InteractionChain extends AbstractInteraction {
|
|
|
60
66
|
for (let i = 0; i < chainLength; i++) {
|
|
61
67
|
const interaction = chain[i];
|
|
62
68
|
if (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
69
|
+
interaction.active & event.type &&
|
|
70
|
+
interaction.modificationKey & event.key &&
|
|
71
|
+
interaction.pointerKey & event.pointer
|
|
66
72
|
) {
|
|
67
73
|
// eslint-disable-next-line no-await-in-loop
|
|
68
74
|
pipedEvent = await interaction.pipe(pipedEvent);
|
|
@@ -79,8 +85,11 @@ class InteractionChain extends AbstractInteraction {
|
|
|
79
85
|
* @param {ModificationKeyType} modifier
|
|
80
86
|
*/
|
|
81
87
|
modifierChanged(modifier) {
|
|
82
|
-
this.chain
|
|
83
|
-
.
|
|
88
|
+
this.chain
|
|
89
|
+
.filter((i) => i.active !== EventType.NONE)
|
|
90
|
+
.forEach((i) => {
|
|
91
|
+
i.modifierChanged(modifier);
|
|
92
|
+
});
|
|
84
93
|
}
|
|
85
94
|
|
|
86
95
|
/**
|
|
@@ -103,11 +112,12 @@ class InteractionChain extends AbstractInteraction {
|
|
|
103
112
|
* @inheritDoc
|
|
104
113
|
*/
|
|
105
114
|
destroy() {
|
|
106
|
-
this.chain.forEach((i) => {
|
|
115
|
+
this.chain.forEach((i) => {
|
|
116
|
+
i.destroy();
|
|
117
|
+
});
|
|
107
118
|
this.chain = [];
|
|
108
119
|
super.destroy();
|
|
109
120
|
}
|
|
110
121
|
}
|
|
111
122
|
|
|
112
123
|
export default InteractionChain;
|
|
113
|
-
|
|
@@ -8,7 +8,9 @@ export class BitCounter {
|
|
|
8
8
|
/**
|
|
9
9
|
* @returns {number}
|
|
10
10
|
*/
|
|
11
|
-
static get interactionTypeCounter() {
|
|
11
|
+
static get interactionTypeCounter() {
|
|
12
|
+
return nextBit;
|
|
13
|
+
}
|
|
12
14
|
|
|
13
15
|
static getNextBit(counter) {
|
|
14
16
|
return counter << 1;
|
|
@@ -26,14 +28,15 @@ export class BitCounter {
|
|
|
26
28
|
* @api
|
|
27
29
|
*/
|
|
28
30
|
export const ModificationKeyType = {
|
|
29
|
-
NONE: nextBit = BitCounter.getNextBit(nextBit),
|
|
30
|
-
ALT: nextBit = BitCounter.getNextBit(nextBit),
|
|
31
|
-
CTRL: nextBit = BitCounter.getNextBit(nextBit),
|
|
32
|
-
SHIFT: nextBit = BitCounter.getNextBit(nextBit),
|
|
31
|
+
NONE: (nextBit = BitCounter.getNextBit(nextBit)),
|
|
32
|
+
ALT: (nextBit = BitCounter.getNextBit(nextBit)),
|
|
33
|
+
CTRL: (nextBit = BitCounter.getNextBit(nextBit)),
|
|
34
|
+
SHIFT: (nextBit = BitCounter.getNextBit(nextBit)),
|
|
33
35
|
ALL: 0,
|
|
34
36
|
};
|
|
35
37
|
|
|
36
|
-
ModificationKeyType.ALL =
|
|
38
|
+
ModificationKeyType.ALL =
|
|
39
|
+
ModificationKeyType.NONE |
|
|
37
40
|
ModificationKeyType.ALT |
|
|
38
41
|
ModificationKeyType.CTRL |
|
|
39
42
|
ModificationKeyType.SHIFT;
|
|
@@ -55,25 +58,21 @@ ModificationKeyType.ALL = ModificationKeyType.NONE |
|
|
|
55
58
|
*/
|
|
56
59
|
export const EventType = {
|
|
57
60
|
NONE: 0,
|
|
58
|
-
CLICK: nextBit = BitCounter.getNextBit(nextBit),
|
|
59
|
-
DBLCLICK: nextBit = BitCounter.getNextBit(nextBit),
|
|
60
|
-
DRAG: nextBit = BitCounter.getNextBit(nextBit),
|
|
61
|
-
DRAGSTART: nextBit = BitCounter.getNextBit(nextBit),
|
|
62
|
-
DRAGEND: nextBit = BitCounter.getNextBit(nextBit),
|
|
63
|
-
MOVE: nextBit = BitCounter.getNextBit(nextBit),
|
|
61
|
+
CLICK: (nextBit = BitCounter.getNextBit(nextBit)),
|
|
62
|
+
DBLCLICK: (nextBit = BitCounter.getNextBit(nextBit)),
|
|
63
|
+
DRAG: (nextBit = BitCounter.getNextBit(nextBit)),
|
|
64
|
+
DRAGSTART: (nextBit = BitCounter.getNextBit(nextBit)),
|
|
65
|
+
DRAGEND: (nextBit = BitCounter.getNextBit(nextBit)),
|
|
66
|
+
MOVE: (nextBit = BitCounter.getNextBit(nextBit)),
|
|
64
67
|
DRAGEVENTS: 0,
|
|
65
68
|
CLICKMOVE: 0,
|
|
66
69
|
ALL: 0,
|
|
67
70
|
};
|
|
68
|
-
EventType.DRAGEVENTS = EventType.DRAG |
|
|
69
|
-
EventType.DRAGEND |
|
|
70
|
-
EventType.DRAGSTART;
|
|
71
|
+
EventType.DRAGEVENTS = EventType.DRAG | EventType.DRAGEND | EventType.DRAGSTART;
|
|
71
72
|
|
|
72
|
-
EventType.CLICKMOVE = EventType.CLICK |
|
|
73
|
-
EventType.MOVE;
|
|
73
|
+
EventType.CLICKMOVE = EventType.CLICK | EventType.MOVE;
|
|
74
74
|
|
|
75
|
-
EventType.ALL = Object.values(EventType)
|
|
76
|
-
.reduce((val, mask) => val | mask, 0);
|
|
75
|
+
EventType.ALL = Object.values(EventType).reduce((val, mask) => val | mask, 0);
|
|
77
76
|
|
|
78
77
|
/**
|
|
79
78
|
* Enumeration of pointer keys.
|
|
@@ -85,15 +84,14 @@ EventType.ALL = Object.values(EventType)
|
|
|
85
84
|
* @api
|
|
86
85
|
*/
|
|
87
86
|
export const PointerKeyType = {
|
|
88
|
-
LEFT: nextBit = BitCounter.getNextBit(nextBit),
|
|
89
|
-
RIGHT: nextBit = BitCounter.getNextBit(nextBit),
|
|
90
|
-
MIDDLE: nextBit = BitCounter.getNextBit(nextBit),
|
|
87
|
+
LEFT: (nextBit = BitCounter.getNextBit(nextBit)),
|
|
88
|
+
RIGHT: (nextBit = BitCounter.getNextBit(nextBit)),
|
|
89
|
+
MIDDLE: (nextBit = BitCounter.getNextBit(nextBit)),
|
|
91
90
|
ALL: 0,
|
|
92
91
|
};
|
|
93
92
|
|
|
94
|
-
PointerKeyType.ALL =
|
|
95
|
-
PointerKeyType.RIGHT |
|
|
96
|
-
PointerKeyType.MIDDLE;
|
|
93
|
+
PointerKeyType.ALL =
|
|
94
|
+
PointerKeyType.LEFT | PointerKeyType.RIGHT | PointerKeyType.MIDDLE;
|
|
97
95
|
|
|
98
96
|
/**
|
|
99
97
|
* Enumeration of pointer key events.
|
|
@@ -107,4 +105,3 @@ export const PointerEventType = {
|
|
|
107
105
|
UP: 2,
|
|
108
106
|
MOVE: 3,
|
|
109
107
|
};
|
|
110
|
-
|