@geode/opengeodeweb-front 10.44.0-rc.2 → 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 (160) hide show
  1. package/.build/server/utils/cleanup.js +7 -2
  2. package/.build/server/utils/microservices.js +9 -81
  3. package/.build/server/utils/microservices_process.js +85 -0
  4. package/.build/server/utils/typed_handler.js +5 -1
  5. package/.build/server/utils/ws_client.js +7 -2
  6. package/.build/shared/utils/fetch_raw.js +2 -2
  7. package/.build/shared/utils/parse_boolean.js +2 -1
  8. package/app/components/ClippingPlanes.vue +22 -78
  9. package/app/components/DragAndDrop.vue +16 -79
  10. package/app/components/FileSelector.vue +9 -6
  11. package/app/components/HybridViewerTooltip.vue +8 -2
  12. package/app/components/MissingFilesSelector.vue +10 -6
  13. package/app/components/ObjectSelector.vue +6 -3
  14. package/app/components/Screenshot.vue +9 -2
  15. package/app/components/ThresholdCard.vue +205 -0
  16. package/app/components/ThresholdFilter.vue +81 -216
  17. package/app/components/ViewToolbar.vue +15 -231
  18. package/app/components/Viewer/EdgedCurve/SpecificEdgesColoring.vue +209 -0
  19. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +3 -191
  20. package/app/components/Viewer/Generic/Mesh/CellsColoring.vue +228 -0
  21. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +3 -210
  22. package/app/components/Viewer/Generic/Mesh/EdgesColoring.vue +211 -0
  23. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +3 -192
  24. package/app/components/Viewer/Generic/Mesh/PolygonsColoring.vue +234 -0
  25. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +3 -215
  26. package/app/components/Viewer/Generic/Mesh/PolyhedraColoring.vue +221 -0
  27. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +3 -203
  28. package/app/components/Viewer/Generic/Model/BlocksOptions.vue +7 -5
  29. package/app/components/Viewer/Generic/Model/ComponentPointsOptions.vue +2 -18
  30. package/app/components/Viewer/Generic/Model/CornerComponentOptions.vue +145 -0
  31. package/app/components/Viewer/Generic/Model/CornersOptions.vue +13 -292
  32. package/app/components/Viewer/Generic/Model/CornersTypeOptions.vue +173 -0
  33. package/app/components/Viewer/Generic/Model/LineComponentOptions.vue +218 -0
  34. package/app/components/Viewer/Generic/Model/LinesOptions.vue +13 -425
  35. package/app/components/Viewer/Generic/Model/LinesTypeOptions.vue +229 -0
  36. package/app/components/Viewer/Generic/Model/ModelEdgesCard.vue +12 -10
  37. package/app/components/Viewer/Generic/Model/ModelPointsCard.vue +12 -10
  38. package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +9 -5
  39. package/app/components/Viewer/ObjectTree/Base/ComponentRelations.vue +4 -1
  40. package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +6 -1
  41. package/app/components/Viewer/Options/AttributeRangeSelector.vue +11 -4
  42. package/app/components/Viewer/Options/AttributeSelector.vue +40 -136
  43. package/app/components/Viewer/Options/ColorPicker.vue +4 -1
  44. package/app/components/Viewer/Options/ColoringTypeSelector.vue +36 -74
  45. package/app/components/Viewer/Options/ColormapQuickPicker.vue +13 -7
  46. package/app/components/Viewer/Options/NoDataColorInfo.vue +56 -0
  47. package/app/components/Viewer/Solid/SpecificPolyhedraColoring.vue +217 -0
  48. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +4 -199
  49. package/app/components/Viewer/Surface/PolygonsColoring.vue +231 -0
  50. package/app/components/Viewer/Surface/PolygonsOptions.vue +3 -213
  51. package/app/components/csv-preview/CsvPreviewer.vue +4 -1
  52. package/app/composables/attribute_coloring_style.ts +8 -2
  53. package/app/composables/attribute_selector.ts +126 -0
  54. package/app/composables/clipping_slices.ts +166 -0
  55. package/app/composables/global_attribute_style.ts +4 -3
  56. package/app/composables/hover_highlight.ts +6 -5
  57. package/app/composables/project_manager.ts +5 -5
  58. package/app/composables/stepper_tree.ts +10 -2
  59. package/app/composables/tree_filter.ts +11 -2
  60. package/app/composables/tree_keyboard_nav.ts +4 -2
  61. package/app/composables/use_overlapping_picker.ts +5 -5
  62. package/app/composables/view_toolbar_options.ts +126 -0
  63. package/app/composables/view_toolbar_tool_options.ts +115 -0
  64. package/app/composables/view_toolbar_tools.ts +108 -0
  65. package/app/composables/virtual_tree.ts +20 -131
  66. package/app/composables/virtual_tree_flatten.ts +86 -0
  67. package/app/composables/virtual_tree_types.ts +81 -0
  68. package/app/stores/app.ts +8 -55
  69. package/app/stores/app_helpers/extension.ts +1 -1
  70. package/app/stores/app_helpers/registry.ts +69 -0
  71. package/app/stores/feedback.ts +2 -2
  72. package/app/stores/hybrid_viewer.ts +1 -1
  73. package/app/stores/menu.ts +1 -124
  74. package/app/stores/menu_helpers/menus_data.ts +127 -0
  75. package/app/stores/treeview.ts +17 -10
  76. package/app/stores/viewer.ts +17 -78
  77. package/app/stores/viewer_helpers/actions.ts +68 -0
  78. package/app/stores/viewer_helpers/request.ts +61 -0
  79. package/app/utils/clipping_planes.ts +4 -131
  80. package/app/utils/clipping_planes_scene.ts +131 -0
  81. package/app/utils/coloring_styles.ts +101 -0
  82. package/app/utils/default_styles/mesh_components.ts +168 -0
  83. package/app/utils/default_styles/meshes.ts +13 -153
  84. package/app/utils/default_styles/model_components.ts +170 -0
  85. package/app/utils/default_styles/models.ts +16 -153
  86. package/app/utils/drag_and_drop.ts +80 -0
  87. package/app/utils/extension.ts +1 -1
  88. package/app/utils/import_workflow.ts +6 -4
  89. package/app/utils/model_component_coloring.ts +46 -0
  90. package/app/utils/threshold.ts +33 -0
  91. package/app/utils/threshold_sources.ts +51 -0
  92. package/app/utils/upload_path.ts +15 -9
  93. package/internal/database/database.ts +4 -1
  94. package/internal/stores/data_style/mesh/cells/cell.ts +27 -150
  95. package/internal/stores/data_style/mesh/cells/cell_attribute.ts +74 -0
  96. package/internal/stores/data_style/mesh/cells/cell_config.ts +152 -0
  97. package/internal/stores/data_style/mesh/cells/vertex.ts +26 -157
  98. package/internal/stores/data_style/mesh/cells/vertex_attribute.ts +80 -0
  99. package/internal/stores/data_style/mesh/cells/vertex_config.ts +152 -0
  100. package/internal/stores/data_style/mesh/edges/edge.ts +27 -150
  101. package/internal/stores/data_style/mesh/edges/edge_attribute.ts +74 -0
  102. package/internal/stores/data_style/mesh/edges/edge_config.ts +152 -0
  103. package/internal/stores/data_style/mesh/edges/vertex.ts +26 -157
  104. package/internal/stores/data_style/mesh/edges/vertex_attribute.ts +80 -0
  105. package/internal/stores/data_style/mesh/edges/vertex_config.ts +152 -0
  106. package/internal/stores/data_style/mesh/points/vertex.ts +26 -157
  107. package/internal/stores/data_style/mesh/points/vertex_attribute.ts +80 -0
  108. package/internal/stores/data_style/mesh/points/vertex_config.ts +152 -0
  109. package/internal/stores/data_style/mesh/polygons/polygon.ts +27 -152
  110. package/internal/stores/data_style/mesh/polygons/polygon_attribute.ts +80 -0
  111. package/internal/stores/data_style/mesh/polygons/polygon_config.ts +148 -0
  112. package/internal/stores/data_style/mesh/polygons/vertex.ts +26 -157
  113. package/internal/stores/data_style/mesh/polygons/vertex_attribute.ts +80 -0
  114. package/internal/stores/data_style/mesh/polygons/vertex_config.ts +152 -0
  115. package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +27 -160
  116. package/internal/stores/data_style/mesh/polyhedra/polyhedron_attribute.ts +82 -0
  117. package/internal/stores/data_style/mesh/polyhedra/polyhedron_config.ts +157 -0
  118. package/internal/stores/data_style/mesh/polyhedra/vertex.ts +26 -157
  119. package/internal/stores/data_style/mesh/polyhedra/vertex_attribute.ts +80 -0
  120. package/internal/stores/data_style/mesh/polyhedra/vertex_config.ts +152 -0
  121. package/internal/stores/data_style/model/blocks/apply_coloring.ts +173 -0
  122. package/internal/stores/data_style/model/blocks/coloring_groups.ts +18 -0
  123. package/internal/stores/data_style/model/blocks/index.ts +12 -140
  124. package/internal/stores/data_style/model/blocks/polyhedron.ts +14 -10
  125. package/internal/stores/data_style/model/blocks/vertex.ts +14 -10
  126. package/internal/stores/data_style/model/common.ts +10 -119
  127. package/internal/stores/data_style/model/common_mutations.ts +184 -0
  128. package/internal/stores/data_style/model/corners/vertex.ts +14 -10
  129. package/internal/stores/data_style/model/lines/apply_coloring.ts +154 -0
  130. package/internal/stores/data_style/model/lines/coloring_groups.ts +18 -0
  131. package/internal/stores/data_style/model/lines/edge.ts +14 -10
  132. package/internal/stores/data_style/model/lines/index.ts +10 -134
  133. package/internal/stores/data_style/model/lines/vertex.ts +14 -10
  134. package/internal/stores/data_style/model/surfaces/apply_coloring.ts +186 -0
  135. package/internal/stores/data_style/model/surfaces/coloring_groups.ts +18 -0
  136. package/internal/stores/data_style/model/surfaces/index.ts +16 -160
  137. package/internal/stores/data_style/model/surfaces/polygon.ts +14 -10
  138. package/internal/stores/data_style/model/surfaces/vertex.ts +14 -10
  139. package/internal/stores/data_style/model/visibility.ts +3 -156
  140. package/internal/stores/data_style/model/visibility_dispatch.ts +160 -0
  141. package/internal/stores/data_style/state.ts +1 -181
  142. package/internal/stores/data_style/state_shared.ts +191 -0
  143. package/internal/stores/hybrid_viewer/brightness.ts +8 -2
  144. package/internal/stores/hybrid_viewer/camera.ts +7 -161
  145. package/internal/stores/hybrid_viewer/camera_animation.ts +4 -3
  146. package/internal/stores/hybrid_viewer/camera_helpers.ts +120 -0
  147. package/internal/stores/hybrid_viewer/camera_orientation.ts +60 -0
  148. package/internal/stores/hybrid_viewer/filters.ts +54 -11
  149. package/internal/stores/hybrid_viewer/highlight.ts +10 -9
  150. package/internal/stores/hybrid_viewer/ruler.ts +4 -3
  151. package/internal/utils/ws_client.ts +8 -1
  152. package/package.json +2 -2
  153. package/server/api/local/extensions/run.post.ts +6 -4
  154. package/server/utils/cleanup.ts +12 -2
  155. package/server/utils/microservices.ts +10 -102
  156. package/server/utils/microservices_process.ts +127 -0
  157. package/server/utils/typed_handler.ts +8 -1
  158. package/server/utils/ws_client.ts +15 -2
  159. package/shared/utils/fetch_raw.ts +2 -2
  160. package/shared/utils/parse_boolean.ts +4 -1
