@geode/opengeodeweb-front 10.43.2 → 10.44.0-rc.10
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/.build/server/utils/cleanup.js +7 -2
- package/.build/server/utils/microservices.js +9 -81
- package/.build/server/utils/microservices_process.js +85 -0
- package/.build/server/utils/scripts.js +34 -23
- package/.build/server/utils/typed_handler.js +5 -1
- package/.build/server/utils/ws_client.js +7 -2
- package/.build/shared/utils/fetch_raw.js +2 -2
- package/.build/shared/utils/parse_boolean.js +2 -1
- package/app/assets/geode_objects.ts +1 -0
- package/app/components/BasemapAttribution.vue +28 -0
- package/app/components/ClippingPlanes.vue +22 -78
- package/app/components/CrsSelector.vue +53 -46
- package/app/components/DragAndDrop.vue +16 -79
- package/app/components/FeedBack/Snackers.vue +27 -0
- package/app/components/FileSelector.vue +9 -6
- package/app/components/HybridViewerTooltip.vue +8 -2
- package/app/components/MissingFilesSelector.vue +40 -23
- package/app/components/ObjectSelector.vue +34 -20
- package/app/components/ProjectCrs.vue +37 -0
- package/app/components/Screenshot.vue +17 -59
- package/app/components/ThresholdCard.vue +205 -0
- package/app/components/ThresholdFilter.vue +81 -216
- package/app/components/ViewToolbar.vue +15 -231
- package/app/components/Viewer/Basemap/CropOptions.vue +50 -0
- package/app/components/Viewer/Basemap/OpacityOptions.vue +52 -0
- package/app/components/Viewer/ContextMenu/CircularItems.vue +1 -2
- package/app/components/Viewer/ContextMenu/ContextMenu.vue +11 -6
- package/app/components/Viewer/ContextMenu/ContextMenuItem.vue +10 -7
- package/app/components/Viewer/ContextMenu/InfoCard.vue +30 -0
- package/app/components/Viewer/EdgedCurve/SpecificEdgesColoring.vue +209 -0
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +3 -191
- package/app/components/Viewer/Generic/Mesh/CellsColoring.vue +221 -0
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +3 -210
- package/app/components/Viewer/Generic/Mesh/EdgesColoring.vue +211 -0
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +3 -192
- package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +13 -0
- package/app/components/Viewer/Generic/Mesh/PolygonsColoring.vue +227 -0
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +3 -215
- package/app/components/Viewer/Generic/Mesh/PolyhedraColoring.vue +221 -0
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +3 -203
- package/app/components/Viewer/Generic/Model/BlocksOptions.vue +14 -12
- package/app/components/Viewer/Generic/Model/ComponentPointsOptions.vue +2 -18
- package/app/components/Viewer/Generic/Model/CornerComponentOptions.vue +145 -0
- package/app/components/Viewer/Generic/Model/CornersOptions.vue +15 -294
- package/app/components/Viewer/Generic/Model/CornersTypeOptions.vue +173 -0
- package/app/components/Viewer/Generic/Model/LineComponentOptions.vue +218 -0
- package/app/components/Viewer/Generic/Model/LinesOptions.vue +15 -427
- package/app/components/Viewer/Generic/Model/LinesTypeOptions.vue +229 -0
- package/app/components/Viewer/Generic/Model/ModelCardTabs.vue +35 -0
- package/app/components/Viewer/Generic/Model/ModelEdgesCard.vue +34 -25
- package/app/components/Viewer/Generic/Model/ModelPointsCard.vue +34 -25
- package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +17 -5
- package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +16 -12
- package/app/components/Viewer/ObjectTree/Base/ComponentRelations.vue +4 -1
- package/app/components/Viewer/ObjectTree/Base/ItemLabel.vue +71 -1
- package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +55 -10
- package/app/components/Viewer/Options/AttributeRangeSelector.vue +11 -4
- package/app/components/Viewer/Options/AttributeSelector.vue +40 -136
- package/app/components/Viewer/Options/ColorPicker.vue +4 -1
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +48 -74
- package/app/components/Viewer/Options/ColormapQuickPicker.vue +13 -7
- package/app/components/Viewer/Options/NoDataColorInfo.vue +56 -0
- package/app/components/Viewer/Options/Sliders/Opacity.vue +22 -0
- package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +13 -0
- package/app/components/Viewer/Scene/BackgroundOptions.vue +37 -0
- package/app/components/Viewer/Scene/OrientationWidgetOptions.vue +48 -0
- package/app/components/Viewer/Scene/TextOptions.vue +63 -0
- package/app/components/Viewer/Solid/SpecificPolyhedraColoring.vue +217 -0
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +4 -199
- package/app/components/Viewer/Surface/PolygonsColoring.vue +224 -0
- package/app/components/Viewer/Surface/PolygonsOptions.vue +3 -213
- package/app/components/Viewer/Ui.vue +9 -0
- package/app/components/csv-preview/CsvPreviewer.vue +4 -1
- package/app/composables/attribute_coloring_style.ts +8 -2
- package/app/composables/attribute_selector.ts +126 -0
- package/app/composables/batch_style_model.ts +34 -0
- package/app/composables/clipping_slices.ts +166 -0
- package/app/composables/global_attribute_style.ts +4 -3
- package/app/composables/hover_highlight.ts +19 -18
- package/app/composables/live_data_item.ts +39 -0
- package/app/composables/model_tabs.ts +86 -0
- package/app/composables/overlapping_picker_menu.ts +43 -0
- package/app/composables/project_manager.ts +5 -81
- package/app/composables/project_manager_helpers/reset.ts +34 -0
- package/app/composables/project_manager_helpers/restore.ts +67 -0
- package/app/composables/project_manager_helpers/types.ts +24 -0
- package/app/composables/project_manager_helpers/viewer_session.ts +25 -0
- package/app/composables/stepper_tree.ts +10 -2
- package/app/composables/tree_filter.ts +11 -2
- package/app/composables/tree_keyboard_nav.ts +4 -2
- package/app/composables/use_overlapping_picker.ts +30 -42
- package/app/composables/view_toolbar_options.ts +126 -0
- package/app/composables/view_toolbar_tool_options.ts +115 -0
- package/app/composables/view_toolbar_tools.ts +108 -0
- package/app/composables/viewer_context_menu.ts +19 -1
- package/app/composables/virtual_tree.ts +20 -131
- package/app/composables/virtual_tree_flatten.ts +109 -0
- package/app/composables/virtual_tree_types.ts +81 -0
- package/app/stores/app.ts +8 -55
- package/app/stores/app_helpers/extension.ts +90 -51
- package/app/stores/app_helpers/registry.ts +69 -0
- package/app/stores/basemap.ts +52 -0
- package/app/stores/basemap_detail.ts +51 -0
- package/app/stores/basemap_helpers/builds.ts +158 -0
- package/app/stores/basemap_helpers/detail_layers.ts +72 -0
- package/app/stores/basemap_helpers/detail_map.ts +62 -0
- package/app/stores/basemap_helpers/detail_refresh.ts +134 -0
- package/app/stores/basemap_helpers/detail_view.ts +94 -0
- package/app/stores/basemap_helpers/extent.ts +40 -0
- package/app/stores/basemap_helpers/georeferenced.ts +50 -0
- package/app/stores/basemap_helpers/layers.ts +66 -0
- package/app/stores/basemap_helpers/settings.ts +87 -0
- package/app/stores/basemap_helpers/viewer.ts +114 -0
- package/app/stores/crs.ts +136 -0
- package/app/stores/data.ts +24 -1
- package/app/stores/data_style.ts +8 -0
- package/app/stores/feedback.ts +12 -2
- package/app/stores/hybrid_viewer.ts +1 -1
- package/app/stores/infra.ts +26 -21
- package/app/stores/menu.ts +8 -124
- package/app/stores/menu_helpers/basemap.ts +10 -0
- package/app/stores/menu_helpers/menus_data.ts +27 -0
- package/app/stores/menu_helpers/mesh/edged_curve.ts +12 -0
- package/app/stores/menu_helpers/mesh/grid.ts +24 -0
- package/app/stores/menu_helpers/mesh/point_set.ts +11 -0
- package/app/stores/menu_helpers/mesh/solid.ts +29 -0
- package/app/stores/menu_helpers/mesh/surface.ts +22 -0
- package/app/stores/menu_helpers/model.ts +25 -0
- package/app/stores/menu_helpers/scene.ts +10 -0
- package/app/stores/menu_helpers/types.ts +5 -0
- package/app/stores/treeview.ts +17 -10
- package/app/stores/viewer.ts +17 -79
- package/app/stores/viewer_helpers/actions.ts +68 -0
- package/app/stores/viewer_helpers/request.ts +61 -0
- package/app/utils/basemap_tree.ts +76 -0
- package/app/utils/clipping_planes.ts +4 -131
- package/app/utils/clipping_planes_scene.ts +131 -0
- package/app/utils/color_picker.ts +18 -15
- package/app/utils/coloring_styles.ts +101 -0
- package/app/utils/crs.ts +38 -0
- package/app/utils/default_styles/constants.ts +10 -0
- package/app/utils/default_styles/index.ts +17 -1
- package/app/utils/default_styles/mesh_components.ts +168 -0
- package/app/utils/default_styles/meshes.ts +13 -153
- package/app/utils/default_styles/model_components.ts +170 -0
- package/app/utils/default_styles/models.ts +16 -153
- package/app/utils/drag_and_drop.ts +80 -0
- package/app/utils/extension.ts +1 -1
- package/app/utils/import_workflow.ts +26 -11
- package/app/utils/model_component_coloring.ts +46 -0
- package/app/utils/threshold.ts +33 -0
- package/app/utils/threshold_sources.ts +51 -0
- package/app/utils/treeview.ts +12 -1
- package/app/utils/upload_path.ts +15 -9
- package/app/utils/visible_map_area.ts +129 -0
- package/internal/database/base_database.ts +2 -0
- package/internal/database/database.ts +47 -29
- package/internal/database/tables/scene_style.ts +6 -0
- package/internal/stores/data_style/mesh/base_style.ts +74 -0
- package/internal/stores/data_style/mesh/cells/cell.ts +27 -150
- package/internal/stores/data_style/mesh/cells/cell_attribute.ts +74 -0
- package/internal/stores/data_style/mesh/cells/cell_config.ts +152 -0
- package/internal/stores/data_style/mesh/cells/color.ts +3 -1
- package/internal/stores/data_style/mesh/cells/index.ts +17 -1
- package/internal/stores/data_style/mesh/cells/opacity.ts +54 -0
- package/internal/stores/data_style/mesh/cells/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/cells/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/cells/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/edges/color.ts +3 -1
- package/internal/stores/data_style/mesh/edges/edge.ts +27 -150
- package/internal/stores/data_style/mesh/edges/edge_attribute.ts +74 -0
- package/internal/stores/data_style/mesh/edges/edge_config.ts +152 -0
- package/internal/stores/data_style/mesh/edges/index.ts +17 -1
- package/internal/stores/data_style/mesh/edges/opacity.ts +54 -0
- package/internal/stores/data_style/mesh/edges/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/edges/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/edges/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/index.ts +2 -57
- package/internal/stores/data_style/mesh/points/color.ts +3 -1
- package/internal/stores/data_style/mesh/points/index.ts +17 -1
- package/internal/stores/data_style/mesh/points/opacity.ts +54 -0
- package/internal/stores/data_style/mesh/points/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/points/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/points/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/polygons/color.ts +3 -1
- package/internal/stores/data_style/mesh/polygons/index.ts +17 -1
- package/internal/stores/data_style/mesh/polygons/opacity.ts +54 -0
- package/internal/stores/data_style/mesh/polygons/polygon.ts +27 -152
- package/internal/stores/data_style/mesh/polygons/polygon_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polygons/polygon_config.ts +148 -0
- package/internal/stores/data_style/mesh/polygons/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/polygons/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polygons/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/polyhedra/color.ts +3 -1
- package/internal/stores/data_style/mesh/polyhedra/index.ts +17 -1
- package/internal/stores/data_style/mesh/polyhedra/opacity.ts +54 -0
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +27 -160
- package/internal/stores/data_style/mesh/polyhedra/polyhedron_attribute.ts +82 -0
- package/internal/stores/data_style/mesh/polyhedra/polyhedron_config.ts +157 -0
- package/internal/stores/data_style/mesh/polyhedra/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/polyhedra/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polyhedra/vertex_config.ts +152 -0
- package/internal/stores/data_style/model/blocks/apply_coloring.ts +173 -0
- package/internal/stores/data_style/model/blocks/color.ts +58 -57
- package/internal/stores/data_style/model/blocks/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/blocks/index.ts +12 -140
- package/internal/stores/data_style/model/blocks/polyhedron.ts +102 -54
- package/internal/stores/data_style/model/blocks/vertex.ts +102 -54
- package/internal/stores/data_style/model/color.ts +25 -26
- package/internal/stores/data_style/model/common.ts +10 -119
- package/internal/stores/data_style/model/common_mutations.ts +184 -0
- package/internal/stores/data_style/model/corners/index.ts +85 -78
- package/internal/stores/data_style/model/corners/vertex.ts +97 -49
- package/internal/stores/data_style/model/lines/apply_coloring.ts +154 -0
- package/internal/stores/data_style/model/lines/color.ts +53 -40
- package/internal/stores/data_style/model/lines/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/lines/edge.ts +102 -54
- package/internal/stores/data_style/model/lines/index.ts +10 -134
- package/internal/stores/data_style/model/lines/vertex.ts +102 -54
- package/internal/stores/data_style/model/surfaces/apply_coloring.ts +186 -0
- package/internal/stores/data_style/model/surfaces/color.ts +68 -56
- package/internal/stores/data_style/model/surfaces/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/surfaces/index.ts +16 -160
- package/internal/stores/data_style/model/surfaces/polygon.ts +94 -46
- package/internal/stores/data_style/model/surfaces/vertex.ts +94 -46
- package/internal/stores/data_style/model/visibility.ts +3 -156
- package/internal/stores/data_style/model/visibility_dispatch.ts +110 -0
- package/internal/stores/data_style/scene.ts +118 -0
- package/internal/stores/data_style/state.ts +5 -181
- package/internal/stores/data_style/state_shared.ts +199 -0
- package/internal/stores/data_style/types.ts +24 -1
- package/internal/stores/hybrid_viewer/brightness.ts +8 -2
- package/internal/stores/hybrid_viewer/camera.ts +7 -161
- package/internal/stores/hybrid_viewer/camera_animation.ts +4 -3
- package/internal/stores/hybrid_viewer/camera_helpers.ts +120 -0
- package/internal/stores/hybrid_viewer/camera_orientation.ts +60 -0
- package/internal/stores/hybrid_viewer/filters.ts +54 -11
- package/internal/stores/hybrid_viewer/highlight.ts +80 -63
- package/internal/stores/hybrid_viewer/ruler.ts +4 -3
- package/internal/stores/hybrid_viewer/scene.ts +34 -26
- package/internal/stores/hybrid_viewer/vtk_types.ts +2 -1
- package/internal/utils/ws_client.ts +8 -1
- package/package.json +5 -5
- package/server/api/local/extensions/run.post.ts +6 -4
- package/server/api/local/extensions/upload.put.ts +47 -20
- package/server/utils/cleanup.ts +12 -2
- package/server/utils/microservices.ts +10 -102
- package/server/utils/microservices_process.ts +127 -0
- package/server/utils/scripts.ts +35 -30
- package/server/utils/typed_handler.ts +8 -1
- package/server/utils/ws_client.ts +15 -2
- package/shared/utils/fetch_raw.ts +2 -2
- package/shared/utils/parse_boolean.ts +4 -1
- package/app/components/Viewer/Options/OptionsSection.vue +0 -76
|
@@ -2,14 +2,10 @@
|
|
|
2
2
|
import viewer_schemas, {
|
|
3
3
|
type ViewerTakeScreenshotParams,
|
|
4
4
|
} from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
5
|
-
import { BACKGROUND_GREY_VALUE } from "@ogw_internal/stores/hybrid_viewer/constants";
|
|
6
|
-
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
7
5
|
import ToolPanel from "@ogw_front/components/ToolPanel.vue";
|
|
8
|
-
import ViewerOptionsColorPicker from "@ogw_front/components/Viewer/Options/ColorPicker.vue";
|
|
9
6
|
import fileDownload from "js-file-download";
|
|
10
7
|
import { useClipboardItems } from "@vueuse/core";
|
|
11
8
|
import { useFeedbackStore } from "@ogw_front/stores/feedback";
|
|
12
|
-
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
13
9
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
14
10
|
|
|
15
11
|
const DEFAULT_PANEL_WIDTH = 260;
|
|
@@ -23,6 +19,13 @@ interface Props {
|
|
|
23
19
|
|
|
24
20
|
const { width = DEFAULT_PANEL_WIDTH, escapeFunction = undefined } = defineProps<Props>();
|
|
25
21
|
|
|
22
|
+
function getErrorMessage(error: unknown): string {
|
|
23
|
+
if (error instanceof Error) {
|
|
24
|
+
return error.message;
|
|
25
|
+
}
|
|
26
|
+
return String(error);
|
|
27
|
+
}
|
|
28
|
+
|
|
26
29
|
const output_extensions =
|
|
27
30
|
viewer_schemas.opengeodeweb_viewer.viewer.take_screenshot.properties.output_extension.enum;
|
|
28
31
|
const filename = ref<string>("");
|
|
@@ -30,28 +33,9 @@ const output_extension = ref<ViewerTakeScreenshotParams["output_extension"]>("pn
|
|
|
30
33
|
const include_background = ref<boolean>(true);
|
|
31
34
|
const include_ui = ref<boolean>(false);
|
|
32
35
|
const screenshot_type = ref<string>("file");
|
|
33
|
-
const DEFAULT_BACKGROUND_COLOR: RGBAColor = {
|
|
34
|
-
red: BACKGROUND_GREY_VALUE,
|
|
35
|
-
green: BACKGROUND_GREY_VALUE,
|
|
36
|
-
blue: BACKGROUND_GREY_VALUE,
|
|
37
|
-
alpha: 1,
|
|
38
|
-
};
|
|
39
|
-
const background_color = ref<RGBAColor>({ ...DEFAULT_BACKGROUND_COLOR });
|
|
40
|
-
let is_capturing = false;
|
|
41
36
|
|
|
42
37
|
const { copy } = useClipboardItems();
|
|
43
38
|
|
|
44
|
-
function applyBackgroundColor(color: RGBAColor): Promise<void> {
|
|
45
|
-
const hybridViewerStore = useHybridViewerStore();
|
|
46
|
-
// oxlint-disable-next-line id-length -- the viewer schema requires { r, g, b }
|
|
47
|
-
return hybridViewerStore.setBackgroundColor({ r: color.red, g: color.green, b: color.blue });
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async function restoreBackgroundColor(): Promise<void> {
|
|
51
|
-
background_color.value = { ...DEFAULT_BACKGROUND_COLOR };
|
|
52
|
-
await applyBackgroundColor(DEFAULT_BACKGROUND_COLOR);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
39
|
async function deliverScreenshot(blob: Blob | Uint8Array, current_filename: string): Promise<void> {
|
|
56
40
|
const feedbackStore = useFeedbackStore();
|
|
57
41
|
if (screenshot_type.value === "file") {
|
|
@@ -64,7 +48,7 @@ async function deliverScreenshot(blob: Blob | Uint8Array, current_filename: stri
|
|
|
64
48
|
await copy([new ClipboardItem({ "image/png": pngBlob })]);
|
|
65
49
|
feedbackStore.add_success("Screenshot copied to clipboard");
|
|
66
50
|
} catch (error) {
|
|
67
|
-
const message =
|
|
51
|
+
const message = getErrorMessage(error);
|
|
68
52
|
feedbackStore.add_error(
|
|
69
53
|
0,
|
|
70
54
|
"",
|
|
@@ -138,42 +122,24 @@ async function takeUiScreenshot(current_filename: string): Promise<void> {
|
|
|
138
122
|
const blob = await captureTab(mime_type);
|
|
139
123
|
await deliverScreenshot(blob, current_filename);
|
|
140
124
|
} catch (error) {
|
|
141
|
-
const message =
|
|
125
|
+
const message = getErrorMessage(error);
|
|
142
126
|
feedbackStore.add_error(0, "", "Screenshot Error", `Failed to capture the page: ${message}`);
|
|
143
127
|
}
|
|
144
128
|
}
|
|
145
129
|
|
|
146
130
|
async function takeScreenshot(): Promise<void> {
|
|
147
131
|
const current_filename = screenshot_type.value === "file" ? filename.value : "screenshot";
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
await takeSceneScreenshot(current_filename);
|
|
157
|
-
show.value = false;
|
|
158
|
-
}
|
|
159
|
-
} finally {
|
|
160
|
-
await restoreBackgroundColor();
|
|
161
|
-
is_capturing = false;
|
|
132
|
+
if (include_ui.value) {
|
|
133
|
+
// Close the panel first so it does not appear on the captured page
|
|
134
|
+
show.value = false;
|
|
135
|
+
await nextTick();
|
|
136
|
+
await takeUiScreenshot(current_filename);
|
|
137
|
+
} else {
|
|
138
|
+
await takeSceneScreenshot(current_filename);
|
|
139
|
+
show.value = false;
|
|
162
140
|
}
|
|
163
141
|
}
|
|
164
142
|
|
|
165
|
-
watch(background_color, async (color) => {
|
|
166
|
-
if (show.value) {
|
|
167
|
-
await applyBackgroundColor(color);
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
watch(show, async (value) => {
|
|
172
|
-
if (!value && !is_capturing) {
|
|
173
|
-
await restoreBackgroundColor();
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
|
|
177
143
|
watch([output_extension, include_ui], ([extension, with_ui]) => {
|
|
178
144
|
if (extension !== "png" || with_ui) {
|
|
179
145
|
include_background.value = true;
|
|
@@ -288,14 +254,6 @@ function handleClose(): void {
|
|
|
288
254
|
class="text-caption"
|
|
289
255
|
></v-switch>
|
|
290
256
|
</v-col>
|
|
291
|
-
<v-col v-if="include_background" cols="12" class="py-1">
|
|
292
|
-
<span class="text-caption">Background color</span>
|
|
293
|
-
<ViewerOptionsColorPicker
|
|
294
|
-
data-testid="screenshotBackgroundColorPicker"
|
|
295
|
-
v-model="background_color"
|
|
296
|
-
disabled-alpha
|
|
297
|
-
/>
|
|
298
|
-
</v-col>
|
|
299
257
|
</v-row>
|
|
300
258
|
</v-container>
|
|
301
259
|
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
type AttributeInfo,
|
|
4
|
+
type AttributeSource,
|
|
5
|
+
isValidThresholdAttribute,
|
|
6
|
+
} from "@ogw_front/utils/threshold";
|
|
7
|
+
import type { Threshold, ThresholdAttribute } from "@ogw_internal/stores/hybrid_viewer/filters";
|
|
8
|
+
import { attributeArrayName, getAttributeRange } from "@ogw_front/utils/attributes";
|
|
9
|
+
import ViewerOptionsAttributeRangeSelector from "@ogw_front/components/Viewer/Options/AttributeRangeSelector.vue";
|
|
10
|
+
import { fetchAttributeRange } from "@ogw_front/utils/attribute_range";
|
|
11
|
+
import { useBackStore } from "@ogw_front/stores/back";
|
|
12
|
+
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
datasetId: string;
|
|
16
|
+
sources: AttributeSource[];
|
|
17
|
+
index: number;
|
|
18
|
+
threshold: Threshold;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const { datasetId, sources, index, threshold } = defineProps<Props>();
|
|
22
|
+
|
|
23
|
+
interface Emits {
|
|
24
|
+
remove: [];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const emit = defineEmits<Emits>();
|
|
28
|
+
|
|
29
|
+
const backStore = useBackStore();
|
|
30
|
+
const dataStyleStore = useDataStyleStore();
|
|
31
|
+
const {
|
|
32
|
+
sourceIndex: selectedSourceIndex,
|
|
33
|
+
attributeName,
|
|
34
|
+
item: attributeItem,
|
|
35
|
+
minimum,
|
|
36
|
+
maximum,
|
|
37
|
+
thresholdAttribute,
|
|
38
|
+
} = toRefs(threshold);
|
|
39
|
+
const attributes = ref<AttributeInfo[]>([]);
|
|
40
|
+
|
|
41
|
+
const availableSources = computed<{ title: string; value: number }[]>(() =>
|
|
42
|
+
sources.map((source, sourceIndex) => ({
|
|
43
|
+
title: source.title,
|
|
44
|
+
value: sourceIndex,
|
|
45
|
+
})),
|
|
46
|
+
);
|
|
47
|
+
const currentSource = computed<AttributeSource | undefined>(
|
|
48
|
+
() => sources[selectedSourceIndex.value ?? -1],
|
|
49
|
+
);
|
|
50
|
+
const currentAttribute = computed<AttributeInfo | undefined>(() =>
|
|
51
|
+
attributes.value.find((attribute) => attribute.attribute_name === attributeName.value),
|
|
52
|
+
);
|
|
53
|
+
const currentTimeStep = computed<number | undefined>(() => {
|
|
54
|
+
if (!currentSource.value || !currentAttribute.value?.time_steps?.length) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
const step =
|
|
58
|
+
dataStyleStore.attributeTimeStep(
|
|
59
|
+
datasetId,
|
|
60
|
+
currentSource.value.timeStepKey,
|
|
61
|
+
attributeName.value,
|
|
62
|
+
) ?? 0;
|
|
63
|
+
return Math.min(step, currentAttribute.value.time_steps.length - 1);
|
|
64
|
+
});
|
|
65
|
+
const itemOptions = computed<{ title: string; value: number }[]>(() =>
|
|
66
|
+
Array.from({ length: currentAttribute.value?.nb_items ?? 0 }, (_, itemIndex) => ({
|
|
67
|
+
title: `Item ${itemIndex + 1}`,
|
|
68
|
+
value: itemIndex,
|
|
69
|
+
})),
|
|
70
|
+
);
|
|
71
|
+
const currentThresholdAttribute = computed<ThresholdAttribute | undefined>(() => {
|
|
72
|
+
if (!currentAttribute.value) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
const attribute = {
|
|
76
|
+
name: attributeArrayName(currentAttribute.value.attribute_name, currentTimeStep.value),
|
|
77
|
+
location: currentSource.value?.location,
|
|
78
|
+
item: attributeItem.value,
|
|
79
|
+
minimum: minimum.value,
|
|
80
|
+
maximum: maximum.value,
|
|
81
|
+
};
|
|
82
|
+
return isValidThresholdAttribute(attribute) ? attribute : undefined;
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
async function resetRange(): Promise<void> {
|
|
86
|
+
const source = currentSource.value;
|
|
87
|
+
const name = attributeName.value;
|
|
88
|
+
if (!source || name === undefined) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const range = await fetchAttributeRange(source.schemas.range, source.params, name);
|
|
92
|
+
if (name !== attributeName.value) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const { min, max } = getAttributeRange(range, attributeItem.value);
|
|
96
|
+
minimum.value = min;
|
|
97
|
+
maximum.value = max;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async function fetchAttributes(): Promise<void> {
|
|
101
|
+
attributes.value = [];
|
|
102
|
+
const source = currentSource.value;
|
|
103
|
+
if (!source) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const response = (await backStore.request({
|
|
107
|
+
schema: source.schemas.names,
|
|
108
|
+
params: source.params,
|
|
109
|
+
})) as { attributes: AttributeInfo[] };
|
|
110
|
+
attributes.value = response.attributes;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
onMounted(fetchAttributes);
|
|
114
|
+
|
|
115
|
+
watch(selectedSourceIndex, async () => {
|
|
116
|
+
attributeName.value = undefined;
|
|
117
|
+
await fetchAttributes();
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
watch(attributeName, async () => {
|
|
121
|
+
attributeItem.value = 0;
|
|
122
|
+
await resetRange();
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
watch(attributeItem, async () => {
|
|
126
|
+
await resetRange();
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
watch(currentThresholdAttribute, (value) => {
|
|
130
|
+
thresholdAttribute.value = value;
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
defineExpose({ resetRange });
|
|
134
|
+
</script>
|
|
135
|
+
|
|
136
|
+
<template>
|
|
137
|
+
<v-card
|
|
138
|
+
data-testid="thresholdCard"
|
|
139
|
+
variant="outlined"
|
|
140
|
+
class="pa-2 mb-3 rounded-lg border-opacity-50"
|
|
141
|
+
>
|
|
142
|
+
<v-row align="center" justify="space-between" no-gutters class="mb-2">
|
|
143
|
+
<v-col cols="auto">
|
|
144
|
+
<v-chip size="x-small" variant="flat" color="primary" class="font-weight-bold">
|
|
145
|
+
Threshold #{{ index + 1 }}
|
|
146
|
+
</v-chip>
|
|
147
|
+
</v-col>
|
|
148
|
+
<v-col cols="auto">
|
|
149
|
+
<v-btn
|
|
150
|
+
data-testid="removeThresholdCardButton"
|
|
151
|
+
icon="mdi-trash-can-outline"
|
|
152
|
+
size="x-small"
|
|
153
|
+
variant="text"
|
|
154
|
+
color="error"
|
|
155
|
+
@click="emit('remove')"
|
|
156
|
+
/>
|
|
157
|
+
</v-col>
|
|
158
|
+
</v-row>
|
|
159
|
+
|
|
160
|
+
<v-select
|
|
161
|
+
v-model="selectedSourceIndex"
|
|
162
|
+
data-testid="thresholdAttributeTypeSelect"
|
|
163
|
+
:items="availableSources"
|
|
164
|
+
label="Select an attribute type"
|
|
165
|
+
variant="outlined"
|
|
166
|
+
density="compact"
|
|
167
|
+
hide-details
|
|
168
|
+
class="mb-3 text-caption"
|
|
169
|
+
/>
|
|
170
|
+
|
|
171
|
+
<v-select
|
|
172
|
+
v-if="selectedSourceIndex !== undefined"
|
|
173
|
+
v-model="attributeName"
|
|
174
|
+
data-testid="thresholdAttributeSelect"
|
|
175
|
+
:items="attributes.map((attribute) => attribute.attribute_name)"
|
|
176
|
+
label="Select an attribute"
|
|
177
|
+
variant="outlined"
|
|
178
|
+
density="compact"
|
|
179
|
+
hide-details
|
|
180
|
+
class="mb-3 text-caption"
|
|
181
|
+
/>
|
|
182
|
+
|
|
183
|
+
<v-select
|
|
184
|
+
v-if="currentAttribute && currentAttribute.nb_items > 1"
|
|
185
|
+
v-model="attributeItem"
|
|
186
|
+
data-testid="thresholdItemSelect"
|
|
187
|
+
:items="itemOptions"
|
|
188
|
+
label="Select an item"
|
|
189
|
+
variant="outlined"
|
|
190
|
+
density="compact"
|
|
191
|
+
hide-details
|
|
192
|
+
class="mb-3 text-caption"
|
|
193
|
+
/>
|
|
194
|
+
|
|
195
|
+
<template v-if="attributeName">
|
|
196
|
+
<span class="text-caption font-weight-bold">Range</span>
|
|
197
|
+
<ViewerOptionsAttributeRangeSelector
|
|
198
|
+
v-model:minimum="minimum"
|
|
199
|
+
v-model:maximum="maximum"
|
|
200
|
+
class="mt-2"
|
|
201
|
+
@reset="resetRange"
|
|
202
|
+
/>
|
|
203
|
+
</template>
|
|
204
|
+
</v-card>
|
|
205
|
+
</template>
|