@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,78 @@
|
|
|
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 { useMeshEdgesCommonStyle } from "./common";
|
|
6
17
|
|
|
7
18
|
interface UseMeshEdgesVertexAttributeConfigReturn {
|
|
8
|
-
meshEdgesVertexAttribute: (
|
|
9
|
-
meshEdgesVertexAttributeName: (
|
|
10
|
-
meshEdgesVertexAttributeLastItem: (
|
|
11
|
-
meshEdgesVertexAttributeItem: (
|
|
19
|
+
meshEdgesVertexAttribute: (meshId: MeshId) => AttributeState;
|
|
20
|
+
meshEdgesVertexAttributeName: (meshId: MeshId) => AttributeName | undefined;
|
|
21
|
+
meshEdgesVertexAttributeLastItem: (meshId: MeshId, name: AttributeName | undefined) => number;
|
|
22
|
+
meshEdgesVertexAttributeItem: (meshId: MeshId) => AttributeItem;
|
|
12
23
|
meshEdgesVertexAttributeStoredConfig: (
|
|
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 UseMeshEdgesVertexAttributeConfigWriterReturn {
|
|
20
|
-
mutateMeshEdgesVertexStyle: (
|
|
31
|
+
mutateMeshEdgesVertexStyle: (meshId: MeshId, values: Record<string, unknown>) => Promise<string>;
|
|
21
32
|
setMeshEdgesVertexAttributeStoredConfig: (
|
|
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 useMeshEdgesVertexAttributeConfig(): UseMeshEdgesVertexAttributeConfigReturn {
|
|
30
41
|
const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
|
|
31
|
-
function meshEdgesVertexAttribute(
|
|
42
|
+
function meshEdgesVertexAttribute(meshId: MeshId): AttributeState {
|
|
32
43
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.vertex shape is defined by the data style schema.
|
|
33
|
-
return meshEdgesCommonStyle.meshEdgesColoring(
|
|
44
|
+
return meshEdgesCommonStyle.meshEdgesColoring(meshId).vertex as AttributeState;
|
|
34
45
|
}
|
|
35
46
|
function meshEdgesVertexAttributeStoredConfig(
|
|
36
|
-
|
|
37
|
-
name:
|
|
38
|
-
item:
|
|
47
|
+
meshId: MeshId,
|
|
48
|
+
name: AttributeName | undefined,
|
|
49
|
+
item: AttributeItem | undefined,
|
|
39
50
|
): AttributeStoredConfig {
|
|
40
|
-
const { storedConfigs } = meshEdgesVertexAttribute(
|
|
51
|
+
const { storedConfigs } = meshEdgesVertexAttribute(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 meshEdgesVertexAttributeName(
|
|
54
|
-
return meshEdgesVertexAttribute(
|
|
59
|
+
function meshEdgesVertexAttributeName(meshId: MeshId): AttributeName | undefined {
|
|
60
|
+
return meshEdgesVertexAttribute(meshId).name;
|
|
55
61
|
}
|
|
56
|
-
function meshEdgesVertexAttributeLastItem(
|
|
57
|
-
|
|
62
|
+
function meshEdgesVertexAttributeLastItem(
|
|
63
|
+
meshId: MeshId,
|
|
64
|
+
name: AttributeName | undefined,
|
|
65
|
+
): number {
|
|
66
|
+
const { storedConfigs } = meshEdgesVertexAttribute(meshId);
|
|
58
67
|
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
59
68
|
if (nameConfig !== undefined) {
|
|
60
69
|
return nameConfig.lastItem;
|
|
61
70
|
}
|
|
62
71
|
return 0;
|
|
63
72
|
}
|
|
64
|
-
function meshEdgesVertexAttributeItem(
|
|
65
|
-
const { item, name } = meshEdgesVertexAttribute(
|
|
66
|
-
return item ?? meshEdgesVertexAttributeLastItem(
|
|
73
|
+
function meshEdgesVertexAttributeItem(meshId: MeshId): AttributeItem {
|
|
74
|
+
const { item, name } = meshEdgesVertexAttribute(meshId);
|
|
75
|
+
return item ?? meshEdgesVertexAttributeLastItem(meshId, name);
|
|
67
76
|
}
|
|
68
77
|
return {
|
|
69
78
|
meshEdgesVertexAttribute,
|
|
@@ -75,9 +84,9 @@ function useMeshEdgesVertexAttributeConfig(): UseMeshEdgesVertexAttributeConfigR
|
|
|
75
84
|
}
|
|
76
85
|
|
|
77
86
|
interface UseMeshEdgesVertexAttributeConfigValuesReturn {
|
|
78
|
-
meshEdgesVertexAttributeRange: (
|
|
79
|
-
meshEdgesVertexAttributeColorMap: (
|
|
80
|
-
meshEdgesVertexAttributeNoDataColor: (
|
|
87
|
+
meshEdgesVertexAttributeRange: (meshId: MeshId) => AttributeRange;
|
|
88
|
+
meshEdgesVertexAttributeColorMap: (meshId: MeshId) => AttributeColorMap | undefined;
|
|
89
|
+
meshEdgesVertexAttributeNoDataColor: (meshId: MeshId) => RGBAColor;
|
|
81
90
|
}
|
|
82
91
|
|
|
83
92
|
function useMeshEdgesVertexAttributeConfigValues(): UseMeshEdgesVertexAttributeConfigValuesReturn {
|
|
@@ -86,22 +95,22 @@ function useMeshEdgesVertexAttributeConfigValues(): UseMeshEdgesVertexAttributeC
|
|
|
86
95
|
meshEdgesVertexAttributeItem,
|
|
87
96
|
meshEdgesVertexAttributeStoredConfig,
|
|
88
97
|
} = useMeshEdgesVertexAttributeConfig();
|
|
89
|
-
function meshEdgesVertexAttributeRange(
|
|
90
|
-
const name = meshEdgesVertexAttributeName(
|
|
91
|
-
const item = meshEdgesVertexAttributeItem(
|
|
92
|
-
const storedConfig = meshEdgesVertexAttributeStoredConfig(
|
|
98
|
+
function meshEdgesVertexAttributeRange(meshId: MeshId): AttributeRange {
|
|
99
|
+
const name = meshEdgesVertexAttributeName(meshId);
|
|
100
|
+
const item = meshEdgesVertexAttributeItem(meshId);
|
|
101
|
+
const storedConfig = meshEdgesVertexAttributeStoredConfig(meshId, name, item);
|
|
93
102
|
return [storedConfig.minimum, storedConfig.maximum];
|
|
94
103
|
}
|
|
95
|
-
function meshEdgesVertexAttributeColorMap(
|
|
96
|
-
const name = meshEdgesVertexAttributeName(
|
|
97
|
-
const item = meshEdgesVertexAttributeItem(
|
|
98
|
-
const storedConfig = meshEdgesVertexAttributeStoredConfig(
|
|
104
|
+
function meshEdgesVertexAttributeColorMap(meshId: MeshId): AttributeColorMap | undefined {
|
|
105
|
+
const name = meshEdgesVertexAttributeName(meshId);
|
|
106
|
+
const item = meshEdgesVertexAttributeItem(meshId);
|
|
107
|
+
const storedConfig = meshEdgesVertexAttributeStoredConfig(meshId, name, item);
|
|
99
108
|
return storedConfig.colorMap;
|
|
100
109
|
}
|
|
101
|
-
function meshEdgesVertexAttributeNoDataColor(
|
|
102
|
-
const name = meshEdgesVertexAttributeName(
|
|
103
|
-
const item = meshEdgesVertexAttributeItem(
|
|
104
|
-
const storedConfig = meshEdgesVertexAttributeStoredConfig(
|
|
110
|
+
function meshEdgesVertexAttributeNoDataColor(meshId: MeshId): RGBAColor {
|
|
111
|
+
const name = meshEdgesVertexAttributeName(meshId);
|
|
112
|
+
const item = meshEdgesVertexAttributeItem(meshId);
|
|
113
|
+
const storedConfig = meshEdgesVertexAttributeStoredConfig(meshId, name, item);
|
|
105
114
|
return storedConfig.no_data_color;
|
|
106
115
|
}
|
|
107
116
|
return {
|
|
@@ -114,10 +123,10 @@ function useMeshEdgesVertexAttributeConfigValues(): UseMeshEdgesVertexAttributeC
|
|
|
114
123
|
function useMeshEdgesVertexAttributeConfigWriter(): UseMeshEdgesVertexAttributeConfigWriterReturn {
|
|
115
124
|
const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
|
|
116
125
|
async function mutateMeshEdgesVertexStyle(
|
|
117
|
-
|
|
126
|
+
meshId: MeshId,
|
|
118
127
|
values: Record<string, unknown>,
|
|
119
128
|
): Promise<string> {
|
|
120
|
-
const result = await meshEdgesCommonStyle.mutateMeshEdgesStyle(
|
|
129
|
+
const result = await meshEdgesCommonStyle.mutateMeshEdgesStyle(meshId, {
|
|
121
130
|
coloring: {
|
|
122
131
|
vertex: values,
|
|
123
132
|
},
|
|
@@ -125,12 +134,12 @@ function useMeshEdgesVertexAttributeConfigWriter(): UseMeshEdgesVertexAttributeC
|
|
|
125
134
|
return result;
|
|
126
135
|
}
|
|
127
136
|
async function setMeshEdgesVertexAttributeStoredConfig(
|
|
128
|
-
|
|
129
|
-
name:
|
|
130
|
-
item:
|
|
137
|
+
meshId: MeshId,
|
|
138
|
+
name: AttributeName | undefined,
|
|
139
|
+
item: AttributeItem | undefined,
|
|
131
140
|
config: Partial<AttributeStoredConfig>,
|
|
132
141
|
): Promise<string> {
|
|
133
|
-
const result = await mutateMeshEdgesVertexStyle(
|
|
142
|
+
const result = await mutateMeshEdgesVertexStyle(meshId, {
|
|
134
143
|
storedConfigs: {
|
|
135
144
|
[name ?? ""]: {
|
|
136
145
|
lastItem: item,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Third party imports
|
|
2
2
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
3
3
|
|
|
4
|
+
import type { MeshId } from "@ogw_front/types/identifiers";
|
|
5
|
+
import type { Visibility } from "@ogw_front/types/style";
|
|
4
6
|
import { useMeshEdgesCommonStyle } from "./common";
|
|
5
7
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
6
8
|
|
|
@@ -8,18 +10,18 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
|
8
10
|
const schema = viewer_schemas.opengeodeweb_viewer.mesh.edges.visibility;
|
|
9
11
|
|
|
10
12
|
export function useMeshEdgesVisibilityStyle(): {
|
|
11
|
-
meshEdgesVisibility: (
|
|
12
|
-
setMeshEdgesVisibility: (
|
|
13
|
+
meshEdgesVisibility: (meshId: MeshId) => Visibility | undefined;
|
|
14
|
+
setMeshEdgesVisibility: (meshId: MeshId, visibility: Visibility) => Promise<unknown>;
|
|
13
15
|
} {
|
|
14
16
|
const viewerStore = useViewerStore();
|
|
15
17
|
const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
|
|
16
18
|
|
|
17
|
-
function meshEdgesVisibility(
|
|
19
|
+
function meshEdgesVisibility(meshId: MeshId): Visibility | undefined {
|
|
18
20
|
// oxlint-disable-next-line no-unsafe-type-assertion -- visibility is defined as boolean in the data style schema.
|
|
19
|
-
return meshEdgesCommonStyle.meshEdgesStyle(
|
|
21
|
+
return meshEdgesCommonStyle.meshEdgesStyle(meshId).visibility as Visibility | undefined;
|
|
20
22
|
}
|
|
21
|
-
async function setMeshEdgesVisibility(
|
|
22
|
-
const params = { id, visibility };
|
|
23
|
+
async function setMeshEdgesVisibility(meshId: MeshId, visibility: Visibility): Promise<unknown> {
|
|
24
|
+
const params = { id: meshId, visibility };
|
|
23
25
|
const result = await viewerStore.request(
|
|
24
26
|
{
|
|
25
27
|
schema,
|
|
@@ -27,7 +29,9 @@ export function useMeshEdgesVisibilityStyle(): {
|
|
|
27
29
|
},
|
|
28
30
|
{
|
|
29
31
|
response_function: async () => {
|
|
30
|
-
const mutateResult = await meshEdgesCommonStyle.mutateMeshEdgesStyle(
|
|
32
|
+
const mutateResult = await meshEdgesCommonStyle.mutateMeshEdgesStyle(meshId, {
|
|
33
|
+
visibility,
|
|
34
|
+
});
|
|
31
35
|
return mutateResult;
|
|
32
36
|
},
|
|
33
37
|
},
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Third party imports
|
|
2
2
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
3
3
|
|
|
4
|
+
import type { MeshId } from "@ogw_front/types/identifiers";
|
|
5
|
+
import type { Width } from "@ogw_front/types/style";
|
|
4
6
|
import { useMeshEdgesCommonStyle } from "./common";
|
|
5
7
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
6
8
|
|
|
@@ -8,18 +10,18 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
|
8
10
|
const schema = viewer_schemas.opengeodeweb_viewer.mesh.edges.width;
|
|
9
11
|
|
|
10
12
|
export function useMeshEdgesWidthStyle(): {
|
|
11
|
-
meshEdgesWidth: (
|
|
12
|
-
setMeshEdgesWidth: (
|
|
13
|
+
meshEdgesWidth: (meshId: MeshId) => Width | undefined;
|
|
14
|
+
setMeshEdgesWidth: (meshId: MeshId, width: Width) => Promise<unknown>;
|
|
13
15
|
} {
|
|
14
16
|
const viewerStore = useViewerStore();
|
|
15
17
|
const meshEdgesCommonStyle = useMeshEdgesCommonStyle();
|
|
16
18
|
|
|
17
|
-
function meshEdgesWidth(
|
|
19
|
+
function meshEdgesWidth(meshId: MeshId): Width | undefined {
|
|
18
20
|
// oxlint-disable-next-line no-unsafe-type-assertion -- width is defined as number in the data style schema.
|
|
19
|
-
return meshEdgesCommonStyle.meshEdgesStyle(
|
|
21
|
+
return meshEdgesCommonStyle.meshEdgesStyle(meshId).width as Width | undefined;
|
|
20
22
|
}
|
|
21
|
-
async function setMeshEdgesWidth(
|
|
22
|
-
const params = { id, width };
|
|
23
|
+
async function setMeshEdgesWidth(meshId: MeshId, width: Width): Promise<unknown> {
|
|
24
|
+
const params = { id: meshId, width };
|
|
23
25
|
const result = await viewerStore.request(
|
|
24
26
|
{
|
|
25
27
|
schema,
|
|
@@ -27,7 +29,7 @@ export function useMeshEdgesWidthStyle(): {
|
|
|
27
29
|
},
|
|
28
30
|
{
|
|
29
31
|
response_function: async () => {
|
|
30
|
-
const mutateResult = await meshEdgesCommonStyle.mutateMeshEdgesStyle(
|
|
32
|
+
const mutateResult = await meshEdgesCommonStyle.mutateMeshEdgesStyle(meshId, { width });
|
|
31
33
|
return mutateResult;
|
|
32
34
|
},
|
|
33
35
|
},
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { AttributeTimeStep } from "@ogw_front/types/attribute";
|
|
2
|
+
import type { MeshId } from "@ogw_front/types/identifiers";
|
|
1
3
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
4
|
+
import type { Visibility } from "@ogw_front/types/style";
|
|
2
5
|
|
|
3
6
|
// Local imports
|
|
4
7
|
import { useDataStyleState } from "@ogw_internal/stores/data_style/state";
|
|
@@ -12,11 +15,11 @@ import { whenDefined } from "@ogw_internal/stores/data_style/when_defined";
|
|
|
12
15
|
|
|
13
16
|
// oxlint-disable-next-line max-lines-per-function
|
|
14
17
|
export function useMeshStyle(): {
|
|
15
|
-
meshVisibility: (
|
|
16
|
-
setMeshVisibility: (
|
|
17
|
-
meshColor: (
|
|
18
|
-
setMeshColor: (
|
|
19
|
-
applyMeshStyle: (
|
|
18
|
+
meshVisibility: (meshId: MeshId) => Visibility | undefined;
|
|
19
|
+
setMeshVisibility: (meshId: MeshId, visibility: Visibility) => Promise<unknown>;
|
|
20
|
+
meshColor: (meshId: MeshId) => RGBAColor | undefined;
|
|
21
|
+
setMeshColor: (meshId: MeshId, color: RGBAColor) => Promise<unknown>;
|
|
22
|
+
applyMeshStyle: (meshId: MeshId) => Promise<unknown[]>;
|
|
20
23
|
} & ReturnType<typeof useMeshPointsStyle> &
|
|
21
24
|
ReturnType<typeof useMeshEdgesStyle> &
|
|
22
25
|
ReturnType<typeof useMeshCellsStyle> &
|
|
@@ -70,22 +73,22 @@ export function useMeshStyle(): {
|
|
|
70
73
|
// The vertex series is shared by all the cards: re-render the other cards showing it
|
|
71
74
|
function sharedVertexTimeStep(
|
|
72
75
|
card: (typeof vertexCards)[number],
|
|
73
|
-
): (
|
|
74
|
-
return async (
|
|
75
|
-
const result = await card.setTimeStep(
|
|
76
|
-
const name = card.name(
|
|
77
|
-
const style = dataStyleState.getStyle(
|
|
76
|
+
): (meshId: MeshId, timeStep: AttributeTimeStep) => Promise<unknown> {
|
|
77
|
+
return async (meshId, timeStep) => {
|
|
78
|
+
const result = await card.setTimeStep(meshId, timeStep);
|
|
79
|
+
const name = card.name(meshId);
|
|
80
|
+
const style = dataStyleState.getStyle(meshId);
|
|
78
81
|
const others = vertexCards.filter(
|
|
79
82
|
(other) =>
|
|
80
83
|
other !== card &&
|
|
81
84
|
style[other.key] !== undefined &&
|
|
82
|
-
other.active(
|
|
83
|
-
other.name(
|
|
85
|
+
other.active(meshId) === "vertex" &&
|
|
86
|
+
other.name(meshId) === name,
|
|
84
87
|
);
|
|
85
88
|
if (name !== undefined) {
|
|
86
89
|
await Promise.all(
|
|
87
90
|
others.map(async (other) => {
|
|
88
|
-
await other.setActive(
|
|
91
|
+
await other.setActive(meshId, "vertex");
|
|
89
92
|
}),
|
|
90
93
|
);
|
|
91
94
|
}
|
|
@@ -93,41 +96,41 @@ export function useMeshStyle(): {
|
|
|
93
96
|
};
|
|
94
97
|
}
|
|
95
98
|
|
|
96
|
-
async function applyMeshStyle(
|
|
97
|
-
const style = dataStyleState.getStyle(
|
|
99
|
+
async function applyMeshStyle(meshId: MeshId): Promise<unknown[]> {
|
|
100
|
+
const style = dataStyleState.getStyle(meshId);
|
|
98
101
|
const promise_array: unknown[] = [];
|
|
99
102
|
for (const key of Object.keys(style)) {
|
|
100
103
|
if (key === "visibility") {
|
|
101
104
|
promise_array.push(
|
|
102
105
|
whenDefined(style.visibility, async (visibility) => {
|
|
103
|
-
const applied = await setMeshVisibility(
|
|
106
|
+
const applied = await setMeshVisibility(meshId, visibility);
|
|
104
107
|
return applied;
|
|
105
108
|
}),
|
|
106
109
|
);
|
|
107
110
|
} else if (key === "color") {
|
|
108
111
|
promise_array.push(
|
|
109
|
-
whenDefined(meshColor(
|
|
110
|
-
const applied = await setMeshColor(
|
|
112
|
+
whenDefined(meshColor(meshId), async (color) => {
|
|
113
|
+
const applied = await setMeshColor(meshId, color);
|
|
111
114
|
return applied;
|
|
112
115
|
}),
|
|
113
116
|
);
|
|
114
117
|
} else if (key === "points") {
|
|
115
|
-
promise_array.push(meshPointsStyle.applyMeshPointsStyle(
|
|
118
|
+
promise_array.push(meshPointsStyle.applyMeshPointsStyle(meshId));
|
|
116
119
|
} else if (key === "edges") {
|
|
117
|
-
promise_array.push(meshEdgesStyle.applyMeshEdgesStyle(
|
|
120
|
+
promise_array.push(meshEdgesStyle.applyMeshEdgesStyle(meshId));
|
|
118
121
|
} else if (key === "cells") {
|
|
119
|
-
promise_array.push(meshCellsStyle.applyMeshCellsStyle(
|
|
122
|
+
promise_array.push(meshCellsStyle.applyMeshCellsStyle(meshId));
|
|
120
123
|
} else if (key === "polygons") {
|
|
121
|
-
promise_array.push(meshPolygonsStyle.applyMeshPolygonsStyle(
|
|
124
|
+
promise_array.push(meshPolygonsStyle.applyMeshPolygonsStyle(meshId));
|
|
122
125
|
} else if (key === "polyhedra") {
|
|
123
|
-
promise_array.push(meshPolyhedraStyle.applyMeshPolyhedraStyle(
|
|
126
|
+
promise_array.push(meshPolyhedraStyle.applyMeshPolyhedraStyle(meshId));
|
|
124
127
|
} else if (
|
|
125
128
|
key === "corners" ||
|
|
126
129
|
key === "lines" ||
|
|
127
130
|
key === "surfaces" ||
|
|
128
131
|
key === "blocks" ||
|
|
129
132
|
key === "attributes" ||
|
|
130
|
-
key === "
|
|
133
|
+
key === "data_id"
|
|
131
134
|
) {
|
|
132
135
|
// These keys are either handled elsewhere or not applicable to mesh objects
|
|
133
136
|
continue;
|
|
@@ -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.points.color;
|
|
12
13
|
|
|
13
14
|
export function useMeshPointsColorStyle(): ReturnType<typeof useMeshPointsOpacityStyle> & {
|
|
14
|
-
meshPointsColor: (
|
|
15
|
-
setMeshPointsColor: (
|
|
15
|
+
meshPointsColor: (meshId: MeshId) => RGBAColor | undefined;
|
|
16
|
+
setMeshPointsColor: (meshId: MeshId, color: RGBAColor) => Promise<unknown>;
|
|
16
17
|
} {
|
|
17
18
|
const viewerStore = useViewerStore();
|
|
18
19
|
const meshPointsCommonStyle = useMeshPointsCommonStyle();
|
|
19
20
|
|
|
20
|
-
function meshPointsColor(
|
|
21
|
+
function meshPointsColor(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 meshPointsCommonStyle.meshPointsColoring(
|
|
23
|
+
return meshPointsCommonStyle.meshPointsColoring(meshId).constant as RGBAColor | undefined;
|
|
23
24
|
}
|
|
24
|
-
async function setMeshPointsColor(
|
|
25
|
-
const params = { id, color };
|
|
25
|
+
async function setMeshPointsColor(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 useMeshPointsColorStyle(): ReturnType<typeof useMeshPointsOpacit
|
|
|
30
31
|
},
|
|
31
32
|
{
|
|
32
33
|
response_function: async () => {
|
|
33
|
-
const mutateResult = await meshPointsCommonStyle.mutateMeshPointsColoring(
|
|
34
|
+
const mutateResult = await meshPointsCommonStyle.mutateMeshPointsColoring(meshId, {
|
|
34
35
|
constant: color,
|
|
35
36
|
});
|
|
36
37
|
return mutateResult;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
+
import type { MeshId } from "@ogw_front/types/identifiers";
|
|
1
2
|
import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
|
|
3
|
+
import type { Visibility } from "@ogw_front/types/style";
|
|
2
4
|
import { useDataStyleState } from "@ogw_internal/stores/data_style/state";
|
|
3
5
|
|
|
4
6
|
export function useMeshPointsCommonStyle(): {
|
|
5
|
-
meshPointsStyle: (
|
|
6
|
-
meshPointsColoring: (
|
|
7
|
-
mutateMeshPointsColoring: (
|
|
8
|
-
mutateMeshPointsStyle: (
|
|
9
|
-
mutateMeshPointsVisibility: (response: { id: string; visibility:
|
|
7
|
+
meshPointsStyle: (meshId: MeshId) => StyleValues;
|
|
8
|
+
meshPointsColoring: (meshId: MeshId) => StyleValues;
|
|
9
|
+
mutateMeshPointsColoring: (meshId: MeshId, values: StyleValues) => Promise<string>;
|
|
10
|
+
mutateMeshPointsStyle: (meshId: MeshId, values: StyleValues) => Promise<string>;
|
|
11
|
+
mutateMeshPointsVisibility: (response: { id: string; visibility: Visibility }) => Promise<string>;
|
|
10
12
|
} {
|
|
11
13
|
const dataStyleState = useDataStyleState();
|
|
12
14
|
|
|
13
|
-
async function mutateMeshPointsStyle(
|
|
14
|
-
const result = await dataStyleState.mutateStyle(
|
|
15
|
+
async function mutateMeshPointsStyle(meshId: MeshId, values: StyleValues): Promise<string> {
|
|
16
|
+
const result = await dataStyleState.mutateStyle(meshId, {
|
|
15
17
|
points: values,
|
|
16
18
|
});
|
|
17
19
|
return result;
|
|
@@ -19,23 +21,23 @@ export function useMeshPointsCommonStyle(): {
|
|
|
19
21
|
|
|
20
22
|
async function mutateMeshPointsVisibility(response: {
|
|
21
23
|
id: string;
|
|
22
|
-
visibility:
|
|
24
|
+
visibility: Visibility;
|
|
23
25
|
}): Promise<string> {
|
|
24
26
|
const result = await mutateMeshPointsStyle(response.id, { visibility: response.visibility });
|
|
25
27
|
return result;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
function meshPointsStyle(
|
|
29
|
-
return dataStyleState.getStyle(
|
|
30
|
+
function meshPointsStyle(meshId: MeshId): StyleValues {
|
|
31
|
+
return dataStyleState.getStyle(meshId).points ?? {};
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
function meshPointsColoring(
|
|
34
|
+
function meshPointsColoring(meshId: MeshId): StyleValues {
|
|
33
35
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring shape is defined by the data style schema.
|
|
34
|
-
return meshPointsStyle(
|
|
36
|
+
return meshPointsStyle(meshId).coloring as StyleValues;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
async function mutateMeshPointsColoring(
|
|
38
|
-
const result = await mutateMeshPointsStyle(
|
|
39
|
+
async function mutateMeshPointsColoring(meshId: MeshId, values: StyleValues): Promise<string> {
|
|
40
|
+
const result = await mutateMeshPointsStyle(meshId, {
|
|
39
41
|
coloring: values,
|
|
40
42
|
});
|
|
41
43
|
return result;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// Third party imports
|
|
2
2
|
|
|
3
3
|
// Local imports
|
|
4
|
-
import {
|
|
4
|
+
import type { MeshId } from "@ogw_front/types/identifiers";
|
|
5
5
|
import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
|
|
6
|
+
import { isAttributeValid } from "@ogw_internal/stores/data_style/attribute_valid";
|
|
6
7
|
import { useMeshPointsColorStyle } from "./color";
|
|
7
8
|
import { useMeshPointsCommonStyle } from "./common";
|
|
8
9
|
import { useMeshPointsSizeStyle } from "./size";
|
|
10
|
+
import { useMeshPointsVertexAttributeStyle } from "./vertex";
|
|
9
11
|
import { useMeshPointsVisibilityStyle } from "./visibility";
|
|
10
12
|
import { whenDefined } from "@ogw_internal/stores/data_style/when_defined";
|
|
11
13
|
|
|
@@ -18,53 +20,53 @@ interface MeshPointsActiveColoringDeps {
|
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
function handleMeshPointsVertexColoring(
|
|
21
|
-
|
|
23
|
+
meshId: MeshId,
|
|
22
24
|
vertexAttributeStyle: ReturnType<typeof useMeshPointsVertexAttributeStyle>,
|
|
23
25
|
): Promise<unknown> | undefined {
|
|
24
|
-
const name = vertexAttributeStyle.meshPointsVertexAttributeName(
|
|
25
|
-
const item = vertexAttributeStyle.meshPointsVertexAttributeItem(
|
|
26
|
-
const [minimum, maximum] = vertexAttributeStyle.meshPointsVertexAttributeRange(
|
|
27
|
-
const colorMap = vertexAttributeStyle.meshPointsVertexAttributeColorMap(
|
|
28
|
-
const no_data_color = vertexAttributeStyle.meshPointsVertexAttributeNoDataColor(
|
|
26
|
+
const name = vertexAttributeStyle.meshPointsVertexAttributeName(meshId);
|
|
27
|
+
const item = vertexAttributeStyle.meshPointsVertexAttributeItem(meshId);
|
|
28
|
+
const [minimum, maximum] = vertexAttributeStyle.meshPointsVertexAttributeRange(meshId);
|
|
29
|
+
const colorMap = vertexAttributeStyle.meshPointsVertexAttributeColorMap(meshId);
|
|
30
|
+
const no_data_color = vertexAttributeStyle.meshPointsVertexAttributeNoDataColor(meshId);
|
|
29
31
|
const vertex_attribute = { name, item, minimum, maximum, colorMap, no_data_color };
|
|
30
|
-
if (!
|
|
32
|
+
if (!isAttributeValid(vertex_attribute)) {
|
|
31
33
|
return undefined;
|
|
32
34
|
}
|
|
33
|
-
return vertexAttributeStyle.setMeshPointsVertexAttribute(
|
|
35
|
+
return vertexAttributeStyle.setMeshPointsVertexAttribute(meshId, vertex_attribute);
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
async function applyMeshPointsActiveColoring(
|
|
37
|
-
|
|
39
|
+
meshId: MeshId,
|
|
38
40
|
type: string | undefined,
|
|
39
41
|
deps: MeshPointsActiveColoringDeps,
|
|
40
42
|
): Promise<unknown> {
|
|
41
|
-
await deps.commonStyle.mutateMeshPointsStyle(
|
|
43
|
+
await deps.commonStyle.mutateMeshPointsStyle(meshId, {
|
|
42
44
|
coloring: { active: type },
|
|
43
45
|
});
|
|
44
46
|
if (type === "constant") {
|
|
45
|
-
const result = await whenDefined(deps.colorStyle.meshPointsColor(
|
|
46
|
-
const applied = await deps.colorStyle.setMeshPointsColor(
|
|
47
|
+
const result = await whenDefined(deps.colorStyle.meshPointsColor(meshId), async (value) => {
|
|
48
|
+
const applied = await deps.colorStyle.setMeshPointsColor(meshId, value);
|
|
47
49
|
return applied;
|
|
48
50
|
});
|
|
49
51
|
return result;
|
|
50
52
|
}
|
|
51
53
|
if (type === "vertex") {
|
|
52
|
-
const result = await handleMeshPointsVertexColoring(
|
|
54
|
+
const result = await handleMeshPointsVertexColoring(meshId, deps.vertexAttributeStyle);
|
|
53
55
|
return result;
|
|
54
56
|
}
|
|
55
57
|
throw new Error(`Unknown mesh points coloring type: ${type}`);
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
async function setMeshPointsActiveColoring(
|
|
59
|
-
|
|
61
|
+
meshId: MeshId,
|
|
60
62
|
type: string | undefined,
|
|
61
63
|
deps: MeshPointsActiveColoringDeps,
|
|
62
64
|
): Promise<unknown> {
|
|
63
|
-
const result = await applyMeshPointsActiveColoring(
|
|
65
|
+
const result = await applyMeshPointsActiveColoring(meshId, type, deps);
|
|
64
66
|
if (type !== "constant") {
|
|
65
67
|
// Attribute and textures colorings keep the actor opacity: restore the stored one
|
|
66
|
-
await whenDefined(deps.colorStyle.meshPointsOpacity(
|
|
67
|
-
const applied = await deps.colorStyle.setMeshPointsOpacity(
|
|
68
|
+
await whenDefined(deps.colorStyle.meshPointsOpacity(meshId), async (value) => {
|
|
69
|
+
const applied = await deps.colorStyle.setMeshPointsOpacity(meshId, value);
|
|
68
70
|
return applied;
|
|
69
71
|
});
|
|
70
72
|
}
|
|
@@ -72,31 +74,31 @@ async function setMeshPointsActiveColoring(
|
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
async function applyMeshPointsStyle(
|
|
75
|
-
|
|
77
|
+
meshId: MeshId,
|
|
76
78
|
visibilityStyle: ReturnType<typeof useMeshPointsVisibilityStyle>,
|
|
77
79
|
sizeStyle: ReturnType<typeof useMeshPointsSizeStyle>,
|
|
78
80
|
activeColoringType: string | undefined,
|
|
79
81
|
deps: MeshPointsActiveColoringDeps,
|
|
80
82
|
): Promise<unknown[]> {
|
|
81
83
|
const result = await Promise.all([
|
|
82
|
-
whenDefined(visibilityStyle.meshPointsVisibility(
|
|
83
|
-
const applied = await visibilityStyle.setMeshPointsVisibility(
|
|
84
|
+
whenDefined(visibilityStyle.meshPointsVisibility(meshId), async (value) => {
|
|
85
|
+
const applied = await visibilityStyle.setMeshPointsVisibility(meshId, value);
|
|
84
86
|
return applied;
|
|
85
87
|
}),
|
|
86
|
-
whenDefined(sizeStyle.meshPointsSize(
|
|
87
|
-
const applied = await sizeStyle.setMeshPointsSize(
|
|
88
|
+
whenDefined(sizeStyle.meshPointsSize(meshId), async (value) => {
|
|
89
|
+
const applied = await sizeStyle.setMeshPointsSize(meshId, value);
|
|
88
90
|
return applied;
|
|
89
91
|
}),
|
|
90
|
-
setMeshPointsActiveColoring(
|
|
92
|
+
setMeshPointsActiveColoring(meshId, activeColoringType, deps),
|
|
91
93
|
]);
|
|
92
94
|
return result;
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
type UseMeshPointsStyleReturn = ReturnType<typeof useMeshPointsCommonStyle> & {
|
|
96
|
-
meshPointsColoring: (
|
|
97
|
-
meshPointsActiveColoring: (
|
|
98
|
-
setMeshPointsActiveColoring: (
|
|
99
|
-
applyMeshPointsStyle: (
|
|
98
|
+
meshPointsColoring: (meshId: MeshId) => StyleValues;
|
|
99
|
+
meshPointsActiveColoring: (meshId: MeshId) => string | undefined;
|
|
100
|
+
setMeshPointsActiveColoring: (meshId: MeshId, type: string | undefined) => Promise<unknown>;
|
|
101
|
+
applyMeshPointsStyle: (meshId: MeshId) => Promise<unknown[]>;
|
|
100
102
|
} & ReturnType<typeof useMeshPointsVisibilityStyle> &
|
|
101
103
|
ReturnType<typeof useMeshPointsColorStyle> &
|
|
102
104
|
ReturnType<typeof useMeshPointsSizeStyle> &
|
|
@@ -115,29 +117,29 @@ export function useMeshPointsStyle(): UseMeshPointsStyleReturn {
|
|
|
115
117
|
vertexAttributeStyle: meshPointsVertexAttributeStyle,
|
|
116
118
|
};
|
|
117
119
|
|
|
118
|
-
function meshPointsColoring(
|
|
119
|
-
return meshPointsCommonStyle.meshPointsColoring(
|
|
120
|
+
function meshPointsColoring(meshId: MeshId): StyleValues {
|
|
121
|
+
return meshPointsCommonStyle.meshPointsColoring(meshId);
|
|
120
122
|
}
|
|
121
123
|
|
|
122
|
-
function meshPointsActiveColoring(
|
|
124
|
+
function meshPointsActiveColoring(meshId: MeshId): string | undefined {
|
|
123
125
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.active is defined as string in the data style schema.
|
|
124
|
-
return meshPointsColoring(
|
|
126
|
+
return meshPointsColoring(meshId).active as string | undefined;
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
async function boundSetMeshPointsActiveColoring(
|
|
128
|
-
|
|
130
|
+
meshId: MeshId,
|
|
129
131
|
type: string | undefined,
|
|
130
132
|
): Promise<unknown> {
|
|
131
|
-
const result = await setMeshPointsActiveColoring(
|
|
133
|
+
const result = await setMeshPointsActiveColoring(meshId, type, activeColoringDeps);
|
|
132
134
|
return result;
|
|
133
135
|
}
|
|
134
136
|
|
|
135
|
-
async function boundApplyMeshPointsStyle(
|
|
137
|
+
async function boundApplyMeshPointsStyle(meshId: MeshId): Promise<unknown[]> {
|
|
136
138
|
const result = await applyMeshPointsStyle(
|
|
137
|
-
|
|
139
|
+
meshId,
|
|
138
140
|
meshPointsVisibility,
|
|
139
141
|
meshPointsSizeStyle,
|
|
140
|
-
meshPointsActiveColoring(
|
|
142
|
+
meshPointsActiveColoring(meshId),
|
|
141
143
|
activeColoringDeps,
|
|
142
144
|
);
|
|
143
145
|
return result;
|