@geode/opengeodeweb-front 10.30.2 → 10.31.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,172 @@
1
+ <script setup>
2
+ import ToolPanel from "@ogw_front/components/ToolPanel";
3
+ import { useDataStore } from "@ogw_front/stores/data";
4
+ import { useDebounceFn } from "@vueuse/core";
5
+ import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
6
+
7
+ const DEFAULT_SHRINK_VALUE = 0.8;
8
+ const MAX_SHRINK_VALUE = 1;
9
+ const DEBOUNCE_DELAY = 100;
10
+
11
+ const show = defineModel("show", { type: Boolean, default: false });
12
+ const dataStore = useDataStore();
13
+ const hybridViewerStore = useHybridViewerStore();
14
+ const targetAllVisible = ref(true);
15
+ const selectedDatasetIds = ref([]);
16
+ const shrinkFactor = ref(DEFAULT_SHRINK_VALUE);
17
+
18
+ const allItems = dataStore.refAllItems();
19
+ const availableDatasets = computed(() =>
20
+ allItems.value.map((item) => ({ title: item.name || item.id, value: item.id })),
21
+ );
22
+
23
+ const debouncedApply = useDebounceFn(() => applyShrink(), DEBOUNCE_DELAY);
24
+
25
+ async function applyShrink() {
26
+ const allIds = allItems.value.map((item) => item.id);
27
+ if (allIds.length === 0) {
28
+ return;
29
+ }
30
+ const targetIds = targetAllVisible.value ? allIds : selectedDatasetIds.value;
31
+ const untargetedIds = allIds.filter((id) => !targetIds.includes(id));
32
+
33
+ if (targetIds.length > 0) {
34
+ await hybridViewerStore.setShrink(targetIds, Number(shrinkFactor.value));
35
+ }
36
+ if (untargetedIds.length > 0) {
37
+ await hybridViewerStore.setShrink(untargetedIds, MAX_SHRINK_VALUE);
38
+ }
39
+ }
40
+
41
+ async function resetShrink() {
42
+ shrinkFactor.value = DEFAULT_SHRINK_VALUE;
43
+ await applyShrink();
44
+ }
45
+
46
+ async function removeShrink() {
47
+ shrinkFactor.value = MAX_SHRINK_VALUE;
48
+ const allIds = allItems.value.map((item) => item.id);
49
+ if (allIds.length > 0) {
50
+ await hybridViewerStore.setShrink(allIds, MAX_SHRINK_VALUE);
51
+ }
52
+ }
53
+
54
+ watch(shrinkFactor, () => {
55
+ debouncedApply();
56
+ });
57
+
58
+ watch(show, (visible) => {
59
+ if (visible) {
60
+ applyShrink();
61
+ }
62
+ });
63
+
64
+ watch(
65
+ [targetAllVisible, selectedDatasetIds],
66
+ () => {
67
+ if (show.value) {
68
+ applyShrink();
69
+ }
70
+ },
71
+ { deep: true },
72
+ );
73
+
74
+ watch(allItems, () => {
75
+ if (show.value) {
76
+ applyShrink();
77
+ }
78
+ });
79
+
80
+ watch(
81
+ () => Object.values(hybridViewerStore.hybridDb).filter((entry) => entry && entry.actor).length,
82
+ (actorCount) => {
83
+ if (show.value && actorCount > 0) {
84
+ applyShrink();
85
+ }
86
+ },
87
+ );
88
+ </script>
89
+
90
+ <template>
91
+ <ToolPanel v-model="show" title="Shrink Filter" :width="340" :click-outside="false">
92
+ <v-card-text class="pa-3 max-panel-height overflow-y-auto overflow-x-hidden">
93
+ <v-switch
94
+ v-model="targetAllVisible"
95
+ data-testid="shrinkTargetAllVisibleSwitch"
96
+ label="Apply to all visible datasets"
97
+ color="primary"
98
+ density="compact"
99
+ hide-details
100
+ class="mb-2 text-caption"
101
+ />
102
+
103
+ <v-select
104
+ v-if="!targetAllVisible"
105
+ v-model="selectedDatasetIds"
106
+ data-testid="shrinkSelectedDatasetsSelect"
107
+ :items="availableDatasets"
108
+ label="Select datasets"
109
+ multiple
110
+ chips
111
+ closable-chips
112
+ variant="outlined"
113
+ density="compact"
114
+ hide-details
115
+ class="mb-3 text-caption"
116
+ />
117
+
118
+ <v-divider class="my-3" />
119
+
120
+ <div class="d-flex align-center justify-space-between mb-1">
121
+ <span class="text-caption font-weight-bold">Shrink Factor</span>
122
+ <span class="text-caption text-primary font-weight-bold">
123
+ {{ (shrinkFactor * 100).toFixed(0) }}% ({{ shrinkFactor.toFixed(2) }})
124
+ </span>
125
+ </div>
126
+
127
+ <v-slider
128
+ v-model="shrinkFactor"
129
+ data-testid="shrinkFactorSlider"
130
+ min="0.0"
131
+ max="1.0"
132
+ step="0.01"
133
+ color="primary"
134
+ track-color="grey-lighten-2"
135
+ density="compact"
136
+ hide-details
137
+ class="my-2 px-1"
138
+ />
139
+ </v-card-text>
140
+
141
+ <template #actions>
142
+ <v-card-actions class="justify-space-between px-3 pb-3 pt-0">
143
+ <v-btn
144
+ data-testid="removeShrinkButton"
145
+ variant="text"
146
+ size="small"
147
+ color="error"
148
+ class="text-caption text-none"
149
+ @click="removeShrink"
150
+ >
151
+ Remove Shrink
152
+ </v-btn>
153
+ <v-btn
154
+ data-testid="resetShrinkButton"
155
+ variant="tonal"
156
+ size="small"
157
+ color="secondary"
158
+ class="text-caption text-none"
159
+ @click="resetShrink"
160
+ >
161
+ Reset
162
+ </v-btn>
163
+ </v-card-actions>
164
+ </template>
165
+ </ToolPanel>
166
+ </template>
167
+
168
+ <style scoped>
169
+ .max-panel-height {
170
+ max-height: 520px;
171
+ }
172
+ </style>
@@ -5,6 +5,7 @@ import CameraManager from "@ogw_front/components/CameraManager";
5
5
  import CameraOrientation from "@ogw_front/components/CameraOrientation";
