@geode/opengeodeweb-front 10.3.0 → 10.3.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.
- package/.eslintrc.cjs +1 -0
- package/app/assets/geode_objects.js +1 -3
- package/app/components/Carousel.vue +7 -4
- package/app/components/CrsSelector.vue +5 -6
- package/app/components/DragAndDrop.vue +18 -8
- package/app/components/ExtensionSelector.vue +9 -17
- package/app/components/FeedBack/ErrorBanner.vue +1 -1
- package/app/components/FeedBack/Snackers.vue +4 -1
- package/app/components/FileSelector.vue +21 -10
- package/app/components/FileUploader.vue +15 -32
- package/app/components/HybridRenderingView.vue +5 -3
- package/app/components/Inspector/InspectionButton.vue +2 -2
- package/app/components/Inspector/ResultPanel.vue +4 -4
- package/app/components/Launcher.vue +1 -1
- package/app/components/Loading.vue +6 -6
- package/app/components/MissingFilesSelector.vue +23 -29
- package/app/components/ObjectSelector.vue +11 -10
- package/app/components/OptionCard.vue +1 -1
- package/app/components/PackagesVersions.vue +5 -3
- package/app/components/Recaptcha.vue +6 -4
- package/app/components/RemoteRenderingView.vue +4 -3
- package/app/components/Screenshot.vue +4 -4
- package/app/components/Step.vue +7 -7
- package/app/components/VeaseViewToolbar.vue +3 -3
- package/app/components/Viewer/BreadCrumb.vue +2 -4
- package/app/components/Viewer/ContextMenu.vue +77 -45
- package/app/components/Viewer/ContextMenuItem.vue +42 -33
- package/app/components/Viewer/EdgedCurve/PointsOptions.vue +3 -3
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +5 -5
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +6 -6
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +5 -5
- package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +5 -5
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +6 -7
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +6 -6
- package/app/components/Viewer/Generic/Model/EdgesOptions.vue +3 -3
- package/app/components/Viewer/Generic/Model/PointsOptions.vue +4 -4
- package/app/components/Viewer/Grid/2D/CellsOptions.vue +3 -3
- package/app/components/Viewer/Grid/2D/EdgesOptions.vue +3 -3
- package/app/components/Viewer/Grid/2D/PointsOptions.vue +3 -3
- package/app/components/Viewer/Grid/3D/CellsOptions.vue +3 -3
- package/app/components/Viewer/Grid/3D/EdgesOptions.vue +3 -3
- package/app/components/Viewer/Grid/3D/FacetsOptions.vue +3 -3
- package/app/components/Viewer/Grid/3D/PointsOptions.vue +3 -3
- package/app/components/Viewer/HybridSolid/EdgesOptions.vue +3 -3
- package/app/components/Viewer/HybridSolid/PointsOptions.vue +3 -3
- package/app/components/Viewer/HybridSolid/PolygonsOptions.vue +3 -3
- package/app/components/Viewer/HybridSolid/PolyhedraOptions.vue +3 -3
- package/app/components/Viewer/Options/CellAttributeSelector.vue +23 -20
- package/app/components/Viewer/Options/ColorMapList.vue +75 -50
- package/app/components/Viewer/Options/ColorMapPicker.vue +38 -32
- package/app/components/Viewer/Options/ColorPicker.vue +3 -3
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +29 -21
- package/app/components/Viewer/Options/EdgeAttributeSelector.vue +7 -7
- package/app/components/Viewer/Options/PolygonAttributeSelector.vue +7 -7
- package/app/components/Viewer/Options/PolyhedronAttributeSelector.vue +7 -7
- package/app/components/Viewer/Options/TextureItem.vue +5 -5
- package/app/components/Viewer/Options/TexturesSelector.vue +5 -5
- package/app/components/Viewer/Options/VertexAttributeSelector.vue +7 -7
- package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +5 -5
- package/app/components/Viewer/PolygonalSurface/EdgesOptions.vue +3 -3
- package/app/components/Viewer/PolygonalSurface/PointsOptions.vue +3 -3
- package/app/components/Viewer/PolygonalSurface/SpecificPolygonsOptions.vue +6 -6
- package/app/components/Viewer/Solid/EdgesOptions.vue +3 -3
- package/app/components/Viewer/Solid/PointsOptions.vue +3 -3
- package/app/components/Viewer/Solid/PolygonsOptions.vue +3 -3
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +6 -6
- package/app/components/Viewer/TetrahedralSolid/TetrahedraOptions.vue +3 -3
- package/app/components/Viewer/TetrahedralSolid/TrianglesOptions.vue +3 -3
- package/app/components/Viewer/Tree/ObjectTree.vue +7 -9
- package/app/components/Viewer/TreeComponent.vue +9 -13
- package/app/components/Viewer/TreeObject.vue +8 -9
- package/app/components/Viewer/TriangulatedSurface/EdgesOptions.vue +3 -3
- package/app/components/Viewer/TriangulatedSurface/PointsOptions.vue +3 -3
- package/app/components/Viewer/TriangulatedSurface/TrianglesOptions.vue +3 -3
- package/app/components/Wrapper.vue +1 -2
- package/app/components/ZScaling.vue +1 -1
- package/app/composables/project_manager.js +6 -6
- package/app/plugins/auto_store_register.js +1 -1
- package/app/stores/app.js +45 -41
- package/app/stores/data.js +52 -51
- package/app/stores/data_style.js +12 -11
- package/app/stores/feedback.js +5 -1
- package/app/stores/geode.js +16 -13
- package/app/stores/hybrid_viewer.js +72 -44
- package/app/stores/infra.js +18 -16
- package/app/stores/lambda.js +1 -9
- package/app/stores/menu.js +13 -13
- package/app/stores/treeview.js +15 -13
- package/app/stores/viewer.js +39 -33
- package/app/utils/app_mode.js +4 -3
- package/app/utils/default_styles.js +55 -47
- package/app/utils/file_import_workflow.js +4 -17
- package/app/utils/local.js +195 -184
- package/app/utils/upload_file.js +1 -2
- package/eslint.config.js +2 -2
- package/internal/database/database.js +17 -32
- package/internal/database/extended_database.js +25 -0
- package/internal/stores/data_style/mesh/cells/cell.js +3 -3
- package/internal/stores/data_style/mesh/cells/color.js +1 -1
- package/internal/stores/data_style/mesh/cells/index.js +7 -7
- package/internal/stores/data_style/mesh/cells/textures.js +1 -1
- package/internal/stores/data_style/mesh/cells/vertex.js +3 -3
- package/internal/stores/data_style/mesh/cells/visibility.js +1 -1
- package/internal/stores/data_style/mesh/edges/color.js +1 -1
- package/internal/stores/data_style/mesh/edges/edge.js +22 -22
- package/internal/stores/data_style/mesh/edges/index.js +7 -7
- package/internal/stores/data_style/mesh/edges/vertex.js +3 -3
- package/internal/stores/data_style/mesh/edges/visibility.js +1 -1
- package/internal/stores/data_style/mesh/edges/width.js +1 -1
- package/internal/stores/data_style/mesh/index.js +4 -5
- package/internal/stores/data_style/mesh/points/color.js +1 -1
- package/internal/stores/data_style/mesh/points/index.js +6 -6
- package/internal/stores/data_style/mesh/points/size.js +1 -1
- package/internal/stores/data_style/mesh/points/vertex.js +3 -3
- package/internal/stores/data_style/mesh/points/visibility.js +1 -1
- package/internal/stores/data_style/mesh/polygons/color.js +1 -1
- package/internal/stores/data_style/mesh/polygons/index.js +7 -7
- package/internal/stores/data_style/mesh/polygons/polygon.js +3 -3
- package/internal/stores/data_style/mesh/polygons/textures.js +1 -1
- package/internal/stores/data_style/mesh/polygons/vertex.js +3 -3
- package/internal/stores/data_style/mesh/polygons/visibility.js +1 -1
- package/internal/stores/data_style/mesh/polyhedra/color.js +1 -1
- package/internal/stores/data_style/mesh/polyhedra/index.js +6 -6
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.js +3 -3
- package/internal/stores/data_style/mesh/polyhedra/vertex.js +3 -3
- package/internal/stores/data_style/mesh/polyhedra/visibility.js +1 -1
- package/internal/stores/data_style/model/edges.js +1 -1
- package/internal/stores/data_style/model/index.js +32 -22
- package/internal/utils/api_fetch.js +8 -5
- package/internal/utils/viewer_call.js +42 -46
- package/nuxt.config.js +3 -3
- package/package.json +1 -1
- package/scripts/generate_geode_objects.js +8 -7
- package/tests/integration/setup.js +28 -21
- package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +18 -10
- package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +18 -10
- package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +9 -5
- package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +17 -10
- package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +18 -10
- package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +18 -10
- package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +10 -6
- package/tests/integration/stores/data_style/model/corners.nuxt.test.js +10 -6
- package/tests/integration/stores/data_style/model/edges.nuxt.test.js +9 -5
- package/tests/integration/stores/data_style/model/index.nuxt.test.js +9 -5
- package/tests/integration/stores/data_style/model/lines.nuxt.test.js +10 -6
- package/tests/integration/stores/data_style/model/points.nuxt.test.js +9 -5
- package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +10 -6
- package/tests/integration/stores/viewer.nuxt.test.js +55 -39
- package/tests/setup_indexeddb.js +1 -0
- package/tests/unit/components/CrsSelector.nuxt.test.js +18 -19
- package/tests/unit/components/ExtensionSelector.nuxt.test.js +24 -19
- package/tests/unit/components/FeedBack/ErrorsBanner.nuxt.test.js +23 -36
- package/tests/unit/components/FeedBack/Snackers.nuxt.test.js +20 -25
- package/tests/unit/components/FileSelector.nuxt.test.js +27 -27
- package/tests/unit/components/FileUploader.nuxt.test.js +18 -17
- package/tests/unit/components/Inspector/InspectionButton.nuxt.test.js +9 -16
- package/tests/unit/components/Inspector/ResultPanel.nuxt.test.js +8 -6
- package/tests/unit/components/Launcher.nuxt.test.js +12 -17
- package/tests/unit/components/MissingFilesSelector.nuxt.test.js +16 -19
- package/tests/unit/components/ObjectSelector.nuxt.test.js +30 -34
- package/tests/unit/components/PackagesVersions.nuxt.test.js +8 -11
- package/tests/unit/components/Step.nuxt.test.js +8 -7
- package/tests/unit/components/Stepper.nuxt.test.js +14 -12
- package/tests/unit/composables/ProjectManager.nuxt.test.js +142 -100
- package/tests/unit/composables/api_fetch.nuxt.test.js +12 -39
- package/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js +36 -61
- package/tests/unit/composables/upload_file.nuxt.test.js +21 -25
- package/tests/unit/plugins/project_load.nuxt.test.js +22 -21
- package/tests/unit/stores/App.nuxt.test.js +45 -43
- package/tests/unit/stores/Feedback.nuxt.test.js +16 -18
- package/tests/unit/stores/Geode.nuxt.test.js +135 -137
- package/tests/unit/stores/Infra.nuxt.test.js +20 -26
- package/tests/unit/stores/Lambda.nuxt.test.js +30 -31
- package/tests/unit/stores/Treeview.nuxt.test.js +53 -55
- package/tests/unit/stores/Viewer.nuxt.test.js +16 -23
- package/tests/unit/utils/validate_schema.nuxt.test.js +18 -18
- package/tests/utils.js +15 -2
- package/tests/vitest.config.js +6 -2
package/app/stores/data.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// Third party imports
|
|
2
2
|
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
|
|
3
|
-
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
|
|
4
3
|
import { database } from "../../internal/database/database.js"
|
|
5
4
|
import { liveQuery } from "dexie"
|
|
6
5
|
import { useObservable } from "@vueuse/rxjs"
|
|
6
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
|
|
7
|
+
|
|
8
|
+
// Local imports
|
|
9
|
+
import { useGeodeStore } from "@ogw_front/stores/geode"
|
|
10
|
+
import { useViewerStore } from "@ogw_front/stores/viewer"
|
|
7
11
|
|
|
8
|
-
// Local constants
|
|
9
12
|
const back_model_schemas = back_schemas.opengeodeweb_back.models
|
|
10
13
|
const viewer_generic_schemas = viewer_schemas.opengeodeweb_viewer.generic
|
|
11
14
|
|
|
12
|
-
import { useViewerStore } from "@ogw_front/stores/viewer"
|
|
13
|
-
import { useGeodeStore } from "@ogw_front/stores/geode"
|
|
14
|
-
|
|
15
15
|
export const useDataStore = defineStore("data", () => {
|
|
16
16
|
const viewerStore = useViewerStore()
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ export const useDataStore = defineStore("data", () => {
|
|
|
19
19
|
function getItem(id) {
|
|
20
20
|
if (!id) {
|
|
21
21
|
const emptyRef = ref({})
|
|
22
|
-
emptyRef.fetch = async () =>
|
|
22
|
+
emptyRef.fetch = async () => ({})
|
|
23
23
|
return emptyRef
|
|
24
24
|
}
|
|
25
25
|
if (itemCache.has(id)) {
|
|
@@ -29,7 +29,7 @@ export const useDataStore = defineStore("data", () => {
|
|
|
29
29
|
liveQuery(() => database.data.get(id)),
|
|
30
30
|
{ initialValue: {} },
|
|
31
31
|
)
|
|
32
|
-
observable.fetch =
|
|
32
|
+
observable.fetch = () => database.data.get(id)
|
|
33
33
|
itemCache.set(id, observable)
|
|
34
34
|
return observable
|
|
35
35
|
}
|
|
@@ -39,45 +39,48 @@ export const useDataStore = defineStore("data", () => {
|
|
|
39
39
|
liveQuery(() => database.data.toArray()),
|
|
40
40
|
{ initialValue: [] },
|
|
41
41
|
)
|
|
42
|
-
observable.fetch =
|
|
42
|
+
observable.fetch = () => database.data.toArray()
|
|
43
43
|
return observable
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
async function formatedMeshComponents(id) {
|
|
47
47
|
const items = await database.model_components.where({ id }).toArray()
|
|
48
48
|
const distinctTypes = [...new Set(items.map((item) => item.type))]
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
49
|
+
|
|
50
|
+
const formated_mesh_components = await Promise.all(
|
|
51
|
+
distinctTypes.map(async (type) => {
|
|
52
|
+
const meshComponents = await database.model_components
|
|
53
|
+
.where({ id, type })
|
|
54
|
+
.toArray()
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
id: type,
|
|
58
|
+
title: type,
|
|
59
|
+
children: meshComponents.map((meshComponent) => ({
|
|
60
|
+
id: meshComponent.geode_id,
|
|
61
|
+
title: meshComponent.name,
|
|
62
|
+
category: meshComponent.type,
|
|
63
|
+
})),
|
|
64
|
+
}
|
|
65
|
+
}),
|
|
66
|
+
)
|
|
65
67
|
|
|
66
68
|
return formated_mesh_components
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
async function meshComponentType(id, geode_id) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
const component = await database.model_components
|
|
73
|
+
.where({ id, geode_id })
|
|
74
|
+
.first()
|
|
75
|
+
return component?.type
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
async function registerObject(id) {
|
|
76
|
-
return viewerStore.request(viewer_generic_schemas.register, { id })
|
|
79
|
+
return await viewerStore.request(viewer_generic_schemas.register, { id })
|
|
77
80
|
}
|
|
78
81
|
|
|
79
82
|
async function deregisterObject(id) {
|
|
80
|
-
return viewerStore.request(viewer_generic_schemas.deregister, { id })
|
|
83
|
+
return await viewerStore.request(viewer_generic_schemas.deregister, { id })
|
|
81
84
|
}
|
|
82
85
|
|
|
83
86
|
async function addItem(id, value) {
|
|
@@ -90,7 +93,7 @@ export const useDataStore = defineStore("data", () => {
|
|
|
90
93
|
created_at: value.created_at || new Date().toISOString(),
|
|
91
94
|
}
|
|
92
95
|
|
|
93
|
-
const serializedData =
|
|
96
|
+
const serializedData = structuredClone(itemData)
|
|
94
97
|
await database.data.put(serializedData)
|
|
95
98
|
}
|
|
96
99
|
async function deleteItem(id) {
|
|
@@ -106,10 +109,10 @@ export const useDataStore = defineStore("data", () => {
|
|
|
106
109
|
console.debug("[addModelComponents] No mesh components to add")
|
|
107
110
|
return
|
|
108
111
|
}
|
|
109
|
-
|
|
112
|
+
for (const value of values) {
|
|
110
113
|
value.created_at = new Date().toISOString()
|
|
111
|
-
}
|
|
112
|
-
const serializedData =
|
|
114
|
+
}
|
|
115
|
+
const serializedData = structuredClone(values)
|
|
113
116
|
await database.model_components.bulkAdd(serializedData)
|
|
114
117
|
}
|
|
115
118
|
|
|
@@ -119,7 +122,7 @@ export const useDataStore = defineStore("data", () => {
|
|
|
119
122
|
|
|
120
123
|
async function fetchMeshComponents(id) {
|
|
121
124
|
const geodeStore = useGeodeStore()
|
|
122
|
-
return geodeStore.request(
|
|
125
|
+
return await geodeStore.request(
|
|
123
126
|
back_model_schemas.mesh_components,
|
|
124
127
|
{ id },
|
|
125
128
|
{
|
|
@@ -132,37 +135,35 @@ export const useDataStore = defineStore("data", () => {
|
|
|
132
135
|
}
|
|
133
136
|
|
|
134
137
|
async function getMeshComponentGeodeIds(id, meshComponentType) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
).map((component) => component.geode_id)
|
|
138
|
+
const components = await database.model_components
|
|
139
|
+
.where({ id, type: meshComponentType })
|
|
140
|
+
.toArray()
|
|
141
|
+
return components.map((component) => component.geode_id)
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
async function getCornersGeodeIds(id) {
|
|
143
|
-
return getMeshComponentGeodeIds(id, "Corner")
|
|
145
|
+
return await getMeshComponentGeodeIds(id, "Corner")
|
|
144
146
|
}
|
|
145
147
|
|
|
146
148
|
async function getLinesGeodeIds(id) {
|
|
147
|
-
return getMeshComponentGeodeIds(id, "Line")
|
|
149
|
+
return await getMeshComponentGeodeIds(id, "Line")
|
|
148
150
|
}
|
|
149
151
|
|
|
150
152
|
async function getSurfacesGeodeIds(id) {
|
|
151
|
-
return getMeshComponentGeodeIds(id, "Surface")
|
|
153
|
+
return await getMeshComponentGeodeIds(id, "Surface")
|
|
152
154
|
}
|
|
153
155
|
|
|
154
156
|
async function getBlocksGeodeIds(id) {
|
|
155
|
-
return getMeshComponentGeodeIds(id, "Block")
|
|
157
|
+
return await getMeshComponentGeodeIds(id, "Block")
|
|
156
158
|
}
|
|
157
159
|
|
|
158
160
|
async function getMeshComponentsViewerIds(id, meshComponentGeodeIds) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
).map((component) => component.viewer_id)
|
|
161
|
+
const components = await database.model_components
|
|
162
|
+
.where("id")
|
|
163
|
+
.equals(id)
|
|
164
|
+
.and((component) => meshComponentGeodeIds.includes(component.geode_id))
|
|
165
|
+
.toArray()
|
|
166
|
+
return components.map((component) => component.viewer_id)
|
|
166
167
|
}
|
|
167
168
|
|
|
168
169
|
async function exportStores() {
|
|
@@ -170,7 +171,7 @@ export const useDataStore = defineStore("data", () => {
|
|
|
170
171
|
return { items }
|
|
171
172
|
}
|
|
172
173
|
|
|
173
|
-
async function importStores(
|
|
174
|
+
async function importStores(_snapshot) {
|
|
174
175
|
await clear()
|
|
175
176
|
}
|
|
176
177
|
|
package/app/stores/data_style.js
CHANGED
|
@@ -18,13 +18,14 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
|
|
|
18
18
|
const item = await dataStore.getItem(id).fetch()
|
|
19
19
|
const viewer_type = item?.viewer_type
|
|
20
20
|
if (!viewer_type) {
|
|
21
|
-
throw new Error(
|
|
21
|
+
throw new Error(`Item not found or not loaded: ${id}`)
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
if (viewer_type === "mesh") {
|
|
25
|
-
return
|
|
26
|
-
}
|
|
27
|
-
|
|
25
|
+
return meshStyleStore.setMeshVisibility(id, visibility)
|
|
26
|
+
}
|
|
27
|
+
if (viewer_type === "model") {
|
|
28
|
+
return modelStyleStore.setModelVisibility(id, visibility)
|
|
28
29
|
}
|
|
29
30
|
throw new Error("Unknown viewer_type")
|
|
30
31
|
}
|
|
@@ -33,23 +34,23 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
|
|
|
33
34
|
const item = await dataStore.getItem(id).fetch()
|
|
34
35
|
const viewer_type = item?.viewer_type
|
|
35
36
|
if (!viewer_type) {
|
|
36
|
-
throw new Error(
|
|
37
|
+
throw new Error(`Item not found or not loaded: ${id}`)
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
if (viewer_type === "mesh") {
|
|
40
41
|
return meshStyleStore.applyMeshStyle(id)
|
|
41
|
-
}
|
|
42
|
+
}
|
|
43
|
+
if (viewer_type === "model") {
|
|
42
44
|
return modelStyleStore.applyModelStyle(id)
|
|
43
|
-
} else {
|
|
44
|
-
throw new Error("Unknown viewer_type: " + viewer_type)
|
|
45
45
|
}
|
|
46
|
+
throw new Error(`Unknown viewer_type: ${viewer_type}`)
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
function exportStores() {
|
|
49
50
|
return { styles: dataStyleState.styles }
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
|
|
53
|
+
function importStores(snapshot) {
|
|
53
54
|
const stylesSnapshot = snapshot.styles || {}
|
|
54
55
|
for (const id of Object.keys(dataStyleState.styles)) {
|
|
55
56
|
delete dataStyleState.styles[id]
|
|
@@ -59,7 +60,7 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
|
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
function applyAllStylesFromState() {
|
|
63
64
|
const ids = Object.keys(dataStyleState.styles || {})
|
|
64
65
|
const promises = []
|
|
65
66
|
for (const id of ids) {
|
package/app/stores/feedback.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { v4 as uuidv4 } from "uuid"
|
|
2
2
|
|
|
3
|
+
const MILLISECONDS_IN_SECOND = 1000
|
|
4
|
+
const DEFAULT_FEEDBACKS_TIMEOUT_SECONDS = 10
|
|
5
|
+
|
|
3
6
|
export const useFeedbackStore = defineStore("feedback", {
|
|
4
7
|
state: () => ({
|
|
5
8
|
feedbacks: [],
|
|
6
9
|
server_error: false,
|
|
7
|
-
feedbacks_timeout_miliseconds:
|
|
10
|
+
feedbacks_timeout_miliseconds:
|
|
11
|
+
DEFAULT_FEEDBACKS_TIMEOUT_SECONDS * MILLISECONDS_IN_SECOND,
|
|
8
12
|
}),
|
|
9
13
|
actions: {
|
|
10
14
|
async add_error(code, route, name, description) {
|
package/app/stores/geode.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
|
|
2
1
|
import Status from "@ogw_front/utils/status"
|
|
3
|
-
import { appMode } from "@ogw_front/utils/app_mode"
|
|
4
2
|
import { api_fetch } from "../../internal/utils/api_fetch"
|
|
5
|
-
import {
|
|
3
|
+
import { appMode } from "@ogw_front/utils/app_mode"
|
|
4
|
+
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
|
|
6
5
|
import { useFeedbackStore } from "@ogw_front/stores/feedback"
|
|
6
|
+
import { useInfraStore } from "@ogw_front/stores/infra"
|
|
7
|
+
|
|
8
|
+
const MILLISECONDS_IN_SECOND = 1000
|
|
9
|
+
const DEFAULT_PING_INTERVAL_SECONDS = 10
|
|
7
10
|
|
|
8
11
|
export const useGeodeStore = defineStore("geode", {
|
|
9
12
|
state: () => ({
|
|
@@ -13,17 +16,17 @@ export const useGeodeStore = defineStore("geode", {
|
|
|
13
16
|
}),
|
|
14
17
|
getters: {
|
|
15
18
|
protocol() {
|
|
16
|
-
if (useInfraStore().app_mode
|
|
19
|
+
if (useInfraStore().app_mode === appMode.CLOUD) {
|
|
17
20
|
return "https"
|
|
18
21
|
}
|
|
19
22
|
return "http"
|
|
20
23
|
},
|
|
21
24
|
port() {
|
|
22
|
-
if (useInfraStore().app_mode
|
|
25
|
+
if (useInfraStore().app_mode === appMode.CLOUD) {
|
|
23
26
|
return "443"
|
|
24
27
|
}
|
|
25
|
-
const GEODE_PORT = useRuntimeConfig().public
|
|
26
|
-
if (GEODE_PORT
|
|
28
|
+
const { GEODE_PORT } = useRuntimeConfig().public
|
|
29
|
+
if (GEODE_PORT !== null && GEODE_PORT !== "") {
|
|
27
30
|
return GEODE_PORT
|
|
28
31
|
}
|
|
29
32
|
return this.default_local_port
|
|
@@ -31,8 +34,8 @@ export const useGeodeStore = defineStore("geode", {
|
|
|
31
34
|
base_url() {
|
|
32
35
|
const infraStore = useInfraStore()
|
|
33
36
|
let geode_url = `${this.protocol}://${infraStore.domain_name}:${this.port}`
|
|
34
|
-
if (infraStore.app_mode
|
|
35
|
-
if (infraStore.ID
|
|
37
|
+
if (infraStore.app_mode === appMode.CLOUD) {
|
|
38
|
+
if (infraStore.ID === "") {
|
|
36
39
|
throw new Error("ID must not be empty in cloud mode")
|
|
37
40
|
}
|
|
38
41
|
geode_url += `/${infraStore.ID}/geode`
|
|
@@ -48,7 +51,7 @@ export const useGeodeStore = defineStore("geode", {
|
|
|
48
51
|
this.ping()
|
|
49
52
|
setInterval(() => {
|
|
50
53
|
this.ping()
|
|
51
|
-
},
|
|
54
|
+
}, DEFAULT_PING_INTERVAL_SECONDS * MILLISECONDS_IN_SECOND)
|
|
52
55
|
},
|
|
53
56
|
ping() {
|
|
54
57
|
const geodeStore = this
|
|
@@ -73,14 +76,14 @@ export const useGeodeStore = defineStore("geode", {
|
|
|
73
76
|
)
|
|
74
77
|
},
|
|
75
78
|
start_request() {
|
|
76
|
-
this.request_counter
|
|
79
|
+
this.request_counter += 1
|
|
77
80
|
},
|
|
78
81
|
stop_request() {
|
|
79
|
-
this.request_counter
|
|
82
|
+
this.request_counter -= 1
|
|
80
83
|
},
|
|
81
84
|
launch() {
|
|
82
85
|
console.log("[GEODE] Launching geode microservice...")
|
|
83
|
-
return
|
|
86
|
+
return globalThis.electronAPI.run_back()
|
|
84
87
|
},
|
|
85
88
|
connect() {
|
|
86
89
|
console.log("[GEODE] Connecting to geode microservice...")
|
|
@@ -1,13 +1,29 @@
|
|
|
1
|
+
// oxlint-disable-next-line import/no-unassigned-import
|
|
1
2
|
import "@kitware/vtk.js/Rendering/Profiles/Geometry"
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import vtkMapper from "@kitware/vtk.js/Rendering/Core/Mapper"
|
|
5
|
-
import
|
|
3
|
+
import { newInstance as vtkActor } from "@kitware/vtk.js/Rendering/Core/Actor"
|
|
4
|
+
import { newInstance as vtkGenericRenderWindow } from "@kitware/vtk.js/Rendering/Misc/GenericRenderWindow"
|
|
5
|
+
import { newInstance as vtkMapper } from "@kitware/vtk.js/Rendering/Core/Mapper"
|
|
6
|
+
import { newInstance as vtkXMLPolyDataReader } from "@kitware/vtk.js/IO/XML/XMLPolyDataReader"
|
|
6
7
|
|
|
7
|
-
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
|
|
8
8
|
import Status from "@ogw_front/utils/status"
|
|
9
|
-
import { useViewerStore } from "@ogw_front/stores/viewer"
|
|
10
9
|
import { useDataStore } from "@ogw_front/stores/data"
|
|
10
|
+
import { useViewerStore } from "@ogw_front/stores/viewer"
|
|
11
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
|
|
12
|
+
|
|
13
|
+
const RGB_MAX = 255
|
|
14
|
+
const BACKGROUND_GREY_VALUE = 180
|
|
15
|
+
const ACTOR_DARK_VALUE = 20
|
|
16
|
+
const BACKGROUND_COLOR = [
|
|
17
|
+
BACKGROUND_GREY_VALUE / RGB_MAX,
|
|
18
|
+
BACKGROUND_GREY_VALUE / RGB_MAX,
|
|
19
|
+
BACKGROUND_GREY_VALUE / RGB_MAX,
|
|
20
|
+
]
|
|
21
|
+
const ACTOR_COLOR = [
|
|
22
|
+
ACTOR_DARK_VALUE / RGB_MAX,
|
|
23
|
+
ACTOR_DARK_VALUE / RGB_MAX,
|
|
24
|
+
ACTOR_DARK_VALUE / RGB_MAX,
|
|
25
|
+
]
|
|
26
|
+
const WHEEL_TIME_OUT_MS = 600
|
|
11
27
|
|
|
12
28
|
export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
13
29
|
const viewerStore = useViewerStore()
|
|
@@ -17,15 +33,17 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
17
33
|
const camera_options = reactive({})
|
|
18
34
|
const genericRenderWindow = reactive({})
|
|
19
35
|
const is_moving = ref(false)
|
|
20
|
-
const zScale = ref(1
|
|
21
|
-
let viewStream
|
|
22
|
-
let gridActor =
|
|
36
|
+
const zScale = ref(1)
|
|
37
|
+
let viewStream = undefined
|
|
38
|
+
let gridActor = undefined
|
|
23
39
|
|
|
24
40
|
async function initHybridViewer() {
|
|
25
|
-
if (status.value !== Status.NOT_CREATED)
|
|
41
|
+
if (status.value !== Status.NOT_CREATED) {
|
|
42
|
+
return
|
|
43
|
+
}
|
|
26
44
|
status.value = Status.CREATING
|
|
27
|
-
genericRenderWindow.value = vtkGenericRenderWindow
|
|
28
|
-
background:
|
|
45
|
+
genericRenderWindow.value = vtkGenericRenderWindow({
|
|
46
|
+
background: BACKGROUND_COLOR,
|
|
29
47
|
listenWindowResize: false,
|
|
30
48
|
})
|
|
31
49
|
|
|
@@ -37,12 +55,14 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
37
55
|
|
|
38
56
|
await viewerStore.ws_connect()
|
|
39
57
|
viewStream = viewerStore.client.getImageStream().createViewStream("-1")
|
|
40
|
-
viewStream.onImageReady((
|
|
41
|
-
if (is_moving.value)
|
|
58
|
+
viewStream.onImageReady((event) => {
|
|
59
|
+
if (is_moving.value) {
|
|
60
|
+
return
|
|
61
|
+
}
|
|
42
62
|
const webGLRenderWindow =
|
|
43
63
|
genericRenderWindow.value.getApiSpecificRenderWindow()
|
|
44
64
|
const imageStyle = webGLRenderWindow.getReferenceByName("bgImage").style
|
|
45
|
-
webGLRenderWindow.setBackgroundImage(
|
|
65
|
+
webGLRenderWindow.setBackgroundImage(event.image)
|
|
46
66
|
imageStyle.opacity = 1
|
|
47
67
|
})
|
|
48
68
|
|
|
@@ -53,18 +73,19 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
53
73
|
if (!genericRenderWindow.value) {
|
|
54
74
|
return
|
|
55
75
|
}
|
|
56
|
-
const
|
|
76
|
+
const item = dataStore.getItem(id)
|
|
77
|
+
const value = await item.fetch()
|
|
57
78
|
console.log("hybridViewerStore.addItem", { value })
|
|
58
|
-
const reader = vtkXMLPolyDataReader
|
|
79
|
+
const reader = vtkXMLPolyDataReader()
|
|
59
80
|
const textEncoder = new TextEncoder()
|
|
60
81
|
await reader.parseAsArrayBuffer(
|
|
61
82
|
textEncoder.encode(value.binary_light_viewable),
|
|
62
83
|
)
|
|
63
84
|
const polydata = reader.getOutputData(0)
|
|
64
|
-
const mapper = vtkMapper
|
|
85
|
+
const mapper = vtkMapper()
|
|
65
86
|
mapper.setInputData(polydata)
|
|
66
|
-
const actor = vtkActor
|
|
67
|
-
actor.getProperty().setColor(
|
|
87
|
+
const actor = vtkActor()
|
|
88
|
+
actor.getProperty().setColor(ACTOR_COLOR)
|
|
68
89
|
actor.setMapper(mapper)
|
|
69
90
|
const renderer = genericRenderWindow.value.getRenderer()
|
|
70
91
|
const renderWindow = genericRenderWindow.value.getRenderWindow()
|
|
@@ -75,7 +96,9 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
75
96
|
}
|
|
76
97
|
|
|
77
98
|
async function removeItem(id) {
|
|
78
|
-
if (!hybridDb[id])
|
|
99
|
+
if (!hybridDb[id]) {
|
|
100
|
+
return
|
|
101
|
+
}
|
|
79
102
|
const renderer = genericRenderWindow.value.getRenderer()
|
|
80
103
|
renderer.removeActor(hybridDb[id].actor)
|
|
81
104
|
genericRenderWindow.value.getRenderWindow().render()
|
|
@@ -91,19 +114,21 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
91
114
|
zScale.value = z_scale
|
|
92
115
|
const renderer = genericRenderWindow.value.getRenderer()
|
|
93
116
|
const actors = renderer.getActors()
|
|
94
|
-
|
|
117
|
+
for (const actor of actors) {
|
|
95
118
|
if (actor !== gridActor) {
|
|
96
119
|
const scale = actor.getScale()
|
|
97
120
|
actor.setScale(scale[0], scale[1], z_scale)
|
|
98
121
|
}
|
|
99
|
-
}
|
|
122
|
+
}
|
|
100
123
|
renderer.resetCamera()
|
|
101
124
|
genericRenderWindow.value.getRenderWindow().render()
|
|
102
125
|
const schema = viewer_schemas?.opengeodeweb_viewer?.viewer?.set_z_scaling
|
|
103
|
-
if (!schema)
|
|
126
|
+
if (!schema) {
|
|
127
|
+
return
|
|
128
|
+
}
|
|
104
129
|
const viewerStore = useViewerStore()
|
|
105
130
|
await viewerStore.request(schema, {
|
|
106
|
-
z_scale
|
|
131
|
+
z_scale,
|
|
107
132
|
})
|
|
108
133
|
remoteRender()
|
|
109
134
|
}
|
|
@@ -114,11 +139,11 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
114
139
|
const camera = renderer.getActiveCamera()
|
|
115
140
|
const params = {
|
|
116
141
|
camera_options: {
|
|
117
|
-
focal_point: camera.getFocalPoint(),
|
|
118
|
-
view_up: camera.getViewUp(),
|
|
119
|
-
position: camera.getPosition(),
|
|
142
|
+
focal_point: [...camera.getFocalPoint()],
|
|
143
|
+
view_up: [...camera.getViewUp()],
|
|
144
|
+
position: [...camera.getPosition()],
|
|
120
145
|
view_angle: camera.getViewAngle(),
|
|
121
|
-
clipping_range: camera.getClippingRange(),
|
|
146
|
+
clipping_range: [...camera.getClippingRange()],
|
|
122
147
|
distance: camera.getDistance(),
|
|
123
148
|
},
|
|
124
149
|
}
|
|
@@ -130,7 +155,9 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
130
155
|
response_function: () => {
|
|
131
156
|
remoteRender()
|
|
132
157
|
for (const key in params.camera_options) {
|
|
133
|
-
|
|
158
|
+
if (Object.hasOwn(params.camera_options, key)) {
|
|
159
|
+
camera_options[key] = params.camera_options[key]
|
|
160
|
+
}
|
|
134
161
|
}
|
|
135
162
|
},
|
|
136
163
|
},
|
|
@@ -139,7 +166,7 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
139
166
|
|
|
140
167
|
function remoteRender() {
|
|
141
168
|
const viewerStore = useViewerStore()
|
|
142
|
-
viewerStore.request(viewer_schemas.opengeodeweb_viewer.viewer.render)
|
|
169
|
+
return viewerStore.request(viewer_schemas.opengeodeweb_viewer.viewer.render)
|
|
143
170
|
}
|
|
144
171
|
|
|
145
172
|
function setContainer(container) {
|
|
@@ -157,7 +184,7 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
157
184
|
target: container,
|
|
158
185
|
onPressed: (event) => {
|
|
159
186
|
console.log("onPressed")
|
|
160
|
-
if (event.button
|
|
187
|
+
if (event.button === 0) {
|
|
161
188
|
is_moving.value = true
|
|
162
189
|
event.stopPropagation()
|
|
163
190
|
imageStyle.opacity = 0
|
|
@@ -173,7 +200,7 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
173
200
|
},
|
|
174
201
|
})
|
|
175
202
|
|
|
176
|
-
let wheelEventEndTimeout =
|
|
203
|
+
let wheelEventEndTimeout = undefined
|
|
177
204
|
useEventListener(container, "wheel", () => {
|
|
178
205
|
is_moving.value = true
|
|
179
206
|
imageStyle.opacity = 0
|
|
@@ -181,7 +208,7 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
181
208
|
wheelEventEndTimeout = setTimeout(() => {
|
|
182
209
|
is_moving.value = false
|
|
183
210
|
syncRemoteCamera()
|
|
184
|
-
},
|
|
211
|
+
}, WHEEL_TIME_OUT_MS)
|
|
185
212
|
})
|
|
186
213
|
}
|
|
187
214
|
|
|
@@ -205,7 +232,7 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
205
232
|
remoteRender()
|
|
206
233
|
}
|
|
207
234
|
|
|
208
|
-
|
|
235
|
+
function exportStores() {
|
|
209
236
|
const renderer = genericRenderWindow.value.getRenderer()
|
|
210
237
|
const camera = renderer.getActiveCamera()
|
|
211
238
|
const cameraSnapshot = camera
|
|
@@ -221,14 +248,14 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
221
248
|
return { zScale: zScale.value, camera_options: cameraSnapshot }
|
|
222
249
|
}
|
|
223
250
|
|
|
224
|
-
|
|
251
|
+
async function importStores(snapshot) {
|
|
225
252
|
if (!snapshot) {
|
|
226
253
|
console.warn("importStores called with undefined snapshot")
|
|
227
254
|
return
|
|
228
255
|
}
|
|
229
256
|
const z_scale = snapshot.zScale
|
|
230
257
|
|
|
231
|
-
|
|
258
|
+
function applyCamera() {
|
|
232
259
|
const { camera_options } = snapshot
|
|
233
260
|
if (!camera_options) {
|
|
234
261
|
return
|
|
@@ -247,11 +274,11 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
247
274
|
|
|
248
275
|
const payload = {
|
|
249
276
|
camera_options: {
|
|
250
|
-
focal_point: camera_options.focal_point,
|
|
251
|
-
view_up: camera_options.view_up,
|
|
252
|
-
position: camera_options.position,
|
|
277
|
+
focal_point: [...camera_options.focal_point],
|
|
278
|
+
view_up: [...camera_options.view_up],
|
|
279
|
+
position: [...camera_options.position],
|
|
253
280
|
view_angle: camera_options.view_angle,
|
|
254
|
-
clipping_range: camera_options.clipping_range,
|
|
281
|
+
clipping_range: [...camera_options.clipping_range],
|
|
255
282
|
},
|
|
256
283
|
}
|
|
257
284
|
const viewerStore = useViewerStore()
|
|
@@ -268,12 +295,13 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
268
295
|
}
|
|
269
296
|
|
|
270
297
|
if (typeof z_scale === "number") {
|
|
271
|
-
|
|
298
|
+
await setZScaling(z_scale)
|
|
299
|
+
return await applyCamera()
|
|
272
300
|
}
|
|
273
|
-
return applyCamera()
|
|
301
|
+
return await applyCamera()
|
|
274
302
|
}
|
|
275
303
|
|
|
276
|
-
|
|
304
|
+
function clear() {
|
|
277
305
|
const renderer = genericRenderWindow.value.getRenderer()
|
|
278
306
|
const actors = renderer.getActors()
|
|
279
307
|
for (const actor of actors) {
|