@vcmap/ui 6.3.5 → 6.3.7
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/config/base.config.json +22 -3
- package/config/concepts-show-case.config.json +4 -0
- package/dist/assets/{cesium-54ed57c9.js → cesium-a9fcdef3.js} +64804 -64777
- package/dist/assets/cesium.js +1 -1
- package/dist/assets/{core-1f683027.js → core-a6684686.js} +6371 -6330
- package/dist/assets/core-workers/panoramaImageWorker.js +1 -1
- package/dist/assets/core.js +1 -1
- package/dist/assets/ol.js +1 -1
- package/dist/assets/{ui-d660ba07.js → ui-130549f1.js} +4032 -4037
- package/dist/assets/ui.js +1 -1
- package/dist/assets/vue.js +1 -1
- package/dist/assets/{vuetify-bc604361.js → vuetify-6d0e90c9.js} +1 -1
- package/dist/assets/vuetify.js +1 -1
- package/package.json +3 -3
- package/plugins/@vcmap-show-case/tileset-feature-visibility/package.json +5 -0
- package/plugins/@vcmap-show-case/tileset-feature-visibility/src/TilesetFeatureVisibilityComponent.vue +349 -0
- package/plugins/@vcmap-show-case/tileset-feature-visibility/src/TilesetFeatureVisibilityInteraction.js +66 -0
- package/plugins/@vcmap-show-case/tileset-feature-visibility/src/index.js +135 -0
- package/plugins/package.json +4 -4
- package/src/vuePlugins/vuetify.js +2 -4
- /package/dist/assets/core-workers/{panoramaImageWorker.js-a8275fd9.js → panoramaImageWorker.js-1e5adc77.js} +0 -0
- /package/dist/assets/{ol-a164129d.js → ol-15bf8646.js} +0 -0
- /package/dist/assets/{ui-d660ba07.css → ui-130549f1.css} +0 -0
- /package/dist/assets/{vue-d940072f.js → vue-d93cd563.js} +0 -0
- /package/dist/assets/{vuetify-bc604361.css → vuetify-6d0e90c9.css} +0 -0
package/dist/assets/ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./ui-
|
|
1
|
+
export * from "./ui-130549f1.js";
|
package/dist/assets/vue.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./vue-
|
|
1
|
+
export * from "./vue-d93cd563.js";
|
|
@@ -10,7 +10,7 @@ function loadCss(href) {
|
|
|
10
10
|
elem.onerror = reject;
|
|
11
11
|
document.head.appendChild(elem);
|
|
12
12
|
});
|
|
13
|
-
} await loadCss('./assets/vuetify-
|
|
13
|
+
} await loadCss('./assets/vuetify-6d0e90c9.css');import { watch as Q, onScopeDispose as Ze, effectScope as Zl, shallowRef as K, reactive as it, computed as b, watchEffect as Fe, toRefs as Yt, capitalize as Nn, unref as ot, Fragment as ie, isVNode as Rc, Comment as Nc, warn as ja, getCurrentInstance as Hc, ref as j, provide as De, inject as ye, defineComponent as zc, h as Gt, camelize as Ir, toRaw as Be, createVNode as r, mergeProps as O, onBeforeUnmount as Qe, readonly as Ql, onMounted as Ye, onDeactivated as _r, onActivated as Wc, nextTick as we, TransitionGroup as Jl, Transition as jt, isRef as Tn, toRef as $, onBeforeMount as ra, withDirectives as $e, resolveDirective as gt, vShow as Ct, onUpdated as jc, Text as Uc, resolveDynamicComponent as Yc, markRaw as Gc, Teleport as Kc, cloneVNode as qc, createTextVNode as Tt, onUnmounted as Tr, onBeforeUpdate as Xc, withModifiers as Tl, toDisplayString as Zc, vModelText as Qc, resolveComponent as Jc, render as Ar } from "./vue-d93cd563.js";
|
|
14
14
|
function rt(e, n) {
|
|
15
15
|
let t;
|
|
16
16
|
function a() {
|
package/dist/assets/vuetify.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./vuetify-
|
|
1
|
+
export * from "./vuetify-6d0e90c9.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vcmap/ui",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.7",
|
|
4
4
|
"author": "Virtual City Systems",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
"fast-deep-equal": "^3.1.3",
|
|
51
51
|
"marked": "^15.0.7",
|
|
52
52
|
"semver": "^7.6.3",
|
|
53
|
-
"uuid": "^
|
|
53
|
+
"uuid": "^14.0.0",
|
|
54
54
|
"vue-i18n": "^9.13.1"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"@vcmap-cesium/engine": "^11.0.5",
|
|
58
|
-
"@vcmap/core": "^6.3.
|
|
58
|
+
"@vcmap/core": "^6.3.7",
|
|
59
59
|
"ol": "^10.4.0",
|
|
60
60
|
"vue": "~3.4.38",
|
|
61
61
|
"vuetify": "~3.7.14"
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-sheet>
|
|
3
|
+
<VcsFormSection heading="Tileset Layer" expandable start-open>
|
|
4
|
+
<v-container class="py-0 px-1">
|
|
5
|
+
<v-row no-gutters>
|
|
6
|
+
<v-col>
|
|
7
|
+
<VcsLabel html-for="layer-select">Layer</VcsLabel>
|
|
8
|
+
</v-col>
|
|
9
|
+
<v-col>
|
|
10
|
+
<VcsSelect
|
|
11
|
+
id="layer-select"
|
|
12
|
+
:items="layerItems"
|
|
13
|
+
v-model="selectedLayerName"
|
|
14
|
+
placeholder="Select a CesiumTilesetLayer"
|
|
15
|
+
/>
|
|
16
|
+
</v-col>
|
|
17
|
+
</v-row>
|
|
18
|
+
</v-container>
|
|
19
|
+
</VcsFormSection>
|
|
20
|
+
|
|
21
|
+
<VcsFormSection heading="Interaction" expandable start-open>
|
|
22
|
+
<v-container class="py-1 px-2">
|
|
23
|
+
<v-row no-gutters class="align-center">
|
|
24
|
+
<v-col>
|
|
25
|
+
Click to highlight, Ctrl+Click to hide, Shift+Click to hide globally
|
|
26
|
+
</v-col>
|
|
27
|
+
</v-row>
|
|
28
|
+
<v-row no-gutters class="mt-2">
|
|
29
|
+
<v-col>
|
|
30
|
+
<VcsFormButton
|
|
31
|
+
:variant="interactionActive ? 'filled' : 'outlined'"
|
|
32
|
+
:disabled="!selectedLayerName"
|
|
33
|
+
@click="toggleInteraction"
|
|
34
|
+
>
|
|
35
|
+
{{
|
|
36
|
+
interactionActive
|
|
37
|
+
? 'Deactivate Interaction'
|
|
38
|
+
: 'Activate Interaction'
|
|
39
|
+
}}
|
|
40
|
+
</VcsFormButton>
|
|
41
|
+
</v-col>
|
|
42
|
+
</v-row>
|
|
43
|
+
</v-container>
|
|
44
|
+
</VcsFormSection>
|
|
45
|
+
|
|
46
|
+
<VcsFormSection
|
|
47
|
+
v-if="highlightedIds.length > 0"
|
|
48
|
+
heading="Highlighted Features"
|
|
49
|
+
expandable
|
|
50
|
+
start-open
|
|
51
|
+
:header-actions="highlightedHeaderActions"
|
|
52
|
+
>
|
|
53
|
+
<VcsList :items="highlightedListItems" :show-title="false" />
|
|
54
|
+
</VcsFormSection>
|
|
55
|
+
|
|
56
|
+
<VcsFormSection
|
|
57
|
+
v-if="globallyHiddenIds.length > 0"
|
|
58
|
+
heading="Globally Hidden Features"
|
|
59
|
+
expandable
|
|
60
|
+
start-open
|
|
61
|
+
:header-actions="globallyHiddenHeaderActions"
|
|
62
|
+
>
|
|
63
|
+
<VcsList :items="globallyHiddenListItems" :show-title="false" />
|
|
64
|
+
</VcsFormSection>
|
|
65
|
+
|
|
66
|
+
<VcsFormSection
|
|
67
|
+
v-if="hiddenIds.length > 0"
|
|
68
|
+
heading="Hidden Features"
|
|
69
|
+
expandable
|
|
70
|
+
start-open
|
|
71
|
+
:header-actions="hiddenHeaderActions"
|
|
72
|
+
>
|
|
73
|
+
<VcsList :items="hiddenListItems" :show-title="false" />
|
|
74
|
+
</VcsFormSection>
|
|
75
|
+
</v-sheet>
|
|
76
|
+
</template>
|
|
77
|
+
|
|
78
|
+
<script>
|
|
79
|
+
import { computed, inject, onUnmounted, ref, watch } from 'vue';
|
|
80
|
+
import {
|
|
81
|
+
CesiumTilesetLayer,
|
|
82
|
+
I3SLayer,
|
|
83
|
+
VectorLayer,
|
|
84
|
+
VectorTileLayer,
|
|
85
|
+
} from '@vcmap/core';
|
|
86
|
+
import {
|
|
87
|
+
VcsFormButton,
|
|
88
|
+
VcsFormSection,
|
|
89
|
+
VcsList,
|
|
90
|
+
VcsLabel,
|
|
91
|
+
VcsSelect,
|
|
92
|
+
} from '@vcmap/ui';
|
|
93
|
+
import { VSheet, VContainer, VRow, VCol } from 'vuetify/components';
|
|
94
|
+
import { name } from '../package.json';
|
|
95
|
+
|
|
96
|
+
export const windowId = 'tileset-feature-visibility-window';
|
|
97
|
+
|
|
98
|
+
export default {
|
|
99
|
+
name: 'TilesetFeatureVisibilityComponent',
|
|
100
|
+
components: {
|
|
101
|
+
VSheet,
|
|
102
|
+
VContainer,
|
|
103
|
+
VRow,
|
|
104
|
+
VCol,
|
|
105
|
+
VcsFormButton,
|
|
106
|
+
VcsFormSection,
|
|
107
|
+
VcsList,
|
|
108
|
+
VcsLabel,
|
|
109
|
+
VcsSelect,
|
|
110
|
+
},
|
|
111
|
+
setup() {
|
|
112
|
+
/** @type {import('@vcmap/ui').VcsUiApp} */
|
|
113
|
+
const app = inject('vcsApp');
|
|
114
|
+
const plugin = app.plugins.getByKey(name);
|
|
115
|
+
|
|
116
|
+
const selectedLayerName = ref(null);
|
|
117
|
+
const interactionActive = ref(false);
|
|
118
|
+
const highlightedIds = ref([]);
|
|
119
|
+
const hiddenIds = ref([]);
|
|
120
|
+
const { globallyHiddenIds } = plugin;
|
|
121
|
+
|
|
122
|
+
let visibilityListener = null;
|
|
123
|
+
|
|
124
|
+
function buildLayerItems() {
|
|
125
|
+
return [...app.layers]
|
|
126
|
+
.filter(
|
|
127
|
+
(l) =>
|
|
128
|
+
l instanceof CesiumTilesetLayer ||
|
|
129
|
+
l instanceof I3SLayer ||
|
|
130
|
+
l instanceof VectorLayer ||
|
|
131
|
+
l instanceof VectorTileLayer,
|
|
132
|
+
)
|
|
133
|
+
.map((l) => ({ title: l.properties.title || l.name, value: l.name }));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const layerItems = ref(buildLayerItems());
|
|
137
|
+
const layerListeners = [
|
|
138
|
+
app.layers.added.addEventListener(() => {
|
|
139
|
+
layerItems.value = buildLayerItems();
|
|
140
|
+
}),
|
|
141
|
+
app.layers.removed.addEventListener(() => {
|
|
142
|
+
layerItems.value = buildLayerItems();
|
|
143
|
+
}),
|
|
144
|
+
];
|
|
145
|
+
|
|
146
|
+
/** @returns {import('@vcmap/core').CesiumTilesetLayer|null} */
|
|
147
|
+
function getSelectedLayer() {
|
|
148
|
+
if (!selectedLayerName.value) return null;
|
|
149
|
+
return /** @type {import('@vcmap/core').CesiumTilesetLayer} */ (
|
|
150
|
+
app.layers.getByKey(selectedLayerName.value)
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function syncVisibilityState() {
|
|
155
|
+
const layer = getSelectedLayer();
|
|
156
|
+
if (!layer) {
|
|
157
|
+
highlightedIds.value = [];
|
|
158
|
+
hiddenIds.value = [];
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
highlightedIds.value = Object.keys(
|
|
162
|
+
layer.featureVisibility.highlightedObjects,
|
|
163
|
+
);
|
|
164
|
+
hiddenIds.value = Object.keys(layer.featureVisibility.hiddenObjects);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
watch(selectedLayerName, () => {
|
|
168
|
+
// Deactivate interaction when layer changes
|
|
169
|
+
if (interactionActive.value) {
|
|
170
|
+
plugin.deactivateInteraction();
|
|
171
|
+
interactionActive.value = false;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Remove old listener
|
|
175
|
+
if (visibilityListener) {
|
|
176
|
+
visibilityListener();
|
|
177
|
+
visibilityListener = null;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Set up new listener
|
|
181
|
+
const layer = getSelectedLayer();
|
|
182
|
+
if (layer) {
|
|
183
|
+
visibilityListener = layer.featureVisibility.changed.addEventListener(
|
|
184
|
+
() => {
|
|
185
|
+
syncVisibilityState();
|
|
186
|
+
},
|
|
187
|
+
);
|
|
188
|
+
syncVisibilityState();
|
|
189
|
+
} else {
|
|
190
|
+
highlightedIds.value = [];
|
|
191
|
+
hiddenIds.value = [];
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
function toggleInteraction() {
|
|
196
|
+
if (!selectedLayerName.value) return;
|
|
197
|
+
if (interactionActive.value) {
|
|
198
|
+
plugin.deactivateInteraction();
|
|
199
|
+
interactionActive.value = false;
|
|
200
|
+
} else {
|
|
201
|
+
const layer = getSelectedLayer();
|
|
202
|
+
if (layer) {
|
|
203
|
+
plugin.activateInteraction(layer, () => {
|
|
204
|
+
// Called when the interaction is forcefully removed by another tool
|
|
205
|
+
interactionActive.value = false;
|
|
206
|
+
});
|
|
207
|
+
interactionActive.value = true;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function showAllFeatures() {
|
|
213
|
+
const layer = getSelectedLayer();
|
|
214
|
+
if (layer) {
|
|
215
|
+
layer.featureVisibility.clearHiddenObjects();
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function clearHighlights() {
|
|
220
|
+
const layer = getSelectedLayer();
|
|
221
|
+
if (layer) {
|
|
222
|
+
layer.featureVisibility.clearHighlighting();
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function unhighlightFeature(id) {
|
|
227
|
+
const layer = getSelectedLayer();
|
|
228
|
+
if (layer) {
|
|
229
|
+
layer.featureVisibility.unHighlight([id]);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function showFeature(id) {
|
|
234
|
+
const layer = getSelectedLayer();
|
|
235
|
+
if (layer) {
|
|
236
|
+
layer.featureVisibility.showObjects([id]);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function globalShowObject(id) {
|
|
241
|
+
plugin.globalShowObject(id);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function clearGloballyHidden() {
|
|
245
|
+
plugin.clearGloballyHidden();
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
const highlightedListItems = computed(() =>
|
|
249
|
+
highlightedIds.value.map((id) => ({
|
|
250
|
+
name: id,
|
|
251
|
+
title: id,
|
|
252
|
+
actions: [
|
|
253
|
+
{
|
|
254
|
+
name: 'unhighlight',
|
|
255
|
+
icon: 'mdi-eye-off-outline',
|
|
256
|
+
tooltip: 'Unhighlight feature',
|
|
257
|
+
callback: () => unhighlightFeature(id),
|
|
258
|
+
},
|
|
259
|
+
],
|
|
260
|
+
})),
|
|
261
|
+
);
|
|
262
|
+
|
|
263
|
+
const hiddenListItems = computed(() =>
|
|
264
|
+
hiddenIds.value.map((id) => ({
|
|
265
|
+
name: id,
|
|
266
|
+
title: id,
|
|
267
|
+
actions: [
|
|
268
|
+
{
|
|
269
|
+
name: 'show',
|
|
270
|
+
icon: 'mdi-eye-outline',
|
|
271
|
+
tooltip: 'Show feature',
|
|
272
|
+
callback: () => showFeature(id),
|
|
273
|
+
},
|
|
274
|
+
],
|
|
275
|
+
})),
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
const globallyHiddenListItems = computed(() =>
|
|
279
|
+
globallyHiddenIds.value.map((id) => ({
|
|
280
|
+
name: id,
|
|
281
|
+
title: id,
|
|
282
|
+
actions: [
|
|
283
|
+
{
|
|
284
|
+
name: 'globalShow',
|
|
285
|
+
icon: 'mdi-eye-outline',
|
|
286
|
+
tooltip: 'Show feature globally',
|
|
287
|
+
callback: () => globalShowObject(id),
|
|
288
|
+
},
|
|
289
|
+
],
|
|
290
|
+
})),
|
|
291
|
+
);
|
|
292
|
+
|
|
293
|
+
const highlightedHeaderActions = computed(() => [
|
|
294
|
+
{
|
|
295
|
+
name: 'clearHighlights',
|
|
296
|
+
icon: 'mdi-close-circle-outline',
|
|
297
|
+
tooltip: 'Clear All Highlights',
|
|
298
|
+
callback: clearHighlights,
|
|
299
|
+
},
|
|
300
|
+
]);
|
|
301
|
+
|
|
302
|
+
const hiddenHeaderActions = computed(() => [
|
|
303
|
+
{
|
|
304
|
+
name: 'showAllHidden',
|
|
305
|
+
icon: 'mdi-eye-outline',
|
|
306
|
+
tooltip: 'Show All Hidden Features',
|
|
307
|
+
callback: showAllFeatures,
|
|
308
|
+
},
|
|
309
|
+
]);
|
|
310
|
+
|
|
311
|
+
const globallyHiddenHeaderActions = computed(() => [
|
|
312
|
+
{
|
|
313
|
+
name: 'clearGloballyHidden',
|
|
314
|
+
icon: 'mdi-eye-outline',
|
|
315
|
+
tooltip: 'Show All Globally Hidden',
|
|
316
|
+
callback: clearGloballyHidden,
|
|
317
|
+
},
|
|
318
|
+
]);
|
|
319
|
+
|
|
320
|
+
onUnmounted(() => {
|
|
321
|
+
layerListeners.forEach((cb) => cb());
|
|
322
|
+
if (visibilityListener) {
|
|
323
|
+
visibilityListener();
|
|
324
|
+
visibilityListener = null;
|
|
325
|
+
}
|
|
326
|
+
if (interactionActive.value) {
|
|
327
|
+
plugin.deactivateInteraction();
|
|
328
|
+
interactionActive.value = false;
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
return {
|
|
333
|
+
layerItems,
|
|
334
|
+
selectedLayerName,
|
|
335
|
+
interactionActive,
|
|
336
|
+
highlightedIds,
|
|
337
|
+
hiddenIds,
|
|
338
|
+
globallyHiddenIds,
|
|
339
|
+
toggleInteraction,
|
|
340
|
+
highlightedListItems,
|
|
341
|
+
hiddenListItems,
|
|
342
|
+
globallyHiddenListItems,
|
|
343
|
+
highlightedHeaderActions,
|
|
344
|
+
hiddenHeaderActions,
|
|
345
|
+
globallyHiddenHeaderActions,
|
|
346
|
+
};
|
|
347
|
+
},
|
|
348
|
+
};
|
|
349
|
+
</script>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AbstractInteraction,
|
|
3
|
+
EventType,
|
|
4
|
+
ModificationKeyType,
|
|
5
|
+
vcsLayerName,
|
|
6
|
+
VectorStyleItem,
|
|
7
|
+
} from '@vcmap/core';
|
|
8
|
+
|
|
9
|
+
/** @type {import('@vcmap/core').VectorStyleItem} */
|
|
10
|
+
const defaultHighlightStyle = new VectorStyleItem({
|
|
11
|
+
fill: { color: [255, 215, 0, 0.8] },
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Interaction that allows highlighting and hiding features of a CesiumTilesetLayer.
|
|
16
|
+
* - Click on a feature: toggle highlight
|
|
17
|
+
* - Ctrl/Cmd + Click on a feature: hide the feature via featureVisibility
|
|
18
|
+
* - Shift + Click on a feature: hide the feature globally via globalHider
|
|
19
|
+
*/
|
|
20
|
+
export default class TilesetFeatureVisibilityInteraction extends AbstractInteraction {
|
|
21
|
+
/**
|
|
22
|
+
* @param {import('@vcmap/core').CesiumTilesetLayer} layer
|
|
23
|
+
* @param {function(string):void} globalHideCallback - called with the feature id when globally hiding
|
|
24
|
+
*/
|
|
25
|
+
constructor(layer, globalHideCallback) {
|
|
26
|
+
super(EventType.CLICK, ModificationKeyType.ALL);
|
|
27
|
+
/** @type {import('@vcmap/core').CesiumTilesetLayer} */
|
|
28
|
+
this._layer = layer;
|
|
29
|
+
/** @type {function(string):void} */
|
|
30
|
+
this._globalHideCallback = globalHideCallback;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @param {import('@vcmap/core').InteractionEvent} event
|
|
35
|
+
* @returns {Promise<import('@vcmap/core').InteractionEvent>}
|
|
36
|
+
*/
|
|
37
|
+
pipe(event) {
|
|
38
|
+
const { feature } = event;
|
|
39
|
+
if (feature && feature[vcsLayerName] === this._layer.name) {
|
|
40
|
+
const id = String(feature.getId());
|
|
41
|
+
const { featureVisibility } = this._layer;
|
|
42
|
+
|
|
43
|
+
if (event.key === ModificationKeyType.CTRL) {
|
|
44
|
+
// Ctrl/Cmd + Click: hide the feature via featureVisibility
|
|
45
|
+
featureVisibility.hideObjects([id]);
|
|
46
|
+
event.stopPropagation = true;
|
|
47
|
+
} else if (event.key === ModificationKeyType.SHIFT) {
|
|
48
|
+
// Shift + Click: hide the feature globally via globalHider
|
|
49
|
+
this._globalHideCallback(id);
|
|
50
|
+
event.stopPropagation = true;
|
|
51
|
+
} else if (event.key === ModificationKeyType.NONE) {
|
|
52
|
+
// Click: toggle highlight
|
|
53
|
+
if (featureVisibility.highlightedObjects[id]) {
|
|
54
|
+
featureVisibility.unHighlight([id]);
|
|
55
|
+
} else {
|
|
56
|
+
const highlightStyle =
|
|
57
|
+
this._layer.highlightStyle ?? defaultHighlightStyle;
|
|
58
|
+
featureVisibility.highlight({ [id]: highlightStyle });
|
|
59
|
+
}
|
|
60
|
+
event.stopPropagation = true;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return Promise.resolve(event);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
import { ButtonLocation, createToggleAction, WindowSlot } from '@vcmap/ui';
|
|
3
|
+
import { name, version, mapVersion } from '../package.json';
|
|
4
|
+
import TilesetFeatureVisibilityComponent, {
|
|
5
|
+
windowId,
|
|
6
|
+
} from './TilesetFeatureVisibilityComponent.vue';
|
|
7
|
+
import TilesetFeatureVisibilityInteraction from './TilesetFeatureVisibilityInteraction.js';
|
|
8
|
+
|
|
9
|
+
export default function tilesetFeatureVisibilityPlugin() {
|
|
10
|
+
/** @type {(() => number)|null} */
|
|
11
|
+
let removeInteraction = null;
|
|
12
|
+
/** @type {TilesetFeatureVisibilityInteraction|null} */
|
|
13
|
+
let interaction = null;
|
|
14
|
+
/** @type {import('@vcmap/ui').VcsUiApp|null} */
|
|
15
|
+
let vcsApp = null;
|
|
16
|
+
/** @type {import('vue').Ref<string[]>} */
|
|
17
|
+
const globallyHiddenIds = ref([]);
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
get name() {
|
|
21
|
+
return name;
|
|
22
|
+
},
|
|
23
|
+
get version() {
|
|
24
|
+
return version;
|
|
25
|
+
},
|
|
26
|
+
get mapVersion() {
|
|
27
|
+
return mapVersion;
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Activate the tileset feature visibility interaction for the given layer.
|
|
32
|
+
* @param {import('@vcmap/core').CesiumTilesetLayer} layer
|
|
33
|
+
* @param {function():void} [onRemoved] - called if the interaction is forcefully removed
|
|
34
|
+
*/
|
|
35
|
+
activateInteraction(layer, onRemoved) {
|
|
36
|
+
if (removeInteraction) {
|
|
37
|
+
removeInteraction();
|
|
38
|
+
removeInteraction = null;
|
|
39
|
+
}
|
|
40
|
+
interaction = new TilesetFeatureVisibilityInteraction(layer, (id) => {
|
|
41
|
+
vcsApp.layers.globalHider.hideObjects([id]);
|
|
42
|
+
if (!globallyHiddenIds.value.includes(id)) {
|
|
43
|
+
globallyHiddenIds.value = [...globallyHiddenIds.value, id];
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
removeInteraction = vcsApp.maps.eventHandler.addExclusiveInteraction(
|
|
47
|
+
interaction,
|
|
48
|
+
() => {
|
|
49
|
+
interaction = null;
|
|
50
|
+
removeInteraction = null;
|
|
51
|
+
onRemoved?.();
|
|
52
|
+
},
|
|
53
|
+
undefined,
|
|
54
|
+
name,
|
|
55
|
+
);
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Deactivate the tileset feature visibility interaction.
|
|
60
|
+
*/
|
|
61
|
+
deactivateInteraction() {
|
|
62
|
+
if (removeInteraction) {
|
|
63
|
+
removeInteraction();
|
|
64
|
+
removeInteraction = null;
|
|
65
|
+
}
|
|
66
|
+
interaction = null;
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Show a feature that was globally hidden by this plugin.
|
|
71
|
+
* @param {string} id
|
|
72
|
+
*/
|
|
73
|
+
globalShowObject(id) {
|
|
74
|
+
vcsApp.layers.globalHider.showObjects([id]);
|
|
75
|
+
globallyHiddenIds.value = globallyHiddenIds.value.filter((i) => i !== id);
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Show all features that were globally hidden by this plugin.
|
|
80
|
+
*/
|
|
81
|
+
clearGloballyHidden() {
|
|
82
|
+
const ids = [...globallyHiddenIds.value];
|
|
83
|
+
vcsApp.layers.globalHider.showObjects(ids);
|
|
84
|
+
globallyHiddenIds.value = [];
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Reactive ref of feature ids globally hidden by this plugin.
|
|
89
|
+
* @type {import('vue').Ref<string[]>}
|
|
90
|
+
*/
|
|
91
|
+
get globallyHiddenIds() {
|
|
92
|
+
return globallyHiddenIds;
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @param {import('@vcmap/ui').VcsUiApp} app
|
|
97
|
+
*/
|
|
98
|
+
initialize(app) {
|
|
99
|
+
vcsApp = app;
|
|
100
|
+
|
|
101
|
+
const { action, destroy } = createToggleAction(
|
|
102
|
+
{
|
|
103
|
+
name: 'Tileset Feature Visibility',
|
|
104
|
+
title: 'Tileset Feature Visibility',
|
|
105
|
+
icon: 'mdi-layers-search',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: windowId,
|
|
109
|
+
state: {
|
|
110
|
+
headerTitle: 'Tileset Feature Visibility',
|
|
111
|
+
headerIcon: 'mdi-layers-search',
|
|
112
|
+
},
|
|
113
|
+
component: TilesetFeatureVisibilityComponent,
|
|
114
|
+
slot: WindowSlot.DYNAMIC_LEFT,
|
|
115
|
+
},
|
|
116
|
+
app.windowManager,
|
|
117
|
+
name,
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
app.navbarManager.add(
|
|
121
|
+
{ id: 'tileset-feature-visibility', action },
|
|
122
|
+
name,
|
|
123
|
+
ButtonLocation.TOOL,
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
this._destroy = destroy;
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
destroy() {
|
|
130
|
+
this.deactivateInteraction();
|
|
131
|
+
this.clearGloballyHidden();
|
|
132
|
+
this._destroy?.();
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
}
|
package/plugins/package.json
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
"dependencies": {
|
|
3
3
|
"@vcmap/print": "^4.0.0",
|
|
4
4
|
"@vcmap/walk": "^2.0.0",
|
|
5
|
-
"@vcmap/clipping-tool": "^
|
|
5
|
+
"@vcmap/clipping-tool": "^4.0.0",
|
|
6
6
|
"@vcmap/transparent-terrain": "^3.0.0",
|
|
7
7
|
"@vcmap/height-profile": "^3.0.0",
|
|
8
8
|
"@vcmap/flight": "^3.0.0",
|
|
9
9
|
"@vcmap/swipe-tool": "^4.0.0",
|
|
10
|
-
"@vcmap/export": "^2.
|
|
11
|
-
"@vcmap/viewshed": "^4.
|
|
10
|
+
"@vcmap/export": "^2.1.0",
|
|
11
|
+
"@vcmap/viewshed": "^4.1.0",
|
|
12
12
|
"@vcmap/measurement": "^5.0.0",
|
|
13
13
|
"@vcmap/multi-view": "^3.0.0",
|
|
14
14
|
"@vcmap/draw": "^5.0.0",
|
|
15
|
-
"@vcmap/shadow": "^3.
|
|
15
|
+
"@vcmap/shadow": "^3.1.0",
|
|
16
16
|
"@vcmap/search-wfs": "^2.1.0",
|
|
17
17
|
"@vcmap/search-esri": "^3.0.0",
|
|
18
18
|
"@vcmap/search-coordinate": "^2.0.0",
|
|
@@ -358,11 +358,9 @@ export function useFontSize() {
|
|
|
358
358
|
export function isMobileLandscape() {
|
|
359
359
|
const display = useDisplay();
|
|
360
360
|
return computed(() => {
|
|
361
|
-
// Check if the device is a mobile platform (e.g., Android, iOS
|
|
361
|
+
// Check if the device is a mobile platform (e.g., Android, iOS)
|
|
362
362
|
const isMobilePlatform =
|
|
363
|
-
display.platform.value.android ||
|
|
364
|
-
display.platform.value.ios ||
|
|
365
|
-
display.platform.value.touch;
|
|
363
|
+
display.platform.value.android || display.platform.value.ios;
|
|
366
364
|
|
|
367
365
|
// Check if the device height is less than the threshold for SM
|
|
368
366
|
const isHeightXs = display.height.value <= display.thresholds.value.sm;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|