@geode/opengeodeweb-front 10.4.0 → 10.4.1-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/.oxlintrc.json +72 -7
  2. package/app/components/Viewer/BreadCrumb.vue +1 -1
  3. package/app/components/Viewer/ContextMenu.vue +1 -9
  4. package/app/stores/data.js +9 -7
  5. package/app/stores/data_style.js +2 -2
  6. package/app/stores/menu.js +4 -0
  7. package/internal/stores/data_style/model/blocks/color.js +64 -0
  8. package/internal/stores/data_style/model/blocks/common.js +21 -0
  9. package/internal/stores/data_style/model/blocks/index.js +35 -0
  10. package/internal/stores/data_style/model/blocks/visibility.js +63 -0
  11. package/internal/stores/data_style/model/corners/color.js +63 -0
  12. package/internal/stores/data_style/model/corners/common.js +21 -0
  13. package/internal/stores/data_style/model/corners/index.js +36 -0
  14. package/internal/stores/data_style/model/corners/visibility.js +64 -0
  15. package/internal/stores/data_style/model/edges/common.js +13 -0
  16. package/internal/stores/data_style/model/edges/index.js +21 -0
  17. package/internal/stores/data_style/model/{edges.js → edges/visibility.js} +5 -14
  18. package/internal/stores/data_style/model/index.js +3 -3
  19. package/internal/stores/data_style/model/lines/color.js +63 -0
  20. package/internal/stores/data_style/model/lines/common.js +21 -0
  21. package/internal/stores/data_style/model/lines/index.js +35 -0
  22. package/internal/stores/data_style/model/lines/visibility.js +63 -0
  23. package/internal/stores/data_style/model/points/common.js +13 -0
  24. package/internal/stores/data_style/model/points/index.js +25 -0
  25. package/internal/stores/data_style/model/points/size.js +36 -0
  26. package/internal/stores/data_style/model/points/visibility.js +40 -0
  27. package/internal/stores/data_style/model/surfaces/color.js +62 -0
  28. package/internal/stores/data_style/model/surfaces/common.js +21 -0
  29. package/internal/stores/data_style/model/surfaces/index.js +39 -0
  30. package/internal/stores/data_style/model/surfaces/visibility.js +62 -0
  31. package/package.json +3 -3
  32. package/tests/integration/microservices/back/requirements.txt +1 -1
  33. package/tests/integration/microservices/viewer/requirements.txt +1 -1
  34. package/internal/stores/data_style/model/blocks.js +0 -126
  35. package/internal/stores/data_style/model/corners.js +0 -127
  36. package/internal/stores/data_style/model/lines.js +0 -124
  37. package/internal/stores/data_style/model/points.js +0 -69
  38. package/internal/stores/data_style/model/surfaces.js +0 -123
package/.oxlintrc.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "style": "error",
8
8
  "restriction": "error"
9
9
  },
10
- "plugins": ["import", "node", "oxc", "promise", "unicorn", "vitest"],
10
+ "plugins": ["import", "node", "oxc", "promise", "unicorn", "vitest", "vue"],
11
11
  "rules": {
12
12
  "unicorn/filename-case": [
13
13
  "error",
@@ -15,26 +15,91 @@
15
15
  "case": "snakeCase"
16
16
  }
17
17
  ],
