@geode/opengeodeweb-front 10.44.0-rc.3 → 10.44.0-rc.4

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 (106) hide show
  1. package/.build/server/utils/microservices.js +9 -85
  2. package/.build/server/utils/microservices_process.js +85 -0
  3. package/app/components/ClippingPlanes.vue +16 -82
  4. package/app/components/DragAndDrop.vue +1 -74
  5. package/app/components/ThresholdCard.vue +205 -0
  6. package/app/components/ThresholdFilter.vue +77 -216
  7. package/app/components/ViewToolbar.vue +15 -231
  8. package/app/components/Viewer/EdgedCurve/SpecificEdgesColoring.vue +209 -0
  9. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +3 -191
  10. package/app/components/Viewer/Generic/Mesh/CellsColoring.vue +228 -0
  11. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +3 -210
  12. package/app/components/Viewer/Generic/Mesh/EdgesColoring.vue +211 -0
  13. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +3 -192
  14. package/app/components/Viewer/Generic/Mesh/PolygonsColoring.vue +234 -0
  15. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +3 -215
  16. package/app/components/Viewer/Generic/Mesh/PolyhedraColoring.vue +221 -0
  17. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +3 -203
  18. package/app/components/Viewer/Generic/Model/ComponentPointsOptions.vue +2 -18
  19. package/app/components/Viewer/Generic/Model/CornerComponentOptions.vue +145 -0
  20. package/app/components/Viewer/Generic/Model/CornersOptions.vue +13 -294
  21. package/app/components/Viewer/Generic/Model/CornersTypeOptions.vue +173 -0
  22. package/app/components/Viewer/Generic/Model/LineComponentOptions.vue +218 -0
  23. package/app/components/Viewer/Generic/Model/LinesOptions.vue +13 -425
  24. package/app/components/Viewer/Generic/Model/LinesTypeOptions.vue +229 -0
  25. package/app/components/Viewer/Options/AttributeSelector.vue +26 -133
  26. package/app/components/Viewer/Options/ColoringTypeSelector.vue +36 -74
  27. package/app/components/Viewer/Options/NoDataColorInfo.vue +56 -0
  28. package/app/components/Viewer/Solid/SpecificPolyhedraColoring.vue +217 -0
  29. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +4 -199
  30. package/app/components/Viewer/Surface/PolygonsColoring.vue +231 -0
  31. package/app/components/Viewer/Surface/PolygonsOptions.vue +3 -213
  32. package/app/composables/attribute_selector.ts +126 -0
  33. package/app/composables/clipping_slices.ts +166 -0
  34. package/app/composables/view_toolbar_options.ts +126 -0
  35. package/app/composables/view_toolbar_tool_options.ts +115 -0
  36. package/app/composables/view_toolbar_tools.ts +108 -0
  37. package/app/composables/virtual_tree.ts +20 -138
  38. package/app/composables/virtual_tree_flatten.ts +86 -0
  39. package/app/composables/virtual_tree_types.ts +81 -0
  40. package/app/stores/app.ts +8 -55
  41. package/app/stores/app_helpers/registry.ts +69 -0
  42. package/app/stores/menu.ts +1 -124
  43. package/app/stores/menu_helpers/menus_data.ts +127 -0
  44. package/app/stores/viewer.ts +17 -78
  45. package/app/stores/viewer_helpers/actions.ts +68 -0
  46. package/app/stores/viewer_helpers/request.ts +61 -0
  47. package/app/utils/clipping_planes.ts +4 -132
  48. package/app/utils/clipping_planes_scene.ts +131 -0
  49. package/app/utils/coloring_styles.ts +101 -0
  50. package/app/utils/default_styles/mesh_components.ts +168 -0
  51. package/app/utils/default_styles/meshes.ts +13 -153
  52. package/app/utils/default_styles/model_components.ts +170 -0
  53. package/app/utils/default_styles/models.ts +16 -153
  54. package/app/utils/drag_and_drop.ts +80 -0
  55. package/app/utils/model_component_coloring.ts +46 -0
  56. package/app/utils/threshold.ts +33 -0
  57. package/app/utils/threshold_sources.ts +51 -0
  58. package/internal/stores/data_style/mesh/cells/cell.ts +27 -150
  59. package/internal/stores/data_style/mesh/cells/cell_attribute.ts +74 -0
  60. package/internal/stores/data_style/mesh/cells/cell_config.ts +152 -0
  61. package/internal/stores/data_style/mesh/cells/vertex.ts +26 -157
  62. package/internal/stores/data_style/mesh/cells/vertex_attribute.ts +80 -0
  63. package/internal/stores/data_style/mesh/cells/vertex_config.ts +152 -0
  64. package/internal/stores/data_style/mesh/edges/edge.ts +27 -150
  65. package/internal/stores/data_style/mesh/edges/edge_attribute.ts +74 -0
  66. package/internal/stores/data_style/mesh/edges/edge_config.ts +152 -0
  67. package/internal/stores/data_style/mesh/edges/vertex.ts +26 -157
  68. package/internal/stores/data_style/mesh/edges/vertex_attribute.ts +80 -0
  69. package/internal/stores/data_style/mesh/edges/vertex_config.ts +152 -0
  70. package/internal/stores/data_style/mesh/points/vertex.ts +26 -157
  71. package/internal/stores/data_style/mesh/points/vertex_attribute.ts +80 -0
  72. package/internal/stores/data_style/mesh/points/vertex_config.ts +152 -0
  73. package/internal/stores/data_style/mesh/polygons/polygon.ts +27 -152
  74. package/internal/stores/data_style/mesh/polygons/polygon_attribute.ts +80 -0
  75. package/internal/stores/data_style/mesh/polygons/polygon_config.ts +148 -0
  76. package/internal/stores/data_style/mesh/polygons/vertex.ts +26 -157
  77. package/internal/stores/data_style/mesh/polygons/vertex_attribute.ts +80 -0
  78. package/internal/stores/data_style/mesh/polygons/vertex_config.ts +152 -0
  79. package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +27 -160
  80. package/internal/stores/data_style/mesh/polyhedra/polyhedron_attribute.ts +82 -0
  81. package/internal/stores/data_style/mesh/polyhedra/polyhedron_config.ts +157 -0
  82. package/internal/stores/data_style/mesh/polyhedra/vertex.ts +26 -157
  83. package/internal/stores/data_style/mesh/polyhedra/vertex_attribute.ts +80 -0
  84. package/internal/stores/data_style/mesh/polyhedra/vertex_config.ts +152 -0
  85. package/internal/stores/data_style/model/blocks/apply_coloring.ts +173 -0
  86. package/internal/stores/data_style/model/blocks/coloring_groups.ts +18 -0
  87. package/internal/stores/data_style/model/blocks/index.ts +12 -140
  88. package/internal/stores/data_style/model/common.ts +10 -119
  89. package/internal/stores/data_style/model/common_mutations.ts +184 -0
  90. package/internal/stores/data_style/model/lines/apply_coloring.ts +154 -0
  91. package/internal/stores/data_style/model/lines/coloring_groups.ts +18 -0
  92. package/internal/stores/data_style/model/lines/index.ts +10 -134
  93. package/internal/stores/data_style/model/surfaces/apply_coloring.ts +186 -0
  94. package/internal/stores/data_style/model/surfaces/coloring_groups.ts +18 -0
  95. package/internal/stores/data_style/model/surfaces/index.ts +16 -160
  96. package/internal/stores/data_style/model/visibility.ts +3 -156
  97. package/internal/stores/data_style/model/visibility_dispatch.ts +160 -0
  98. package/internal/stores/data_style/state.ts +1 -181
  99. package/internal/stores/data_style/state_shared.ts +191 -0
  100. package/internal/stores/hybrid_viewer/camera.ts +7 -161
  101. package/internal/stores/hybrid_viewer/camera_helpers.ts +120 -0
  102. package/internal/stores/hybrid_viewer/camera_orientation.ts +60 -0
  103. package/internal/stores/hybrid_viewer/filters.ts +54 -11
  104. package/package.json +1 -1
  105. package/server/utils/microservices.ts +10 -109
  106. package/server/utils/microservices_process.ts +127 -0
