@geode/opengeodeweb-front 9.9.0 → 9.10.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/assets/viewer_svgs/edged_curve_edges.svg +67 -0
- package/assets/viewer_svgs/edged_curve_points.svg +95 -0
- package/assets/viewer_svgs/grid_2d_cells.svg +78 -0
- package/assets/viewer_svgs/grid_2d_edges.svg +71 -0
- package/assets/viewer_svgs/grid_2d_points.svg +108 -0
- package/assets/viewer_svgs/grid_3d_cells.svg +76 -0
- package/assets/viewer_svgs/grid_3d_edges.svg +72 -0
- package/assets/viewer_svgs/grid_3d_facets.svg +102 -0
- package/assets/viewer_svgs/grid_3d_points.svg +172 -0
- package/assets/viewer_svgs/point_set_points.svg +86 -0
- package/assets/viewer_svgs/solid_edges.svg +96 -0
- package/assets/viewer_svgs/solid_facets.svg +119 -0
- package/assets/viewer_svgs/solid_points.svg +134 -0
- package/assets/viewer_svgs/solid_polyhedra.svg +103 -0
- package/assets/viewer_svgs/surface_edges.svg +73 -0
- package/assets/viewer_svgs/surface_points.svg +115 -0
- package/assets/viewer_svgs/surface_triangles.svg +92 -0
- package/components/ContextMenu.vue +123 -0
- package/components/ContextMenuItem.vue +90 -0
- package/components/EdgedCurve/EdgesOptions.vue +14 -0
- package/components/EdgedCurve/PointsOptions.vue +14 -0
- package/components/Generic/Mesh/EdgesOptions.vue +48 -0
- package/components/Generic/Mesh/PointsOptions.vue +73 -0
- package/components/Generic/Mesh/PolygonsOptions.vue +65 -0
- package/components/Generic/Mesh/PolyhedraOptions.vue +58 -0
- package/components/Generic/Model/EdgesOptions.vue +29 -0
- package/components/Generic/Model/PointsOptions.vue +53 -0
- package/components/Grid/2D/CellsOptions.vue +15 -0
- package/components/Grid/2D/EdgesOptions.vue +14 -0
- package/components/Grid/2D/PointsOptions.vue +14 -0
- package/components/Grid/3D/CellsOptions.vue +15 -0
- package/components/Grid/3D/EdgesOptions.vue +14 -0
- package/components/Grid/3D/FacetsOptions.vue +15 -0
- package/components/Grid/3D/PointsOptions.vue +14 -0
- package/components/HybridRenderingView.vue +41 -0
- package/components/HybridSolid/EdgesOptions.vue +14 -0
- package/components/HybridSolid/PointsOptions.vue +14 -0
- package/components/HybridSolid/PolygonsOptions.vue +14 -0
- package/components/HybridSolid/PolyhedraOptions.vue +14 -0
- package/components/Options/ColorPicker.vue +25 -0
- package/components/Options/ColoringTypeSelector.vue +125 -0
- package/components/Options/PolygonAttributeSelector.vue +59 -0
- package/components/Options/PolyhedronAttributeSelector.vue +63 -0
- package/components/Options/TextureItem.vue +116 -0
- package/components/Options/TexturesSelector.vue +67 -0
- package/components/Options/VertexAttributeSelector.vue +60 -0
- package/components/Options/VisibilitySwitch.vue +14 -0
- package/components/PointSet/PointsOptions.vue +14 -0
- package/components/PointSet/SpecificPointsOptions.vue +74 -0
- package/components/PolygonalSurface/EdgesOptions.vue +14 -0
- package/components/PolygonalSurface/PointsOptions.vue +14 -0
- package/components/PolygonalSurface/PolygonsOptions.vue +14 -0
- package/components/Solid/EdgesOptions.vue +14 -0
- package/components/Solid/PointsOptions.vue +14 -0
- package/components/Solid/PolygonsOptions.vue +14 -0
- package/components/Solid/PolyhedraOptions.vue +14 -0
- package/components/TetrahedralSolid/TetrahedraOptions.vue +15 -0
- package/components/TetrahedralSolid/TrianglesOptions.vue +15 -0
- package/components/TriangulatedSurface/EdgesOptions.vue +14 -0
- package/components/TriangulatedSurface/PointsOptions.vue +14 -0
- package/components/TriangulatedSurface/TrianglesOptions.vue +15 -0
- package/components/VeaseViewToolbar.vue +107 -0
- package/components/Viewer/BreadCrumb.vue +61 -0
- package/components/Viewer/Tree/ObjectTree.vue +170 -0
- package/components/Viewer/TreeComponent.vue +93 -0
- package/components/Viewer/TreeObject.vue +100 -0
- package/internal_stores/data_style_state.js +18 -0
- package/internal_stores/mesh/edges.js +106 -0
- package/internal_stores/mesh/index.js +50 -0
- package/internal_stores/mesh/points.js +131 -0
- package/internal_stores/mesh/polygons.js +159 -0
- package/internal_stores/mesh/polyhedra.js +136 -0
- package/internal_stores/model/blocks.js +60 -0
- package/internal_stores/model/corners.js +63 -0
- package/internal_stores/model/edges.js +47 -0
- package/internal_stores/model/index.js +154 -0
- package/internal_stores/model/lines.js +81 -0
- package/internal_stores/model/points.js +61 -0
- package/internal_stores/model/surfaces.js +60 -0
- package/package.json +1 -1
- package/stores/data_base.js +148 -0
- package/stores/data_style.js +57 -0
- package/stores/hybrid_viewer.js +193 -0
- package/stores/menu.js +182 -0
- package/stores/treeview.js +64 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
|
|
2
|
+
const model_edges_schemas = viewer_schemas.opengeodeweb_viewer.model.edges
|
|
3
|
+
|
|
4
|
+
export function useModelEdgesStyle() {
|
|
5
|
+
const dataStyleStore = useDataStyleStore()
|
|
6
|
+
|
|
7
|
+
function modelEdgesVisibility(id) {
|
|
8
|
+
return dataStyleStore.styles[id].edges.visibility
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function setModelEdgesVisibility(id, visibility) {
|
|
12
|
+
if (!dataStyleStore.styles[id]) {
|
|
13
|
+
dataStyleStore.styles[id] = {}
|
|
14
|
+
}
|
|
15
|
+
if (!dataStyleStore.styles[id].edges) {
|
|
16
|
+
dataStyleStore.styles[id].edges = {}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
viewer_call(
|
|
20
|
+
{
|
|
21
|
+
schema: model_edges_schemas.visibility,
|
|
22
|
+
params: { id, visibility },
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
response_function: () => {
|
|
26
|
+
dataStyleStore.styles[id].edges.visibility = visibility
|
|
27
|
+
console.log("setModelEdgesVisibility", visibility)
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function applyModelEdgesStyle(id, style) {
|
|
34
|
+
setModelEdgesVisibility(id, style.visibility)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function setModelEdgesDefaultStyle(id) {
|
|
38
|
+
setModelEdgesVisibility(id, false)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
modelEdgesVisibility,
|
|
43
|
+
setModelEdgesVisibility,
|
|
44
|
+
applyModelEdgesStyle,
|
|
45
|
+
setModelEdgesDefaultStyle,
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
|
|
2
|
+
import { useSurfacesStyle } from "./surfaces.js"
|
|
3
|
+
import { useCornersStyle } from "./corners.js"
|
|
4
|
+
import { useBlocksStyle } from "./blocks.js"
|
|
5
|
+
import { useLinesStyle } from "./lines.js"
|
|
6
|
+
import { useModelEdgesStyle } from "./edges.js"
|
|
7
|
+
import { useModelPointsStyle } from "./points.js"
|
|
8
|
+
|
|
9
|
+
export default function useModelStyle() {
|
|
10
|
+
/** States **/
|
|
11
|
+
const dataBaseStore = useDataBaseStore()
|
|
12
|
+
const dataStyleStore = useDataStyleStore()
|
|
13
|
+
const cornersStyleStore = useCornersStyle()
|
|
14
|
+
const linesStyleStore = useLinesStyle()
|
|
15
|
+
const surfacesStyleStore = useSurfacesStyle()
|
|
16
|
+
const blocksStyleStore = useBlocksStyle()
|
|
17
|
+
const modelEdgesStore = useModelEdgesStyle()
|
|
18
|
+
const modelPointsStore = useModelPointsStyle()
|
|
19
|
+
|
|
20
|
+
/** Getters **/
|
|
21
|
+
function modelVisibility(id) {
|
|
22
|
+
return dataStyleStore.styles[id]?.visibility
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function visibleMeshComponents(id) {
|
|
26
|
+
const visible_mesh_components = ref([])
|
|
27
|
+
const styles = dataStyleStore.styles[id]
|
|
28
|
+
if (!styles) return visible_mesh_components
|
|
29
|
+
|
|
30
|
+
Object.entries(styles.corners || {}).forEach(([corner_id, style]) => {
|
|
31
|
+
if (style.visibility) visible_mesh_components.value.push(corner_id)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
Object.entries(styles.lines || {}).forEach(([line_id, style]) => {
|
|
35
|
+
if (style.visibility) visible_mesh_components.value.push(line_id)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
Object.entries(styles.surfaces || {}).forEach(([surface_id, style]) => {
|
|
39
|
+
if (style.visibility) visible_mesh_components.value.push(surface_id)
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
Object.entries(styles.blocks || {}).forEach(([block_id, style]) => {
|
|
43
|
+
if (style.visibility) visible_mesh_components.value.push(block_id)
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
return visible_mesh_components
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function modelMeshComponentVisibility(id, component_type, component_id) {
|
|
50
|
+
switch (component_type) {
|
|
51
|
+
case "Corner":
|
|
52
|
+
return cornersStyleStore.cornerVisibility(id, component_id)
|
|
53
|
+
case "Line":
|
|
54
|
+
return linesStyleStore.lineVisibility(id, component_id)
|
|
55
|
+
case "Surface":
|
|
56
|
+
return surfacesStyleStore.surfaceVisibility(id, component_id)
|
|
57
|
+
case "Block":
|
|
58
|
+
return blocksStyleStore.blockVisibility(id, component_id)
|
|
59
|
+
default:
|
|
60
|
+
return false
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function setModelVisibility(id, visibility) {
|
|
65
|
+
viewer_call(
|
|
66
|
+
{
|
|
67
|
+
schema: viewer_schemas.opengeodeweb_viewer.model.visibility,
|
|
68
|
+
params: { id, visibility },
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
response_function: () => {
|
|
72
|
+
dataStyleStore.styles[id].visibility = visibility
|
|
73
|
+
console.log("setModelVisibility", visibility)
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function setModelColor(id, color) {
|
|
80
|
+
viewer_call(
|
|
81
|
+
{
|
|
82
|
+
schema: viewer_schemas.opengeodeweb_viewer.model.color,
|
|
83
|
+
params: { id, color },
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
response_function: () => {
|
|
87
|
+
dataStyleStore.styles[id].color = color
|
|
88
|
+
console.log("setModelColor", color)
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function setModelMeshComponentVisibility(
|
|
95
|
+
id,
|
|
96
|
+
component_type,
|
|
97
|
+
component_id,
|
|
98
|
+
visibility,
|
|
99
|
+
) {
|
|
100
|
+
switch (component_type) {
|
|
101
|
+
case "Corner":
|
|
102
|
+
cornersStyleStore.setCornerVisibility(id, [component_id], visibility)
|
|
103
|
+
break
|
|
104
|
+
case "Line":
|
|
105
|
+
linesStyleStore.setLineVisibility(id, [component_id], visibility)
|
|
106
|
+
break
|
|
107
|
+
case "Surface":
|
|
108
|
+
surfacesStyleStore.setSurfaceVisibility(id, [component_id], visibility)
|
|
109
|
+
break
|
|
110
|
+
case "Block":
|
|
111
|
+
blocksStyleStore.setBlockVisibility(id, [component_id], visibility)
|
|
112
|
+
break
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function applyModelDefaultStyle(id) {
|
|
117
|
+
const id_style = dataStyleStore.styles[id]
|
|
118
|
+
for (const [key, value] of Object.entries(id_style)) {
|
|
119
|
+
if (key === "visibility") setModelVisibility(id, value)
|
|
120
|
+
else if (key === "edges") modelEdgesStore.applyModelEdgesStyle(id, value)
|
|
121
|
+
else if (key === "points")
|
|
122
|
+
modelPointsStore.applyModelPointsStyle(id, value)
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function setMeshComponentsDefaultStyle(id) {
|
|
127
|
+
const { mesh_components } = dataBaseStore.itemMetaDatas(id)
|
|
128
|
+
if ("Corner" in mesh_components)
|
|
129
|
+
cornersStyleStore.setCornersDefaultStyle(id)
|
|
130
|
+
if ("Line" in mesh_components) linesStyleStore.setLinesDefaultStyle(id)
|
|
131
|
+
if ("Surface" in mesh_components)
|
|
132
|
+
surfacesStyleStore.setSurfacesDefaultStyle(id)
|
|
133
|
+
if ("Block" in mesh_components) blocksStyleStore.setBlocksDefaultStyle(id)
|
|
134
|
+
modelEdgesStore.setModelEdgesDefaultStyle(id)
|
|
135
|
+
modelPointsStore.setModelPointsDefaultStyle(id)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return {
|
|
139
|
+
modelVisibility,
|
|
140
|
+
visibleMeshComponents,
|
|
141
|
+
modelMeshComponentVisibility,
|
|
142
|
+
setModelVisibility,
|
|
143
|
+
setModelColor,
|
|
144
|
+
setModelMeshComponentVisibility,
|
|
145
|
+
applyModelDefaultStyle,
|
|
146
|
+
setMeshComponentsDefaultStyle,
|
|
147
|
+
...useSurfacesStyle(),
|
|
148
|
+
...useCornersStyle(),
|
|
149
|
+
...useBlocksStyle(),
|
|
150
|
+
...useLinesStyle(),
|
|
151
|
+
...useModelEdgesStyle(),
|
|
152
|
+
...useModelPointsStyle(),
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
|
|
2
|
+
const lines_schemas = viewer_schemas.opengeodeweb_viewer.model.lines
|
|
3
|
+
|
|
4
|
+
export function useLinesStyle() {
|
|
5
|
+
/** State **/
|
|
6
|
+
const dataStyleStore = useDataStyleStore()
|
|
7
|
+
const dataBaseStore = useDataBaseStore()
|
|
8
|
+
|
|
9
|
+
/** Getters **/
|
|
10
|
+
function lineVisibility(id, line_id) {
|
|
11
|
+
return dataStyleStore.styles[id].lines[line_id].visibility
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function linesColor(id) {
|
|
15
|
+
return dataStyleStore.styles[id].lines.color
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Actions **/
|
|
19
|
+
function setLineVisibility(id, line_ids, visibility) {
|
|
20
|
+
const line_flat_indexes = dataBaseStore.getFlatIndexes(id, line_ids)
|
|
21
|
+
viewer_call(
|
|
22
|
+
{
|
|
23
|
+
schema: lines_schemas.visibility,
|
|
24
|
+
params: { id, block_ids: line_flat_indexes, visibility },
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
response_function: () => {
|
|
28
|
+
for (const line_id of line_ids) {
|
|
29
|
+
if (!dataStyleStore.styles[id].lines[line_id])
|
|
30
|
+
dataStyleStore.styles[id].lines[line_id] = {}
|
|
31
|
+
dataStyleStore.styles[id].lines[line_id].visibility = visibility
|
|
32
|
+
}
|
|
33
|
+
console.log("setLineVisibility", line_ids, visibility)
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function setLineColor(id, line_ids, color) {
|
|
40
|
+
const line_flat_indexes = dataBaseStore.getFlatIndexes(id, line_ids)
|
|
41
|
+
viewer_call(
|
|
42
|
+
{
|
|
43
|
+
schema: lines_schemas.color,
|
|
44
|
+
params: { id, block_ids: line_flat_indexes, color },
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
response_function: () => {
|
|
48
|
+
for (const line_id of line_ids) {
|
|
49
|
+
if (!dataStyleStore.styles[id].lines[line_id])
|
|
50
|
+
dataStyleStore.styles[id].lines[line_id] = {}
|
|
51
|
+
dataStyleStore.styles[id].lines[line_id].color = color
|
|
52
|
+
}
|
|
53
|
+
console.log("setLineColor", line_ids, color)
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function setLinesDefaultStyle(id) {
|
|
60
|
+
const line_ids = dataBaseStore.getLinesUuids(id)
|
|
61
|
+
setLineVisibility(id, line_ids, dataStyleStore.styles[id].lines.visibility)
|
|
62
|
+
setLineColor(id, line_ids, dataStyleStore.styles[id].lines.color)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function applyLinesStyle(id) {
|
|
66
|
+
const lines = dataStyleStore.styles[id].lines
|
|
67
|
+
for (const [line_id, style] of Object.entries(lines)) {
|
|
68
|
+
setLineVisibility(id, [line_id], style.visibility)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
lineVisibility,
|
|
74
|
+
linesColor,
|
|
75
|
+
setLinesDefaultStyle,
|
|
76
|
+
setLineVisibility,
|
|
77
|
+
applyLinesStyle,
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export default useLinesStyle
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
|
|
2
|
+
const model_points_schemas = viewer_schemas.opengeodeweb_viewer.model.points
|
|
3
|
+
|
|
4
|
+
export function useModelPointsStyle() {
|
|
5
|
+
const dataStyleStore = useDataStyleStore()
|
|
6
|
+
|
|
7
|
+
function modelPointsVisibility(id) {
|
|
8
|
+
return dataStyleStore.styles[id].points.visibility
|
|
9
|
+
}
|
|
10
|
+
function modelPointsSize(id) {
|
|
11
|
+
return dataStyleStore.styles[id].points.size
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function setModelPointsVisibility(id, visibility) {
|
|
15
|
+
viewer_call(
|
|
16
|
+
{
|
|
17
|
+
schema: model_points_schemas.visibility,
|
|
18
|
+
params: { id, visibility },
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
response_function: () => {
|
|
22
|
+
dataStyleStore.styles[id].points.visibility = visibility
|
|
23
|
+
console.log("setModelPointsVisibility", visibility)
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function setModelPointsSize(id, size) {
|
|
30
|
+
viewer_call(
|
|
31
|
+
{
|
|
32
|
+
schema: model_points_schemas.size,
|
|
33
|
+
params: { id, size },
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
response_function: () => {
|
|
37
|
+
dataStyleStore.styles[id].points.size = size
|
|
38
|
+
console.log("setModelPointsSize", size)
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function applyModelPointsStyle(id, style) {
|
|
45
|
+
setModelPointsVisibility(id, style.visibility)
|
|
46
|
+
setModelPointsSize(id, style.size)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function setModelPointsDefaultStyle(id) {
|
|
50
|
+
setModelPointsVisibility(id, false)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
modelPointsVisibility,
|
|
55
|
+
modelPointsSize,
|
|
56
|
+
setModelPointsVisibility,
|
|
57
|
+
setModelPointsSize,
|
|
58
|
+
applyModelPointsStyle,
|
|
59
|
+
setModelPointsDefaultStyle,
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
|
|
2
|
+
const surfaces_schemas = viewer_schemas.opengeodeweb_viewer.model.surfaces
|
|
3
|
+
|
|
4
|
+
export function useSurfacesStyle() {
|
|
5
|
+
/** State **/
|
|
6
|
+
const dataStyleStore = useDataStyleStore()
|
|
7
|
+
const dataBaseStore = useDataBaseStore()
|
|
8
|
+
|
|
9
|
+
/** Getters **/
|
|
10
|
+
function surfaceVisibility(id, surface_id) {
|
|
11
|
+
return dataStyleStore.styles[id].surfaces[surface_id].visibility
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Actions **/
|
|
15
|
+
function setSurfaceVisibility(id, surface_ids, visibility) {
|
|
16
|
+
const surface_flat_indexes = dataBaseStore.getFlatIndexes(id, surface_ids)
|
|
17
|
+
viewer_call(
|
|
18
|
+
{
|
|
19
|
+
schema: surfaces_schemas.visibility,
|
|
20
|
+
params: { id, block_ids: surface_flat_indexes, visibility },
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
response_function: () => {
|
|
24
|
+
for (const surface_id of surface_ids) {
|
|
25
|
+
if (!dataStyleStore.styles[id].surfaces[surface_id])
|
|
26
|
+
dataStyleStore.styles[id].surfaces[surface_id] = {}
|
|
27
|
+
dataStyleStore.styles[id].surfaces[surface_id].visibility =
|
|
28
|
+
visibility
|
|
29
|
+
}
|
|
30
|
+
console.log("setSurfaceVisibility", surface_ids, visibility)
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function setSurfacesDefaultStyle(id) {
|
|
37
|
+
const surface_ids = dataBaseStore.getSurfacesUuids(id)
|
|
38
|
+
setSurfaceVisibility(
|
|
39
|
+
id,
|
|
40
|
+
surface_ids,
|
|
41
|
+
dataStyleStore.styles[id].surfaces.visibility,
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function applySurfacesStyle(id) {
|
|
46
|
+
const surfaces = dataStyleStore.styles[id].surfaces
|
|
47
|
+
for (const [surface_id, style] of Object.entries(surfaces)) {
|
|
48
|
+
setSurfaceVisibility(id, [surface_id], style.visibility)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
surfaceVisibility,
|
|
54
|
+
setSurfacesDefaultStyle,
|
|
55
|
+
setSurfaceVisibility,
|
|
56
|
+
applySurfacesStyle,
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export default useSurfacesStyle
|
package/package.json
CHANGED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
|
|
2
|
+
|
|
3
|
+
export const useDataBaseStore = defineStore("dataBase", () => {
|
|
4
|
+
const treeview_store = use_treeview_store()
|
|
5
|
+
const hybridViewerStore = useHybridViewerStore()
|
|
6
|
+
|
|
7
|
+
/** State **/
|
|
8
|
+
const db = reactive({})
|
|
9
|
+
|
|
10
|
+
/** Getters **/
|
|
11
|
+
function itemMetaDatas(id) {
|
|
12
|
+
return db[id]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function formatedMeshComponents(id) {
|
|
16
|
+
const { mesh_components } = itemMetaDatas(id)
|
|
17
|
+
const formated_mesh_components = ref([])
|
|
18
|
+
|
|
19
|
+
for (const [category, uuids] of Object.entries(mesh_components)) {
|
|
20
|
+
formated_mesh_components.value.push({
|
|
21
|
+
id: category,
|
|
22
|
+
title: category,
|
|
23
|
+
children: uuids.map((uuid) => ({
|
|
24
|
+
id: uuid,
|
|
25
|
+
title: uuid,
|
|
26
|
+
category,
|
|
27
|
+
})),
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
return formated_mesh_components.value
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function meshComponentType(id, uuid) {
|
|
34
|
+
const { mesh_components } = itemMetaDatas(id)
|
|
35
|
+
|
|
36
|
+
if (mesh_components["Corner"]?.includes(uuid)) return "corner"
|
|
37
|
+
else if (mesh_components["Line"]?.includes(uuid)) return "line"
|
|
38
|
+
else if (mesh_components["Surface"]?.includes(uuid)) return "surface"
|
|
39
|
+
else if (mesh_components["Block"]?.includes(uuid)) return "block"
|
|
40
|
+
return null
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Actions **/
|
|
44
|
+
async function addItem(
|
|
45
|
+
id,
|
|
46
|
+
value = {
|
|
47
|
+
object_type,
|
|
48
|
+
geode_object,
|
|
49
|
+
native_filename,
|
|
50
|
+
viewable_filename,
|
|
51
|
+
displayed_name,
|
|
52
|
+
vtk_js: { binary_light_viewable },
|
|
53
|
+
},
|
|
54
|
+
) {
|
|
55
|
+
db[id] = value
|
|
56
|
+
|
|
57
|
+
if (value.object_type === "model") {
|
|
58
|
+
await fetchMeshComponents(id)
|
|
59
|
+
await fetchUuidToFlatIndexDict(id)
|
|
60
|
+
}
|
|
61
|
+
treeview_store.addItem(
|
|
62
|
+
value.geode_object,
|
|
63
|
+
value.displayed_name,
|
|
64
|
+
id,
|
|
65
|
+
value.object_type,
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
hybridViewerStore.addItem(id, value.vtk_js)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async function fetchMeshComponents(id) {
|
|
72
|
+
const { native_filename, geode_object } = itemMetaDatas(id)
|
|
73
|
+
await api_fetch(
|
|
74
|
+
{
|
|
75
|
+
schema: back_schemas.opengeodeweb_back.models.mesh_components,
|
|
76
|
+
params: {
|
|
77
|
+
filename: native_filename,
|
|
78
|
+
geode_object,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
response_function: async (response) => {
|
|
83
|
+
if (response._data?.uuid_dict) {
|
|
84
|
+
db[id].mesh_components = response._data.uuid_dict
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async function fetchUuidToFlatIndexDict(id) {
|
|
92
|
+
await api_fetch(
|
|
93
|
+
{
|
|
94
|
+
schema: back_schemas.opengeodeweb_back.models.vtm_component_indices,
|
|
95
|
+
params: { id },
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
response_function: async (response) => {
|
|
99
|
+
if (response._data?.uuid_to_flat_index) {
|
|
100
|
+
db[id]["uuid_to_flat_index"] = response._data.uuid_to_flat_index
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function getCornersUuids(id) {
|
|
108
|
+
const { mesh_components } = itemMetaDatas(id)
|
|
109
|
+
return Object.values(mesh_components["Corner"])
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function getLinesUuids(id) {
|
|
113
|
+
const { mesh_components } = itemMetaDatas(id)
|
|
114
|
+
return Object.values(mesh_components["Line"])
|
|
115
|
+
}
|
|
116
|
+
function getSurfacesUuids(id) {
|
|
117
|
+
const { mesh_components } = itemMetaDatas(id)
|
|
118
|
+
return Object.values(mesh_components["Surface"])
|
|
119
|
+
}
|
|
120
|
+
function getBlocksUuids(id) {
|
|
121
|
+
const { mesh_components } = itemMetaDatas(id)
|
|
122
|
+
return Object.values(mesh_components["Block"])
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function getFlatIndexes(id, mesh_component_ids) {
|
|
126
|
+
const { uuid_to_flat_index } = itemMetaDatas(id)
|
|
127
|
+
|
|
128
|
+
const flat_indexes = mesh_component_ids.map(
|
|
129
|
+
(mesh_component_id) => uuid_to_flat_index[mesh_component_id] || null,
|
|
130
|
+
)
|
|
131
|
+
return flat_indexes.filter((index) => index !== null)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return {
|
|
135
|
+
db,
|
|
136
|
+
itemMetaDatas,
|
|
137
|
+
meshComponentType,
|
|
138
|
+
formatedMeshComponents,
|
|
139
|
+
addItem,
|
|
140
|
+
fetchUuidToFlatIndexDict,
|
|
141
|
+
fetchMeshComponents,
|
|
142
|
+
getCornersUuids,
|
|
143
|
+
getLinesUuids,
|
|
144
|
+
getSurfacesUuids,
|
|
145
|
+
getBlocksUuids,
|
|
146
|
+
getFlatIndexes,
|
|
147
|
+
}
|
|
148
|
+
})
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import useDataStyleState from "../internal_stores/data_style_state.js"
|
|
2
|
+
import useMeshStyle from "../internal_stores/mesh/index.js"
|
|
3
|
+
import useModelStyle from "../internal_stores/model/index.js"
|
|
4
|
+
|
|
5
|
+
export const useDataStyleStore = defineStore("dataStyle", () => {
|
|
6
|
+
/** States **/
|
|
7
|
+
const dataStyleState = useDataStyleState()
|
|
8
|
+
const meshStyleStore = useMeshStyle()
|
|
9
|
+
const modelStyleStore = useModelStyle()
|
|
10
|
+
const dataBaseStore = useDataBaseStore()
|
|
11
|
+
|
|
12
|
+
/** Actions **/
|
|
13
|
+
function addDataStyle(id, geode_object, object_type) {
|
|
14
|
+
dataStyleState.styles[id] = getDefaultStyle(geode_object)
|
|
15
|
+
|
|
16
|
+
if (object_type === "mesh") {
|
|
17
|
+
meshStyleStore.applyMeshDefaultStyle(id)
|
|
18
|
+
} else if (object_type === "model") {
|
|
19
|
+
modelStyleStore.setMeshComponentsDefaultStyle(id)
|
|
20
|
+
modelStyleStore.applyModelDefaultStyle(id)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function setVisibility(id, visibility) {
|
|
25
|
+
const object_type = dataBaseStore.itemMetaDatas(id).object_type
|
|
26
|
+
if (object_type === "mesh") {
|
|
27
|
+
meshStyleStore.setMeshVisibility(id, visibility)
|
|
28
|
+
} else if (object_type === "model") {
|
|
29
|
+
modelStyleStore.setModelVisibility(id, visibility)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function setModelEdgesVisibility(id, visibility) {
|
|
34
|
+
modelStyleStore.setModelMeshComponentVisibility(
|
|
35
|
+
id,
|
|
36
|
+
"Edge",
|
|
37
|
+
null,
|
|
38
|
+
visibility,
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function modelEdgesVisibility(id) {
|
|
43
|
+
return modelStyleStore.modelMeshComponentVisibility(id, "Edge", null)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
...dataStyleState,
|
|
48
|
+
addDataStyle,
|
|
49
|
+
setVisibility,
|
|
50
|
+
setModelEdgesVisibility,
|
|
51
|
+
modelEdgesVisibility,
|
|
52
|
+
...meshStyleStore,
|
|
53
|
+
...modelStyleStore,
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
export default useDataStyleStore
|