18
- "eslint/func-style": [
18
+ "eslint/func-style": ["error", "declaration"],
19
+ "eslint/sort-keys": "off",
20
+ "eslint/no-ternary": "off", // A utiliser pour des opérations simples
21
+ "oxc/no-async-await": "off",
22
+ "oxc/no-rest-spread-properties": "off", // Enable if older browser support is needed
23
+ "eslint/max-statements": ["warn", 20],
24
+ "eslint/id-length": [
19
25
  "error",
20
26
  {
21
- "style:": "declaration"
27
+ "exceptions": [
28
+ "x",
29
+ "y",
30
+ "z",
31
+ "i",
32
+ "j",
33
+ "k",
34
+ "r",
35
+ "g",
36
+ "b",
37
+ "id",
38
+ "ID",
39
+ "fs",
40
+ "os"
41
+ ],
42
+ "min": 3
22
43
  }
23
44
  ],
24
- "eslint/sort-keys": "off",
25
- "eslint/no-ternary": "off"
45
+ "eslint/no-console": "warn", // Disable for debugging. Disable later to not have browser logs
46
+ "sort-imports": ["error", { "allowSeparatedGroups": true }],
47
+ "eslint/no-undefined": "off", // Conflict with unicorn/no-typeof-undefined which prefers direct undefined comparison
48
+ "import/prefer-default-export": "off",
49
+ "import/no-named-export": "off",
50
+ "import/no-namespace": ["error", { "ignore": ["vuetify/*"] }],
51
+ "vue/max-props": ["error", { "maxProps": 8 }],
52
+ "oxc/no-optional-chaining": "off",
53
+ "node/no-process-env": "off",
54
+ "no-continue": "off",
55
+ "import/unambiguous": "off",
56
+ "max-params": ["warn", { "max": 4 }],
57
+ "import/no-nodejs-modules": "off",
58
+ "eslint/no-magic-numbers": [
59
+ "error",
60
+ {
61
+ "ignore": [-1, 0, 1, 2, 3, 4],
62
+ "ignoreArrayIndexes": true
63
+ }
64
+ ]
26
65
  },
27
66
  "overrides": [
28
67
  {
29
- "files": ["**/components/*"],
68
+ "files": ["**/components/**"],
30
69
  "rules": {
31
70
  "unicorn/filename-case": [
32
71
  "error",
33
72
  {
34
- "case": "PascalCase"
73
+ "case": "pascalCase"
35
74
  }
36
75
  ]
37
76
  }
77
+ },
78
+ {
79
+ "files": [
80
+ "app/plugins/**",
81
+ "node_scripts/**",
82
+ "server/**",
83
+ "*.config.js"
84
+ ],
85
+ "rules": {
86
+ "import/no-default-export": "off"
87
+ }
88
+ },
89
+ {
90
+ "files": ["tests/**"],
91
+ "rules": {
92
+ "vitest/require-hook": "off",
93
+ "vitest/no-hooks": "off",
94
+ "vitest/no-importing-vitest-globals": "off",
95
+ "import/no-relative-parent-imports": "warn"
96
+ }
97
+ },
98
+ {
99
+ "files": ["**/preload.js"],
100
+ "rules": {
101
+ "import/no-commonjs": "off"
102
+ }
38
103
  }
39
104
  ]
40
105
  }
@@ -13,7 +13,7 @@
13
13
 
14
14
  const model_id = computed(() => treeviewStore.model_id)
15
15
 
16
- const metaDatas = computed(() => dataStore.getItem(model_id.value).value)
16
+ const metaDatas = dataStore.refItem(model_id.value)
17
17
  </script>
18
18
 
19
19
  <template>
@@ -1,5 +1,4 @@
1
1
  <script setup>
2
- import { useDataStore } from "@ogw_front/stores/data"
3
2
  import { useEventListener } from "@vueuse/core"
4
3
  import { useMenuStore } from "@ogw_front/stores/menu"
5
4
 
@@ -16,7 +15,6 @@
16
15
  const CLOSE_DELAY = 100
17
16
 
18
17
  const menuStore = useMenuStore()
19
- const dataStore = useDataStore()
20
18
 
21
19
  const { id, x, y, containerWidth, containerHeight } = defineProps({
22
20
  id: { type: String, required: true },
@@ -26,13 +24,7 @@
26
24
  containerHeight: { type: Number, required: true },
27
25
  })
28
26
 
29
- const meta_data = computed(() => {
30
- const itemId = id || menuStore.current_id
31
- if (!itemId) {
32
- return {}
33
- }
34
- return dataStore.getItem(itemId).value || {}
35
- })
27
+ const meta_data = computed(() => menuStore.current_meta_data || {})
36
28
 
37
29
  const show_menu = ref(true)
38
30
  const isDragging = ref(false)
