@geode/opengeodeweb-front 10.44.0 → 10.44.1-rc.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 +4 -4
- package/shared/utils/fetch_raw.ts +7 -8
|
@@ -1,80 +1,50 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AttributeColorMap,
|
|
3
|
+
AttributeItem,
|
|
4
|
+
AttributeName,
|
|
5
|
+
AttributeRange,
|
|
6
|
+
AttributeRangeMaximum,
|
|
7
|
+
AttributeRangeMinimum,
|
|
8
|
+
AttributeTimeStep,
|
|
9
|
+
} from "@ogw_front/types/attribute";
|
|
10
|
+
import type {
|
|
11
|
+
AttributeStoredConfig,
|
|
12
|
+
ValidAttributeInput,
|
|
13
|
+
} from "@ogw_internal/stores/data_style/attribute_types";
|
|
14
|
+
import type { MeshId } from "@ogw_front/types/identifiers";
|
|
1
15
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
2
16
|
|
|
3
|
-
interface AttributeStoredConfig {
|
|
4
|
-
minimum: number | undefined;
|
|
5
|
-
maximum: number | undefined;
|
|
6
|
-
colorMap: string | undefined;
|
|
7
|
-
no_data_color: RGBAColor;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface AttributeState {
|
|
11
|
-
name?: string;
|
|
12
|
-
item?: number;
|
|
13
|
-
storedConfigs?: Record<string, { lastItem: number } & Record<string, AttributeStoredConfig>>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
interface AttributeInput {
|
|
17
|
-
name: string | undefined;
|
|
18
|
-
item: number | undefined;
|
|
19
|
-
minimum: number | undefined;
|
|
20
|
-
maximum: number | undefined;
|
|
21
|
-
colorMap: string | undefined;
|
|
22
|
-
no_data_color?: RGBAColor;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface ValidAttributeInput {
|
|
26
|
-
name: string;
|
|
27
|
-
item: number;
|
|
28
|
-
minimum: number;
|
|
29
|
-
maximum: number;
|
|
30
|
-
colorMap: string;
|
|
31
|
-
no_data_color?: RGBAColor;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function isMeshPolygonsVertexAttributeValid(input: AttributeInput): input is ValidAttributeInput {
|
|
35
|
-
return (
|
|
36
|
-
input.name !== undefined &&
|
|
37
|
-
input.item !== undefined &&
|
|
38
|
-
input.minimum !== undefined &&
|
|
39
|
-
input.maximum !== undefined &&
|
|
40
|
-
input.colorMap !== undefined
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
17
|
interface UseMeshPolygonsVertexAttributeStyleReturn {
|
|
45
|
-
meshPolygonsVertexAttributeName: (
|
|
46
|
-
meshPolygonsVertexAttributeItem: (
|
|
47
|
-
meshPolygonsVertexAttributeRange: (
|
|
48
|
-
meshPolygonsVertexAttributeTimeStep: (
|
|
49
|
-
setMeshPolygonsVertexAttributeTimeStep: (
|
|
50
|
-
|
|
18
|
+
meshPolygonsVertexAttributeName: (meshId: MeshId) => AttributeName | undefined;
|
|
19
|
+
meshPolygonsVertexAttributeItem: (meshId: MeshId) => AttributeItem;
|
|
20
|
+
meshPolygonsVertexAttributeRange: (meshId: MeshId) => AttributeRange;
|
|
21
|
+
meshPolygonsVertexAttributeTimeStep: (meshId: MeshId) => AttributeTimeStep | undefined;
|
|
22
|
+
setMeshPolygonsVertexAttributeTimeStep: (
|
|
23
|
+
meshId: MeshId,
|
|
24
|
+
timeStep: AttributeTimeStep,
|
|
25
|
+
) => Promise<unknown>;
|
|
26
|
+
meshPolygonsVertexAttributeColorMap: (meshId: MeshId) => AttributeColorMap | undefined;
|
|
51
27
|
meshPolygonsVertexAttributeStoredConfig: (
|
|
52
|
-
|
|
53
|
-
name:
|
|
54
|
-
item:
|
|
28
|
+
meshId: MeshId,
|
|
29
|
+
name: AttributeName | undefined,
|
|
30
|
+
item: AttributeItem | undefined,
|
|
55
31
|
) => AttributeStoredConfig;
|
|
56
|
-
setMeshPolygonsVertexAttribute: (
|
|
57
|
-
setMeshPolygonsVertexAttributeName: (
|
|
58
|
-
setMeshPolygonsVertexAttributeItem: (
|
|
32
|
+
setMeshPolygonsVertexAttribute: (meshId: MeshId, input: ValidAttributeInput) => Promise<unknown>;
|
|
33
|
+
setMeshPolygonsVertexAttributeName: (meshId: MeshId, name: AttributeName) => Promise<unknown>;
|
|
34
|
+
setMeshPolygonsVertexAttributeItem: (meshId: MeshId, item: AttributeItem) => Promise<unknown>;
|
|
59
35
|
setMeshPolygonsVertexAttributeRange: (
|
|
60
|
-
|
|
61
|
-
minimum:
|
|
62
|
-
maximum:
|
|
36
|
+
meshId: MeshId,
|
|
37
|
+
minimum: AttributeRangeMinimum,
|
|
38
|
+
maximum: AttributeRangeMaximum,
|
|
63
39
|
) => Promise<unknown>;
|
|
64
40
|
setMeshPolygonsVertexAttributeColorMap: (
|
|
65
|
-
|
|
66
|
-
colorMap:
|
|
41
|
+
meshId: MeshId,
|
|
42
|
+
colorMap: AttributeColorMap | undefined,
|
|
67
43
|
) => Promise<unknown>;
|
|
68
|
-
meshPolygonsVertexAttributeNoDataColor: (
|
|
44
|
+
meshPolygonsVertexAttributeNoDataColor: (meshId: MeshId) => RGBAColor;
|
|
69
45
|
setMeshPolygonsVertexAttributeNoDataColor: (
|
|
70
|
-
|
|
46
|
+
meshId: MeshId,
|
|
71
47
|
no_data_color: RGBAColor,
|
|
72
48
|
) => Promise<unknown>;
|
|
73
49
|
}
|
|
74
|
-
export {
|
|
75
|
-
export type {
|
|
76
|
-
AttributeStoredConfig,
|
|
77
|
-
AttributeState,
|
|
78
|
-
ValidAttributeInput,
|
|
79
|
-
UseMeshPolygonsVertexAttributeStyleReturn,
|
|
80
|
-
};
|
|
50
|
+
export type { UseMeshPolygonsVertexAttributeStyleReturn };
|
|
@@ -1,69 +1,81 @@
|
|
|
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 { useMeshPolygonsCommonStyle } from "./common";
|
|
6
17
|
|
|
7
18
|
interface UseMeshPolygonsVertexAttributeConfigReturn {
|
|
8
|
-
meshPolygonsVertexAttribute: (
|
|
9
|
-
meshPolygonsVertexAttributeName: (
|
|
10
|
-
meshPolygonsVertexAttributeLastItem: (
|
|
11
|
-
meshPolygonsVertexAttributeItem: (
|
|
19
|
+
meshPolygonsVertexAttribute: (meshId: MeshId) => AttributeState;
|
|
20
|
+
meshPolygonsVertexAttributeName: (meshId: MeshId) => AttributeName | undefined;
|
|
21
|
+
meshPolygonsVertexAttributeLastItem: (meshId: MeshId, name: AttributeName | undefined) => number;
|
|
22
|
+
meshPolygonsVertexAttributeItem: (meshId: MeshId) => AttributeItem;
|
|
12
23
|
meshPolygonsVertexAttributeStoredConfig: (
|
|
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 UseMeshPolygonsVertexAttributeConfigWriterReturn {
|
|
20
|
-
mutateMeshPolygonsVertexStyle: (
|
|
31
|
+
mutateMeshPolygonsVertexStyle: (
|
|
32
|
+
meshId: MeshId,
|
|
33
|
+
values: Record<string, unknown>,
|
|
34
|
+
) => Promise<string>;
|
|
21
35
|
setMeshPolygonsVertexAttributeStoredConfig: (
|
|
22
|
-
|
|
23
|
-
name:
|
|
24
|
-
item:
|
|
36
|
+
meshId: MeshId,
|
|
37
|
+
name: AttributeName | undefined,
|
|
38
|
+
item: AttributeItem | undefined,
|
|
25
39
|
config: Partial<AttributeStoredConfig>,
|
|
26
40
|
) => Promise<string>;
|
|
27
41
|
}
|
|
28
42
|
|
|
29
43
|
function useMeshPolygonsVertexAttributeConfig(): UseMeshPolygonsVertexAttributeConfigReturn {
|
|
30
44
|
const meshPolygonsCommonStyle = useMeshPolygonsCommonStyle();
|
|
31
|
-
function meshPolygonsVertexAttribute(
|
|
45
|
+
function meshPolygonsVertexAttribute(meshId: MeshId): AttributeState {
|
|
32
46
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.vertex shape is defined by the data style schema.
|
|
33
|
-
return meshPolygonsCommonStyle.meshPolygonsColoring(
|
|
47
|
+
return meshPolygonsCommonStyle.meshPolygonsColoring(meshId).vertex as AttributeState;
|
|
34
48
|
}
|
|
35
49
|
function meshPolygonsVertexAttributeStoredConfig(
|
|
36
|
-
|
|
37
|
-
name:
|
|
38
|
-
item:
|
|
50
|
+
meshId: MeshId,
|
|
51
|
+
name: AttributeName | undefined,
|
|
52
|
+
item: AttributeItem | undefined,
|
|
39
53
|
): AttributeStoredConfig {
|
|
40
|
-
const { storedConfigs } = meshPolygonsVertexAttribute(
|
|
54
|
+
const { storedConfigs } = meshPolygonsVertexAttribute(meshId);
|
|
41
55
|
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
42
56
|
const itemConfig = item === undefined ? undefined : nameConfig?.[item];
|
|
43
57
|
if (itemConfig !== undefined) {
|
|
44
58
|
return itemConfig;
|
|
45
59
|
}
|
|
46
|
-
return
|
|
47
|
-
minimum: undefined,
|
|
48
|
-
maximum: undefined,
|
|
49
|
-
colorMap: undefined,
|
|
50
|
-
no_data_color: DEFAULT_NO_DATA_COLOR,
|
|
51
|
-
};
|
|
60
|
+
return defaultAttributeStoredConfig();
|
|
52
61
|
}
|
|
53
|
-
function meshPolygonsVertexAttributeName(
|
|
54
|
-
return meshPolygonsVertexAttribute(
|
|
62
|
+
function meshPolygonsVertexAttributeName(meshId: MeshId): AttributeName | undefined {
|
|
63
|
+
return meshPolygonsVertexAttribute(meshId).name;
|
|
55
64
|
}
|
|
56
|
-
function meshPolygonsVertexAttributeLastItem(
|
|
57
|
-
|
|
65
|
+
function meshPolygonsVertexAttributeLastItem(
|
|
66
|
+
meshId: MeshId,
|
|
67
|
+
name: AttributeName | undefined,
|
|
68
|
+
): number {
|
|
69
|
+
const { storedConfigs } = meshPolygonsVertexAttribute(meshId);
|
|
58
70
|
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
59
71
|
if (nameConfig !== undefined) {
|
|
60
72
|
return nameConfig.lastItem;
|
|
61
73
|
}
|
|
62
74
|
return 0;
|
|
63
75
|
}
|
|
64
|
-
function meshPolygonsVertexAttributeItem(
|
|
65
|
-
const { item, name } = meshPolygonsVertexAttribute(
|
|
66
|
-
return item ?? meshPolygonsVertexAttributeLastItem(
|
|
76
|
+
function meshPolygonsVertexAttributeItem(meshId: MeshId): AttributeItem {
|
|
77
|
+
const { item, name } = meshPolygonsVertexAttribute(meshId);
|
|
78
|
+
return item ?? meshPolygonsVertexAttributeLastItem(meshId, name);
|
|
67
79
|
}
|
|
68
80
|
return {
|
|
69
81
|
meshPolygonsVertexAttribute,
|
|
@@ -75,9 +87,9 @@ function useMeshPolygonsVertexAttributeConfig(): UseMeshPolygonsVertexAttributeC
|
|
|
75
87
|
}
|
|
76
88
|
|
|
77
89
|
interface UseMeshPolygonsVertexAttributeConfigValuesReturn {
|
|
78
|
-
meshPolygonsVertexAttributeRange: (
|
|
79
|
-
meshPolygonsVertexAttributeColorMap: (
|
|
80
|
-
meshPolygonsVertexAttributeNoDataColor: (
|
|
90
|
+
meshPolygonsVertexAttributeRange: (meshId: MeshId) => AttributeRange;
|
|
91
|
+
meshPolygonsVertexAttributeColorMap: (meshId: MeshId) => AttributeColorMap | undefined;
|
|
92
|
+
meshPolygonsVertexAttributeNoDataColor: (meshId: MeshId) => RGBAColor;
|
|
81
93
|
}
|
|
82
94
|
|
|
83
95
|
function useMeshPolygonsVertexAttributeConfigValues(): UseMeshPolygonsVertexAttributeConfigValuesReturn {
|
|
@@ -86,22 +98,22 @@ function useMeshPolygonsVertexAttributeConfigValues(): UseMeshPolygonsVertexAttr
|
|
|
86
98
|
meshPolygonsVertexAttributeItem,
|
|
87
99
|
meshPolygonsVertexAttributeStoredConfig,
|
|
88
100
|
} = useMeshPolygonsVertexAttributeConfig();
|
|
89
|
-
function meshPolygonsVertexAttributeRange(
|
|
90
|
-
const name = meshPolygonsVertexAttributeName(
|
|
91
|
-
const item = meshPolygonsVertexAttributeItem(
|
|
92
|
-
const storedConfig = meshPolygonsVertexAttributeStoredConfig(
|
|
101
|
+
function meshPolygonsVertexAttributeRange(meshId: MeshId): AttributeRange {
|
|
102
|
+
const name = meshPolygonsVertexAttributeName(meshId);
|
|
103
|
+
const item = meshPolygonsVertexAttributeItem(meshId);
|
|
104
|
+
const storedConfig = meshPolygonsVertexAttributeStoredConfig(meshId, name, item);
|
|
93
105
|
return [storedConfig.minimum, storedConfig.maximum];
|
|
94
106
|
}
|
|
95
|
-
function meshPolygonsVertexAttributeColorMap(
|
|
96
|
-
const name = meshPolygonsVertexAttributeName(
|
|
97
|
-
const item = meshPolygonsVertexAttributeItem(
|
|
98
|
-
const storedConfig = meshPolygonsVertexAttributeStoredConfig(
|
|
107
|
+
function meshPolygonsVertexAttributeColorMap(meshId: MeshId): AttributeColorMap | undefined {
|
|
108
|
+
const name = meshPolygonsVertexAttributeName(meshId);
|
|
109
|
+
const item = meshPolygonsVertexAttributeItem(meshId);
|
|
110
|
+
const storedConfig = meshPolygonsVertexAttributeStoredConfig(meshId, name, item);
|
|
99
111
|
return storedConfig.colorMap;
|
|
100
112
|
}
|
|
101
|
-
function meshPolygonsVertexAttributeNoDataColor(
|
|
102
|
-
const name = meshPolygonsVertexAttributeName(
|
|
103
|
-
const item = meshPolygonsVertexAttributeItem(
|
|
104
|
-
const storedConfig = meshPolygonsVertexAttributeStoredConfig(
|
|
113
|
+
function meshPolygonsVertexAttributeNoDataColor(meshId: MeshId): RGBAColor {
|
|
114
|
+
const name = meshPolygonsVertexAttributeName(meshId);
|
|
115
|
+
const item = meshPolygonsVertexAttributeItem(meshId);
|
|
116
|
+
const storedConfig = meshPolygonsVertexAttributeStoredConfig(meshId, name, item);
|
|
105
117
|
return storedConfig.no_data_color;
|
|
106
118
|
}
|
|
107
119
|
return {
|
|
@@ -114,10 +126,10 @@ function useMeshPolygonsVertexAttributeConfigValues(): UseMeshPolygonsVertexAttr
|
|
|
114
126
|
function useMeshPolygonsVertexAttributeConfigWriter(): UseMeshPolygonsVertexAttributeConfigWriterReturn {
|
|
115
127
|
const meshPolygonsCommonStyle = useMeshPolygonsCommonStyle();
|
|
116
128
|
async function mutateMeshPolygonsVertexStyle(
|
|
117
|
-
|
|
129
|
+
meshId: MeshId,
|
|
118
130
|
values: Record<string, unknown>,
|
|
119
131
|
): Promise<string> {
|
|
120
|
-
const result = await meshPolygonsCommonStyle.mutateMeshPolygonsStyle(
|
|
132
|
+
const result = await meshPolygonsCommonStyle.mutateMeshPolygonsStyle(meshId, {
|
|
121
133
|
coloring: {
|
|
122
134
|
vertex: values,
|
|
123
135
|
},
|
|
@@ -125,12 +137,12 @@ function useMeshPolygonsVertexAttributeConfigWriter(): UseMeshPolygonsVertexAttr
|
|
|
125
137
|
return result;
|
|
126
138
|
}
|
|
127
139
|
async function setMeshPolygonsVertexAttributeStoredConfig(
|
|
128
|
-
|
|
129
|
-
name:
|
|
130
|
-
item:
|
|
140
|
+
meshId: MeshId,
|
|
141
|
+
name: AttributeName | undefined,
|
|
142
|
+
item: AttributeItem | undefined,
|
|
131
143
|
config: Partial<AttributeStoredConfig>,
|
|
132
144
|
): Promise<string> {
|
|
133
|
-
const result = await mutateMeshPolygonsVertexStyle(
|
|
145
|
+
const result = await mutateMeshPolygonsVertexStyle(meshId, {
|
|
134
146
|
storedConfigs: {
|
|
135
147
|
[name ?? ""]: {
|
|
136
148
|
lastItem: item,
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
3
3
|
|
|
4
4
|
// Local imports
|
|
5
|
+
import type { MeshId } from "@ogw_front/types/identifiers";
|
|
6
|
+
import type { Visibility } from "@ogw_front/types/style";
|
|
5
7
|
import { useMeshPolygonsCommonStyle } from "./common";
|
|
6
8
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
7
9
|
|
|
@@ -9,18 +11,21 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
|
9
11
|
const schema = viewer_schemas.opengeodeweb_viewer.mesh.polygons.visibility;
|
|
10
12
|
|
|
11
13
|
export function useMeshPolygonsVisibilityStyle(): {
|
|
12
|
-
meshPolygonsVisibility: (
|
|
13
|
-
setMeshPolygonsVisibility: (
|
|
14
|
+
meshPolygonsVisibility: (meshId: MeshId) => Visibility | undefined;
|
|
15
|
+
setMeshPolygonsVisibility: (meshId: MeshId, visibility: Visibility) => Promise<unknown>;
|
|
14
16
|
} {
|
|
15
17
|
const viewerStore = useViewerStore();
|
|
16
18
|
const meshPolygonsCommonStyle = useMeshPolygonsCommonStyle();
|
|
17
19
|
|
|
18
|
-
function meshPolygonsVisibility(
|
|
20
|
+
function meshPolygonsVisibility(meshId: MeshId): Visibility | undefined {
|
|
19
21
|
// oxlint-disable-next-line no-unsafe-type-assertion -- visibility is defined as boolean in the data style schema.
|
|
20
|
-
return meshPolygonsCommonStyle.meshPolygonsStyle(
|
|
22
|
+
return meshPolygonsCommonStyle.meshPolygonsStyle(meshId).visibility as Visibility | undefined;
|
|
21
23
|
}
|
|
22
|
-
async function setMeshPolygonsVisibility(
|
|
23
|
-
|
|
24
|
+
async function setMeshPolygonsVisibility(
|
|
25
|
+
meshId: MeshId,
|
|
26
|
+
visibility: Visibility,
|
|
27
|
+
): Promise<unknown> {
|
|
28
|
+
const params = { id: meshId, visibility };
|
|
24
29
|
const result = await viewerStore.request(
|
|
25
30
|
{
|
|
26
31
|
schema,
|
|
@@ -28,7 +33,7 @@ export function useMeshPolygonsVisibilityStyle(): {
|
|
|
28
33
|
},
|
|
29
34
|
{
|
|
30
35
|
response_function: async () => {
|
|
31
|
-
const mutateResult = await meshPolygonsCommonStyle.mutateMeshPolygonsStyle(
|
|
36
|
+
const mutateResult = await meshPolygonsCommonStyle.mutateMeshPolygonsStyle(meshId, {
|
|
32
37
|
visibility,
|
|
33
38
|
});
|
|
34
39
|
return mutateResult;
|
|
@@ -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.polyhedra.color;
|
|
12
13
|
|
|
13
14
|
export function useMeshPolyhedraColorStyle(): ReturnType<typeof useMeshPolyhedraOpacityStyle> & {
|
|
14
|
-
meshPolyhedraColor: (
|
|
15
|
-
setMeshPolyhedraColor: (
|
|
15
|
+
meshPolyhedraColor: (meshId: MeshId) => RGBAColor | undefined;
|
|
16
|
+
setMeshPolyhedraColor: (meshId: MeshId, color: RGBAColor) => Promise<unknown>;
|
|
16
17
|
} {
|
|
17
18
|
const viewerStore = useViewerStore();
|
|
18
19
|
const meshPolyhedraCommonStyle = useMeshPolyhedraCommonStyle();
|
|
19
20
|
|
|
20
|
-
function meshPolyhedraColor(
|
|
21
|
+
function meshPolyhedraColor(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 meshPolyhedraCommonStyle.meshPolyhedraColoring(
|
|
23
|
+
return meshPolyhedraCommonStyle.meshPolyhedraColoring(meshId).constant as RGBAColor | undefined;
|
|
23
24
|
}
|
|
24
|
-
async function setMeshPolyhedraColor(
|
|
25
|
-
const params = { id, color };
|
|
25
|
+
async function setMeshPolyhedraColor(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,9 +31,12 @@ export function useMeshPolyhedraColorStyle(): ReturnType<typeof useMeshPolyhedra
|
|
|
30
31
|
},
|
|
31
32
|
{
|
|
32
33
|
response_function: async () => {
|
|
33
|
-
const mutation_result = await meshPolyhedraCommonStyle.mutateMeshPolyhedraColoring(
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const mutation_result = await meshPolyhedraCommonStyle.mutateMeshPolyhedraColoring(
|
|
35
|
+
meshId,
|
|
36
|
+
{
|
|
37
|
+
constant: color,
|
|
38
|
+
},
|
|
39
|
+
);
|
|
36
40
|
return mutation_result;
|
|
37
41
|
},
|
|
38
42
|
},
|
|
@@ -1,32 +1,33 @@
|
|
|
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 useMeshPolyhedraCommonStyle(): {
|
|
5
|
-
meshPolyhedraStyle: (
|
|
6
|
-
meshPolyhedraColoring: (
|
|
7
|
-
mutateMeshPolyhedraStyle: (
|
|
8
|
-
mutateMeshPolyhedraColoring: (
|
|
6
|
+
meshPolyhedraStyle: (meshId: MeshId) => StyleValues;
|
|
7
|
+
meshPolyhedraColoring: (meshId: MeshId) => StyleValues;
|
|
8
|
+
mutateMeshPolyhedraStyle: (meshId: MeshId, values: StyleValues) => Promise<string>;
|
|
9
|
+
mutateMeshPolyhedraColoring: (meshId: MeshId, values: StyleValues) => Promise<string>;
|
|
9
10
|
} {
|
|
10
11
|
const dataStyleState = useDataStyleState();
|
|
11
12
|
|
|
12
|
-
async function mutateMeshPolyhedraStyle(
|
|
13
|
-
const result = await dataStyleState.mutateStyle(
|
|
13
|
+
async function mutateMeshPolyhedraStyle(meshId: MeshId, values: StyleValues): Promise<string> {
|
|
14
|
+
const result = await dataStyleState.mutateStyle(meshId, {
|
|
14
15
|
polyhedra: values,
|
|
15
16
|
});
|
|
16
17
|
return result;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
function meshPolyhedraStyle(
|
|
20
|
-
return dataStyleState.getStyle(
|
|
20
|
+
function meshPolyhedraStyle(meshId: MeshId): StyleValues {
|
|
21
|
+
return dataStyleState.getStyle(meshId).polyhedra ?? {};
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
function meshPolyhedraColoring(
|
|
24
|
+
function meshPolyhedraColoring(meshId: MeshId): StyleValues {
|
|
24
25
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring shape is defined by the data style schema.
|
|
25
|
-
return meshPolyhedraStyle(
|
|
26
|
+
return meshPolyhedraStyle(meshId).coloring as StyleValues;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
async function mutateMeshPolyhedraColoring(
|
|
29
|
-
const result = await mutateMeshPolyhedraStyle(
|
|
29
|
+
async function mutateMeshPolyhedraColoring(meshId: MeshId, values: StyleValues): Promise<string> {
|
|
30
|
+
const result = await mutateMeshPolyhedraStyle(meshId, {
|
|
30
31
|
coloring: values,
|
|
31
32
|
});
|
|
32
33
|
return result;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
// Third party imports
|
|
2
2
|
|
|
3
3
|
// Local imports
|
|
4
|
-
import {
|
|
5
|
-
isMeshPolyhedraPolyhedronAttributeValid,
|
|
6
|
-
useMeshPolyhedraPolyhedronAttributeStyle,
|
|
7
|
-
} from "./polyhedron";
|
|
8
|
-
import {
|
|
9
|
-
isMeshPolyhedraVertexAttributeValid,
|
|
10
|
-
useMeshPolyhedraVertexAttributeStyle,
|
|
11
|
-
} from "./vertex";
|
|
4
|
+
import type { MeshId } from "@ogw_front/types/identifiers";
|
|
12
5
|
import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
|
|
6
|
+
import { isAttributeValid } from "@ogw_internal/stores/data_style/attribute_valid";
|
|
13
7
|
import { useMeshPolyhedraColorStyle } from "./color";
|
|
14
8
|
import { useMeshPolyhedraCommonStyle } from "./common";
|
|
9
|
+
import { useMeshPolyhedraPolyhedronAttributeStyle } from "./polyhedron";
|
|
10
|
+
import { useMeshPolyhedraVertexAttributeStyle } from "./vertex";
|
|
15
11
|
import { useMeshPolyhedraVisibilityStyle } from "./visibility";
|
|
16
12
|
import { whenDefined } from "@ogw_internal/stores/data_style/when_defined";
|
|
17
13
|
|
|
@@ -25,30 +21,31 @@ interface MeshPolyhedraActiveColoringDeps {
|
|
|
25
21
|
}
|
|
26
22
|
|
|
27
23
|
function handleMeshPolyhedraVertexColoring(
|
|
28
|
-
|
|
24
|
+
meshId: MeshId,
|
|
29
25
|
vertexAttributeStyle: ReturnType<typeof useMeshPolyhedraVertexAttributeStyle>,
|
|
30
26
|
): Promise<unknown> | undefined {
|
|
31
|
-
const name = vertexAttributeStyle.meshPolyhedraVertexAttributeName(
|
|
32
|
-
const item = vertexAttributeStyle.meshPolyhedraVertexAttributeItem(
|
|
33
|
-
const [minimum, maximum] = vertexAttributeStyle.meshPolyhedraVertexAttributeRange(
|
|
34
|
-
const colorMap = vertexAttributeStyle.meshPolyhedraVertexAttributeColorMap(
|
|
35
|
-
const no_data_color = vertexAttributeStyle.meshPolyhedraVertexAttributeNoDataColor(
|
|
27
|
+
const name = vertexAttributeStyle.meshPolyhedraVertexAttributeName(meshId);
|
|
28
|
+
const item = vertexAttributeStyle.meshPolyhedraVertexAttributeItem(meshId);
|
|
29
|
+
const [minimum, maximum] = vertexAttributeStyle.meshPolyhedraVertexAttributeRange(meshId);
|
|
30
|
+
const colorMap = vertexAttributeStyle.meshPolyhedraVertexAttributeColorMap(meshId);
|
|
31
|
+
const no_data_color = vertexAttributeStyle.meshPolyhedraVertexAttributeNoDataColor(meshId);
|
|
36
32
|
const vertex_attribute = { name, item, minimum, maximum, colorMap, no_data_color };
|
|
37
|
-
if (!
|
|
33
|
+
if (!isAttributeValid(vertex_attribute)) {
|
|
38
34
|
return undefined;
|
|
39
35
|
}
|
|
40
|
-
return vertexAttributeStyle.setMeshPolyhedraVertexAttribute(
|
|
36
|
+
return vertexAttributeStyle.setMeshPolyhedraVertexAttribute(meshId, vertex_attribute);
|
|
41
37
|
}
|
|
42
38
|
|
|
43
39
|
function handleMeshPolyhedraPolyhedronColoring(
|
|
44
|
-
|
|
40
|
+
meshId: MeshId,
|
|
45
41
|
polyhedronAttributeStyle: ReturnType<typeof useMeshPolyhedraPolyhedronAttributeStyle>,
|
|
46
42
|
): Promise<unknown> | undefined {
|
|
47
|
-
const name = polyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeName(
|
|
48
|
-
const item = polyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeItem(
|
|
49
|
-
const [minimum, maximum] = polyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeRange(
|
|
50
|
-
const colorMap = polyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeColorMap(
|
|
51
|
-
const no_data_color =
|
|
43
|
+
const name = polyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeName(meshId);
|
|
44
|
+
const item = polyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeItem(meshId);
|
|
45
|
+
const [minimum, maximum] = polyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeRange(meshId);
|
|
46
|
+
const colorMap = polyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeColorMap(meshId);
|
|
47
|
+
const no_data_color =
|
|
48
|
+
polyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeNoDataColor(meshId);
|
|
52
49
|
const polyhedron_attribute = {
|
|
53
50
|
name,
|
|
54
51
|
item,
|
|
@@ -57,48 +54,51 @@ function handleMeshPolyhedraPolyhedronColoring(
|
|
|
57
54
|
colorMap,
|
|
58
55
|
no_data_color,
|
|
59
56
|
};
|
|
60
|
-
if (!
|
|
57
|
+
if (!isAttributeValid(polyhedron_attribute)) {
|
|
61
58
|
return undefined;
|
|
62
59
|
}
|
|
63
|
-
return polyhedronAttributeStyle.setMeshPolyhedraPolyhedronAttribute(
|
|
60
|
+
return polyhedronAttributeStyle.setMeshPolyhedraPolyhedronAttribute(meshId, polyhedron_attribute);
|
|
64
61
|
}
|
|
65
62
|
|
|
66
63
|
async function applyMeshPolyhedraActiveColoring(
|
|
67
|
-
|
|
64
|
+
meshId: MeshId,
|
|
68
65
|
type: string | undefined,
|
|
69
66
|
deps: MeshPolyhedraActiveColoringDeps,
|
|
70
67
|
): Promise<unknown> {
|
|
71
|
-
await deps.commonStyle.mutateMeshPolyhedraStyle(
|
|
68
|
+
await deps.commonStyle.mutateMeshPolyhedraStyle(meshId, {
|
|
72
69
|
coloring: { active: type },
|
|
73
70
|
});
|
|
74
71
|
if (type === "constant") {
|
|
75
|
-
const result = await whenDefined(deps.colorStyle.meshPolyhedraColor(
|
|
76
|
-
const applied = await deps.colorStyle.setMeshPolyhedraColor(
|
|
72
|
+
const result = await whenDefined(deps.colorStyle.meshPolyhedraColor(meshId), async (value) => {
|
|
73
|
+
const applied = await deps.colorStyle.setMeshPolyhedraColor(meshId, value);
|
|
77
74
|
return applied;
|
|
78
75
|
});
|
|
79
76
|
return result;
|
|
80
77
|
}
|
|
81
78
|
if (type === "vertex") {
|
|
82
|
-
const result = await handleMeshPolyhedraVertexColoring(
|
|
79
|
+
const result = await handleMeshPolyhedraVertexColoring(meshId, deps.vertexAttributeStyle);
|
|
83
80
|
return result;
|
|
84
81
|
}
|
|
85
82
|
if (type === "polyhedron") {
|
|
86
|
-
const result = await handleMeshPolyhedraPolyhedronColoring(
|
|
83
|
+
const result = await handleMeshPolyhedraPolyhedronColoring(
|
|
84
|
+
meshId,
|
|
85
|
+
deps.polyhedronAttributeStyle,
|
|
86
|
+
);
|
|
87
87
|
return result;
|
|
88
88
|
}
|
|
89
89
|
throw new Error(`Unknown mesh polyhedra coloring type: ${type}`);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
async function setMeshPolyhedraActiveColoring(
|
|
93
|
-
|
|
93
|
+
meshId: MeshId,
|
|
94
94
|
type: string | undefined,
|
|
95
95
|
deps: MeshPolyhedraActiveColoringDeps,
|
|
96
96
|
): Promise<unknown> {
|
|
97
|
-
const result = await applyMeshPolyhedraActiveColoring(
|
|
97
|
+
const result = await applyMeshPolyhedraActiveColoring(meshId, type, deps);
|
|
98
98
|
if (type !== "constant") {
|
|
99
99
|
// Attribute and textures colorings keep the actor opacity: restore the stored one
|
|
100
|
-
await whenDefined(deps.colorStyle.meshPolyhedraOpacity(
|
|
101
|
-
const applied = await deps.colorStyle.setMeshPolyhedraOpacity(
|
|
100
|
+
await whenDefined(deps.colorStyle.meshPolyhedraOpacity(meshId), async (value) => {
|
|
101
|
+
const applied = await deps.colorStyle.setMeshPolyhedraOpacity(meshId, value);
|
|
102
102
|
return applied;
|
|
103
103
|
});
|
|
104
104
|
}
|
|
@@ -106,26 +106,26 @@ async function setMeshPolyhedraActiveColoring(
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
async function applyMeshPolyhedraStyle(
|
|
109
|
-
|
|
109
|
+
meshId: MeshId,
|
|
110
110
|
visibilityStyle: ReturnType<typeof useMeshPolyhedraVisibilityStyle>,
|
|
111
111
|
activeColoringType: string | undefined,
|
|
112
112
|
deps: MeshPolyhedraActiveColoringDeps,
|
|
113
113
|
): Promise<unknown[]> {
|
|
114
114
|
const result = await Promise.all([
|
|
115
|
-
whenDefined(visibilityStyle.meshPolyhedraVisibility(
|
|
116
|
-
const applied = await visibilityStyle.setMeshPolyhedraVisibility(
|
|
115
|
+
whenDefined(visibilityStyle.meshPolyhedraVisibility(meshId), async (value) => {
|
|
116
|
+
const applied = await visibilityStyle.setMeshPolyhedraVisibility(meshId, value);
|
|
117
117
|
return applied;
|
|
118
118
|
}),
|
|
119
|
-
setMeshPolyhedraActiveColoring(
|
|
119
|
+
setMeshPolyhedraActiveColoring(meshId, activeColoringType, deps),
|
|
120
120
|
]);
|
|
121
121
|
return result;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
type UseMeshPolyhedraStyleReturn = ReturnType<typeof useMeshPolyhedraCommonStyle> & {
|
|
125
|
-
meshPolyhedraColoring: (
|
|
126
|
-
meshPolyhedraActiveColoring: (
|
|
127
|
-
setMeshPolyhedraActiveColoring: (
|
|
128
|
-
applyMeshPolyhedraStyle: (
|
|
125
|
+
meshPolyhedraColoring: (meshId: MeshId) => StyleValues;
|
|
126
|
+
meshPolyhedraActiveColoring: (meshId: MeshId) => string | undefined;
|
|
127
|
+
setMeshPolyhedraActiveColoring: (meshId: MeshId, type: string | undefined) => Promise<unknown>;
|
|
128
|
+
applyMeshPolyhedraStyle: (meshId: MeshId) => Promise<unknown[]>;
|
|
129
129
|
} & ReturnType<typeof useMeshPolyhedraVisibilityStyle> &
|
|
130
130
|
ReturnType<typeof useMeshPolyhedraColorStyle> &
|
|
131
131
|
ReturnType<typeof useMeshPolyhedraVertexAttributeStyle> &
|
|
@@ -145,28 +145,28 @@ export function useMeshPolyhedraStyle(): UseMeshPolyhedraStyleReturn {
|
|
|
145
145
|
polyhedronAttributeStyle: meshPolyhedraPolyhedronAttributeStyle,
|
|
146
146
|
};
|
|
147
147
|
|
|
148
|
-
function meshPolyhedraColoring(
|
|
149
|
-
return meshPolyhedraCommonStyle.meshPolyhedraColoring(
|
|
148
|
+
function meshPolyhedraColoring(meshId: MeshId): StyleValues {
|
|
149
|
+
return meshPolyhedraCommonStyle.meshPolyhedraColoring(meshId);
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
function meshPolyhedraActiveColoring(
|
|
152
|
+
function meshPolyhedraActiveColoring(meshId: MeshId): string | undefined {
|
|
153
153
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.active is defined as string in the data style schema.
|
|
154
|
-
return meshPolyhedraColoring(
|
|
154
|
+
return meshPolyhedraColoring(meshId).active as string | undefined;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
async function boundSetMeshPolyhedraActiveColoring(
|
|
158
|
-
|
|
158
|
+
meshId: MeshId,
|
|
159
159
|
type: string | undefined,
|
|
160
160
|
): Promise<unknown> {
|
|
161
|
-
const result = await setMeshPolyhedraActiveColoring(
|
|
161
|
+
const result = await setMeshPolyhedraActiveColoring(meshId, type, activeColoringDeps);
|
|
162
162
|
return result;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
async function boundApplyMeshPolyhedraStyle(
|
|
165
|
+
async function boundApplyMeshPolyhedraStyle(meshId: MeshId): Promise<unknown[]> {
|
|
166
166
|
const result = await applyMeshPolyhedraStyle(
|
|
167
|
-
|
|
167
|
+
meshId,
|
|
168
168
|
meshPolyhedraVisibility,
|
|
169
|
-
meshPolyhedraActiveColoring(
|
|
169
|
+
meshPolyhedraActiveColoring(meshId),
|
|
170
170
|
activeColoringDeps,
|
|
171
171
|
);
|
|
172
172
|
return result;
|