6
6
  import ClippingPlanes from "@ogw_front/components/ClippingPlanes";
7
7
  import Screenshot from "@ogw_front/components/Screenshot";
8
+ import ShrinkFilter from "@ogw_front/components/ShrinkFilter";
8
9
  import ZScaling from "@ogw_front/components/ZScaling";
9
10
  import schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
10
11
  import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
@@ -17,6 +18,7 @@ const show_camera_manager = ref(false);
17
18
  const showCameraOrientation = ref(false);
18
19
  const showZScaling = ref(false);
19
20
  const showClippingPlanes = ref(false);
21
+ const showShrinkFilter = ref(false);
20
22
  const grid_scale = ref(false);
21
23
  const zScale = ref(hybridViewerStore.zScale);
22
24
 
@@ -162,6 +164,15 @@ const camera_options = computed(() => [
162
164
  showClippingPlanes.value = !showClippingPlanes.value;
163
165
  },
164
166
  },
167
+ {
168
+ testId: "shrinkFilterButton",
169
+ tooltip: "Shrink Filter",
170
+ icon: "mdi-arrow-collapse-all",
171
+ color: showShrinkFilter.value ? "primary" : undefined,
172
+ action: () => {
173
+ showShrinkFilter.value = !showShrinkFilter.value;
174
+ },
175
+ },
165
176
  ]);
166
177
  </script>
167
178
 
