@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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// oxlint-disable eslint/max-lines
|
|
1
2
|
import { DEFAULT_NO_DATA_COLOR } from "@ogw_front/utils/default_styles/constants";
|
|
2
3
|
// Third party imports
|
|
3
4
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
|
|
@@ -50,14 +51,68 @@ function isModelSurfacesPolygonAttributeValid({
|
|
|
50
51
|
);
|
|
51
52
|
}
|
|
52
53
|
|
|
54
|
+
interface UseModelSurfacesPolygonAttributeReturn {
|
|
55
|
+
modelSurfacesPolygonAttributeName: (modelId: string, surfaceId?: string) => string | undefined;
|
|
56
|
+
modelSurfacesPolygonAttributeItem: (modelId: string, surfaceId?: string) => number;
|
|
57
|
+
modelSurfacesPolygonAttributeRange: (
|
|
58
|
+
modelId: string,
|
|
59
|
+
surfaceId?: string,
|
|
60
|
+
) => [number | undefined, number | undefined];
|
|
61
|
+
modelSurfacesPolygonAttributeColorMap: (
|
|
62
|
+
modelId: string,
|
|
63
|
+
surfaceId?: string,
|
|
64
|
+
) => string | undefined;
|
|
65
|
+
modelSurfacesPolygonAttributeStoredConfig: (
|
|
66
|
+
modelId: string,
|
|
67
|
+
surfaceId: string | undefined,
|
|
68
|
+
name: string | undefined,
|
|
69
|
+
item: number | undefined,
|
|
70
|
+
) => AttributeStoredConfig;
|
|
71
|
+
setModelSurfacesPolygonAttribute: (
|
|
72
|
+
modelId: string,
|
|
73
|
+
surfaceIds: string[],
|
|
74
|
+
input: AttributeInput,
|
|
75
|
+
) => Promise<unknown>;
|
|
76
|
+
setModelSurfacesPolygonAttributeName: (
|
|
77
|
+
modelId: string,
|
|
78
|
+
surfaceIds: string[],
|
|
79
|
+
name: string,
|
|
80
|
+
) => Promise<void>;
|
|
81
|
+
setModelSurfacesPolygonAttributeItem: (
|
|
82
|
+
modelId: string,
|
|
83
|
+
surfaceIds: string[],
|
|
84
|
+
item: number,
|
|
85
|
+
) => Promise<void>;
|
|
86
|
+
setModelSurfacesPolygonAttributeRange: (
|
|
87
|
+
modelId: string,
|
|
88
|
+
surfaceIds: string[],
|
|
89
|
+
minimum: number,
|
|
90
|
+
maximum: number,
|
|
91
|
+
) => Promise<void>;
|
|
92
|
+
setModelSurfacesPolygonAttributeColorMap: (
|
|
93
|
+
modelId: string,
|
|
94
|
+
surfaceIds: string[],
|
|
95
|
+
colorMap: string | undefined,
|
|
96
|
+
) => Promise<void>;
|
|
97
|
+
modelSurfacesPolygonAttributeNoDataColor: (modelId: string, surfaceId?: string) => unknown;
|
|
98
|
+
setModelSurfacesPolygonAttributeNoDataColor: (
|
|
99
|
+
modelId: string,
|
|
100
|
+
surfaceIds: string[],
|
|
101
|
+
no_data_color: unknown,
|
|
102
|
+
) => Promise<void>;
|
|
103
|
+
}
|
|
104
|
+
|
|
53
105
|
// oxlint-disable-next-line max-lines-per-function
|
|
54
|
-
function useModelSurfacesPolygonAttribute() {
|
|
106
|
+
function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeReturn {
|
|
55
107
|
const dataStore = useDataStore();
|
|
56
108
|
const modelSurfacesCommonStyle = useModelSurfacesCommonStyle();
|
|
57
109
|
const viewerStore = useViewerStore();
|
|
58
110
|
function modelSurfacesPolygonAttribute(modelId: string, surfaceId?: string): AttributeState {
|
|
59
|
-
return
|
|
60
|
-
.
|
|
111
|
+
return (
|
|
112
|
+
modelSurfacesCommonStyle.modelSurfaceColoring(modelId, surfaceId)
|
|
113
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.polygon shape is defined by the data style schema.
|
|
114
|
+
.polygon as AttributeState
|
|
115
|
+
);
|
|
61
116
|
}
|
|
62
117
|
function modelSurfacesPolygonAttributeStoredConfig(
|
|
63
118
|
modelId: string,
|
|
@@ -66,14 +121,10 @@ function useModelSurfacesPolygonAttribute() {
|
|
|
66
121
|
item: number | undefined,
|
|
67
122
|
): AttributeStoredConfig {
|
|
68
123
|
const { storedConfigs } = modelSurfacesPolygonAttribute(modelId, surfaceId);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
item !== undefined &&
|
|
74
|
-
item in storedConfigs[name]!
|
|
75
|
-
) {
|
|
76
|
-
return storedConfigs[name]![item]!;
|
|
124
|
+
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
125
|
+
const itemConfig = item === undefined ? undefined : nameConfig?.[item];
|
|
126
|
+
if (itemConfig !== undefined) {
|
|
127
|
+
return itemConfig;
|
|
77
128
|
}
|
|
78
129
|
return {
|
|
79
130
|
minimum: undefined,
|
|
@@ -82,34 +133,33 @@ function useModelSurfacesPolygonAttribute() {
|
|
|
82
133
|
no_data_color: DEFAULT_NO_DATA_COLOR,
|
|
83
134
|
};
|
|
84
135
|
}
|
|
85
|
-
function mutateModelSurfacesPolygonStyle(
|
|
136
|
+
async function mutateModelSurfacesPolygonStyle(
|
|
86
137
|
modelId: string,
|
|
87
138
|
surfaceIds: string[],
|
|
88
139
|
values: Record<string, unknown>,
|
|
89
|
-
) {
|
|
90
|
-
|
|
91
|
-
modelSurfacesCommonStyle.
|
|
140
|
+
): Promise<void> {
|
|
141
|
+
const tasks: Promise<void>[] = [
|
|
142
|
+
modelSurfacesCommonStyle.mutateModelSurfacesColoring(modelId, surfaceIds, {
|
|
92
143
|
polygon: values,
|
|
93
|
-
})
|
|
144
|
+
}),
|
|
145
|
+
];
|
|
146
|
+
const totalSurfaceIds = await dataStore.getSurfacesGeodeIds(modelId);
|
|
147
|
+
if (surfaceIds.length === totalSurfaceIds.length) {
|
|
148
|
+
tasks.push(
|
|
149
|
+
modelSurfacesCommonStyle.mutateModelSurfacesTypeColoring(modelId, { polygon: values }),
|
|
150
|
+
);
|
|
94
151
|
}
|
|
95
|
-
|
|
96
|
-
polygon: values,
|
|
97
|
-
});
|
|
152
|
+
await Promise.all(tasks);
|
|
98
153
|
}
|
|
99
|
-
function setModelSurfacesPolygonAttributeStoredConfig(
|
|
154
|
+
async function setModelSurfacesPolygonAttributeStoredConfig(
|
|
100
155
|
modelId: string,
|
|
101
156
|
surfaceIds: string[],
|
|
102
157
|
name: string | undefined,
|
|
103
158
|
item: number | undefined,
|
|
104
159
|
config: Partial<AttributeStoredConfig>,
|
|
105
|
-
) {
|
|
106
|
-
|
|
107
|
-
storedConfigs: {
|
|
108
|
-
[name as string]: {
|
|
109
|
-
lastItem: item,
|
|
110
|
-
[item as number]: config,
|
|
111
|
-
},
|
|
112
|
-
},
|
|
160
|
+
): Promise<void> {
|
|
161
|
+
await mutateModelSurfacesPolygonStyle(modelId, surfaceIds, {
|
|
162
|
+
storedConfigs: { [name ?? ""]: { lastItem: item, [item ?? 0]: config } },
|
|
113
163
|
});
|
|
114
164
|
}
|
|
115
165
|
function modelSurfacesPolygonAttributeName(
|
|
@@ -124,8 +174,9 @@ function useModelSurfacesPolygonAttribute() {
|
|
|
124
174
|
name: string | undefined,
|
|
125
175
|
): number {
|
|
126
176
|
const { storedConfigs } = modelSurfacesPolygonAttribute(modelId, surfaceId);
|
|
127
|
-
|
|
128
|
-
|
|
177
|
+
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
178
|
+
if (nameConfig !== undefined) {
|
|
179
|
+
return nameConfig.lastItem;
|
|
129
180
|
}
|
|
130
181
|
return 0;
|
|
131
182
|
}
|
|
@@ -166,18 +217,15 @@ function useModelSurfacesPolygonAttribute() {
|
|
|
166
217
|
colorMap,
|
|
167
218
|
no_data_color = DEFAULT_NO_DATA_COLOR,
|
|
168
219
|
}: AttributeInput,
|
|
169
|
-
) {
|
|
170
|
-
mutateModelSurfacesPolygonStyle(modelId, surfaceIds, {
|
|
171
|
-
|
|
172
|
-
item,
|
|
173
|
-
});
|
|
174
|
-
setModelSurfacesPolygonAttributeStoredConfig(modelId, surfaceIds, name, item, {
|
|
220
|
+
): Promise<unknown> {
|
|
221
|
+
await mutateModelSurfacesPolygonStyle(modelId, surfaceIds, { name, item });
|
|
222
|
+
await setModelSurfacesPolygonAttributeStoredConfig(modelId, surfaceIds, name, item, {
|
|
175
223
|
minimum,
|
|
176
224
|
maximum,
|
|
177
225
|
colorMap,
|
|
178
226
|
no_data_color,
|
|
179
227
|
});
|
|
180
|
-
const points = getRGBPointsFromPreset(colorMap
|
|
228
|
+
const points = getRGBPointsFromPreset(colorMap ?? "");
|
|
181
229
|
const surface_viewer_ids = await dataStore.getMeshComponentsViewerIds(modelId, surfaceIds);
|
|
182
230
|
const params = {
|
|
183
231
|
id: modelId,
|
|
@@ -189,12 +237,10 @@ function useModelSurfacesPolygonAttribute() {
|
|
|
189
237
|
maximum,
|
|
190
238
|
no_data_color,
|
|
191
239
|
};
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
params,
|
|
195
|
-
});
|
|
240
|
+
const result = await viewerStore.request({ schema: attributeSchema, params });
|
|
241
|
+
return result;
|
|
196
242
|
}
|
|
197
|
-
function applyPolygonAttribute(modelId: string, surfaceIds: string[]) {
|
|
243
|
+
async function applyPolygonAttribute(modelId: string, surfaceIds: string[]): Promise<void> {
|
|
198
244
|
const name = modelSurfacesPolygonAttributeName(modelId, surfaceIds[0]);
|
|
199
245
|
const item = modelSurfacesPolygonAttributeItem(modelId, surfaceIds[0]);
|
|
200
246
|
const storedConfig = modelSurfacesPolygonAttributeStoredConfig(
|
|
@@ -212,57 +258,51 @@ function useModelSurfacesPolygonAttribute() {
|
|
|
212
258
|
no_data_color: storedConfig.no_data_color,
|
|
213
259
|
};
|
|
214
260
|
if (isModelSurfacesPolygonAttributeValid(attribute)) {
|
|
215
|
-
|
|
261
|
+
await setModelSurfacesPolygonAttribute(modelId, surfaceIds, attribute);
|
|
216
262
|
}
|
|
217
|
-
return Promise.resolve();
|
|
218
263
|
}
|
|
219
|
-
function setModelSurfacesPolygonAttributeName(
|
|
264
|
+
async function setModelSurfacesPolygonAttributeName(
|
|
220
265
|
modelId: string,
|
|
221
266
|
surfaceIds: string[],
|
|
222
267
|
name: string,
|
|
223
|
-
) {
|
|
268
|
+
): Promise<void> {
|
|
224
269
|
const item = modelSurfacesPolygonAttributeLastItem(modelId, surfaceIds[0], name);
|
|
225
|
-
mutateModelSurfacesPolygonStyle(modelId, surfaceIds, {
|
|
226
|
-
|
|
227
|
-
item,
|
|
228
|
-
});
|
|
229
|
-
return applyPolygonAttribute(modelId, surfaceIds);
|
|
270
|
+
await mutateModelSurfacesPolygonStyle(modelId, surfaceIds, { name, item });
|
|
271
|
+
await applyPolygonAttribute(modelId, surfaceIds);
|
|
230
272
|
}
|
|
231
|
-
function setModelSurfacesPolygonAttributeItem(
|
|
273
|
+
async function setModelSurfacesPolygonAttributeItem(
|
|
232
274
|
modelId: string,
|
|
233
275
|
surfaceIds: string[],
|
|
234
276
|
item: number,
|
|
235
|
-
) {
|
|
236
|
-
mutateModelSurfacesPolygonStyle(modelId, surfaceIds, {
|
|
237
|
-
|
|
238
|
-
});
|
|
239
|
-
return applyPolygonAttribute(modelId, surfaceIds);
|
|
277
|
+
): Promise<void> {
|
|
278
|
+
await mutateModelSurfacesPolygonStyle(modelId, surfaceIds, { item });
|
|
279
|
+
await applyPolygonAttribute(modelId, surfaceIds);
|
|
240
280
|
}
|
|
241
|
-
function setModelSurfacesPolygonAttributeRange(
|
|
281
|
+
async function setModelSurfacesPolygonAttributeRange(
|
|
242
282
|
modelId: string,
|
|
243
283
|
surfaceIds: string[],
|
|
244
284
|
minimum: number,
|
|
245
285
|
maximum: number,
|
|
246
|
-
) {
|
|
286
|
+
): Promise<void> {
|
|
247
287
|
const name = modelSurfacesPolygonAttributeName(modelId, surfaceIds[0]);
|
|
248
288
|
const item = modelSurfacesPolygonAttributeItem(modelId, surfaceIds[0]);
|
|
249
|
-
setModelSurfacesPolygonAttributeStoredConfig(modelId, surfaceIds, name, item, {
|
|
289
|
+
await setModelSurfacesPolygonAttributeStoredConfig(modelId, surfaceIds, name, item, {
|
|
250
290
|
minimum,
|
|
251
291
|
maximum,
|
|
252
292
|
});
|
|
253
|
-
|
|
293
|
+
await applyPolygonAttribute(modelId, surfaceIds);
|
|
254
294
|
}
|
|
255
|
-
function setModelSurfacesPolygonAttributeColorMap(
|
|
295
|
+
async function setModelSurfacesPolygonAttributeColorMap(
|
|
256
296
|
modelId: string,
|
|
257
297
|
surfaceIds: string[],
|
|
258
298
|
colorMap: string | undefined,
|
|
259
|
-
) {
|
|
299
|
+
): Promise<void> {
|
|
260
300
|
const name = modelSurfacesPolygonAttributeName(modelId, surfaceIds[0]);
|
|
261
301
|
const item = modelSurfacesPolygonAttributeItem(modelId, surfaceIds[0]);
|
|
262
|
-
setModelSurfacesPolygonAttributeStoredConfig(modelId, surfaceIds, name, item, {
|
|
302
|
+
await setModelSurfacesPolygonAttributeStoredConfig(modelId, surfaceIds, name, item, {
|
|
263
303
|
colorMap,
|
|
264
304
|
});
|
|
265
|
-
|
|
305
|
+
await applyPolygonAttribute(modelId, surfaceIds);
|
|
266
306
|
}
|
|
267
307
|
function modelSurfacesPolygonAttributeNoDataColor(modelId: string, surfaceId?: string): unknown {
|
|
268
308
|
const name = modelSurfacesPolygonAttributeName(modelId, surfaceId);
|
|
@@ -274,7 +314,7 @@ function useModelSurfacesPolygonAttribute() {
|
|
|
274
314
|
modelId: string,
|
|
275
315
|
surfaceIds: string[],
|
|
276
316
|
no_data_color: unknown,
|
|
277
|
-
) {
|
|
317
|
+
): Promise<void> {
|
|
278
318
|
const name = modelSurfacesPolygonAttributeName(modelId, surfaceIds[0]);
|
|
279
319
|
const item = modelSurfacesPolygonAttributeItem(modelId, surfaceIds[0]);
|
|
280
320
|
const storedConfig = modelSurfacesPolygonAttributeStoredConfig(
|
|
@@ -287,7 +327,7 @@ function useModelSurfacesPolygonAttribute() {
|
|
|
287
327
|
...storedConfig,
|
|
288
328
|
no_data_color,
|
|
289
329
|
});
|
|
290
|
-
|
|
330
|
+
await applyPolygonAttribute(modelId, surfaceIds);
|
|
291
331
|
}
|
|
292
332
|
return {
|
|
293
333
|
modelSurfacesPolygonAttributeName,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// oxlint-disable eslint/max-lines
|
|
1
2
|
import { DEFAULT_NO_DATA_COLOR } from "@ogw_front/utils/default_styles/constants";
|
|
2
3
|
// Third party imports
|
|
3
4
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
|
|
@@ -50,14 +51,65 @@ function isModelSurfacesVertexAttributeValid({
|
|
|
50
51
|
);
|
|
51
52
|
}
|
|
52
53
|
|
|
54
|
+
interface UseModelSurfacesVertexAttributeReturn {
|
|
55
|
+
modelSurfacesVertexAttributeName: (modelId: string, surfaceId?: string) => string | undefined;
|
|
56
|
+
modelSurfacesVertexAttributeItem: (modelId: string, surfaceId?: string) => number;
|
|
57
|
+
modelSurfacesVertexAttributeRange: (
|
|
58
|
+
modelId: string,
|
|
59
|
+
surfaceId?: string,
|
|
60
|
+
) => [number | undefined, number | undefined];
|
|
61
|
+
modelSurfacesVertexAttributeColorMap: (modelId: string, surfaceId?: string) => string | undefined;
|
|
62
|
+
modelSurfacesVertexAttributeStoredConfig: (
|
|
63
|
+
modelId: string,
|
|
64
|
+
surfaceId: string | undefined,
|
|
65
|
+
name: string | undefined,
|
|
66
|
+
item: number | undefined,
|
|
67
|
+
) => AttributeStoredConfig;
|
|
68
|
+
setModelSurfacesVertexAttribute: (
|
|
69
|
+
modelId: string,
|
|
70
|
+
surfaceIds: string[],
|
|
71
|
+
input: AttributeInput,
|
|
72
|
+
) => Promise<unknown>;
|
|
73
|
+
setModelSurfacesVertexAttributeName: (
|
|
74
|
+
modelId: string,
|
|
75
|
+
surfaceIds: string[],
|
|
76
|
+
name: string,
|
|
77
|
+
) => Promise<unknown>;
|
|
78
|
+
setModelSurfacesVertexAttributeItem: (
|
|
79
|
+
modelId: string,
|
|
80
|
+
surfaceIds: string[],
|
|
81
|
+
item: number,
|
|
82
|
+
) => Promise<unknown>;
|
|
83
|
+
setModelSurfacesVertexAttributeRange: (
|
|
84
|
+
modelId: string,
|
|
85
|
+
surfaceIds: string[],
|
|
86
|
+
minimum: number,
|
|
87
|
+
maximum: number,
|
|
88
|
+
) => Promise<unknown>;
|
|
89
|
+
setModelSurfacesVertexAttributeColorMap: (
|
|
90
|
+
modelId: string,
|
|
91
|
+
surfaceIds: string[],
|
|
92
|
+
colorMap: string | undefined,
|
|
93
|
+
) => Promise<unknown>;
|
|
94
|
+
modelSurfacesVertexAttributeNoDataColor: (modelId: string, surfaceId?: string) => unknown;
|
|
95
|
+
setModelSurfacesVertexAttributeNoDataColor: (
|
|
96
|
+
modelId: string,
|
|
97
|
+
surfaceIds: string[],
|
|
98
|
+
no_data_color: unknown,
|
|
99
|
+
) => Promise<unknown>;
|
|
100
|
+
}
|
|
101
|
+
|
|
53
102
|
// oxlint-disable-next-line max-lines-per-function
|
|
54
|
-
function useModelSurfacesVertexAttribute() {
|
|
103
|
+
function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeReturn {
|
|
55
104
|
const dataStore = useDataStore();
|
|
56
105
|
const modelSurfacesCommonStyle = useModelSurfacesCommonStyle();
|
|
57
106
|
const viewerStore = useViewerStore();
|
|
58
107
|
function modelSurfacesVertexAttribute(modelId: string, surfaceId?: string): AttributeState {
|
|
59
|
-
return
|
|
60
|
-
.
|
|
108
|
+
return (
|
|
109
|
+
modelSurfacesCommonStyle.modelSurfaceColoring(modelId, surfaceId)
|
|
110
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.vertex shape is defined by the data style schema.
|
|
111
|
+
.vertex as AttributeState
|
|
112
|
+
);
|
|
61
113
|
}
|
|
62
114
|
function modelSurfacesVertexAttributeStoredConfig(
|
|
63
115
|
modelId: string,
|
|
@@ -66,14 +118,10 @@ function useModelSurfacesVertexAttribute() {
|
|
|
66
118
|
item: number | undefined,
|
|
67
119
|
): AttributeStoredConfig {
|
|
68
120
|
const { storedConfigs } = modelSurfacesVertexAttribute(modelId, surfaceId);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
item !== undefined &&
|
|
74
|
-
item in storedConfigs[name]!
|
|
75
|
-
) {
|
|
76
|
-
return storedConfigs[name]![item]!;
|
|
121
|
+
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
122
|
+
const itemConfig = item === undefined ? undefined : nameConfig?.[item];
|
|
123
|
+
if (itemConfig !== undefined) {
|
|
124
|
+
return itemConfig;
|
|
77
125
|
}
|
|
78
126
|
return {
|
|
79
127
|
minimum: undefined,
|
|
@@ -82,34 +130,33 @@ function useModelSurfacesVertexAttribute() {
|
|
|
82
130
|
no_data_color: DEFAULT_NO_DATA_COLOR,
|
|
83
131
|
};
|
|
84
132
|
}
|
|
85
|
-
function mutateModelSurfacesVertexStyle(
|
|
133
|
+
async function mutateModelSurfacesVertexStyle(
|
|
86
134
|
modelId: string,
|
|
87
135
|
surfaceIds: string[],
|
|
88
136
|
values: Record<string, unknown>,
|
|
89
|
-
) {
|
|
90
|
-
|
|
91
|
-
modelSurfacesCommonStyle.
|
|
137
|
+
): Promise<void> {
|
|
138
|
+
const tasks: Promise<void>[] = [
|
|
139
|
+
modelSurfacesCommonStyle.mutateModelSurfacesColoring(modelId, surfaceIds, {
|
|
92
140
|
vertex: values,
|
|
93
|
-
})
|
|
141
|
+
}),
|
|
142
|
+
];
|
|
143
|
+
const totalSurfaceIds = await dataStore.getSurfacesGeodeIds(modelId);
|
|
144
|
+
if (surfaceIds.length === totalSurfaceIds.length) {
|
|
145
|
+
tasks.push(
|
|
146
|
+
modelSurfacesCommonStyle.mutateModelSurfacesTypeColoring(modelId, { vertex: values }),
|
|
147
|
+
);
|
|
94
148
|
}
|
|
95
|
-
|
|
96
|
-
vertex: values,
|
|
97
|
-
});
|
|
149
|
+
await Promise.all(tasks);
|
|
98
150
|
}
|
|
99
|
-
function setModelSurfacesVertexAttributeStoredConfig(
|
|
151
|
+
async function setModelSurfacesVertexAttributeStoredConfig(
|
|
100
152
|
modelId: string,
|
|
101
153
|
surfaceIds: string[],
|
|
102
154
|
name: string | undefined,
|
|
103
155
|
item: number | undefined,
|
|
104
156
|
config: Partial<AttributeStoredConfig>,
|
|
105
|
-
) {
|
|
106
|
-
|
|
107
|
-
storedConfigs: {
|
|
108
|
-
[name as string]: {
|
|
109
|
-
lastItem: item,
|
|
110
|
-
[item as number]: config,
|
|
111
|
-
},
|
|
112
|
-
},
|
|
157
|
+
): Promise<void> {
|
|
158
|
+
await mutateModelSurfacesVertexStyle(modelId, surfaceIds, {
|
|
159
|
+
storedConfigs: { [name ?? ""]: { lastItem: item, [item ?? 0]: config } },
|
|
113
160
|
});
|
|
114
161
|
}
|
|
115
162
|
function modelSurfacesVertexAttributeName(
|
|
@@ -124,8 +171,9 @@ function useModelSurfacesVertexAttribute() {
|
|
|
124
171
|
name: string | undefined,
|
|
125
172
|
): number {
|
|
126
173
|
const { storedConfigs } = modelSurfacesVertexAttribute(modelId, surfaceId);
|
|
127
|
-
|
|
128
|
-
|
|
174
|
+
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
175
|
+
if (nameConfig !== undefined) {
|
|
176
|
+
return nameConfig.lastItem;
|
|
129
177
|
}
|
|
130
178
|
return 0;
|
|
131
179
|
}
|
|
@@ -166,18 +214,15 @@ function useModelSurfacesVertexAttribute() {
|
|
|
166
214
|
colorMap,
|
|
167
215
|
no_data_color = DEFAULT_NO_DATA_COLOR,
|
|
168
216
|
}: AttributeInput,
|
|
169
|
-
) {
|
|
170
|
-
mutateModelSurfacesVertexStyle(modelId, surfaceIds, {
|
|
171
|
-
|
|
172
|
-
item,
|
|
173
|
-
});
|
|
174
|
-
setModelSurfacesVertexAttributeStoredConfig(modelId, surfaceIds, name, item, {
|
|
217
|
+
): Promise<unknown> {
|
|
218
|
+
await mutateModelSurfacesVertexStyle(modelId, surfaceIds, { name, item });
|
|
219
|
+
await setModelSurfacesVertexAttributeStoredConfig(modelId, surfaceIds, name, item, {
|
|
175
220
|
minimum,
|
|
176
221
|
maximum,
|
|
177
222
|
colorMap,
|
|
178
223
|
no_data_color,
|
|
179
224
|
});
|
|
180
|
-
const points = getRGBPointsFromPreset(colorMap
|
|
225
|
+
const points = getRGBPointsFromPreset(colorMap ?? "");
|
|
181
226
|
const surface_viewer_ids = await dataStore.getMeshComponentsViewerIds(modelId, surfaceIds);
|
|
182
227
|
const params = {
|
|
183
228
|
id: modelId,
|
|
@@ -189,12 +234,10 @@ function useModelSurfacesVertexAttribute() {
|
|
|
189
234
|
maximum,
|
|
190
235
|
no_data_color,
|
|
191
236
|
};
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
params,
|
|
195
|
-
});
|
|
237
|
+
const result = await viewerStore.request({ schema: attributeSchema, params });
|
|
238
|
+
return result;
|
|
196
239
|
}
|
|
197
|
-
function applyVertexAttribute(modelId: string, surfaceIds: string[]) {
|
|
240
|
+
async function applyVertexAttribute(modelId: string, surfaceIds: string[]): Promise<unknown> {
|
|
198
241
|
const name = modelSurfacesVertexAttributeName(modelId, surfaceIds[0]);
|
|
199
242
|
const item = modelSurfacesVertexAttributeItem(modelId, surfaceIds[0]);
|
|
200
243
|
const storedConfig = modelSurfacesVertexAttributeStoredConfig(
|
|
@@ -212,57 +255,57 @@ function useModelSurfacesVertexAttribute() {
|
|
|
212
255
|
no_data_color: storedConfig.no_data_color,
|
|
213
256
|
};
|
|
214
257
|
if (isModelSurfacesVertexAttributeValid(attribute)) {
|
|
215
|
-
|
|
258
|
+
const result = await setModelSurfacesVertexAttribute(modelId, surfaceIds, attribute);
|
|
259
|
+
return result;
|
|
216
260
|
}
|
|
217
|
-
return
|
|
261
|
+
return undefined;
|
|
218
262
|
}
|
|
219
|
-
function setModelSurfacesVertexAttributeName(
|
|
263
|
+
async function setModelSurfacesVertexAttributeName(
|
|
220
264
|
modelId: string,
|
|
221
265
|
surfaceIds: string[],
|
|
222
266
|
name: string,
|
|
223
|
-
) {
|
|
267
|
+
): Promise<unknown> {
|
|
224
268
|
const item = modelSurfacesVertexAttributeLastItem(modelId, surfaceIds[0], name);
|
|
225
|
-
mutateModelSurfacesVertexStyle(modelId, surfaceIds, {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
});
|
|
229
|
-
return applyVertexAttribute(modelId, surfaceIds);
|
|
269
|
+
await mutateModelSurfacesVertexStyle(modelId, surfaceIds, { name, item });
|
|
270
|
+
const result = await applyVertexAttribute(modelId, surfaceIds);
|
|
271
|
+
return result;
|
|
230
272
|
}
|
|
231
|
-
function setModelSurfacesVertexAttributeItem(
|
|
273
|
+
async function setModelSurfacesVertexAttributeItem(
|
|
232
274
|
modelId: string,
|
|
233
275
|
surfaceIds: string[],
|
|
234
276
|
item: number,
|
|
235
|
-
) {
|
|
236
|
-
mutateModelSurfacesVertexStyle(modelId, surfaceIds, {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return applyVertexAttribute(modelId, surfaceIds);
|
|
277
|
+
): Promise<unknown> {
|
|
278
|
+
await mutateModelSurfacesVertexStyle(modelId, surfaceIds, { item });
|
|
279
|
+
const result = await applyVertexAttribute(modelId, surfaceIds);
|
|
280
|
+
return result;
|
|
240
281
|
}
|
|
241
|
-
function setModelSurfacesVertexAttributeRange(
|
|
282
|
+
async function setModelSurfacesVertexAttributeRange(
|
|
242
283
|
modelId: string,
|
|
243
284
|
surfaceIds: string[],
|
|
244
285
|
minimum: number,
|
|
245
286
|
maximum: number,
|
|
246
|
-
) {
|
|
287
|
+
): Promise<unknown> {
|
|
247
288
|
const name = modelSurfacesVertexAttributeName(modelId, surfaceIds[0]);
|
|
248
289
|
const item = modelSurfacesVertexAttributeItem(modelId, surfaceIds[0]);
|
|
249
|
-
setModelSurfacesVertexAttributeStoredConfig(modelId, surfaceIds, name, item, {
|
|
290
|
+
await setModelSurfacesVertexAttributeStoredConfig(modelId, surfaceIds, name, item, {
|
|
250
291
|
minimum,
|
|
251
292
|
maximum,
|
|
252
293
|
});
|
|
253
|
-
|
|
294
|
+
const result = await applyVertexAttribute(modelId, surfaceIds);
|
|
295
|
+
return result;
|
|
254
296
|
}
|
|
255
|
-
function setModelSurfacesVertexAttributeColorMap(
|
|
297
|
+
async function setModelSurfacesVertexAttributeColorMap(
|
|
256
298
|
modelId: string,
|
|
257
299
|
surfaceIds: string[],
|
|
258
300
|
colorMap: string | undefined,
|
|
259
|
-
) {
|
|
301
|
+
): Promise<unknown> {
|
|
260
302
|
const name = modelSurfacesVertexAttributeName(modelId, surfaceIds[0]);
|
|
261
303
|
const item = modelSurfacesVertexAttributeItem(modelId, surfaceIds[0]);
|
|
262
|
-
setModelSurfacesVertexAttributeStoredConfig(modelId, surfaceIds, name, item, {
|
|
304
|
+
await setModelSurfacesVertexAttributeStoredConfig(modelId, surfaceIds, name, item, {
|
|
263
305
|
colorMap,
|
|
264
306
|
});
|
|
265
|
-
|
|
307
|
+
const result = await applyVertexAttribute(modelId, surfaceIds);
|
|
308
|
+
return result;
|
|
266
309
|
}
|
|
267
310
|
function modelSurfacesVertexAttributeNoDataColor(modelId: string, surfaceId?: string): unknown {
|
|
268
311
|
const name = modelSurfacesVertexAttributeName(modelId, surfaceId);
|
|
@@ -274,7 +317,7 @@ function useModelSurfacesVertexAttribute() {
|
|
|
274
317
|
modelId: string,
|
|
275
318
|
surfaceIds: string[],
|
|
276
319
|
no_data_color: unknown,
|
|
277
|
-
) {
|
|
320
|
+
): Promise<unknown> {
|
|
278
321
|
const name = modelSurfacesVertexAttributeName(modelId, surfaceIds[0]);
|
|
279
322
|
const item = modelSurfacesVertexAttributeItem(modelId, surfaceIds[0]);
|
|
280
323
|
const storedConfig = modelSurfacesVertexAttributeStoredConfig(
|
|
@@ -287,7 +330,8 @@ function useModelSurfacesVertexAttribute() {
|
|
|
287
330
|
...storedConfig,
|
|
288
331
|
no_data_color,
|
|
289
332
|
});
|
|
290
|
-
|
|
333
|
+
const result = await applyVertexAttribute(modelId, surfaceIds);
|
|
334
|
+
return result;
|
|
291
335
|
}
|
|
292
336
|
return {
|
|
293
337
|
modelSurfacesVertexAttributeName,
|
|
@@ -4,7 +4,14 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schem
|
|
|
4
4
|
|
|
5
5
|
const schema = viewer_schemas.opengeodeweb_viewer.model.surfaces.visibility;
|
|
6
6
|
|
|
7
|
-
export function useModelSurfacesVisibility() {
|
|
7
|
+
export function useModelSurfacesVisibility(): {
|
|
8
|
+
setModelSurfacesVisibility: (
|
|
9
|
+
modelId: string,
|
|
10
|
+
surfaces_ids: readonly string[],
|
|
11
|
+
visibility: boolean | undefined,
|
|
12
|
+
) => Promise<unknown>;
|
|
13
|
+
modelSurfaceVisibility: (id: string, surface_id?: string) => unknown;
|
|
14
|
+
} {
|
|
8
15
|
const modelCommonStyle = useModelCommonStyle();
|
|
9
16
|
const modelSurfacesCommonStyle = useModelSurfacesCommonStyle();
|
|
10
17
|
|
|
@@ -12,12 +19,18 @@ export function useModelSurfacesVisibility() {
|
|
|
12
19
|
return modelSurfacesCommonStyle.modelSurfaceStyle(id, surface_id).visibility;
|
|
13
20
|
}
|
|
14
21
|
|
|
15
|
-
function setModelSurfacesVisibility(
|
|
22
|
+
async function setModelSurfacesVisibility(
|
|
16
23
|
modelId: string,
|
|
17
|
-
surfaces_ids: string[],
|
|
24
|
+
surfaces_ids: readonly string[],
|
|
18
25
|
visibility: boolean | undefined,
|
|
19
|
-
) {
|
|
20
|
-
|
|
26
|
+
): Promise<unknown> {
|
|
27
|
+
const result = await modelCommonStyle.setModelTypeVisibility(
|
|
28
|
+
modelId,
|
|
29
|
+
[...surfaces_ids],
|
|
30
|
+
visibility,
|
|
31
|
+
schema,
|
|
32
|
+
);
|
|
33
|
+
return result;
|
|
21
34
|
}
|
|
22
35
|
|
|
23
36
|
return { setModelSurfacesVisibility, modelSurfaceVisibility };
|