@geode/opengeodeweb-front 10.34.0-rc.9 → 10.34.0
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/{server → .build/server}/utils/app_config.js +10 -9
- package/{server → .build/server}/utils/cleanup.js +31 -17
- package/{server → .build/server}/utils/cloud.js +1 -4
- package/{server → .build/server}/utils/microservices.js +21 -9
- package/{server → .build/server}/utils/path.js +4 -4
- package/{server → .build/server}/utils/scripts.js +9 -9
- package/.build/server/utils/server_config.js +51 -0
- package/.build/server/utils/stream.js +6 -0
- package/{server → .build/server}/utils/ws_client.js +18 -3
- package/{shared → .build/shared}/scripts.js +10 -10
- package/.build/shared/utils/call_raw.js +31 -0
- package/{shared → .build/shared}/utils/call_schema.js +2 -2
- package/.build/shared/utils/fetch_raw.js +52 -0
- package/{shared → .build/shared}/utils/fetch_schema.js +2 -2
- package/{shared → .build/shared}/utils/file.js +3 -1
- package/{shared → .build/shared}/utils/response_handlers/load.js +10 -7
- package/{shared → .build/shared}/utils/validate_schema.js +1 -1
- package/app/components/ActionButton.vue +6 -6
- package/app/components/CameraManager/List.vue +5 -5
- package/app/components/CameraManager/Saver.vue +3 -5
- package/app/components/CameraManager.vue +6 -4
- package/app/components/CameraOrientation.vue +12 -12
- package/app/components/ClippingPlaneCard.vue +4 -2
- package/app/components/ClippingPlanes.vue +8 -8
- package/app/components/CrsSelector.vue +9 -10
- package/app/components/DeleteDialog.vue +4 -2
- package/app/components/DragAndDrop.vue +10 -12
- package/app/components/DragAndDropInternal/DragAndDropInline.vue +4 -2
- package/app/components/ExtensionSelector.vue +4 -4
- package/app/components/FeedBack/ErrorBanner.vue +3 -1
- package/app/components/FeedBack/Snackers.vue +4 -3
- package/app/components/FileSelector.vue +10 -8
- package/app/components/FileUploader.vue +11 -11
- package/app/components/GlassCard.vue +1 -1
- package/app/components/HybridRenderingView.vue +7 -5
- package/app/components/HybridViewerTooltip.vue +7 -7
- package/app/components/Launcher.vue +1 -1
- package/app/components/Loading/EcoMessages.vue +9 -3
- package/app/components/Loading.vue +2 -2
- package/app/components/MissingFilesSelector.vue +12 -10
- package/app/components/ObjectSelector.vue +10 -9
- package/app/components/PackagesVersions.vue +6 -5
- package/app/components/Recaptcha.vue +3 -3
- package/app/components/RemoteRenderingView.vue +6 -7
- package/app/components/Ruler.vue +3 -3
- package/app/components/Screenshot.vue +6 -6
- package/app/components/SearchBar.vue +4 -2
- package/app/components/ShrinkFilter.vue +7 -7
- package/app/components/Step.vue +6 -5
- package/app/components/Stepper.vue +4 -3
- package/app/components/ToolPanel.vue +6 -3
- package/app/components/ViewToolbar.vue +25 -28
- package/app/components/Viewer/ContextMenu/CenterButton.vue +7 -5
- package/app/components/Viewer/ContextMenu/CircularItems.vue +3 -3
- package/app/components/Viewer/ContextMenu/ContextMenu.vue +22 -19
- package/app/components/Viewer/ContextMenu/ContextMenuItem.vue +10 -8
- package/app/components/Viewer/ContextMenu/InfoCard.vue +11 -12
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +13 -17
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +11 -15
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +12 -16
- package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +8 -12
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +11 -15
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +11 -15
- package/app/components/Viewer/Generic/Model/BlocksOptions.vue +67 -38
- package/app/components/Viewer/Generic/Model/CornersOptions.vue +53 -23
- package/app/components/Viewer/Generic/Model/EdgesOptions.vue +1 -3
- package/app/components/Viewer/Generic/Model/LinesOptions.vue +67 -38
- package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +31 -15
- package/app/components/Viewer/Generic/Model/ModelStyleOptions.vue +2 -3
- package/app/components/Viewer/Generic/Model/PointsOptions.vue +6 -6
- package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +69 -38
- package/app/components/Viewer/ObjectTree/Base/CommonTreeView.vue +64 -46
- package/app/components/Viewer/ObjectTree/Base/Controls.vue +5 -5
- package/app/components/Viewer/ObjectTree/Base/ItemLabel.vue +13 -9
- package/app/components/Viewer/ObjectTree/Base/StickyHeader.vue +5 -5
- package/app/components/Viewer/ObjectTree/Base/TreeRow.vue +10 -10
- package/app/components/Viewer/ObjectTree/Box.vue +6 -4
- package/app/components/Viewer/ObjectTree/Layout.vue +23 -21
- package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +14 -14
- package/app/components/Viewer/ObjectTree/Views/{ModelCollections.vue → ModelTree.vue} +59 -24
- package/app/components/Viewer/Options/AttributeColorBar.vue +4 -2
- package/app/components/Viewer/Options/AttributeRangeSelector.vue +4 -2
- package/app/components/Viewer/Options/AttributeSelector.vue +7 -9
- package/app/components/Viewer/Options/ColorMapList.vue +15 -13
- package/app/components/Viewer/Options/ColorMapPicker.vue +4 -4
- package/app/components/Viewer/Options/ColorPicker.vue +223 -41
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +16 -16
- package/app/components/Viewer/Options/ColormapQuickPicker.vue +7 -5
- package/app/components/Viewer/Options/OptionsSection.vue +1 -1
- package/app/components/Viewer/Options/TextureItem.vue +8 -6
- package/app/components/Viewer/Options/TexturesSelector.vue +1 -1
- package/app/components/Viewer/OverlappingObjectsPicker.vue +8 -9
- package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +2 -6
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +12 -16
- package/app/components/Viewer/Surface/PolygonsOptions.vue +12 -16
- package/app/components/Viewer/Ui.vue +2 -2
- package/app/components/Wrapper.vue +1 -4
- package/app/components/ZScaling.vue +5 -3
- package/app/components/csv-preview/CsvPreviewer.vue +38 -37
- package/app/components/csv-preview/CsvSettings.vue +6 -4
- package/app/components/csv-preview/CsvTable.vue +1 -1
- package/app/composables/batch_style.ts +5 -6
- package/app/composables/clipping_planes_widget.ts +73 -181
- package/app/composables/clipping_planes_widget_entries.ts +189 -0
- package/app/composables/copy_to_clipboard.ts +7 -0
- package/app/composables/global_attribute_style.ts +163 -83
- package/app/composables/hover_highlight.ts +46 -14
- package/app/composables/model_collections.ts +26 -13
- package/app/composables/model_components.ts +26 -13
- package/app/composables/project_manager.ts +76 -19
- package/app/composables/responsive_middle_truncate.ts +13 -13
- package/app/composables/stepper_tree.ts +34 -11
- package/app/composables/tree_filter.ts +66 -44
- package/app/composables/tree_keyboard_nav.ts +25 -11
- package/app/composables/tree_scroll.ts +44 -14
- package/app/composables/use_adaptive_styles.ts +66 -23
- package/app/composables/use_overlapping_picker.ts +66 -16
- package/app/composables/use_quick_colormap.ts +16 -5
- package/app/composables/virtual_tree.ts +75 -43
- package/app/composables/vtk_implicit_plane_widget.d.ts +2 -0
- package/app/plugins/auto_store_register.ts +2 -7
- package/app/plugins/click_outside_ignore_snackbars.client.ts +39 -0
- package/app/stores/app.ts +57 -192
- package/app/stores/app_helpers/extension.ts +179 -0
- package/app/stores/back.ts +37 -21
- package/app/stores/camera_manager.ts +22 -20
- package/app/stores/cloud.ts +17 -13
- package/app/stores/data.ts +88 -47
- package/app/stores/data_helpers/collections.ts +36 -38
- package/app/stores/data_helpers/mesh.ts +45 -36
- package/app/stores/data_style.ts +50 -28
- package/app/stores/feedback.ts +6 -6
- package/app/stores/hybrid_viewer.ts +41 -52
- package/app/stores/infra.ts +39 -37
- package/app/stores/menu.ts +23 -14
- package/app/stores/treeview.ts +72 -42
- package/app/stores/viewer.ts +39 -27
- package/app/utils/attributes.ts +3 -3
- package/app/utils/clipping_planes.ts +111 -14
- package/app/utils/color_picker.ts +57 -0
- package/app/utils/colormap.ts +58 -35
- package/app/utils/default_styles/index.ts +2 -2
- package/app/utils/default_styles/meshes.ts +107 -13
- package/app/utils/default_styles/models.ts +83 -14
- package/app/utils/extension.ts +47 -20
- package/app/utils/import_workflow.ts +21 -13
- package/app/utils/name_cleaner.ts +1 -1
- package/app/utils/string.ts +1 -1
- package/app/utils/treeview.ts +2 -2
- package/internal/database/base_database.ts +7 -3
- package/internal/database/database.ts +36 -26
- package/internal/database/extended_database.ts +1 -1
- package/internal/stores/data_style/mesh/cells/cell.ts +70 -34
- package/internal/stores/data_style/mesh/cells/color.ts +12 -6
- package/internal/stores/data_style/mesh/cells/common.ts +18 -8
- package/internal/stores/data_style/mesh/cells/index.ts +122 -42
- package/internal/stores/data_style/mesh/cells/textures.ts +12 -6
- package/internal/stores/data_style/mesh/cells/vertex.ts +75 -34
- package/internal/stores/data_style/mesh/cells/visibility.ts +15 -4
- package/internal/stores/data_style/mesh/edges/color.ts +12 -6
- package/internal/stores/data_style/mesh/edges/common.ts +14 -6
- package/internal/stores/data_style/mesh/edges/edge.ts +71 -39
- package/internal/stores/data_style/mesh/edges/index.ts +117 -42
- package/internal/stores/data_style/mesh/edges/vertex.ts +76 -39
- package/internal/stores/data_style/mesh/edges/visibility.ts +15 -4
- package/internal/stores/data_style/mesh/edges/width.ts +12 -4
- package/internal/stores/data_style/mesh/index.ts +30 -11
- package/internal/stores/data_style/mesh/points/color.ts +12 -6
- package/internal/stores/data_style/mesh/points/common.ts +21 -8
- package/internal/stores/data_style/mesh/points/index.ts +101 -50
- package/internal/stores/data_style/mesh/points/size.ts +12 -4
- package/internal/stores/data_style/mesh/points/vertex.ts +75 -34
- package/internal/stores/data_style/mesh/points/visibility.ts +17 -7
- package/internal/stores/data_style/mesh/polygons/color.ts +12 -6
- package/internal/stores/data_style/mesh/polygons/common.ts +23 -6
- package/internal/stores/data_style/mesh/polygons/index.ts +130 -70
- package/internal/stores/data_style/mesh/polygons/polygon.ts +77 -43
- package/internal/stores/data_style/mesh/polygons/textures.ts +12 -6
- package/internal/stores/data_style/mesh/polygons/vertex.ts +79 -39
- package/internal/stores/data_style/mesh/polygons/visibility.ts +16 -6
- package/internal/stores/data_style/mesh/polyhedra/color.ts +12 -6
- package/internal/stores/data_style/mesh/polyhedra/common.ts +14 -6
- package/internal/stores/data_style/mesh/polyhedra/index.ts +115 -56
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +80 -39
- package/internal/stores/data_style/mesh/polyhedra/vertex.ts +79 -39
- package/internal/stores/data_style/mesh/polyhedra/visibility.ts +16 -6
- package/internal/stores/data_style/model/blocks/color.ts +43 -13
- package/internal/stores/data_style/model/blocks/common.ts +21 -6
- package/internal/stores/data_style/model/blocks/index.ts +89 -59
- package/internal/stores/data_style/model/blocks/polyhedron.ts +101 -44
- package/internal/stores/data_style/model/blocks/vertex.ts +107 -42
- package/internal/stores/data_style/model/blocks/visibility.ts +17 -4
- package/internal/stores/data_style/model/color.ts +171 -83
- package/internal/stores/data_style/model/common.ts +70 -21
- package/internal/stores/data_style/model/corners/color.ts +43 -11
- package/internal/stores/data_style/model/corners/common.ts +25 -6
- package/internal/stores/data_style/model/corners/index.ts +66 -41
- package/internal/stores/data_style/model/corners/vertex.ts +105 -74
- package/internal/stores/data_style/model/corners/visibility.ts +19 -4
- package/internal/stores/data_style/model/edges/common.ts +12 -4
- package/internal/stores/data_style/model/edges/index.ts +2 -1
- package/internal/stores/data_style/model/edges/visibility.ts +24 -7
- package/internal/stores/data_style/model/index.ts +24 -11
- package/internal/stores/data_style/model/lines/color.ts +41 -11
- package/internal/stores/data_style/model/lines/common.ts +17 -6
- package/internal/stores/data_style/model/lines/edge.ts +105 -42
- package/internal/stores/data_style/model/lines/index.ts +86 -59
- package/internal/stores/data_style/model/lines/vertex.ts +105 -42
- package/internal/stores/data_style/model/lines/visibility.ts +17 -4
- package/internal/stores/data_style/model/points/common.ts +8 -4
- package/internal/stores/data_style/model/points/index.ts +10 -3
- package/internal/stores/data_style/model/points/size.ts +12 -4
- package/internal/stores/data_style/model/points/visibility.ts +16 -6
- package/internal/stores/data_style/model/selection.ts +80 -58
- package/internal/stores/data_style/model/surfaces/color.ts +41 -11
- package/internal/stores/data_style/model/surfaces/common.ts +23 -6
- package/internal/stores/data_style/model/surfaces/index.ts +89 -59
- package/internal/stores/data_style/model/surfaces/polygon.ts +107 -67
- package/internal/stores/data_style/model/surfaces/vertex.ts +111 -67
- package/internal/stores/data_style/model/surfaces/visibility.ts +18 -5
- package/internal/stores/data_style/model/visibility.ts +82 -20
- package/internal/stores/data_style/state.ts +77 -65
- package/internal/stores/hybrid_viewer/brightness.ts +49 -31
- package/internal/stores/hybrid_viewer/camera.ts +191 -177
- package/internal/stores/hybrid_viewer/camera_animation.ts +11 -10
- package/internal/stores/hybrid_viewer/core.ts +64 -0
- package/internal/stores/hybrid_viewer/filters.ts +10 -16
- package/internal/stores/hybrid_viewer/highlight.ts +91 -130
- package/internal/stores/hybrid_viewer/ruler.ts +24 -15
- package/internal/stores/hybrid_viewer/scene.ts +96 -117
- package/internal/stores/hybrid_viewer/viewport.ts +74 -65
- package/internal/stores/hybrid_viewer/vtk_types.ts +13 -29
- package/internal/utils/api_fetch.ts +54 -23
- package/internal/utils/upload_file.ts +74 -53
- package/internal/utils/viewer_call.ts +22 -13
- package/internal/utils/ws_client.ts +24 -13
- package/nuxt.config.ts +58 -1
- package/package.json +20 -8
- package/server/api/cloud/extensions/run.post.ts +6 -10
- package/server/api/local/app/project_folder_path.post.ts +4 -4
- package/server/api/local/app/run_back.post.ts +5 -7
- package/server/api/local/app/run_viewer.post.ts +5 -7
- package/server/api/local/extensions/kill.post.ts +4 -3
- package/server/api/local/extensions/run.post.ts +7 -10
- package/server/api/local/extensions/upload.put.ts +44 -54
- package/server/api/microservice/app/get_is_app_ready.get.ts +4 -5
- package/server/api/microservice/app/set_app_base_url.post.ts +5 -6
- package/server/api/microservice/app/set_back_base_url.post.ts +5 -6
- package/server/api/microservice/app/set_is_app_ready.post.ts +5 -6
- package/server/api/microservice/app/set_viewer_base_url.post.ts +5 -6
- package/server/api/microservice/extensions/download.post.ts +5 -4
- package/server/api/serverless/run_cloud.post.ts +53 -11
- package/server/utils/app_config.ts +29 -22
- package/server/utils/cleanup.ts +60 -30
- package/server/utils/cloud.ts +9 -8
- package/server/utils/extension.ts +23 -9
- package/server/utils/microservices.ts +33 -24
- package/server/utils/path.ts +4 -4
- package/server/utils/scripts.ts +26 -23
- package/server/utils/server.ts +2 -2
- package/server/utils/server_config.ts +41 -27
- package/server/utils/stream.ts +6 -0
- package/server/utils/ws_client.ts +42 -8
- package/shared/scripts.ts +15 -10
- package/shared/utils/call_raw.ts +23 -16
- package/shared/utils/call_schema.ts +5 -8
- package/shared/utils/fetch_raw.ts +87 -47
- package/shared/utils/fetch_schema.ts +6 -9
- package/shared/utils/file.ts +8 -2
- package/shared/utils/response_handlers/load.ts +26 -11
- package/shared/utils/types.ts +9 -9
- package/shared/utils/validate_schema.ts +1 -1
- package/app/components/Viewer/ObjectTree/Views/ModelComponents.vue +0 -276
- package/server/types/vendor.d.ts +0 -64
- package/server/utils/server_config.js +0 -43
- package/shared/utils/call_raw.js +0 -30
- package/shared/utils/fetch_raw.js +0 -40
- /package/{opengeodeweb_front_schemas.js → .build/opengeodeweb_front_schemas.js} +0 -0
- /package/{server → .build/server}/utils/server.js +0 -0
- /package/{shared → .build/shared}/app_mode.js +0 -0
- /package/{shared → .build/shared}/utils/parse_boolean.js +0 -0
- /package/{shared → .build/shared}/utils/types.js +0 -0
|
@@ -9,87 +9,146 @@ import {
|
|
|
9
9
|
isMeshPolyhedraVertexAttributeValid,
|
|
10
10
|
useMeshPolyhedraVertexAttributeStyle,
|
|
11
11
|
} from "./vertex";
|
|
12
|
+
import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
|
|
12
13
|
import { useMeshPolyhedraColorStyle } from "./color";
|
|
13
14
|
import { useMeshPolyhedraCommonStyle } from "./common";
|
|
14
15
|
import { useMeshPolyhedraVisibilityStyle } from "./visibility";
|
|
15
16
|
|
|
16
17
|
// Local constants
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
interface MeshPolyhedraActiveColoringDeps {
|
|
20
|
+
readonly commonStyle: ReturnType<typeof useMeshPolyhedraCommonStyle>;
|
|
21
|
+
readonly colorStyle: ReturnType<typeof useMeshPolyhedraColorStyle>;
|
|
22
|
+
readonly vertexAttributeStyle: ReturnType<typeof useMeshPolyhedraVertexAttributeStyle>;
|
|
23
|
+
readonly polyhedronAttributeStyle: ReturnType<typeof useMeshPolyhedraPolyhedronAttributeStyle>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function handleMeshPolyhedraVertexColoring(
|
|
27
|
+
id: string,
|
|
28
|
+
vertexAttributeStyle: ReturnType<typeof useMeshPolyhedraVertexAttributeStyle>,
|
|
29
|
+
): Promise<unknown> | undefined {
|
|
30
|
+
const name = vertexAttributeStyle.meshPolyhedraVertexAttributeName(id);
|
|
31
|
+
const item = vertexAttributeStyle.meshPolyhedraVertexAttributeItem(id);
|
|
32
|
+
const [minimum, maximum] = vertexAttributeStyle.meshPolyhedraVertexAttributeRange(id);
|
|
33
|
+
const colorMap = vertexAttributeStyle.meshPolyhedraVertexAttributeColorMap(id);
|
|
34
|
+
const vertex_attribute = { name, item, minimum, maximum, colorMap };
|
|
35
|
+
if (!isMeshPolyhedraVertexAttributeValid(vertex_attribute)) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
return vertexAttributeStyle.setMeshPolyhedraVertexAttribute(id, vertex_attribute);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function handleMeshPolyhedraPolyhedronColoring(
|
|
42
|
+
id: string,
|
|
43
|
+
polyhedronAttributeStyle: ReturnType<typeof useMeshPolyhedraPolyhedronAttributeStyle>,
|
|
44
|
+
): Promise<unknown> | undefined {
|
|
45
|
+
const name = polyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeName(id);
|
|
46
|
+
const item = polyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeItem(id);
|
|
47
|
+
const [minimum, maximum] = polyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeRange(id);
|
|
48
|
+
const colorMap = polyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeColorMap(id);
|
|
49
|
+
const polyhedron_attribute = { name, item, minimum, maximum, colorMap };
|
|
50
|
+
if (!isMeshPolyhedraPolyhedronAttributeValid(polyhedron_attribute)) {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
return polyhedronAttributeStyle.setMeshPolyhedraPolyhedronAttribute(id, polyhedron_attribute);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function setMeshPolyhedraActiveColoring(
|
|
57
|
+
id: string,
|
|
58
|
+
type: string | undefined,
|
|
59
|
+
deps: MeshPolyhedraActiveColoringDeps,
|
|
60
|
+
): Promise<unknown> {
|
|
61
|
+
await deps.commonStyle.mutateMeshPolyhedraStyle(id, {
|
|
62
|
+
coloring: { active: type },
|
|
63
|
+
});
|
|
64
|
+
if (type === "constant") {
|
|
65
|
+
const result = await deps.colorStyle.setMeshPolyhedraColor(
|
|
66
|
+
id,
|
|
67
|
+
deps.colorStyle.meshPolyhedraColor(id),
|
|
68
|
+
);
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
if (type === "vertex") {
|
|
72
|
+
const result = await handleMeshPolyhedraVertexColoring(id, deps.vertexAttributeStyle);
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
if (type === "polyhedron") {
|
|
76
|
+
const result = await handleMeshPolyhedraPolyhedronColoring(id, deps.polyhedronAttributeStyle);
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
throw new Error(`Unknown mesh polyhedra coloring type: ${type}`);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async function applyMeshPolyhedraStyle(
|
|
83
|
+
id: string,
|
|
84
|
+
visibilityStyle: ReturnType<typeof useMeshPolyhedraVisibilityStyle>,
|
|
85
|
+
activeColoringType: string | undefined,
|
|
86
|
+
deps: MeshPolyhedraActiveColoringDeps,
|
|
87
|
+
): Promise<unknown[]> {
|
|
88
|
+
const result = await Promise.all([
|
|
89
|
+
visibilityStyle.setMeshPolyhedraVisibility(id, visibilityStyle.meshPolyhedraVisibility(id)),
|
|
90
|
+
setMeshPolyhedraActiveColoring(id, activeColoringType, deps),
|
|
91
|
+
]);
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
type UseMeshPolyhedraStyleReturn = ReturnType<typeof useMeshPolyhedraCommonStyle> & {
|
|
96
|
+
meshPolyhedraColoring: (id: string) => StyleValues;
|
|
97
|
+
meshPolyhedraActiveColoring: (id: string) => string | undefined;
|
|
98
|
+
setMeshPolyhedraActiveColoring: (id: string, type: string | undefined) => Promise<unknown>;
|
|
99
|
+
applyMeshPolyhedraStyle: (id: string) => Promise<unknown[]>;
|
|
100
|
+
} & ReturnType<typeof useMeshPolyhedraVisibilityStyle> &
|
|
101
|
+
ReturnType<typeof useMeshPolyhedraColorStyle> &
|
|
102
|
+
ReturnType<typeof useMeshPolyhedraVertexAttributeStyle> &
|
|
103
|
+
ReturnType<typeof useMeshPolyhedraPolyhedronAttributeStyle>;
|
|
104
|
+
|
|
105
|
+
export function useMeshPolyhedraStyle(): UseMeshPolyhedraStyleReturn {
|
|
19
106
|
const meshPolyhedraCommonStyle = useMeshPolyhedraCommonStyle();
|
|
20
107
|
const meshPolyhedraVisibility = useMeshPolyhedraVisibilityStyle();
|
|
21
108
|
const meshPolyhedraColorStyle = useMeshPolyhedraColorStyle();
|
|
109
|
+
const meshPolyhedraVertexAttributeStyle = useMeshPolyhedraVertexAttributeStyle();
|
|
110
|
+
const meshPolyhedraPolyhedronAttributeStyle = useMeshPolyhedraPolyhedronAttributeStyle();
|
|
111
|
+
|
|
112
|
+
const activeColoringDeps: MeshPolyhedraActiveColoringDeps = {
|
|
113
|
+
commonStyle: meshPolyhedraCommonStyle,
|
|
114
|
+
colorStyle: meshPolyhedraColorStyle,
|
|
115
|
+
vertexAttributeStyle: meshPolyhedraVertexAttributeStyle,
|
|
116
|
+
polyhedronAttributeStyle: meshPolyhedraPolyhedronAttributeStyle,
|
|
117
|
+
};
|
|
22
118
|
|
|
23
|
-
function meshPolyhedraColoring(id: string) {
|
|
119
|
+
function meshPolyhedraColoring(id: string): StyleValues {
|
|
24
120
|
return meshPolyhedraCommonStyle.meshPolyhedraColoring(id);
|
|
25
121
|
}
|
|
26
|
-
const meshPolyhedraVertexAttributeStyle = useMeshPolyhedraVertexAttributeStyle();
|
|
27
|
-
const meshPolyhedraPolyhedronAttributeStyle = useMeshPolyhedraPolyhedronAttributeStyle();
|
|
28
122
|
|
|
29
123
|
function meshPolyhedraActiveColoring(id: string): string | undefined {
|
|
124
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.active is defined as string in the data style schema.
|
|
30
125
|
return meshPolyhedraColoring(id).active as string | undefined;
|
|
31
126
|
}
|
|
32
127
|
|
|
33
|
-
async function
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
id,
|
|
40
|
-
meshPolyhedraColorStyle.meshPolyhedraColor(id),
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
if (type === "vertex") {
|
|
44
|
-
const name = meshPolyhedraVertexAttributeStyle.meshPolyhedraVertexAttributeName(id);
|
|
45
|
-
const item = meshPolyhedraVertexAttributeStyle.meshPolyhedraVertexAttributeItem(id);
|
|
46
|
-
const [minimum, maximum] =
|
|
47
|
-
meshPolyhedraVertexAttributeStyle.meshPolyhedraVertexAttributeRange(id);
|
|
48
|
-
const colorMap = meshPolyhedraVertexAttributeStyle.meshPolyhedraVertexAttributeColorMap(id);
|
|
49
|
-
const vertex_attribute = { name, item, minimum, maximum, colorMap };
|
|
50
|
-
if (!isMeshPolyhedraVertexAttributeValid(vertex_attribute)) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
return meshPolyhedraVertexAttributeStyle.setMeshPolyhedraVertexAttribute(
|
|
54
|
-
id,
|
|
55
|
-
vertex_attribute,
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
if (type === "polyhedron") {
|
|
59
|
-
const name = meshPolyhedraPolyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeName(id);
|
|
60
|
-
const item = meshPolyhedraPolyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeItem(id);
|
|
61
|
-
const [minimum, maximum] =
|
|
62
|
-
meshPolyhedraPolyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeRange(id);
|
|
63
|
-
const colorMap =
|
|
64
|
-
meshPolyhedraPolyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeColorMap(id);
|
|
65
|
-
const polyhedron_attribute = { name, item, minimum, maximum, colorMap };
|
|
66
|
-
if (!isMeshPolyhedraPolyhedronAttributeValid(polyhedron_attribute)) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
return meshPolyhedraPolyhedronAttributeStyle.setMeshPolyhedraPolyhedronAttribute(
|
|
70
|
-
id,
|
|
71
|
-
polyhedron_attribute,
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
throw new Error(`Unknown mesh polyhedra coloring type: ${type}`);
|
|
128
|
+
async function boundSetMeshPolyhedraActiveColoring(
|
|
129
|
+
id: string,
|
|
130
|
+
type: string | undefined,
|
|
131
|
+
): Promise<unknown> {
|
|
132
|
+
const result = await setMeshPolyhedraActiveColoring(id, type, activeColoringDeps);
|
|
133
|
+
return result;
|
|
75
134
|
}
|
|
76
135
|
|
|
77
|
-
function
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
136
|
+
async function boundApplyMeshPolyhedraStyle(id: string): Promise<unknown[]> {
|
|
137
|
+
const result = await applyMeshPolyhedraStyle(
|
|
138
|
+
id,
|
|
139
|
+
meshPolyhedraVisibility,
|
|
140
|
+
meshPolyhedraActiveColoring(id),
|
|
141
|
+
activeColoringDeps,
|
|
142
|
+
);
|
|
143
|
+
return result;
|
|
85
144
|
}
|
|
86
145
|
|
|
87
146
|
return {
|
|
88
147
|
...meshPolyhedraCommonStyle,
|
|
89
148
|
meshPolyhedraColoring,
|
|
90
149
|
meshPolyhedraActiveColoring,
|
|
91
|
-
setMeshPolyhedraActiveColoring,
|
|
92
|
-
applyMeshPolyhedraStyle,
|
|
150
|
+
setMeshPolyhedraActiveColoring: boundSetMeshPolyhedraActiveColoring,
|
|
151
|
+
applyMeshPolyhedraStyle: boundApplyMeshPolyhedraStyle,
|
|
93
152
|
...meshPolyhedraVisibility,
|
|
94
153
|
...meshPolyhedraColorStyle,
|
|
95
154
|
...meshPolyhedraVertexAttributeStyle,
|
|
@@ -3,7 +3,6 @@ import { DEFAULT_NO_DATA_COLOR } from "@ogw_front/utils/default_styles/constants
|
|
|
3
3
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
|
|
4
4
|
|
|
5
5
|
// Local imports
|
|
6
|
-
import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
|
|
7
6
|
import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
|
|
8
7
|
import { useMeshPolyhedraCommonStyle } from "./common";
|
|
9
8
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
@@ -51,14 +50,39 @@ function isMeshPolyhedraPolyhedronAttributeValid({
|
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
// oxlint-disable-next-line max-lines-per-function
|
|
54
|
-
function useMeshPolyhedraPolyhedronAttributeStyle() {
|
|
53
|
+
function useMeshPolyhedraPolyhedronAttributeStyle(): {
|
|
54
|
+
meshPolyhedraPolyhedronAttributeName: (id: string) => string | undefined;
|
|
55
|
+
meshPolyhedraPolyhedronAttributeItem: (id: string) => number;
|
|
56
|
+
meshPolyhedraPolyhedronAttributeRange: (id: string) => [number | undefined, number | undefined];
|
|
57
|
+
meshPolyhedraPolyhedronAttributeColorMap: (id: string) => string | undefined;
|
|
58
|
+
meshPolyhedraPolyhedronAttributeStoredConfig: (
|
|
59
|
+
id: string,
|
|
60
|
+
name: string | undefined,
|
|
61
|
+
item: number | undefined,
|
|
62
|
+
) => AttributeStoredConfig;
|
|
63
|
+
setMeshPolyhedraPolyhedronAttribute: (id: string, input: AttributeInput) => Promise<unknown>;
|
|
64
|
+
setMeshPolyhedraPolyhedronAttributeName: (id: string, name: string) => Promise<unknown>;
|
|
65
|
+
setMeshPolyhedraPolyhedronAttributeItem: (id: string, item: number) => Promise<unknown>;
|
|
66
|
+
setMeshPolyhedraPolyhedronAttributeRange: (
|
|
67
|
+
id: string,
|
|
68
|
+
minimum: number,
|
|
69
|
+
maximum: number,
|
|
70
|
+
) => Promise<unknown>;
|
|
71
|
+
setMeshPolyhedraPolyhedronAttributeColorMap: (
|
|
72
|
+
id: string,
|
|
73
|
+
colorMap: string | undefined,
|
|
74
|
+
) => Promise<unknown>;
|
|
75
|
+
meshPolyhedraPolyhedronAttributeNoDataColor: (id: string) => unknown;
|
|
76
|
+
setMeshPolyhedraPolyhedronAttributeNoDataColor: (
|
|
77
|
+
id: string,
|
|
78
|
+
no_data_color: unknown,
|
|
79
|
+
) => Promise<unknown>;
|
|
80
|
+
} {
|
|
55
81
|
const viewerStore = useViewerStore();
|
|
56
82
|
const meshPolyhedraCommonStyle = useMeshPolyhedraCommonStyle();
|
|
57
|
-
function meshPolyhedraColoring(id: string): StyleValues {
|
|
58
|
-
return meshPolyhedraCommonStyle.meshPolyhedraStyle(id).coloring as StyleValues;
|
|
59
|
-
}
|
|
60
83
|
function meshPolyhedraPolyhedronAttribute(id: string): AttributeState {
|
|
61
|
-
|
|
84
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.polyhedron shape is defined by the data style schema.
|
|
85
|
+
return meshPolyhedraCommonStyle.meshPolyhedraColoring(id).polyhedron as AttributeState;
|
|
62
86
|
}
|
|
63
87
|
function meshPolyhedraPolyhedronAttributeStoredConfig(
|
|
64
88
|
id: string,
|
|
@@ -66,14 +90,10 @@ function useMeshPolyhedraPolyhedronAttributeStyle() {
|
|
|
66
90
|
item: number | undefined,
|
|
67
91
|
): AttributeStoredConfig {
|
|
68
92
|
const { storedConfigs } = meshPolyhedraPolyhedronAttribute(id);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
item !== undefined &&
|
|
74
|
-
item in storedConfigs[name]!
|
|
75
|
-
) {
|
|
76
|
-
return storedConfigs[name]![item]!;
|
|
93
|
+
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
94
|
+
const itemConfig = item === undefined ? undefined : nameConfig?.[item];
|
|
95
|
+
if (itemConfig !== undefined) {
|
|
96
|
+
return itemConfig;
|
|
77
97
|
}
|
|
78
98
|
return {
|
|
79
99
|
minimum: undefined,
|
|
@@ -82,35 +102,41 @@ function useMeshPolyhedraPolyhedronAttributeStyle() {
|
|
|
82
102
|
no_data_color: DEFAULT_NO_DATA_COLOR,
|
|
83
103
|
};
|
|
84
104
|
}
|
|
85
|
-
function mutateMeshPolyhedraPolyhedronStyle(
|
|
86
|
-
|
|
105
|
+
async function mutateMeshPolyhedraPolyhedronStyle(
|
|
106
|
+
id: string,
|
|
107
|
+
values: Record<string, unknown>,
|
|
108
|
+
): Promise<string> {
|
|
109
|
+
const result = await meshPolyhedraCommonStyle.mutateMeshPolyhedraStyle(id, {
|
|
87
110
|
coloring: {
|
|
88
111
|
polyhedron: values,
|
|
89
112
|
},
|
|
90
113
|
});
|
|
114
|
+
return result;
|
|
91
115
|
}
|
|
92
|
-
function setMeshPolyhedraPolyhedronAttributeStoredConfig(
|
|
116
|
+
async function setMeshPolyhedraPolyhedronAttributeStoredConfig(
|
|
93
117
|
id: string,
|
|
94
118
|
name: string | undefined,
|
|
95
119
|
item: number | undefined,
|
|
96
120
|
config: Partial<AttributeStoredConfig>,
|
|
97
|
-
) {
|
|
98
|
-
|
|
121
|
+
): Promise<string> {
|
|
122
|
+
const result = await mutateMeshPolyhedraPolyhedronStyle(id, {
|
|
99
123
|
storedConfigs: {
|
|
100
|
-
[name
|
|
124
|
+
[name ?? ""]: {
|
|
101
125
|
lastItem: item,
|
|
102
|
-
[item
|
|
126
|
+
[item ?? 0]: config,
|
|
103
127
|
},
|
|
104
128
|
},
|
|
105
129
|
});
|
|
130
|
+
return result;
|
|
106
131
|
}
|
|
107
132
|
function meshPolyhedraPolyhedronAttributeName(id: string): string | undefined {
|
|
108
133
|
return meshPolyhedraPolyhedronAttribute(id).name;
|
|
109
134
|
}
|
|
110
135
|
function meshPolyhedraPolyhedronAttributeLastItem(id: string, name: string | undefined): number {
|
|
111
136
|
const { storedConfigs } = meshPolyhedraPolyhedronAttribute(id);
|
|
112
|
-
|
|
113
|
-
|
|
137
|
+
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
138
|
+
if (nameConfig !== undefined) {
|
|
139
|
+
return nameConfig.lastItem;
|
|
114
140
|
}
|
|
115
141
|
return 0;
|
|
116
142
|
}
|
|
@@ -118,7 +144,7 @@ function useMeshPolyhedraPolyhedronAttributeStyle() {
|
|
|
118
144
|
const { item, name } = meshPolyhedraPolyhedronAttribute(id);
|
|
119
145
|
return item ?? meshPolyhedraPolyhedronAttributeLastItem(id, name);
|
|
120
146
|
}
|
|
121
|
-
function setMeshPolyhedraPolyhedronAttribute(
|
|
147
|
+
async function setMeshPolyhedraPolyhedronAttribute(
|
|
122
148
|
id: string,
|
|
123
149
|
{
|
|
124
150
|
name,
|
|
@@ -128,18 +154,18 @@ function useMeshPolyhedraPolyhedronAttributeStyle() {
|
|
|
128
154
|
colorMap,
|
|
129
155
|
no_data_color = DEFAULT_NO_DATA_COLOR,
|
|
130
156
|
}: AttributeInput,
|
|
131
|
-
) {
|
|
132
|
-
mutateMeshPolyhedraPolyhedronStyle(id, {
|
|
157
|
+
): Promise<unknown> {
|
|
158
|
+
await mutateMeshPolyhedraPolyhedronStyle(id, {
|
|
133
159
|
name,
|
|
134
160
|
item,
|
|
135
161
|
});
|
|
136
|
-
setMeshPolyhedraPolyhedronAttributeStoredConfig(id, name, item, {
|
|
162
|
+
await setMeshPolyhedraPolyhedronAttributeStoredConfig(id, name, item, {
|
|
137
163
|
minimum,
|
|
138
164
|
maximum,
|
|
139
165
|
colorMap,
|
|
140
166
|
no_data_color,
|
|
141
167
|
});
|
|
142
|
-
const points = getRGBPointsFromPreset(colorMap
|
|
168
|
+
const points = getRGBPointsFromPreset(colorMap ?? "");
|
|
143
169
|
const schema = meshPolyhedraPolyhedronAttributeSchemas.attribute;
|
|
144
170
|
const params = {
|
|
145
171
|
id,
|
|
@@ -155,7 +181,7 @@ function useMeshPolyhedraPolyhedronAttributeStyle() {
|
|
|
155
181
|
params,
|
|
156
182
|
});
|
|
157
183
|
}
|
|
158
|
-
function applyPolyhedronAttribute(id: string) {
|
|
184
|
+
async function applyPolyhedronAttribute(id: string): Promise<unknown> {
|
|
159
185
|
const name = meshPolyhedraPolyhedronAttributeName(id);
|
|
160
186
|
const item = meshPolyhedraPolyhedronAttributeItem(id);
|
|
161
187
|
const storedConfig = meshPolyhedraPolyhedronAttributeStoredConfig(id, name, item);
|
|
@@ -168,19 +194,27 @@ function useMeshPolyhedraPolyhedronAttributeStyle() {
|
|
|
168
194
|
no_data_color: storedConfig.no_data_color,
|
|
169
195
|
};
|
|
170
196
|
if (isMeshPolyhedraPolyhedronAttributeValid(attribute)) {
|
|
171
|
-
|
|
197
|
+
const result = await setMeshPolyhedraPolyhedronAttribute(id, attribute);
|
|
198
|
+
return result;
|
|
172
199
|
}
|
|
200
|
+
return undefined;
|
|
173
201
|
}
|
|
174
|
-
function setMeshPolyhedraPolyhedronAttributeName(
|
|
202
|
+
async function setMeshPolyhedraPolyhedronAttributeName(
|
|
203
|
+
id: string,
|
|
204
|
+
name: string,
|
|
205
|
+
): Promise<unknown> {
|
|
175
206
|
const item = meshPolyhedraPolyhedronAttributeLastItem(id, name);
|
|
176
|
-
mutateMeshPolyhedraPolyhedronStyle(id, {
|
|
207
|
+
await mutateMeshPolyhedraPolyhedronStyle(id, {
|
|
177
208
|
name,
|
|
178
209
|
item,
|
|
179
210
|
});
|
|
180
211
|
return applyPolyhedronAttribute(id);
|
|
181
212
|
}
|
|
182
|
-
function setMeshPolyhedraPolyhedronAttributeItem(
|
|
183
|
-
|
|
213
|
+
async function setMeshPolyhedraPolyhedronAttributeItem(
|
|
214
|
+
id: string,
|
|
215
|
+
item: number,
|
|
216
|
+
): Promise<unknown> {
|
|
217
|
+
await mutateMeshPolyhedraPolyhedronStyle(id, {
|
|
184
218
|
item,
|
|
185
219
|
});
|
|
186
220
|
return applyPolyhedronAttribute(id);
|
|
@@ -193,10 +227,14 @@ function useMeshPolyhedraPolyhedronAttributeStyle() {
|
|
|
193
227
|
const storedConfig = meshPolyhedraPolyhedronAttributeStoredConfig(id, name, item);
|
|
194
228
|
return [storedConfig.minimum, storedConfig.maximum];
|
|
195
229
|
}
|
|
196
|
-
function setMeshPolyhedraPolyhedronAttributeRange(
|
|
230
|
+
async function setMeshPolyhedraPolyhedronAttributeRange(
|
|
231
|
+
id: string,
|
|
232
|
+
minimum: number,
|
|
233
|
+
maximum: number,
|
|
234
|
+
): Promise<unknown> {
|
|
197
235
|
const name = meshPolyhedraPolyhedronAttributeName(id);
|
|
198
236
|
const item = meshPolyhedraPolyhedronAttributeItem(id);
|
|
199
|
-
setMeshPolyhedraPolyhedronAttributeStoredConfig(id, name, item, {
|
|
237
|
+
await setMeshPolyhedraPolyhedronAttributeStoredConfig(id, name, item, {
|
|
200
238
|
minimum,
|
|
201
239
|
maximum,
|
|
202
240
|
});
|
|
@@ -208,10 +246,13 @@ function useMeshPolyhedraPolyhedronAttributeStyle() {
|
|
|
208
246
|
const storedConfig = meshPolyhedraPolyhedronAttributeStoredConfig(id, name, item);
|
|
209
247
|
return storedConfig.colorMap;
|
|
210
248
|
}
|
|
211
|
-
function setMeshPolyhedraPolyhedronAttributeColorMap(
|
|
249
|
+
async function setMeshPolyhedraPolyhedronAttributeColorMap(
|
|
250
|
+
id: string,
|
|
251
|
+
colorMap: string | undefined,
|
|
252
|
+
): Promise<unknown> {
|
|
212
253
|
const name = meshPolyhedraPolyhedronAttributeName(id);
|
|
213
254
|
const item = meshPolyhedraPolyhedronAttributeItem(id);
|
|
214
|
-
setMeshPolyhedraPolyhedronAttributeStoredConfig(id, name, item, {
|
|
255
|
+
await setMeshPolyhedraPolyhedronAttributeStoredConfig(id, name, item, {
|
|
215
256
|
colorMap,
|
|
216
257
|
});
|
|
217
258
|
return applyPolyhedronAttribute(id);
|
|
@@ -225,7 +266,7 @@ function useMeshPolyhedraPolyhedronAttributeStyle() {
|
|
|
225
266
|
async function setMeshPolyhedraPolyhedronAttributeNoDataColor(
|
|
226
267
|
id: string,
|
|
227
268
|
no_data_color: unknown,
|
|
228
|
-
) {
|
|
269
|
+
): Promise<unknown> {
|
|
229
270
|
const name = meshPolyhedraPolyhedronAttributeName(id);
|
|
230
271
|
const item = meshPolyhedraPolyhedronAttributeItem(id);
|
|
231
272
|
const storedConfig = meshPolyhedraPolyhedronAttributeStoredConfig(id, name, item);
|
|
@@ -3,7 +3,6 @@ import { DEFAULT_NO_DATA_COLOR } from "@ogw_front/utils/default_styles/constants
|
|
|
3
3
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
|
|
4
4
|
|
|
5
5
|
// Local imports
|
|
6
|
-
import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
|
|
7
6
|
import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
|
|
8
7
|
import { useMeshPolyhedraCommonStyle } from "./common";
|
|
9
8
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
@@ -50,15 +49,42 @@ function isMeshPolyhedraVertexAttributeValid({
|
|
|
50
49
|
);
|
|
51
50
|
}
|
|
52
51
|
|
|
52
|
+
interface UseMeshPolyhedraVertexAttributeStyleReturn {
|
|
53
|
+
meshPolyhedraVertexAttributeName: (id: string) => string | undefined;
|
|
54
|
+
meshPolyhedraVertexAttributeItem: (id: string) => number;
|
|
55
|
+
meshPolyhedraVertexAttributeRange: (id: string) => [number | undefined, number | undefined];
|
|
56
|
+
meshPolyhedraVertexAttributeColorMap: (id: string) => string | undefined;
|
|
57
|
+
meshPolyhedraVertexAttributeStoredConfig: (
|
|
58
|
+
id: string,
|
|
59
|
+
name: string | undefined,
|
|
60
|
+
item: number | undefined,
|
|
61
|
+
) => AttributeStoredConfig;
|
|
62
|
+
setMeshPolyhedraVertexAttribute: (id: string, input: AttributeInput) => Promise<unknown>;
|
|
63
|
+
setMeshPolyhedraVertexAttributeName: (id: string, name: string) => Promise<unknown>;
|
|
64
|
+
setMeshPolyhedraVertexAttributeItem: (id: string, item: number) => Promise<unknown>;
|
|
65
|
+
setMeshPolyhedraVertexAttributeRange: (
|
|
66
|
+
id: string,
|
|
67
|
+
minimum: number,
|
|
68
|
+
maximum: number,
|
|
69
|
+
) => Promise<unknown>;
|
|
70
|
+
setMeshPolyhedraVertexAttributeColorMap: (
|
|
71
|
+
id: string,
|
|
72
|
+
colorMap: string | undefined,
|
|
73
|
+
) => Promise<unknown>;
|
|
74
|
+
meshPolyhedraVertexAttributeNoDataColor: (id: string) => unknown;
|
|
75
|
+
setMeshPolyhedraVertexAttributeNoDataColor: (
|
|
76
|
+
id: string,
|
|
77
|
+
no_data_color: unknown,
|
|
78
|
+
) => Promise<unknown>;
|
|
79
|
+
}
|
|
80
|
+
|
|
53
81
|
// oxlint-disable-next-line max-lines-per-function
|
|
54
|
-
function useMeshPolyhedraVertexAttributeStyle() {
|
|
82
|
+
function useMeshPolyhedraVertexAttributeStyle(): UseMeshPolyhedraVertexAttributeStyleReturn {
|
|
55
83
|
const viewerStore = useViewerStore();
|
|
56
84
|
const meshPolyhedraCommonStyle = useMeshPolyhedraCommonStyle();
|
|
57
|
-
function meshPolyhedraColoring(id: string): StyleValues {
|
|
58
|
-
return meshPolyhedraCommonStyle.meshPolyhedraStyle(id).coloring as StyleValues;
|
|
59
|
-
}
|
|
60
85
|
function meshPolyhedraVertexAttribute(id: string): AttributeState {
|
|
61
|
-
|
|
86
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.vertex shape is defined by the data style schema.
|
|
87
|
+
return meshPolyhedraCommonStyle.meshPolyhedraColoring(id).vertex as AttributeState;
|
|
62
88
|
}
|
|
63
89
|
function meshPolyhedraVertexAttributeStoredConfig(
|
|
64
90
|
id: string,
|
|
@@ -66,14 +92,10 @@ function useMeshPolyhedraVertexAttributeStyle() {
|
|
|
66
92
|
item: number | undefined,
|
|
67
93
|
): AttributeStoredConfig {
|
|
68
94
|
const { storedConfigs } = meshPolyhedraVertexAttribute(id);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
item !== undefined &&
|
|
74
|
-
item in storedConfigs[name]!
|
|
75
|
-
) {
|
|
76
|
-
return storedConfigs[name]![item]!;
|
|
95
|
+
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
96
|
+
const itemConfig = item === undefined ? undefined : nameConfig?.[item];
|
|
97
|
+
if (itemConfig !== undefined) {
|
|
98
|
+
return itemConfig;
|
|
77
99
|
}
|
|
78
100
|
return {
|
|
79
101
|
minimum: undefined,
|
|
@@ -82,35 +104,41 @@ function useMeshPolyhedraVertexAttributeStyle() {
|
|
|
82
104
|
no_data_color: DEFAULT_NO_DATA_COLOR,
|
|
83
105
|
};
|
|
84
106
|
}
|
|
85
|
-
function mutateMeshPolyhedraVertexStyle(
|
|
86
|
-
|
|
107
|
+
async function mutateMeshPolyhedraVertexStyle(
|
|
108
|
+
id: string,
|
|
109
|
+
values: Record<string, unknown>,
|
|
110
|
+
): Promise<string> {
|
|
111
|
+
const result = await meshPolyhedraCommonStyle.mutateMeshPolyhedraStyle(id, {
|
|
87
112
|
coloring: {
|
|
88
113
|
vertex: values,
|
|
89
114
|
},
|
|
90
115
|
});
|
|
116
|
+
return result;
|
|
91
117
|
}
|
|
92
|
-
function setMeshPolyhedraVertexAttributeStoredConfig(
|
|
118
|
+
async function setMeshPolyhedraVertexAttributeStoredConfig(
|
|
93
119
|
id: string,
|
|
94
120
|
name: string | undefined,
|
|
95
121
|
item: number | undefined,
|
|
96
122
|
config: Partial<AttributeStoredConfig>,
|
|
97
|
-
) {
|
|
98
|
-
|
|
123
|
+
): Promise<string> {
|
|
124
|
+
const result = await mutateMeshPolyhedraVertexStyle(id, {
|
|
99
125
|
storedConfigs: {
|
|
100
|
-
[name
|
|
126
|
+
[name ?? ""]: {
|
|
101
127
|
lastItem: item,
|
|
102
|
-
[item
|
|
128
|
+
[item ?? 0]: config,
|
|
103
129
|
},
|
|
104
130
|
},
|
|
105
131
|
});
|
|
132
|
+
return result;
|
|
106
133
|
}
|
|
107
134
|
function meshPolyhedraVertexAttributeName(id: string): string | undefined {
|
|
108
135
|
return meshPolyhedraVertexAttribute(id).name;
|
|
109
136
|
}
|
|
110
137
|
function meshPolyhedraVertexAttributeLastItem(id: string, name: string | undefined): number {
|
|
111
138
|
const { storedConfigs } = meshPolyhedraVertexAttribute(id);
|
|
112
|
-
|
|
113
|
-
|
|
139
|
+
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
140
|
+
if (nameConfig !== undefined) {
|
|
141
|
+
return nameConfig.lastItem;
|
|
114
142
|
}
|
|
115
143
|
return 0;
|
|
116
144
|
}
|
|
@@ -118,7 +146,7 @@ function useMeshPolyhedraVertexAttributeStyle() {
|
|
|
118
146
|
const { item, name } = meshPolyhedraVertexAttribute(id);
|
|
119
147
|
return item ?? meshPolyhedraVertexAttributeLastItem(id, name);
|
|
120
148
|
}
|
|
121
|
-
function setMeshPolyhedraVertexAttribute(
|
|
149
|
+
async function setMeshPolyhedraVertexAttribute(
|
|
122
150
|
id: string,
|
|
123
151
|
{
|
|
124
152
|
name,
|
|
@@ -128,18 +156,18 @@ function useMeshPolyhedraVertexAttributeStyle() {
|
|
|
128
156
|
colorMap,
|
|
129
157
|
no_data_color = DEFAULT_NO_DATA_COLOR,
|
|
130
158
|
}: AttributeInput,
|
|
131
|
-
) {
|
|
132
|
-
mutateMeshPolyhedraVertexStyle(id, {
|
|
159
|
+
): Promise<unknown> {
|
|
160
|
+
await mutateMeshPolyhedraVertexStyle(id, {
|
|
133
161
|
name,
|
|
134
162
|
item,
|
|
135
163
|
});
|
|
136
|
-
setMeshPolyhedraVertexAttributeStoredConfig(id, name, item, {
|
|
164
|
+
await setMeshPolyhedraVertexAttributeStoredConfig(id, name, item, {
|
|
137
165
|
minimum,
|
|
138
166
|
maximum,
|
|
139
167
|
colorMap,
|
|
140
168
|
no_data_color,
|
|
141
169
|
});
|
|
142
|
-
const points = getRGBPointsFromPreset(colorMap
|
|
170
|
+
const points = getRGBPointsFromPreset(colorMap ?? "");
|
|
143
171
|
const schema = meshPolyhedraVertexAttributeSchemas.attribute;
|
|
144
172
|
const params = {
|
|
145
173
|
id,
|
|
@@ -155,7 +183,7 @@ function useMeshPolyhedraVertexAttributeStyle() {
|
|
|
155
183
|
params,
|
|
156
184
|
});
|
|
157
185
|
}
|
|
158
|
-
function applyVertexAttribute(id: string) {
|
|
186
|
+
async function applyVertexAttribute(id: string): Promise<unknown> {
|
|
159
187
|
const name = meshPolyhedraVertexAttributeName(id);
|
|
160
188
|
const item = meshPolyhedraVertexAttributeItem(id);
|
|
161
189
|
const storedConfig = meshPolyhedraVertexAttributeStoredConfig(id, name, item);
|
|
@@ -168,19 +196,21 @@ function useMeshPolyhedraVertexAttributeStyle() {
|
|
|
168
196
|
no_data_color: storedConfig.no_data_color,
|
|
169
197
|
};
|
|
170
198
|
if (isMeshPolyhedraVertexAttributeValid(attribute)) {
|
|
171
|
-
|
|
199
|
+
const result = await setMeshPolyhedraVertexAttribute(id, attribute);
|
|
200
|
+
return result;
|
|
172
201
|
}
|
|
202
|
+
return undefined;
|
|
173
203
|
}
|
|
174
|
-
function setMeshPolyhedraVertexAttributeName(id: string, name: string) {
|
|
204
|
+
async function setMeshPolyhedraVertexAttributeName(id: string, name: string): Promise<unknown> {
|
|
175
205
|
const item = meshPolyhedraVertexAttributeLastItem(id, name);
|
|
176
|
-
mutateMeshPolyhedraVertexStyle(id, {
|
|
206
|
+
await mutateMeshPolyhedraVertexStyle(id, {
|
|
177
207
|
name,
|
|
178
208
|
item,
|
|
179
209
|
});
|
|
180
210
|
return applyVertexAttribute(id);
|
|
181
211
|
}
|
|
182
|
-
function setMeshPolyhedraVertexAttributeItem(id: string, item: number) {
|
|
183
|
-
mutateMeshPolyhedraVertexStyle(id, {
|
|
212
|
+
async function setMeshPolyhedraVertexAttributeItem(id: string, item: number): Promise<unknown> {
|
|
213
|
+
await mutateMeshPolyhedraVertexStyle(id, {
|
|
184
214
|
item,
|
|
185
215
|
});
|
|
186
216
|
return applyVertexAttribute(id);
|
|
@@ -191,10 +221,14 @@ function useMeshPolyhedraVertexAttributeStyle() {
|
|
|
191
221
|
const storedConfig = meshPolyhedraVertexAttributeStoredConfig(id, name, item);
|
|
192
222
|
return [storedConfig.minimum, storedConfig.maximum];
|
|
193
223
|
}
|
|
194
|
-
function setMeshPolyhedraVertexAttributeRange(
|
|
224
|
+
async function setMeshPolyhedraVertexAttributeRange(
|
|
225
|
+
id: string,
|
|
226
|
+
minimum: number,
|
|
227
|
+
maximum: number,
|
|
228
|
+
): Promise<unknown> {
|
|
195
229
|
const name = meshPolyhedraVertexAttributeName(id);
|
|
196
230
|
const item = meshPolyhedraVertexAttributeItem(id);
|
|
197
|
-
setMeshPolyhedraVertexAttributeStoredConfig(id, name, item, {
|
|
231
|
+
await setMeshPolyhedraVertexAttributeStoredConfig(id, name, item, {
|
|
198
232
|
minimum,
|
|
199
233
|
maximum,
|
|
200
234
|
});
|
|
@@ -206,10 +240,13 @@ function useMeshPolyhedraVertexAttributeStyle() {
|
|
|
206
240
|
const storedConfig = meshPolyhedraVertexAttributeStoredConfig(id, name, item);
|
|
207
241
|
return storedConfig.colorMap;
|
|
208
242
|
}
|
|
209
|
-
function setMeshPolyhedraVertexAttributeColorMap(
|
|
243
|
+
async function setMeshPolyhedraVertexAttributeColorMap(
|
|
244
|
+
id: string,
|
|
245
|
+
colorMap: string | undefined,
|
|
246
|
+
): Promise<unknown> {
|
|
210
247
|
const name = meshPolyhedraVertexAttributeName(id);
|
|
211
248
|
const item = meshPolyhedraVertexAttributeItem(id);
|
|
212
|
-
setMeshPolyhedraVertexAttributeStoredConfig(id, name, item, {
|
|
249
|
+
await setMeshPolyhedraVertexAttributeStoredConfig(id, name, item, {
|
|
213
250
|
colorMap,
|
|
214
251
|
});
|
|
215
252
|
return applyVertexAttribute(id);
|
|
@@ -220,7 +257,10 @@ function useMeshPolyhedraVertexAttributeStyle() {
|
|
|
220
257
|
const storedConfig = meshPolyhedraVertexAttributeStoredConfig(id, name, item);
|
|
221
258
|
return storedConfig.no_data_color;
|
|
222
259
|
}
|
|
223
|
-
async function setMeshPolyhedraVertexAttributeNoDataColor(
|
|
260
|
+
async function setMeshPolyhedraVertexAttributeNoDataColor(
|
|
261
|
+
id: string,
|
|
262
|
+
no_data_color: unknown,
|
|
263
|
+
): Promise<unknown> {
|
|
224
264
|
const name = meshPolyhedraVertexAttributeName(id);
|
|
225
265
|
const item = meshPolyhedraVertexAttributeItem(id);
|
|
226
266
|
const storedConfig = meshPolyhedraVertexAttributeStoredConfig(id, name, item);
|