@geode/opengeodeweb-front 10.34.0-rc.8 → 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
|
@@ -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 { useMeshEdgesCommonStyle } from "./common";
|
|
9
8
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
@@ -50,14 +49,33 @@ function isMeshEdgesEdgeAttributeValid({
|
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
// oxlint-disable-next-line max-lines-per-function
|
|
53
|
-
function useMeshEdgesEdgeAttributeStyle() {
|
|
52
|
+
function useMeshEdgesEdgeAttributeStyle(): {
|
|
53
|
+
meshEdgesEdgeAttributeName: (id: string) => string | undefined;
|
|
54
|
+
meshEdgesEdgeAttributeItem: (id: string) => number;
|
|
55
|
+
meshEdgesEdgeAttributeRange: (id: string) => [number | undefined, number | undefined];
|
|
56
|
+
meshEdgesEdgeAttributeColorMap: (id: string) => string | undefined;
|
|
57
|
+
meshEdgesEdgeAttributeStoredConfig: (
|
|
58
|
+
id: string,
|
|
59
|
+
name: string | undefined,
|
|
60
|
+
item: number | undefined,
|
|
61
|
+
) => AttributeStoredConfig;
|
|
62
|
+
setMeshEdgesEdgeAttribute: (id: string, input: AttributeInput) => Promise<unknown>;
|
|
63
|
+
setMeshEdgesEdgeAttributeName: (id: string, name: string) => Promise<unknown>;
|
|
64
|
+
setMeshEdgesEdgeAttributeItem: (id: string, item: number) => Promise<unknown>;
|
|
65
|
+
setMeshEdgesEdgeAttributeRange: (
|
|
66
|
+
id: string,
|
|
67
|
+
minimum: number,
|
|
68
|
+
maximum: number,
|
|
69
|
+
) => Promise<unknown>;
|
|
70
|
+
setMeshEdgesEdgeAttributeColorMap: (id: string, colorMap: string | undefined) => Promise<unknown>;
|
|
71
|
+
meshEdgesEdgeAttributeNoDataColor: (id: string) => unknown;
|
|
72
|
+
setMeshEdgesEdgeAttributeNoDataColor: (id: string, no_data_color: unknown) => Promise<unknown>;
|
|
73
|
+
} {
|
|
54
74
|
const viewerStore = useViewerStore();
|
|
55
75
|
const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
|
|
56
|
-
function meshEdgesColoring(id: string): StyleValues {
|
|
57
|
-
return meshEdgesCommonStyle.meshEdgesStyle(id).coloring as StyleValues;
|
|
58
|
-
}
|
|
59
76
|
function meshEdgesEdgeAttribute(id: string): AttributeState {
|
|
60
|
-
|
|
77
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.edge shape is defined by the data style schema.
|
|
78
|
+
return meshEdgesCommonStyle.meshEdgesColoring(id).edge as AttributeState;
|
|
61
79
|
}
|
|
62
80
|
function meshEdgesEdgeAttributeStoredConfig(
|
|
63
81
|
id: string,
|
|
@@ -65,14 +83,10 @@ function useMeshEdgesEdgeAttributeStyle() {
|
|
|
65
83
|
item: number | undefined,
|
|
66
84
|
): AttributeStoredConfig {
|
|
67
85
|
const { storedConfigs } = meshEdgesEdgeAttribute(id);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
item !== undefined &&
|
|
73
|
-
item in storedConfigs[name]!
|
|
74
|
-
) {
|
|
75
|
-
return storedConfigs[name]![item]!;
|
|
86
|
+
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
87
|
+
const itemConfig = item === undefined ? undefined : nameConfig?.[item];
|
|
88
|
+
if (itemConfig !== undefined) {
|
|
89
|
+
return itemConfig;
|
|
76
90
|
}
|
|
77
91
|
return {
|
|
78
92
|
minimum: undefined,
|
|
@@ -81,35 +95,41 @@ function useMeshEdgesEdgeAttributeStyle() {
|
|
|
81
95
|
no_data_color: DEFAULT_NO_DATA_COLOR,
|
|
82
96
|
};
|
|
83
97
|
}
|
|
84
|
-
function mutateMeshEdgesEdgeStyle(
|
|
85
|
-
|
|
98
|
+
async function mutateMeshEdgesEdgeStyle(
|
|
99
|
+
id: string,
|
|
100
|
+
values: Record<string, unknown>,
|
|
101
|
+
): Promise<string> {
|
|
102
|
+
const result = await meshEdgesCommonStyle.mutateMeshEdgesStyle(id, {
|
|
86
103
|
coloring: {
|
|
87
104
|
edge: values,
|
|
88
105
|
},
|
|
89
106
|
});
|
|
107
|
+
return result;
|
|
90
108
|
}
|
|
91
|
-
function setMeshEdgesEdgeAttributeStoredConfig(
|
|
109
|
+
async function setMeshEdgesEdgeAttributeStoredConfig(
|
|
92
110
|
id: string,
|
|
93
111
|
name: string | undefined,
|
|
94
112
|
item: number | undefined,
|
|
95
113
|
config: Partial<AttributeStoredConfig>,
|
|
96
|
-
) {
|
|
97
|
-
|
|
114
|
+
): Promise<string> {
|
|
115
|
+
const result = await mutateMeshEdgesEdgeStyle(id, {
|
|
98
116
|
storedConfigs: {
|
|
99
|
-
[name
|
|
117
|
+
[name ?? ""]: {
|
|
100
118
|
lastItem: item,
|
|
101
|
-
[item
|
|
119
|
+
[item ?? 0]: config,
|
|
102
120
|
},
|
|
103
121
|
},
|
|
104
122
|
});
|
|
123
|
+
return result;
|
|
105
124
|
}
|
|
106
125
|
function meshEdgesEdgeAttributeName(id: string): string | undefined {
|
|
107
126
|
return meshEdgesEdgeAttribute(id).name;
|
|
108
127
|
}
|
|
109
128
|
function meshEdgesEdgeAttributeLastItem(id: string, name: string | undefined): number {
|
|
110
129
|
const { storedConfigs } = meshEdgesEdgeAttribute(id);
|
|
111
|
-
|
|
112
|
-
|
|
130
|
+
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
131
|
+
if (nameConfig !== undefined) {
|
|
132
|
+
return nameConfig.lastItem;
|
|
113
133
|
}
|
|
114
134
|
return 0;
|
|
115
135
|
}
|
|
@@ -117,7 +137,7 @@ function useMeshEdgesEdgeAttributeStyle() {
|
|
|
117
137
|
const { item, name } = meshEdgesEdgeAttribute(id);
|
|
118
138
|
return item ?? meshEdgesEdgeAttributeLastItem(id, name);
|
|
119
139
|
}
|
|
120
|
-
function setMeshEdgesEdgeAttribute(
|
|
140
|
+
async function setMeshEdgesEdgeAttribute(
|
|
121
141
|
id: string,
|
|
122
142
|
{
|
|
123
143
|
name,
|
|
@@ -127,18 +147,18 @@ function useMeshEdgesEdgeAttributeStyle() {
|
|
|
127
147
|
colorMap,
|
|
128
148
|
no_data_color = DEFAULT_NO_DATA_COLOR,
|
|
129
149
|
}: AttributeInput,
|
|
130
|
-
) {
|
|
131
|
-
mutateMeshEdgesEdgeStyle(id, {
|
|
150
|
+
): Promise<unknown> {
|
|
151
|
+
await mutateMeshEdgesEdgeStyle(id, {
|
|
132
152
|
name,
|
|
133
153
|
item,
|
|
134
154
|
});
|
|
135
|
-
setMeshEdgesEdgeAttributeStoredConfig(id, name, item, {
|
|
155
|
+
await setMeshEdgesEdgeAttributeStoredConfig(id, name, item, {
|
|
136
156
|
minimum,
|
|
137
157
|
maximum,
|
|
138
158
|
colorMap,
|
|
139
159
|
no_data_color,
|
|
140
160
|
});
|
|
141
|
-
const points = getRGBPointsFromPreset(colorMap
|
|
161
|
+
const points = getRGBPointsFromPreset(colorMap ?? "");
|
|
142
162
|
const schema = meshEdgesEdgeAttributeSchemas.attribute;
|
|
143
163
|
const params = {
|
|
144
164
|
id,
|
|
@@ -154,7 +174,7 @@ function useMeshEdgesEdgeAttributeStyle() {
|
|
|
154
174
|
params,
|
|
155
175
|
});
|
|
156
176
|
}
|
|
157
|
-
function applyEdgeAttribute(id: string) {
|
|
177
|
+
async function applyEdgeAttribute(id: string): Promise<unknown> {
|
|
158
178
|
const name = meshEdgesEdgeAttributeName(id);
|
|
159
179
|
const item = meshEdgesEdgeAttributeItem(id);
|
|
160
180
|
const storedConfig = meshEdgesEdgeAttributeStoredConfig(id, name, item);
|
|
@@ -167,19 +187,21 @@ function useMeshEdgesEdgeAttributeStyle() {
|
|
|
167
187
|
no_data_color: storedConfig.no_data_color,
|
|
168
188
|
};
|
|
169
189
|
if (isMeshEdgesEdgeAttributeValid(attribute)) {
|
|
170
|
-
|
|
190
|
+
const result = await setMeshEdgesEdgeAttribute(id, attribute);
|
|
191
|
+
return result;
|
|
171
192
|
}
|
|
193
|
+
return undefined;
|
|
172
194
|
}
|
|
173
|
-
function setMeshEdgesEdgeAttributeName(id: string, name: string) {
|
|
195
|
+
async function setMeshEdgesEdgeAttributeName(id: string, name: string): Promise<unknown> {
|
|
174
196
|
const item = meshEdgesEdgeAttributeLastItem(id, name);
|
|
175
|
-
mutateMeshEdgesEdgeStyle(id, {
|
|
197
|
+
await mutateMeshEdgesEdgeStyle(id, {
|
|
176
198
|
name,
|
|
177
199
|
item,
|
|
178
200
|
});
|
|
179
201
|
return applyEdgeAttribute(id);
|
|
180
202
|
}
|
|
181
|
-
function setMeshEdgesEdgeAttributeItem(id: string, item: number) {
|
|
182
|
-
mutateMeshEdgesEdgeStyle(id, {
|
|
203
|
+
async function setMeshEdgesEdgeAttributeItem(id: string, item: number): Promise<unknown> {
|
|
204
|
+
await mutateMeshEdgesEdgeStyle(id, {
|
|
183
205
|
item,
|
|
184
206
|
});
|
|
185
207
|
return applyEdgeAttribute(id);
|
|
@@ -190,10 +212,14 @@ function useMeshEdgesEdgeAttributeStyle() {
|
|
|
190
212
|
const storedConfig = meshEdgesEdgeAttributeStoredConfig(id, name, item);
|
|
191
213
|
return [storedConfig.minimum, storedConfig.maximum];
|
|
192
214
|
}
|
|
193
|
-
function setMeshEdgesEdgeAttributeRange(
|
|
215
|
+
async function setMeshEdgesEdgeAttributeRange(
|
|
216
|
+
id: string,
|
|
217
|
+
minimum: number,
|
|
218
|
+
maximum: number,
|
|
219
|
+
): Promise<unknown> {
|
|
194
220
|
const name = meshEdgesEdgeAttributeName(id);
|
|
195
221
|
const item = meshEdgesEdgeAttributeItem(id);
|
|
196
|
-
setMeshEdgesEdgeAttributeStoredConfig(id, name, item, {
|
|
222
|
+
await setMeshEdgesEdgeAttributeStoredConfig(id, name, item, {
|
|
197
223
|
minimum,
|
|
198
224
|
maximum,
|
|
199
225
|
});
|
|
@@ -205,10 +231,13 @@ function useMeshEdgesEdgeAttributeStyle() {
|
|
|
205
231
|
const storedConfig = meshEdgesEdgeAttributeStoredConfig(id, name, item);
|
|
206
232
|
return storedConfig.colorMap;
|
|
207
233
|
}
|
|
208
|
-
function setMeshEdgesEdgeAttributeColorMap(
|
|
234
|
+
async function setMeshEdgesEdgeAttributeColorMap(
|
|
235
|
+
id: string,
|
|
236
|
+
colorMap: string | undefined,
|
|
237
|
+
): Promise<unknown> {
|
|
209
238
|
const name = meshEdgesEdgeAttributeName(id);
|
|
210
239
|
const item = meshEdgesEdgeAttributeItem(id);
|
|
211
|
-
setMeshEdgesEdgeAttributeStoredConfig(id, name, item, {
|
|
240
|
+
await setMeshEdgesEdgeAttributeStoredConfig(id, name, item, {
|
|
212
241
|
colorMap,
|
|
213
242
|
});
|
|
214
243
|
return applyEdgeAttribute(id);
|
|
@@ -219,7 +248,10 @@ function useMeshEdgesEdgeAttributeStyle() {
|
|
|
219
248
|
const storedConfig = meshEdgesEdgeAttributeStoredConfig(id, name, item);
|
|
220
249
|
return storedConfig.no_data_color;
|
|
221
250
|
}
|
|
222
|
-
async function setMeshEdgesEdgeAttributeNoDataColor(
|
|
251
|
+
async function setMeshEdgesEdgeAttributeNoDataColor(
|
|
252
|
+
id: string,
|
|
253
|
+
no_data_color: unknown,
|
|
254
|
+
): Promise<unknown> {
|
|
223
255
|
const name = meshEdgesEdgeAttributeName(id);
|
|
224
256
|
const item = meshEdgesEdgeAttributeItem(id);
|
|
225
257
|
const storedConfig = meshEdgesEdgeAttributeStoredConfig(id, name, item);
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// Local imports
|
|
4
4
|
import { isMeshEdgesEdgeAttributeValid, useMeshEdgesEdgeAttributeStyle } from "./edge";
|
|
5
5
|
import { isMeshEdgesVertexAttributeValid, useMeshEdgesVertexAttributeStyle } from "./vertex";
|
|
6
|
+
import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
|
|
6
7
|
import { useMeshEdgesColorStyle } from "./color";
|
|
7
8
|
import { useMeshEdgesCommonStyle } from "./common";
|
|
8
9
|
import { useMeshEdgesVisibilityStyle } from "./visibility";
|
|
@@ -10,67 +11,141 @@ import { useMeshEdgesWidthStyle } from "./width";
|
|
|
10
11
|
|
|
11
12
|
// Local constants
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
interface MeshEdgesActiveColoringDeps {
|
|
15
|
+
readonly commonStyle: ReturnType<typeof useMeshEdgesCommonStyle>;
|
|
16
|
+
readonly colorStyle: ReturnType<typeof useMeshEdgesColorStyle>;
|
|
17
|
+
readonly vertexAttributeStyle: ReturnType<typeof useMeshEdgesVertexAttributeStyle>;
|
|
18
|
+
readonly edgeAttributeStyle: ReturnType<typeof useMeshEdgesEdgeAttributeStyle>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function handleMeshEdgesVertexColoring(
|
|
22
|
+
id: string,
|
|
23
|
+
vertexAttributeStyle: ReturnType<typeof useMeshEdgesVertexAttributeStyle>,
|
|
24
|
+
): Promise<unknown> | undefined {
|
|
25
|
+
const name = vertexAttributeStyle.meshEdgesVertexAttributeName(id);
|
|
26
|
+
const item = vertexAttributeStyle.meshEdgesVertexAttributeItem(id);
|
|
27
|
+
const [minimum, maximum] = vertexAttributeStyle.meshEdgesVertexAttributeRange(id);
|
|
28
|
+
const colorMap = vertexAttributeStyle.meshEdgesVertexAttributeColorMap(id);
|
|
29
|
+
const vertex_attribute = { name, item, minimum, maximum, colorMap };
|
|
30
|
+
if (!isMeshEdgesVertexAttributeValid(vertex_attribute)) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
return vertexAttributeStyle.setMeshEdgesVertexAttribute(id, vertex_attribute);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function handleMeshEdgesEdgeColoring(
|
|
37
|
+
id: string,
|
|
38
|
+
edgeAttributeStyle: ReturnType<typeof useMeshEdgesEdgeAttributeStyle>,
|
|
39
|
+
): Promise<unknown> | undefined {
|
|
40
|
+
const name = edgeAttributeStyle.meshEdgesEdgeAttributeName(id);
|
|
41
|
+
const item = edgeAttributeStyle.meshEdgesEdgeAttributeItem(id);
|
|
42
|
+
const [minimum, maximum] = edgeAttributeStyle.meshEdgesEdgeAttributeRange(id);
|
|
43
|
+
const colorMap = edgeAttributeStyle.meshEdgesEdgeAttributeColorMap(id);
|
|
44
|
+
const edge_attribute = { name, item, minimum, maximum, colorMap };
|
|
45
|
+
if (!isMeshEdgesEdgeAttributeValid(edge_attribute)) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
return edgeAttributeStyle.setMeshEdgesEdgeAttribute(id, edge_attribute);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async function setMeshEdgesActiveColoring(
|
|
52
|
+
id: string,
|
|
53
|
+
type: string | undefined,
|
|
54
|
+
deps: MeshEdgesActiveColoringDeps,
|
|
55
|
+
): Promise<unknown> {
|
|
56
|
+
await deps.commonStyle.mutateMeshEdgesStyle(id, {
|
|
57
|
+
coloring: { active: type },
|
|
58
|
+
});
|
|
59
|
+
if (type === "constant") {
|
|
60
|
+
const result = await deps.colorStyle.setMeshEdgesColor(id, deps.colorStyle.meshEdgesColor(id));
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
if (type === "vertex") {
|
|
64
|
+
const result = await handleMeshEdgesVertexColoring(id, deps.vertexAttributeStyle);
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
if (type === "edge") {
|
|
68
|
+
const result = await handleMeshEdgesEdgeColoring(id, deps.edgeAttributeStyle);
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
throw new Error(`Unknown mesh edges coloring type: ${type}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function applyMeshEdgesStyle(
|
|
75
|
+
id: string,
|
|
76
|
+
visibilityStyle: ReturnType<typeof useMeshEdgesVisibilityStyle>,
|
|
77
|
+
widthStyle: ReturnType<typeof useMeshEdgesWidthStyle>,
|
|
78
|
+
activeColoringType: string | undefined,
|
|
79
|
+
deps: MeshEdgesActiveColoringDeps,
|
|
80
|
+
): Promise<unknown[]> {
|
|
81
|
+
const result = await Promise.all([
|
|
82
|
+
visibilityStyle.setMeshEdgesVisibility(id, visibilityStyle.meshEdgesVisibility(id)),
|
|
83
|
+
widthStyle.setMeshEdgesWidth(id, widthStyle.meshEdgesWidth(id)),
|
|
84
|
+
setMeshEdgesActiveColoring(id, activeColoringType, deps),
|
|
85
|
+
]);
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
type UseMeshEdgesStyleReturn = ReturnType<typeof useMeshEdgesCommonStyle> & {
|
|
90
|
+
meshEdgesColoring: (id: string) => StyleValues;
|
|
91
|
+
meshEdgesActiveColoring: (id: string) => string | undefined;
|
|
92
|
+
setMeshEdgesActiveColoring: (id: string, type: string | undefined) => Promise<unknown>;
|
|
93
|
+
applyMeshEdgesStyle: (id: string) => Promise<unknown[]>;
|
|
94
|
+
} & ReturnType<typeof useMeshEdgesVisibilityStyle> &
|
|
95
|
+
ReturnType<typeof useMeshEdgesColorStyle> &
|
|
96
|
+
ReturnType<typeof useMeshEdgesWidthStyle> &
|
|
97
|
+
ReturnType<typeof useMeshEdgesVertexAttributeStyle> &
|
|
98
|
+
ReturnType<typeof useMeshEdgesEdgeAttributeStyle>;
|
|
99
|
+
|
|
100
|
+
export function useMeshEdgesStyle(): UseMeshEdgesStyleReturn {
|
|
101
|
+
const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
|
|
14
102
|
const meshEdgesVisibility = useMeshEdgesVisibilityStyle();
|
|
15
103
|
const meshEdgesColorStyle = useMeshEdgesColorStyle();
|
|
16
104
|
const meshEdgesWidthStyle = useMeshEdgesWidthStyle();
|
|
17
105
|
const meshEdgesVertexAttributeStyle = useMeshEdgesVertexAttributeStyle();
|
|
18
106
|
const meshEdgesEdgeAttributeStyle = useMeshEdgesEdgeAttributeStyle();
|
|
19
|
-
const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
|
|
20
107
|
|
|
21
|
-
|
|
108
|
+
const activeColoringDeps: MeshEdgesActiveColoringDeps = {
|
|
109
|
+
commonStyle: meshEdgesCommonStyle,
|
|
110
|
+
colorStyle: meshEdgesColorStyle,
|
|
111
|
+
vertexAttributeStyle: meshEdgesVertexAttributeStyle,
|
|
112
|
+
edgeAttributeStyle: meshEdgesEdgeAttributeStyle,
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
function meshEdgesColoring(id: string): StyleValues {
|
|
22
116
|
return meshEdgesCommonStyle.meshEdgesColoring(id);
|
|
23
117
|
}
|
|
24
118
|
|
|
25
119
|
function meshEdgesActiveColoring(id: string): string | undefined {
|
|
120
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.active is defined as string in the data style schema.
|
|
26
121
|
return meshEdgesColoring(id).active as string | undefined;
|
|
27
122
|
}
|
|
28
123
|
|
|
29
|
-
async function
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
if (type === "vertex") {
|
|
37
|
-
const name = meshEdgesVertexAttributeStyle.meshEdgesVertexAttributeName(id);
|
|
38
|
-
const item = meshEdgesVertexAttributeStyle.meshEdgesVertexAttributeItem(id);
|
|
39
|
-
const [minimum, maximum] = meshEdgesVertexAttributeStyle.meshEdgesVertexAttributeRange(id);
|
|
40
|
-
const colorMap = meshEdgesVertexAttributeStyle.meshEdgesVertexAttributeColorMap(id);
|
|
41
|
-
const vertex_attribute = { name, item, minimum, maximum, colorMap };
|
|
42
|
-
if (!isMeshEdgesVertexAttributeValid(vertex_attribute)) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
return meshEdgesVertexAttributeStyle.setMeshEdgesVertexAttribute(id, vertex_attribute);
|
|
46
|
-
}
|
|
47
|
-
if (type === "edge") {
|
|
48
|
-
const name = meshEdgesEdgeAttributeStyle.meshEdgesEdgeAttributeName(id);
|
|
49
|
-
const item = meshEdgesEdgeAttributeStyle.meshEdgesEdgeAttributeItem(id);
|
|
50
|
-
const [minimum, maximum] = meshEdgesEdgeAttributeStyle.meshEdgesEdgeAttributeRange(id);
|
|
51
|
-
const colorMap = meshEdgesEdgeAttributeStyle.meshEdgesEdgeAttributeColorMap(id);
|
|
52
|
-
const edge_attribute = { name, item, minimum, maximum, colorMap };
|
|
53
|
-
if (!isMeshEdgesEdgeAttributeValid(edge_attribute)) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
return meshEdgesEdgeAttributeStyle.setMeshEdgesEdgeAttribute(id, edge_attribute);
|
|
57
|
-
}
|
|
58
|
-
throw new Error(`Unknown mesh edges coloring type: ${type}`);
|
|
124
|
+
async function boundSetMeshEdgesActiveColoring(
|
|
125
|
+
id: string,
|
|
126
|
+
type: string | undefined,
|
|
127
|
+
): Promise<unknown> {
|
|
128
|
+
const result = await setMeshEdgesActiveColoring(id, type, activeColoringDeps);
|
|
129
|
+
return result;
|
|
59
130
|
}
|
|
60
131
|
|
|
61
|
-
function
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
132
|
+
async function boundApplyMeshEdgesStyle(id: string): Promise<unknown[]> {
|
|
133
|
+
const result = await applyMeshEdgesStyle(
|
|
134
|
+
id,
|
|
135
|
+
meshEdgesVisibility,
|
|
136
|
+
meshEdgesWidthStyle,
|
|
137
|
+
meshEdgesActiveColoring(id),
|
|
138
|
+
activeColoringDeps,
|
|
139
|
+
);
|
|
140
|
+
return result;
|
|
67
141
|
}
|
|
68
142
|
|
|
69
143
|
return {
|
|
70
|
-
meshEdgesActiveColoring,
|
|
71
|
-
setMeshEdgesActiveColoring,
|
|
72
|
-
applyMeshEdgesStyle,
|
|
73
144
|
...meshEdgesCommonStyle,
|
|
145
|
+
meshEdgesColoring,
|
|
146
|
+
meshEdgesActiveColoring,
|
|
147
|
+
setMeshEdgesActiveColoring: boundSetMeshEdgesActiveColoring,
|
|
148
|
+
applyMeshEdgesStyle: boundApplyMeshEdgesStyle,
|
|
74
149
|
...meshEdgesVisibility,
|
|
75
150
|
...meshEdgesColorStyle,
|
|
76
151
|
...meshEdgesWidthStyle,
|
|
@@ -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 { useMeshEdgesCommonStyle } from "./common";
|
|
9
8
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
@@ -50,15 +49,39 @@ function isMeshEdgesVertexAttributeValid({
|
|
|
50
49
|
);
|
|
51
50
|
}
|
|
52
51
|
|
|
52
|
+
interface UseMeshEdgesVertexAttributeStyleReturn {
|
|
53
|
+
meshEdgesVertexAttributeName: (id: string) => string | undefined;
|
|
54
|
+
meshEdgesVertexAttributeItem: (id: string) => number;
|
|
55
|
+
meshEdgesVertexAttributeRange: (id: string) => [number | undefined, number | undefined];
|
|
56
|
+
meshEdgesVertexAttributeColorMap: (id: string) => string | undefined;
|
|
57
|
+
meshEdgesVertexAttributeStoredConfig: (
|
|
58
|
+
id: string,
|
|
59
|
+
name: string | undefined,
|
|
60
|
+
item: number | undefined,
|
|
61
|
+
) => AttributeStoredConfig;
|
|
62
|
+
setMeshEdgesVertexAttribute: (id: string, input: AttributeInput) => Promise<unknown>;
|
|
63
|
+
setMeshEdgesVertexAttributeName: (id: string, name: string) => Promise<unknown>;
|
|
64
|
+
setMeshEdgesVertexAttributeItem: (id: string, item: number) => Promise<unknown>;
|
|
65
|
+
setMeshEdgesVertexAttributeRange: (
|
|
66
|
+
id: string,
|
|
67
|
+
minimum: number,
|
|
68
|
+
maximum: number,
|
|
69
|
+
) => Promise<unknown>;
|
|
70
|
+
setMeshEdgesVertexAttributeColorMap: (
|
|
71
|
+
id: string,
|
|
72
|
+
colorMap: string | undefined,
|
|
73
|
+
) => Promise<unknown>;
|
|
74
|
+
meshEdgesVertexAttributeNoDataColor: (id: string) => unknown;
|
|
75
|
+
setMeshEdgesVertexAttributeNoDataColor: (id: string, no_data_color: unknown) => Promise<unknown>;
|
|
76
|
+
}
|
|
77
|
+
|
|
53
78
|
// oxlint-disable-next-line max-lines-per-function
|
|
54
|
-
function useMeshEdgesVertexAttributeStyle() {
|
|
79
|
+
function useMeshEdgesVertexAttributeStyle(): UseMeshEdgesVertexAttributeStyleReturn {
|
|
55
80
|
const viewerStore = useViewerStore();
|
|
56
81
|
const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
|
|
57
|
-
function meshEdgesColoring(id: string): StyleValues {
|
|
58
|
-
return meshEdgesCommonStyle.meshEdgesStyle(id).coloring as StyleValues;
|
|
59
|
-
}
|
|
60
82
|
function meshEdgesVertexAttribute(id: string): AttributeState {
|
|
61
|
-
|
|
83
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.vertex shape is defined by the data style schema.
|
|
84
|
+
return meshEdgesCommonStyle.meshEdgesColoring(id).vertex as AttributeState;
|
|
62
85
|
}
|
|
63
86
|
function meshEdgesVertexAttributeStoredConfig(
|
|
64
87
|
id: string,
|
|
@@ -66,14 +89,10 @@ function useMeshEdgesVertexAttributeStyle() {
|
|
|
66
89
|
item: number | undefined,
|
|
67
90
|
): AttributeStoredConfig {
|
|
68
91
|
const { storedConfigs } = meshEdgesVertexAttribute(id);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
item !== undefined &&
|
|
74
|
-
item in storedConfigs[name]!
|
|
75
|
-
) {
|
|
76
|
-
return storedConfigs[name]![item]!;
|
|
92
|
+
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
93
|
+
const itemConfig = item === undefined ? undefined : nameConfig?.[item];
|
|
94
|
+
if (itemConfig !== undefined) {
|
|
95
|
+
return itemConfig;
|
|
77
96
|
}
|
|
78
97
|
return {
|
|
79
98
|
minimum: undefined,
|
|
@@ -82,35 +101,41 @@ function useMeshEdgesVertexAttributeStyle() {
|
|
|
82
101
|
no_data_color: DEFAULT_NO_DATA_COLOR,
|
|
83
102
|
};
|
|
84
103
|
}
|
|
85
|
-
function mutateMeshEdgesVertexStyle(
|
|
86
|
-
|
|
104
|
+
async function mutateMeshEdgesVertexStyle(
|
|
105
|
+
id: string,
|
|
106
|
+
values: Record<string, unknown>,
|
|
107
|
+
): Promise<string> {
|
|
108
|
+
const result = await meshEdgesCommonStyle.mutateMeshEdgesStyle(id, {
|
|
87
109
|
coloring: {
|
|
88
110
|
vertex: values,
|
|
89
111
|
},
|
|
90
112
|
});
|
|
113
|
+
return result;
|
|
91
114
|
}
|
|
92
|
-
function setMeshEdgesVertexAttributeStoredConfig(
|
|
115
|
+
async function setMeshEdgesVertexAttributeStoredConfig(
|
|
93
116
|
id: string,
|
|
94
117
|
name: string | undefined,
|
|
95
118
|
item: number | undefined,
|
|
96
119
|
config: Partial<AttributeStoredConfig>,
|
|
97
|
-
) {
|
|
98
|
-
|
|
120
|
+
): Promise<string> {
|
|
121
|
+
const result = await mutateMeshEdgesVertexStyle(id, {
|
|
99
122
|
storedConfigs: {
|
|
100
|
-
[name
|
|
123
|
+
[name ?? ""]: {
|
|
101
124
|
lastItem: item,
|
|
102
|
-
[item
|
|
125
|
+
[item ?? 0]: config,
|
|
103
126
|
},
|
|
104
127
|
},
|
|
105
128
|
});
|
|
129
|
+
return result;
|
|
106
130
|
}
|
|
107
131
|
function meshEdgesVertexAttributeName(id: string): string | undefined {
|
|
108
132
|
return meshEdgesVertexAttribute(id).name;
|
|
109
133
|
}
|
|
110
134
|
function meshEdgesVertexAttributeLastItem(id: string, name: string | undefined): number {
|
|
111
135
|
const { storedConfigs } = meshEdgesVertexAttribute(id);
|
|
112
|
-
|
|
113
|
-
|
|
136
|
+
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
137
|
+
if (nameConfig !== undefined) {
|
|
138
|
+
return nameConfig.lastItem;
|
|
114
139
|
}
|
|
115
140
|
return 0;
|
|
116
141
|
}
|
|
@@ -118,7 +143,7 @@ function useMeshEdgesVertexAttributeStyle() {
|
|
|
118
143
|
const { item, name } = meshEdgesVertexAttribute(id);
|
|
119
144
|
return item ?? meshEdgesVertexAttributeLastItem(id, name);
|
|
120
145
|
}
|
|
121
|
-
function setMeshEdgesVertexAttribute(
|
|
146
|
+
async function setMeshEdgesVertexAttribute(
|
|
122
147
|
id: string,
|
|
123
148
|
{
|
|
124
149
|
name,
|
|
@@ -128,18 +153,18 @@ function useMeshEdgesVertexAttributeStyle() {
|
|
|
128
153
|
colorMap,
|
|
129
154
|
no_data_color = DEFAULT_NO_DATA_COLOR,
|
|
130
155
|
}: AttributeInput,
|
|
131
|
-
) {
|
|
132
|
-
mutateMeshEdgesVertexStyle(id, {
|
|
156
|
+
): Promise<unknown> {
|
|
157
|
+
await mutateMeshEdgesVertexStyle(id, {
|
|
133
158
|
name,
|
|
134
159
|
item,
|
|
135
160
|
});
|
|
136
|
-
setMeshEdgesVertexAttributeStoredConfig(id, name, item, {
|
|
161
|
+
await setMeshEdgesVertexAttributeStoredConfig(id, name, item, {
|
|
137
162
|
minimum,
|
|
138
163
|
maximum,
|
|
139
164
|
colorMap,
|
|
140
165
|
no_data_color,
|
|
141
166
|
});
|
|
142
|
-
const points = getRGBPointsFromPreset(colorMap
|
|
167
|
+
const points = getRGBPointsFromPreset(colorMap ?? "");
|
|
143
168
|
const schema = meshEdgesVertexAttributeSchemas.attribute;
|
|
144
169
|
const params = {
|
|
145
170
|
id,
|
|
@@ -155,7 +180,7 @@ function useMeshEdgesVertexAttributeStyle() {
|
|
|
155
180
|
params,
|
|
156
181
|
});
|
|
157
182
|
}
|
|
158
|
-
function applyVertexAttribute(id: string) {
|
|
183
|
+
async function applyVertexAttribute(id: string): Promise<unknown> {
|
|
159
184
|
const name = meshEdgesVertexAttributeName(id);
|
|
160
185
|
const item = meshEdgesVertexAttributeItem(id);
|
|
161
186
|
const storedConfig = meshEdgesVertexAttributeStoredConfig(id, name, item);
|
|
@@ -168,19 +193,21 @@ function useMeshEdgesVertexAttributeStyle() {
|
|
|
168
193
|
no_data_color: storedConfig.no_data_color,
|
|
169
194
|
};
|
|
170
195
|
if (isMeshEdgesVertexAttributeValid(attribute)) {
|
|
171
|
-
|
|
196
|
+
const result = await setMeshEdgesVertexAttribute(id, attribute);
|
|
197
|
+
return result;
|
|
172
198
|
}
|
|
199
|
+
return undefined;
|
|
173
200
|
}
|
|
174
|
-
function setMeshEdgesVertexAttributeName(id: string, name: string) {
|
|
201
|
+
async function setMeshEdgesVertexAttributeName(id: string, name: string): Promise<unknown> {
|
|
175
202
|
const item = meshEdgesVertexAttributeLastItem(id, name);
|
|
176
|
-
mutateMeshEdgesVertexStyle(id, {
|
|
203
|
+
await mutateMeshEdgesVertexStyle(id, {
|
|
177
204
|
name,
|
|
178
205
|
item,
|
|
179
206
|
});
|
|
180
207
|
return applyVertexAttribute(id);
|
|
181
208
|
}
|
|
182
|
-
function setMeshEdgesVertexAttributeItem(id: string, item: number) {
|
|
183
|
-
mutateMeshEdgesVertexStyle(id, {
|
|
209
|
+
async function setMeshEdgesVertexAttributeItem(id: string, item: number): Promise<unknown> {
|
|
210
|
+
await mutateMeshEdgesVertexStyle(id, {
|
|
184
211
|
item,
|
|
185
212
|
});
|
|
186
213
|
return applyVertexAttribute(id);
|
|
@@ -191,10 +218,14 @@ function useMeshEdgesVertexAttributeStyle() {
|
|
|
191
218
|
const storedConfig = meshEdgesVertexAttributeStoredConfig(id, name, item);
|
|
192
219
|
return [storedConfig.minimum, storedConfig.maximum];
|
|
193
220
|
}
|
|
194
|
-
function setMeshEdgesVertexAttributeRange(
|
|
221
|
+
async function setMeshEdgesVertexAttributeRange(
|
|
222
|
+
id: string,
|
|
223
|
+
minimum: number,
|
|
224
|
+
maximum: number,
|
|
225
|
+
): Promise<unknown> {
|
|
195
226
|
const name = meshEdgesVertexAttributeName(id);
|
|
196
227
|
const item = meshEdgesVertexAttributeItem(id);
|
|
197
|
-
setMeshEdgesVertexAttributeStoredConfig(id, name, item, {
|
|
228
|
+
await setMeshEdgesVertexAttributeStoredConfig(id, name, item, {
|
|
198
229
|
minimum,
|
|
199
230
|
maximum,
|
|
200
231
|
});
|
|
@@ -206,10 +237,13 @@ function useMeshEdgesVertexAttributeStyle() {
|
|
|
206
237
|
const storedConfig = meshEdgesVertexAttributeStoredConfig(id, name, item);
|
|
207
238
|
return storedConfig.colorMap;
|
|
208
239
|
}
|
|
209
|
-
function setMeshEdgesVertexAttributeColorMap(
|
|
240
|
+
async function setMeshEdgesVertexAttributeColorMap(
|
|
241
|
+
id: string,
|
|
242
|
+
colorMap: string | undefined,
|
|
243
|
+
): Promise<unknown> {
|
|
210
244
|
const name = meshEdgesVertexAttributeName(id);
|
|
211
245
|
const item = meshEdgesVertexAttributeItem(id);
|
|
212
|
-
setMeshEdgesVertexAttributeStoredConfig(id, name, item, {
|
|
246
|
+
await setMeshEdgesVertexAttributeStoredConfig(id, name, item, {
|
|
213
247
|
colorMap,
|
|
214
248
|
});
|
|
215
249
|
return applyVertexAttribute(id);
|
|
@@ -220,7 +254,10 @@ function useMeshEdgesVertexAttributeStyle() {
|
|
|
220
254
|
const storedConfig = meshEdgesVertexAttributeStoredConfig(id, name, item);
|
|
221
255
|
return storedConfig.no_data_color;
|
|
222
256
|
}
|
|
223
|
-
async function setMeshEdgesVertexAttributeNoDataColor(
|
|
257
|
+
async function setMeshEdgesVertexAttributeNoDataColor(
|
|
258
|
+
id: string,
|
|
259
|
+
no_data_color: unknown,
|
|
260
|
+
): Promise<unknown> {
|
|
224
261
|
const name = meshEdgesVertexAttributeName(id);
|
|
225
262
|
const item = meshEdgesVertexAttributeItem(id);
|
|
226
263
|
const storedConfig = meshEdgesVertexAttributeStoredConfig(id, name, item);
|