@@ -0,0 +1,131 @@
1
+ import type { Bounds } from "@kitware/vtk.js/types";
2
+ import type vtkActor from "@kitware/vtk.js/Rendering/Core/Actor";
3
+ import type { vtkCamera } from "@kitware/vtk.js/Rendering/Core/Camera";
4
+
5
+ function computeSceneBounds(actors: readonly vtkActor[]): Bounds {
6
+ let bounds: Bounds = [Infinity, -Infinity, Infinity, -Infinity, Infinity, -Infinity];
7
+ for (const actor of actors) {
8
+ const boundsOfActor = actor.getBounds();
9
+ bounds = [
10
+ Math.min(bounds[0], boundsOfActor[0]),
11
+ Math.max(bounds[1], boundsOfActor[1]),
12
+ Math.min(bounds[2], boundsOfActor[2]),
13
+ Math.max(bounds[3], boundsOfActor[3]),
14
+ Math.min(bounds[4], boundsOfActor[4]),
15
+ Math.max(bounds[5], boundsOfActor[5]),
16
+ ];
17
+ }
18
+ return bounds;
19
+ }
20
+
21
+ interface SceneBoundsInfo {
22
+ readonly center: readonly number[];
23
+ readonly cubicBounds: readonly number[];
24
+ }
25
+
26
+ function computeSceneBoundsInfo(actors: readonly vtkActor[]): SceneBoundsInfo {
27
+ if (actors.length === 0) {
28
+ return { center: [0, 0, 0], cubicBounds: [-1, 1, -1, 1, -1, 1] };
29
+ }
30
+ const [xmin, xmax, ymin, ymax, zmin, zmax] = computeSceneBounds(actors);
31
+ const center = [
32
+ Number(((xmin + xmax) / 2).toFixed(4)),
33
+ Number(((ymin + ymax) / 2).toFixed(4)),
34
+ Number(((zmin + zmax) / 2).toFixed(4)),
35
+ ];
36
+
37
+ const maxActorExtent = Math.max(
38
+ ...actors.map((actor: vtkActor) => {
39
+ const bounds = actor.getBounds();
40
+ return Math.max(bounds[1] - bounds[0], bounds[3] - bounds[2], bounds[5] - bounds[4]);
41
+ }),
42
+ );
43
+ const halfExtent = maxActorExtent / 2;
44
+ const [centerX = 0, centerY = 0, centerZ = 0] = center;
45
+ const cubicBounds = [
46
+ centerX - halfExtent,
47
+ centerX + halfExtent,
48
+ centerY - halfExtent,
49
+ centerY + halfExtent,
50
+ centerZ - halfExtent,
51
+ centerZ + halfExtent,
52
+ ];
53
+ return { center, cubicBounds };
54
+ }
55
+
56
+ interface ActorEntry {
57
+ readonly actor: vtkActor;
58
+ }
59
+
60
+ interface MainCameraOptions {
61
+ readonly focal_point?: readonly number[];
62
+ readonly position?: readonly number[];
63
+ readonly view_up?: readonly number[];
64
+ }
65
+
66
+ function resolveActiveActors(
67
+ targetAllVisible: boolean,
68
+ allItems: readonly { readonly id: string }[],
69
+ selectedDatasetIds: readonly string[],
70
+ hybridDb: Record<string, ActorEntry | undefined>,
71
+ ): vtkActor[] {
72
+ let targetIds: readonly string[] = selectedDatasetIds;
73
+ if (targetAllVisible) {
74
+ targetIds = allItems.map((item: { id: string }) => item.id);
75
+ }
76
+ const targeted = targetIds
77
+ .map((id) => hybridDb[id]?.actor)
78
+ .filter((actor: vtkActor | undefined): actor is vtkActor => actor !== undefined);
79
+ if (targeted.length > 0) {
80
+ return targeted;
81
+ }
82
+ return Object.values(hybridDb)
83
+ .filter((entry: ActorEntry | undefined): entry is ActorEntry => entry !== undefined)
84
+ .map((entry: ActorEntry) => entry.actor);
85
+ }
86
+
87
+ function computeNormalizedViewDirection(
88
+ focalPoint: readonly number[],
89
+ position: readonly number[],
90
+ ): readonly number[] | undefined {
91
+ const dir = [
92
+ (position[0] ?? 0) - (focalPoint[0] ?? 0),
93
+ (position[1] ?? 0) - (focalPoint[1] ?? 0),
94
+ (position[2] ?? 0) - (focalPoint[2] ?? 0),
95
+ ];
96
+ const dirLen = Math.hypot(...dir);
97
+ if (dirLen === 0) {
98
+ return undefined;
99
+ }
100
+ return dir.map((component) => component / dirLen);
101
+ }
102
+
103
+ // Aligns the local clipping-plane preview camera onto the same viewing direction as the
104
+ // Main viewer camera, re-centered on the clipped scene's bounds.
105
+ function alignCameraToMainCamera(
106
+ camera: vtkCamera,
107
+ mainCam: MainCameraOptions,
108
+ center: readonly number[],
109
+ ): void {
110
+ if (!mainCam.focal_point || !mainCam.position) {
111
+ return;
112
+ }
113
+ const normDir = computeNormalizedViewDirection(mainCam.focal_point, mainCam.position);
114
+ if (!normDir) {
115
+ return;
116
+ }
117
+ const distance = camera.getDistance();
118
+ camera.setFocalPoint(center[0] ?? 0, center[1] ?? 0, center[2] ?? 0);
119
+ camera.setPosition(
120
+ (center[0] ?? 0) + (normDir[0] ?? 0) * distance,
121
+ (center[1] ?? 0) + (normDir[1] ?? 0) * distance,
122
+ (center[2] ?? 0) + (normDir[2] ?? 0) * distance,
123
+ );
124
+ if (mainCam.view_up) {
125
+ const [viewUpX = 0, viewUpY = 0, viewUpZ = 0] = mainCam.view_up;
126
+ camera.setViewUp(viewUpX, viewUpY, viewUpZ);
127
+ }
128
+ }
129
+
130
+ export { alignCameraToMainCamera, computeSceneBounds, computeSceneBoundsInfo, resolveActiveActors };
131
+ export type { MainCameraOptions, SceneBoundsInfo };
@@ -0,0 +1,101 @@
1
+ import type { AttributeSchemas } from "@ogw_front/utils/attribute_range";
2
+ import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
3
+
4
+ interface Schemas {
5
+ vertex?: AttributeSchemas;
6
+ edge?: AttributeSchemas;
7
+ cell?: AttributeSchemas;
8
+ polygon?: AttributeSchemas;
9
+ polyhedron?: AttributeSchemas;
10
+ }
11
+
12
+ interface ColoringStyle {
13
+ name: string;
14
+ value: string;
15
+ }
16
+
17
+ interface ColoringAvailability {
18
+ color: boolean;
19
+ textures: boolean;
20
+ vertex: boolean;
21
+ edge: boolean;
22
+ cell: boolean;
23
+ polygon: boolean;
24
+ polyhedron: boolean;
25
+ }
26
+
27
+ const COLORING_STYLES = {
28
+ color: { name: "Constant", value: "constant" },
29
+ random: { name: "Random", value: "random" },
30
+ textures: { name: "Textures", value: "textures" },
31
+ vertex: { name: "Vertex attribute", value: "vertex" },
32
+ edge: { name: "Edge attribute", value: "edge" },
33
+ cell: { name: "Cell attribute", value: "cell" },
34
+ polygon: { name: "Polygon attribute", value: "polygon" },
35
+ polyhedron: {
36
+ name: "Polyhedron attribute",
37
+ value: "polyhedron",
38
+ },
39
+ };
40
+
41
+ const ATTRIBUTE_STYLE_KEYS = [
42
+ "textures",
43
+ "vertex",
44
+ "edge",
45
+ "cell",
46
+ "polygon",
47
+ "polyhedron",
48
+ ] as const;
49
+
50
+ function buildColoringStyles(
51
+ available: ColoringAvailability,
52
+ allowRandom: boolean,
53
+ ): { labels: string[]; values: string[] } {
54
+ const array: ColoringStyle[] = [];
55
+ if (available.color) {
56
+ array.push(COLORING_STYLES.color);
57
+ if (allowRandom) {
58
+ array.push(COLORING_STYLES.random);
59
+ }
60
+ }
61
+ for (const key of ATTRIBUTE_STYLE_KEYS) {
62
+ if (available[key]) {
63
+ array.push(COLORING_STYLES[key]);
64
+ }
65
+ }
66
+
67
+ const labels = array.map((coloring) => coloring.name);
68
+ const values = array.map((coloring) => coloring.value);
69
+
70
+ return { labels, values };
71
+ }
72
+
73
+ // The attribute schemas of the props, each defaulting to the ones of the mesh elements
74
+ function resolveAttributeSchemas(schemas: Schemas): Required<Schemas> {
75
+ const backSchemas = back_schemas.opengeodeweb_back;
76
+ return {
77
+ vertex: schemas.vertex ?? {
78
+ names: backSchemas.vertex_attribute_names,
79
+ range: backSchemas.vertex_attribute_range,
80
+ },
81
+ edge: schemas.edge ?? {
82
+ names: backSchemas.edge_attribute_names,
83
+ range: backSchemas.edge_attribute_range,
84
+ },
85
+ cell: schemas.cell ?? {
86
+ names: backSchemas.cell_attribute_names,
87
+ range: backSchemas.cell_attribute_range,
88
+ },
89
+ polygon: schemas.polygon ?? {
90
+ names: backSchemas.polygon_attribute_names,
91
+ range: backSchemas.polygon_attribute_range,
92
+ },
93
+ polyhedron: schemas.polyhedron ?? {
94
+ names: backSchemas.polyhedron_attribute_names,
95
+ range: backSchemas.polyhedron_attribute_range,
96
+ },
97
+ };
98
+ }
99
+
100
+ export { COLORING_STYLES, buildColoringStyles, resolveAttributeSchemas };
101
+ export type { Schemas };
@@ -0,0 +1,168 @@
1
+ import {
2
+ type AttributeConfig,
3
+ CELLS_DEFAULT_COLOR,
4
+ CELLS_DEFAULT_VISIBILITY,
5
+ EDGES_DEFAULT_COLOR,
6
+ EDGES_DEFAULT_VISIBILITY,
7
+ EDGES_DEFAULT_WIDTH,
8
+ MESH_DEFAULT_ACTIVE_COLORING,
9
+ POINTS_DEFAULT_COLOR,
10
+ POINTS_DEFAULT_SIZE,
11
+ POINTS_DEFAULT_VISIBILITY,
12
+ POLYGONS_DEFAULT_COLOR,
13
+ POLYGONS_DEFAULT_VISIBILITY,
14
+ POLYHEDRA_DEFAULT_COLOR,
15
+ POLYHEDRA_DEFAULT_VISIBILITY,
16
+ type RGBAColor,
17
+ } from "./constants";
18
+ import type { MeshApplyTexturesParams } from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
19
+
20
+ function emptyAttributeConfig(): AttributeConfig {
21
+ return { name: undefined, storedConfigs: {} };
22
+ }
23
+
24
+ interface MeshComponentColoring {
25
+ active: string;
26
+ constant: RGBAColor;
27
+ vertex: AttributeConfig;
28
+ }
29
+
30
+ interface MeshEdgesColoring extends MeshComponentColoring {
31
+ edge: AttributeConfig;
32
+ }
33
+
34
+ interface MeshCellsColoring extends MeshComponentColoring {
35
+ cell: AttributeConfig;
36
+ textures: MeshApplyTexturesParams["textures"];
37
+ }
38
+
39
+ interface MeshPolygonsColoring extends MeshComponentColoring {
40
+ textures: MeshApplyTexturesParams["textures"];
41
+ polygon: AttributeConfig;
42
+ }
43
+
44
+ interface MeshPolyhedraColoring extends MeshComponentColoring {
45
+ polyhedron: AttributeConfig;
46
+ }
47
+
48
+ interface MeshPointsStyle {
49
+ visibility: boolean;
50
+ coloring: MeshComponentColoring;
51
+ size: number;
52
+ }
53
+
54
+ interface MeshEdgesStyle {
55
+ visibility: boolean;
56
+ coloring: MeshEdgesColoring;
57
+ width: number;
58
+ }
59
+
60
+ interface MeshCellsStyle {
61
+ visibility: boolean;
62
+ coloring: MeshCellsColoring;
63
+ }
64
+
65
+ interface MeshPolygonsStyle {
66
+ visibility: boolean;
67
+ coloring: MeshPolygonsColoring;
68
+ }
69
+
70
+ interface MeshPolyhedraStyle {
71
+ visibility: boolean;
72
+ coloring: MeshPolyhedraColoring;
73
+ }
74
+
75
+ function meshPointsDefaultStyle(
76
+ visibility: boolean = POINTS_DEFAULT_VISIBILITY,
77
+ size: number = POINTS_DEFAULT_SIZE,
78
+ constant: RGBAColor = POINTS_DEFAULT_COLOR,
79
+ ): MeshPointsStyle {
80
+ return {
81
+ visibility,
82
+ coloring: {
83
+ active: MESH_DEFAULT_ACTIVE_COLORING,
84
+ constant,
85
+ vertex: emptyAttributeConfig(),
86
+ },
87
+ size,
88
+ };
89
+ }
90
+
91
+ function meshEdgesDefaultStyle(
92
+ visibility: boolean = EDGES_DEFAULT_VISIBILITY,
93
+ width: number = EDGES_DEFAULT_WIDTH,
94
+ constant: RGBAColor = EDGES_DEFAULT_COLOR,
95
+ ): MeshEdgesStyle {
96
+ return {
97
+ visibility,
98
+ coloring: {
99
+ active: MESH_DEFAULT_ACTIVE_COLORING,
100
+ constant,
101
+ edge: emptyAttributeConfig(),
102
+ vertex: emptyAttributeConfig(),
103
+ },
104
+ width,
105
+ };
106
+ }
107
+
108
+ function meshCellsDefaultStyle(
109
+ visibility: boolean = CELLS_DEFAULT_VISIBILITY,
110
+ constant: RGBAColor = CELLS_DEFAULT_COLOR,
111
+ ): MeshCellsStyle {
112
+ return {
113
+ visibility,
114
+ coloring: {
115
+ active: MESH_DEFAULT_ACTIVE_COLORING,
116
+ cell: emptyAttributeConfig(),
117
+ constant,
118
+ textures: [],
119
+ vertex: emptyAttributeConfig(),
120
+ },
121
+ };
122
+ }
123
+
124
+ function meshPolygonsDefaultStyle(
125
+ visibility: boolean = POLYGONS_DEFAULT_VISIBILITY,
126
+ constant: RGBAColor = POLYGONS_DEFAULT_COLOR,
127
+ ): MeshPolygonsStyle {
128
+ return {
129
+ visibility,
130
+ coloring: {
131
+ active: MESH_DEFAULT_ACTIVE_COLORING,
132
+ constant,
133
+ textures: [],
134
+ polygon: emptyAttributeConfig(),
135
+ vertex: emptyAttributeConfig(),
136
+ },
137
+ };
138
+ }
139
+
140
+ function meshPolyhedraDefaultStyle(
141
+ visibility: boolean = POLYHEDRA_DEFAULT_VISIBILITY,
142
+ constant: RGBAColor = POLYHEDRA_DEFAULT_COLOR,
143
+ ): MeshPolyhedraStyle {
144
+ return {
145
+ visibility,
146
+ coloring: {
147
+ active: MESH_DEFAULT_ACTIVE_COLORING,
148
+ constant,
149
+ polyhedron: emptyAttributeConfig(),
150
+ vertex: emptyAttributeConfig(),
151
+ },
152
+ };
153
+ }
154
+
155
+ export {
156
+ meshPointsDefaultStyle,
157
+ meshEdgesDefaultStyle,
158
+ meshCellsDefaultStyle,
159
+ meshPolygonsDefaultStyle,
160
+ meshPolyhedraDefaultStyle,
161
+ };
162
+ export type {
163
+ MeshCellsStyle,
164
+ MeshEdgesStyle,
165
+ MeshPointsStyle,
166
+ MeshPolygonsStyle,
167
+ MeshPolyhedraStyle,
168
+ };
@@ -1,77 +1,15 @@
1
- import type { MeshApplyTexturesParams } from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
2
-
3
1
  import {
4
- type AttributeConfig,
5
- CELLS_DEFAULT_COLOR,
6
- CELLS_DEFAULT_VISIBILITY,
7
- EDGES_DEFAULT_COLOR,
8
- EDGES_DEFAULT_VISIBILITY,
9
- EDGES_DEFAULT_WIDTH,
10
- MESH_DEFAULT_ACTIVE_COLORING,
11
- POINTS_DEFAULT_COLOR,
12
- POINTS_DEFAULT_SIZE,
13
- POINTS_DEFAULT_VISIBILITY,
14
- POLYGONS_DEFAULT_COLOR,
15
- POLYGONS_DEFAULT_VISIBILITY,
16
- POLYHEDRA_DEFAULT_COLOR,
17
- POLYHEDRA_DEFAULT_VISIBILITY,
18
- type RGBAColor,
19
- } from "./constants";
20
-
21
- function emptyAttributeConfig(): AttributeConfig {
22
- return { name: undefined, storedConfigs: {} };
23
- }
24
-
25
- interface MeshComponentColoring {
26
- active: string;
27
- constant: RGBAColor;
28
- vertex: AttributeConfig;
29
- }
30
-
31
- interface MeshEdgesColoring extends MeshComponentColoring {
32
- edge: AttributeConfig;
33
- }
34
-
35
- interface MeshCellsColoring extends MeshComponentColoring {
36
- cell: AttributeConfig;
37
- textures: MeshApplyTexturesParams["textures"];
38
- }
39
-
40
- interface MeshPolygonsColoring extends MeshComponentColoring {
41
- textures: MeshApplyTexturesParams["textures"];
42
- polygon: AttributeConfig;
43
- }
44
-
45
- interface MeshPolyhedraColoring extends MeshComponentColoring {
46
- polyhedron: AttributeConfig;
47
- }
48
-
49
- interface MeshPointsStyle {
50
- visibility: boolean;
51
- coloring: MeshComponentColoring;
52
- size: number;
53
- }
54
-
55
- interface MeshEdgesStyle {
56
- visibility: boolean;
57
- coloring: MeshEdgesColoring;
58
- width: number;
59
- }
60
-
61
- interface MeshCellsStyle {
62
- visibility: boolean;
63
- coloring: MeshCellsColoring;
64
- }
65
-
66
- interface MeshPolygonsStyle {
67
- visibility: boolean;
68
- coloring: MeshPolygonsColoring;
69
- }
70
-
71
- interface MeshPolyhedraStyle {
72
- visibility: boolean;
73
- coloring: MeshPolyhedraColoring;
74
- }
2
+ type MeshCellsStyle,
3
+ type MeshEdgesStyle,
4
+ type MeshPointsStyle,
5
+ type MeshPolygonsStyle,
6
+ type MeshPolyhedraStyle,
7
+ meshCellsDefaultStyle,
8
+ meshEdgesDefaultStyle,
9
+ meshPointsDefaultStyle,
10
+ meshPolygonsDefaultStyle,
11
+ meshPolyhedraDefaultStyle,
12
+ } from "./mesh_components";
75
13
 
