@geode/opengeodeweb-front 9.12.2-rc.1 → 9.12.2-rc.2

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.
Files changed (38) hide show
  1. package/components/Viewer/TreeComponent.vue +28 -8
  2. package/internal_stores/data_style_state.js +6 -1
  3. package/internal_stores/mesh/edges.js +18 -8
  4. package/internal_stores/mesh/index.js +21 -20
  5. package/internal_stores/mesh/points.js +22 -9
  6. package/internal_stores/mesh/polygons.js +26 -8
  7. package/internal_stores/mesh/polyhedra.js +19 -8
  8. package/internal_stores/model/blocks.js +71 -31
  9. package/internal_stores/model/corners.js +69 -32
  10. package/internal_stores/model/edges.js +16 -10
  11. package/internal_stores/model/index.js +117 -77
  12. package/internal_stores/model/lines.js +53 -36
  13. package/internal_stores/model/points.js +23 -16
  14. package/internal_stores/model/surfaces.js +63 -29
  15. package/package.json +1 -1
  16. package/stores/data_base.js +18 -32
  17. package/stores/data_style.js +18 -30
  18. package/stores/hybrid_viewer.js +12 -6
  19. package/stores/treeview.js +2 -3
  20. package/tests/integration/data/uploads/test.og_brep +0 -0
  21. package/tests/integration/microservices/viewer/requirements.txt +1 -1
  22. package/tests/integration/setup.js +16 -31
  23. package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +27 -13
  24. package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +66 -0
  25. package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +47 -13
  26. package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +27 -13
  27. package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +26 -13
  28. package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +92 -0
  29. package/tests/integration/stores/data_style/model/corners.nuxt.test.js +92 -0
  30. package/tests/integration/stores/data_style/model/edges.nuxt.test.js +57 -0
  31. package/tests/integration/stores/data_style/model/index.nuxt.test.js +57 -0
  32. package/tests/integration/stores/data_style/model/lines.nuxt.test.js +83 -0
  33. package/tests/integration/stores/data_style/model/points.nuxt.test.js +73 -0
  34. package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +96 -0
  35. package/tests/vitest.config.js +2 -1
  36. package/utils/default_styles.js +19 -7
  37. package/utils/file_import_workflow.js +82 -0
  38. package/tests/integration/utils.js +0 -35
@@ -1,61 +1,98 @@
1
+ // Third party imports
1
2
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
2
- const corners_schemas = viewer_schemas.opengeodeweb_viewer.model.corners
3
3
 
