@geode/opengeodeweb-front 10.44.0-rc.4 → 10.44.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/assets/geode_objects.ts +1 -0
- package/app/components/Viewer/EdgedCurve/SpecificEdgesColoring.vue +12 -12
- package/app/components/Viewer/Generic/Mesh/CellsColoring.vue +17 -24
- package/app/components/Viewer/Generic/Mesh/EdgesColoring.vue +12 -12
- package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +13 -0
- package/app/components/Viewer/Generic/Mesh/PolygonsColoring.vue +17 -24
- package/app/components/Viewer/Generic/Mesh/PolyhedraColoring.vue +12 -12
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +12 -0
- package/app/components/Viewer/Options/Sliders/Opacity.vue +22 -0
- package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +13 -0
- package/app/components/Viewer/Solid/SpecificPolyhedraColoring.vue +12 -12
- package/app/components/Viewer/Surface/PolygonsColoring.vue +17 -24
- package/app/components/Viewer/Ui.vue +0 -1
- package/app/composables/batch_style_model.ts +34 -0
- package/app/composables/project_manager.ts +6 -97
- package/app/composables/project_manager_helpers/reset.ts +31 -0
- package/app/composables/project_manager_helpers/restore.ts +55 -0
- package/app/composables/project_manager_helpers/types.ts +22 -0
- package/app/composables/project_manager_helpers/viewer_session.ts +25 -0
- package/app/stores/menu_helpers/menus_data.ts +16 -120
- package/app/stores/menu_helpers/mesh/edged_curve.ts +12 -0
- package/app/stores/menu_helpers/mesh/grid.ts +24 -0
- package/app/stores/menu_helpers/mesh/point_set.ts +11 -0
- package/app/stores/menu_helpers/mesh/solid.ts +29 -0
- package/app/stores/menu_helpers/mesh/surface.ts +22 -0
- package/app/stores/menu_helpers/model.ts +25 -0
- package/app/stores/menu_helpers/types.ts +5 -0
- package/app/stores/viewer.ts +0 -1
- package/internal/stores/data_style/mesh/cells/color.ts +3 -1
- package/internal/stores/data_style/mesh/cells/index.ts +17 -1
- package/internal/stores/data_style/mesh/cells/opacity.ts +54 -0
- package/internal/stores/data_style/mesh/edges/color.ts +3 -1
- package/internal/stores/data_style/mesh/edges/index.ts +17 -1
- package/internal/stores/data_style/mesh/edges/opacity.ts +54 -0
- package/internal/stores/data_style/mesh/points/color.ts +3 -1
- package/internal/stores/data_style/mesh/points/index.ts +17 -1
- package/internal/stores/data_style/mesh/points/opacity.ts +54 -0
- package/internal/stores/data_style/mesh/polygons/color.ts +3 -1
- package/internal/stores/data_style/mesh/polygons/index.ts +17 -1
- package/internal/stores/data_style/mesh/polygons/opacity.ts +54 -0
- package/internal/stores/data_style/mesh/polyhedra/color.ts +3 -1
- package/internal/stores/data_style/mesh/polyhedra/index.ts +17 -1
- package/internal/stores/data_style/mesh/polyhedra/opacity.ts +54 -0
- package/package.json +1 -1
|
@@ -1,37 +1,12 @@
|
|
|
1
|
-
import back_schemas
|
|
2
|
-
type CRSList,
|
|
3
|
-
} from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
|
|
1
|
+
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
|
|
4
2
|
import fileDownload from "js-file-download";
|
|
5
|
-
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
6
3
|
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import type { CameraSnapshot } from "@ogw_internal/stores/hybrid_viewer/camera";
|
|
11
|
-
import type { ModelComponentRecord } from "@ogw_front/stores/data_helpers/mesh.js";
|
|
12
|
-
import type { ModelComponentRelationRecord } from "@ogw_front/stores/data.js";
|
|
13
|
-
import { importWorkflowFromSnapshot } from "@ogw_front/utils/import_workflow";
|
|
14
|
-
import { oldestCrs } from "@ogw_front/utils/crs";
|
|
4
|
+
import type { ProjectSnapshot } from "@ogw_front/composables/project_manager_helpers/types";
|
|
5
|
+
import { resetProject } from "@ogw_front/composables/project_manager_helpers/reset";
|
|
6
|
+
import { restoreProject } from "@ogw_front/composables/project_manager_helpers/restore";
|
|
15
7
|
import { useAppStore } from "@ogw_front/stores/app";
|
|
16
8
|
import { useBackStore } from "@ogw_front/stores/back";
|
|
17
|
-
import { useCrsStore } from "@ogw_front/stores/crs";
|
|
18
9
|
import { useFeedbackStore } from "@ogw_front/stores/feedback";
|
|
19
|
-
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
20
|
-
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
21
|
-
|
|
22
|
-
interface ProjectDataSnapshot {
|
|
23
|
-
items: NewDataItem[];
|
|
24
|
-
modelComponents: ModelComponentRecord[];
|
|
25
|
-
modelComponentsRelations: ModelComponentRelationRecord[];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface ProjectSnapshot {
|
|
29
|
-
treeview?: TreeviewSnapshot;
|
|
30
|
-
data?: ProjectDataSnapshot;
|
|
31
|
-
hybridViewer?: CameraSnapshot;
|
|
32
|
-
dataStyle?: DataStyleSnapshot;
|
|
33
|
-
crs?: { projectCrs?: CRSList };
|
|
34
|
-
}
|
|
35
10
|
|
|
36
11
|
async function exportProject(): Promise<{ result: Blob }> {
|
|
37
12
|
const appStore = useAppStore();
|
|
@@ -47,50 +22,10 @@ async function exportProject(): Promise<{ result: Blob }> {
|
|
|
47
22
|
return { result };
|
|
48
23
|
}
|
|
49
24
|
|
|
50
|
-
async function releaseViewerDatabase(
|
|
51
|
-
client: ReturnType<typeof useViewerStore>["client"],
|
|
52
|
-
): Promise<void> {
|
|
53
|
-
if (
|
|
54
|
-
client !== undefined &&
|
|
55
|
-
client.getConnection !== undefined &&
|
|
56
|
-
client.getConnection().getSession !== undefined
|
|
57
|
-
) {
|
|
58
|
-
await client.getConnection().getSession().call("opengeodeweb_viewer.release_database", [{}]);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
async function importProjectToViewer(
|
|
63
|
-
client: ReturnType<typeof useViewerStore>["client"],
|
|
64
|
-
): Promise<void> {
|
|
65
|
-
if (
|
|
66
|
-
client !== undefined &&
|
|
67
|
-
client.getConnection !== undefined &&
|
|
68
|
-
client.getConnection().getSession !== undefined
|
|
69
|
-
) {
|
|
70
|
-
await client.getConnection().getSession().call("opengeodeweb_viewer.import_project", [{}]);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
25
|
async function importProject(file: File): Promise<void> {
|
|
75
26
|
const backStore = useBackStore();
|
|
76
|
-
const dataStyleStore = useDataStyleStore();
|
|
77
|
-
const viewerStore = useViewerStore();
|
|
78
|
-
const dataStore = useDataStore();
|
|
79
|
-
const treeviewStore = useTreeviewStore();
|
|
80
|
-
const hybridViewerStore = useHybridViewerStore();
|
|
81
|
-
const crsStore = useCrsStore();
|
|
82
|
-
|
|
83
|
-
await viewerStore.ws_connect();
|
|
84
|
-
|
|
85
|
-
await releaseViewerDatabase(viewerStore.client);
|
|
86
|
-
const resetVisualizationSchema = viewer_schemas.opengeodeweb_viewer.viewer.reset_visualization;
|
|
87
|
-
const timeout = undefined;
|
|
88
|
-
await viewerStore.request({ schema: resetVisualizationSchema, timeout });
|
|
89
27
|
|
|
90
|
-
|
|
91
|
-
await dataStore.clear();
|
|
92
|
-
hybridViewerStore.clear();
|
|
93
|
-
crsStore.reset();
|
|
28
|
+
await resetProject();
|
|
94
29
|
|
|
95
30
|
const importProjectSchema = back_schemas.opengeodeweb_back.import_project;
|
|
96
31
|
const form = new FormData();
|
|
@@ -103,34 +38,8 @@ async function importProject(file: File): Promise<void> {
|
|
|
103
38
|
const result = await backStore.request({ schema: importProjectSchema, params: form });
|
|
104
39
|
const snapshot: ProjectSnapshot = result.snapshot;
|
|
105
40
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
await importProjectToViewer(viewerStore.client);
|
|
109
|
-
|
|
110
|
-
treeviewStore.importStores(snapshot.treeview);
|
|
111
|
-
if (snapshot.data !== undefined) {
|
|
112
|
-
await dataStore.importStores(snapshot.data);
|
|
113
|
-
}
|
|
114
|
-
await hybridViewerStore.initHybridViewer();
|
|
115
|
-
|
|
116
|
-
const items = snapshot.data?.items ?? [];
|
|
117
|
-
await importWorkflowFromSnapshot(items);
|
|
118
|
-
// After every data item is added: on partial data the project CRS would follow them.
|
|
119
|
-
// A project saved without a project CRS takes the one of its oldest data, read in the
|
|
120
|
-
// Snapshot: the stored items carry the import time as creation date
|
|
121
|
-
if (snapshot.crs?.projectCrs === undefined) {
|
|
122
|
-
crsStore.importStores({ projectCrs: oldestCrs(snapshot.data?.items ?? []) });
|
|
123
|
-
} else {
|
|
124
|
-
crsStore.importStores(snapshot.crs);
|
|
125
|
-
}
|
|
126
|
-
await hybridViewerStore.importStores(snapshot.hybridViewer);
|
|
127
|
-
if (snapshot.dataStyle !== undefined) {
|
|
128
|
-
await dataStyleStore.importStores(snapshot.dataStyle);
|
|
129
|
-
}
|
|
130
|
-
await dataStyleStore.applyAllStylesFromState();
|
|
41
|
+
await restoreProject(snapshot);
|
|
131
42
|
|
|
132
|
-
treeviewStore.finalizeImportSelection();
|
|
133
|
-
treeviewStore.isImporting = false;
|
|
134
43
|
const feedbackStore = useFeedbackStore();
|
|
135
44
|
feedbackStore.add_success("Project imported successfully");
|
|
136
45
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
2
|
+
|
|
3
|
+
import { releaseViewerDatabase } from "@ogw_front/composables/project_manager_helpers/viewer_session";
|
|
4
|
+
import { useCrsStore } from "@ogw_front/stores/crs";
|
|
5
|
+
import { useDataStore } from "@ogw_front/stores/data";
|
|
6
|
+
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
7
|
+
import { useTreeviewStore } from "@ogw_front/stores/treeview";
|
|
8
|
+
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
9
|
+
|
|
10
|
+
// Empties the viewer and every store, ready to receive an imported project.
|
|
11
|
+
async function resetProject(): Promise<void> {
|
|
12
|
+
const viewerStore = useViewerStore();
|
|
13
|
+
const dataStore = useDataStore();
|
|
14
|
+
const treeviewStore = useTreeviewStore();
|
|
15
|
+
const hybridViewerStore = useHybridViewerStore();
|
|
16
|
+
const crsStore = useCrsStore();
|
|
17
|
+
|
|
18
|
+
await viewerStore.ws_connect();
|
|
19
|
+
|
|
20
|
+
await releaseViewerDatabase(viewerStore.client);
|
|
21
|
+
const resetVisualizationSchema = viewer_schemas.opengeodeweb_viewer.viewer.reset_visualization;
|
|
22
|
+
const timeout = undefined;
|
|
23
|
+
await viewerStore.request({ schema: resetVisualizationSchema, timeout });
|
|
24
|
+
|
|
25
|
+
treeviewStore.clear();
|
|
26
|
+
await dataStore.clear();
|
|
27
|
+
hybridViewerStore.clear();
|
|
28
|
+
crsStore.reset();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { resetProject };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ProjectSnapshot } from "@ogw_front/composables/project_manager_helpers/types";
|
|
2
|
+
import { importProjectToViewer } from "@ogw_front/composables/project_manager_helpers/viewer_session";
|
|
3
|
+
import { importWorkflowFromSnapshot } from "@ogw_front/utils/import_workflow";
|
|
4
|
+
import { oldestCrs } from "@ogw_front/utils/crs";
|
|
5
|
+
import { useCrsStore } from "@ogw_front/stores/crs";
|
|
6
|
+
import { useDataStore } from "@ogw_front/stores/data";
|
|
7
|
+
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
8
|
+
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
9
|
+
import { useTreeviewStore } from "@ogw_front/stores/treeview";
|
|
10
|
+
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
11
|
+
|
|
12
|
+
// After every data item is added: on partial data the project CRS would follow them.
|
|
13
|
+
// A project saved without a project CRS takes the one of its oldest data, read in the
|
|
14
|
+
// Snapshot: the stored items carry the import time as creation date
|
|
15
|
+
function restoreCrs(snapshot: ProjectSnapshot): void {
|
|
16
|
+
const crsStore = useCrsStore();
|
|
17
|
+
if (snapshot.crs?.projectCrs === undefined) {
|
|
18
|
+
crsStore.importStores({ projectCrs: oldestCrs(snapshot.data?.items ?? []) });
|
|
19
|
+
} else {
|
|
20
|
+
crsStore.importStores(snapshot.crs);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Loads a project snapshot into the (already reset) viewer and stores.
|
|
25
|
+
async function restoreProject(snapshot: ProjectSnapshot): Promise<void> {
|
|
26
|
+
const dataStyleStore = useDataStyleStore();
|
|
27
|
+
const viewerStore = useViewerStore();
|
|
28
|
+
const dataStore = useDataStore();
|
|
29
|
+
const treeviewStore = useTreeviewStore();
|
|
30
|
+
const hybridViewerStore = useHybridViewerStore();
|
|
31
|
+
|
|
32
|
+
treeviewStore.isImporting = true;
|
|
33
|
+
|
|
34
|
+
await importProjectToViewer(viewerStore.client);
|
|
35
|
+
|
|
36
|
+
treeviewStore.importStores(snapshot.treeview);
|
|
37
|
+
if (snapshot.data !== undefined) {
|
|
38
|
+
await dataStore.importStores(snapshot.data);
|
|
39
|
+
}
|
|
40
|
+
await hybridViewerStore.initHybridViewer();
|
|
41
|
+
|
|
42
|
+
const items = snapshot.data?.items ?? [];
|
|
43
|
+
await importWorkflowFromSnapshot(items);
|
|
44
|
+
restoreCrs(snapshot);
|
|
45
|
+
await hybridViewerStore.importStores(snapshot.hybridViewer);
|
|
46
|
+
if (snapshot.dataStyle !== undefined) {
|
|
47
|
+
await dataStyleStore.importStores(snapshot.dataStyle);
|
|
48
|
+
}
|
|
49
|
+
await dataStyleStore.applyAllStylesFromState();
|
|
50
|
+
|
|
51
|
+
treeviewStore.finalizeImportSelection();
|
|
52
|
+
treeviewStore.isImporting = false;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { restoreProject };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ModelComponentRelationRecord, NewDataItem } from "@ogw_front/stores/data";
|
|
2
|
+
import type { CRSList } from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
|
|
3
|
+
import type { CameraSnapshot } from "@ogw_internal/stores/hybrid_viewer/camera";
|
|
4
|
+
import type { DataStyleSnapshot } from "@ogw_front/stores/data_style";
|
|
5
|
+
import type { ModelComponentRecord } from "@ogw_front/stores/data_helpers/mesh.js";
|
|
6
|
+
import type { TreeviewSnapshot } from "@ogw_front/stores/treeview";
|
|
7
|
+
|
|
8
|
+
interface ProjectDataSnapshot {
|
|
9
|
+
items: NewDataItem[];
|
|
10
|
+
modelComponents: ModelComponentRecord[];
|
|
11
|
+
modelComponentsRelations: ModelComponentRelationRecord[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface ProjectSnapshot {
|
|
15
|
+
treeview?: TreeviewSnapshot;
|
|
16
|
+
data?: ProjectDataSnapshot;
|
|
17
|
+
hybridViewer?: CameraSnapshot;
|
|
18
|
+
dataStyle?: DataStyleSnapshot;
|
|
19
|
+
crs?: { projectCrs?: CRSList };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type { ProjectSnapshot };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { useViewerStore } from "@ogw_front/stores/viewer";
|
|
2
|
+
|
|
3
|
+
type ViewerClient = ReturnType<typeof useViewerStore>["client"];
|
|
4
|
+
|
|
5
|
+
async function releaseViewerDatabase(client: ViewerClient): Promise<void> {
|
|
6
|
+
if (
|
|
7
|
+
client !== undefined &&
|
|
8
|
+
client.getConnection !== undefined &&
|
|
9
|
+
client.getConnection().getSession !== undefined
|
|
10
|
+
) {
|
|
11
|
+
await client.getConnection().getSession().call("opengeodeweb_viewer.release_database", [{}]);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async function importProjectToViewer(client: ViewerClient): Promise<void> {
|
|
16
|
+
if (
|
|
17
|
+
client !== undefined &&
|
|
18
|
+
client.getConnection !== undefined &&
|
|
19
|
+
client.getConnection().getSession !== undefined
|
|
20
|
+
) {
|
|
21
|
+
await client.getConnection().getSession().call("opengeodeweb_viewer.import_project", [{}]);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { importProjectToViewer, releaseViewerDatabase };
|
|
@@ -1,127 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
// Surface components
|
|
9
|
-
import SurfaceEdgesOptions from "@ogw_front/components/Viewer/Surface/EdgesOptions.vue";
|
|
10
|
-
import SurfacePointsOptions from "@ogw_front/components/Viewer/Surface/PointsOptions.vue";
|
|
11
|
-
import SurfacePolygonsOptions from "@ogw_front/components/Viewer/Surface/PolygonsOptions.vue";
|
|
12
|
-
|
|
13
|
-
// TriangulatedSurface components
|
|
14
|
-
import TriangulatedSurfaceTrianglesOptions from "@ogw_front/components/Viewer/Surface/Triangulated/TrianglesOptions.vue";
|
|
15
|
-
|
|
16
|
-
// Grid 2D components
|
|
17
|
-
import Grid2DCellsOptions from "@ogw_front/components/Viewer/Grid/2D/CellsOptions.vue";
|
|
18
|
-
import Grid2DEdgesOptions from "@ogw_front/components/Viewer/Grid/2D/EdgesOptions.vue";
|
|
19
|
-
import Grid2DPointsOptions from "@ogw_front/components/Viewer/Grid/2D/PointsOptions.vue";
|
|
20
|
-
|
|
21
|
-
// Grid 3D components
|
|
22
|
-
import Grid3DCellsOptions from "@ogw_front/components/Viewer/Grid/3D/CellsOptions.vue";
|
|
23
|
-
import Grid3DEdgesOptions from "@ogw_front/components/Viewer/Grid/3D/EdgesOptions.vue";
|
|
24
|
-
import Grid3DPointsOptions from "@ogw_front/components/Viewer/Grid/3D/PointsOptions.vue";
|
|
25
|
-
|
|
26
|
-
// Solid components
|
|
27
|
-
import SolidEdgesOptions from "@ogw_front/components/Viewer/Solid/EdgesOptions.vue";
|
|
28
|
-
import SolidPointsOptions from "@ogw_front/components/Viewer/Solid/PointsOptions.vue";
|
|
29
|
-
import SolidPolygonsOptions from "@ogw_front/components/Viewer/Solid/PolygonsOptions.vue";
|
|
30
|
-
import SolidPolyhedraOptions from "@ogw_front/components/Viewer/Solid/SpecificPolyhedraOptions.vue";
|
|
31
|
-
|
|
32
|
-
// TetrahedralSolid components
|
|
33
|
-
import TetrahedralSolidTetrahedraOptions from "@ogw_front/components/Viewer/TetrahedralSolid/TetrahedraOptions.vue";
|
|
34
|
-
import TetrahedralSolidTrianglesOptions from "@ogw_front/components/Viewer/TetrahedralSolid/TrianglesOptions.vue";
|
|
35
|
-
|
|
36
|
-
// Model components
|
|
37
|
-
import ModelEdgesOptions from "@ogw_front/components/Viewer/Generic/Model/EdgesOptions.vue";
|
|
38
|
-
import ModelPointsOptions from "@ogw_front/components/Viewer/Generic/Model/PointsOptions.vue";
|
|
39
|
-
import ModelStyleOptions from "@ogw_front/components/Viewer/Generic/Model/ModelStyleOptions.vue";
|
|
40
|
-
|
|
41
|
-
import type { Component } from "vue";
|
|
42
|
-
|
|
43
|
-
type MenuItems = Component[];
|
|
44
|
-
|
|
45
|
-
const PointSet_menu = [PointSetPointsOptions];
|
|
46
|
-
|
|
47
|
-
const EdgedCurve_menu = [EdgedCurvePointsOptions, EdgedCurveEdgesOptions];
|
|
48
|
-
|
|
49
|
-
const PolygonalSurface_menu = [SurfacePointsOptions, SurfaceEdgesOptions, SurfacePolygonsOptions];
|
|
50
|
-
|
|
51
|
-
const TriangulatedSurface_menu = [
|
|
52
|
-
SurfacePointsOptions,
|
|
53
|
-
SurfaceEdgesOptions,
|
|
54
|
-
TriangulatedSurfaceTrianglesOptions,
|
|
55
|
-
];
|
|
56
|
-
|
|
57
|
-
const Grid2D_menu = [Grid2DPointsOptions, Grid2DEdgesOptions, Grid2DCellsOptions];
|
|
58
|
-
const Grid3D_menu = [
|
|
59
|
-
Grid3DPointsOptions,
|
|
60
|
-
Grid3DEdgesOptions,
|
|
61
|
-
// Grid3DFacetsOptions,
|
|
62
|
-
Grid3DCellsOptions,
|
|
63
|
-
];
|
|
64
|
-
|
|
65
|
-
const Solid_menu = [
|
|
66
|
-
SolidPointsOptions,
|
|
67
|
-
SolidEdgesOptions,
|
|
68
|
-
SolidPolygonsOptions,
|
|
69
|
-
SolidPolyhedraOptions,
|
|
70
|
-
];
|
|
71
|
-
|
|
72
|
-
const TetrahedralSolid_menu = [
|
|
73
|
-
SolidPointsOptions,
|
|
74
|
-
SolidEdgesOptions,
|
|
75
|
-
TetrahedralSolidTrianglesOptions,
|
|
76
|
-
TetrahedralSolidTetrahedraOptions,
|
|
77
|
-
];
|
|
78
|
-
|
|
79
|
-
const BRep_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
|
|
80
|
-
|
|
81
|
-
const CrossSection_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
|
|
82
|
-
|
|
83
|
-
const ImplicitCrossSection_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
|
|
84
|
-
const ImplicitStructuralModel_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
|
|
85
|
-
|
|
86
|
-
const Section_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
|
|
87
|
-
|
|
88
|
-
const StructuralModel_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
|
|
89
|
-
|
|
90
|
-
const ModelComponent_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
|
|
1
|
+
import { modelComponentMenus, modelComponentTypeMenus, modelMenus } from "./model.js";
|
|
2
|
+
import type { MenuItems } from "./types.js";
|
|
3
|
+
import { edgedCurveMenus } from "./mesh/edged_curve.js";
|
|
4
|
+
import { gridMenus } from "./mesh/grid.js";
|
|
5
|
+
import { pointSetMenus } from "./mesh/point_set.js";
|
|
6
|
+
import { solidMenus } from "./mesh/solid.js";
|
|
7
|
+
import { surfaceMenus } from "./mesh/surface.js";
|
|
91
8
|
|
|
92
9
|
const menusData: Record<string, Record<string, MenuItems>> = {
|
|
93
10
|
mesh: {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
PointSet2D: PointSet_menu,
|
|
100
|
-
PointSet3D: PointSet_menu,
|
|
101
|
-
PolygonalSurface2D: PolygonalSurface_menu,
|
|
102
|
-
PolygonalSurface3D: PolygonalSurface_menu,
|
|
103
|
-
PolyhedralSolid3D: Solid_menu,
|
|
104
|
-
RegularGrid2D: Grid2D_menu,
|
|
105
|
-
RegularGrid3D: Grid3D_menu,
|
|
106
|
-
TetrahedralSolid3D: TetrahedralSolid_menu,
|
|
107
|
-
TriangulatedSurface2D: TriangulatedSurface_menu,
|
|
108
|
-
TriangulatedSurface3D: TriangulatedSurface_menu,
|
|
109
|
-
},
|
|
110
|
-
model: {
|
|
111
|
-
BRep: BRep_menu,
|
|
112
|
-
CrossSection: CrossSection_menu,
|
|
113
|
-
ImplicitCrossSection: ImplicitCrossSection_menu,
|
|
114
|
-
ImplicitStructuralModel: ImplicitStructuralModel_menu,
|
|
115
|
-
Section: Section_menu,
|
|
116
|
-
StructuralModel: StructuralModel_menu,
|
|
117
|
-
},
|
|
118
|
-
model_component_type: {
|
|
119
|
-
type: ModelComponent_menu,
|
|
120
|
-
},
|
|
121
|
-
model_component: {
|
|
122
|
-
component: ModelComponent_menu,
|
|
11
|
+
...edgedCurveMenus,
|
|
12
|
+
...gridMenus,
|
|
13
|
+
...pointSetMenus,
|
|
14
|
+
...solidMenus,
|
|
15
|
+
...surfaceMenus,
|
|
123
16
|
},
|
|
17
|
+
model: modelMenus,
|
|
18
|
+
model_component_type: modelComponentTypeMenus,
|
|
19
|
+
model_component: modelComponentMenus,
|
|
124
20
|
};
|
|
125
21
|
|
|
126
22
|
export { menusData };
|
|
127
|
-
export type { MenuItems };
|
|
23
|
+
export type { MenuItems } from "./types.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import EdgedCurveEdgesOptions from "@ogw_front/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue";
|
|
2
|
+
import EdgedCurvePointsOptions from "@ogw_front/components/Viewer/EdgedCurve/PointsOptions.vue";
|
|
3
|
+
import type { MenuItems } from "@ogw_front/stores/menu_helpers/types";
|
|
4
|
+
|
|
5
|
+
const EdgedCurve_menu = [EdgedCurvePointsOptions, EdgedCurveEdgesOptions];
|
|
6
|
+
|
|
7
|
+
const edgedCurveMenus: Record<string, MenuItems> = {
|
|
8
|
+
EdgedCurve2D: EdgedCurve_menu,
|
|
9
|
+
EdgedCurve3D: EdgedCurve_menu,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { edgedCurveMenus };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Grid2DCellsOptions from "@ogw_front/components/Viewer/Grid/2D/CellsOptions.vue";
|
|
2
|
+
import Grid2DEdgesOptions from "@ogw_front/components/Viewer/Grid/2D/EdgesOptions.vue";
|
|
3
|
+
import Grid2DPointsOptions from "@ogw_front/components/Viewer/Grid/2D/PointsOptions.vue";
|
|
4
|
+
import Grid3DCellsOptions from "@ogw_front/components/Viewer/Grid/3D/CellsOptions.vue";
|
|
5
|
+
import Grid3DEdgesOptions from "@ogw_front/components/Viewer/Grid/3D/EdgesOptions.vue";
|
|
6
|
+
import Grid3DPointsOptions from "@ogw_front/components/Viewer/Grid/3D/PointsOptions.vue";
|
|
7
|
+
import type { MenuItems } from "@ogw_front/stores/menu_helpers/types";
|
|
8
|
+
|
|
9
|
+
const Grid2D_menu = [Grid2DPointsOptions, Grid2DEdgesOptions, Grid2DCellsOptions];
|
|
10
|
+
const Grid3D_menu = [
|
|
11
|
+
Grid3DPointsOptions,
|
|
12
|
+
Grid3DEdgesOptions,
|
|
13
|
+
// Grid3DFacetsOptions,
|
|
14
|
+
Grid3DCellsOptions,
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
const gridMenus: Record<string, MenuItems> = {
|
|
18
|
+
LightRegularGrid2D: Grid2D_menu,
|
|
19
|
+
LightRegularGrid3D: Grid3D_menu,
|
|
20
|
+
RegularGrid2D: Grid2D_menu,
|
|
21
|
+
RegularGrid3D: Grid3D_menu,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { gridMenus };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MenuItems } from "@ogw_front/stores/menu_helpers/types";
|
|
2
|
+
import PointSetPointsOptions from "@ogw_front/components/Viewer/PointSet/SpecificPointsOptions.vue";
|
|
3
|
+
|
|
4
|
+
const PointSet_menu = [PointSetPointsOptions];
|
|
5
|
+
|
|
6
|
+
const pointSetMenus: Record<string, MenuItems> = {
|
|
7
|
+
PointSet2D: PointSet_menu,
|
|
8
|
+
PointSet3D: PointSet_menu,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { pointSetMenus };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { MenuItems } from "@ogw_front/stores/menu_helpers/types";
|
|
2
|
+
import SolidEdgesOptions from "@ogw_front/components/Viewer/Solid/EdgesOptions.vue";
|
|
3
|
+
import SolidPointsOptions from "@ogw_front/components/Viewer/Solid/PointsOptions.vue";
|
|
4
|
+
import SolidPolygonsOptions from "@ogw_front/components/Viewer/Solid/PolygonsOptions.vue";
|
|
5
|
+
import SolidPolyhedraOptions from "@ogw_front/components/Viewer/Solid/SpecificPolyhedraOptions.vue";
|
|
6
|
+
import TetrahedralSolidTetrahedraOptions from "@ogw_front/components/Viewer/TetrahedralSolid/TetrahedraOptions.vue";
|
|
7
|
+
import TetrahedralSolidTrianglesOptions from "@ogw_front/components/Viewer/TetrahedralSolid/TrianglesOptions.vue";
|
|
8
|
+
|
|
9
|
+
const Solid_menu = [
|
|
10
|
+
SolidPointsOptions,
|
|
11
|
+
SolidEdgesOptions,
|
|
12
|
+
SolidPolygonsOptions,
|
|
13
|
+
SolidPolyhedraOptions,
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
const TetrahedralSolid_menu = [
|
|
17
|
+
SolidPointsOptions,
|
|
18
|
+
SolidEdgesOptions,
|
|
19
|
+
TetrahedralSolidTrianglesOptions,
|
|
20
|
+
TetrahedralSolidTetrahedraOptions,
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
const solidMenus: Record<string, MenuItems> = {
|
|
24
|
+
HybridSolid3D: Solid_menu,
|
|
25
|
+
PolyhedralSolid3D: Solid_menu,
|
|
26
|
+
TetrahedralSolid3D: TetrahedralSolid_menu,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { solidMenus };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { MenuItems } from "@ogw_front/stores/menu_helpers/types";
|
|
2
|
+
import SurfaceEdgesOptions from "@ogw_front/components/Viewer/Surface/EdgesOptions.vue";
|
|
3
|
+
import SurfacePointsOptions from "@ogw_front/components/Viewer/Surface/PointsOptions.vue";
|
|
4
|
+
import SurfacePolygonsOptions from "@ogw_front/components/Viewer/Surface/PolygonsOptions.vue";
|
|
5
|
+
import TriangulatedSurfaceTrianglesOptions from "@ogw_front/components/Viewer/Surface/Triangulated/TrianglesOptions.vue";
|
|
6
|
+
|
|
7
|
+
const PolygonalSurface_menu = [SurfacePointsOptions, SurfaceEdgesOptions, SurfacePolygonsOptions];
|
|
8
|
+
|
|
9
|
+
const TriangulatedSurface_menu = [
|
|
10
|
+
SurfacePointsOptions,
|
|
11
|
+
SurfaceEdgesOptions,
|
|
12
|
+
TriangulatedSurfaceTrianglesOptions,
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
const surfaceMenus: Record<string, MenuItems> = {
|
|
16
|
+
PolygonalSurface2D: PolygonalSurface_menu,
|
|
17
|
+
PolygonalSurface3D: PolygonalSurface_menu,
|
|
18
|
+
TriangulatedSurface2D: TriangulatedSurface_menu,
|
|
19
|
+
TriangulatedSurface3D: TriangulatedSurface_menu,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { surfaceMenus };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { MenuItems } from "./types.js";
|
|
2
|
+
import ModelEdgesOptions from "@ogw_front/components/Viewer/Generic/Model/EdgesOptions.vue";
|
|
3
|
+
import ModelPointsOptions from "@ogw_front/components/Viewer/Generic/Model/PointsOptions.vue";
|
|
4
|
+
import ModelStyleOptions from "@ogw_front/components/Viewer/Generic/Model/ModelStyleOptions.vue";
|
|
5
|
+
|
|
6
|
+
const Model_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
|
|
7
|
+
|
|
8
|
+
const modelMenus: Record<string, MenuItems> = {
|
|
9
|
+
BRep: Model_menu,
|
|
10
|
+
CrossSection: Model_menu,
|
|
11
|
+
ImplicitCrossSection: Model_menu,
|
|
12
|
+
ImplicitStructuralModel: Model_menu,
|
|
13
|
+
Section: Model_menu,
|
|
14
|
+
StructuralModel: Model_menu,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const modelComponentTypeMenus: Record<string, MenuItems> = {
|
|
18
|
+
type: Model_menu,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const modelComponentMenus: Record<string, MenuItems> = {
|
|
22
|
+
component: Model_menu,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { modelComponentMenus, modelComponentTypeMenus, modelMenus };
|
package/app/stores/viewer.ts
CHANGED
|
@@ -27,7 +27,6 @@ import type {
|
|
|
27
27
|
RequestHandlers,
|
|
28
28
|
ResponseOf,
|
|
29
29
|
} from "@ogw_shared/utils/types.js";
|
|
30
|
-
// oxlint-disable-next-line import/max-dependencies -- all imports above are required by this store.
|
|
31
30
|
import type { RpcClient } from "@ogw_shared/utils/call_raw.js";
|
|
32
31
|
|
|
33
32
|
interface PickedPoint {
|
|
@@ -4,12 +4,13 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed
|
|
|
4
4
|
|
|
5
5
|
// Local imports
|
|
6
6
|
import { useMeshCellsCommonStyle } from "./common";
|
|
7
|
+
import { useMeshCellsOpacityStyle } from "./opacity";
|
|
7
8
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
8
9
|
|
|
9
10
|
// Local constants
|
|
10
11
|
const schema = viewer_schemas.opengeodeweb_viewer.mesh.cells.color;
|
|
11
12
|
|
|
12
|
-
export function useMeshCellsColorStyle(): {
|
|
13
|
+
export function useMeshCellsColorStyle(): ReturnType<typeof useMeshCellsOpacityStyle> & {
|
|
13
14
|
meshCellsColor: (id: string) => RGBAColor | undefined;
|
|
14
15
|
setMeshCellsColor: (id: string, color: RGBAColor) => Promise<unknown>;
|
|
15
16
|
} {
|
|
@@ -42,5 +43,6 @@ export function useMeshCellsColorStyle(): {
|
|
|
42
43
|
return {
|
|
43
44
|
meshCellsColor,
|
|
44
45
|
setMeshCellsColor,
|
|
46
|
+
...useMeshCellsOpacityStyle(),
|
|
45
47
|
};
|
|
46
48
|
}
|
|
@@ -52,7 +52,7 @@ function handleMeshCellsCellColoring(
|
|
|
52
52
|
return cellAttributeStyle.setMeshCellsCellAttribute(id, cell_attribute);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
async function
|
|
55
|
+
async function applyMeshCellsActiveColoring(
|
|
56
56
|
id: string,
|
|
57
57
|
type: string | undefined,
|
|
58
58
|
deps: MeshCellsActiveColoringDeps,
|
|
@@ -87,6 +87,22 @@ async function setMeshCellsActiveColoring(
|
|
|
87
87
|
throw new Error(`Unknown mesh cells coloring type: ${type}`);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
async function setMeshCellsActiveColoring(
|
|
91
|
+
id: string,
|
|
92
|
+
type: string | undefined,
|
|
93
|
+
deps: MeshCellsActiveColoringDeps,
|
|
94
|
+
): Promise<unknown> {
|
|
95
|
+
const result = await applyMeshCellsActiveColoring(id, type, deps);
|
|
96
|
+
if (type !== "constant") {
|
|
97
|
+
// Attribute and textures colorings keep the actor opacity: restore the stored one
|
|
98
|
+
await whenDefined(deps.colorStyle.meshCellsOpacity(id), async (value) => {
|
|
99
|
+
const applied = await deps.colorStyle.setMeshCellsOpacity(id, value);
|
|
100
|
+
return applied;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
|
|
90
106
|
async function applyMeshCellsStyle(
|
|
91
107
|
id: string,
|
|
92
108
|
visibilityStyle: ReturnType<typeof useMeshCellsVisibilityStyle>,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
2
|
+
// Third party imports
|
|
3
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
4
|
+
|
|
5
|
+
// Local imports
|
|
6
|
+
import { useMeshCellsCommonStyle } from "./common";
|
|
7
|
+
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
8
|
+
|
|
9
|
+
// Local constants
|
|
10
|
+
const schema = viewer_schemas.opengeodeweb_viewer.mesh.cells.opacity;
|
|
11
|
+
|
|
12
|
+
// The opacity is the constant color alpha, the viewer applies it whatever the coloring
|
|
13
|
+
export function useMeshCellsOpacityStyle(): {
|
|
14
|
+
meshCellsOpacity: (id: string) => number | undefined;
|
|
15
|
+
setMeshCellsOpacity: (id: string, opacity: number) => Promise<unknown>;
|
|
16
|
+
} {
|
|
17
|
+
const viewerStore = useViewerStore();
|
|
18
|
+
const meshCellsCommonStyle = useMeshCellsCommonStyle();
|
|
19
|
+
|
|
20
|
+
function meshCellsConstantColor(id: string): RGBAColor | undefined {
|
|
21
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.constant shape is defined by the data style schema.
|
|
22
|
+
return meshCellsCommonStyle.meshCellsColoring(id).constant as RGBAColor | undefined;
|
|
23
|
+
}
|
|
24
|
+
function meshCellsOpacity(id: string): number | undefined {
|
|
25
|
+
return meshCellsConstantColor(id)?.alpha;
|
|
26
|
+
}
|
|
27
|
+
async function setMeshCellsOpacity(id: string, opacity: number): Promise<unknown> {
|
|
28
|
+
const params = { id, opacity };
|
|
29
|
+
const result = await viewerStore.request(
|
|
30
|
+
{
|
|
31
|
+
schema,
|
|
32
|
+
params,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
response_function: async () => {
|
|
36
|
+
const color = meshCellsConstantColor(id);
|
|
37
|
+
if (color === undefined) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
const mutateResult = await meshCellsCommonStyle.mutateMeshCellsColoring(id, {
|
|
41
|
+
constant: { ...color, alpha: opacity },
|
|
42
|
+
});
|
|
43
|
+
return mutateResult;
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
);
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
meshCellsOpacity,
|
|
52
|
+
setMeshCellsOpacity,
|
|
53
|
+
};
|
|
54
|
+
}
|