@@ -0,0 +1,69 @@
1
+ import { consola } from "consola";
2
+
3
+ interface RegisterableStore {
4
+ $id: string;
5
+ $patch?: (partial: Record<string, unknown>) => void;
6
+ exportStores?: (params?: Record<string, unknown>) => Promise<unknown>;
7
+ importStores?: (snapshot: unknown) => Promise<void> | void;
8
+ connect?: () => Promise<void>;
9
+ kill?: () => Promise<void>;
10
+ [key: string]: unknown;
11
+ }
12
+
13
+ async function exportRegisteredStores(
14
+ stores: readonly RegisterableStore[],
15
+ params: Record<string, unknown> = {},
16
+ ): Promise<Record<string, unknown>> {
17
+ const snapshot: Record<string, unknown> = {};
18
+
19
+ await Promise.all(
20
+ stores.map(async (store: RegisterableStore) => {
21
+ if (!store.exportStores) {
22
+ return;
23
+ }
24
+ const storeId = store.$id;
25
+ try {
26
+ snapshot[storeId] = await store.exportStores(params);
27
+ } catch {
28
+ // Ignore stores that fail to export; other stores still complete independently.
29
+ }
30
+ }),
31
+ );
32
+ return snapshot;
33
+ }
34
+
35
+ async function importRegisteredStores(
36
+ stores: readonly RegisterableStore[],
37
+ snapshot: Record<string, unknown> | undefined,
38
+ ): Promise<void> {
39
+ if (!snapshot) {
40
+ return;
41
+ }
42
+
43
+ const missingStoreIds: string[] = [];
44
+
45
+ await Promise.all(
46
+ stores.map(async (store: RegisterableStore) => {
47
+ if (!store.importStores) {
48
+ return;
49
+ }
50
+ const storeId = store.$id;
51
+ if (snapshot[storeId] === undefined) {
52
+ missingStoreIds.push(storeId);
53
+ return;
54
+ }
55
+ try {
56
+ await store.importStores(snapshot[storeId]);
57
+ } catch {
58
+ // Ignore stores that fail to import; other stores still complete independently.
59
+ }
60
+ }),
61
+ );
62
+
63
+ if (missingStoreIds.length > 0) {
64
+ consola.warn(`Stores not found in snapshot: ${missingStoreIds.join(", ")}`);
65
+ }
66
+ }
67
+
68
+ export { exportRegisteredStores, importRegisteredStores };
69
+ export type { RegisterableStore };
@@ -1,46 +1,4 @@
1
- // PointSet components
2
- import PointSetPointsOptions from "@ogw_front/components/Viewer/PointSet/SpecificPointsOptions.vue";
3
-
4
- // EdgedCurve components
5
- import EdgedCurveEdgesOptions from "@ogw_front/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue";
6
- import EdgedCurvePointsOptions from "@ogw_front/components/Viewer/EdgedCurve/PointsOptions.vue";
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[];
1
+ import { type MenuItems, menusData } from "./menu_helpers/menus_data.js";
44
2
 