4
- export function useCornersStyle() {
5
- /** State **/
4
+ // Local constants
5
+ const model_corners_schemas = viewer_schemas.opengeodeweb_viewer.model.corners
6
+
7
+ export function useModelCornersStyle() {
6
8
  const dataStyleStore = useDataStyleStore()
7
9
  const dataBaseStore = useDataBaseStore()
8
10
 
9
- /** Getters **/
10
- function cornerVisibility(id, corner_id) {
11
- return dataStyleStore.styles[id].corners[corner_id].visibility
11
+ function modelCornersStyle(id) {
12
+ return dataStyleStore.getStyle(id).corners
13
+ }
14
+ function modelCornerStyle(id, corner_id) {
15
+ if (!modelCornersStyle(id)[corner_id]) {
16
+ modelCornersStyle(id)[corner_id] = {}
17
+ }
18
+ return modelCornersStyle(id)[corner_id]
19
+ }
20
+
21
+ function modelCornerVisibility(id, corner_id) {
22
+ return modelCornerStyle(id, corner_id).visibility
12
23
  }
13
24
 
14
- /** Actions **/
15
- function setCornerVisibility(id, corner_ids, visibility) {
25
+ function saveModelCornerVisibility(id, corner_id, visibility) {
26
+ modelCornerStyle(id, corner_id).visibility = visibility
27
+ }
28
+ function setModelCornersVisibility(id, corner_ids, visibility) {
16
29
  const corner_flat_indexes = dataBaseStore.getFlatIndexes(id, corner_ids)
17
30
  return viewer_call(
18
31
  {
19
- schema: corners_schemas.visibility,
32
+ schema: model_corners_schemas.visibility,
20
33
  params: { id, block_ids: corner_flat_indexes, visibility },
21
34
  },
22
35
  {
23
36
  response_function: () => {
24
37
  for (const corner_id of corner_ids) {
25
- if (!dataStyleStore.styles[id].corners[corner_id])
26
- dataStyleStore.styles[id].corners[corner_id] = {}
27
- dataStyleStore.styles[id].corners[corner_id].visibility = visibility
38
+ saveModelCornerVisibility(id, corner_id, visibility)
28
39
  }
29
- console.log("setCornerVisibility", corner_ids, visibility)
40
+ console.log(
41
+ setModelCornersVisibility.name,
42
+ { id },
43
+ { corner_ids },
44
+ modelCornerVisibility(id, corner_ids[0]),
45
+ )
30
46
  },
31
47
  },
32
48
  )
33
49
  }
34
50
 
35
- function setCornersDefaultStyle(id) {
36
- const corner_ids = dataBaseStore.getCornersUuids(id)
37
- console.log(
38
- "dataStyleStore.styles[id].corners.visibility",
39
- dataStyleStore.styles[id].corners.visibility,
40
- )
41
- setCornerVisibility(
42
- id,
43
- corner_ids,
44
- dataStyleStore.styles[id].corners.visibility,
51
+ function modelCornerColor(id, corner_id) {
52
+ return modelCornerStyle(id, corner_id).color
53
+ }
54
+
55
+ function saveModelCornerColor(id, corner_id, color) {
56
+ modelCornerStyle(id, corner_id).color = color
57
+ }
58
+
59
+ function setModelCornersColor(id, corner_ids, color) {
60
+ const corner_flat_indexes = dataBaseStore.getFlatIndexes(id, corner_ids)
61
+ return viewer_call(
62
+ {
63
+ schema: model_corners_schemas.color,
64
+ params: { id, block_ids: corner_flat_indexes, color },
65
+ },
66
+ {
67
+ response_function: () => {
68
+ for (const corner_id of corner_ids) {
69
+ saveModelCornerColor(id, corner_id, color)
70
+ }
71
+ console.log(
72
+ setModelCornersColor.name,
73
+ { id },
74
+ { corner_ids },
75
+ JSON.stringify(modelCornerColor(id, corner_ids[0])),
76
+ )
77
+ },
78
+ },
45
79
  )
46
80
  }
47
81
 
48
- function applyCornersStyle(id) {
49
- const corners = dataStyleStore.styles[id].corners
50
- for (const [corner_id, style] of Object.entries(corners)) {
51
- setCornerVisibility(id, [corner_id], style.visibility)
52
- }
82
+ function applyModelCornersStyle(id) {
83
+ const style = modelCornersStyle(id)
84
+ const corner_ids = dataBaseStore.getCornersUuids(id)
85
+ return Promise.all([
86
+ setModelCornersVisibility(id, corner_ids, style.visibility),
87
+ setModelCornersColor(id, corner_ids, style.color),
88
+ ])
53
89
  }
54
90
 
55
91
  return {
56
- cornerVisibility,
57
- setCornersDefaultStyle,
58
- setCornerVisibility,
59
- applyCornersStyle,
92
+ modelCornerVisibility,
93
+ modelCornerColor,
94
+ setModelCornersVisibility,
95
+ setModelCornersColor,
96
+ applyModelCornersStyle,
60
97
  }
61
98
  }
@@ -1,11 +1,17 @@
1
+ // Third party imports
1
2
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
3
+
4
+ // Local constants
2
5
  const model_edges_schemas = viewer_schemas.opengeodeweb_viewer.model.edges
3
6
 
4
7
  export function useModelEdgesStyle() {
5
8
  const dataStyleStore = useDataStyleStore()
6
9
 
10
+ function modelEdgesStyle(id) {
11
+ return dataStyleStore.styles[id].edges
12
+ }
7
13
  function modelEdgesVisibility(id) {
8
- return dataStyleStore.styles[id].edges.visibility
14
+ return modelEdgesStyle(id).visibility
9
15
  }
10
16
 
11
17
  function setModelEdgesVisibility(id, visibility) {
@@ -16,25 +22,25 @@ export function useModelEdgesStyle() {
16
22
  },
17
23
  {
18
24
  response_function: () => {
19
- dataStyleStore.styles[id].edges.visibility = visibility
20
- console.log("setModelEdgesVisibility", visibility)
25
+ modelEdgesStyle(id).visibility = visibility
26
+ console.log(
27
+ setModelEdgesVisibility.name,
28
+ { id },
29
+ modelEdgesVisibility(id),
30
+ )
21
31
  },
22
32
  },
23
33
  )
24
34
  }
25
35
 
26
- function applyModelEdgesStyle(id, style) {
27
- setModelEdgesVisibility(id, style.visibility)
28
- }
29
-
30
- function setModelEdgesDefaultStyle(id) {
31
- setModelEdgesVisibility(id, false)
36
+ function applyModelEdgesStyle(id) {
37
+ const style = modelEdgesStyle(id)
38
+ return Promise.all([setModelEdgesVisibility(id, style.visibility)])
32
39
  }
33
40
 
34
41
  return {
35
42
  modelEdgesVisibility,
36
43
  setModelEdgesVisibility,
37
44
  applyModelEdgesStyle,
38
- setModelEdgesDefaultStyle,
39
45
  }
40
46
  }
@@ -1,26 +1,45 @@
1
+ // Third party imports
1
2
  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"
3
+
4
+ // Local imports
5
+ import { useModelSurfacesStyle } from "./surfaces.js"
6
+ import { useModelCornersStyle } from "./corners.js"
7
+ import { useModelBlocksStyle } from "./blocks.js"
8
+ import { useModelLinesStyle } from "./lines.js"
6
9
  import { useModelEdgesStyle } from "./edges.js"
7
10
  import { useModelPointsStyle } from "./points.js"
8
11
 
12
+ // Local constants
13
+ const model_schemas = viewer_schemas.opengeodeweb_viewer.model
14
+
9
15
  export default function useModelStyle() {
10
- /** States **/
11
16
  const dataBaseStore = useDataBaseStore()
12
17
  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()
18
+ const modelCornersStyleStore = useModelCornersStyle()
19
+ const modelBlocksStyleStore = useModelBlocksStyle()
20
+ const modelEdgesStyleStore = useModelEdgesStyle()
21
+ const modelLinesStyleStore = useModelLinesStyle()
22
+ const modelPointsStyleStore = useModelPointsStyle()
23
+ const modelSurfacesStyleStore = useModelSurfacesStyle()
19
24
  const hybridViewerStore = useHybridViewerStore()
20
25
 
21
- /** Getters **/
22
26
  function modelVisibility(id) {
23
- return dataStyleStore.styles[id]?.visibility
27
+ return dataStyleStore.getStyle(id).visibility
28
+ }
29
+ function setModelVisibility(id, visibility) {
30
+ return viewer_call(
31
+ {
32
+ schema: model_schemas.visibility,
33
+ params: { id, visibility },
34
+ },
35
+ {
36
+ response_function: () => {
37
+ dataStyleStore.getStyle(id).visibility = visibility
38
+ hybridViewerStore.setVisibility(id, visibility)
39
+ console.log(setModelVisibility.name, { id }, modelVisibility(id))
40
+ },
41
+ },
42
+ )
24
43
  }
25
44
 
26
45
  function visibleMeshComponents(id) {
@@ -48,46 +67,31 @@ export default function useModelStyle() {
48
67
  }
49
68
 
50
69
  function modelMeshComponentVisibility(id, component_type, component_id) {
51
- switch (component_type) {
52
- case "Corner":
53
- return cornersStyleStore.cornerVisibility(id, component_id)
54
- case "Line":
55
- return linesStyleStore.lineVisibility(id, component_id)
56
- case "Surface":
57
- return surfacesStyleStore.surfaceVisibility(id, component_id)
58
- case "Block":
59
- return blocksStyleStore.blockVisibility(id, component_id)
60
- default:
61
- return false
70
+ if (component_type === "Corner") {
71
+ return modelCornersStyleStore.modelCornerVisibility(id, component_id)
72
+ } else if (component_type === "Line") {
73
+ return modelLinesStyleStore.modelLineVisibility(id, component_id)
74
+ } else if (component_type === "Surface") {
75
+ return modelSurfacesStyleStore.modelSurfaceVisibility(id, component_id)
76
+ } else if (component_type === "Block") {
77
+ return modelBlocksStyleStore.modelBlockVisibility(id, component_id)
62
78
  }
79
+ throw new Error("Unknown model component_type: " + component_type)
63
80
  }
64
81
 
65
- function setModelVisibility(id, visibility) {
66
- return viewer_call(
67
- {
68
- schema: viewer_schemas.opengeodeweb_viewer.model.visibility,
69
- params: { id, visibility },
70
- },
71
- {
72
- response_function: () => {
73
- dataStyleStore.styles[id].visibility = visibility
74
- hybridViewerStore.setVisibility(id, visibility)
75
- console.log("setModelVisibility", visibility)
76
- },
77
- },
78
- )
82
+ function modelColor(id) {
83
+ return dataStyleStore.getStyle(id).color
79
84
  }
80
-
81
85
  function setModelColor(id, color) {
82
- viewer_call(
86
+ return viewer_call(
83
87
  {
84
- schema: viewer_schemas.opengeodeweb_viewer.model.color,
88
+ schema: model_schemas.color,
85
89
  params: { id, color },
86
90
  },
87
91
  {
88
92
  response_function: () => {
89
93
  dataStyleStore.styles[id].color = color
90
- console.log("setModelColor", color)
94
+ console.log(setModelColor.name, { id }, modelColor(id))
91
95
  },
92
96
  },
93
97
  )
@@ -99,42 +103,78 @@ export default function useModelStyle() {
99
103
  component_id,
100
104
  visibility,
101
105
  ) {
102
- switch (component_type) {
103
- case "Corner":
104
- cornersStyleStore.setCornerVisibility(id, [component_id], visibility)
105
- break
106
- case "Line":
107
- linesStyleStore.setLineVisibility(id, [component_id], visibility)
108
- break
109
- case "Surface":
110
- surfacesStyleStore.setSurfaceVisibility(id, [component_id], visibility)
111
- break
112
- case "Block":
113
- blocksStyleStore.setBlockVisibility(id, [component_id], visibility)
114
- break
106
+ if (component_type === "Corner") {
107
+ return modelCornersStyleStore.setModelCornersVisibility(
108
+ id,
109
+ [component_id],
110
+ visibility,
111
+ )
112
+ } else if (component_type === "Line") {
113
+ return modelLinesStyleStore.setModelLinesVisibility(
114
+ id,
115
+ [component_id],
116
+ visibility,
117
+ )
118
+ } else if (component_type === "Surface") {
119
+ return modelSurfacesStyleStore.setModelSurfacesVisibility(
120
+ id,
121
+ [component_id],
122
+ visibility,
123
+ )
124
+ } else if (component_type === "Block") {
125
+ return modelBlocksStyleStore.setModelBlocksVisibility(
126
+ id,
127
+ [component_id],
128
+ visibility,
129
+ )
130
+ } else {
131
+ throw new Error("Unknown model component_type: " + component_type)
115
132
  }
116
133
  }
117
134
 
118
- function applyModelDefaultStyle(id) {
119
- const id_style = dataStyleStore.styles[id]
120
- for (const [key, value] of Object.entries(id_style)) {
121
- if (key === "visibility") setModelVisibility(id, value)
122
- else if (key === "edges") modelEdgesStore.applyModelEdgesStyle(id, value)
123
- else if (key === "points")
124
- modelPointsStore.applyModelPointsStyle(id, value)
135
+ function applyModelStyle(id) {
136
+ const style = dataStyleStore.getStyle(id)
137
+ const promise_array = []
138
+ for (const [key, value] of Object.entries(style)) {
139
+ if (key === "visibility") {
140
+ promise_array.push(setModelVisibility(id, value))
141
+ } else if (key === "corners") {
142
+ promise_array.push(modelCornersStyleStore.applyModelCornersStyle(id))
143
+ } else if (key === "lines") {
144
+ promise_array.push(modelLinesStyleStore.applyModelLinesStyle(id))
145
+ } else if (key === "surfaces") {
146
+ promise_array.push(modelSurfacesStyleStore.applyModelSurfacesStyle(id))
147
+ } else if (key === "blocks") {
148
+ promise_array.push(modelBlocksStyleStore.applyModelBlocksStyle(id))
149
+ } else if (key === "points") {
150
+ promise_array.push(modelPointsStyleStore.applyModelPointsStyle(id))
151
+ } else if (key === "edges") {
152
+ promise_array.push(modelEdgesStyleStore.applyModelEdgesStyle(id))
153
+ } else {
154
+ throw new Error("Unknown model key: " + key)
155
+ }
125
156
  }
157
+ return Promise.all(promise_array)
126
158
  }
127
159
 
128
- function setMeshComponentsDefaultStyle(id) {
160
+ function setModelMeshComponentsDefaultStyle(id) {
129
161
  const { mesh_components } = dataBaseStore.itemMetaDatas(id)
130
- if ("Corner" in mesh_components)
131
- cornersStyleStore.setCornersDefaultStyle(id)
132
- if ("Line" in mesh_components) linesStyleStore.setLinesDefaultStyle(id)
133
- if ("Surface" in mesh_components)
134
- surfacesStyleStore.setSurfacesDefaultStyle(id)
135
- if ("Block" in mesh_components) blocksStyleStore.setBlocksDefaultStyle(id)
136
- modelEdgesStore.setModelEdgesDefaultStyle(id)
137
- modelPointsStore.setModelPointsDefaultStyle(id)
162
+ const promise_array = []
163
+ if ("Corner" in mesh_components) {
164
+ promise_array.push(modelCornersStyleStore.setModelCornersDefaultStyle(id))
165
+ }
166
+ if ("Line" in mesh_components) {
167
+ promise_array.push(modelLinesStyleStore.setModelLinesDefaultStyle(id))
168
+ }
169
+ if ("Surface" in mesh_components) {
170
+ promise_array.push(
171
+ modelSurfacesStyleStore.setModelSurfacesDefaultStyle(id),
172
+ )
173
+ }
174
+ if ("Block" in mesh_components) {
175
+ promise_array.push(modelBlocksStyleStore.setModelBlocksDefaultStyle(id))
176
+ }
177
+ return promise_array
138
178
  }
139
179
 
140
180
  return {
@@ -144,13 +184,13 @@ export default function useModelStyle() {
144
184
  setModelVisibility,
145
185
  setModelColor,
146
186
  setModelMeshComponentVisibility,
147
- applyModelDefaultStyle,
148
- setMeshComponentsDefaultStyle,
149
- ...useSurfacesStyle(),
150
- ...useCornersStyle(),
151
- ...useBlocksStyle(),
152
- ...useLinesStyle(),
187
+ applyModelStyle,
188
+ setModelMeshComponentsDefaultStyle,
189
+ ...useModelBlocksStyle(),
190
+ ...useModelCornersStyle(),
153
191
  ...useModelEdgesStyle(),
192
+ ...useModelLinesStyle(),
154
193
  ...useModelPointsStyle(),
194
+ ...useModelSurfacesStyle(),
155
195
  }
156
196
  }
@@ -1,79 +1,96 @@
1
+ // Third party imports
1
2
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
2
- const lines_schemas = viewer_schemas.opengeodeweb_viewer.model.lines
3
3
 
4
- export function useLinesStyle() {
5
- /** State **/
4
+ // Local constants
5
+ const model_lines_schemas = viewer_schemas.opengeodeweb_viewer.model.lines
6
+
7
+ export function useModelLinesStyle() {
6
8
  const dataStyleStore = useDataStyleStore()
7
9
  const dataBaseStore = useDataBaseStore()
8
10
 
9
- /** Getters **/
10
- function lineVisibility(id, line_id) {
11
- return dataStyleStore.styles[id].lines[line_id].visibility
11
+ function modelLinesStyle(id) {
12
+ return dataStyleStore.getStyle(id).lines
13
+ }
14
+ function modelLineStyle(id, line_id) {
15
+ if (!modelLinesStyle(id)[line_id]) {
16
+ modelLinesStyle(id)[line_id] = {}
17
+ }
18
+ return modelLinesStyle(id)[line_id]
12
19
  }
13
20
 
14
- function linesColor(id) {
15
- return dataStyleStore.styles[id].lines.color
21
+ function modelLineVisibility(id, line_id) {
22
+ return modelLineStyle(id, line_id).visibility
16
23
  }
17
24
 
18
- /** Actions **/
19
- function setLineVisibility(id, line_ids, visibility) {
25
+ function saveModelLineVisibility(id, line_id, visibility) {
26
+ modelLineStyle(id, line_id).visibility = visibility
27
+ }
28
+ function setModelLinesVisibility(id, line_ids, visibility) {
20
29
  const line_flat_indexes = dataBaseStore.getFlatIndexes(id, line_ids)
21
30
  return viewer_call(
22
31
  {
23
- schema: lines_schemas.visibility,
32
+ schema: model_lines_schemas.visibility,
24
33
  params: { id, block_ids: line_flat_indexes, visibility },
25
34
  },
26
35
  {
27
36
  response_function: () => {
28
37
  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
38
+ saveModelLineVisibility(id, line_id, visibility)
32
39
  }
33
- console.log("setLineVisibility", line_ids, visibility)
40
+ console.log(
41
+ setModelLinesVisibility.name,
42
+ { id },
43
+ { line_ids },
44
+ modelLineVisibility(id, line_ids[0]),
45
+ )
34
46
  },
35
47
  },
36
48
  )
37
49
  }
38
50
 
39
- function setLineColor(id, line_ids, color) {
51
+ function modelLineColor(id, line_id) {
52
+ return modelLineStyle(id, line_id).color
53
+ }
54
+ function saveModelLineColor(id, line_id, color) {
55
+ modelLineStyle(id, line_id).color = color
56
+ }
57
+ function setModelLinesColor(id, line_ids, color) {
40
58
  const line_flat_indexes = dataBaseStore.getFlatIndexes(id, line_ids)
41
59
  return viewer_call(
42
60
  {
43
- schema: lines_schemas.color,
61
+ schema: model_lines_schemas.color,
44
62
  params: { id, block_ids: line_flat_indexes, color },
45
63
  },
46
64
  {
47
65
  response_function: () => {
48
66
  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
67
+ saveModelLineColor(id, line_id, color)
52
68
  }
53
- console.log("setLineColor", line_ids, color)
69
+ console.log(
70
+ setModelLinesColor.name,
71
+ { id },
72
+ { line_ids },
73
+ JSON.stringify(modelLineColor(id, line_ids[0])),
74
+ )
54
75
  },
55
76
  },
56
77
  )
57
78
  }
58
79
 
59
- function setLinesDefaultStyle(id) {
80
+ function applyModelLinesStyle(id) {
81
+ const style = modelLinesStyle(id)
60
82
  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
- }
83
+ return Promise.all([
84
+ setModelLinesVisibility(id, line_ids, style.visibility),
85
+ setModelLinesColor(id, line_ids, style.color),
86
+ ])
70
87
  }
71
88
 
72
89
  return {
73
- lineVisibility,
74
- linesColor,
75
- setLinesDefaultStyle,
76
- setLineVisibility,
77
- applyLinesStyle,
90
+ modelLineVisibility,
91
+ modelLineColor,
92
+ setModelLinesVisibility,
93
+ setModelLinesColor,
94
+ applyModelLinesStyle,
78
95
  }
79
96
  }
@@ -1,16 +1,18 @@
1
+ // Third party imports
1
2
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
3
+
4
+ // Local constants
2
5
  const model_points_schemas = viewer_schemas.opengeodeweb_viewer.model.points
3
6
 
4
7
  export function useModelPointsStyle() {
5
8
  const dataStyleStore = useDataStyleStore()
6
9
 
7
- function modelPointsVisibility(id) {
8
- return dataStyleStore.styles[id].points.visibility
10
+ function modelPointsStyle(id) {
11
+ return dataStyleStore.getStyle(id).points
9
12
  }
10
- function modelPointsSize(id) {
11
- return dataStyleStore.styles[id].points.size
13
+ function modelPointsVisibility(id) {
14
+ return modelPointsStyle(id).visibility
12
15
  }
13
-
14
16
  function setModelPointsVisibility(id, visibility) {
15
17
  return viewer_call(
16
18
  {
@@ -19,13 +21,20 @@ export function useModelPointsStyle() {
19
21
  },
20
22
  {
21
23
  response_function: () => {
22
- dataStyleStore.styles[id].points.visibility = visibility
23
- console.log("setModelPointsVisibility", visibility)
24
+ modelPointsStyle(id).visibility = visibility
25
+ console.log(
26
+ setModelPointsVisibility.name,
27
+ { id },
28
+ modelPointsVisibility(id),
29
+ )
24
30
  },
25
31
  },
26
32
  )
27
33
  }
28
34
 
35
+ function modelPointsSize(id) {
36
+ return modelPointsStyle(id).size
37
+ }
29
38
  function setModelPointsSize(id, size) {
30
39
  return viewer_call(
31
40
  {
@@ -35,19 +44,18 @@ export function useModelPointsStyle() {
35
44
  {
36
45
  response_function: () => {
37
46
  dataStyleStore.styles[id].points.size = size
38
- console.log("setModelPointsSize", size)
47
+ console.log(setModelPointsSize.name, { id }, modelPointsSize(id))
39
48
  },
40
49
  },
41
50
  )
42
51
  }
43
52
 
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)
53
+ function applyModelPointsStyle(id) {
54
+ const style = modelPointsStyle(id)
55
+ return Promise.all([
56
+ setModelPointsVisibility(id, style.visibility),
57
+ setModelPointsSize(id, style.size),
58
+ ])
51
59
  }
52
60
 
53
61
  return {
@@ -56,6 +64,5 @@ export function useModelPointsStyle() {
56
64
  setModelPointsVisibility,
57
65
  setModelPointsSize,
58
66
  applyModelPointsStyle,
59
- setModelPointsDefaultStyle,
60
67
  }
61
68
  }