@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,5 +1,23 @@
|
|
|
1
1
|
// oxlint-disable eslint/max-lines
|
|
2
|
+
import type {
|
|
3
|
+
AttributeColorMap,
|
|
4
|
+
AttributeItem,
|
|
5
|
+
AttributeName,
|
|
6
|
+
AttributeRange,
|
|
7
|
+
AttributeRangeMaximum,
|
|
8
|
+
AttributeRangeMinimum,
|
|
9
|
+
AttributeTimeStep,
|
|
10
|
+
} from "@ogw_front/types/attribute";
|
|
11
|
+
import type {
|
|
12
|
+
AttributeInput,
|
|
13
|
+
AttributeState,
|
|
14
|
+
AttributeStoredConfig,
|
|
15
|
+
ValidAttributeInput,
|
|
16
|
+
} from "@ogw_internal/stores/data_style/attribute_types";
|
|
2
17
|
import { DEFAULT_NO_DATA_COLOR, type RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
18
|
+
import type { ModelId, SurfaceId } from "@ogw_front/types/identifiers";
|
|
19
|
+
import { defaultAttributeStoredConfig } from "@ogw_internal/stores/data_style/attribute_default";
|
|
20
|
+
import { isAttributeValid } from "@ogw_internal/stores/data_style/attribute_valid";
|
|
3
21
|
// Third party imports
|
|
4
22
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
5
23
|
|
|
@@ -17,103 +35,62 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
|
17
35
|
const attributeSchema =
|
|
18
36
|
viewer_schemas.opengeodeweb_viewer.model.surfaces.attribute.polygon.attribute;
|
|
19
37
|
|
|
20
|
-
interface AttributeStoredConfig {
|
|
21
|
-
minimum: number | undefined;
|
|
22
|
-
maximum: number | undefined;
|
|
23
|
-
colorMap: string | undefined;
|
|
24
|
-
no_data_color: RGBAColor;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface AttributeState {
|
|
28
|
-
name?: string;
|
|
29
|
-
item?: number;
|
|
30
|
-
storedConfigs?: Record<string, { lastItem: number } & Record<string, AttributeStoredConfig>>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
interface AttributeInput {
|
|
34
|
-
name: string | undefined;
|
|
35
|
-
item: number | undefined;
|
|
36
|
-
minimum: number | undefined;
|
|
37
|
-
maximum: number | undefined;
|
|
38
|
-
colorMap: string | undefined;
|
|
39
|
-
no_data_color?: RGBAColor;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
interface ValidAttributeInput {
|
|
43
|
-
name: string;
|
|
44
|
-
item: number;
|
|
45
|
-
minimum: number;
|
|
46
|
-
maximum: number;
|
|
47
|
-
colorMap: string;
|
|
48
|
-
no_data_color?: RGBAColor;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function isModelSurfacesPolygonAttributeValid(input: AttributeInput): input is ValidAttributeInput {
|
|
52
|
-
return (
|
|
53
|
-
input.name !== undefined &&
|
|
54
|
-
input.item !== undefined &&
|
|
55
|
-
input.minimum !== undefined &&
|
|
56
|
-
input.maximum !== undefined &&
|
|
57
|
-
input.colorMap !== undefined
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
38
|
interface UseModelSurfacesPolygonAttributeReturn {
|
|
62
|
-
modelSurfacesPolygonAttributeName: (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
39
|
+
modelSurfacesPolygonAttributeName: (
|
|
40
|
+
modelId: ModelId,
|
|
41
|
+
surfaceId?: SurfaceId,
|
|
42
|
+
) => AttributeName | undefined;
|
|
43
|
+
modelSurfacesPolygonAttributeItem: (modelId: ModelId, surfaceId?: SurfaceId) => AttributeItem;
|
|
44
|
+
modelSurfacesPolygonAttributeRange: (modelId: ModelId, surfaceId?: SurfaceId) => AttributeRange;
|
|
68
45
|
modelSurfacesPolygonAttributeTimeStep: (
|
|
69
|
-
modelId:
|
|
70
|
-
surfaceId?:
|
|
71
|
-
) =>
|
|
46
|
+
modelId: ModelId,
|
|
47
|
+
surfaceId?: SurfaceId,
|
|
48
|
+
) => AttributeTimeStep | undefined;
|
|
72
49
|
setModelSurfacesPolygonAttributeTimeStep: (
|
|
73
|
-
modelId:
|
|
74
|
-
surfaceIds:
|
|
75
|
-
timeStep:
|
|
50
|
+
modelId: ModelId,
|
|
51
|
+
surfaceIds: SurfaceId[],
|
|
52
|
+
timeStep: AttributeTimeStep,
|
|
76
53
|
) => Promise<void>;
|
|
77
54
|
modelSurfacesPolygonAttributeColorMap: (
|
|
78
|
-
modelId:
|
|
79
|
-
surfaceId?:
|
|
80
|
-
) =>
|
|
55
|
+
modelId: ModelId,
|
|
56
|
+
surfaceId?: SurfaceId,
|
|
57
|
+
) => AttributeColorMap | undefined;
|
|
81
58
|
modelSurfacesPolygonAttributeStoredConfig: (
|
|
82
|
-
modelId:
|
|
83
|
-
surfaceId:
|
|
84
|
-
name:
|
|
85
|
-
item:
|
|
59
|
+
modelId: ModelId,
|
|
60
|
+
surfaceId: SurfaceId | undefined,
|
|
61
|
+
name: AttributeName | undefined,
|
|
62
|
+
item: AttributeItem | undefined,
|
|
86
63
|
) => AttributeStoredConfig;
|
|
87
64
|
setModelSurfacesPolygonAttribute: (
|
|
88
|
-
modelId:
|
|
89
|
-
surfaceIds:
|
|
65
|
+
modelId: ModelId,
|
|
66
|
+
surfaceIds: SurfaceId[],
|
|
90
67
|
input: ValidAttributeInput,
|
|
91
68
|
) => Promise<unknown>;
|
|
92
69
|
setModelSurfacesPolygonAttributeName: (
|
|
93
|
-
modelId:
|
|
94
|
-
surfaceIds:
|
|
95
|
-
name:
|
|
70
|
+
modelId: ModelId,
|
|
71
|
+
surfaceIds: SurfaceId[],
|
|
72
|
+
name: AttributeName,
|
|
96
73
|
) => Promise<void>;
|
|
97
74
|
setModelSurfacesPolygonAttributeItem: (
|
|
98
|
-
modelId:
|
|
99
|
-
surfaceIds:
|
|
100
|
-
item:
|
|
75
|
+
modelId: ModelId,
|
|
76
|
+
surfaceIds: SurfaceId[],
|
|
77
|
+
item: AttributeItem,
|
|
101
78
|
) => Promise<void>;
|
|
102
79
|
setModelSurfacesPolygonAttributeRange: (
|
|
103
|
-
modelId:
|
|
104
|
-
surfaceIds:
|
|
105
|
-
minimum:
|
|
106
|
-
maximum:
|
|
80
|
+
modelId: ModelId,
|
|
81
|
+
surfaceIds: SurfaceId[],
|
|
82
|
+
minimum: AttributeRangeMinimum,
|
|
83
|
+
maximum: AttributeRangeMaximum,
|
|
107
84
|
) => Promise<void>;
|
|
108
85
|
setModelSurfacesPolygonAttributeColorMap: (
|
|
109
|
-
modelId:
|
|
110
|
-
surfaceIds:
|
|
111
|
-
colorMap:
|
|
86
|
+
modelId: ModelId,
|
|
87
|
+
surfaceIds: SurfaceId[],
|
|
88
|
+
colorMap: AttributeColorMap | undefined,
|
|
112
89
|
) => Promise<void>;
|
|
113
|
-
modelSurfacesPolygonAttributeNoDataColor: (modelId:
|
|
90
|
+
modelSurfacesPolygonAttributeNoDataColor: (modelId: ModelId, surfaceId?: SurfaceId) => RGBAColor;
|
|
114
91
|
setModelSurfacesPolygonAttributeNoDataColor: (
|
|
115
|
-
modelId:
|
|
116
|
-
surfaceIds:
|
|
92
|
+
modelId: ModelId,
|
|
93
|
+
surfaceIds: SurfaceId[],
|
|
117
94
|
no_data_color: RGBAColor,
|
|
118
95
|
) => Promise<void>;
|
|
119
96
|
}
|
|
@@ -129,9 +106,9 @@ type ModelSurfacesPolygonAttributeGetters = Pick<
|
|
|
129
106
|
| "modelSurfacesPolygonAttributeTimeStep"
|
|
130
107
|
> & {
|
|
131
108
|
modelSurfacesPolygonAttributeLastItem: (
|
|
132
|
-
modelId:
|
|
109
|
+
modelId: ModelId,
|
|
133
110
|
componentId: string | undefined,
|
|
134
|
-
name:
|
|
111
|
+
name: AttributeName | undefined,
|
|
135
112
|
) => number;
|
|
136
113
|
};
|
|
137
114
|
|
|
@@ -140,17 +117,17 @@ function useModelSurfacesPolygonAttributeGetters(
|
|
|
140
117
|
modelSurfacesCommonStyle: ReturnType<typeof useModelSurfacesCommonStyle>,
|
|
141
118
|
): ModelSurfacesPolygonAttributeGetters {
|
|
142
119
|
const { attributeTimeStep } = useAttributeTimeStepStyle();
|
|
143
|
-
function modelSurfacesPolygonAttribute(modelId:
|
|
120
|
+
function modelSurfacesPolygonAttribute(modelId: ModelId, surfaceId?: SurfaceId): AttributeState {
|
|
144
121
|
return (
|
|
145
122
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.polygon shape is defined by the data style schema.
|
|
146
123
|
modelSurfacesCommonStyle.modelSurfaceColoring(modelId, surfaceId).polygon as AttributeState
|
|
147
124
|
);
|
|
148
125
|
}
|
|
149
126
|
function modelSurfacesPolygonAttributeStoredConfig(
|
|
150
|
-
modelId:
|
|
151
|
-
surfaceId:
|
|
152
|
-
name:
|
|
153
|
-
item:
|
|
127
|
+
modelId: ModelId,
|
|
128
|
+
surfaceId: SurfaceId | undefined,
|
|
129
|
+
name: AttributeName | undefined,
|
|
130
|
+
item: AttributeItem | undefined,
|
|
154
131
|
): AttributeStoredConfig {
|
|
155
132
|
const { storedConfigs } = modelSurfacesPolygonAttribute(modelId, surfaceId);
|
|
156
133
|
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
@@ -158,23 +135,18 @@ function useModelSurfacesPolygonAttributeGetters(
|
|
|
158
135
|
if (itemConfig !== undefined) {
|
|
159
136
|
return itemConfig;
|
|
160
137
|
}
|
|
161
|
-
return
|
|
162
|
-
minimum: undefined,
|
|
163
|
-
maximum: undefined,
|
|
164
|
-
colorMap: undefined,
|
|
165
|
-
no_data_color: DEFAULT_NO_DATA_COLOR,
|
|
166
|
-
};
|
|
138
|
+
return defaultAttributeStoredConfig();
|
|
167
139
|
}
|
|
168
140
|
function modelSurfacesPolygonAttributeName(
|
|
169
|
-
modelId:
|
|
170
|
-
surfaceId?:
|
|
171
|
-
):
|
|
141
|
+
modelId: ModelId,
|
|
142
|
+
surfaceId?: SurfaceId,
|
|
143
|
+
): AttributeName | undefined {
|
|
172
144
|
return modelSurfacesPolygonAttribute(modelId, surfaceId).name;
|
|
173
145
|
}
|
|
174
146
|
function modelSurfacesPolygonAttributeLastItem(
|
|
175
|
-
modelId:
|
|
176
|
-
surfaceId:
|
|
177
|
-
name:
|
|
147
|
+
modelId: ModelId,
|
|
148
|
+
surfaceId: SurfaceId | undefined,
|
|
149
|
+
name: AttributeName | undefined,
|
|
178
150
|
): number {
|
|
179
151
|
const { storedConfigs } = modelSurfacesPolygonAttribute(modelId, surfaceId);
|
|
180
152
|
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
@@ -183,7 +155,10 @@ function useModelSurfacesPolygonAttributeGetters(
|
|
|
183
155
|
}
|
|
184
156
|
return 0;
|
|
185
157
|
}
|
|
186
|
-
function modelSurfacesPolygonAttributeItem(
|
|
158
|
+
function modelSurfacesPolygonAttributeItem(
|
|
159
|
+
modelId: ModelId,
|
|
160
|
+
surfaceId?: SurfaceId,
|
|
161
|
+
): AttributeItem {
|
|
187
162
|
const polygonAttribute = modelSurfacesPolygonAttribute(modelId, surfaceId);
|
|
188
163
|
return (
|
|
189
164
|
polygonAttribute.item ??
|
|
@@ -191,9 +166,9 @@ function useModelSurfacesPolygonAttributeGetters(
|
|
|
191
166
|
);
|
|
192
167
|
}
|
|
193
168
|
function modelSurfacesPolygonAttributeRange(
|
|
194
|
-
modelId:
|
|
195
|
-
surfaceId?:
|
|
196
|
-
):
|
|
169
|
+
modelId: ModelId,
|
|
170
|
+
surfaceId?: SurfaceId,
|
|
171
|
+
): AttributeRange {
|
|
197
172
|
const name = modelSurfacesPolygonAttributeName(modelId, surfaceId);
|
|
198
173
|
const item = modelSurfacesPolygonAttributeItem(modelId, surfaceId);
|
|
199
174
|
const storedConfig = modelSurfacesPolygonAttributeStoredConfig(modelId, surfaceId, name, item);
|
|
@@ -201,17 +176,17 @@ function useModelSurfacesPolygonAttributeGetters(
|
|
|
201
176
|
return [minimum, maximum];
|
|
202
177
|
}
|
|
203
178
|
function modelSurfacesPolygonAttributeColorMap(
|
|
204
|
-
modelId:
|
|
205
|
-
surfaceId?:
|
|
206
|
-
):
|
|
179
|
+
modelId: ModelId,
|
|
180
|
+
surfaceId?: SurfaceId,
|
|
181
|
+
): AttributeColorMap | undefined {
|
|
207
182
|
const name = modelSurfacesPolygonAttributeName(modelId, surfaceId);
|
|
208
183
|
const item = modelSurfacesPolygonAttributeItem(modelId, surfaceId);
|
|
209
184
|
const storedConfig = modelSurfacesPolygonAttributeStoredConfig(modelId, surfaceId, name, item);
|
|
210
185
|
return storedConfig.colorMap;
|
|
211
186
|
}
|
|
212
187
|
function modelSurfacesPolygonAttributeNoDataColor(
|
|
213
|
-
modelId:
|
|
214
|
-
surfaceId?:
|
|
188
|
+
modelId: ModelId,
|
|
189
|
+
surfaceId?: SurfaceId,
|
|
215
190
|
): RGBAColor {
|
|
216
191
|
const name = modelSurfacesPolygonAttributeName(modelId, surfaceId);
|
|
217
192
|
const item = modelSurfacesPolygonAttributeItem(modelId, surfaceId);
|
|
@@ -219,9 +194,9 @@ function useModelSurfacesPolygonAttributeGetters(
|
|
|
219
194
|
return storedConfig.no_data_color;
|
|
220
195
|
}
|
|
221
196
|
function modelSurfacesPolygonAttributeTimeStep(
|
|
222
|
-
modelId:
|
|
223
|
-
surfaceId?:
|
|
224
|
-
):
|
|
197
|
+
modelId: ModelId,
|
|
198
|
+
surfaceId?: SurfaceId,
|
|
199
|
+
): AttributeTimeStep | undefined {
|
|
225
200
|
return attributeTimeStep(
|
|
226
201
|
modelId,
|
|
227
202
|
attributeSchema.$id,
|
|
@@ -257,8 +232,8 @@ function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeRet
|
|
|
257
232
|
} = useModelSurfacesPolygonAttributeGetters(modelSurfacesCommonStyle);
|
|
258
233
|
const viewerStore = useViewerStore();
|
|
259
234
|
async function mutateModelSurfacesPolygonStyle(
|
|
260
|
-
modelId:
|
|
261
|
-
surfaceIds:
|
|
235
|
+
modelId: ModelId,
|
|
236
|
+
surfaceIds: SurfaceId[],
|
|
262
237
|
values: Record<string, unknown>,
|
|
263
238
|
): Promise<void> {
|
|
264
239
|
const tasks: Promise<void>[] = [
|
|
@@ -277,10 +252,10 @@ function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeRet
|
|
|
277
252
|
await Promise.all(tasks);
|
|
278
253
|
}
|
|
279
254
|
async function setModelSurfacesPolygonAttributeStoredConfig(
|
|
280
|
-
modelId:
|
|
281
|
-
surfaceIds:
|
|
282
|
-
name:
|
|
283
|
-
item:
|
|
255
|
+
modelId: ModelId,
|
|
256
|
+
surfaceIds: SurfaceId[],
|
|
257
|
+
name: AttributeName | undefined,
|
|
258
|
+
item: AttributeItem | undefined,
|
|
284
259
|
config: Partial<AttributeStoredConfig>,
|
|
285
260
|
): Promise<void> {
|
|
286
261
|
await mutateModelSurfacesPolygonStyle(modelId, surfaceIds, {
|
|
@@ -288,8 +263,8 @@ function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeRet
|
|
|
288
263
|
});
|
|
289
264
|
}
|
|
290
265
|
async function setModelSurfacesPolygonAttribute(
|
|
291
|
-
modelId:
|
|
292
|
-
surfaceIds:
|
|
266
|
+
modelId: ModelId,
|
|
267
|
+
surfaceIds: SurfaceId[],
|
|
293
268
|
{
|
|
294
269
|
name,
|
|
295
270
|
item,
|
|
@@ -324,7 +299,7 @@ function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeRet
|
|
|
324
299
|
});
|
|
325
300
|
return result;
|
|
326
301
|
}
|
|
327
|
-
async function applyPolygonAttribute(modelId:
|
|
302
|
+
async function applyPolygonAttribute(modelId: ModelId, surfaceIds: SurfaceId[]): Promise<void> {
|
|
328
303
|
const name = modelSurfacesPolygonAttributeName(modelId, surfaceIds[0]);
|
|
329
304
|
const item = modelSurfacesPolygonAttributeItem(modelId, surfaceIds[0]);
|
|
330
305
|
const storedConfig = modelSurfacesPolygonAttributeStoredConfig(
|
|
@@ -341,31 +316,31 @@ function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeRet
|
|
|
341
316
|
colorMap: storedConfig.colorMap,
|
|
342
317
|
no_data_color: storedConfig.no_data_color,
|
|
343
318
|
};
|
|
344
|
-
if (
|
|
319
|
+
if (isAttributeValid(attribute)) {
|
|
345
320
|
await setModelSurfacesPolygonAttribute(modelId, surfaceIds, attribute);
|
|
346
321
|
}
|
|
347
322
|
}
|
|
348
323
|
async function setModelSurfacesPolygonAttributeName(
|
|
349
|
-
modelId:
|
|
350
|
-
surfaceIds:
|
|
351
|
-
name:
|
|
324
|
+
modelId: ModelId,
|
|
325
|
+
surfaceIds: SurfaceId[],
|
|
326
|
+
name: AttributeName,
|
|
352
327
|
): Promise<void> {
|
|
353
328
|
const item = modelSurfacesPolygonAttributeLastItem(modelId, surfaceIds[0], name);
|
|
354
329
|
await mutateModelSurfacesPolygonStyle(modelId, surfaceIds, { name, item });
|
|
355
330
|
await applyPolygonAttribute(modelId, surfaceIds);
|
|
356
331
|
}
|
|
357
332
|
async function setModelSurfacesPolygonAttributeItem(
|
|
358
|
-
modelId:
|
|
359
|
-
surfaceIds:
|
|
360
|
-
item:
|
|
333
|
+
modelId: ModelId,
|
|
334
|
+
surfaceIds: SurfaceId[],
|
|
335
|
+
item: AttributeItem,
|
|
361
336
|
): Promise<void> {
|
|
362
337
|
await mutateModelSurfacesPolygonStyle(modelId, surfaceIds, { item });
|
|
363
338
|
await applyPolygonAttribute(modelId, surfaceIds);
|
|
364
339
|
}
|
|
365
340
|
async function setModelSurfacesPolygonAttributeTimeStep(
|
|
366
|
-
modelId:
|
|
367
|
-
surfaceIds:
|
|
368
|
-
timeStep:
|
|
341
|
+
modelId: ModelId,
|
|
342
|
+
surfaceIds: SurfaceId[],
|
|
343
|
+
timeStep: AttributeTimeStep,
|
|
369
344
|
): Promise<void> {
|
|
370
345
|
const name = modelSurfacesPolygonAttributeName(modelId, surfaceIds[0]);
|
|
371
346
|
if (name === undefined) {
|
|
@@ -398,10 +373,10 @@ function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeRet
|
|
|
398
373
|
]);
|
|
399
374
|
}
|
|
400
375
|
async function setModelSurfacesPolygonAttributeRange(
|
|
401
|
-
modelId:
|
|
402
|
-
surfaceIds:
|
|
403
|
-
minimum:
|
|
404
|
-
maximum:
|
|
376
|
+
modelId: ModelId,
|
|
377
|
+
surfaceIds: SurfaceId[],
|
|
378
|
+
minimum: AttributeRangeMinimum,
|
|
379
|
+
maximum: AttributeRangeMaximum,
|
|
405
380
|
): Promise<void> {
|
|
406
381
|
const name = modelSurfacesPolygonAttributeName(modelId, surfaceIds[0]);
|
|
407
382
|
const item = modelSurfacesPolygonAttributeItem(modelId, surfaceIds[0]);
|
|
@@ -412,9 +387,9 @@ function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeRet
|
|
|
412
387
|
await applyPolygonAttribute(modelId, surfaceIds);
|
|
413
388
|
}
|
|
414
389
|
async function setModelSurfacesPolygonAttributeColorMap(
|
|
415
|
-
modelId:
|
|
416
|
-
surfaceIds:
|
|
417
|
-
colorMap:
|
|
390
|
+
modelId: ModelId,
|
|
391
|
+
surfaceIds: SurfaceId[],
|
|
392
|
+
colorMap: AttributeColorMap | undefined,
|
|
418
393
|
): Promise<void> {
|
|
419
394
|
const name = modelSurfacesPolygonAttributeName(modelId, surfaceIds[0]);
|
|
420
395
|
const item = modelSurfacesPolygonAttributeItem(modelId, surfaceIds[0]);
|
|
@@ -424,8 +399,8 @@ function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeRet
|
|
|
424
399
|
await applyPolygonAttribute(modelId, surfaceIds);
|
|
425
400
|
}
|
|
426
401
|
async function setModelSurfacesPolygonAttributeNoDataColor(
|
|
427
|
-
modelId:
|
|
428
|
-
surfaceIds:
|
|
402
|
+
modelId: ModelId,
|
|
403
|
+
surfaceIds: SurfaceId[],
|
|
429
404
|
no_data_color: RGBAColor,
|
|
430
405
|
): Promise<void> {
|
|
431
406
|
const name = modelSurfacesPolygonAttributeName(modelId, surfaceIds[0]);
|
|
@@ -459,4 +434,4 @@ function useModelSurfacesPolygonAttribute(): UseModelSurfacesPolygonAttributeRet
|
|
|
459
434
|
setModelSurfacesPolygonAttributeNoDataColor,
|
|
460
435
|
};
|
|
461
436
|
}
|
|
462
|
-
export {
|
|
437
|
+
export { useModelSurfacesPolygonAttribute };
|