45
3
  interface MenuMetaData {
46
4
  viewer_type?: string;
@@ -60,87 +18,6 @@ interface OpenMenuOptions {
60
18
  readonly meta_data: MenuMetaData | undefined;
61
19
  }
62
20
 
63
- const PointSet_menu = [PointSetPointsOptions];
64
-
65
- const EdgedCurve_menu = [EdgedCurvePointsOptions, EdgedCurveEdgesOptions];
66
-
67
- const PolygonalSurface_menu = [SurfacePointsOptions, SurfaceEdgesOptions, SurfacePolygonsOptions];
68
-
69
- const TriangulatedSurface_menu = [
70
- SurfacePointsOptions,
71
- SurfaceEdgesOptions,
72
- TriangulatedSurfaceTrianglesOptions,
73
- ];
74
-
75
- const Grid2D_menu = [Grid2DPointsOptions, Grid2DEdgesOptions, Grid2DCellsOptions];
76
- const Grid3D_menu = [
77
- Grid3DPointsOptions,
78
- Grid3DEdgesOptions,
79
- // Grid3DFacetsOptions,
80
- Grid3DCellsOptions,
81
- ];
82
-
83
- const Solid_menu = [
84
- SolidPointsOptions,
85
- SolidEdgesOptions,
86
- SolidPolygonsOptions,
87
- SolidPolyhedraOptions,
88
- ];
89
-
90
- const TetrahedralSolid_menu = [
91
- SolidPointsOptions,
92
- SolidEdgesOptions,
93
- TetrahedralSolidTrianglesOptions,
94
- TetrahedralSolidTetrahedraOptions,
95
- ];
96
-
97
- const BRep_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
98
-
99
- const CrossSection_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
100
-
101
- const ImplicitCrossSection_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
102
- const ImplicitStructuralModel_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
103
-
104
- const Section_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
105
-
106
- const StructuralModel_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
107
-
108
- const ModelComponent_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
109
-
110
- const menusData: Record<string, Record<string, MenuItems>> = {
111
- mesh: {
112
- EdgedCurve2D: EdgedCurve_menu,
113
- EdgedCurve3D: EdgedCurve_menu,
114
- HybridSolid3D: Solid_menu,
115
- LightRegularGrid2D: Grid2D_menu,
116
- LightRegularGrid3D: Grid3D_menu,
117
- PointSet2D: PointSet_menu,
118
- PointSet3D: PointSet_menu,
119
- PolygonalSurface2D: PolygonalSurface_menu,
120
- PolygonalSurface3D: PolygonalSurface_menu,
121
- PolyhedralSolid3D: Solid_menu,
122
- RegularGrid2D: Grid2D_menu,
123
- RegularGrid3D: Grid3D_menu,
124
- TetrahedralSolid3D: TetrahedralSolid_menu,
125
- TriangulatedSurface2D: TriangulatedSurface_menu,
126
- TriangulatedSurface3D: TriangulatedSurface_menu,
127
- },
128
- model: {
129
- BRep: BRep_menu,
130
- CrossSection: CrossSection_menu,
131
- ImplicitCrossSection: ImplicitCrossSection_menu,
132
- ImplicitStructuralModel: ImplicitStructuralModel_menu,
133
- Section: Section_menu,
134
- StructuralModel: StructuralModel_menu,
135
- },
136
- model_component_type: {
137
- type: ModelComponent_menu,
138
- },
139
- model_component: {
140
- component: ModelComponent_menu,
141
- },
142
- };
143
-
144
21
  export const useMenuStore = defineStore("menu", () => {
145
22
  const menus = shallowRef(menusData);
146
23
  const display_menu = ref(false);
@@ -0,0 +1,127 @@
1
+ // PointSet components
2
+ import PointSetPointsOptions from "@ogw_front/components/Viewer/PointSet/SpecificPointsOptions.vue";
3
+
4
+ // EdgedCurve components
5
+ import EdgedCurveEdgesOptions from "@ogw_front/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue";
6
+ import EdgedCurvePointsOptions from "@ogw_front/components/Viewer/EdgedCurve/PointsOptions.vue";
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];
91
+
92
+ const menusData: Record<string, Record<string, MenuItems>> = {
93
+ mesh: {
94
+ EdgedCurve2D: EdgedCurve_menu,
95
+ EdgedCurve3D: EdgedCurve_menu,
96
+ HybridSolid3D: Solid_menu,
97
+ LightRegularGrid2D: Grid2D_menu,
98
+ LightRegularGrid3D: Grid3D_menu,
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,
123
+ },
124
+ };
125
+
126
+ export { menusData };
127
+ export type { MenuItems };
@@ -4,24 +4,26 @@ import "@kitware/vtk.js/Rendering/OpenGL/Profiles/Geometry";
4
4
  import type { Vector3 } from "@kitware/vtk.js/types";
5
5
  import { connectImageStream } from "@kitware/vtk.js/Rendering/Misc/RemoteView";
6
6
  import { initWebSocketClient } from "@ogw_internal/utils/ws_client";
7
- import opengeodeweb_front_schemas from "@geode/opengeodeweb-front/opengeodeweb_front_typed_schemas.js";
8
7
  import opengeodeweb_viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
9
8
 
10
9
  // Local imports
10
+ import { type ViewerRequestArgs, callViewer } from "./viewer_helpers/request.js";
11
+ import {
12
+ fetchViewerVersion,
13
+ launchViewerMicroservice,
14
+ pickWorldPosition,
15
+ } from "./viewer_helpers/actions.js";
11
16
  import {
12
17
  getWebsocketApiPort,
13
18
  getWebsocketApiProtocol,
14
19
  isCloudMode,
15
20
  } from "@ogw_front/utils/stores.js";
16
21
  import { Status } from "@ogw_front/utils/status";
17
- import { useAppStore } from "@ogw_front/stores/app";
18
22
  import { useInfraStore } from "@ogw_front/stores/infra";
19
- import { viewer_call } from "@ogw_internal/utils/viewer_call";
20
23
 
21
24
  import type {
22
25
  JsonRpcSchema,
23
26
  MicroserviceVersionSchema,
24
- ParamsOf,
25
27
  RequestHandlers,
26
28
  ResponseOf,
27
29
  } from "@ogw_shared/utils/types.js";
@@ -34,9 +36,6 @@ interface PickedPoint {
34
36
  z: number | undefined;
35
37
  }
36
38
 
37
- const MS_PER_SECOND = 1000;
38
- const SECONDS_PER_REQUEST = 10;
39
- const request_timeout = MS_PER_SECOND * SECONDS_PER_REQUEST;
40
39
  export const useViewerStore = defineStore(
41
40
  "viewer",
42
41
  // oxlint-disable-next-line max-lines-per-function, max-statements
@@ -77,15 +76,7 @@ export const useViewerStore = defineStore(
77
76
  }
78
77
  // oxlint-disable-next-line unicorn/consistent-function-scoping
79
78
  async function request<Schema extends JsonRpcSchema>(
80
- {
81
- schema,
82
- params,
83
- timeout = request_timeout,
84
- }: {
85
- schema: Schema;
86
- params?: ParamsOf<Schema>;
87
- timeout?: number;
88
- },
79
+ args: ViewerRequestArgs<Schema>,
89
80
  callbacks: RequestHandlers<ResponseOf<Schema>> = {},
90
81
  ): Promise<ResponseOf<Schema>> {
91
82
  const microservice = {
@@ -95,38 +86,12 @@ export const useViewerStore = defineStore(
95
86
  start_request,
96
87
  stop_request,
97
88
  };
98
- const result = await viewer_call(
99
- microservice,
100
- {
101
- schema,
102
- params: params ?? {},
103
- timeout,
104
- },
105
- {
106
- ...callbacks,
107
- response_function: async (response: unknown) => {
108
- if (callbacks.response_function) {
109
- // The viewer validates its responses against the schema `response` it was generated from.
110
- // oxlint-disable-next-line typescript/no-unsafe-type-assertion
111
- await callbacks.response_function(response as ResponseOf<Schema>);
112
- }
113
- },
114
- },
115
- );
116
- // oxlint-disable-next-line typescript/no-unsafe-type-assertion
117
- return result as ResponseOf<Schema>;
89
+ const result = await callViewer(microservice, args, callbacks);
90
+ return result;
118
91
  }
119
92
  async function pick_world_position(x: number, y: number): Promise<Vector3> {
120
- const schema = opengeodeweb_viewer_schemas.opengeodeweb_viewer.viewer.get_point_position;
121
- const {
122
- x: world_x,
123
- y: world_y,
124
- z: world_z,
125
- } = await request({
126
- schema,
127
- params: { x: Math.round(x), y: Math.round(y) },
128
- });
129
- return [world_x, world_y, world_z];
93
+ const position = await pickWorldPosition(request, x, y);
94
+ return position;
130
95
  }
131
96
  async function set_picked_point(x: number, y: number): Promise<void> {
132
97
  const [world_x, world_y, world_z] = await pick_world_position(x, y);
@@ -166,25 +131,9 @@ export const useViewerStore = defineStore(
166
131
  });
167
132
  }
168
133
  async function launch(args: Readonly<{ projectFolderPath: string }>): Promise<unknown> {
169
- const appStore = useAppStore();
170
- const { COMMAND_VIEWER, NUXT_ROOT_PATH } = useRuntimeConfig().public;
171
- const schema = opengeodeweb_front_schemas.api.local.app.run_viewer;
172
- const params = {
173
- COMMAND_VIEWER,
174
- NUXT_ROOT_PATH,
175
- args,
176
- };
177
- const result = await appStore.request(
178
- {
179
- schema,
180
- params,
181
- },
182
- {
183
- response_function: (response) => {
184
- default_local_port.value = String(response.port);
185
- },
186
- },
187
- );
134
+ const result = await launchViewerMicroservice(args, (new_port) => {
135
+ default_local_port.value = new_port;
136
+ });
188
137
  return result;
189
138
  }
190
139
  async function connect(): Promise<void> {
@@ -193,19 +142,9 @@ export const useViewerStore = defineStore(
193
142
  async function get_version(
194
143
  schema: MicroserviceVersionSchema | undefined,
195
144
  ): Promise<{ microservice_version: string } | undefined> {
196
- if (!schema) {
197
- return undefined;
198
- }
199
- const result = await request(
200
- {
201
- schema,
202
- },
203
- {
204
- response_function: ({ microservice_version }) => {
205
- version.value = microservice_version;
206
- },
207
- },
208
- );
145
+ const result = await fetchViewerVersion(request, schema, (microservice_version) => {
146
+ version.value = microservice_version;
147
+ });
209
148
  return result;
210
149
  }
211
150
  return {
@@ -0,0 +1,68 @@
1
+ import type { MicroserviceVersionSchema } from "@ogw_shared/utils/types.js";
2
+ import type { Vector3 } from "@kitware/vtk.js/types";
3
+ import type { ViewerRequest } from "./request.js";
4
+ import opengeodeweb_front_schemas from "@geode/opengeodeweb-front/opengeodeweb_front_typed_schemas.js";
5
+ import opengeodeweb_viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
6
+ import { useAppStore } from "@ogw_front/stores/app";
7
+
8
+ async function pickWorldPosition(request: ViewerRequest, x: number, y: number): Promise<Vector3> {
9
+ const schema = opengeodeweb_viewer_schemas.opengeodeweb_viewer.viewer.get_point_position;
10
+ const {
11
+ x: world_x,
12
+ y: world_y,
13
+ z: world_z,
14
+ } = await request({
15
+ schema,
16
+ params: { x: Math.round(x), y: Math.round(y) },
17
+ });
18
+ return [world_x, world_y, world_z];
19
+ }
20
+
21
+ async function launchViewerMicroservice(
22
+ args: Readonly<{ projectFolderPath: string }>,
23
+ onPort: (port: string) => void,
24
+ ): Promise<unknown> {
25
+ const appStore = useAppStore();
26
+ const { COMMAND_VIEWER, NUXT_ROOT_PATH } = useRuntimeConfig().public;
27
+ const schema = opengeodeweb_front_schemas.api.local.app.run_viewer;
28
+ const params = {
29
+ COMMAND_VIEWER,
30
+ NUXT_ROOT_PATH,
31
+ args,
32
+ };
33
+ const result = await appStore.request(
34
+ {
35
+ schema,
36
+ params,
37
+ },
38
+ {
39
+ response_function: (response) => {
40
+ onPort(String(response.port));
41
+ },
42
+ },
43
+ );
44
+ return result;
45
+ }
46
+
47
+ async function fetchViewerVersion(
48
+ request: ViewerRequest,
49
+ schema: MicroserviceVersionSchema | undefined,
50
+ onVersion: (version: string) => void,
51
+ ): Promise<{ microservice_version: string } | undefined> {
52
+ if (!schema) {
53
+ return undefined;
54
+ }
55
+ const result = await request(
56
+ {
57
+ schema,
58
+ },
59
+ {
60
+ response_function: ({ microservice_version }) => {
61
+ onVersion(microservice_version);
62
+ },
63
+ },
64
+ );
65
+ return result;
66
+ }
67
+
68
+ export { fetchViewerVersion, launchViewerMicroservice, pickWorldPosition };
@@ -0,0 +1,61 @@
1
+ import type {
2
+ JsonRpcSchema,
3
+ ParamsOf,
4
+ RequestHandlers,
5
+ ResponseOf,
6
+ } from "@ogw_shared/utils/types.js";
7
+ import type { RpcClient } from "@ogw_shared/utils/call_raw.js";
8
+ import { viewer_call } from "@ogw_internal/utils/viewer_call";
9
+
10
+ interface ViewerRequestMicroservice {
11
+ $id: string;
12
+ client: RpcClient;
13
+ base_url: string;
14
+ start_request: () => void;
15
+ stop_request: () => void;
16
+ }
17
+
18
+ interface ViewerRequestArgs<Schema extends JsonRpcSchema> {
19
+ schema: Schema;
20
+ params?: ParamsOf<Schema>;
21
+ timeout?: number;
22
+ }
23
+
24
+ type ViewerRequest = <Schema extends JsonRpcSchema>(
25
+ args: ViewerRequestArgs<Schema>,
26
+ callbacks?: RequestHandlers<ResponseOf<Schema>>,
27
+ ) => Promise<ResponseOf<Schema>>;
28
+
29
+ const MS_PER_SECOND = 1000;
30
+ const SECONDS_PER_REQUEST = 10;
31
+ const request_timeout = MS_PER_SECOND * SECONDS_PER_REQUEST;
32
+
33
+ async function callViewer<Schema extends JsonRpcSchema>(
34
+ microservice: ViewerRequestMicroservice,
35
+ { schema, params, timeout = request_timeout }: ViewerRequestArgs<Schema>,
36
+ callbacks: RequestHandlers<ResponseOf<Schema>> = {},
37
+ ): Promise<ResponseOf<Schema>> {
38
+ const result = await viewer_call(
39
+ microservice,
40
+ {
41
+ schema,
42
+ params: params ?? {},
43
+ timeout,
44
+ },
45
+ {
46
+ ...callbacks,
47
+ response_function: async (response: unknown) => {
48
+ if (callbacks.response_function) {
49
+ // The viewer validates its responses against the schema `response` it was generated from.
50
+ // oxlint-disable-next-line typescript/no-unsafe-type-assertion
51
+ await callbacks.response_function(response as ResponseOf<Schema>);
52
+ }
53
+ },
54
+ },
55
+ );
56
+ // oxlint-disable-next-line typescript/no-unsafe-type-assertion
57
+ return result as ResponseOf<Schema>;
58
+ }
59
+
60
+ export { callViewer };
61
+ export type { ViewerRequest, ViewerRequestArgs };