@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.
- package/.build/server/utils/microservices.js +9 -85
- package/.build/server/utils/microservices_process.js +85 -0
- package/app/components/ClippingPlanes.vue +16 -82
- package/app/components/DragAndDrop.vue +1 -74
- package/app/components/ThresholdCard.vue +205 -0
- package/app/components/ThresholdFilter.vue +77 -216
- package/app/components/ViewToolbar.vue +15 -231
- package/app/components/Viewer/EdgedCurve/SpecificEdgesColoring.vue +209 -0
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +3 -191
- package/app/components/Viewer/Generic/Mesh/CellsColoring.vue +228 -0
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +3 -210
- package/app/components/Viewer/Generic/Mesh/EdgesColoring.vue +211 -0
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +3 -192
- package/app/components/Viewer/Generic/Mesh/PolygonsColoring.vue +234 -0
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +3 -215
- package/app/components/Viewer/Generic/Mesh/PolyhedraColoring.vue +221 -0
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +3 -203
- package/app/components/Viewer/Generic/Model/ComponentPointsOptions.vue +2 -18
- package/app/components/Viewer/Generic/Model/CornerComponentOptions.vue +145 -0
- package/app/components/Viewer/Generic/Model/CornersOptions.vue +13 -294
- package/app/components/Viewer/Generic/Model/CornersTypeOptions.vue +173 -0
- package/app/components/Viewer/Generic/Model/LineComponentOptions.vue +218 -0
- package/app/components/Viewer/Generic/Model/LinesOptions.vue +13 -425
- package/app/components/Viewer/Generic/Model/LinesTypeOptions.vue +229 -0
- package/app/components/Viewer/Options/AttributeSelector.vue +26 -133
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +36 -74
- package/app/components/Viewer/Options/NoDataColorInfo.vue +56 -0
- package/app/components/Viewer/Solid/SpecificPolyhedraColoring.vue +217 -0
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +4 -199
- package/app/components/Viewer/Surface/PolygonsColoring.vue +231 -0
- package/app/components/Viewer/Surface/PolygonsOptions.vue +3 -213
- package/app/composables/attribute_selector.ts +126 -0
- package/app/composables/clipping_slices.ts +166 -0
- package/app/composables/view_toolbar_options.ts +126 -0
- package/app/composables/view_toolbar_tool_options.ts +115 -0
- package/app/composables/view_toolbar_tools.ts +108 -0
- package/app/composables/virtual_tree.ts +20 -138
- package/app/composables/virtual_tree_flatten.ts +86 -0
- package/app/composables/virtual_tree_types.ts +81 -0
- package/app/stores/app.ts +8 -55
- package/app/stores/app_helpers/registry.ts +69 -0
- package/app/stores/menu.ts +1 -124
- package/app/stores/menu_helpers/menus_data.ts +127 -0
- package/app/stores/viewer.ts +17 -78
- package/app/stores/viewer_helpers/actions.ts +68 -0
- package/app/stores/viewer_helpers/request.ts +61 -0
- package/app/utils/clipping_planes.ts +4 -132
- package/app/utils/clipping_planes_scene.ts +131 -0
- package/app/utils/coloring_styles.ts +101 -0
- package/app/utils/default_styles/mesh_components.ts +168 -0
- package/app/utils/default_styles/meshes.ts +13 -153
- package/app/utils/default_styles/model_components.ts +170 -0
- package/app/utils/default_styles/models.ts +16 -153
- package/app/utils/drag_and_drop.ts +80 -0
- package/app/utils/model_component_coloring.ts +46 -0
- package/app/utils/threshold.ts +33 -0
- package/app/utils/threshold_sources.ts +51 -0
- package/internal/stores/data_style/mesh/cells/cell.ts +27 -150
- package/internal/stores/data_style/mesh/cells/cell_attribute.ts +74 -0
- package/internal/stores/data_style/mesh/cells/cell_config.ts +152 -0
- package/internal/stores/data_style/mesh/cells/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/cells/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/cells/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/edges/edge.ts +27 -150
- package/internal/stores/data_style/mesh/edges/edge_attribute.ts +74 -0
- package/internal/stores/data_style/mesh/edges/edge_config.ts +152 -0
- package/internal/stores/data_style/mesh/edges/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/edges/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/edges/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/points/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/points/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/points/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/polygons/polygon.ts +27 -152
- package/internal/stores/data_style/mesh/polygons/polygon_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polygons/polygon_config.ts +148 -0
- package/internal/stores/data_style/mesh/polygons/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/polygons/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polygons/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +27 -160
- package/internal/stores/data_style/mesh/polyhedra/polyhedron_attribute.ts +82 -0
- package/internal/stores/data_style/mesh/polyhedra/polyhedron_config.ts +157 -0
- package/internal/stores/data_style/mesh/polyhedra/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/polyhedra/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polyhedra/vertex_config.ts +152 -0
- package/internal/stores/data_style/model/blocks/apply_coloring.ts +173 -0
- package/internal/stores/data_style/model/blocks/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/blocks/index.ts +12 -140
- package/internal/stores/data_style/model/common.ts +10 -119
- package/internal/stores/data_style/model/common_mutations.ts +184 -0
- package/internal/stores/data_style/model/lines/apply_coloring.ts +154 -0
- package/internal/stores/data_style/model/lines/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/lines/index.ts +10 -134
- package/internal/stores/data_style/model/surfaces/apply_coloring.ts +186 -0
- package/internal/stores/data_style/model/surfaces/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/surfaces/index.ts +16 -160
- package/internal/stores/data_style/model/visibility.ts +3 -156
- package/internal/stores/data_style/model/visibility_dispatch.ts +160 -0
- package/internal/stores/data_style/state.ts +1 -181
- package/internal/stores/data_style/state_shared.ts +191 -0
- package/internal/stores/hybrid_viewer/camera.ts +7 -161
- package/internal/stores/hybrid_viewer/camera_helpers.ts +120 -0
- package/internal/stores/hybrid_viewer/camera_orientation.ts +60 -0
- package/internal/stores/hybrid_viewer/filters.ts +54 -11
- package/package.json +1 -1
- package/server/utils/microservices.ts +10 -109
- package/server/utils/microservices_process.ts +127 -0
|
@@ -1,7 +1,3 @@
|
|
|
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
1
|
const AXIS_SCALE = 0.45;
|
|
6
2
|
const SIZE_RATIO = 0.1;
|
|
7
3
|
const DEBOUNCE_DELAY = 200;
|
|
@@ -79,131 +75,6 @@ function getPlaneStyle(rgb: readonly number[]): PlaneStyle {
|
|
|
79
75
|
};
|
|
80
76
|
}
|
|
81
77
|
|
|
82
|
-
function computeSceneBounds(actors: readonly vtkActor[]): Bounds {
|
|
83
|
-
let bounds: Bounds = [Infinity, -Infinity, Infinity, -Infinity, Infinity, -Infinity];
|
|
84
|
-
for (const actor of actors) {
|
|
85
|
-
const boundsOfActor = actor.getBounds();
|
|
86
|
-
bounds = [
|
|
87
|
-
Math.min(bounds[0], boundsOfActor[0]),
|
|
88
|
-
Math.max(bounds[1], boundsOfActor[1]),
|
|
89
|
-
Math.min(bounds[2], boundsOfActor[2]),
|
|
90
|
-
Math.max(bounds[3], boundsOfActor[3]),
|
|
91
|
-
Math.min(bounds[4], boundsOfActor[4]),
|
|
92
|
-
Math.max(bounds[5], boundsOfActor[5]),
|
|
93
|
-
];
|
|
94
|
-
}
|
|
95
|
-
return bounds;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
interface SceneBoundsInfo {
|
|
99
|
-
readonly center: readonly number[];
|
|
100
|
-
readonly cubicBounds: readonly number[];
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function computeSceneBoundsInfo(actors: readonly vtkActor[]): SceneBoundsInfo {
|
|
104
|
-
if (actors.length === 0) {
|
|
105
|
-
return { center: [0, 0, 0], cubicBounds: [-1, 1, -1, 1, -1, 1] };
|
|
106
|
-
}
|
|
107
|
-
const [xmin, xmax, ymin, ymax, zmin, zmax] = computeSceneBounds(actors);
|
|
108
|
-
const center = [
|
|
109
|
-
Number(((xmin + xmax) / 2).toFixed(4)),
|
|
110
|
-
Number(((ymin + ymax) / 2).toFixed(4)),
|
|
111
|
-
Number(((zmin + zmax) / 2).toFixed(4)),
|
|
112
|
-
];
|
|
113
|
-
|
|
114
|
-
const maxActorExtent = Math.max(
|
|
115
|
-
...actors.map((actor: vtkActor) => {
|
|
116
|
-
const bounds = actor.getBounds();
|
|
117
|
-
return Math.max(bounds[1] - bounds[0], bounds[3] - bounds[2], bounds[5] - bounds[4]);
|
|
118
|
-
}),
|
|
119
|
-
);
|
|
120
|
-
const halfExtent = maxActorExtent / 2;
|
|
121
|
-
const [centerX = 0, centerY = 0, centerZ = 0] = center;
|
|
122
|
-
const cubicBounds = [
|
|
123
|
-
centerX - halfExtent,
|
|
124
|
-
centerX + halfExtent,
|
|
125
|
-
centerY - halfExtent,
|
|
126
|
-
centerY + halfExtent,
|
|
127
|
-
centerZ - halfExtent,
|
|
128
|
-
centerZ + halfExtent,
|
|
129
|
-
];
|
|
130
|
-
return { center, cubicBounds };
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
interface ActorEntry {
|
|
134
|
-
readonly actor: vtkActor;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
interface MainCameraOptions {
|
|
138
|
-
readonly focal_point?: readonly number[];
|
|
139
|
-
readonly position?: readonly number[];
|
|
140
|
-
readonly view_up?: readonly number[];
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function resolveActiveActors(
|
|
144
|
-
targetAllVisible: boolean,
|
|
145
|
-
allItems: readonly { readonly id: string }[],
|
|
146
|
-
selectedDatasetIds: readonly string[],
|
|
147
|
-
hybridDb: Record<string, ActorEntry | undefined>,
|
|
148
|
-
): vtkActor[] {
|
|
149
|
-
let targetIds: readonly string[] = selectedDatasetIds;
|
|
150
|
-
if (targetAllVisible) {
|
|
151
|
-
targetIds = allItems.map((item: { id: string }) => item.id);
|
|
152
|
-
}
|
|
153
|
-
const targeted = targetIds
|
|
154
|
-
.map((id) => hybridDb[id]?.actor)
|
|
155
|
-
.filter((actor: vtkActor | undefined): actor is vtkActor => actor !== undefined);
|
|
156
|
-
if (targeted.length > 0) {
|
|
157
|
-
return targeted;
|
|
158
|
-
}
|
|
159
|
-
return Object.values(hybridDb)
|
|
160
|
-
.filter((entry: ActorEntry | undefined): entry is ActorEntry => entry !== undefined)
|
|
161
|
-
.map((entry: ActorEntry) => entry.actor);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function computeNormalizedViewDirection(
|
|
165
|
-
focalPoint: readonly number[],
|
|
166
|
-
position: readonly number[],
|
|
167
|
-
): readonly number[] | undefined {
|
|
168
|
-
const dir = [
|
|
169
|
-
(position[0] ?? 0) - (focalPoint[0] ?? 0),
|
|
170
|
-
(position[1] ?? 0) - (focalPoint[1] ?? 0),
|
|
171
|
-
(position[2] ?? 0) - (focalPoint[2] ?? 0),
|
|
172
|
-
];
|
|
173
|
-
const dirLen = Math.hypot(...dir);
|
|
174
|
-
if (dirLen === 0) {
|
|
175
|
-
return undefined;
|
|
176
|
-
}
|
|
177
|
-
return dir.map((component) => component / dirLen);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// Aligns the local clipping-plane preview camera onto the same viewing direction as the
|
|
181
|
-
// Main viewer camera, re-centered on the clipped scene's bounds.
|
|
182
|
-
function alignCameraToMainCamera(
|
|
183
|
-
camera: vtkCamera,
|
|
184
|
-
mainCam: MainCameraOptions,
|
|
185
|
-
center: readonly number[],
|
|
186
|
-
): void {
|
|
187
|
-
if (!mainCam.focal_point || !mainCam.position) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
const normDir = computeNormalizedViewDirection(mainCam.focal_point, mainCam.position);
|
|
191
|
-
if (!normDir) {
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
const distance = camera.getDistance();
|
|
195
|
-
camera.setFocalPoint(center[0] ?? 0, center[1] ?? 0, center[2] ?? 0);
|
|
196
|
-
camera.setPosition(
|
|
197
|
-
(center[0] ?? 0) + (normDir[0] ?? 0) * distance,
|
|
198
|
-
(center[1] ?? 0) + (normDir[1] ?? 0) * distance,
|
|
199
|
-
(center[2] ?? 0) + (normDir[2] ?? 0) * distance,
|
|
200
|
-
);
|
|
201
|
-
if (mainCam.view_up) {
|
|
202
|
-
const [viewUpX = 0, viewUpY = 0, viewUpZ = 0] = mainCam.view_up;
|
|
203
|
-
camera.setViewUp(viewUpX, viewUpY, viewUpZ);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
78
|
export {
|
|
208
79
|
AXIS_SCALE,
|
|
209
80
|
SIZE_RATIO,
|
|
@@ -214,10 +85,11 @@ export {
|
|
|
214
85
|
getPlaneCssColor,
|
|
215
86
|
hasPlaneChanged,
|
|
216
87
|
getPlaneStyle,
|
|
88
|
+
};
|
|
89
|
+
export {
|
|
217
90
|
computeSceneBounds,
|
|
218
91
|
computeSceneBoundsInfo,
|
|
219
92
|
resolveActiveActors,
|
|
220
93
|
alignCameraToMainCamera,
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
export type { SceneBoundsInfo, MainCameraOptions };
|
|
94
|
+
} from "./clipping_planes_scene";
|
|
95
|
+
export type { SceneBoundsInfo, MainCameraOptions } from "./clipping_planes_scene";
|
|
@@ -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
|
+
};
|