@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,19 +1,39 @@
|
|
|
1
|
-
// Not auto-fixable (eslint's sort-imports core rule has no autofixer) and this file's import order doesn't match its syntax-kind-then-alphabetical requirement - left as-is rather than manually reordered across the codebase for a purely cosmetic rule.
|
|
2
|
-
// oxlint-disable eslint/sort-imports
|
|
3
|
-
import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
|
|
4
1
|
import { isModelCornersVertexAttributeValid, useModelCornersVertexAttribute } from "./vertex";
|
|
2
|
+
import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
|
|
3
|
+
import { useDataStore } from "@ogw_front/stores/data";
|
|
5
4
|
import { useModelCommonStyle } from "@ogw_internal/stores/data_style/model/common";
|
|
6
5
|
import { useModelCornersCommonStyle } from "./common";
|
|
7
6
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
|
|
8
7
|
|
|
9
8
|
const schema = viewer_schemas.opengeodeweb_viewer.model.corners.color;
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
interface ModelCornersColorApi {
|
|
11
|
+
setModelCornersColor: (
|
|
12
|
+
modelId: string,
|
|
13
|
+
corners_ids: string[],
|
|
14
|
+
color: unknown,
|
|
15
|
+
activeColoring?: string,
|
|
16
|
+
collectionId?: string,
|
|
17
|
+
) => Promise<unknown>;
|
|
18
|
+
modelCornerColoring: (id: string, corner_id?: string) => StyleValues;
|
|
19
|
+
modelCornerColor: (id: string, corner_id?: string) => unknown;
|
|
20
|
+
modelCornerActiveColoring: (id: string, corner_id?: string) => unknown;
|
|
21
|
+
setModelCornersActiveColoring: (
|
|
22
|
+
modelId: string,
|
|
23
|
+
corners_ids: string[],
|
|
24
|
+
activeColoring: string,
|
|
25
|
+
collectionId?: string,
|
|
26
|
+
) => Promise<unknown>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function useModelCornersColor(): ModelCornersColorApi {
|
|
30
|
+
const dataStore = useDataStore();
|
|
12
31
|
const modelCommonStyle = useModelCommonStyle();
|
|
13
32
|
const modelCornersCommonStyle = useModelCornersCommonStyle();
|
|
14
33
|
const modelCornersVertexAttribute = useModelCornersVertexAttribute();
|
|
15
34
|
|
|
16
35
|
function modelCornerColoring(id: string, corner_id?: string): StyleValues {
|
|
36
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring is a StyleValues sub-object stored under a StyleValues index signature.
|
|
17
37
|
return modelCornersCommonStyle.modelCornerStyle(id, corner_id).coloring as StyleValues;
|
|
18
38
|
}
|
|
19
39
|
|
|
@@ -21,13 +41,22 @@ export function useModelCornersColor() {
|
|
|
21
41
|
return modelCornerColoring(id, corner_id).constant;
|
|
22
42
|
}
|
|
23
43
|
|
|
24
|
-
function setModelCornersColor(
|
|
44
|
+
async function setModelCornersColor(
|
|
25
45
|
modelId: string,
|
|
26
46
|
corners_ids: string[],
|
|
27
47
|
color: unknown,
|
|
28
48
|
activeColoring = "constant",
|
|
29
|
-
|
|
30
|
-
|
|
49
|
+
collectionId?: string,
|
|
50
|
+
): Promise<unknown> {
|
|
51
|
+
const result = await modelCommonStyle.setModelTypeColor(
|
|
52
|
+
modelId,
|
|
53
|
+
corners_ids,
|
|
54
|
+
color,
|
|
55
|
+
schema,
|
|
56
|
+
activeColoring,
|
|
57
|
+
collectionId,
|
|
58
|
+
);
|
|
59
|
+
return result;
|
|
31
60
|
}
|
|
32
61
|
|
|
33
62
|
function modelCornerActiveColoring(id: string, corner_id?: string): unknown {
|
|
@@ -38,9 +67,11 @@ export function useModelCornersColor() {
|
|
|
38
67
|
modelId: string,
|
|
39
68
|
corners_ids: string[],
|
|
40
69
|
activeColoring: string,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
70
|
+
collectionId?: string,
|
|
71
|
+
): Promise<unknown> {
|
|
72
|
+
const totalCornerIds = await dataStore.getCornersGeodeIds(modelId);
|
|
73
|
+
if (corners_ids.length === totalCornerIds.length) {
|
|
74
|
+
await modelCornersCommonStyle.mutateModelCornersTypeColoring(modelId, {
|
|
44
75
|
active: activeColoring,
|
|
45
76
|
});
|
|
46
77
|
}
|
|
@@ -49,7 +80,7 @@ export function useModelCornersColor() {
|
|
|
49
80
|
});
|
|
50
81
|
if (activeColoring === "constant" || activeColoring === "random") {
|
|
51
82
|
const color = modelCornerColor(modelId, corners_ids[0]);
|
|
52
|
-
return setModelCornersColor(modelId, corners_ids, color, activeColoring);
|
|
83
|
+
return setModelCornersColor(modelId, corners_ids, color, activeColoring, collectionId);
|
|
53
84
|
}
|
|
54
85
|
|
|
55
86
|
if (activeColoring === "vertex") {
|
|
@@ -78,6 +109,7 @@ export function useModelCornersColor() {
|
|
|
78
109
|
);
|
|
79
110
|
}
|
|
80
111
|
}
|
|
112
|
+
return undefined;
|
|
81
113
|
}
|
|
82
114
|
|
|
83
115
|
return {
|
|
@@ -3,12 +3,26 @@ import merge from "lodash/merge";
|
|
|
3
3
|
import { useDataStyleState } from "@ogw_internal/stores/data_style/state";
|
|
4
4
|
import { useModelCommonStyle } from "@ogw_internal/stores/data_style/model/common";
|
|
5
5
|
|
|
6
|
-
export function useModelCornersCommonStyle() {
|
|
6
|
+
export function useModelCornersCommonStyle(): {
|
|
7
|
+
modelCornersStyle: (id: string) => StyleValues;
|
|
8
|
+
modelCornerStyle: (id: string, corner_id?: string) => StyleValues;
|
|
9
|
+
modelCornerColoring: (id: string, corner_id?: string) => StyleValues;
|
|
10
|
+
mutateModelCornersColoring: (
|
|
11
|
+
id: string,
|
|
12
|
+
corners_ids: string[],
|
|
13
|
+
values: StyleValues,
|
|
14
|
+
) => Promise<void>;
|
|
15
|
+
mutateModelCornersTypeColoring: (id: string, values: StyleValues) => Promise<void>;
|
|
16
|
+
} {
|
|
7
17
|
const dataStyleState = useDataStyleState();
|
|
8
18
|
const modelCommonStyle = useModelCommonStyle();
|
|
9
19
|
|
|
10
20
|
function modelCornersStyle(id: string): StyleValues {
|
|
11
|
-
|
|
21
|
+
const { corners } = dataStyleState.getStyle(id);
|
|
22
|
+
if (corners === undefined) {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
return corners;
|
|
12
26
|
}
|
|
13
27
|
|
|
14
28
|
function modelComponentTypeCornersStyle(id: string): StyleValues {
|
|
@@ -27,17 +41,22 @@ export function useModelCornersCommonStyle() {
|
|
|
27
41
|
}
|
|
28
42
|
|
|
29
43
|
function modelCornerColoring(id: string, corner_id?: string): StyleValues {
|
|
44
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring is a StyleValues sub-object stored under a StyleValues index signature.
|
|
30
45
|
return modelCornerStyle(id, corner_id).coloring as StyleValues;
|
|
31
46
|
}
|
|
32
47
|
|
|
33
|
-
function mutateModelCornersColoring(
|
|
34
|
-
|
|
48
|
+
async function mutateModelCornersColoring(
|
|
49
|
+
id: string,
|
|
50
|
+
corners_ids: string[],
|
|
51
|
+
values: StyleValues,
|
|
52
|
+
): Promise<void> {
|
|
53
|
+
await modelCommonStyle.mutateComponentStyles(id, corners_ids, {
|
|
35
54
|
coloring: values,
|
|
36
55
|
});
|
|
37
56
|
}
|
|
38
57
|
|
|
39
|
-
function mutateModelCornersTypeColoring(id: string, values: StyleValues) {
|
|
40
|
-
|
|
58
|
+
async function mutateModelCornersTypeColoring(id: string, values: StyleValues): Promise<void> {
|
|
59
|
+
await modelCommonStyle.mutateModelComponentTypeStyle(id, "Corner", {
|
|
41
60
|
coloring: values,
|
|
42
61
|
});
|
|
43
62
|
}
|
|
@@ -18,41 +18,57 @@ interface AttributeGroup {
|
|
|
18
18
|
corners_ids: string[];
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
async function setModelCornersDefaultStyle(_id: string) {
|
|
21
|
+
async function setModelCornersDefaultStyle(_id: string): Promise<void> {
|
|
22
22
|
// Placeholder
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
type ModelCornersStyleApi = ReturnType<typeof useModelCornersCommonStyle> &
|
|
26
|
+
ReturnType<typeof useModelCornersVisibility> &
|
|
27
|
+
ReturnType<typeof useModelCornersColor> &
|
|
28
|
+
ReturnType<typeof useModelCornersVertexAttribute> & {
|
|
29
|
+
applyModelCornersStyle: (modelId: string) => Promise<void>;
|
|
30
|
+
setModelCornersDefaultStyle: (id: string) => Promise<void>;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export function useModelCornersStyle(): ModelCornersStyleApi {
|
|
26
34
|
const dataStore = useDataStore();
|
|
27
35
|
const modelCommonStyle = useModelCornersCommonStyle();
|
|
28
36
|
const modelVisibilityStyle = useModelCornersVisibility();
|
|
29
37
|
const modelColorStyle = useModelCornersColor();
|
|
30
38
|
const modelCornersVertexAttribute = useModelCornersVertexAttribute();
|
|
31
39
|
|
|
32
|
-
function applyModelCornersVisibilityStyle(
|
|
40
|
+
async function applyModelCornersVisibilityStyle(
|
|
41
|
+
modelId: string,
|
|
42
|
+
corners_ids: string[],
|
|
43
|
+
): Promise<unknown[]> {
|
|
33
44
|
const visibilityGroups: Record<string, string[]> = {};
|
|
34
45
|
for (const corner_id of corners_ids) {
|
|
35
46
|
const style = modelCommonStyle.modelCornerStyle(modelId, corner_id);
|
|
36
47
|
const visibility = String(style.visibility);
|
|
37
|
-
|
|
38
|
-
visibilityGroups[visibility] = [];
|
|
39
|
-
}
|
|
48
|
+
visibilityGroups[visibility] ??= [];
|
|
40
49
|
visibilityGroups[visibility].push(corner_id);
|
|
41
50
|
}
|
|
42
|
-
|
|
43
|
-
Object.entries(visibilityGroups).map(([visibility, ids]) =>
|
|
44
|
-
modelVisibilityStyle.setModelCornersVisibility(
|
|
45
|
-
|
|
51
|
+
const results = await Promise.all(
|
|
52
|
+
Object.entries(visibilityGroups).map(async ([visibility, ids]) => {
|
|
53
|
+
const result = await modelVisibilityStyle.setModelCornersVisibility(
|
|
54
|
+
modelId,
|
|
55
|
+
ids,
|
|
56
|
+
visibility === "true",
|
|
57
|
+
);
|
|
58
|
+
return result;
|
|
59
|
+
}),
|
|
46
60
|
);
|
|
61
|
+
return results;
|
|
47
62
|
}
|
|
48
63
|
|
|
49
|
-
function applyModelCornersColoringStyle(
|
|
64
|
+
async function applyModelCornersColoringStyle(
|
|
65
|
+
modelId: string,
|
|
66
|
+
corners_ids: string[],
|
|
67
|
+
): Promise<unknown[]> {
|
|
50
68
|
const activeColoringGroups: Record<string, string[]> = {};
|
|
51
69
|
for (const corner_id of corners_ids) {
|
|
52
70
|
const activeColoring = String(modelColorStyle.modelCornerActiveColoring(modelId, corner_id));
|
|
53
|
-
|
|
54
|
-
activeColoringGroups[activeColoring] = [];
|
|
55
|
-
}
|
|
71
|
+
activeColoringGroups[activeColoring] ??= [];
|
|
56
72
|
activeColoringGroups[activeColoring].push(corner_id);
|
|
57
73
|
}
|
|
58
74
|
|
|
@@ -64,15 +80,19 @@ export function useModelCornersStyle() {
|
|
|
64
80
|
for (const corner_id of type_corners_ids) {
|
|
65
81
|
const color = modelColorStyle.modelCornerColor(modelId, corner_id);
|
|
66
82
|
const color_key = JSON.stringify(color);
|
|
67
|
-
|
|
68
|
-
colorGroups[color_key] = { color, corners_ids: [] };
|
|
69
|
-
}
|
|
83
|
+
colorGroups[color_key] ??= { color, corners_ids: [] };
|
|
70
84
|
colorGroups[color_key].corners_ids.push(corner_id);
|
|
71
85
|
}
|
|
72
86
|
coloringPromises.push(
|
|
73
|
-
...Object.values(colorGroups).map(({ color, corners_ids: ids }) =>
|
|
74
|
-
modelColorStyle.setModelCornersColor(
|
|
75
|
-
|
|
87
|
+
...Object.values(colorGroups).map(async ({ color, corners_ids: ids }) => {
|
|
88
|
+
const result = await modelColorStyle.setModelCornersColor(
|
|
89
|
+
modelId,
|
|
90
|
+
ids,
|
|
91
|
+
color,
|
|
92
|
+
"constant",
|
|
93
|
+
);
|
|
94
|
+
return result;
|
|
95
|
+
}),
|
|
76
96
|
);
|
|
77
97
|
} else if (type === "random") {
|
|
78
98
|
coloringPromises.push(
|
|
@@ -102,43 +122,48 @@ export function useModelCornersStyle() {
|
|
|
102
122
|
continue;
|
|
103
123
|
}
|
|
104
124
|
const key = `${name}_${item}_${colorMap}_${minimum}_${maximum}`;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
};
|
|
114
|
-
}
|
|
125
|
+
vertexGroups[key] ??= {
|
|
126
|
+
name,
|
|
127
|
+
item,
|
|
128
|
+
minimum,
|
|
129
|
+
maximum,
|
|
130
|
+
colorMap,
|
|
131
|
+
corners_ids: [],
|
|
132
|
+
};
|
|
115
133
|
vertexGroups[key].corners_ids.push(corner_id);
|
|
116
134
|
}
|
|
117
135
|
coloringPromises.push(
|
|
118
136
|
...Object.values(vertexGroups).map(
|
|
119
|
-
({ name, item, minimum, maximum, colorMap, corners_ids: ids }) =>
|
|
120
|
-
modelCornersVertexAttribute.setModelCornersVertexAttribute(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
137
|
+
async ({ name, item, minimum, maximum, colorMap, corners_ids: ids }) => {
|
|
138
|
+
const result = await modelCornersVertexAttribute.setModelCornersVertexAttribute(
|
|
139
|
+
modelId,
|
|
140
|
+
ids,
|
|
141
|
+
{
|
|
142
|
+
name,
|
|
143
|
+
item,
|
|
144
|
+
minimum,
|
|
145
|
+
maximum,
|
|
146
|
+
colorMap,
|
|
147
|
+
},
|
|
148
|
+
);
|
|
149
|
+
return result;
|
|
150
|
+
},
|
|
127
151
|
),
|
|
128
152
|
);
|
|
129
153
|
}
|
|
130
154
|
}
|
|
131
155
|
|
|
132
|
-
|
|
156
|
+
const results = await Promise.all(coloringPromises);
|
|
157
|
+
return results;
|
|
133
158
|
}
|
|
134
159
|
|
|
135
|
-
async function applyModelCornersStyle(modelId: string) {
|
|
160
|
+
async function applyModelCornersStyle(modelId: string): Promise<void> {
|
|
136
161
|
const corners_ids = await dataStore.getCornersGeodeIds(modelId);
|
|
137
162
|
if (corners_ids.length === 0) {
|
|
138
163
|
return;
|
|
139
164
|
}
|
|
140
165
|
|
|
141
|
-
|
|
166
|
+
await Promise.all([
|
|
142
167
|
applyModelCornersVisibilityStyle(modelId, corners_ids),
|
|
143
168
|
applyModelCornersColoringStyle(modelId, corners_ids),
|
|
144
169
|
]);
|
|
@@ -33,6 +33,40 @@ interface AttributeInput {
|
|
|
33
33
|
no_data_color?: unknown;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
type IdsFn<Value> = (modelId: string, cornerIds: string[], value: Value) => Promise<void>;
|
|
37
|
+
|
|
38
|
+
interface ModelCornersVertexAttributeApi {
|
|
39
|
+
modelCornersVertexAttributeName: (modelId: string, cornerId?: string) => string | undefined;
|
|
40
|
+
modelCornersVertexAttributeItem: (modelId: string, cornerId?: string) => number;
|
|
41
|
+
modelCornersVertexAttributeRange: (
|
|
42
|
+
modelId: string,
|
|
43
|
+
cornerId?: string,
|
|
44
|
+
) => [number | undefined, number | undefined];
|
|
45
|
+
modelCornersVertexAttributeColorMap: (modelId: string, cornerId?: string) => string | undefined;
|
|
46
|
+
modelCornersVertexAttributeStoredConfig: (
|
|
47
|
+
modelId: string,
|
|
48
|
+
cornerId: string | undefined,
|
|
49
|
+
name: string | undefined,
|
|
50
|
+
item: number | undefined,
|
|
51
|
+
) => AttributeStoredConfig;
|
|
52
|
+
setModelCornersVertexAttribute: (
|
|
53
|
+
modelId: string,
|
|
54
|
+
cornerIds: string[],
|
|
55
|
+
attribute: AttributeInput,
|
|
56
|
+
) => Promise<unknown>;
|
|
57
|
+
setModelCornersVertexAttributeName: IdsFn<string>;
|
|
58
|
+
setModelCornersVertexAttributeItem: IdsFn<number>;
|
|
59
|
+
setModelCornersVertexAttributeRange: (
|
|
60
|
+
modelId: string,
|
|
61
|
+
cornerIds: string[],
|
|
62
|
+
minimum: number,
|
|
63
|
+
maximum: number,
|
|
64
|
+
) => Promise<void>;
|
|
65
|
+
setModelCornersVertexAttributeColorMap: IdsFn<string | undefined>;
|
|
66
|
+
modelCornersVertexAttributeNoDataColor: (modelId: string, cornerId?: string) => unknown;
|
|
67
|
+
setModelCornersVertexAttributeNoDataColor: IdsFn<unknown>;
|
|
68
|
+
}
|
|
69
|
+
|
|
36
70
|
function isModelCornersVertexAttributeValid({
|
|
37
71
|
name,
|
|
38
72
|
item,
|
|
@@ -50,11 +84,12 @@ function isModelCornersVertexAttributeValid({
|
|
|
50
84
|
}
|
|
51
85
|
|
|
52
86
|
// oxlint-disable-next-line max-lines-per-function
|
|
53
|
-
function useModelCornersVertexAttribute() {
|
|
87
|
+
function useModelCornersVertexAttribute(): ModelCornersVertexAttributeApi {
|
|
54
88
|
const dataStore = useDataStore();
|
|
55
89
|
const modelCornersCommonStyle = useModelCornersCommonStyle();
|
|
56
90
|
const viewerStore = useViewerStore();
|
|
57
91
|
function modelCornersVertexAttribute(modelId: string, cornerId?: string): AttributeState {
|
|
92
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- vertex is a StyleValues sub-object stored under a StyleValues index signature.
|
|
58
93
|
return modelCornersCommonStyle.modelCornerColoring(modelId, cornerId).vertex as AttributeState;
|
|
59
94
|
}
|
|
60
95
|
function modelCornersVertexAttributeStoredConfig(
|
|
@@ -63,15 +98,12 @@ function useModelCornersVertexAttribute() {
|
|
|
63
98
|
name: string | undefined,
|
|
64
99
|
item: number | undefined,
|
|
65
100
|
): AttributeStoredConfig {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
item in storedConfigs[name]!
|
|
73
|
-
) {
|
|
74
|
-
return storedConfigs[name]![item]!;
|
|
101
|
+
const storedConfig =
|
|
102
|
+
name !== undefined && item !== undefined
|
|
103
|
+
? modelCornersVertexAttribute(modelId, cornerId).storedConfigs?.[name]?.[item]
|
|
104
|
+
: undefined;
|
|
105
|
+
if (storedConfig !== undefined) {
|
|
106
|
+
return storedConfig;
|
|
75
107
|
}
|
|
76
108
|
return {
|
|
77
109
|
minimum: undefined,
|
|
@@ -80,34 +112,36 @@ function useModelCornersVertexAttribute() {
|
|
|
80
112
|
no_data_color: DEFAULT_NO_DATA_COLOR,
|
|
81
113
|
};
|
|
82
114
|
}
|
|
83
|
-
function mutateModelCornersVertexStyle(
|
|
115
|
+
async function mutateModelCornersVertexStyle(
|
|
84
116
|
modelId: string,
|
|
85
117
|
cornerIds: string[],
|
|
86
118
|
values: Record<string, unknown>,
|
|
87
|
-
) {
|
|
88
|
-
|
|
89
|
-
modelCornersCommonStyle.
|
|
119
|
+
): Promise<void> {
|
|
120
|
+
const tasks: Promise<void>[] = [
|
|
121
|
+
modelCornersCommonStyle.mutateModelCornersColoring(modelId, cornerIds, {
|
|
90
122
|
vertex: values,
|
|
91
|
-
})
|
|
123
|
+
}),
|
|
124
|
+
];
|
|
125
|
+
const totalCornerIds = await dataStore.getCornersGeodeIds(modelId);
|
|
126
|
+
if (cornerIds.length === totalCornerIds.length) {
|
|
127
|
+
tasks.push(
|
|
128
|
+
modelCornersCommonStyle.mutateModelCornersTypeColoring(modelId, { vertex: values }),
|
|
129
|
+
);
|
|
92
130
|
}
|
|
93
|
-
|
|
94
|
-
vertex: values,
|
|
95
|
-
});
|
|
131
|
+
await Promise.all(tasks);
|
|
96
132
|
}
|
|
97
|
-
function setModelCornersVertexAttributeStoredConfig(
|
|
133
|
+
async function setModelCornersVertexAttributeStoredConfig(
|
|
98
134
|
modelId: string,
|
|
99
135
|
cornerIds: string[],
|
|
100
136
|
name: string | undefined,
|
|
101
137
|
item: number | undefined,
|
|
102
138
|
config: Partial<AttributeStoredConfig>,
|
|
103
|
-
) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
},
|
|
110
|
-
},
|
|
139
|
+
): Promise<void> {
|
|
140
|
+
if (name === undefined || item === undefined) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
await mutateModelCornersVertexStyle(modelId, cornerIds, {
|
|
144
|
+
storedConfigs: { [name]: { lastItem: item, [item]: config } },
|
|
111
145
|
});
|
|
112
146
|
}
|
|
113
147
|
function modelCornersVertexAttributeName(modelId: string, cornerId?: string): string | undefined {
|
|
@@ -118,11 +152,11 @@ function useModelCornersVertexAttribute() {
|
|
|
118
152
|
cornerId: string | undefined,
|
|
119
153
|
name: string | undefined,
|
|
120
154
|
): number {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
return storedConfigs[name]!.lastItem;
|
|
155
|
+
if (name === undefined) {
|
|
156
|
+
return 0;
|
|
124
157
|
}
|
|
125
|
-
|
|
158
|
+
const { storedConfigs } = modelCornersVertexAttribute(modelId, cornerId);
|
|
159
|
+
return storedConfigs?.[name]?.lastItem ?? 0;
|
|
126
160
|
}
|
|
127
161
|
function modelCornersVertexAttributeItem(modelId: string, cornerId?: string): number {
|
|
128
162
|
const vertexAttribute = modelCornersVertexAttribute(modelId, cornerId);
|
|
@@ -137,8 +171,12 @@ function useModelCornersVertexAttribute() {
|
|
|
137
171
|
): [number | undefined, number | undefined] {
|
|
138
172
|
const name = modelCornersVertexAttributeName(modelId, cornerId);
|
|
139
173
|
const item = modelCornersVertexAttributeItem(modelId, cornerId);
|
|
140
|
-
const
|
|
141
|
-
|
|
174
|
+
const { minimum, maximum } = modelCornersVertexAttributeStoredConfig(
|
|
175
|
+
modelId,
|
|
176
|
+
cornerId,
|
|
177
|
+
name,
|
|
178
|
+
item,
|
|
179
|
+
);
|
|
142
180
|
return [minimum, maximum];
|
|
143
181
|
}
|
|
144
182
|
function modelCornersVertexAttributeColorMap(
|
|
@@ -147,8 +185,7 @@ function useModelCornersVertexAttribute() {
|
|
|
147
185
|
): string | undefined {
|
|
148
186
|
const name = modelCornersVertexAttributeName(modelId, cornerId);
|
|
149
187
|
const item = modelCornersVertexAttributeItem(modelId, cornerId);
|
|
150
|
-
|
|
151
|
-
return storedConfig.colorMap;
|
|
188
|
+
return modelCornersVertexAttributeStoredConfig(modelId, cornerId, name, item).colorMap;
|
|
152
189
|
}
|
|
153
190
|
async function setModelCornersVertexAttribute(
|
|
154
191
|
modelId: string,
|
|
@@ -161,18 +198,15 @@ function useModelCornersVertexAttribute() {
|
|
|
161
198
|
colorMap,
|
|
162
199
|
no_data_color = DEFAULT_NO_DATA_COLOR,
|
|
163
200
|
}: AttributeInput,
|
|
164
|
-
) {
|
|
165
|
-
mutateModelCornersVertexStyle(modelId, cornerIds, {
|
|
166
|
-
|
|
167
|
-
item,
|
|
168
|
-
});
|
|
169
|
-
setModelCornersVertexAttributeStoredConfig(modelId, cornerIds, name, item, {
|
|
201
|
+
): Promise<unknown> {
|
|
202
|
+
await mutateModelCornersVertexStyle(modelId, cornerIds, { name, item });
|
|
203
|
+
await setModelCornersVertexAttributeStoredConfig(modelId, cornerIds, name, item, {
|
|
170
204
|
minimum,
|
|
171
205
|
maximum,
|
|
172
206
|
colorMap,
|
|
173
207
|
no_data_color,
|
|
174
208
|
});
|
|
175
|
-
const points = getRGBPointsFromPreset(colorMap
|
|
209
|
+
const points = getRGBPointsFromPreset(colorMap ?? "");
|
|
176
210
|
const corner_viewer_ids = await dataStore.getMeshComponentsViewerIds(modelId, cornerIds);
|
|
177
211
|
const params = {
|
|
178
212
|
id: modelId,
|
|
@@ -184,12 +218,10 @@ function useModelCornersVertexAttribute() {
|
|
|
184
218
|
maximum,
|
|
185
219
|
no_data_color,
|
|
186
220
|
};
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
params,
|
|
190
|
-
});
|
|
221
|
+
const result = await viewerStore.request({ schema: attributeSchema, params });
|
|
222
|
+
return result;
|
|
191
223
|
}
|
|
192
|
-
function applyVertexAttribute(modelId: string, cornerIds: string[]) {
|
|
224
|
+
async function applyVertexAttribute(modelId: string, cornerIds: string[]): Promise<void> {
|
|
193
225
|
const name = modelCornersVertexAttributeName(modelId, cornerIds[0]);
|
|
194
226
|
const item = modelCornersVertexAttributeItem(modelId, cornerIds[0]);
|
|
195
227
|
const storedConfig = modelCornersVertexAttributeStoredConfig(modelId, cornerIds[0], name, item);
|
|
@@ -202,61 +234,60 @@ function useModelCornersVertexAttribute() {
|
|
|
202
234
|
no_data_color: storedConfig.no_data_color,
|
|
203
235
|
};
|
|
204
236
|
if (isModelCornersVertexAttributeValid(attribute)) {
|
|
205
|
-
|
|
237
|
+
await setModelCornersVertexAttribute(modelId, cornerIds, attribute);
|
|
206
238
|
}
|
|
207
|
-
return Promise.resolve();
|
|
208
239
|
}
|
|
209
|
-
function setModelCornersVertexAttributeName(
|
|
240
|
+
async function setModelCornersVertexAttributeName(
|
|
241
|
+
modelId: string,
|
|
242
|
+
cornerIds: string[],
|
|
243
|
+
name: string,
|
|
244
|
+
): Promise<void> {
|
|
210
245
|
const item = modelCornersVertexAttributeLastItem(modelId, cornerIds[0], name);
|
|
211
|
-
mutateModelCornersVertexStyle(modelId, cornerIds, {
|
|
212
|
-
|
|
213
|
-
item,
|
|
214
|
-
});
|
|
215
|
-
return applyVertexAttribute(modelId, cornerIds);
|
|
246
|
+
await mutateModelCornersVertexStyle(modelId, cornerIds, { name, item });
|
|
247
|
+
await applyVertexAttribute(modelId, cornerIds);
|
|
216
248
|
}
|
|
217
|
-
function setModelCornersVertexAttributeItem(
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
249
|
+
async function setModelCornersVertexAttributeItem(
|
|
250
|
+
modelId: string,
|
|
251
|
+
cornerIds: string[],
|
|
252
|
+
item: number,
|
|
253
|
+
): Promise<void> {
|
|
254
|
+
await mutateModelCornersVertexStyle(modelId, cornerIds, { item });
|
|
255
|
+
await applyVertexAttribute(modelId, cornerIds);
|
|
222
256
|
}
|
|
223
|
-
function setModelCornersVertexAttributeRange(
|
|
257
|
+
async function setModelCornersVertexAttributeRange(
|
|
224
258
|
modelId: string,
|
|
225
259
|
cornerIds: string[],
|
|
226
260
|
minimum: number,
|
|
227
261
|
maximum: number,
|
|
228
|
-
) {
|
|
262
|
+
): Promise<void> {
|
|
229
263
|
const name = modelCornersVertexAttributeName(modelId, cornerIds[0]);
|
|
230
264
|
const item = modelCornersVertexAttributeItem(modelId, cornerIds[0]);
|
|
231
|
-
setModelCornersVertexAttributeStoredConfig(modelId, cornerIds, name, item, {
|
|
265
|
+
await setModelCornersVertexAttributeStoredConfig(modelId, cornerIds, name, item, {
|
|
232
266
|
minimum,
|
|
233
267
|
maximum,
|
|
234
268
|
});
|
|
235
|
-
|
|
269
|
+
await applyVertexAttribute(modelId, cornerIds);
|
|
236
270
|
}
|
|
237
|
-
function setModelCornersVertexAttributeColorMap(
|
|
271
|
+
async function setModelCornersVertexAttributeColorMap(
|
|
238
272
|
modelId: string,
|
|
239
273
|
cornerIds: string[],
|
|
240
274
|
colorMap: string | undefined,
|
|
241
|
-
) {
|
|
275
|
+
): Promise<void> {
|
|
242
276
|
const name = modelCornersVertexAttributeName(modelId, cornerIds[0]);
|
|
243
277
|
const item = modelCornersVertexAttributeItem(modelId, cornerIds[0]);
|
|
244
|
-
setModelCornersVertexAttributeStoredConfig(modelId, cornerIds, name, item, {
|
|
245
|
-
|
|
246
|
-
});
|
|
247
|
-
return applyVertexAttribute(modelId, cornerIds);
|
|
278
|
+
await setModelCornersVertexAttributeStoredConfig(modelId, cornerIds, name, item, { colorMap });
|
|
279
|
+
await applyVertexAttribute(modelId, cornerIds);
|
|
248
280
|
}
|
|
249
281
|
function modelCornersVertexAttributeNoDataColor(modelId: string, cornerId?: string): unknown {
|
|
250
282
|
const name = modelCornersVertexAttributeName(modelId, cornerId);
|
|
251
283
|
const item = modelCornersVertexAttributeItem(modelId, cornerId);
|
|
252
|
-
|
|
253
|
-
return storedConfig.no_data_color;
|
|
284
|
+
return modelCornersVertexAttributeStoredConfig(modelId, cornerId, name, item).no_data_color;
|
|
254
285
|
}
|
|
255
286
|
async function setModelCornersVertexAttributeNoDataColor(
|
|
256
287
|
modelId: string,
|
|
257
288
|
cornerIds: string[],
|
|
258
289
|
no_data_color: unknown,
|
|
259
|
-
) {
|
|
290
|
+
): Promise<void> {
|
|
260
291
|
const name = modelCornersVertexAttributeName(modelId, cornerIds[0]);
|
|
261
292
|
const item = modelCornersVertexAttributeItem(modelId, cornerIds[0]);
|
|
262
293
|
const storedConfig = modelCornersVertexAttributeStoredConfig(modelId, cornerIds[0], name, item);
|
|
@@ -264,7 +295,7 @@ function useModelCornersVertexAttribute() {
|
|
|
264
295
|
...storedConfig,
|
|
265
296
|
no_data_color,
|
|
266
297
|
});
|
|
267
|
-
|
|
298
|
+
await applyVertexAttribute(modelId, cornerIds);
|
|
268
299
|
}
|
|
269
300
|
return {
|
|
270
301
|
modelCornersVertexAttributeName,
|
|
@@ -4,7 +4,16 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schem
|
|
|
4
4
|
|
|
5
5
|
const schema = viewer_schemas.opengeodeweb_viewer.model.corners.visibility;
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
interface ModelCornersVisibilityApi {
|
|
8
|
+
setModelCornersVisibility: (
|
|
9
|
+
modelId: string,
|
|
10
|
+
corners_ids: string[],
|
|
11
|
+
visibility: boolean | undefined,
|
|
12
|
+
) => Promise<unknown>;
|
|
13
|
+
modelCornerVisibility: (id: string, corner_id?: string) => unknown;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function useModelCornersVisibility(): ModelCornersVisibilityApi {
|
|
8
17
|
const modelCommonStyle = useModelCommonStyle();
|
|
9
18
|
const modelCornersCommonStyle = useModelCornersCommonStyle();
|
|
10
19
|
|
|
@@ -12,12 +21,18 @@ export function useModelCornersVisibility() {
|
|
|
12
21
|
return modelCornersCommonStyle.modelCornerStyle(id, corner_id).visibility;
|
|
13
22
|
}
|
|
14
23
|
|
|
15
|
-
function setModelCornersVisibility(
|
|
24
|
+
async function setModelCornersVisibility(
|
|
16
25
|
modelId: string,
|
|
17
26
|
corners_ids: string[],
|
|
18
27
|
visibility: boolean | undefined,
|
|
19
|
-
) {
|
|
20
|
-
|
|
28
|
+
): Promise<unknown> {
|
|
29
|
+
const result = await modelCommonStyle.setModelTypeVisibility(
|
|
30
|
+
modelId,
|
|
31
|
+
corners_ids,
|
|
32
|
+
visibility,
|
|
33
|
+
schema,
|
|
34
|
+
);
|
|
35
|
+
return result;
|
|
21
36
|
}
|
|
22
37
|
|
|
23
38
|
return { setModelCornersVisibility, modelCornerVisibility };
|