@@ -235,6 +246,7 @@ const camera_options = computed(() => [
235
246
  @apply="handleZScalingClose"
236
247
  />
237
248
  <ClippingPlanes v-model:show="showClippingPlanes" />
249
+ <ShrinkFilter v-model:show="showShrinkFilter" />
238
250
  </template>
239
251
 
240
252
  <style module>
@@ -21,7 +21,10 @@ import {
21
21
  performClearHoverHighlight,
22
22
  performClickPicking,
23
23
  performRemoveItem,
24
+ performResize,
25
+ performSetClippingPlanes,
24
26
  performSetContainer,
27
+ performSetShrink,
25
28
  performSetVisibility,
26
29
  performSetZScaling,
27
30
  } from "@ogw_internal/stores/hybrid_viewer";
@@ -138,10 +141,11 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
138
141
  }
139
142
 
140
143
  async function setClippingPlanes(ids, planes) {
141
- const schema = viewer_schemas.opengeodeweb_viewer.viewer.clipping_planes;
142
- const params = { ids, planes };
143
- await viewerStore.request({ schema, params });
144
- await remoteRender();
144
+ await performSetClippingPlanes(ids, planes, { viewerStore, viewer_schemas, remoteRender });
145
+ }
146
+
147
+ async function setShrink(ids, shrink_factor) {
148
+ await performSetShrink(ids, shrink_factor, { viewerStore, viewer_schemas, remoteRender });
145
149
  }
146
150
 
147
151
  function resetCamera() {
@@ -266,18 +270,14 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
266
270
  }
267
271
 
268
272
  async function resize(width, height) {
269
- if (viewerStore.status !== Status.CONNECTED || status.value !== Status.CREATED) {
270
- return;
271
- }
272
- const webGLRenderWindow = genericRenderWindow.value.getApiSpecificRenderWindow();
273
- const canvas = webGLRenderWindow.getCanvas();
274
- canvas.width = width;
275
- canvas.height = height;
276
- await nextTick();
277
- webGLRenderWindow.setSize(width, height);
278
- viewStream.setSize(width, height);
279
- genericRenderWindow.value.getRenderWindow().render();
280
- remoteRender();
273
+ await performResize(width, height, {
274
+ viewerStore,
275
+ status,
276
+ Status,
277
+ genericRenderWindow: genericRenderWindow.value,
278
+ viewStream,
279
+ remoteRender,
280
+ });
281
281
  }
282
282
 
283
283
  function getAverageBrightness(rect) {
@@ -315,6 +315,7 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
315
315
  setVisibility,
316
316
  setZScaling,
317
317
  setClippingPlanes,
318
+ setShrink,
318
319
  syncRemoteCamera,
319
320
  setCamera,
320
321
  initHybridViewer,
@@ -252,14 +252,49 @@ function performClear(options) {
252
252
  }
253
253
  }
254
254
 
255
+ async function performSetClippingPlanes(ids, planes, options) {
256
+ const { viewerStore, viewer_schemas, remoteRender } = options;
257
+ const schema = viewer_schemas.opengeodeweb_viewer.viewer.clipping_planes;
258
+ const params = { ids, planes };
259
+ await viewerStore.request({ schema, params });
260
+ await remoteRender();
261
+ }
262
+
263
+ async function performSetShrink(ids, shrink_factor, options) {
264
+ const { viewerStore, viewer_schemas, remoteRender } = options;
265
+ const schema = viewer_schemas.opengeodeweb_viewer.viewer.shrink;
266
+ const params = { ids, shrink_factor };
267
+ await viewerStore.request({ schema, params });
268
+ await remoteRender();
269
+ }
270
+
271
+ async function performResize(width, height, options) {
272
+ const { viewerStore, status, Status, genericRenderWindow, viewStream, remoteRender } = options;
273
+ if (viewerStore.status !== Status.CONNECTED || status.value !== Status.CREATED) {
274
+ return;
275
+ }
276
+ const webGLRenderWindow = genericRenderWindow.getApiSpecificRenderWindow();
277
+ const canvas = webGLRenderWindow.getCanvas();
278
+ canvas.width = width;
279
+ canvas.height = height;
280
+ await nextTick();
281
+ webGLRenderWindow.setSize(width, height);
282
+ viewStream.setSize(width, height);
283
+ genericRenderWindow.getRenderWindow().render();
284
+ remoteRender();
285
+ }
286
+
255
287
  export {
256
288
  performAddItem,
289
+ performClear,
257
290
  performClearHoverHighlight,
258
291
  performClickPicking,
259
292
  performHoverHighlight,
260
- performSetContainer,
261
- performSetZScaling,
262
293
  performRemoveItem,
294
+ performResize,
295
+ performSetClippingPlanes,
296
+ performSetContainer,
297
+ performSetShrink,
263
298
  performSetVisibility,
264
- performClear,
299
+ performSetZScaling,
265
300
  };
package/nuxt.config.js CHANGED
@@ -41,6 +41,9 @@ export default defineNuxtConfig({
41
41
  },
42
42
 
43
43
  vuetify: {
44
+ moduleOptions: {
45
+ prefixComposables: true,
46
+ },
44
47
  vuetifyOptions: {
45
48
  defaults: {
46
49
  VTooltip: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geode/opengeodeweb-front",
3
- "version": "10.30.2",
3
+ "version": "10.31.0-rc.1",
4
4
  "description": "OpenSource Vue/Nuxt/Pinia/Vuetify framework for web applications",
5
5
  "homepage": "https://github.com/Geode-solutions/OpenGeodeWeb-Front",
6
6
  "bugs": {
@@ -34,8 +34,8 @@
34
34
  "build": ""
35
35
  },
36
36
  "dependencies": {
37
- "@geode/opengeodeweb-back": "latest",
38
- "@geode/opengeodeweb-viewer": "latest",
37
+ "@geode/opengeodeweb-back": "next",
38
+ "@geode/opengeodeweb-viewer": "next",
39
39
  "@google-cloud/run": "3.2.0",
40
40
  "@kitware/vtk.js": "33.3.0",
41
41
  "@mdi/font": "7.4.47",