@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
|
@@ -49,11 +49,38 @@ function isMeshPointsVertexAttributeValid({
|
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
interface UseMeshPointsVertexAttributeStyleReturn {
|
|
53
|
+
meshPointsVertexAttributeName: (id: string) => string | undefined;
|
|
54
|
+
meshPointsVertexAttributeItem: (id: string) => number;
|
|
55
|
+
meshPointsVertexAttributeRange: (id: string) => [number | undefined, number | undefined];
|
|
56
|
+
meshPointsVertexAttributeColorMap: (id: string) => string | undefined;
|
|
57
|
+
meshPointsVertexAttributeStoredConfig: (
|
|
58
|
+
id: string,
|
|
59
|
+
name: string | undefined,
|
|
60
|
+
item: number | undefined,
|
|
61
|
+
) => AttributeStoredConfig;
|
|
62
|
+
setMeshPointsVertexAttribute: (id: string, input: AttributeInput) => Promise<unknown>;
|
|
63
|
+
setMeshPointsVertexAttributeName: (id: string, name: string) => Promise<unknown>;
|
|
64
|
+
setMeshPointsVertexAttributeItem: (id: string, item: number) => Promise<unknown>;
|
|
65
|
+
setMeshPointsVertexAttributeRange: (
|
|
66
|
+
id: string,
|
|
67
|
+
minimum: number,
|
|
68
|
+
maximum: number,
|
|
69
|
+
) => Promise<unknown>;
|
|
70
|
+
setMeshPointsVertexAttributeColorMap: (
|
|
71
|
+
id: string,
|
|
72
|
+
colorMap: string | undefined,
|
|
73
|
+
) => Promise<unknown>;
|
|
74
|
+
meshPointsVertexAttributeNoDataColor: (id: string) => unknown;
|
|
75
|
+
setMeshPointsVertexAttributeNoDataColor: (id: string, no_data_color: unknown) => Promise<unknown>;
|
|
76
|
+
}
|
|
77
|
+
|
|
52
78
|
// oxlint-disable-next-line max-lines-per-function
|
|
53
|
-
function useMeshPointsVertexAttributeStyle() {
|
|
79
|
+
function useMeshPointsVertexAttributeStyle(): UseMeshPointsVertexAttributeStyleReturn {
|
|
54
80
|
const viewerStore = useViewerStore();
|
|
55
81
|
const meshPointsCommonStyle = useMeshPointsCommonStyle();
|
|
56
82
|
function meshPointsVertexAttribute(id: string): AttributeState {
|
|
83
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.vertex shape is defined by the data style schema.
|
|
57
84
|
return meshPointsCommonStyle.meshPointsColoring(id).vertex as AttributeState;
|
|
58
85
|
}
|
|
59
86
|
function meshPointsVertexAttributeStoredConfig(
|
|
@@ -62,14 +89,10 @@ function useMeshPointsVertexAttributeStyle() {
|
|
|
62
89
|
item: number | undefined,
|
|
63
90
|
): AttributeStoredConfig {
|
|
64
91
|
const { storedConfigs } = meshPointsVertexAttribute(id);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
item !== undefined &&
|
|
70
|
-
item in storedConfigs[name]!
|
|
71
|
-
) {
|
|
72
|
-
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;
|
|
73
96
|
}
|
|
74
97
|
return {
|
|
75
98
|
minimum: undefined,
|
|
@@ -78,35 +101,41 @@ function useMeshPointsVertexAttributeStyle() {
|
|
|
78
101
|
no_data_color: DEFAULT_NO_DATA_COLOR,
|
|
79
102
|
};
|
|
80
103
|
}
|
|
81
|
-
function mutateMeshPointsVertexStyle(
|
|
82
|
-
|
|
104
|
+
async function mutateMeshPointsVertexStyle(
|
|
105
|
+
id: string,
|
|
106
|
+
values: Record<string, unknown>,
|
|
107
|
+
): Promise<string> {
|
|
108
|
+
const result = await meshPointsCommonStyle.mutateMeshPointsStyle(id, {
|
|
83
109
|
coloring: {
|
|
84
110
|
vertex: values,
|
|
85
111
|
},
|
|
86
112
|
});
|
|
113
|
+
return result;
|
|
87
114
|
}
|
|
88
|
-
function setMeshPointsVertexAttributeStoredConfig(
|
|
115
|
+
async function setMeshPointsVertexAttributeStoredConfig(
|
|
89
116
|
id: string,
|
|
90
117
|
name: string | undefined,
|
|
91
118
|
item: number | undefined,
|
|
92
119
|
config: Partial<AttributeStoredConfig>,
|
|
93
|
-
) {
|
|
94
|
-
|
|
120
|
+
): Promise<string> {
|
|
121
|
+
const result = await mutateMeshPointsVertexStyle(id, {
|
|
95
122
|
storedConfigs: {
|
|
96
|
-
[name
|
|
123
|
+
[name ?? ""]: {
|
|
97
124
|
lastItem: item,
|
|
98
|
-
[item
|
|
125
|
+
[item ?? 0]: config,
|
|
99
126
|
},
|
|
100
127
|
},
|
|
101
128
|
});
|
|
129
|
+
return result;
|
|
102
130
|
}
|
|
103
131
|
function meshPointsVertexAttributeName(id: string): string | undefined {
|
|
104
132
|
return meshPointsVertexAttribute(id).name;
|
|
105
133
|
}
|
|
106
134
|
function meshPointsVertexAttributeLastItem(id: string, name: string | undefined): number {
|
|
107
135
|
const { storedConfigs } = meshPointsVertexAttribute(id);
|
|
108
|
-
|
|
109
|
-
|
|
136
|
+
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
137
|
+
if (nameConfig !== undefined) {
|
|
138
|
+
return nameConfig.lastItem;
|
|
110
139
|
}
|
|
111
140
|
return 0;
|
|
112
141
|
}
|
|
@@ -114,7 +143,7 @@ function useMeshPointsVertexAttributeStyle() {
|
|
|
114
143
|
const { item, name } = meshPointsVertexAttribute(id);
|
|
115
144
|
return item ?? meshPointsVertexAttributeLastItem(id, name);
|
|
116
145
|
}
|
|
117
|
-
function setMeshPointsVertexAttribute(
|
|
146
|
+
async function setMeshPointsVertexAttribute(
|
|
118
147
|
id: string,
|
|
119
148
|
{
|
|
120
149
|
name,
|
|
@@ -124,18 +153,18 @@ function useMeshPointsVertexAttributeStyle() {
|
|
|
124
153
|
colorMap,
|
|
125
154
|
no_data_color = DEFAULT_NO_DATA_COLOR,
|
|
126
155
|
}: AttributeInput,
|
|
127
|
-
) {
|
|
128
|
-
mutateMeshPointsVertexStyle(id, {
|
|
156
|
+
): Promise<unknown> {
|
|
157
|
+
await mutateMeshPointsVertexStyle(id, {
|
|
129
158
|
name,
|
|
130
159
|
item,
|
|
131
160
|
});
|
|
132
|
-
setMeshPointsVertexAttributeStoredConfig(id, name, item, {
|
|
161
|
+
await setMeshPointsVertexAttributeStoredConfig(id, name, item, {
|
|
133
162
|
minimum,
|
|
134
163
|
maximum,
|
|
135
164
|
colorMap,
|
|
136
165
|
no_data_color,
|
|
137
166
|
});
|
|
138
|
-
const points = getRGBPointsFromPreset(colorMap
|
|
167
|
+
const points = getRGBPointsFromPreset(colorMap ?? "");
|
|
139
168
|
const schema = meshPointsVertexAttributeSchemas.attribute;
|
|
140
169
|
const params = {
|
|
141
170
|
id,
|
|
@@ -151,7 +180,7 @@ function useMeshPointsVertexAttributeStyle() {
|
|
|
151
180
|
params,
|
|
152
181
|
});
|
|
153
182
|
}
|
|
154
|
-
function applyVertexAttribute(id: string) {
|
|
183
|
+
async function applyVertexAttribute(id: string): Promise<unknown> {
|
|
155
184
|
const name = meshPointsVertexAttributeName(id);
|
|
156
185
|
const item = meshPointsVertexAttributeItem(id);
|
|
157
186
|
const storedConfig = meshPointsVertexAttributeStoredConfig(id, name, item);
|
|
@@ -164,19 +193,21 @@ function useMeshPointsVertexAttributeStyle() {
|
|
|
164
193
|
no_data_color: storedConfig.no_data_color,
|
|
165
194
|
};
|
|
166
195
|
if (isMeshPointsVertexAttributeValid(attribute)) {
|
|
167
|
-
|
|
196
|
+
const result = await setMeshPointsVertexAttribute(id, attribute);
|
|
197
|
+
return result;
|
|
168
198
|
}
|
|
199
|
+
return undefined;
|
|
169
200
|
}
|
|
170
|
-
function setMeshPointsVertexAttributeName(id: string, name: string) {
|
|
201
|
+
async function setMeshPointsVertexAttributeName(id: string, name: string): Promise<unknown> {
|
|
171
202
|
const item = meshPointsVertexAttributeLastItem(id, name);
|
|
172
|
-
mutateMeshPointsVertexStyle(id, {
|
|
203
|
+
await mutateMeshPointsVertexStyle(id, {
|
|
173
204
|
name,
|
|
174
205
|
item,
|
|
175
206
|
});
|
|
176
207
|
return applyVertexAttribute(id);
|
|
177
208
|
}
|
|
178
|
-
function setMeshPointsVertexAttributeItem(id: string, item: number) {
|
|
179
|
-
mutateMeshPointsVertexStyle(id, {
|
|
209
|
+
async function setMeshPointsVertexAttributeItem(id: string, item: number): Promise<unknown> {
|
|
210
|
+
await mutateMeshPointsVertexStyle(id, {
|
|
180
211
|
item,
|
|
181
212
|
});
|
|
182
213
|
return applyVertexAttribute(id);
|
|
@@ -187,10 +218,14 @@ function useMeshPointsVertexAttributeStyle() {
|
|
|
187
218
|
const storedConfig = meshPointsVertexAttributeStoredConfig(id, name, item);
|
|
188
219
|
return [storedConfig.minimum, storedConfig.maximum];
|
|
189
220
|
}
|
|
190
|
-
function setMeshPointsVertexAttributeRange(
|
|
221
|
+
async function setMeshPointsVertexAttributeRange(
|
|
222
|
+
id: string,
|
|
223
|
+
minimum: number,
|
|
224
|
+
maximum: number,
|
|
225
|
+
): Promise<unknown> {
|
|
191
226
|
const name = meshPointsVertexAttributeName(id);
|
|
192
227
|
const item = meshPointsVertexAttributeItem(id);
|
|
193
|
-
setMeshPointsVertexAttributeStoredConfig(id, name, item, {
|
|
228
|
+
await setMeshPointsVertexAttributeStoredConfig(id, name, item, {
|
|
194
229
|
minimum,
|
|
195
230
|
maximum,
|
|
196
231
|
});
|
|
@@ -202,10 +237,13 @@ function useMeshPointsVertexAttributeStyle() {
|
|
|
202
237
|
const storedConfig = meshPointsVertexAttributeStoredConfig(id, name, item);
|
|
203
238
|
return storedConfig.colorMap;
|
|
204
239
|
}
|
|
205
|
-
function setMeshPointsVertexAttributeColorMap(
|
|
240
|
+
async function setMeshPointsVertexAttributeColorMap(
|
|
241
|
+
id: string,
|
|
242
|
+
colorMap: string | undefined,
|
|
243
|
+
): Promise<unknown> {
|
|
206
244
|
const name = meshPointsVertexAttributeName(id);
|
|
207
245
|
const item = meshPointsVertexAttributeItem(id);
|
|
208
|
-
setMeshPointsVertexAttributeStoredConfig(id, name, item, {
|
|
246
|
+
await setMeshPointsVertexAttributeStoredConfig(id, name, item, {
|
|
209
247
|
colorMap,
|
|
210
248
|
});
|
|
211
249
|
return applyVertexAttribute(id);
|
|
@@ -216,7 +254,10 @@ function useMeshPointsVertexAttributeStyle() {
|
|
|
216
254
|
const storedConfig = meshPointsVertexAttributeStoredConfig(id, name, item);
|
|
217
255
|
return storedConfig.no_data_color;
|
|
218
256
|
}
|
|
219
|
-
async function setMeshPointsVertexAttributeNoDataColor(
|
|
257
|
+
async function setMeshPointsVertexAttributeNoDataColor(
|
|
258
|
+
id: string,
|
|
259
|
+
no_data_color: unknown,
|
|
260
|
+
): Promise<unknown> {
|
|
220
261
|
const name = meshPointsVertexAttributeName(id);
|
|
221
262
|
const item = meshPointsVertexAttributeItem(id);
|
|
222
263
|
const storedConfig = meshPointsVertexAttributeStoredConfig(id, name, item);
|
|
@@ -8,28 +8,38 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
|
8
8
|
// Local constants
|
|
9
9
|
const schema = viewer_schemas.opengeodeweb_viewer.mesh.points.visibility;
|
|
10
10
|
|
|
11
|
-
export function useMeshPointsVisibilityStyle() {
|
|
11
|
+
export function useMeshPointsVisibilityStyle(): {
|
|
12
|
+
meshPointsVisibility: (id: string) => boolean | undefined;
|
|
13
|
+
setMeshPointsVisibility: (id: string, visibility: boolean | undefined) => Promise<unknown>;
|
|
14
|
+
} {
|
|
12
15
|
const viewerStore = useViewerStore();
|
|
13
16
|
const meshPointsCommonStyle = useMeshPointsCommonStyle();
|
|
14
17
|
|
|
15
18
|
function meshPointsVisibility(id: string): boolean | undefined {
|
|
19
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- visibility is defined as boolean in the data style schema.
|
|
16
20
|
return meshPointsCommonStyle.meshPointsStyle(id).visibility as boolean | undefined;
|
|
17
21
|
}
|
|
18
|
-
function setMeshPointsVisibility(
|
|
22
|
+
async function setMeshPointsVisibility(
|
|
23
|
+
id: string,
|
|
24
|
+
visibility: boolean | undefined,
|
|
25
|
+
): Promise<unknown> {
|
|
19
26
|
const params = { id, visibility };
|
|
20
|
-
|
|
27
|
+
const result = await viewerStore.request(
|
|
21
28
|
{
|
|
22
29
|
schema,
|
|
23
30
|
params,
|
|
24
31
|
},
|
|
25
32
|
{
|
|
26
|
-
response_function(response: unknown) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
response_function: async (response: unknown) => {
|
|
34
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- response shape is defined by the viewer schema.
|
|
35
|
+
const typedResponse = response as { id: string; visibility: boolean };
|
|
36
|
+
const mutateResult =
|
|
37
|
+
await meshPointsCommonStyle.mutateMeshPointsVisibility(typedResponse);
|
|
38
|
+
return mutateResult;
|
|
30
39
|
},
|
|
31
40
|
},
|
|
32
41
|
);
|
|
42
|
+
return result;
|
|
33
43
|
}
|
|
34
44
|
|
|
35
45
|
return {
|
|
@@ -8,27 +8,33 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
|
8
8
|
// Local constants
|
|
9
9
|
const schema = viewer_schemas.opengeodeweb_viewer.mesh.polygons.color;
|
|
10
10
|
|
|
11
|
-
export function useMeshPolygonsColorStyle() {
|
|
11
|
+
export function useMeshPolygonsColorStyle(): {
|
|
12
|
+
meshPolygonsColor: (id: string) => unknown;
|
|
13
|
+
setMeshPolygonsColor: (id: string, color: unknown) => Promise<unknown>;
|
|
14
|
+
} {
|
|
12
15
|
const viewerStore = useViewerStore();
|
|
13
16
|
const meshPolygonsCommonStyle = useMeshPolygonsCommonStyle();
|
|
14
17
|
|
|
15
18
|
function meshPolygonsColor(id: string): unknown {
|
|
16
19
|
return meshPolygonsCommonStyle.meshPolygonsColoring(id).constant;
|
|
17
20
|
}
|
|
18
|
-
function setMeshPolygonsColor(id: string, color: unknown) {
|
|
21
|
+
async function setMeshPolygonsColor(id: string, color: unknown): Promise<unknown> {
|
|
19
22
|
const params = { id, color };
|
|
20
|
-
|
|
23
|
+
const result = await viewerStore.request(
|
|
21
24
|
{
|
|
22
25
|
schema,
|
|
23
26
|
params,
|
|
24
27
|
},
|
|
25
28
|
{
|
|
26
|
-
response_function: () =>
|
|
27
|
-
meshPolygonsCommonStyle.mutateMeshPolygonsColoring(id, {
|
|
29
|
+
response_function: async () => {
|
|
30
|
+
const mutateResult = await meshPolygonsCommonStyle.mutateMeshPolygonsColoring(id, {
|
|
28
31
|
constant: color,
|
|
29
|
-
})
|
|
32
|
+
});
|
|
33
|
+
return mutateResult;
|
|
34
|
+
},
|
|
30
35
|
},
|
|
31
36
|
);
|
|
37
|
+
return result;
|
|
32
38
|
}
|
|
33
39
|
|
|
34
40
|
return {
|
|
@@ -1,27 +1,43 @@
|
|
|
1
1
|
import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
|
|
2
2
|
import { useDataStyleState } from "@ogw_internal/stores/data_style/state";
|
|
3
3
|
|
|
4
|
-
export function useMeshPolygonsCommonStyle() {
|
|
4
|
+
export function useMeshPolygonsCommonStyle(): {
|
|
5
|
+
meshPolygonsStyle: (id: string) => StyleValues;
|
|
6
|
+
meshPolygonsColoring: (id: string) => StyleValues;
|
|
7
|
+
mutateMeshPolygonsStyle: (id: string, values: StyleValues) => Promise<string>;
|
|
8
|
+
mutateMeshPolygonsColoring: (id: string, values: StyleValues) => Promise<string>;
|
|
9
|
+
mutateMeshPolygonsPolygonStyle: (id: string, values: StyleValues) => Promise<string>;
|
|
10
|
+
} {
|
|
5
11
|
const dataStyleState = useDataStyleState();
|
|
6
12
|
|
|
7
|
-
function mutateMeshPolygonsStyle(id: string, values: StyleValues) {
|
|
8
|
-
|
|
13
|
+
async function mutateMeshPolygonsStyle(id: string, values: StyleValues): Promise<string> {
|
|
14
|
+
const result = await dataStyleState.mutateStyle(id, {
|
|
9
15
|
polygons: values,
|
|
10
16
|
});
|
|
17
|
+
return result;
|
|
11
18
|
}
|
|
12
19
|
|
|
13
20
|
function meshPolygonsStyle(id: string): StyleValues {
|
|
14
|
-
return dataStyleState.getStyle(id).polygons
|
|
21
|
+
return dataStyleState.getStyle(id).polygons ?? {};
|
|
15
22
|
}
|
|
16
23
|
|
|
17
24
|
function meshPolygonsColoring(id: string): StyleValues {
|
|
25
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring shape is defined by the data style schema.
|
|
18
26
|
return meshPolygonsStyle(id).coloring as StyleValues;
|
|
19
27
|
}
|
|
20
28
|
|
|
21
|
-
function mutateMeshPolygonsColoring(id: string, values: StyleValues) {
|
|
22
|
-
|
|
29
|
+
async function mutateMeshPolygonsColoring(id: string, values: StyleValues): Promise<string> {
|
|
30
|
+
const result = await mutateMeshPolygonsStyle(id, {
|
|
23
31
|
coloring: values,
|
|
24
32
|
});
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async function mutateMeshPolygonsPolygonStyle(id: string, values: StyleValues): Promise<string> {
|
|
37
|
+
const result = await mutateMeshPolygonsColoring(id, {
|
|
38
|
+
polygon: values,
|
|
39
|
+
});
|
|
40
|
+
return result;
|
|
25
41
|
}
|
|
26
42
|
|
|
27
43
|
return {
|
|
@@ -29,5 +45,6 @@ export function useMeshPolygonsCommonStyle() {
|
|
|
29
45
|
meshPolygonsColoring,
|
|
30
46
|
mutateMeshPolygonsStyle,
|
|
31
47
|
mutateMeshPolygonsColoring,
|
|
48
|
+
mutateMeshPolygonsPolygonStyle,
|
|
32
49
|
};
|
|
33
50
|
}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
useMeshPolygonsPolygonAttributeStyle,
|
|
7
7
|
} from "./polygon";
|
|
8
8
|
import { isMeshPolygonsVertexAttributeValid, useMeshPolygonsVertexAttributeStyle } from "./vertex";
|
|
9
|
+
import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
|
|
9
10
|
import { useMeshPolygonsColorStyle } from "./color";
|
|
10
11
|
import { useMeshPolygonsCommonStyle } from "./common";
|
|
11
12
|
import { useMeshPolygonsTexturesStyle } from "./textures";
|
|
@@ -13,95 +14,154 @@ import { useMeshPolygonsVisibilityStyle } from "./visibility";
|
|
|
13
14
|
|
|
14
15
|
// Local constants
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
interface MeshPolygonsActiveColoringDeps {
|
|
18
|
+
readonly commonStyle: ReturnType<typeof useMeshPolygonsCommonStyle>;
|
|
19
|
+
readonly colorStyle: ReturnType<typeof useMeshPolygonsColorStyle>;
|
|
20
|
+
readonly texturesStyle: ReturnType<typeof useMeshPolygonsTexturesStyle>;
|
|
21
|
+
readonly vertexAttributeStyle: ReturnType<typeof useMeshPolygonsVertexAttributeStyle>;
|
|
22
|
+
readonly polygonAttributeStyle: ReturnType<typeof useMeshPolygonsPolygonAttributeStyle>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function handleMeshPolygonsVertexColoring(
|
|
26
|
+
id: string,
|
|
27
|
+
vertexAttributeStyle: ReturnType<typeof useMeshPolygonsVertexAttributeStyle>,
|
|
28
|
+
): Promise<unknown> | undefined {
|
|
29
|
+
const name = vertexAttributeStyle.meshPolygonsVertexAttributeName(id);
|
|
30
|
+
const item = vertexAttributeStyle.meshPolygonsVertexAttributeItem(id);
|
|
31
|
+
const [minimum, maximum] = vertexAttributeStyle.meshPolygonsVertexAttributeRange(id);
|
|
32
|
+
const colorMap = vertexAttributeStyle.meshPolygonsVertexAttributeColorMap(id);
|
|
33
|
+
const vertex_attribute = { name, item, minimum, maximum, colorMap };
|
|
34
|
+
if (!isMeshPolygonsVertexAttributeValid(vertex_attribute)) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
return vertexAttributeStyle.setMeshPolygonsVertexAttribute(id, vertex_attribute);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function handleMeshPolygonsPolygonColoring(
|
|
41
|
+
id: string,
|
|
42
|
+
polygonAttributeStyle: ReturnType<typeof useMeshPolygonsPolygonAttributeStyle>,
|
|
43
|
+
): Promise<unknown> | undefined {
|
|
44
|
+
const name = polygonAttributeStyle.meshPolygonsPolygonAttributeName(id);
|
|
45
|
+
const item = polygonAttributeStyle.meshPolygonsPolygonAttributeItem(id);
|
|
46
|
+
const [minimum, maximum] = polygonAttributeStyle.meshPolygonsPolygonAttributeRange(id);
|
|
47
|
+
const colorMap = polygonAttributeStyle.meshPolygonsPolygonAttributeColorMap(id);
|
|
48
|
+
const polygon_attribute = { name, item, minimum, maximum, colorMap };
|
|
49
|
+
if (!isMeshPolygonsPolygonAttributeValid(polygon_attribute)) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
return polygonAttributeStyle.setMeshPolygonsPolygonAttribute(id, polygon_attribute);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async function setMeshPolygonsActiveColoring(
|
|
56
|
+
id: string,
|
|
57
|
+
type: string | undefined,
|
|
58
|
+
deps: MeshPolygonsActiveColoringDeps,
|
|
59
|
+
): Promise<unknown> {
|
|
60
|
+
await deps.commonStyle.mutateMeshPolygonsStyle(id, {
|
|
61
|
+
coloring: { active: type },
|
|
62
|
+
});
|
|
63
|
+
if (type === "constant") {
|
|
64
|
+
const result = await deps.colorStyle.setMeshPolygonsColor(
|
|
65
|
+
id,
|
|
66
|
+
deps.colorStyle.meshPolygonsColor(id),
|
|
67
|
+
);
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
if (type === "textures") {
|
|
71
|
+
const result = await deps.texturesStyle.setMeshPolygonsTextures(
|
|
72
|
+
id,
|
|
73
|
+
deps.texturesStyle.meshPolygonsTextures(id),
|
|
74
|
+
);
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
if (type === "vertex") {
|
|
78
|
+
const result = await handleMeshPolygonsVertexColoring(id, deps.vertexAttributeStyle);
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
if (type === "polygon") {
|
|
82
|
+
const result = await handleMeshPolygonsPolygonColoring(id, deps.polygonAttributeStyle);
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
throw new Error(`Unknown mesh polygons coloring type: ${type}`);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async function applyMeshPolygonsStyle(
|
|
89
|
+
id: string,
|
|
90
|
+
visibilityStyle: ReturnType<typeof useMeshPolygonsVisibilityStyle>,
|
|
91
|
+
activeColoringType: string | undefined,
|
|
92
|
+
deps: MeshPolygonsActiveColoringDeps,
|
|
93
|
+
): Promise<unknown[]> {
|
|
94
|
+
const result = await Promise.all([
|
|
95
|
+
visibilityStyle.setMeshPolygonsVisibility(id, visibilityStyle.meshPolygonsVisibility(id)),
|
|
96
|
+
setMeshPolygonsActiveColoring(id, activeColoringType, deps),
|
|
97
|
+
]);
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
type UseMeshPolygonsStyleReturn = ReturnType<typeof useMeshPolygonsCommonStyle> & {
|
|
102
|
+
meshPolygonsColoring: (id: string) => StyleValues;
|
|
103
|
+
meshPolygonsActiveColoring: (id: string) => string | undefined;
|
|
104
|
+
setMeshPolygonsActiveColoring: (id: string, type: string | undefined) => Promise<unknown>;
|
|
105
|
+
applyMeshPolygonsStyle: (id: string) => Promise<unknown[]>;
|
|
106
|
+
} & ReturnType<typeof useMeshPolygonsVisibilityStyle> &
|
|
107
|
+
ReturnType<typeof useMeshPolygonsColorStyle> &
|
|
108
|
+
ReturnType<typeof useMeshPolygonsTexturesStyle> &
|
|
109
|
+
ReturnType<typeof useMeshPolygonsVertexAttributeStyle> &
|
|
110
|
+
ReturnType<typeof useMeshPolygonsPolygonAttributeStyle>;
|
|
111
|
+
|
|
112
|
+
export function useMeshPolygonsStyle(): UseMeshPolygonsStyleReturn {
|
|
17
113
|
const meshPolygonsCommonStyle = useMeshPolygonsCommonStyle();
|
|
114
|
+
const meshPolygonsVisibility = useMeshPolygonsVisibilityStyle();
|
|
18
115
|
const meshPolygonsColorStyle = useMeshPolygonsColorStyle();
|
|
19
|
-
const
|
|
116
|
+
const meshPolygonsTexturesStore = useMeshPolygonsTexturesStyle();
|
|
20
117
|
const meshPolygonsVertexAttributeStyle = useMeshPolygonsVertexAttributeStyle();
|
|
21
118
|
const meshPolygonsPolygonAttributeStyle = useMeshPolygonsPolygonAttributeStyle();
|
|
22
119
|
|
|
23
|
-
|
|
120
|
+
const activeColoringDeps: MeshPolygonsActiveColoringDeps = {
|
|
121
|
+
commonStyle: meshPolygonsCommonStyle,
|
|
122
|
+
colorStyle: meshPolygonsColorStyle,
|
|
123
|
+
texturesStyle: meshPolygonsTexturesStore,
|
|
124
|
+
vertexAttributeStyle: meshPolygonsVertexAttributeStyle,
|
|
125
|
+
polygonAttributeStyle: meshPolygonsPolygonAttributeStyle,
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
function meshPolygonsColoring(id: string): StyleValues {
|
|
24
129
|
return meshPolygonsCommonStyle.meshPolygonsColoring(id);
|
|
25
130
|
}
|
|
26
131
|
|
|
27
132
|
function meshPolygonsActiveColoring(id: string): string | undefined {
|
|
133
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.active is defined as string in the data style schema.
|
|
28
134
|
return meshPolygonsColoring(id).active as string | undefined;
|
|
29
135
|
}
|
|
30
136
|
|
|
31
|
-
async function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const item = meshPolygonsVertexAttributeStyle.meshPolygonsVertexAttributeItem(id);
|
|
48
|
-
const [minimum, maximum] =
|
|
49
|
-
meshPolygonsVertexAttributeStyle.meshPolygonsVertexAttributeRange(id);
|
|
50
|
-
const colorMap = meshPolygonsVertexAttributeStyle.meshPolygonsVertexAttributeColorMap(id);
|
|
51
|
-
const vertex_attribute = { name, item, minimum, maximum, colorMap };
|
|
52
|
-
if (!isMeshPolygonsVertexAttributeValid(vertex_attribute)) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
return meshPolygonsVertexAttributeStyle.setMeshPolygonsVertexAttribute(id, vertex_attribute);
|
|
56
|
-
}
|
|
57
|
-
if (type === "polygon") {
|
|
58
|
-
const name = meshPolygonsPolygonAttributeStyle.meshPolygonsPolygonAttributeName(id);
|
|
59
|
-
const item = meshPolygonsPolygonAttributeStyle.meshPolygonsPolygonAttributeItem(id);
|
|
60
|
-
const [minimum, maximum] =
|
|
61
|
-
meshPolygonsPolygonAttributeStyle.meshPolygonsPolygonAttributeRange(id);
|
|
62
|
-
const colorMap = meshPolygonsPolygonAttributeStyle.meshPolygonsPolygonAttributeColorMap(id);
|
|
63
|
-
const polygon_attribute = { name, item, minimum, maximum, colorMap };
|
|
64
|
-
if (!isMeshPolygonsPolygonAttributeValid(polygon_attribute)) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
return meshPolygonsPolygonAttributeStyle.setMeshPolygonsPolygonAttribute(
|
|
68
|
-
id,
|
|
69
|
-
polygon_attribute,
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
throw new Error(`Unknown mesh polygons coloring type: ${type}`);
|
|
137
|
+
async function boundSetMeshPolygonsActiveColoring(
|
|
138
|
+
id: string,
|
|
139
|
+
type: string | undefined,
|
|
140
|
+
): Promise<unknown> {
|
|
141
|
+
const result = await setMeshPolygonsActiveColoring(id, type, activeColoringDeps);
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async function boundApplyMeshPolygonsStyle(id: string): Promise<unknown[]> {
|
|
146
|
+
const result = await applyMeshPolygonsStyle(
|
|
147
|
+
id,
|
|
148
|
+
meshPolygonsVisibility,
|
|
149
|
+
meshPolygonsActiveColoring(id),
|
|
150
|
+
activeColoringDeps,
|
|
151
|
+
);
|
|
152
|
+
return result;
|
|
73
153
|
}
|
|
74
154
|
|
|
75
155
|
return {
|
|
156
|
+
...meshPolygonsCommonStyle,
|
|
76
157
|
meshPolygonsColoring,
|
|
77
158
|
meshPolygonsActiveColoring,
|
|
78
|
-
setMeshPolygonsActiveColoring,
|
|
159
|
+
setMeshPolygonsActiveColoring: boundSetMeshPolygonsActiveColoring,
|
|
160
|
+
applyMeshPolygonsStyle: boundApplyMeshPolygonsStyle,
|
|
161
|
+
...meshPolygonsVisibility,
|
|
79
162
|
...meshPolygonsColorStyle,
|
|
80
|
-
...
|
|
163
|
+
...meshPolygonsTexturesStore,
|
|
81
164
|
...meshPolygonsVertexAttributeStyle,
|
|
82
165
|
...meshPolygonsPolygonAttributeStyle,
|
|
83
166
|
};
|
|
84
167
|
}
|
|
85
|
-
|
|
86
|
-
export function useMeshPolygonsStyle() {
|
|
87
|
-
const meshPolygonsCommonStyle = useMeshPolygonsCommonStyle();
|
|
88
|
-
const meshPolygonsVisibility = useMeshPolygonsVisibilityStyle();
|
|
89
|
-
const coloringStyle = useMeshPolygonsColoringStyle();
|
|
90
|
-
|
|
91
|
-
function applyMeshPolygonsStyle(id: string) {
|
|
92
|
-
return Promise.all([
|
|
93
|
-
meshPolygonsVisibility.setMeshPolygonsVisibility(
|
|
94
|
-
id,
|
|
95
|
-
meshPolygonsVisibility.meshPolygonsVisibility(id),
|
|
96
|
-
),
|
|
97
|
-
coloringStyle.setMeshPolygonsActiveColoring(id, coloringStyle.meshPolygonsActiveColoring(id)),
|
|
98
|
-
]);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return {
|
|
102
|
-
...meshPolygonsCommonStyle,
|
|
103
|
-
...coloringStyle,
|
|
104
|
-
applyMeshPolygonsStyle,
|
|
105
|
-
...meshPolygonsVisibility,
|
|
106
|
-
};
|
|
107
|
-
}
|