@geode/opengeodeweb-front 10.18.0-rc.3 → 10.18.0
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.
|
@@ -137,11 +137,19 @@ function handleHoverLeave({ item }) {
|
|
|
137
137
|
</template>
|
|
138
138
|
|
|
139
139
|
<template #append="{ item }">
|
|
140
|
+
<v-btn
|
|
141
|
+
v-if="item.viewer_type"
|
|
142
|
+
icon="mdi-target"
|
|
143
|
+
size="medium"
|
|
144
|
+
variant="text"
|
|
145
|
+
v-tooltip="'Focus camera on object'"
|
|
146
|
+
@click.stop="hybridViewerStore.focusCameraOnObject(item.id)"
|
|
147
|
+
/>
|
|
140
148
|
<v-btn
|
|
141
149
|
v-if="isModel(item)"
|
|
142
150
|
icon="mdi-magnify-expand"
|
|
143
151
|
size="medium"
|
|
144
|
-
class="ml-
|
|
152
|
+
class="ml-2"
|
|
145
153
|
variant="text"
|
|
146
154
|
v-tooltip="'Model\'s mesh components'"
|
|
147
155
|
@click.stop="
|
|
@@ -5,11 +5,13 @@ import FetchingData from "@ogw_front/components/FetchingData.vue";
|
|
|
5
5
|
import ObjectTreeControls from "@ogw_front/components/Viewer/ObjectTree/Base/Controls.vue";
|
|
6
6
|
import ObjectTreeItemLabel from "@ogw_front/components/Viewer/ObjectTree/Base/ItemLabel.vue";
|
|
7
7
|
import { useHoverhighlight } from "@ogw_front/composables/hover_highlight";
|
|
8
|
+
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
8
9
|
import { useModelComponents } from "@ogw_front/composables/model_components";
|
|
9
10
|
import { useTreeviewStore } from "@ogw_front/stores/treeview";
|
|
10
11
|
|
|
11
12
|
const { id } = defineProps({ id: { type: String, required: true } });
|
|
12
13
|
const { onHoverEnter, onHoverLeave } = useHoverhighlight();
|
|
14
|
+
const hybridViewerStore = useHybridViewerStore();
|
|
13
15
|
const emit = defineEmits(["show-menu"]);
|
|
14
16
|
|
|
15
17
|
const treeviewStore = useTreeviewStore();
|
|
@@ -150,6 +152,22 @@ function handleHoverLeave() {
|
|
|
150
152
|
@contextmenu.prevent.stop="showContextMenu($event, item)"
|
|
151
153
|
/>
|
|
152
154
|
</template>
|
|
155
|
+
|
|
156
|
+
<template #append="{ item }">
|
|
157
|
+
<v-btn
|
|
158
|
+
v-if="item.category || (item.children && item.children.length > 0)"
|
|
159
|
+
icon="mdi-target"
|
|
160
|
+
size="medium"
|
|
161
|
+
variant="text"
|
|
162
|
+
v-tooltip="'Focus camera on object'"
|
|
163
|
+
@click.stop="
|
|
164
|
+
hybridViewerStore.focusCameraOnObject(
|
|
165
|
+
id,
|
|
166
|
+
item.category ? [item.viewer_id] : item.children.map((child) => child.viewer_id),
|
|
167
|
+
)
|
|
168
|
+
"
|
|
169
|
+
/>
|
|
170
|
+
</template>
|
|
153
171
|
</CommonTreeView>
|
|
154
172
|
</div>
|
|
155
173
|
</template>
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
getCameraOptions,
|
|
8
8
|
performCameraOrientation,
|
|
9
9
|
performClickPicking,
|
|
10
|
+
performFocusCameraOnObject,
|
|
10
11
|
performSetCamera,
|
|
11
12
|
} from "@ogw_internal/stores/hybrid_viewer";
|
|
12
13
|
import { newInstance as vtkActor } from "@kitware/vtk.js/Rendering/Core/Actor";
|
|
@@ -144,9 +145,13 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
144
145
|
syncRemoteCamera();
|
|
145
146
|
}
|
|
146
147
|
|
|
147
|
-
function
|
|
148
|
-
|
|
148
|
+
async function focusCameraOnObject(id, block_ids = []) {
|
|
149
|
+
await performFocusCameraOnObject(id, {
|
|
150
|
+
hybridDb,
|
|
151
|
+
viewerStore,
|
|
152
|
+
viewer_schemas,
|
|
149
153
|
genericRenderWindow: genericRenderWindow.value,
|
|
154
|
+
block_ids,
|
|
150
155
|
is_moving,
|
|
151
156
|
imageStyle,
|
|
152
157
|
syncRemoteCamera,
|
|
@@ -162,6 +167,15 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
162
167
|
});
|
|
163
168
|
}
|
|
164
169
|
|
|
170
|
+
function setCamera(targetCameraOptions) {
|
|
171
|
+
performSetCamera(targetCameraOptions, {
|
|
172
|
+
genericRenderWindow: genericRenderWindow.value,
|
|
173
|
+
is_moving,
|
|
174
|
+
imageStyle,
|
|
175
|
+
syncRemoteCamera,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
165
179
|
function syncRemoteCamera() {
|
|
166
180
|
const camera = genericRenderWindow.value.getRenderer().getActiveCamera();
|
|
167
181
|
const options = getCameraOptions(camera);
|
|
@@ -217,6 +231,9 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
217
231
|
is_moving.value = false;
|
|
218
232
|
syncRemoteCamera();
|
|
219
233
|
}
|
|
234
|
+
is_moving.value = false;
|
|
235
|
+
genericRenderWindow.value.getRenderer().resetCameraClippingRange();
|
|
236
|
+
syncRemoteCamera();
|
|
220
237
|
},
|
|
221
238
|
});
|
|
222
239
|
useEventListener(container, "wheel", () => {
|
|
@@ -227,6 +244,7 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
227
244
|
clearTimeout(wheelEventEndTimeout);
|
|
228
245
|
wheelEventEndTimeout = setTimeout(() => {
|
|
229
246
|
is_moving.value = false;
|
|
247
|
+
genericRenderWindow.value.getRenderer().resetCameraClippingRange();
|
|
230
248
|
syncRemoteCamera();
|
|
231
249
|
}, WHEEL_TIME_OUT_MS);
|
|
232
250
|
});
|
|
@@ -294,6 +312,7 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
294
312
|
remoteRender,
|
|
295
313
|
resize,
|
|
296
314
|
resetCamera,
|
|
315
|
+
focusCameraOnObject,
|
|
297
316
|
setCameraOrientation,
|
|
298
317
|
setContainer,
|
|
299
318
|
zScale,
|
|
@@ -235,6 +235,47 @@ function performCameraOrientation(orientation, options) {
|
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
+
async function performFocusCameraOnObject(id, options) {
|
|
239
|
+
const {
|
|
240
|
+
hybridDb,
|
|
241
|
+
viewerStore,
|
|
242
|
+
viewer_schemas,
|
|
243
|
+
genericRenderWindow,
|
|
244
|
+
block_ids = [],
|
|
245
|
+
is_moving,
|
|
246
|
+
imageStyle,
|
|
247
|
+
syncRemoteCamera,
|
|
248
|
+
} = options;
|
|
249
|
+
|
|
250
|
+
if (!hybridDb[id]) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
let bounds = [];
|
|
255
|
+
if (block_ids.length > 0) {
|
|
256
|
+
bounds = await viewerStore.request(viewer_schemas.opengeodeweb_viewer.model.get_blocks_bounds, {
|
|
257
|
+
id,
|
|
258
|
+
block_ids,
|
|
259
|
+
});
|
|
260
|
+
} else {
|
|
261
|
+
bounds = hybridDb[id].actor.getBounds();
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const renderer = genericRenderWindow.getRenderer();
|
|
265
|
+
const camera = renderer.getActiveCamera();
|
|
266
|
+
const startOptions = getCameraOptions(camera);
|
|
267
|
+
renderer.resetCamera(bounds);
|
|
268
|
+
const targetOptions = getCameraOptions(camera);
|
|
269
|
+
applyCameraOptions(camera, startOptions);
|
|
270
|
+
|
|
271
|
+
performSetCamera(targetOptions, {
|
|
272
|
+
genericRenderWindow,
|
|
273
|
+
is_moving,
|
|
274
|
+
imageStyle,
|
|
275
|
+
syncRemoteCamera,
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
|
|
238
279
|
export {
|
|
239
280
|
BACKGROUND_COLOR,
|
|
240
281
|
ACTOR_COLOR,
|
|
@@ -250,5 +291,6 @@ export {
|
|
|
250
291
|
getCameraOptions,
|
|
251
292
|
performCameraOrientation,
|
|
252
293
|
performClickPicking,
|
|
294
|
+
performFocusCameraOnObject,
|
|
253
295
|
performSetCamera,
|
|
254
296
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geode/opengeodeweb-front",
|
|
3
|
-
"version": "10.18.0
|
|
3
|
+
"version": "10.18.0",
|
|
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": "
|
|
38
|
-
"@geode/opengeodeweb-viewer": "
|
|
37
|
+
"@geode/opengeodeweb-back": "latest",
|
|
38
|
+
"@geode/opengeodeweb-viewer": "latest",
|
|
39
39
|
"@google-cloud/run": "3.2.0",
|
|
40
40
|
"@kitware/vtk.js": "33.3.0",
|
|
41
41
|
"@mdi/font": "7.4.47",
|