@geode/opengeodeweb-front 10.13.3-rc.1 → 10.14.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.
- package/app/components/Viewer/ContextMenuItem.vue +2 -1
- package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +129 -52
- package/app/components/Viewer/ObjectTree/Views/ModelComponents.vue +12 -8
- package/app/components/Viewer/Options/OptionsSection.vue +74 -0
- package/app/stores/data.js +2 -2
- package/app/stores/data_style.js +11 -2
- package/app/stores/menu.js +3 -0
- package/app/utils/default_styles.js +10 -1
- package/app/utils/import_workflow.js +3 -3
- package/internal/database/base_database.js +2 -0
- package/internal/database/database.js +1 -0
- package/internal/database/tables/model_component_type_datastyle.js +4 -0
- package/internal/stores/data_style/model/blocks/color.js +8 -34
- package/internal/stores/data_style/model/blocks/common.js +5 -3
- package/internal/stores/data_style/model/blocks/index.js +31 -33
- package/internal/stores/data_style/model/blocks/visibility.js +9 -36
- package/internal/stores/data_style/model/color.js +97 -0
- package/internal/stores/data_style/model/common.js +132 -0
- package/internal/stores/data_style/model/corners/color.js +8 -32
- package/internal/stores/data_style/model/corners/common.js +5 -3
- package/internal/stores/data_style/model/corners/index.js +31 -38
- package/internal/stores/data_style/model/corners/visibility.js +8 -32
- package/internal/stores/data_style/model/index.js +50 -202
- package/internal/stores/data_style/model/lines/color.js +8 -36
- package/internal/stores/data_style/model/lines/common.js +5 -3
- package/internal/stores/data_style/model/lines/index.js +30 -31
- package/internal/stores/data_style/model/lines/visibility.js +9 -36
- package/internal/stores/data_style/model/selection.js +83 -0
- package/internal/stores/data_style/model/surfaces/color.js +8 -32
- package/internal/stores/data_style/model/surfaces/common.js +5 -3
- package/internal/stores/data_style/model/surfaces/index.js +30 -33
- package/internal/stores/data_style/model/surfaces/visibility.js +9 -34
- package/internal/stores/data_style/model/visibility.js +186 -0
- package/internal/stores/data_style/state.js +24 -31
- package/package.json +1 -1
- package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +11 -2
- package/tests/integration/stores/data_style/model/corners.nuxt.test.js +11 -2
- package/tests/integration/stores/data_style/model/lines.nuxt.test.js +11 -2
- package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +11 -2
|
@@ -96,8 +96,9 @@ function toggleOptions() {
|
|
|
96
96
|
variant="panel"
|
|
97
97
|
padding="pa-0"
|
|
98
98
|
class="elevation-24"
|
|
99
|
+
style="overflow: hidden; display: flex; flex-direction: column"
|
|
99
100
|
>
|
|
100
|
-
<v-card-text class="pa-5">
|
|
101
|
+
<v-card-text class="pa-5" style="overflow-y: auto; flex: 1; min-height: 0">
|
|
101
102
|
<slot name="options" />
|
|
102
103
|
</v-card-text>
|
|
103
104
|
</GlassCard>
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import OptionsSection from "@ogw_front/components/Viewer/Options/OptionsSection.vue";
|
|
2
3
|
import ViewerOptionsColorPicker from "@ogw_front/components/Viewer/Options/ColorPicker.vue";
|
|
3
4
|
import VisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
|
|
5
|
+
import { useDataStore } from "@ogw_front/stores/data";
|
|
4
6
|
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
5
7
|
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
6
8
|
|
|
7
9
|
const dataStyleStore = useDataStyleStore();
|
|
8
10
|
const hybridViewerStore = useHybridViewerStore();
|
|
11
|
+
const dataStore = useDataStore();
|
|
9
12
|
|
|
10
13
|
const { itemProps } = defineProps({
|
|
11
14
|
itemProps: { type: Object, required: true },
|
|
@@ -13,11 +16,43 @@ const { itemProps } = defineProps({
|
|
|
13
16
|
|
|
14
17
|
const modelId = computed(() => itemProps.meta_data.modelId || itemProps.id);
|
|
15
18
|
const componentId = computed(() => itemProps.meta_data.pickedComponentId);
|
|
19
|
+
const selection = dataStyleStore.visibleMeshComponents(modelId);
|
|
20
|
+
const componentType = ref(undefined);
|
|
21
|
+
|
|
22
|
+
watchEffect(async () => {
|
|
23
|
+
if (itemProps.meta_data.viewer_type === "model_component_type") {
|
|
24
|
+
componentType.value = itemProps.meta_data.modelComponentType;
|
|
25
|
+
} else if (componentId.value && modelId.value) {
|
|
26
|
+
componentType.value = await dataStore.meshComponentType(modelId.value, componentId.value);
|
|
27
|
+
} else {
|
|
28
|
+
componentType.value = undefined;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
16
31
|
|
|
17
32
|
const modelVisibility = computed({
|
|
18
33
|
get: () => dataStyleStore.modelVisibility(modelId.value),
|
|
19
|
-
set: (
|
|
20
|
-
dataStyleStore.setModelVisibility(modelId.value,
|
|
34
|
+
set: async (newValue) => {
|
|
35
|
+
await dataStyleStore.setModelVisibility(modelId.value, newValue);
|
|
36
|
+
hybridViewerStore.remoteRender();
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const modelComponentTypeVisibility = computed({
|
|
41
|
+
get: () => selection.value.includes(componentType.value),
|
|
42
|
+
set: async (newValue) => {
|
|
43
|
+
await dataStyleStore.setModelComponentTypeVisibility(
|
|
44
|
+
modelId.value,
|
|
45
|
+
componentType.value,
|
|
46
|
+
newValue,
|
|
47
|
+
);
|
|
48
|
+
hybridViewerStore.remoteRender();
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const componentVisibility = computed({
|
|
53
|
+
get: () => selection.value.includes(componentId.value),
|
|
54
|
+
set: async (newValue) => {
|
|
55
|
+
await dataStyleStore.setModelComponentsVisibility(modelId.value, [componentId.value], newValue);
|
|
21
56
|
hybridViewerStore.remoteRender();
|
|
22
57
|
},
|
|
23
58
|
});
|
|
@@ -25,72 +60,114 @@ const modelVisibility = computed({
|
|
|
25
60
|
const componentColor = computed({
|
|
26
61
|
get: () =>
|
|
27
62
|
componentId.value
|
|
28
|
-
? dataStyleStore.
|
|
63
|
+
? dataStyleStore.getModelComponentEffectiveColor(
|
|
64
|
+
modelId.value,
|
|
65
|
+
componentId.value,
|
|
66
|
+
componentType.value,
|
|
67
|
+
)
|
|
29
68
|
: undefined,
|
|
30
|
-
set: async (
|
|
69
|
+
set: async (color) => {
|
|
31
70
|
if (componentId.value) {
|
|
32
|
-
await dataStyleStore.setModelComponentsColor(modelId.value, [componentId.value],
|
|
71
|
+
await dataStyleStore.setModelComponentsColor(modelId.value, [componentId.value], color);
|
|
72
|
+
hybridViewerStore.remoteRender();
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const modelComponentTypeColor = computed({
|
|
78
|
+
get: () =>
|
|
79
|
+
componentType.value
|
|
80
|
+
? dataStyleStore.getModelComponentTypeColor(modelId.value, componentType.value)
|
|
81
|
+
: undefined,
|
|
82
|
+
set: async (color) => {
|
|
83
|
+
if (componentType.value) {
|
|
84
|
+
await dataStyleStore.setModelComponentTypeColor(modelId.value, componentType.value, color);
|
|
33
85
|
hybridViewerStore.remoteRender();
|
|
34
86
|
}
|
|
35
87
|
},
|
|
36
88
|
});
|
|
89
|
+
|
|
90
|
+
const modelComponentTypeColorMode = computed({
|
|
91
|
+
get: () => dataStyleStore.getModelComponentTypeColorMode(modelId.value, componentType.value),
|
|
92
|
+
set: async (colorMode) => {
|
|
93
|
+
if (componentType.value) {
|
|
94
|
+
await dataStyleStore.setModelComponentTypeColorMode(
|
|
95
|
+
modelId.value,
|
|
96
|
+
componentType.value,
|
|
97
|
+
colorMode,
|
|
98
|
+
);
|
|
99
|
+
hybridViewerStore.remoteRender();
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const componentColorMode = computed({
|
|
105
|
+
get: () => dataStyleStore.getModelComponentColorMode(modelId.value, componentId.value),
|
|
106
|
+
set: async (colorMode) => {
|
|
107
|
+
if (componentId.value) {
|
|
108
|
+
await dataStyleStore.setModelComponentColorMode(modelId.value, componentId.value, colorMode);
|
|
109
|
+
hybridViewerStore.remoteRender();
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const colorModes = [
|
|
115
|
+
{ title: "Constant", value: "constant" },
|
|
116
|
+
{ title: "Random", value: "random" },
|
|
117
|
+
];
|
|
118
|
+
|
|
119
|
+
const modelComponentTypeLabel = computed(() =>
|
|
120
|
+
componentType.value ? `${componentType.value}s Options` : "",
|
|
121
|
+
);
|
|
37
122
|
</script>
|
|
38
123
|
|
|
39
124
|
<template>
|
|
40
125
|
<div class="model-style-card">
|
|
41
|
-
<
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
126
|
+
<OptionsSection title="Model Options">
|
|
127
|
+
<VisibilitySwitch v-model="modelVisibility" />
|
|
128
|
+
</OptionsSection>
|
|
129
|
+
|
|
130
|
+
<OptionsSection v-if="componentType" :title="modelComponentTypeLabel" class="mt-6">
|
|
131
|
+
<VisibilitySwitch v-model="modelComponentTypeVisibility" />
|
|
132
|
+
<div class="text-caption mb-1 mt-2">Color Mode</div>
|
|
133
|
+
<v-select
|
|
134
|
+
v-model="modelComponentTypeColorMode"
|
|
135
|
+
:items="colorModes"
|
|
136
|
+
density="compact"
|
|
137
|
+
hide-details
|
|
138
|
+
class="mb-3"
|
|
139
|
+
variant="outlined"
|
|
140
|
+
/>
|
|
141
|
+
|
|
142
|
+
<template v-if="modelComponentTypeColorMode === 'constant'">
|
|
143
|
+
<div class="text-caption mb-1">Color</div>
|
|
144
|
+
<ViewerOptionsColorPicker v-model="modelComponentTypeColor" />
|
|
145
|
+
</template>
|
|
146
|
+
</OptionsSection>
|
|
147
|
+
|
|
148
|
+
<OptionsSection v-if="componentId" title="Component Options" class="mt-6">
|
|
149
|
+
<VisibilitySwitch v-model="componentVisibility" />
|
|
150
|
+
<div class="text-caption mb-1 mt-2">Color Mode</div>
|
|
151
|
+
<v-select
|
|
152
|
+
v-model="componentColorMode"
|
|
153
|
+
:items="colorModes"
|
|
154
|
+
density="compact"
|
|
155
|
+
hide-details
|
|
156
|
+
class="mb-3"
|
|
157
|
+
variant="outlined"
|
|
158
|
+
/>
|
|
159
|
+
|
|
160
|
+
<template v-if="componentColorMode === 'constant'">
|
|
51
161
|
<div class="text-caption mb-1">Color</div>
|
|
52
162
|
<ViewerOptionsColorPicker v-model="componentColor" />
|
|
53
|
-
</
|
|
54
|
-
</
|
|
163
|
+
</template>
|
|
164
|
+
</OptionsSection>
|
|
55
165
|
</div>
|
|
56
166
|
</template>
|
|
57
167
|
|
|
58
168
|
<style scoped>
|
|
59
169
|
.model-style-card {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
.options-section {
|
|
64
|
-
position: relative;
|
|
65
|
-
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
66
|
-
border-radius: 12px;
|
|
67
|
-
padding: 12px 8px 8px 8px;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.section-badge {
|
|
71
|
-
position: absolute;
|
|
72
|
-
top: -12px;
|
|
73
|
-
left: 16px;
|
|
74
|
-
background-color: rgba(255, 255, 255, 0.1);
|
|
75
|
-
backdrop-filter: blur(8px);
|
|
76
|
-
padding: 2px 12px;
|
|
77
|
-
font-size: 0.7rem;
|
|
78
|
-
font-weight: 700;
|
|
79
|
-
text-transform: uppercase;
|
|
80
|
-
letter-spacing: 0.5px;
|
|
81
|
-
color: white;
|
|
82
|
-
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
83
|
-
border-radius: 20px;
|
|
84
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.v-theme--light .options-section {
|
|
88
|
-
border-color: rgba(0, 0, 0, 0.12);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.v-theme--light .section-badge {
|
|
92
|
-
background-color: white;
|
|
93
|
-
color: #444;
|
|
94
|
-
border-color: rgba(0, 0, 0, 0.12);
|
|
170
|
+
padding-top: 20px;
|
|
171
|
+
overflow-x: hidden;
|
|
95
172
|
}
|
|
96
173
|
</style>
|
|
@@ -52,6 +52,17 @@ async function onSelectionChange(current) {
|
|
|
52
52
|
}
|
|
53
53
|
hybridViewerStore.remoteRender();
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
function showContextMenu(event, item) {
|
|
57
|
+
const actualItem = item.raw || item;
|
|
58
|
+
emit("show-menu", {
|
|
59
|
+
event,
|
|
60
|
+
itemId: actualItem.category ? actualItem.id : viewId,
|
|
61
|
+
context_type: actualItem.category ? "model_component" : "model_component_type",
|
|
62
|
+
modelId: viewId,
|
|
63
|
+
modelComponentType: actualItem.category ? undefined : actualItem.id,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
55
66
|
</script>
|
|
56
67
|
|
|
57
68
|
<template>
|
|
@@ -83,14 +94,7 @@ async function onSelectionChange(current) {
|
|
|
83
94
|
<ObjectTreeItemLabel
|
|
84
95
|
:item="item"
|
|
85
96
|
show-tooltip
|
|
86
|
-
@contextmenu="
|
|
87
|
-
emit('show-menu', {
|
|
88
|
-
event: $event,
|
|
89
|
-
itemId: item.id,
|
|
90
|
-
context_type: 'model_component',
|
|
91
|
-
modelId: viewId,
|
|
92
|
-
})
|
|
93
|
-
"
|
|
97
|
+
@contextmenu="showContextMenu($event, item)"
|
|
94
98
|
/>
|
|
95
99
|
</template>
|
|
96
100
|
</v-treeview>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const { title } = defineProps({
|
|
3
|
+
title: { type: String, required: true },
|
|
4
|
+
});
|
|
5
|
+
|
|
6
|
+
const isCollapsed = ref(false);
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<div class="options-section">
|
|
11
|
+
<div class="section-badge" @click="isCollapsed = !isCollapsed">
|
|
12
|
+
{{ title }}
|
|
13
|
+
<v-icon class="collapse-icon" :class="{ rotated: isCollapsed }" size="12">
|
|
14
|
+
mdi-chevron-down
|
|
15
|
+
</v-icon>
|
|
16
|
+
</div>
|
|
17
|
+
<v-container v-show="!isCollapsed" class="pa-2">
|
|
18
|
+
<slot />
|
|
19
|
+
</v-container>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<style scoped>
|
|
24
|
+
.options-section {
|
|
25
|
+
position: relative;
|
|
26
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
27
|
+
border-radius: 12px;
|
|
28
|
+
padding: 12px 8px 8px 8px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.section-badge {
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: -12px;
|
|
34
|
+
left: 16px;
|
|
35
|
+
background-color: rgba(255, 255, 255, 0.1);
|
|
36
|
+
backdrop-filter: blur(8px);
|
|
37
|
+
padding: 2px 12px;
|
|
38
|
+
font-size: 0.7rem;
|
|
39
|
+
font-weight: 700;
|
|
40
|
+
text-transform: uppercase;
|
|
41
|
+
letter-spacing: 0.5px;
|
|
42
|
+
color: white;
|
|
43
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
44
|
+
border-radius: 20px;
|
|
45
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
user-select: none;
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
gap: 4px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.section-badge:hover {
|
|
54
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.collapse-icon {
|
|
58
|
+
transition: transform 0.2s ease;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.collapse-icon.rotated {
|
|
62
|
+
transform: rotate(-90deg);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.v-theme--light .options-section {
|
|
66
|
+
border-color: rgba(0, 0, 0, 0.12);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.v-theme--light .section-badge {
|
|
70
|
+
background-color: white;
|
|
71
|
+
color: #444;
|
|
72
|
+
border-color: rgba(0, 0, 0, 0.12);
|
|
73
|
+
}
|
|
74
|
+
</style>
|
package/app/stores/data.js
CHANGED
|
@@ -184,10 +184,10 @@ export const useDataStore = defineStore("data", () => {
|
|
|
184
184
|
await database.model_components_relation.where("id").equals(modelId).delete();
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
async function getMeshComponentGeodeIds(modelId,
|
|
187
|
+
async function getMeshComponentGeodeIds(modelId, type) {
|
|
188
188
|
const components = await database.model_components
|
|
189
189
|
.where("[id+type]")
|
|
190
|
-
.equals([modelId,
|
|
190
|
+
.equals([modelId, type])
|
|
191
191
|
.toArray();
|
|
192
192
|
return components.map((component) => component.geode_id);
|
|
193
193
|
}
|
package/app/stores/data_style.js
CHANGED
|
@@ -45,12 +45,14 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
|
|
|
45
45
|
return {
|
|
46
46
|
styles: dataStyleState.styles,
|
|
47
47
|
componentStyles: dataStyleState.componentStyles,
|
|
48
|
+
modelComponentTypeStyles: dataStyleState.modelComponentTypeStyles,
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
async function importStores(snapshot) {
|
|
52
53
|
const stylesSnapshot = snapshot.styles;
|
|
53
54
|
const componentStylesSnapshot = snapshot.componentStyles;
|
|
55
|
+
const modelComponentTypeStylesSnapshot = snapshot.modelComponentTypeStyles;
|
|
54
56
|
|
|
55
57
|
await dataStyleState.clear();
|
|
56
58
|
|
|
@@ -60,12 +62,19 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
|
|
|
60
62
|
const component_style_promises = Object.values(componentStylesSnapshot).map((style) =>
|
|
61
63
|
database.model_component_datastyle.put(structuredClone(style)),
|
|
62
64
|
);
|
|
65
|
+
const model_component_type_style_promises = Object.values(modelComponentTypeStylesSnapshot).map(
|
|
66
|
+
(style) => database.model_component_type_datastyle.put(structuredClone(style)),
|
|
67
|
+
);
|
|
63
68
|
|
|
64
|
-
await Promise.all([
|
|
69
|
+
await Promise.all([
|
|
70
|
+
...style_promises,
|
|
71
|
+
...component_style_promises,
|
|
72
|
+
...model_component_type_style_promises,
|
|
73
|
+
]);
|
|
65
74
|
}
|
|
66
75
|
|
|
67
76
|
function applyAllStylesFromState() {
|
|
68
|
-
const ids = Object.keys(dataStyleState.styles);
|
|
77
|
+
const ids = Object.keys(dataStyleState.styles.value);
|
|
69
78
|
const promises = ids.map(async (id) => {
|
|
70
79
|
const meta = await dataStore.item(id);
|
|
71
80
|
const viewerType = meta.viewer_type;
|
package/app/stores/menu.js
CHANGED
|
@@ -21,6 +21,15 @@ const surfaces_defaultColor = { r: 255, g: 255, b: 255 };
|
|
|
21
21
|
const blocks_defaultVisibility = true;
|
|
22
22
|
const blocks_defaultColor = { r: 255, g: 255, b: 255 };
|
|
23
23
|
|
|
24
|
+
const DEFAULT_MODEL_COMPONENT_TYPE_COLORS = {
|
|
25
|
+
Corner: corners_defaultColor,
|
|
26
|
+
Line: lines_defaultColor,
|
|
27
|
+
Surface: surfaces_defaultColor,
|
|
28
|
+
Block: blocks_defaultColor,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const MESH_TYPES = ["Corner", "Line", "Surface", "Block"];
|
|
32
|
+
|
|
24
33
|
// Mesh functions
|
|
25
34
|
function meshPointsDefaultStyle(
|
|
26
35
|
visibility = points_defaultVisibility,
|
|
@@ -315,4 +324,4 @@ function getDefaultStyle(type) {
|
|
|
315
324
|
return default_styles()[type];
|
|
316
325
|
}
|
|
317
326
|
|
|
318
|
-
export { getDefaultStyle };
|
|
327
|
+
export { getDefaultStyle, DEFAULT_MODEL_COMPONENT_TYPE_COLORS, MESH_TYPES };
|
|
@@ -48,10 +48,10 @@ async function importItem(item) {
|
|
|
48
48
|
const addDataRelationsTask =
|
|
49
49
|
item.viewer_type === "model" ? dataStore.addComponentRelations(item) : Promise.resolve();
|
|
50
50
|
treeviewStore.addItem(item.geode_object_type, item.name, item.id, item.viewer_type);
|
|
51
|
-
dataStyleStore.addDataStyle(item.id, item.geode_object_type);
|
|
51
|
+
const addDataStyleTask = dataStyleStore.addDataStyle(item.id, item.geode_object_type);
|
|
52
52
|
const addViewerTask = addDataTask.then(() => hybridViewerStore.addItem(item.id));
|
|
53
|
-
const applyStyleTask = Promise.all([registerTask, addDataComponentsTask]).then(
|
|
54
|
-
dataStyleStore.applyDefaultStyle(item.id),
|
|
53
|
+
const applyStyleTask = Promise.all([registerTask, addDataComponentsTask, addDataStyleTask]).then(
|
|
54
|
+
() => dataStyleStore.applyDefaultStyle(item.id),
|
|
55
55
|
);
|
|
56
56
|
await Promise.all([
|
|
57
57
|
registerTask,
|
|
@@ -2,6 +2,7 @@ import { Dexie } from "dexie";
|
|
|
2
2
|
import { dataStyleTable } from "./tables/data_style";
|
|
3
3
|
import { dataTable } from "./tables/data";
|
|
4
4
|
import { modelComponentDataStyleTable } from "./tables/model_component_datastyle";
|
|
5
|
+
import { modelComponentTypeDataStyleTable } from "./tables/model_component_type_datastyle";
|
|
5
6
|
import { modelComponentsRelationTable } from "./tables/model_components_relation";
|
|
6
7
|
import { modelComponentsTable } from "./tables/model_components";
|
|
7
8
|
|
|
@@ -12,6 +13,7 @@ export class BaseDatabase extends Dexie {
|
|
|
12
13
|
[modelComponentsTable.name]: modelComponentsTable.schema,
|
|
13
14
|
[dataStyleTable.name]: dataStyleTable.schema,
|
|
14
15
|
[modelComponentDataStyleTable.name]: modelComponentDataStyleTable.schema,
|
|
16
|
+
[modelComponentTypeDataStyleTable.name]: modelComponentTypeDataStyleTable.schema,
|
|
15
17
|
[modelComponentsRelationTable.name]: modelComponentsRelationTable.schema,
|
|
16
18
|
treeview_config: "id",
|
|
17
19
|
};
|
|
@@ -1,46 +1,20 @@
|
|
|
1
|
-
// Third party imports
|
|
2
|
-
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
|
|
3
|
-
|
|
4
|
-
// Local imports
|
|
5
|
-
import { useDataStore } from "@ogw_front/stores/data";
|
|
6
1
|
import { useModelBlocksCommonStyle } from "./common";
|
|
7
|
-
import {
|
|
2
|
+
import { useModelCommonStyle } from "@ogw_internal/stores/data_style/model/common";
|
|
3
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
const model_blocks_schemas = viewer_schemas.opengeodeweb_viewer.model.blocks;
|
|
5
|
+
const schema = viewer_schemas.opengeodeweb_viewer.model.blocks.color;
|
|
11
6
|
|
|
12
|
-
export function
|
|
13
|
-
const
|
|
14
|
-
const viewerStore = useViewerStore();
|
|
7
|
+
export function useModelBlocksColor() {
|
|
8
|
+
const modelCommonStyle = useModelCommonStyle();
|
|
15
9
|
const modelBlocksCommonStyle = useModelBlocksCommonStyle();
|
|
16
10
|
|
|
17
11
|
function modelBlockColor(id, block_id) {
|
|
18
12
|
return modelBlocksCommonStyle.modelBlockStyle(id, block_id).color;
|
|
19
13
|
}
|
|
20
14
|
|
|
21
|
-
function setModelBlocksColor(
|
|
22
|
-
|
|
23
|
-
return Promise.resolve();
|
|
24
|
-
}
|
|
25
|
-
return dataStore.getMeshComponentsViewerIds(id, block_ids).then((block_viewer_ids) => {
|
|
26
|
-
if (!block_viewer_ids || block_viewer_ids.length === 0) {
|
|
27
|
-
return modelBlocksCommonStyle.mutateModelBlocksStyle(id, block_ids, {
|
|
28
|
-
color,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
return viewerStore.request(
|
|
32
|
-
model_blocks_schemas.color,
|
|
33
|
-
{ id, block_ids: block_viewer_ids, color },
|
|
34
|
-
{
|
|
35
|
-
response_function: () =>
|
|
36
|
-
modelBlocksCommonStyle.mutateModelBlocksStyle(id, block_ids, { color }),
|
|
37
|
-
},
|
|
38
|
-
);
|
|
39
|
-
});
|
|
15
|
+
function setModelBlocksColor(modelId, blocks_ids, color, color_mode = "constant") {
|
|
16
|
+
return modelCommonStyle.setModelTypeColor(modelId, blocks_ids, color, schema, color_mode);
|
|
40
17
|
}
|
|
41
18
|
|
|
42
|
-
return {
|
|
43
|
-
modelBlockColor,
|
|
44
|
-
setModelBlocksColor,
|
|
45
|
-
};
|
|
19
|
+
return { setModelBlocksColor, modelBlockColor };
|
|
46
20
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import merge from "lodash/merge";
|
|
2
2
|
import { useDataStyleState } from "@ogw_internal/stores/data_style/state";
|
|
3
|
+
import { useModelCommonStyle } from "@ogw_internal/stores/data_style/model/common";
|
|
3
4
|
|
|
4
5
|
export function useModelBlocksCommonStyle() {
|
|
5
6
|
const dataStyleState = useDataStyleState();
|
|
7
|
+
const modelCommonStyle = useModelCommonStyle();
|
|
6
8
|
|
|
7
9
|
function modelBlocksStyle(id) {
|
|
8
10
|
return dataStyleState.getStyle(id).blocks;
|
|
@@ -14,12 +16,12 @@ export function useModelBlocksCommonStyle() {
|
|
|
14
16
|
return merge({}, groupStyle, individualStyle);
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
function mutateModelBlocksStyle(id,
|
|
18
|
-
return
|
|
19
|
+
function mutateModelBlocksStyle(id, blocks_ids, values) {
|
|
20
|
+
return modelCommonStyle.mutateComponentStyles(id, blocks_ids, values);
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
function mutateModelBlockStyle(id, block_id, values) {
|
|
22
|
-
return
|
|
24
|
+
return modelCommonStyle.mutateComponentStyle(id, block_id, values);
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
return {
|
|
@@ -1,54 +1,52 @@
|
|
|
1
|
-
// Local imports
|
|
2
1
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
3
|
-
import {
|
|
2
|
+
import { useModelBlocksColor } from "./color";
|
|
4
3
|
import { useModelBlocksCommonStyle } from "./common";
|
|
5
|
-
import {
|
|
4
|
+
import { useModelBlocksVisibility } from "./visibility";
|
|
5
|
+
|
|
6
6
|
async function setModelBlocksDefaultStyle(_id) {
|
|
7
7
|
// Placeholder
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export function useModelBlocksStyle() {
|
|
11
11
|
const dataStore = useDataStore();
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
12
|
+
const modelCommonStyle = useModelBlocksCommonStyle();
|
|
13
|
+
const modelVisibilityStyle = useModelBlocksVisibility();
|
|
14
|
+
const modelColorStyle = useModelBlocksColor();
|
|
15
15
|
|
|
16
|
-
async function applyModelBlocksStyle(
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
16
|
+
async function applyModelBlocksStyle(modelId) {
|
|
17
|
+
const blocks_ids = await dataStore.getBlocksGeodeIds(modelId);
|
|
18
|
+
if (!blocks_ids?.length) {
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const visibilityGroups = {};
|
|
23
23
|
const colorGroups = {};
|
|
24
24
|
|
|
25
|
-
for (const block_id of
|
|
26
|
-
const style =
|
|
25
|
+
for (const block_id of blocks_ids) {
|
|
26
|
+
const style = modelCommonStyle.modelBlockStyle(modelId, block_id);
|
|
27
27
|
|
|
28
|
-
const
|
|
29
|
-
if (!visibilityGroups[
|
|
30
|
-
visibilityGroups[
|
|
28
|
+
const visibility = String(style.visibility);
|
|
29
|
+
if (!visibilityGroups[visibility]) {
|
|
30
|
+
visibilityGroups[visibility] = [];
|
|
31
31
|
}
|
|
32
|
-
visibilityGroups[
|
|
32
|
+
visibilityGroups[visibility].push(block_id);
|
|
33
33
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
const color_mode = style.color_mode || "constant";
|
|
35
|
+
const color_key = color_mode === "random" ? "random" : JSON.stringify(style.color);
|
|
36
|
+
if (!colorGroups[color_key]) {
|
|
37
|
+
colorGroups[color_key] = { color_mode, color: style.color, blocks_ids: [] };
|
|
37
38
|
}
|
|
38
|
-
colorGroups[
|
|
39
|
+
colorGroups[color_key].blocks_ids.push(block_id);
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
const promises = [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
for (const [cValue, ids] of Object.entries(colorGroups)) {
|
|
50
|
-
promises.push(modelBlocksColorStyle.setModelBlocksColor(id, ids, JSON.parse(cValue)));
|
|
51
|
-
}
|
|
42
|
+
const promises = [
|
|
43
|
+
...Object.entries(visibilityGroups).map(([visibility, ids]) =>
|
|
44
|
+
modelVisibilityStyle.setModelBlocksVisibility(modelId, ids, visibility === "true"),
|
|
45
|
+
),
|
|
46
|
+
...Object.values(colorGroups).map(({ color_mode, color, blocks_ids: ids }) =>
|
|
47
|
+
modelColorStyle.setModelBlocksColor(modelId, ids, color, color_mode),
|
|
48
|
+
),
|
|
49
|
+
];
|
|
52
50
|
|
|
53
51
|
return Promise.all(promises);
|
|
54
52
|
}
|
|
@@ -56,8 +54,8 @@ export function useModelBlocksStyle() {
|
|
|
56
54
|
return {
|
|
57
55
|
applyModelBlocksStyle,
|
|
58
56
|
setModelBlocksDefaultStyle,
|
|
59
|
-
...
|
|
60
|
-
...
|
|
61
|
-
...
|
|
57
|
+
...modelCommonStyle,
|
|
58
|
+
...modelVisibilityStyle,
|
|
59
|
+
...modelColorStyle,
|
|
62
60
|
};
|
|
63
61
|
}
|