76
14
  interface PointSetStyle {
77
15
  visibility: boolean;
@@ -114,86 +52,6 @@ interface SolidStyle {
114
52
  polyhedra: MeshPolyhedraStyle;
115
53
  }
116
54
 
117
- function meshPointsDefaultStyle(
118
- visibility: boolean = POINTS_DEFAULT_VISIBILITY,
119
- size: number = POINTS_DEFAULT_SIZE,
120
- constant: RGBAColor = POINTS_DEFAULT_COLOR,
121
- ): MeshPointsStyle {
122
- return {
123
- visibility,
124
- coloring: {
125
- active: MESH_DEFAULT_ACTIVE_COLORING,
126
- constant,
127
- vertex: emptyAttributeConfig(),
128
- },
129
- size,
130
- };
131
- }
132
-
133
- function meshEdgesDefaultStyle(
134
- visibility: boolean = EDGES_DEFAULT_VISIBILITY,
135
- width: number = EDGES_DEFAULT_WIDTH,
136
- constant: RGBAColor = EDGES_DEFAULT_COLOR,
137
- ): MeshEdgesStyle {
138
- return {
139
- visibility,
140
- coloring: {
141
- active: MESH_DEFAULT_ACTIVE_COLORING,
142
- constant,
143
- edge: emptyAttributeConfig(),
144
- vertex: emptyAttributeConfig(),
145
- },
146
- width,
147
- };
148
- }
149
-
150
- function meshCellsDefaultStyle(
151
- visibility: boolean = CELLS_DEFAULT_VISIBILITY,
152
- constant: RGBAColor = CELLS_DEFAULT_COLOR,
153
- ): MeshCellsStyle {
154
- return {
155
- visibility,
156
- coloring: {
157
- active: MESH_DEFAULT_ACTIVE_COLORING,
158
- cell: emptyAttributeConfig(),
159
- constant,
160
- textures: [],
161
- vertex: emptyAttributeConfig(),
162
- },
163
- };
164
- }
165
-
166
- function meshPolygonsDefaultStyle(
167
- visibility: boolean = POLYGONS_DEFAULT_VISIBILITY,
168
- constant: RGBAColor = POLYGONS_DEFAULT_COLOR,
169
- ): MeshPolygonsStyle {
170
- return {
171
- visibility,
172
- coloring: {
173
- active: MESH_DEFAULT_ACTIVE_COLORING,
174
- constant,
175
- textures: [],
176
- polygon: emptyAttributeConfig(),
177
- vertex: emptyAttributeConfig(),
178
- },
179
- };
180
- }
181
-
182
- function meshPolyhedraDefaultStyle(
183
- visibility: boolean = POLYHEDRA_DEFAULT_VISIBILITY,
184
- constant: RGBAColor = POLYHEDRA_DEFAULT_COLOR,
185
- ): MeshPolyhedraStyle {
186
- return {
187
- visibility,
188
- coloring: {
189
- active: MESH_DEFAULT_ACTIVE_COLORING,
190
- constant,
191
- polyhedron: emptyAttributeConfig(),
192
- vertex: emptyAttributeConfig(),
193
- },
194
- };
195
- }
196
-
197
55
  function pointSetDefaultStyle(): PointSetStyle {
198
56
  return {
199
57
  visibility: true,
@@ -253,6 +111,8 @@ export {
253
111
  meshCellsDefaultStyle,
254
112
  meshPolygonsDefaultStyle,
255
113
  meshPolyhedraDefaultStyle,
114
+ } from "./mesh_components";
115
+ export {
256
116
  pointSetDefaultStyle,
257
117
  edgedCurveDefaultStyle,
258
118
  grid2dDefaultStyle,