@geode/opengeodeweb-front 10.44.0 → 10.44.1
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/app/components/ClippingPlanes.vue +7 -5
- package/app/components/CrsSelector.vue +2 -1
- package/app/components/ExtensionSelector.vue +8 -7
- package/app/components/FactorFilterPanel.vue +4 -4
- package/app/components/MissingFilesSelector.vue +2 -1
- package/app/components/ObjectSelector.vue +4 -3
- package/app/components/ThresholdCard.vue +6 -5
- package/app/components/ThresholdFilter.vue +11 -10
- package/app/components/TimeSeriesTargetSelector.vue +10 -7
- package/app/components/Viewer/ContextMenu/InfoCard.vue +12 -10
- package/app/components/Viewer/EdgedCurve/SpecificEdgesColoring.vue +72 -63
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +12 -10
- package/app/components/Viewer/Generic/Mesh/CellsColoring.vue +76 -71
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +8 -6
- package/app/components/Viewer/Generic/Mesh/EdgesColoring.vue +72 -63
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +12 -10
- package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +54 -45
- package/app/components/Viewer/Generic/Mesh/PolygonsColoring.vue +76 -73
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +8 -6
- package/app/components/Viewer/Generic/Mesh/PolyhedraColoring.vue +72 -67
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +8 -6
- package/app/components/Viewer/Generic/Model/BlocksOptions.vue +29 -21
- package/app/components/Viewer/Generic/Model/ComponentEdgesOptions.vue +8 -6
- package/app/components/Viewer/Generic/Model/ComponentPointsOptions.vue +8 -6
- package/app/components/Viewer/Generic/Model/CornerComponentOptions.vue +15 -7
- package/app/components/Viewer/Generic/Model/CornersOptions.vue +2 -1
- package/app/components/Viewer/Generic/Model/CornersTypeOptions.vue +13 -6
- package/app/components/Viewer/Generic/Model/LineComponentOptions.vue +19 -11
- package/app/components/Viewer/Generic/Model/LinesOptions.vue +2 -1
- package/app/components/Viewer/Generic/Model/LinesTypeOptions.vue +17 -10
- package/app/components/Viewer/Generic/Model/ModelEdgesCard.vue +3 -2
- package/app/components/Viewer/Generic/Model/ModelPointsCard.vue +2 -1
- package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +3 -2
- package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +29 -21
- package/app/components/Viewer/ObjectTree/Base/ItemLabel.vue +2 -2
- package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +2 -3
- package/app/components/Viewer/Options/AttributeSelector.vue +11 -7
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +10 -13
- package/app/components/Viewer/Options/TextureItem.vue +5 -4
- package/app/components/Viewer/Options/TexturesSelector.vue +5 -8
- package/app/components/Viewer/Options/TimeStepSlider.vue +3 -1
- package/app/components/Viewer/OverlappingObjectsPicker.vue +6 -13
- package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +40 -38
- package/app/components/Viewer/Solid/SpecificPolyhedraColoring.vue +69 -65
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +8 -6
- package/app/components/Viewer/Surface/PolygonsColoring.vue +73 -71
- package/app/components/Viewer/Surface/PolygonsOptions.vue +8 -6
- package/app/composables/attribute_coloring_style.ts +17 -12
- package/app/composables/attribute_selector.ts +9 -15
- package/app/composables/batch_style.ts +25 -16
- package/app/composables/batch_style_model.ts +6 -5
- package/app/composables/clipping_planes_widget.ts +2 -5
- package/app/composables/clipping_slices.ts +2 -1
- package/app/composables/hover_highlight.ts +17 -16
- package/app/composables/live_data_item.ts +3 -2
- package/app/composables/model_attribute_style.ts +2 -1
- package/app/composables/model_menu_context.ts +3 -4
- package/app/composables/model_tree.ts +3 -2
- package/app/composables/project_manager_helpers/types.ts +10 -4
- package/app/composables/tree_filter.ts +3 -3
- package/app/composables/tree_keyboard_nav.ts +1 -6
- package/app/composables/tree_scroll.ts +2 -0
- package/app/composables/use_overlapping_picker.ts +9 -9
- package/app/stores/basemap_helpers/georeferenced.ts +1 -1
- package/app/stores/basemap_helpers/viewer.ts +2 -1
- package/app/stores/crs.ts +6 -5
- package/app/stores/data.ts +84 -69
- package/app/stores/data_helpers/collections.ts +13 -21
- package/app/stores/data_helpers/mesh.ts +19 -24
- package/app/stores/data_helpers/relations.ts +12 -12
- package/app/stores/data_style.ts +26 -20
- package/app/stores/menu.ts +17 -11
- package/app/stores/treeview.ts +28 -27
- package/app/types/attribute.ts +37 -0
- package/app/types/identifiers.ts +72 -0
- package/app/types/style.ts +13 -0
- package/app/types/texture.ts +6 -0
- package/app/types/tree.ts +17 -0
- package/app/utils/attribute_range.ts +2 -1
- package/app/utils/attributes.ts +13 -4
- package/app/utils/basemap_tree.ts +3 -5
- package/app/utils/clipping_planes.ts +6 -4
- package/app/utils/clipping_planes_scene.ts +4 -3
- package/app/utils/crs.ts +4 -1
- package/app/utils/default_styles/constants.ts +8 -1
- package/app/utils/default_styles/mesh_components.ts +21 -25
- package/app/utils/default_styles/meshes.ts +7 -22
- package/app/utils/default_styles/model_components.ts +22 -26
- package/app/utils/default_styles/models.ts +11 -13
- package/app/utils/import_workflow.ts +37 -29
- package/app/utils/legacy_data_id.ts +16 -0
- package/app/utils/slice.ts +7 -2
- package/app/utils/threshold.ts +1 -8
- package/app/utils/threshold_sources.ts +8 -5
- package/app/utils/treeview.ts +3 -2
- package/internal/database/tables/data.ts +1 -1
- package/internal/database/tables/data_style.ts +1 -1
- package/internal/database/tables/model_components.ts +1 -1
- package/internal/database/tables/model_components_relation.ts +1 -1
- package/internal/stores/data_style/attribute_default.ts +14 -0
- package/internal/stores/data_style/attribute_types.ts +59 -0
- package/internal/stores/data_style/attribute_valid.ts +16 -0
- package/internal/stores/data_style/mesh/base_style.ts +17 -15
- package/internal/stores/data_style/mesh/cells/cell.ts +64 -49
- package/internal/stores/data_style/mesh/cells/cell_attribute.ts +42 -66
- package/internal/stores/data_style/mesh/cells/cell_config.ts +59 -53
- package/internal/stores/data_style/mesh/cells/color.ts +8 -7
- package/internal/stores/data_style/mesh/cells/common.ts +16 -15
- package/internal/stores/data_style/mesh/cells/index.ts +49 -47
- package/internal/stores/data_style/mesh/cells/opacity.ts +12 -10
- package/internal/stores/data_style/mesh/cells/textures.ts +8 -7
- package/internal/stores/data_style/mesh/cells/vertex.ts +66 -50
- package/internal/stores/data_style/mesh/cells/vertex_attribute.ts +37 -67
- package/internal/stores/data_style/mesh/cells/vertex_config.ts +62 -53
- package/internal/stores/data_style/mesh/cells/visibility.ts +11 -7
- package/internal/stores/data_style/mesh/edges/color.ts +8 -7
- package/internal/stores/data_style/mesh/edges/common.ts +13 -12
- package/internal/stores/data_style/mesh/edges/edge.ts +64 -49
- package/internal/stores/data_style/mesh/edges/edge_attribute.ts +42 -66
- package/internal/stores/data_style/mesh/edges/edge_config.ts +59 -53
- package/internal/stores/data_style/mesh/edges/index.ts +49 -47
- package/internal/stores/data_style/mesh/edges/opacity.ts +12 -10
- package/internal/stores/data_style/mesh/edges/vertex.ts +66 -50
- package/internal/stores/data_style/mesh/edges/vertex_attribute.ts +37 -67
- package/internal/stores/data_style/mesh/edges/vertex_config.ts +62 -53
- package/internal/stores/data_style/mesh/edges/visibility.ts +11 -7
- package/internal/stores/data_style/mesh/edges/width.ts +9 -7
- package/internal/stores/data_style/mesh/index.ts +27 -24
- package/internal/stores/data_style/mesh/points/color.ts +8 -7
- package/internal/stores/data_style/mesh/points/common.ts +16 -14
- package/internal/stores/data_style/mesh/points/index.ts +39 -37
- package/internal/stores/data_style/mesh/points/opacity.ts +12 -10
- package/internal/stores/data_style/mesh/points/size.ts +9 -7
- package/internal/stores/data_style/mesh/points/vertex.ts +66 -50
- package/internal/stores/data_style/mesh/points/vertex_attribute.ts +37 -67
- package/internal/stores/data_style/mesh/points/vertex_config.ts +62 -53
- package/internal/stores/data_style/mesh/points/visibility.ts +8 -6
- package/internal/stores/data_style/mesh/polygons/color.ts +8 -7
- package/internal/stores/data_style/mesh/polygons/common.ts +19 -15
- package/internal/stores/data_style/mesh/polygons/index.ts +49 -50
- package/internal/stores/data_style/mesh/polygons/opacity.ts +12 -10
- package/internal/stores/data_style/mesh/polygons/polygon.ts +66 -50
- package/internal/stores/data_style/mesh/polygons/polygon_attribute.ts +37 -67
- package/internal/stores/data_style/mesh/polygons/polygon_config.ts +65 -53
- package/internal/stores/data_style/mesh/polygons/textures.ts +8 -7
- package/internal/stores/data_style/mesh/polygons/vertex.ts +66 -50
- package/internal/stores/data_style/mesh/polygons/vertex_attribute.ts +37 -67
- package/internal/stores/data_style/mesh/polygons/vertex_config.ts +65 -53
- package/internal/stores/data_style/mesh/polygons/visibility.ts +12 -7
- package/internal/stores/data_style/mesh/polyhedra/color.ts +13 -9
- package/internal/stores/data_style/mesh/polyhedra/common.ts +13 -12
- package/internal/stores/data_style/mesh/polyhedra/index.ts +51 -51
- package/internal/stores/data_style/mesh/polyhedra/opacity.ts +12 -10
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +59 -53
- package/internal/stores/data_style/mesh/polyhedra/polyhedron_attribute.ts +46 -69
- package/internal/stores/data_style/mesh/polyhedra/polyhedron_config.ts +65 -55
- package/internal/stores/data_style/mesh/polyhedra/vertex.ts +66 -50
- package/internal/stores/data_style/mesh/polyhedra/vertex_attribute.ts +37 -67
- package/internal/stores/data_style/mesh/polyhedra/vertex_config.ts +65 -53
- package/internal/stores/data_style/mesh/polyhedra/visibility.ts +12 -7
- package/internal/stores/data_style/model/blocks/apply_coloring.ts +11 -12
- package/internal/stores/data_style/model/blocks/color.ts +25 -26
- package/internal/stores/data_style/model/blocks/coloring_groups.ts +5 -9
- package/internal/stores/data_style/model/blocks/common.ts +26 -22
- package/internal/stores/data_style/model/blocks/index.ts +8 -7
- package/internal/stores/data_style/model/blocks/polyhedron.ts +114 -135
- package/internal/stores/data_style/model/blocks/vertex.ts +110 -132
- package/internal/stores/data_style/model/blocks/visibility.ts +11 -9
- package/internal/stores/data_style/model/color.ts +55 -41
- package/internal/stores/data_style/model/common.ts +16 -14
- package/internal/stores/data_style/model/component_style.ts +0 -16
- package/internal/stores/data_style/model/corners/color.ts +21 -19
- package/internal/stores/data_style/model/corners/common.ts +26 -22
- package/internal/stores/data_style/model/corners/index.ts +21 -24
- package/internal/stores/data_style/model/corners/vertex.ts +103 -122
- package/internal/stores/data_style/model/corners/visibility.ts +11 -9
- package/internal/stores/data_style/model/edges/common.ts +7 -6
- package/internal/stores/data_style/model/edges/component.ts +63 -55
- package/internal/stores/data_style/model/edges/visibility.ts +24 -16
- package/internal/stores/data_style/model/edges/width.ts +10 -8
- package/internal/stores/data_style/model/index.ts +7 -6
- package/internal/stores/data_style/model/lines/apply_coloring.ts +11 -9
- package/internal/stores/data_style/model/lines/color.ts +25 -23
- package/internal/stores/data_style/model/lines/coloring_groups.ts +5 -9
- package/internal/stores/data_style/model/lines/common.ts +29 -21
- package/internal/stores/data_style/model/lines/edge.ts +109 -128
- package/internal/stores/data_style/model/lines/index.ts +8 -7
- package/internal/stores/data_style/model/lines/vertex.ts +109 -128
- package/internal/stores/data_style/model/lines/visibility.ts +11 -9
- package/internal/stores/data_style/model/points/common.ts +7 -6
- package/internal/stores/data_style/model/points/component.ts +62 -54
- package/internal/stores/data_style/model/points/index.ts +12 -7
- package/internal/stores/data_style/model/points/size.ts +10 -8
- package/internal/stores/data_style/model/points/visibility.ts +13 -8
- package/internal/stores/data_style/model/selection.ts +6 -11
- package/internal/stores/data_style/model/surfaces/apply_coloring.ts +11 -15
- package/internal/stores/data_style/model/surfaces/color.ts +31 -23
- package/internal/stores/data_style/model/surfaces/coloring_groups.ts +5 -9
- package/internal/stores/data_style/model/surfaces/common.ts +26 -22
- package/internal/stores/data_style/model/surfaces/index.ts +8 -7
- package/internal/stores/data_style/model/surfaces/polygon.ts +113 -138
- package/internal/stores/data_style/model/surfaces/vertex.ts +117 -133
- package/internal/stores/data_style/model/surfaces/visibility.ts +11 -9
- package/internal/stores/data_style/model/visibility.ts +18 -16
- package/internal/stores/data_style/model/visibility_dispatch.ts +4 -4
- package/internal/stores/data_style/state.ts +7 -6
- package/internal/stores/data_style/state_shared.ts +11 -10
- package/internal/stores/data_style/time_step.ts +21 -15
- package/internal/stores/data_style/types.ts +4 -3
- package/internal/stores/hybrid_viewer/camera.ts +11 -6
- package/internal/stores/hybrid_viewer/filters.ts +16 -14
- package/internal/stores/hybrid_viewer/highlight.ts +6 -5
- package/internal/stores/hybrid_viewer/scene.ts +20 -18
- package/internal/stores/hybrid_viewer/vtk_types.ts +2 -2
- package/internal/utils/api_fetch.ts +1 -1
- package/internal/utils/upload_file.ts +1 -7
- package/package.json +1 -1
- package/shared/utils/fetch_raw.ts +7 -8
|
@@ -1,69 +1,75 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type {
|
|
2
|
+
AttributeColorMap,
|
|
3
|
+
AttributeItem,
|
|
4
|
+
AttributeName,
|
|
5
|
+
AttributeRange,
|
|
6
|
+
} from "@ogw_front/types/attribute";
|
|
7
|
+
import type {
|
|
8
|
+
AttributeState,
|
|
9
|
+
AttributeStoredConfig,
|
|
10
|
+
} from "@ogw_internal/stores/data_style/attribute_types";
|
|
11
|
+
import type { MeshId } from "@ogw_front/types/identifiers";
|
|
12
|
+
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
13
|
+
import { defaultAttributeStoredConfig } from "@ogw_internal/stores/data_style/attribute_default";
|
|
3
14
|
|
|
4
15
|
// Local imports
|
|
5
16
|
import { useMeshCellsCommonStyle } from "./common";
|
|
6
17
|
|
|
7
18
|
interface UseMeshCellsCellAttributeConfigReturn {
|
|
8
|
-
meshCellsCellAttribute: (
|
|
9
|
-
meshCellsCellAttributeName: (
|
|
10
|
-
meshCellsCellAttributeLastItem: (
|
|
11
|
-
meshCellsCellAttributeItem: (
|
|
19
|
+
meshCellsCellAttribute: (meshId: MeshId) => AttributeState;
|
|
20
|
+
meshCellsCellAttributeName: (meshId: MeshId) => AttributeName | undefined;
|
|
21
|
+
meshCellsCellAttributeLastItem: (meshId: MeshId, name: AttributeName | undefined) => number;
|
|
22
|
+
meshCellsCellAttributeItem: (meshId: MeshId) => AttributeItem;
|
|
12
23
|
meshCellsCellAttributeStoredConfig: (
|
|
13
|
-
|
|
14
|
-
name:
|
|
15
|
-
item:
|
|
24
|
+
meshId: MeshId,
|
|
25
|
+
name: AttributeName | undefined,
|
|
26
|
+
item: AttributeItem | undefined,
|
|
16
27
|
) => AttributeStoredConfig;
|
|
17
28
|
}
|
|
18
29
|
|
|
19
30
|
interface UseMeshCellsCellAttributeConfigWriterReturn {
|
|
20
|
-
mutateMeshCellsCellStyle: (
|
|
31
|
+
mutateMeshCellsCellStyle: (meshId: MeshId, values: Record<string, unknown>) => Promise<string>;
|
|
21
32
|
setMeshCellsCellAttributeStoredConfig: (
|
|
22
|
-
|
|
23
|
-
name:
|
|
24
|
-
item:
|
|
33
|
+
meshId: MeshId,
|
|
34
|
+
name: AttributeName | undefined,
|
|
35
|
+
item: AttributeItem | undefined,
|
|
25
36
|
config: Partial<AttributeStoredConfig>,
|
|
26
37
|
) => Promise<string>;
|
|
27
38
|
}
|
|
28
39
|
|
|
29
40
|
function useMeshCellsCellAttributeConfig(): UseMeshCellsCellAttributeConfigReturn {
|
|
30
41
|
const meshCellsCommonStyle = useMeshCellsCommonStyle();
|
|
31
|
-
function meshCellsCellAttribute(
|
|
42
|
+
function meshCellsCellAttribute(meshId: MeshId): AttributeState {
|
|
32
43
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.cell shape is defined by the data style schema.
|
|
33
|
-
return meshCellsCommonStyle.meshCellsColoring(
|
|
44
|
+
return meshCellsCommonStyle.meshCellsColoring(meshId).cell as AttributeState;
|
|
34
45
|
}
|
|
35
46
|
function meshCellsCellAttributeStoredConfig(
|
|
36
|
-
|
|
37
|
-
name:
|
|
38
|
-
item:
|
|
47
|
+
meshId: MeshId,
|
|
48
|
+
name: AttributeName | undefined,
|
|
49
|
+
item: AttributeItem | undefined,
|
|
39
50
|
): AttributeStoredConfig {
|
|
40
|
-
const { storedConfigs } = meshCellsCellAttribute(
|
|
51
|
+
const { storedConfigs } = meshCellsCellAttribute(meshId);
|
|
41
52
|
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
42
53
|
const itemConfig = item === undefined ? undefined : nameConfig?.[item];
|
|
43
54
|
if (itemConfig !== undefined) {
|
|
44
55
|
return itemConfig;
|
|
45
56
|
}
|
|
46
|
-
return
|
|
47
|
-
minimum: undefined,
|
|
48
|
-
maximum: undefined,
|
|
49
|
-
colorMap: undefined,
|
|
50
|
-
no_data_color: DEFAULT_NO_DATA_COLOR,
|
|
51
|
-
};
|
|
57
|
+
return defaultAttributeStoredConfig();
|
|
52
58
|
}
|
|
53
|
-
function meshCellsCellAttributeName(
|
|
54
|
-
return meshCellsCellAttribute(
|
|
59
|
+
function meshCellsCellAttributeName(meshId: MeshId): AttributeName | undefined {
|
|
60
|
+
return meshCellsCellAttribute(meshId).name;
|
|
55
61
|
}
|
|
56
|
-
function meshCellsCellAttributeLastItem(
|
|
57
|
-
const { storedConfigs } = meshCellsCellAttribute(
|
|
62
|
+
function meshCellsCellAttributeLastItem(meshId: MeshId, name: AttributeName | undefined): number {
|
|
63
|
+
const { storedConfigs } = meshCellsCellAttribute(meshId);
|
|
58
64
|
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
59
65
|
if (nameConfig !== undefined) {
|
|
60
66
|
return nameConfig.lastItem;
|
|
61
67
|
}
|
|
62
68
|
return 0;
|
|
63
69
|
}
|
|
64
|
-
function meshCellsCellAttributeItem(
|
|
65
|
-
const { item, name } = meshCellsCellAttribute(
|
|
66
|
-
return item ?? meshCellsCellAttributeLastItem(
|
|
70
|
+
function meshCellsCellAttributeItem(meshId: MeshId): AttributeItem {
|
|
71
|
+
const { item, name } = meshCellsCellAttribute(meshId);
|
|
72
|
+
return item ?? meshCellsCellAttributeLastItem(meshId, name);
|
|
67
73
|
}
|
|
68
74
|
return {
|
|
69
75
|
meshCellsCellAttribute,
|
|
@@ -75,9 +81,9 @@ function useMeshCellsCellAttributeConfig(): UseMeshCellsCellAttributeConfigRetur
|
|
|
75
81
|
}
|
|
76
82
|
|
|
77
83
|
interface UseMeshCellsCellAttributeConfigValuesReturn {
|
|
78
|
-
meshCellsCellAttributeRange: (
|
|
79
|
-
meshCellsCellAttributeColorMap: (
|
|
80
|
-
meshCellsCellAttributeNoDataColor: (
|
|
84
|
+
meshCellsCellAttributeRange: (meshId: MeshId) => AttributeRange;
|
|
85
|
+
meshCellsCellAttributeColorMap: (meshId: MeshId) => AttributeColorMap | undefined;
|
|
86
|
+
meshCellsCellAttributeNoDataColor: (meshId: MeshId) => RGBAColor;
|
|
81
87
|
}
|
|
82
88
|
|
|
83
89
|
function useMeshCellsCellAttributeConfigValues(): UseMeshCellsCellAttributeConfigValuesReturn {
|
|
@@ -86,22 +92,22 @@ function useMeshCellsCellAttributeConfigValues(): UseMeshCellsCellAttributeConfi
|
|
|
86
92
|
meshCellsCellAttributeItem,
|
|
87
93
|
meshCellsCellAttributeStoredConfig,
|
|
88
94
|
} = useMeshCellsCellAttributeConfig();
|
|
89
|
-
function meshCellsCellAttributeRange(
|
|
90
|
-
const name = meshCellsCellAttributeName(
|
|
91
|
-
const item = meshCellsCellAttributeItem(
|
|
92
|
-
const storedConfig = meshCellsCellAttributeStoredConfig(
|
|
95
|
+
function meshCellsCellAttributeRange(meshId: MeshId): AttributeRange {
|
|
96
|
+
const name = meshCellsCellAttributeName(meshId);
|
|
97
|
+
const item = meshCellsCellAttributeItem(meshId);
|
|
98
|
+
const storedConfig = meshCellsCellAttributeStoredConfig(meshId, name, item);
|
|
93
99
|
return [storedConfig.minimum, storedConfig.maximum];
|
|
94
100
|
}
|
|
95
|
-
function meshCellsCellAttributeColorMap(
|
|
96
|
-
const name = meshCellsCellAttributeName(
|
|
97
|
-
const item = meshCellsCellAttributeItem(
|
|
98
|
-
const storedConfig = meshCellsCellAttributeStoredConfig(
|
|
101
|
+
function meshCellsCellAttributeColorMap(meshId: MeshId): AttributeColorMap | undefined {
|
|
102
|
+
const name = meshCellsCellAttributeName(meshId);
|
|
103
|
+
const item = meshCellsCellAttributeItem(meshId);
|
|
104
|
+
const storedConfig = meshCellsCellAttributeStoredConfig(meshId, name, item);
|
|
99
105
|
return storedConfig.colorMap;
|
|
100
106
|
}
|
|
101
|
-
function meshCellsCellAttributeNoDataColor(
|
|
102
|
-
const name = meshCellsCellAttributeName(
|
|
103
|
-
const item = meshCellsCellAttributeItem(
|
|
104
|
-
const storedConfig = meshCellsCellAttributeStoredConfig(
|
|
107
|
+
function meshCellsCellAttributeNoDataColor(meshId: MeshId): RGBAColor {
|
|
108
|
+
const name = meshCellsCellAttributeName(meshId);
|
|
109
|
+
const item = meshCellsCellAttributeItem(meshId);
|
|
110
|
+
const storedConfig = meshCellsCellAttributeStoredConfig(meshId, name, item);
|
|
105
111
|
return storedConfig.no_data_color;
|
|
106
112
|
}
|
|
107
113
|
return {
|
|
@@ -114,10 +120,10 @@ function useMeshCellsCellAttributeConfigValues(): UseMeshCellsCellAttributeConfi
|
|
|
114
120
|
function useMeshCellsCellAttributeConfigWriter(): UseMeshCellsCellAttributeConfigWriterReturn {
|
|
115
121
|
const meshCellsCommonStyle = useMeshCellsCommonStyle();
|
|
116
122
|
async function mutateMeshCellsCellStyle(
|
|
117
|
-
|
|
123
|
+
meshId: MeshId,
|
|
118
124
|
values: Record<string, unknown>,
|
|
119
125
|
): Promise<string> {
|
|
120
|
-
const result = await meshCellsCommonStyle.mutateMeshCellsStyle(
|
|
126
|
+
const result = await meshCellsCommonStyle.mutateMeshCellsStyle(meshId, {
|
|
121
127
|
coloring: {
|
|
122
128
|
cell: values,
|
|
123
129
|
},
|
|
@@ -125,12 +131,12 @@ function useMeshCellsCellAttributeConfigWriter(): UseMeshCellsCellAttributeConfi
|
|
|
125
131
|
return result;
|
|
126
132
|
}
|
|
127
133
|
async function setMeshCellsCellAttributeStoredConfig(
|
|
128
|
-
|
|
129
|
-
name:
|
|
130
|
-
item:
|
|
134
|
+
meshId: MeshId,
|
|
135
|
+
name: AttributeName | undefined,
|
|
136
|
+
item: AttributeItem | undefined,
|
|
131
137
|
config: Partial<AttributeStoredConfig>,
|
|
132
138
|
): Promise<string> {
|
|
133
|
-
const result = await mutateMeshCellsCellStyle(
|
|
139
|
+
const result = await mutateMeshCellsCellStyle(meshId, {
|
|
134
140
|
storedConfigs: {
|
|
135
141
|
[name ?? ""]: {
|
|
136
142
|
lastItem: item,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MeshId } from "@ogw_front/types/identifiers";
|
|
1
2
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
2
3
|
// Third party imports
|
|
3
4
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
@@ -11,18 +12,18 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
|
11
12
|
const schema = viewer_schemas.opengeodeweb_viewer.mesh.cells.color;
|
|
12
13
|
|
|
13
14
|
export function useMeshCellsColorStyle(): ReturnType<typeof useMeshCellsOpacityStyle> & {
|
|
14
|
-
meshCellsColor: (
|
|
15
|
-
setMeshCellsColor: (
|
|
15
|
+
meshCellsColor: (meshId: MeshId) => RGBAColor | undefined;
|
|
16
|
+
setMeshCellsColor: (meshId: MeshId, color: RGBAColor) => Promise<unknown>;
|
|
16
17
|
} {
|
|
17
18
|
const viewerStore = useViewerStore();
|
|
18
19
|
const meshCellsCommonStyle = useMeshCellsCommonStyle();
|
|
19
20
|
|
|
20
|
-
function meshCellsColor(
|
|
21
|
+
function meshCellsColor(meshId: MeshId): RGBAColor | undefined {
|
|
21
22
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.constant shape is defined by the data style schema.
|
|
22
|
-
return meshCellsCommonStyle.meshCellsColoring(
|
|
23
|
+
return meshCellsCommonStyle.meshCellsColoring(meshId).constant as RGBAColor | undefined;
|
|
23
24
|
}
|
|
24
|
-
async function setMeshCellsColor(
|
|
25
|
-
const params = { id, color };
|
|
25
|
+
async function setMeshCellsColor(meshId: MeshId, color: RGBAColor): Promise<unknown> {
|
|
26
|
+
const params = { id: meshId, color };
|
|
26
27
|
const result = await viewerStore.request(
|
|
27
28
|
{
|
|
28
29
|
schema,
|
|
@@ -30,7 +31,7 @@ export function useMeshCellsColorStyle(): ReturnType<typeof useMeshCellsOpacityS
|
|
|
30
31
|
},
|
|
31
32
|
{
|
|
32
33
|
response_function: async () => {
|
|
33
|
-
const mutateResult = await meshCellsCommonStyle.mutateMeshCellsColoring(
|
|
34
|
+
const mutateResult = await meshCellsCommonStyle.mutateMeshCellsColoring(meshId, {
|
|
34
35
|
constant: color,
|
|
35
36
|
});
|
|
36
37
|
return mutateResult;
|
|
@@ -1,40 +1,41 @@
|
|
|
1
|
+
import type { MeshId } from "@ogw_front/types/identifiers";
|
|
1
2
|
import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
|
|
2
3
|
import { useDataStyleState } from "@ogw_internal/stores/data_style/state";
|
|
3
4
|
|
|
4
5
|
export function useMeshCellsCommonStyle(): {
|
|
5
|
-
meshCellsStyle: (
|
|
6
|
-
meshCellsColoring: (
|
|
7
|
-
mutateMeshCellsStyle: (
|
|
8
|
-
mutateMeshCellsColoring: (
|
|
9
|
-
mutateMeshCellsCellStyle: (
|
|
6
|
+
meshCellsStyle: (meshId: MeshId) => StyleValues;
|
|
7
|
+
meshCellsColoring: (meshId: MeshId) => StyleValues;
|
|
8
|
+
mutateMeshCellsStyle: (meshId: MeshId, values: StyleValues) => Promise<string>;
|
|
9
|
+
mutateMeshCellsColoring: (meshId: MeshId, values: StyleValues) => Promise<string>;
|
|
10
|
+
mutateMeshCellsCellStyle: (meshId: MeshId, values: StyleValues) => Promise<string>;
|
|
10
11
|
} {
|
|
11
12
|
const dataStyleState = useDataStyleState();
|
|
12
13
|
|
|
13
|
-
async function mutateMeshCellsStyle(
|
|
14
|
-
const result = await dataStyleState.mutateStyle(
|
|
14
|
+
async function mutateMeshCellsStyle(meshId: MeshId, values: StyleValues): Promise<string> {
|
|
15
|
+
const result = await dataStyleState.mutateStyle(meshId, {
|
|
15
16
|
cells: values,
|
|
16
17
|
});
|
|
17
18
|
return result;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
function meshCellsStyle(
|
|
21
|
-
return dataStyleState.getStyle(
|
|
21
|
+
function meshCellsStyle(meshId: MeshId): StyleValues {
|
|
22
|
+
return dataStyleState.getStyle(meshId).cells ?? {};
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
function meshCellsColoring(
|
|
25
|
+
function meshCellsColoring(meshId: MeshId): StyleValues {
|
|
25
26
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring shape is defined by the data style schema.
|
|
26
|
-
return meshCellsStyle(
|
|
27
|
+
return meshCellsStyle(meshId).coloring as StyleValues;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
async function mutateMeshCellsColoring(
|
|
30
|
-
const result = await mutateMeshCellsStyle(
|
|
30
|
+
async function mutateMeshCellsColoring(meshId: MeshId, values: StyleValues): Promise<string> {
|
|
31
|
+
const result = await mutateMeshCellsStyle(meshId, {
|
|
31
32
|
coloring: values,
|
|
32
33
|
});
|
|
33
34
|
return result;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
async function mutateMeshCellsCellStyle(
|
|
37
|
-
const result = await mutateMeshCellsColoring(
|
|
37
|
+
async function mutateMeshCellsCellStyle(meshId: MeshId, values: StyleValues): Promise<string> {
|
|
38
|
+
const result = await mutateMeshCellsColoring(meshId, {
|
|
38
39
|
cell: values,
|
|
39
40
|
});
|
|
40
41
|
return result;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
// Third party imports
|
|
2
2
|
|
|
3
3
|
// Local imports
|
|
4
|
-
import {
|
|
5
|
-
import { isMeshCellsVertexAttributeValid, useMeshCellsVertexAttributeStyle } from "./vertex";
|
|
4
|
+
import type { MeshId } from "@ogw_front/types/identifiers";
|
|
6
5
|
import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
|
|
6
|
+
import { isAttributeValid } from "@ogw_internal/stores/data_style/attribute_valid";
|
|
7
|
+
import { useMeshCellsCellAttributeStyle } from "./cell";
|
|
7
8
|
import { useMeshCellsColorStyle } from "./color";
|
|
8
9
|
import { useMeshCellsCommonStyle } from "./common";
|
|
9
10
|
import { useMeshCellsTexturesStyle } from "./textures";
|
|
11
|
+
import { useMeshCellsVertexAttributeStyle } from "./vertex";
|
|
10
12
|
import { useMeshCellsVisibilityStyle } from "./visibility";
|
|
11
13
|
import { whenDefined } from "@ogw_internal/stores/data_style/when_defined";
|
|
12
14
|
|
|
@@ -21,82 +23,82 @@ interface MeshCellsActiveColoringDeps {
|
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
function handleMeshCellsVertexColoring(
|
|
24
|
-
|
|
26
|
+
meshId: MeshId,
|
|
25
27
|
vertexAttributeStyle: ReturnType<typeof useMeshCellsVertexAttributeStyle>,
|
|
26
28
|
): Promise<unknown> | undefined {
|
|
27
|
-
const name = vertexAttributeStyle.meshCellsVertexAttributeName(
|
|
28
|
-
const item = vertexAttributeStyle.meshCellsVertexAttributeItem(
|
|
29
|
-
const [minimum, maximum] = vertexAttributeStyle.meshCellsVertexAttributeRange(
|
|
30
|
-
const colorMap = vertexAttributeStyle.meshCellsVertexAttributeColorMap(
|
|
31
|
-
const no_data_color = vertexAttributeStyle.meshCellsVertexAttributeNoDataColor(
|
|
29
|
+
const name = vertexAttributeStyle.meshCellsVertexAttributeName(meshId);
|
|
30
|
+
const item = vertexAttributeStyle.meshCellsVertexAttributeItem(meshId);
|
|
31
|
+
const [minimum, maximum] = vertexAttributeStyle.meshCellsVertexAttributeRange(meshId);
|
|
32
|
+
const colorMap = vertexAttributeStyle.meshCellsVertexAttributeColorMap(meshId);
|
|
33
|
+
const no_data_color = vertexAttributeStyle.meshCellsVertexAttributeNoDataColor(meshId);
|
|
32
34
|
const vertex_attribute = { name, item, minimum, maximum, colorMap, no_data_color };
|
|
33
|
-
if (!
|
|
35
|
+
if (!isAttributeValid(vertex_attribute)) {
|
|
34
36
|
return undefined;
|
|
35
37
|
}
|
|
36
|
-
return vertexAttributeStyle.setMeshCellsVertexAttribute(
|
|
38
|
+
return vertexAttributeStyle.setMeshCellsVertexAttribute(meshId, vertex_attribute);
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
function handleMeshCellsCellColoring(
|
|
40
|
-
|
|
42
|
+
meshId: MeshId,
|
|
41
43
|
cellAttributeStyle: ReturnType<typeof useMeshCellsCellAttributeStyle>,
|
|
42
44
|
): Promise<unknown> | undefined {
|
|
43
|
-
const name = cellAttributeStyle.meshCellsCellAttributeName(
|
|
44
|
-
const item = cellAttributeStyle.meshCellsCellAttributeItem(
|
|
45
|
-
const [minimum, maximum] = cellAttributeStyle.meshCellsCellAttributeRange(
|
|
46
|
-
const colorMap = cellAttributeStyle.meshCellsCellAttributeColorMap(
|
|
47
|
-
const no_data_color = cellAttributeStyle.meshCellsCellAttributeNoDataColor(
|
|
45
|
+
const name = cellAttributeStyle.meshCellsCellAttributeName(meshId);
|
|
46
|
+
const item = cellAttributeStyle.meshCellsCellAttributeItem(meshId);
|
|
47
|
+
const [minimum, maximum] = cellAttributeStyle.meshCellsCellAttributeRange(meshId);
|
|
48
|
+
const colorMap = cellAttributeStyle.meshCellsCellAttributeColorMap(meshId);
|
|
49
|
+
const no_data_color = cellAttributeStyle.meshCellsCellAttributeNoDataColor(meshId);
|
|
48
50
|
const cell_attribute = { name, item, minimum, maximum, colorMap, no_data_color };
|
|
49
|
-
if (!
|
|
51
|
+
if (!isAttributeValid(cell_attribute)) {
|
|
50
52
|
return undefined;
|
|
51
53
|
}
|
|
52
|
-
return cellAttributeStyle.setMeshCellsCellAttribute(
|
|
54
|
+
return cellAttributeStyle.setMeshCellsCellAttribute(meshId, cell_attribute);
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
async function applyMeshCellsActiveColoring(
|
|
56
|
-
|
|
58
|
+
meshId: MeshId,
|
|
57
59
|
type: string | undefined,
|
|
58
60
|
deps: MeshCellsActiveColoringDeps,
|
|
59
61
|
): Promise<unknown> {
|
|
60
|
-
await deps.commonStyle.mutateMeshCellsStyle(
|
|
62
|
+
await deps.commonStyle.mutateMeshCellsStyle(meshId, {
|
|
61
63
|
coloring: { active: type },
|
|
62
64
|
});
|
|
63
65
|
if (type === "constant") {
|
|
64
|
-
const result = await whenDefined(deps.colorStyle.meshCellsColor(
|
|
65
|
-
const applied = await deps.colorStyle.setMeshCellsColor(
|
|
66
|
+
const result = await whenDefined(deps.colorStyle.meshCellsColor(meshId), async (value) => {
|
|
67
|
+
const applied = await deps.colorStyle.setMeshCellsColor(meshId, value);
|
|
66
68
|
return applied;
|
|
67
69
|
});
|
|
68
70
|
return result;
|
|
69
71
|
}
|
|
70
72
|
if (type === "textures") {
|
|
71
|
-
const textures = deps.texturesStyle.meshCellsTextures(
|
|
73
|
+
const textures = deps.texturesStyle.meshCellsTextures(meshId);
|
|
72
74
|
// The viewer requires at least one texture: nothing to apply until one is picked.
|
|
73
75
|
if (textures === undefined || textures.length === 0) {
|
|
74
76
|
return undefined;
|
|
75
77
|
}
|
|
76
|
-
const result = await deps.texturesStyle.setMeshCellsTextures(
|
|
78
|
+
const result = await deps.texturesStyle.setMeshCellsTextures(meshId, textures);
|
|
77
79
|
return result;
|
|
78
80
|
}
|
|
79
81
|
if (type === "vertex") {
|
|
80
|
-
const result = await handleMeshCellsVertexColoring(
|
|
82
|
+
const result = await handleMeshCellsVertexColoring(meshId, deps.vertexAttributeStyle);
|
|
81
83
|
return result;
|
|
82
84
|
}
|
|
83
85
|
if (type === "cell") {
|
|
84
|
-
const result = await handleMeshCellsCellColoring(
|
|
86
|
+
const result = await handleMeshCellsCellColoring(meshId, deps.cellAttributeStyle);
|
|
85
87
|
return result;
|
|
86
88
|
}
|
|
87
89
|
throw new Error(`Unknown mesh cells coloring type: ${type}`);
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
async function setMeshCellsActiveColoring(
|
|
91
|
-
|
|
93
|
+
meshId: MeshId,
|
|
92
94
|
type: string | undefined,
|
|
93
95
|
deps: MeshCellsActiveColoringDeps,
|
|
94
96
|
): Promise<unknown> {
|
|
95
|
-
const result = await applyMeshCellsActiveColoring(
|
|
97
|
+
const result = await applyMeshCellsActiveColoring(meshId, type, deps);
|
|
96
98
|
if (type !== "constant") {
|
|
97
99
|
// Attribute and textures colorings keep the actor opacity: restore the stored one
|
|
98
|
-
await whenDefined(deps.colorStyle.meshCellsOpacity(
|
|
99
|
-
const applied = await deps.colorStyle.setMeshCellsOpacity(
|
|
100
|
+
await whenDefined(deps.colorStyle.meshCellsOpacity(meshId), async (value) => {
|
|
101
|
+
const applied = await deps.colorStyle.setMeshCellsOpacity(meshId, value);
|
|
100
102
|
return applied;
|
|
101
103
|
});
|
|
102
104
|
}
|
|
@@ -104,26 +106,26 @@ async function setMeshCellsActiveColoring(
|
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
async function applyMeshCellsStyle(
|
|
107
|
-
|
|
109
|
+
meshId: MeshId,
|
|
108
110
|
visibilityStyle: ReturnType<typeof useMeshCellsVisibilityStyle>,
|
|
109
111
|
activeColoringType: string | undefined,
|
|
110
112
|
deps: MeshCellsActiveColoringDeps,
|
|
111
113
|
): Promise<unknown[]> {
|
|
112
114
|
const result = await Promise.all([
|
|
113
|
-
whenDefined(visibilityStyle.meshCellsVisibility(
|
|
114
|
-
const applied = await visibilityStyle.setMeshCellsVisibility(
|
|
115
|
+
whenDefined(visibilityStyle.meshCellsVisibility(meshId), async (value) => {
|
|
116
|
+
const applied = await visibilityStyle.setMeshCellsVisibility(meshId, value);
|
|
115
117
|
return applied;
|
|
116
118
|
}),
|
|
117
|
-
setMeshCellsActiveColoring(
|
|
119
|
+
setMeshCellsActiveColoring(meshId, activeColoringType, deps),
|
|
118
120
|
]);
|
|
119
121
|
return result;
|
|
120
122
|
}
|
|
121
123
|
|
|
122
124
|
type UseMeshCellsStyleReturn = ReturnType<typeof useMeshCellsCommonStyle> & {
|
|
123
|
-
meshCellsColoring: (
|
|
124
|
-
meshCellsActiveColoring: (
|
|
125
|
-
setMeshCellsActiveColoring: (
|
|
126
|
-
applyMeshCellsStyle: (
|
|
125
|
+
meshCellsColoring: (meshId: MeshId) => StyleValues;
|
|
126
|
+
meshCellsActiveColoring: (meshId: MeshId) => string | undefined;
|
|
127
|
+
setMeshCellsActiveColoring: (meshId: MeshId, type: string | undefined) => Promise<unknown>;
|
|
128
|
+
applyMeshCellsStyle: (meshId: MeshId) => Promise<unknown[]>;
|
|
127
129
|
} & ReturnType<typeof useMeshCellsVisibilityStyle> &
|
|
128
130
|
ReturnType<typeof useMeshCellsColorStyle> &
|
|
129
131
|
ReturnType<typeof useMeshCellsTexturesStyle> &
|
|
@@ -146,28 +148,28 @@ export function useMeshCellsStyle(): UseMeshCellsStyleReturn {
|
|
|
146
148
|
cellAttributeStyle: meshCellsCellAttributeStyle,
|
|
147
149
|
};
|
|
148
150
|
|
|
149
|
-
function meshCellsColoring(
|
|
150
|
-
return meshCellsCommonStyle.meshCellsColoring(
|
|
151
|
+
function meshCellsColoring(meshId: MeshId): StyleValues {
|
|
152
|
+
return meshCellsCommonStyle.meshCellsColoring(meshId);
|
|
151
153
|
}
|
|
152
154
|
|
|
153
|
-
function meshCellsActiveColoring(
|
|
155
|
+
function meshCellsActiveColoring(meshId: MeshId): string | undefined {
|
|
154
156
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.active is defined as string in the data style schema.
|
|
155
|
-
return meshCellsColoring(
|
|
157
|
+
return meshCellsColoring(meshId).active as string | undefined;
|
|
156
158
|
}
|
|
157
159
|
|
|
158
160
|
async function boundSetMeshCellsActiveColoring(
|
|
159
|
-
|
|
161
|
+
meshId: MeshId,
|
|
160
162
|
type: string | undefined,
|
|
161
163
|
): Promise<unknown> {
|
|
162
|
-
const result = await setMeshCellsActiveColoring(
|
|
164
|
+
const result = await setMeshCellsActiveColoring(meshId, type, activeColoringDeps);
|
|
163
165
|
return result;
|
|
164
166
|
}
|
|
165
167
|
|
|
166
|
-
async function boundApplyMeshCellsStyle(
|
|
168
|
+
async function boundApplyMeshCellsStyle(meshId: MeshId): Promise<unknown[]> {
|
|
167
169
|
const result = await applyMeshCellsStyle(
|
|
168
|
-
|
|
170
|
+
meshId,
|
|
169
171
|
meshCellsVisibility,
|
|
170
|
-
meshCellsActiveColoring(
|
|
172
|
+
meshCellsActiveColoring(meshId),
|
|
171
173
|
activeColoringDeps,
|
|
172
174
|
);
|
|
173
175
|
return result;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { MeshId } from "@ogw_front/types/identifiers";
|
|
2
|
+
import type { Opacity } from "@ogw_front/types/style";
|
|
1
3
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
2
4
|
// Third party imports
|
|
3
5
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
@@ -11,21 +13,21 @@ const schema = viewer_schemas.opengeodeweb_viewer.mesh.cells.opacity;
|
|
|
11
13
|
|
|
12
14
|
// The opacity is the constant color alpha, the viewer applies it whatever the coloring
|
|
13
15
|
export function useMeshCellsOpacityStyle(): {
|
|
14
|
-
meshCellsOpacity: (
|
|
15
|
-
setMeshCellsOpacity: (
|
|
16
|
+
meshCellsOpacity: (meshId: MeshId) => Opacity | undefined;
|
|
17
|
+
setMeshCellsOpacity: (meshId: MeshId, opacity: Opacity) => Promise<unknown>;
|
|
16
18
|
} {
|
|
17
19
|
const viewerStore = useViewerStore();
|
|
18
20
|
const meshCellsCommonStyle = useMeshCellsCommonStyle();
|
|
19
21
|
|
|
20
|
-
function meshCellsConstantColor(
|
|
22
|
+
function meshCellsConstantColor(meshId: MeshId): RGBAColor | undefined {
|
|
21
23
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.constant shape is defined by the data style schema.
|
|
22
|
-
return meshCellsCommonStyle.meshCellsColoring(
|
|
24
|
+
return meshCellsCommonStyle.meshCellsColoring(meshId).constant as RGBAColor | undefined;
|
|
23
25
|
}
|
|
24
|
-
function meshCellsOpacity(
|
|
25
|
-
return meshCellsConstantColor(
|
|
26
|
+
function meshCellsOpacity(meshId: MeshId): Opacity | undefined {
|
|
27
|
+
return meshCellsConstantColor(meshId)?.alpha;
|
|
26
28
|
}
|
|
27
|
-
async function setMeshCellsOpacity(
|
|
28
|
-
const params = { id, opacity };
|
|
29
|
+
async function setMeshCellsOpacity(meshId: MeshId, opacity: Opacity): Promise<unknown> {
|
|
30
|
+
const params = { id: meshId, opacity };
|
|
29
31
|
const result = await viewerStore.request(
|
|
30
32
|
{
|
|
31
33
|
schema,
|
|
@@ -33,11 +35,11 @@ export function useMeshCellsOpacityStyle(): {
|
|
|
33
35
|
},
|
|
34
36
|
{
|
|
35
37
|
response_function: async () => {
|
|
36
|
-
const color = meshCellsConstantColor(
|
|
38
|
+
const color = meshCellsConstantColor(meshId);
|
|
37
39
|
if (color === undefined) {
|
|
38
40
|
return undefined;
|
|
39
41
|
}
|
|
40
|
-
const mutateResult = await meshCellsCommonStyle.mutateMeshCellsColoring(
|
|
42
|
+
const mutateResult = await meshCellsCommonStyle.mutateMeshCellsColoring(meshId, {
|
|
41
43
|
constant: { ...color, alpha: opacity },
|
|
42
44
|
});
|
|
43
45
|
return mutateResult;
|
|
@@ -4,6 +4,7 @@ import viewer_schemas, {
|
|
|
4
4
|
} from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
5
5
|
|
|
6
6
|
// Local imports
|
|
7
|
+
import type { MeshId } from "@ogw_front/types/identifiers";
|
|
7
8
|
import { useMeshCellsCommonStyle } from "./common";
|
|
8
9
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
9
10
|
|
|
@@ -11,26 +12,26 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
|
11
12
|
const schema = viewer_schemas.opengeodeweb_viewer.mesh.apply_textures;
|
|
12
13
|
|
|
13
14
|
export function useMeshCellsTexturesStyle(): {
|
|
14
|
-
meshCellsTextures: (
|
|
15
|
+
meshCellsTextures: (meshId: MeshId) => MeshApplyTexturesParams["textures"] | undefined;
|
|
15
16
|
setMeshCellsTextures: (
|
|
16
|
-
|
|
17
|
+
meshId: MeshId,
|
|
17
18
|
textures: MeshApplyTexturesParams["textures"],
|
|
18
19
|
) => Promise<unknown>;
|
|
19
20
|
} {
|
|
20
21
|
const viewerStore = useViewerStore();
|
|
21
22
|
const meshCellsCommonStyle = useMeshCellsCommonStyle();
|
|
22
23
|
|
|
23
|
-
function meshCellsTextures(
|
|
24
|
+
function meshCellsTextures(meshId: MeshId): MeshApplyTexturesParams["textures"] | undefined {
|
|
24
25
|
// oxlint-disable-next-line no-unsafe-type-assertion -- textures shape is defined by the data style schema.
|
|
25
|
-
return meshCellsCommonStyle.meshCellsColoring(
|
|
26
|
+
return meshCellsCommonStyle.meshCellsColoring(meshId).textures as
|
|
26
27
|
| MeshApplyTexturesParams["textures"]
|
|
27
28
|
| undefined;
|
|
28
29
|
}
|
|
29
30
|
async function setMeshCellsTextures(
|
|
30
|
-
|
|
31
|
+
meshId: MeshId,
|
|
31
32
|
textures: MeshApplyTexturesParams["textures"],
|
|
32
33
|
): Promise<unknown> {
|
|
33
|
-
const params = { id, textures };
|
|
34
|
+
const params = { id: meshId, textures };
|
|
34
35
|
const result = await viewerStore.request(
|
|
35
36
|
{
|
|
36
37
|
schema,
|
|
@@ -38,7 +39,7 @@ export function useMeshCellsTexturesStyle(): {
|
|
|
38
39
|
},
|
|
39
40
|
{
|
|
40
41
|
response_function: async () => {
|
|
41
|
-
const mutateResult = await meshCellsCommonStyle.mutateMeshCellsStyle(
|
|
42
|
+
const mutateResult = await meshCellsCommonStyle.mutateMeshCellsStyle(meshId, {
|
|
42
43
|
coloring: { textures },
|
|
43
44
|
});
|
|
44
45
|
return mutateResult;
|