Skip to content

Commit 178c4df

Browse files
committed
Merge branch 'fix/project' into fix/VoiFromTopo
2 parents ac25a05 + 2a70d8a commit 178c4df

12 files changed

Lines changed: 116 additions & 35 deletions

File tree

app/components/FeedBack/Snackers.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function calc_margin(index) {
2323
transition="slide-x-reverse-transition"
2424
max-width="200px"
2525
height="20px"
26-
timeout="10000"
26+
timeout="-1"
2727
z-index="4"
2828
>
2929
<v-row dense class="flex-nowrap">

app/components/Viewer/ObjectTree/Base/ItemLabel.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ const tooltipDisabled = computed(() => {
5050
</script>
5151

5252
<template>
53-
<div ref="label-container" class="tree-item-label-container w-100">
53+
<div
54+
ref="label-container"
55+
:data-testid="'treeRow-' + actualItem.id"
56+
class="tree-item-label-container w-100"
57+
>
5458
<v-tooltip :disabled="tooltipDisabled" location="right" open-delay="400">
5559
<template #activator="{ props: tooltipProps }">
5660
<span

app/components/Viewer/Options/ColorPicker.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ watch(pressed, (value) => {
5252
flat
5353
canvas-height="75"
5454
hide-inputs
55+
hide-eye-dropper
5556
width="220"
5657
mode="rgba"
5758
class="mx-auto"

app/composables/project_manager.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { useAppStore } from "@ogw_front/stores/app";
88
import { useBackStore } from "@ogw_front/stores/back";
99
import { useDataStore } from "@ogw_front/stores/data";
1010
import { useDataStyleStore } from "@ogw_front/stores/data_style";
11+
import { useFeedbackStore } from "@ogw_front/stores/feedback";
1112
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
1213
import { useTreeviewStore } from "@ogw_front/stores/treeview";
1314
import { useViewerStore } from "@ogw_front/stores/viewer";
@@ -16,6 +17,7 @@ async function exportProject() {
1617
console.log("[export triggered]");
1718
const appStore = useAppStore();
1819
const backStore = useBackStore();
20+
const feedbackStore = useFeedbackStore();
1921
const snapshot = await appStore.exportStores();
2022
const schema = back_schemas.opengeodeweb_back.export_project;
2123
const defaultName = "project.vease";
@@ -26,6 +28,7 @@ async function exportProject() {
2628
body: { snapshot, filename: defaultName },
2729
});
2830
fileDownload(result, defaultName);
31+
feedbackStore.add_success("Project exported successfully");
2932
return { result };
3033
}
3134

@@ -73,23 +76,20 @@ async function importProject(file) {
7376
await client2.getConnection().getSession().call("opengeodeweb_viewer.import_project", [{}]);
7477
}
7578

76-
await treeviewStore.importStores(snapshot.treeview || {});
79+
await treeviewStore.importStores(snapshot.treeview);
80+
await dataStore.importStores(snapshot.data);
7781
await hybridViewerStore.initHybridViewer();
78-
await hybridViewerStore.importStores(snapshot.hybridViewer || {});
7982

8083
const items = snapshot?.data?.items || [];
81-
8284
await importWorkflowFromSnapshot(items);
83-
await hybridViewerStore.importStores(snapshot.hybridViewer || {});
84-
{
85-
await dataStyleStore.importStores(snapshot.dataStyle || {});
86-
}
87-
{
88-
await dataStyleStore.applyAllStylesFromState();
89-
}
85+
await hybridViewerStore.importStores(snapshot.hybridViewer);
86+
await dataStyleStore.importStores(snapshot.dataStyle);
87+
await dataStyleStore.applyAllStylesFromState();
9088

9189
treeviewStore.finalizeImportSelection();
9290
treeviewStore.isImporting = false;
91+
const feedbackStore = useFeedbackStore();
92+
feedbackStore.add_success("Project imported successfully");
9393
}
9494

9595
export { exportProject, importProject };

app/stores/data.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,21 @@ export const useDataStore = defineStore("data", () => {
191191

192192
async function exportStores() {
193193
const items = await data_db.toArray();
194-
return { items };
194+
const modelComponents = await model_components_db.toArray();
195+
const modelComponentsRelations = await model_components_relation_db.toArray();
196+
return { items, modelComponents, modelComponentsRelations };
195197
}
196198

197-
async function importStores(_snapshot) {
199+
async function importStores(snapshot) {
198200
await clear();
201+
await model_components_db.bulkPut(snapshot.modelComponents);
202+
await model_components_relation_db.bulkPut(snapshot.modelComponentsRelations);
199203
}
200204

201205
async function clear() {
202206
await data_db.clear();
207+
await model_components_db.clear();
208+
await model_components_relation_db.clear();
203209
}
204210

205211
return {

app/stores/data_style.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
1313
const dataStore = useDataStore();
1414
const data_style_db = database.data_style;
1515
const model_component_type_datastyle_db = database.model_component_type_datastyle;
16-
const component_datastyle_db = database.component_datastyle;
16+
const component_datastyle_db = database.model_component_datastyle;
1717

1818
async function addDataStyle(id, geode_object) {
1919
await data_style_db.put(structuredClone({ id, ...getDefaultStyle(geode_object) }));
@@ -47,9 +47,9 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
4747

4848
function exportStores() {
4949
return {
50-
styles: dataStyleState.styles,
51-
componentStyles: dataStyleState.componentStyles,
52-
modelComponentTypeStyles: dataStyleState.modelComponentTypeStyles,
50+
styles: dataStyleState.styles.value,
51+
componentStyles: dataStyleState.componentStyles.value,
52+
modelComponentTypeStyles: dataStyleState.modelComponentTypeStyles.value,
5353
};
5454
}
5555

internal/stores/data_style/mesh/cells/index.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,22 @@ export function useMeshCellsStyle() {
4040
}
4141
if (type === "vertex") {
4242
const name = meshCellsVertexAttributeStyle.meshCellsVertexAttributeName(id);
43-
return meshCellsVertexAttributeStyle.setMeshCellsVertexAttributeName(id, name);
43+
const { colorMap } = meshCellsVertexAttributeStyle.meshCellsVertexAttributeStoredConfig(
44+
id,
45+
name,
46+
);
47+
return Promise.all([
48+
meshCellsVertexAttributeStyle.setMeshCellsVertexAttributeName(id, name),
49+
meshCellsVertexAttributeStyle.setMeshCellsVertexAttributeColorMap(id, colorMap),
50+
]);
4451
}
4552
if (type === "cell") {
4653
const name = meshCellsCellAttributeStyle.meshCellsCellAttributeName(id);
47-
return meshCellsCellAttributeStyle.setMeshCellsCellAttributeName(id, name);
54+
const { colorMap } = meshCellsCellAttributeStyle.meshCellsCellAttributeStoredConfig(id, name);
55+
return Promise.all([
56+
meshCellsCellAttributeStyle.setMeshCellsCellAttributeName(id, name),
57+
meshCellsCellAttributeStyle.setMeshCellsCellAttributeColorMap(id, colorMap),
58+
]);
4859
}
4960
throw new Error(`Unknown mesh cells coloring type: ${type}`);
5061
}

internal/stores/data_style/mesh/edges/index.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,22 @@ export function useMeshEdgesStyle() {
3535
}
3636
if (type === "vertex") {
3737
const name = meshEdgesVertexAttributeStyle.meshEdgesVertexAttributeName(id);
38-
return meshEdgesVertexAttributeStyle.setMeshEdgesVertexAttributeName(id, name);
38+
const { colorMap } = meshEdgesVertexAttributeStyle.meshEdgesVertexAttributeStoredConfig(
39+
id,
40+
name,
41+
);
42+
return Promise.all([
43+
meshEdgesVertexAttributeStyle.setMeshEdgesVertexAttributeName(id, name),
44+
meshEdgesVertexAttributeStyle.setMeshEdgesVertexAttributeColorMap(id, colorMap),
45+
]);
3946
}
4047
if (type === "edge") {
4148
const name = meshEdgesEdgeAttributeStyle.meshEdgesEdgeAttributeName(id);
42-
return meshEdgesEdgeAttributeStyle.setMeshEdgesEdgeAttributeName(id, name);
49+
const { colorMap } = meshEdgesEdgeAttributeStyle.meshEdgesEdgeAttributeStoredConfig(id, name);
50+
return Promise.all([
51+
meshEdgesEdgeAttributeStyle.setMeshEdgesEdgeAttributeName(id, name),
52+
meshEdgesEdgeAttributeStyle.setMeshEdgesEdgeAttributeColorMap(id, colorMap),
53+
]);
4354
}
4455
throw new Error(`Unknown mesh edges coloring type: ${type}`);
4556
}

internal/stores/data_style/mesh/points/index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,17 @@ function useMeshPointsColoringStyle() {
2828
});
2929
if (type === "constant") {
3030
return meshPointsColorStyle.setMeshPointsColor(id, meshPointsColorStyle.meshPointsColor(id));
31-
} else if (type === "vertex") {
31+
}
32+
if (type === "vertex") {
3233
const name = meshPointsVertexAttributeStyle.meshPointsVertexAttributeName(id);
33-
return meshPointsVertexAttributeStyle.setMeshPointsVertexAttributeName(id, name);
34+
const { colorMap } = meshPointsVertexAttributeStyle.meshPointsVertexAttributeStoredConfig(
35+
id,
36+
name,
37+
);
38+
return Promise.all([
39+
meshPointsVertexAttributeStyle.setMeshPointsVertexAttributeName(id, name),
40+
meshPointsVertexAttributeStyle.setMeshPointsVertexAttributeColorMap(id, colorMap),
41+
]);
3442
}
3543
throw new Error(`Unknown mesh points coloring type: ${type}`);
3644
}

internal/stores/data_style/mesh/polygons/index.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,30 @@ function useMeshPolygonsColoringStyle() {
3434
id,
3535
meshPolygonsColorStyle.meshPolygonsColor(id),
3636
);
37-
} else if (type === "textures") {
37+
}
38+
if (type === "textures") {
3839
const textures = meshPolygonsTexturesStyle.meshPolygonsTextures(id);
3940
return meshPolygonsTexturesStyle.setMeshPolygonsTextures(id, textures);
40-
} else if (type === "vertex") {
41+
}
42+
if (type === "vertex") {
4143
const name = meshPolygonsVertexAttributeStyle.meshPolygonsVertexAttributeName(id);
42-
return meshPolygonsVertexAttributeStyle.setMeshPolygonsVertexAttributeName(id, name);
43-
} else if (type === "polygon") {
44+
const { colorMap } = meshPolygonsVertexAttributeStyle.meshPolygonsVertexAttributeStoredConfig(
45+
id,
46+
name,
47+
);
48+
return Promise.all([
49+
meshPolygonsVertexAttributeStyle.setMeshPolygonsVertexAttributeName(id, name),
50+
meshPolygonsVertexAttributeStyle.setMeshPolygonsVertexAttributeColorMap(id, colorMap),
51+
]);
52+
}
53+
if (type === "polygon") {
4454
const name = meshPolygonsPolygonAttributeStyle.meshPolygonsPolygonAttributeName(id);
45-
return meshPolygonsPolygonAttributeStyle.setMeshPolygonsPolygonAttributeName(id, name);
55+
const { colorMap } =
56+
meshPolygonsPolygonAttributeStyle.meshPolygonsPolygonAttributeStoredConfig(id, name);
57+
return Promise.all([
58+
meshPolygonsPolygonAttributeStyle.setMeshPolygonsPolygonAttributeName(id, name),
59+
meshPolygonsPolygonAttributeStyle.setMeshPolygonsPolygonAttributeColorMap(id, colorMap),
60+
]);
4661
}
4762
throw new Error(`Unknown mesh polygons coloring type: ${type}`);
4863
}

0 commit comments

Comments
 (0)