@@ -15,17 +15,18 @@ const viewer_generic_schemas = viewer_schemas.opengeodeweb_viewer.generic
15
15
  export const useDataStore = defineStore("data", () => {
16
16
  const viewerStore = useViewerStore()
17
17
 
18
- function getItem(id) {
19
- if (!id) {
20
- return ref({})
21
- }
18
+ function item(id) {
19
+ return database.data.get(id)
20
+ }
21
+
22
+ function refItem(id) {
22
23
  return useObservable(
23
24
  liveQuery(() => database.data.get(id)),
24
25
  { initialValue: {} },
25
26
  )
26
27
  }
27
28
 
28
- function getAllItems() {
29
+ function refAllItems() {
29
30
  return useObservable(
30
31
  liveQuery(() => database.data.toArray()),
31
32
  { initialValue: [] },
@@ -181,8 +182,9 @@ export const useDataStore = defineStore("data", () => {
181
182
  }
182
183
 
183
184
  return {
184
- getAllItems,
185
- getItem,
185
+ refAllItems,
186
+ item,
187
+ refItem,
186
188
  meshComponentType,
187
189
  formatedMeshComponents,
188
190
  registerObject,
@@ -61,11 +61,11 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
61
61
  }
62
62
  }
63
63
 
64
- function applyAllStylesFromState() {
64
+ async function applyAllStylesFromState() {
65
65
  const ids = Object.keys(dataStyleState.styles || {})
66
66
  const promises = []
67
67
  for (const id of ids) {
68
- const meta = dataStore.getItem(id).value
68
+ const meta = await dataStore.item(id)
69
69
  const viewerType = meta?.viewer_type
70
70
  const style = dataStyleState.styles[id]
71
71
  if (style && viewerType === "mesh") {
@@ -132,6 +132,7 @@ export const useMenuStore = defineStore("menu", () => {
132
132
  const containerTop = ref(0)
133
133
  const containerLeft = ref(0)
134
134
  const active_item_index = ref(undefined)
135
+ const current_meta_data = ref({})
135
136
 
136
137
  function getMenuItems(objectType, geodeObject) {
137
138
  if (!objectType || !geodeObject || !menus.value[objectType]) {
@@ -143,6 +144,7 @@ export const useMenuStore = defineStore("menu", () => {
143
144
  function closeMenu() {
144
145
  active_item_index.value = undefined
145
146
  current_id.value = undefined
147
+ current_meta_data.value = {}
146
148
  menuX.value = 0
147
149
  menuY.value = 0
148
150
  display_menu.value = false
@@ -162,6 +164,7 @@ export const useMenuStore = defineStore("menu", () => {
162
164
  }
163
165
 
164
166
  current_id.value = id
167
+ current_meta_data.value = meta_data || {}
165
168
 
166
169
  if (x !== undefined && y !== undefined) {
167
170
  menuX.value = x
@@ -202,6 +205,7 @@ export const useMenuStore = defineStore("menu", () => {
202
205
  return {
203
206
  display_menu,
204
207
  current_id,
208
+ current_meta_data,
205
209
  menuX,
206
210
  menuY,
207
211
  containerWidth,
@@ -0,0 +1,64 @@
1
+ // Third party imports
2
+ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
3
+
4
+ // Local imports
5
+ import { useModelBlocksCommonStyle } from "./common"
6
+ import { useDataStore } from "@ogw_front/stores/data"
7
+ import { useViewerStore } from "@ogw_front/stores/viewer"
8
+
9
+ // Local constants
10
+ const model_blocks_schemas = viewer_schemas.opengeodeweb_viewer.model.blocks
11
+
12
+ export function useModelBlocksColorStyle() {
13
+ const dataStore = useDataStore()
14
+ const viewerStore = useViewerStore()
15
+ const modelBlocksCommonStyle = useModelBlocksCommonStyle()
16
+
17
+ function modelBlockColor(id, block_id) {
18
+ return modelBlocksCommonStyle.modelBlockStyle(id, block_id).color
19
+ }
20
+
21
+ function saveModelBlockColor(id, block_id, color) {
22
+ modelBlocksCommonStyle.modelBlockStyle(id, block_id).color = color
23
+ }
24
+
25
+ async function setModelBlocksColor(id, block_ids, color) {
26
+ if (!block_ids || block_ids.length === 0) {
27
+ return
28
+ }
29
+ const blocks_viewer_ids = await dataStore.getMeshComponentsViewerIds(
30
+ id,
31
+ block_ids,
32
+ )
33
+ if (!blocks_viewer_ids || blocks_viewer_ids.length === 0) {
34
+ console.warn(
35
+ "[setModelBlocksColor] No viewer IDs found, skipping color request",
36
+ { id, block_ids },
37
+ )
38
+ return
39
+ }
40
+ return viewerStore.request(
41
+ model_blocks_schemas.color,
42
+ { id, block_ids: blocks_viewer_ids, color },
43
+ {
44
+ response_function: () => {
45
+ for (const block_id of block_ids) {
46
+ saveModelBlockColor(id, block_id, color)
47
+ }
48
+
49
+ console.log(
50
+ setModelBlocksColor.name,
51
+ { id },
52
+ { block_ids },
53
+ JSON.stringify(modelBlockColor(id, block_ids[0])),
54
+ )
55
+ },
56
+ },
57
+ )
58
+ }
59
+
60
+ return {
61
+ modelBlockColor,
62
+ setModelBlocksColor,
63
+ }
64
+ }
@@ -0,0 +1,21 @@
1
+ import { useDataStyleStateStore } from "../../state"
2
+
3
+ export function useModelBlocksCommonStyle() {
4
+ const dataStyleStateStore = useDataStyleStateStore()
5
+
6
+ function modelBlocksStyle(id) {
7
+ return dataStyleStateStore.getStyle(id).blocks
8
+ }
9
+
10
+ function modelBlockStyle(id, block_id) {
11
+ if (!modelBlocksStyle(id)[block_id]) {
12
+ modelBlocksStyle(id)[block_id] = {}
13
+ }
14
+ return modelBlocksStyle(id)[block_id]
15
+ }
16
+
17
+ return {
18
+ modelBlocksStyle,
19
+ modelBlockStyle,
20
+ }
21
+ }
@@ -0,0 +1,35 @@
1
+ // Local imports
2
+ import { useModelBlocksColorStyle } from "./color"
3
+ import { useModelBlocksCommonStyle } from "./common"
4
+ import { useModelBlocksVisibilityStyle } from "./visibility"
5
+ import { useDataStore } from "@ogw_front/stores/data"
6
+
7
+ export function useModelBlocksStyle() {
8
+ const dataStore = useDataStore()
9
+ const modelBlocksCommonStyle = useModelBlocksCommonStyle()
10
+ const modelBlocksVisibilityStyle = useModelBlocksVisibilityStyle()
11
+ const modelBlocksColorStyle = useModelBlocksColorStyle()
12
+
13
+ async function applyModelBlocksStyle(id) {
14
+ const style = modelBlocksCommonStyle.modelBlocksStyle(id)
15
+ const blocks_ids = await dataStore.getBlocksGeodeIds(id)
16
+ return Promise.all([
17
+ modelBlocksVisibilityStyle.setModelBlocksVisibility(
18
+ id,
19
+ blocks_ids,
20
+ style.visibility,
21
+ ),
22
+ modelBlocksColorStyle.setModelBlocksColor(id, blocks_ids, style.color),
23
+ ])
24
+ }
25
+
26
+ async function setModelBlocksDefaultStyle(id) {}
27
+
28
+ return {
29
+ applyModelBlocksStyle,
30
+ setModelBlocksDefaultStyle,
31
+ ...modelBlocksCommonStyle,
32
+ ...modelBlocksVisibilityStyle,
33
+ ...modelBlocksColorStyle,
34
+ }
35
+ }
@@ -0,0 +1,63 @@
1
+ // Third party imports
2
+ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
3
+
4
+ // Local imports
5
+ import { useModelBlocksCommonStyle } from "./common"
6
+ import { useDataStore } from "@ogw_front/stores/data"
7
+ import { useViewerStore } from "@ogw_front/stores/viewer"
8
+
9
+ // Local constants
10
+ const model_blocks_schemas = viewer_schemas.opengeodeweb_viewer.model.blocks
11
+
12
+ export function useModelBlocksVisibilityStyle() {
13
+ const dataStore = useDataStore()
14
+ const viewerStore = useViewerStore()
15
+ const modelBlocksCommonStyle = useModelBlocksCommonStyle()
16
+
17
+ function modelBlockVisibility(id, block_id) {
18
+ return modelBlocksCommonStyle.modelBlockStyle(id, block_id).visibility
19
+ }
20
+
21
+ function saveModelBlockVisibility(id, block_id, visibility) {
22
+ modelBlocksCommonStyle.modelBlockStyle(id, block_id).visibility = visibility
23
+ }
24
+
25
+ async function setModelBlocksVisibility(id, block_ids, visibility) {
26
+ if (!block_ids || block_ids.length === 0) {
27
+ return
28
+ }
29
+ const blocks_viewer_ids = await dataStore.getMeshComponentsViewerIds(
30
+ id,
31
+ block_ids,
32
+ )
33
+ if (!blocks_viewer_ids || blocks_viewer_ids.length === 0) {
34
+ console.warn(
35
+ "[setModelBlocksVisibility] No viewer IDs found, skipping visibility request",
36
+ { id, block_ids },
37
+ )
38
+ return
39
+ }
40
+ return viewerStore.request(
41
+ model_blocks_schemas.visibility,
42
+ { id, block_ids: blocks_viewer_ids, visibility },
43
+ {
44
+ response_function: () => {
45
+ for (const block_id of block_ids) {
46
+ saveModelBlockVisibility(id, block_id, visibility)
47
+ }
48
+ console.log(
49
+ setModelBlocksVisibility.name,
50
+ { id },
51
+ { block_ids },
52
+ modelBlockVisibility(id, block_ids[0]),
53
+ )
54
+ },
55
+ },
56
+ )
57
+ }
58
+
59
+ return {
60
+ modelBlockVisibility,
61
+ setModelBlocksVisibility,
62
+ }
63
+ }
@@ -0,0 +1,63 @@
1
+ // Third party imports
2
+ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
3
+
4
+ // Local imports
5
+ import { useModelCornersCommonStyle } from "./common"
6
+ import { useDataStore } from "@ogw_front/stores/data"
7
+ import { useViewerStore } from "@ogw_front/stores/viewer"
8
+
9
+ // Local constants
10
+ const model_corners_schemas = viewer_schemas.opengeodeweb_viewer.model.corners
11
+
12
+ export function useModelCornersColorStyle() {
13
+ const dataStore = useDataStore()
14
+ const viewerStore = useViewerStore()
15
+ const modelCornersCommonStyle = useModelCornersCommonStyle()
16
+
17
+ function modelCornerColor(id, corner_id) {
18
+ return modelCornersCommonStyle.modelCornerStyle(id, corner_id).color
19
+ }
20
+
21
+ function saveModelCornerColor(id, corner_id, color) {
22
+ modelCornersCommonStyle.modelCornerStyle(id, corner_id).color = color
23
+ }
24
+
25
+ async function setModelCornersColor(id, corner_ids, color) {
26
+ if (!corner_ids || corner_ids.length === 0) {
27
+ return
28
+ }
29
+ const corner_viewer_ids = await dataStore.getMeshComponentsViewerIds(
30
+ id,
31
+ corner_ids,
32
+ )
33
+ if (!corner_viewer_ids || corner_viewer_ids.length === 0) {
34
+ console.warn(
35
+ "[setModelCornersColor] No viewer IDs found, skipping color request",
36
+ { id, corner_ids },
37
+ )
38
+ return
39
+ }
40
+ return viewerStore.request(
41
+ model_corners_schemas.color,
42
+ { id, block_ids: corner_viewer_ids, color },
43
+ {
44
+ response_function: () => {
45
+ for (const corner_id of corner_ids) {
46
+ saveModelCornerColor(id, corner_id, color)
47
+ }
48
+ console.log(
49
+ setModelCornersColor.name,
50
+ { id },
51
+ { corner_ids },
52
+ JSON.stringify(modelCornerColor(id, corner_ids[0])),
53
+ )
54
+ },
55
+ },
56
+ )
57
+ }
58
+
59
+ return {
60
+ modelCornerColor,
61
+ setModelCornersColor,
62
+ }
63
+ }
@@ -0,0 +1,21 @@
1
+ import { useDataStyleStateStore } from "../../state"
2
+
3
+ export function useModelCornersCommonStyle() {
4
+ const dataStyleStateStore = useDataStyleStateStore()
5
+
6
+ function modelCornersStyle(id) {
7
+ return dataStyleStateStore.getStyle(id).corners
8
+ }
9
+
10
+ function modelCornerStyle(id, corner_id) {
11
+ if (!modelCornersStyle(id)[corner_id]) {
12
+ modelCornersStyle(id)[corner_id] = {}
13
+ }
14
+ return modelCornersStyle(id)[corner_id]
15
+ }
16
+
17
+ return {
18
+ modelCornersStyle,
19
+ modelCornerStyle,
20
+ }
21
+ }
@@ -0,0 +1,36 @@
1
+ // Local imports
2
+ import { useModelCornersColorStyle } from "./color"
3
+ import { useModelCornersCommonStyle } from "./common"
4
+ import { useModelCornersVisibilityStyle } from "./visibility"
5
+ import { useDataStore } from "@ogw_front/stores/data"
6
+
7
+ export function useModelCornersStyle() {
8
+ const dataStore = useDataStore()
9
+ const modelCornersCommonStyle = useModelCornersCommonStyle()
10
+ const modelCornersVisibilityStyle = useModelCornersVisibilityStyle()
11
+ const modelCornersColorStyle = useModelCornersColorStyle()
12
+
13
+ async function applyModelCornersStyle(id) {
14
+ const style = modelCornersCommonStyle.modelCornersStyle(id)
15
+ const corner_ids = await dataStore.getCornersGeodeIds(id)
16
+ console.log(applyModelCornersStyle.name, { id }, { corner_ids })
17
+ return Promise.all([
18
+ modelCornersVisibilityStyle.setModelCornersVisibility(
19
+ id,
20
+ corner_ids,
21
+ style.visibility,
22
+ ),
23
+ modelCornersColorStyle.setModelCornersColor(id, corner_ids, style.color),
24
+ ])
25
+ }
26
+
27
+ async function setModelCornersDefaultStyle(id) {}
28
+
29
+ return {
30
+ applyModelCornersStyle,
31
+ setModelCornersDefaultStyle,
32
+ ...modelCornersCommonStyle,
33
+ ...modelCornersVisibilityStyle,
34
+ ...modelCornersColorStyle,
35
+ }
36
+ }
@@ -0,0 +1,64 @@
1
+ // Third party imports
2
+ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
3
+
4
+ // Local imports
5
+ import { useModelCornersCommonStyle } from "./common"
6
+ import { useDataStore } from "@ogw_front/stores/data"
7
+ import { useViewerStore } from "@ogw_front/stores/viewer"
8
+
9
+ // Local constants
10
+ const model_corners_schemas = viewer_schemas.opengeodeweb_viewer.model.corners
11
+
12
+ export function useModelCornersVisibilityStyle() {
13
+ const dataStore = useDataStore()
14
+ const viewerStore = useViewerStore()
15
+ const modelCornersCommonStyle = useModelCornersCommonStyle()
16
+
17
+ function modelCornerVisibility(id, corner_id) {
18
+ return modelCornersCommonStyle.modelCornerStyle(id, corner_id).visibility
19
+ }
20
+
21
+ function saveModelCornerVisibility(id, corner_id, visibility) {
22
+ modelCornersCommonStyle.modelCornerStyle(id, corner_id).visibility =
23
+ visibility
24
+ }
25
+
26
+ async function setModelCornersVisibility(id, corner_ids, visibility) {
27
+ if (!corner_ids || corner_ids.length === 0) {
28
+ return
29
+ }
30
+ const corner_viewer_ids = await dataStore.getMeshComponentsViewerIds(
31
+ id,
32
+ corner_ids,
33
+ )
34
+ if (!corner_viewer_ids || corner_viewer_ids.length === 0) {
35
+ console.warn(
36
+ "[setModelCornersVisibility] No viewer IDs found, skipping visibility request",
37
+ { id, corner_ids },
38
+ )
39
+ return
40
+ }
41
+ return viewerStore.request(
42
+ model_corners_schemas.visibility,
43
+ { id, block_ids: corner_viewer_ids, visibility },
44
+ {
45
+ response_function: () => {
46
+ for (const corner_id of corner_ids) {
47
+ saveModelCornerVisibility(id, corner_id, visibility)
48
+ }
49
+ console.log(
50
+ setModelCornersVisibility.name,
51
+ { id },
52
+ { corner_ids },
53
+ modelCornerVisibility(id, corner_ids[0]),
54
+ )
55
+ },
56
+ },
57
+ )
58
+ }
59
+
60
+ return {
61
+ modelCornerVisibility,
62
+ setModelCornersVisibility,
63
+ }
64
+ }
@@ -0,0 +1,13 @@
1
+ import { useDataStyleStateStore } from "../../state"
2
+
3
+ export function useModelEdgesCommonStyle() {
4
+ const dataStyleStateStore = useDataStyleStateStore()
5
+
6
+ function modelEdgesStyle(id) {
7
+ return dataStyleStateStore.styles[id].edges
8
+ }
9
+
10
+ return {
11
+ modelEdgesStyle,
12
+ }
13
+ }
@@ -0,0 +1,21 @@
1
+ // Local imports
2
+ import { useModelEdgesCommonStyle } from "./common"
3
+ import { useModelEdgesVisibilityStyle } from "./visibility"
4
+
5
+ export function useModelEdgesStyle() {
6
+ const modelEdgesCommonStyle = useModelEdgesCommonStyle()
7
+ const modelEdgesVisibilityStyle = useModelEdgesVisibilityStyle()
8
+
9
+ function applyModelEdgesStyle(id) {
10
+ const style = modelEdgesCommonStyle.modelEdgesStyle(id)
11
+ return Promise.resolve([
12
+ modelEdgesVisibilityStyle.setModelEdgesVisibility(id, style.visibility),
13
+ ])
14
+ }
15
+
16
+ return {
17
+ applyModelEdgesStyle,
18
+ ...modelEdgesCommonStyle,
19
+ ...modelEdgesVisibilityStyle,
20
+ }
21
+ }
@@ -2,21 +2,18 @@
2
2
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
3
3
 
4
4
  // Local imports
5
- import { useDataStyleStateStore } from "../state"
5
+ import { useModelEdgesCommonStyle } from "./common"
6
6
  import { useViewerStore } from "@ogw_front/stores/viewer"
7
7
 
8
8
  // Local constants
9
9
  const model_edges_schemas = viewer_schemas.opengeodeweb_viewer.model.edges
10
10
 
11
- export function useModelEdgesStyle() {
12
- const dataStyleStateStore = useDataStyleStateStore()
11
+ export function useModelEdgesVisibilityStyle() {
13
12
  const viewerStore = useViewerStore()
13
+ const modelEdgesCommonStyle = useModelEdgesCommonStyle()
14
14
 
15
- function modelEdgesStyle(id) {
16
- return dataStyleStateStore.styles[id].edges
17
- }
18
15
  function modelEdgesVisibility(id) {
19
- return modelEdgesStyle(id).visibility
16
+ return modelEdgesCommonStyle.modelEdgesStyle(id).visibility
20
17
  }
21
18
 
22
19
  function setModelEdgesVisibility(id, visibility) {
@@ -25,7 +22,7 @@ export function useModelEdgesStyle() {
25
22
  { id, visibility },
26
23
  {
27
24
  response_function: () => {
28
- modelEdgesStyle(id).visibility = visibility
25
+ modelEdgesCommonStyle.modelEdgesStyle(id).visibility = visibility
29
26
  console.log(
30
27
  setModelEdgesVisibility.name,
31
28
  { id },
@@ -36,14 +33,8 @@ export function useModelEdgesStyle() {
36
33
  )
37
34
  }
38
35
 
39
- function applyModelEdgesStyle(id) {
40
- const style = modelEdgesStyle(id)
41
- return Promise.resolve([setModelEdgesVisibility(id, style.visibility)])
42
- }
43
-
44
36
  return {
45
37
  modelEdgesVisibility,
46
38
  setModelEdgesVisibility,
47
- applyModelEdgesStyle,
48
39
  }
49
40
  }