@geode/opengeodeweb-front 10.4.1-rc.1 → 10.4.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/.oxlintrc.json +2 -2
- package/internal/stores/data_style/model/blocks/color.js +64 -0
- package/internal/stores/data_style/model/blocks/common.js +21 -0
- package/internal/stores/data_style/model/blocks/index.js +35 -0
- package/internal/stores/data_style/model/blocks/visibility.js +63 -0
- package/internal/stores/data_style/model/corners/color.js +63 -0
- package/internal/stores/data_style/model/corners/common.js +21 -0
- package/internal/stores/data_style/model/corners/index.js +36 -0
- package/internal/stores/data_style/model/corners/visibility.js +64 -0
- package/internal/stores/data_style/model/edges/common.js +13 -0
- package/internal/stores/data_style/model/edges/index.js +21 -0
- package/internal/stores/data_style/model/{edges.js → edges/visibility.js} +5 -14
- package/internal/stores/data_style/model/lines/color.js +63 -0
- package/internal/stores/data_style/model/lines/common.js +21 -0
- package/internal/stores/data_style/model/lines/index.js +35 -0
- package/internal/stores/data_style/model/lines/visibility.js +63 -0
- package/internal/stores/data_style/model/points/common.js +13 -0
- package/internal/stores/data_style/model/points/index.js +25 -0
- package/internal/stores/data_style/model/points/size.js +36 -0
- package/internal/stores/data_style/model/points/visibility.js +40 -0
- package/internal/stores/data_style/model/surfaces/color.js +62 -0
- package/internal/stores/data_style/model/surfaces/common.js +21 -0
- package/internal/stores/data_style/model/surfaces/index.js +39 -0
- package/internal/stores/data_style/model/surfaces/visibility.js +62 -0
- package/package.json +3 -3
- package/tests/integration/microservices/back/requirements.txt +1 -1
- package/tests/integration/microservices/viewer/requirements.txt +1 -1
- package/internal/stores/data_style/model/blocks.js +0 -126
- package/internal/stores/data_style/model/corners.js +0 -127
- package/internal/stores/data_style/model/lines.js +0 -124
- package/internal/stores/data_style/model/points.js +0 -69
- package/internal/stores/data_style/model/surfaces.js +0 -123
package/.oxlintrc.json
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"eslint/func-style": ["error", "declaration"],
|
|
19
19
|
"eslint/sort-keys": "off",
|
|
20
20
|
"eslint/no-ternary": "off", // A utiliser pour des opérations simples
|
|
21
|
+
"unicorn/prefer-ternary": "off",
|
|
21
22
|
"oxc/no-async-await": "off",
|
|
22
23
|
"oxc/no-rest-spread-properties": "off", // Enable if older browser support is needed
|
|
23
24
|
"eslint/max-statements": ["warn", 20],
|
|
@@ -91,8 +92,7 @@
|
|
|
91
92
|
"rules": {
|
|
92
93
|
"vitest/require-hook": "off",
|
|
93
94
|
"vitest/no-hooks": "off",
|
|
94
|
-
"vitest/no-importing-vitest-globals": "off"
|
|
95
|
-
"import/no-relative-parent-imports": "warn"
|
|
95
|
+
"vitest/no-importing-vitest-globals": "off"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
{
|
|
@@ -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 {
|
|
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
|
|
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
|
}
|
|
@@ -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 { useModelLinesCommonStyle } 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_lines_schemas = viewer_schemas.opengeodeweb_viewer.model.lines
|
|
11
|
+
|
|
12
|
+
export function useModelLinesColorStyle() {
|
|
13
|
+
const dataStore = useDataStore()
|
|
14
|
+
const viewerStore = useViewerStore()
|
|
15
|
+
const modelLinesCommonStyle = useModelLinesCommonStyle()
|
|
16
|
+
|
|
17
|
+
function modelLineColor(id, line_id) {
|
|
18
|
+
return modelLinesCommonStyle.modelLineStyle(id, line_id).color
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function saveModelLineColor(id, line_id, color) {
|
|
22
|
+
modelLinesCommonStyle.modelLineStyle(id, line_id).color = color
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function setModelLinesColor(id, line_ids, color) {
|
|
26
|
+
if (!line_ids || line_ids.length === 0) {
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
const line_viewer_ids = await dataStore.getMeshComponentsViewerIds(
|
|
30
|
+
id,
|
|
31
|
+
line_ids,
|
|
32
|
+
)
|
|
33
|
+
if (!line_viewer_ids || line_viewer_ids.length === 0) {
|
|
34
|
+
console.warn(
|
|
35
|
+
"[setModelLinesColor] No viewer IDs found, skipping color request",
|
|
36
|
+
{ id, line_ids },
|
|
37
|
+
)
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
return viewerStore.request(
|
|
41
|
+
model_lines_schemas.color,
|
|
42
|
+
{ id, block_ids: line_viewer_ids, color },
|
|
43
|
+
{
|
|
44
|
+
response_function: () => {
|
|
45
|
+
for (const line_id of line_ids) {
|
|
46
|
+
saveModelLineColor(id, line_id, color)
|
|
47
|
+
}
|
|
48
|
+
console.log(
|
|
49
|
+
setModelLinesColor.name,
|
|
50
|
+
{ id },
|
|
51
|
+
{ line_ids },
|
|
52
|
+
JSON.stringify(modelLineColor(id, line_ids[0])),
|
|
53
|
+
)
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
modelLineColor,
|
|
61
|
+
setModelLinesColor,
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useDataStyleStateStore } from "../../state"
|
|
2
|
+
|
|
3
|
+
export function useModelLinesCommonStyle() {
|
|
4
|
+
const dataStyleStateStore = useDataStyleStateStore()
|
|
5
|
+
|
|
6
|
+
function modelLinesStyle(id) {
|
|
7
|
+
return dataStyleStateStore.getStyle(id).lines
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function modelLineStyle(id, line_id) {
|
|
11
|
+
if (!modelLinesStyle(id)[line_id]) {
|
|
12
|
+
modelLinesStyle(id)[line_id] = {}
|
|
13
|
+
}
|
|
14
|
+
return modelLinesStyle(id)[line_id]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
modelLinesStyle,
|
|
19
|
+
modelLineStyle,
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Local imports
|
|
2
|
+
import { useModelLinesColorStyle } from "./color"
|
|
3
|
+
import { useModelLinesCommonStyle } from "./common"
|
|
4
|
+
import { useModelLinesVisibilityStyle } from "./visibility"
|
|
5
|
+
import { useDataStore } from "@ogw_front/stores/data"
|
|
6
|
+
|
|
7
|
+
export function useModelLinesStyle() {
|
|
8
|
+
const dataStore = useDataStore()
|
|
9
|
+
const modelLinesCommonStyle = useModelLinesCommonStyle()
|
|
10
|
+
const modelLinesVisibilityStyle = useModelLinesVisibilityStyle()
|
|
11
|
+
const modelLinesColorStyle = useModelLinesColorStyle()
|
|
12
|
+
|
|
13
|
+
async function applyModelLinesStyle(id) {
|
|
14
|
+
const style = modelLinesCommonStyle.modelLinesStyle(id)
|
|
15
|
+
const line_ids = await dataStore.getLinesGeodeIds(id)
|
|
16
|
+
return Promise.all([
|
|
17
|
+
modelLinesVisibilityStyle.setModelLinesVisibility(
|
|
18
|
+
id,
|
|
19
|
+
line_ids,
|
|
20
|
+
style.visibility,
|
|
21
|
+
),
|
|
22
|
+
modelLinesColorStyle.setModelLinesColor(id, line_ids, style.color),
|
|
23
|
+
])
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function setModelLinesDefaultStyle(id) {}
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
applyModelLinesStyle,
|
|
30
|
+
setModelLinesDefaultStyle,
|
|
31
|
+
...modelLinesCommonStyle,
|
|
32
|
+
...modelLinesVisibilityStyle,
|
|
33
|
+
...modelLinesColorStyle,
|
|
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 { useModelLinesCommonStyle } 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_lines_schemas = viewer_schemas.opengeodeweb_viewer.model.lines
|
|
11
|
+
|
|
12
|
+
export function useModelLinesVisibilityStyle() {
|
|
13
|
+
const dataStore = useDataStore()
|
|
14
|
+
const viewerStore = useViewerStore()
|
|
15
|
+
const modelLinesCommonStyle = useModelLinesCommonStyle()
|
|
16
|
+
|
|
17
|
+
function modelLineVisibility(id, line_id) {
|
|
18
|
+
return modelLinesCommonStyle.modelLineStyle(id, line_id).visibility
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function saveModelLineVisibility(id, line_id, visibility) {
|
|
22
|
+
modelLinesCommonStyle.modelLineStyle(id, line_id).visibility = visibility
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function setModelLinesVisibility(id, line_ids, visibility) {
|
|
26
|
+
if (!line_ids || line_ids.length === 0) {
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
const line_viewer_ids = await dataStore.getMeshComponentsViewerIds(
|
|
30
|
+
id,
|
|
31
|
+
line_ids,
|
|
32
|
+
)
|
|
33
|
+
if (!line_viewer_ids || line_viewer_ids.length === 0) {
|
|
34
|
+
console.warn(
|
|
35
|
+
"[setModelLinesVisibility] No viewer IDs found, skipping visibility request",
|
|
36
|
+
{ id, line_ids },
|
|
37
|
+
)
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
return viewerStore.request(
|
|
41
|
+
model_lines_schemas.visibility,
|
|
42
|
+
{ id, block_ids: line_viewer_ids, visibility },
|
|
43
|
+
{
|
|
44
|
+
response_function: () => {
|
|
45
|
+
for (const line_id of line_ids) {
|
|
46
|
+
saveModelLineVisibility(id, line_id, visibility)
|
|
47
|
+
}
|
|
48
|
+
console.log(
|
|
49
|
+
setModelLinesVisibility.name,
|
|
50
|
+
{ id },
|
|
51
|
+
{ line_ids },
|
|
52
|
+
modelLineVisibility(id, line_ids[0]),
|
|
53
|
+
)
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
modelLineVisibility,
|
|
61
|
+
setModelLinesVisibility,
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useDataStyleStateStore } from "../../state"
|
|
2
|
+
|
|
3
|
+
export function useModelPointsCommonStyle() {
|
|
4
|
+
const dataStyleStateStore = useDataStyleStateStore()
|
|
5
|
+
|
|
6
|
+
function modelPointsStyle(id) {
|
|
7
|
+
return dataStyleStateStore.getStyle(id).points
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
modelPointsStyle,
|
|
12
|
+
}
|
|
13
|
+
}
|