@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,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";
|
|
17
|
+
import type { BlockId, ModelId } from "@ogw_front/types/identifiers";
|
|
2
18
|
import { DEFAULT_NO_DATA_COLOR, type RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
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
|
|
|
@@ -16,97 +34,62 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
|
16
34
|
// Local constants
|
|
17
35
|
const attributeSchema = viewer_schemas.opengeodeweb_viewer.model.blocks.attribute.vertex.attribute;
|
|
18
36
|
|
|
19
|
-
interface AttributeStoredConfig {
|
|
20
|
-
minimum: number | undefined;
|
|
21
|
-
maximum: number | undefined;
|
|
22
|
-
colorMap: string | undefined;
|
|
23
|
-
no_data_color: RGBAColor;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface AttributeState {
|
|
27
|
-
name?: string;
|
|
28
|
-
item?: number;
|
|
29
|
-
storedConfigs?: Record<string, { lastItem: number } & Record<string, AttributeStoredConfig>>;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
interface AttributeInput {
|
|
33
|
-
name: string | undefined;
|
|
34
|
-
item: number | undefined;
|
|
35
|
-
minimum: number | undefined;
|
|
36
|
-
maximum: number | undefined;
|
|
37
|
-
colorMap: string | undefined;
|
|
38
|
-
no_data_color?: RGBAColor;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
interface ValidAttributeInput {
|
|
42
|
-
name: string;
|
|
43
|
-
item: number;
|
|
44
|
-
minimum: number;
|
|
45
|
-
maximum: number;
|
|
46
|
-
colorMap: string;
|
|
47
|
-
no_data_color?: RGBAColor;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function isModelBlocksVertexAttributeValid(input: AttributeInput): input is ValidAttributeInput {
|
|
51
|
-
return (
|
|
52
|
-
input.name !== undefined &&
|
|
53
|
-
input.item !== undefined &&
|
|
54
|
-
input.minimum !== undefined &&
|
|
55
|
-
input.maximum !== undefined &&
|
|
56
|
-
input.colorMap !== undefined
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
37
|
interface UseModelBlocksVertexAttributeReturn {
|
|
61
|
-
modelBlocksVertexAttributeName: (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
modelBlocksVertexAttributeTimeStep: (
|
|
38
|
+
modelBlocksVertexAttributeName: (
|
|
39
|
+
modelId: ModelId,
|
|
40
|
+
blockId?: BlockId,
|
|
41
|
+
) => AttributeName | undefined;
|
|
42
|
+
modelBlocksVertexAttributeItem: (modelId: ModelId, blockId?: BlockId) => AttributeItem;
|
|
43
|
+
modelBlocksVertexAttributeRange: (modelId: ModelId, blockId?: BlockId) => AttributeRange;
|
|
44
|
+
modelBlocksVertexAttributeTimeStep: (
|
|
45
|
+
modelId: ModelId,
|
|
46
|
+
blockId?: BlockId,
|
|
47
|
+
) => AttributeTimeStep | undefined;
|
|
68
48
|
setModelBlocksVertexAttributeTimeStep: (
|
|
69
|
-
modelId:
|
|
70
|
-
blockIds:
|
|
71
|
-
timeStep:
|
|
49
|
+
modelId: ModelId,
|
|
50
|
+
blockIds: BlockId[],
|
|
51
|
+
timeStep: AttributeTimeStep,
|
|
72
52
|
) => Promise<void>;
|
|
73
|
-
modelBlocksVertexAttributeColorMap: (
|
|
53
|
+
modelBlocksVertexAttributeColorMap: (
|
|
54
|
+
modelId: ModelId,
|
|
55
|
+
blockId?: BlockId,
|
|
56
|
+
) => AttributeColorMap | undefined;
|
|
74
57
|
modelBlocksVertexAttributeStoredConfig: (
|
|
75
|
-
modelId:
|
|
76
|
-
blockId:
|
|
77
|
-
name:
|
|
78
|
-
item:
|
|
58
|
+
modelId: ModelId,
|
|
59
|
+
blockId: BlockId | undefined,
|
|
60
|
+
name: AttributeName | undefined,
|
|
61
|
+
item: AttributeItem | undefined,
|
|
79
62
|
) => AttributeStoredConfig;
|
|
80
63
|
setModelBlocksVertexAttribute: (
|
|
81
|
-
modelId:
|
|
82
|
-
blockIds:
|
|
64
|
+
modelId: ModelId,
|
|
65
|
+
blockIds: BlockId[],
|
|
83
66
|
input: ValidAttributeInput,
|
|
84
67
|
) => Promise<unknown>;
|
|
85
68
|
setModelBlocksVertexAttributeName: (
|
|
86
|
-
modelId:
|
|
87
|
-
blockIds:
|
|
88
|
-
name:
|
|
69
|
+
modelId: ModelId,
|
|
70
|
+
blockIds: BlockId[],
|
|
71
|
+
name: AttributeName,
|
|
89
72
|
) => Promise<unknown>;
|
|
90
73
|
setModelBlocksVertexAttributeItem: (
|
|
91
|
-
modelId:
|
|
92
|
-
blockIds:
|
|
93
|
-
item:
|
|
74
|
+
modelId: ModelId,
|
|
75
|
+
blockIds: BlockId[],
|
|
76
|
+
item: AttributeItem,
|
|
94
77
|
) => Promise<unknown>;
|
|
95
78
|
setModelBlocksVertexAttributeRange: (
|
|
96
|
-
modelId:
|
|
97
|
-
blockIds:
|
|
98
|
-
minimum:
|
|
99
|
-
maximum:
|
|
79
|
+
modelId: ModelId,
|
|
80
|
+
blockIds: BlockId[],
|
|
81
|
+
minimum: AttributeRangeMinimum,
|
|
82
|
+
maximum: AttributeRangeMaximum,
|
|
100
83
|
) => Promise<unknown>;
|
|
101
84
|
setModelBlocksVertexAttributeColorMap: (
|
|
102
|
-
modelId:
|
|
103
|
-
blockIds:
|
|
104
|
-
colorMap:
|
|
85
|
+
modelId: ModelId,
|
|
86
|
+
blockIds: BlockId[],
|
|
87
|
+
colorMap: AttributeColorMap | undefined,
|
|
105
88
|
) => Promise<unknown>;
|
|
106
|
-
modelBlocksVertexAttributeNoDataColor: (modelId:
|
|
89
|
+
modelBlocksVertexAttributeNoDataColor: (modelId: ModelId, blockId?: BlockId) => RGBAColor;
|
|
107
90
|
setModelBlocksVertexAttributeNoDataColor: (
|
|
108
|
-
modelId:
|
|
109
|
-
blockIds:
|
|
91
|
+
modelId: ModelId,
|
|
92
|
+
blockIds: BlockId[],
|
|
110
93
|
no_data_color: RGBAColor,
|
|
111
94
|
) => Promise<unknown>;
|
|
112
95
|
}
|
|
@@ -122,9 +105,9 @@ type ModelBlocksVertexAttributeGetters = Pick<
|
|
|
122
105
|
| "modelBlocksVertexAttributeTimeStep"
|
|
123
106
|
> & {
|
|
124
107
|
modelBlocksVertexAttributeLastItem: (
|
|
125
|
-
modelId:
|
|
108
|
+
modelId: ModelId,
|
|
126
109
|
componentId: string | undefined,
|
|
127
|
-
name:
|
|
110
|
+
name: AttributeName | undefined,
|
|
128
111
|
) => number;
|
|
129
112
|
};
|
|
130
113
|
|
|
@@ -133,15 +116,15 @@ function useModelBlocksVertexAttributeGetters(
|
|
|
133
116
|
modelBlocksCommonStyle: ReturnType<typeof useModelBlocksCommonStyle>,
|
|
134
117
|
): ModelBlocksVertexAttributeGetters {
|
|
135
118
|
const { attributeTimeStep } = useAttributeTimeStepStyle();
|
|
136
|
-
function modelBlocksVertexAttribute(modelId:
|
|
119
|
+
function modelBlocksVertexAttribute(modelId: ModelId, blockId?: BlockId): AttributeState {
|
|
137
120
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.vertex shape is defined by the data style schema.
|
|
138
121
|
return modelBlocksCommonStyle.modelBlockColoring(modelId, blockId).vertex as AttributeState;
|
|
139
122
|
}
|
|
140
123
|
function modelBlocksVertexAttributeStoredConfig(
|
|
141
|
-
modelId:
|
|
142
|
-
blockId:
|
|
143
|
-
name:
|
|
144
|
-
item:
|
|
124
|
+
modelId: ModelId,
|
|
125
|
+
blockId: BlockId | undefined,
|
|
126
|
+
name: AttributeName | undefined,
|
|
127
|
+
item: AttributeItem | undefined,
|
|
145
128
|
): AttributeStoredConfig {
|
|
146
129
|
const { storedConfigs } = modelBlocksVertexAttribute(modelId, blockId);
|
|
147
130
|
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
@@ -149,20 +132,18 @@ function useModelBlocksVertexAttributeGetters(
|
|
|
149
132
|
if (itemConfig !== undefined) {
|
|
150
133
|
return itemConfig;
|
|
151
134
|
}
|
|
152
|
-
return
|
|
153
|
-
minimum: undefined,
|
|
154
|
-
maximum: undefined,
|
|
155
|
-
colorMap: undefined,
|
|
156
|
-
no_data_color: DEFAULT_NO_DATA_COLOR,
|
|
157
|
-
};
|
|
135
|
+
return defaultAttributeStoredConfig();
|
|
158
136
|
}
|
|
159
|
-
function modelBlocksVertexAttributeName(
|
|
137
|
+
function modelBlocksVertexAttributeName(
|
|
138
|
+
modelId: ModelId,
|
|
139
|
+
blockId?: BlockId,
|
|
140
|
+
): AttributeName | undefined {
|
|
160
141
|
return modelBlocksVertexAttribute(modelId, blockId).name;
|
|
161
142
|
}
|
|
162
143
|
function modelBlocksVertexAttributeLastItem(
|
|
163
|
-
modelId:
|
|
164
|
-
blockId:
|
|
165
|
-
name:
|
|
144
|
+
modelId: ModelId,
|
|
145
|
+
blockId: BlockId | undefined,
|
|
146
|
+
name: AttributeName | undefined,
|
|
166
147
|
): number {
|
|
167
148
|
const { storedConfigs } = modelBlocksVertexAttribute(modelId, blockId);
|
|
168
149
|
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
@@ -171,17 +152,14 @@ function useModelBlocksVertexAttributeGetters(
|
|
|
171
152
|
}
|
|
172
153
|
return 0;
|
|
173
154
|
}
|
|
174
|
-
function modelBlocksVertexAttributeItem(modelId:
|
|
155
|
+
function modelBlocksVertexAttributeItem(modelId: ModelId, blockId?: BlockId): AttributeItem {
|
|
175
156
|
const vertexAttribute = modelBlocksVertexAttribute(modelId, blockId);
|
|
176
157
|
return (
|
|
177
158
|
vertexAttribute.item ??
|
|
178
159
|
modelBlocksVertexAttributeLastItem(modelId, blockId, vertexAttribute.name)
|
|
179
160
|
);
|
|
180
161
|
}
|
|
181
|
-
function modelBlocksVertexAttributeRange(
|
|
182
|
-
modelId: string,
|
|
183
|
-
blockId?: string,
|
|
184
|
-
): [number | undefined, number | undefined] {
|
|
162
|
+
function modelBlocksVertexAttributeRange(modelId: ModelId, blockId?: BlockId): AttributeRange {
|
|
185
163
|
const name = modelBlocksVertexAttributeName(modelId, blockId);
|
|
186
164
|
const item = modelBlocksVertexAttributeItem(modelId, blockId);
|
|
187
165
|
const storedConfig = modelBlocksVertexAttributeStoredConfig(modelId, blockId, name, item);
|
|
@@ -189,24 +167,24 @@ function useModelBlocksVertexAttributeGetters(
|
|
|
189
167
|
return [minimum, maximum];
|
|
190
168
|
}
|
|
191
169
|
function modelBlocksVertexAttributeColorMap(
|
|
192
|
-
modelId:
|
|
193
|
-
blockId?:
|
|
194
|
-
):
|
|
170
|
+
modelId: ModelId,
|
|
171
|
+
blockId?: BlockId,
|
|
172
|
+
): AttributeColorMap | undefined {
|
|
195
173
|
const name = modelBlocksVertexAttributeName(modelId, blockId);
|
|
196
174
|
const item = modelBlocksVertexAttributeItem(modelId, blockId);
|
|
197
175
|
const storedConfig = modelBlocksVertexAttributeStoredConfig(modelId, blockId, name, item);
|
|
198
176
|
return storedConfig.colorMap;
|
|
199
177
|
}
|
|
200
|
-
function modelBlocksVertexAttributeNoDataColor(modelId:
|
|
178
|
+
function modelBlocksVertexAttributeNoDataColor(modelId: ModelId, blockId?: BlockId): RGBAColor {
|
|
201
179
|
const name = modelBlocksVertexAttributeName(modelId, blockId);
|
|
202
180
|
const item = modelBlocksVertexAttributeItem(modelId, blockId);
|
|
203
181
|
const storedConfig = modelBlocksVertexAttributeStoredConfig(modelId, blockId, name, item);
|
|
204
182
|
return storedConfig.no_data_color;
|
|
205
183
|
}
|
|
206
184
|
function modelBlocksVertexAttributeTimeStep(
|
|
207
|
-
modelId:
|
|
208
|
-
blockId?:
|
|
209
|
-
):
|
|
185
|
+
modelId: ModelId,
|
|
186
|
+
blockId?: BlockId,
|
|
187
|
+
): AttributeTimeStep | undefined {
|
|
210
188
|
return attributeTimeStep(
|
|
211
189
|
modelId,
|
|
212
190
|
attributeSchema.$id,
|
|
@@ -242,8 +220,8 @@ function useModelBlocksVertexAttribute(): UseModelBlocksVertexAttributeReturn {
|
|
|
242
220
|
} = useModelBlocksVertexAttributeGetters(modelBlocksCommonStyle);
|
|
243
221
|
const viewerStore = useViewerStore();
|
|
244
222
|
async function mutateModelBlocksVertexStyle(
|
|
245
|
-
modelId:
|
|
246
|
-
blockIds:
|
|
223
|
+
modelId: ModelId,
|
|
224
|
+
blockIds: BlockId[],
|
|
247
225
|
values: Record<string, unknown>,
|
|
248
226
|
): Promise<void> {
|
|
249
227
|
const tasks: Promise<void>[] = [
|
|
@@ -262,10 +240,10 @@ function useModelBlocksVertexAttribute(): UseModelBlocksVertexAttributeReturn {
|
|
|
262
240
|
await Promise.all(tasks);
|
|
263
241
|
}
|
|
264
242
|
async function setModelBlocksVertexAttributeStoredConfig(
|
|
265
|
-
modelId:
|
|
266
|
-
blockIds:
|
|
267
|
-
name:
|
|
268
|
-
item:
|
|
243
|
+
modelId: ModelId,
|
|
244
|
+
blockIds: BlockId[],
|
|
245
|
+
name: AttributeName | undefined,
|
|
246
|
+
item: AttributeItem | undefined,
|
|
269
247
|
config: Partial<AttributeStoredConfig>,
|
|
270
248
|
): Promise<void> {
|
|
271
249
|
if (name === undefined || item === undefined) {
|
|
@@ -281,8 +259,8 @@ function useModelBlocksVertexAttribute(): UseModelBlocksVertexAttributeReturn {
|
|
|
281
259
|
});
|
|
282
260
|
}
|
|
283
261
|
async function setModelBlocksVertexAttribute(
|
|
284
|
-
modelId:
|
|
285
|
-
blockIds:
|
|
262
|
+
modelId: ModelId,
|
|
263
|
+
blockIds: BlockId[],
|
|
286
264
|
{
|
|
287
265
|
name,
|
|
288
266
|
item,
|
|
@@ -319,7 +297,7 @@ function useModelBlocksVertexAttribute(): UseModelBlocksVertexAttributeReturn {
|
|
|
319
297
|
params,
|
|
320
298
|
});
|
|
321
299
|
}
|
|
322
|
-
async function applyVertexAttribute(modelId:
|
|
300
|
+
async function applyVertexAttribute(modelId: ModelId, blockIds: BlockId[]): Promise<unknown> {
|
|
323
301
|
const name = modelBlocksVertexAttributeName(modelId, blockIds[0]);
|
|
324
302
|
const item = modelBlocksVertexAttributeItem(modelId, blockIds[0]);
|
|
325
303
|
const storedConfig = modelBlocksVertexAttributeStoredConfig(modelId, blockIds[0], name, item);
|
|
@@ -331,16 +309,16 @@ function useModelBlocksVertexAttribute(): UseModelBlocksVertexAttributeReturn {
|
|
|
331
309
|
colorMap: storedConfig.colorMap,
|
|
332
310
|
no_data_color: storedConfig.no_data_color,
|
|
333
311
|
};
|
|
334
|
-
if (
|
|
312
|
+
if (isAttributeValid(attribute)) {
|
|
335
313
|
const result = await setModelBlocksVertexAttribute(modelId, blockIds, attribute);
|
|
336
314
|
return result;
|
|
337
315
|
}
|
|
338
316
|
return undefined;
|
|
339
317
|
}
|
|
340
318
|
async function setModelBlocksVertexAttributeName(
|
|
341
|
-
modelId:
|
|
342
|
-
blockIds:
|
|
343
|
-
name:
|
|
319
|
+
modelId: ModelId,
|
|
320
|
+
blockIds: BlockId[],
|
|
321
|
+
name: AttributeName,
|
|
344
322
|
): Promise<unknown> {
|
|
345
323
|
const item = modelBlocksVertexAttributeLastItem(modelId, blockIds[0], name);
|
|
346
324
|
await mutateModelBlocksVertexStyle(modelId, blockIds, {
|
|
@@ -350,9 +328,9 @@ function useModelBlocksVertexAttribute(): UseModelBlocksVertexAttributeReturn {
|
|
|
350
328
|
return applyVertexAttribute(modelId, blockIds);
|
|
351
329
|
}
|
|
352
330
|
async function setModelBlocksVertexAttributeItem(
|
|
353
|
-
modelId:
|
|
354
|
-
blockIds:
|
|
355
|
-
item:
|
|
331
|
+
modelId: ModelId,
|
|
332
|
+
blockIds: BlockId[],
|
|
333
|
+
item: AttributeItem,
|
|
356
334
|
): Promise<unknown> {
|
|
357
335
|
await mutateModelBlocksVertexStyle(modelId, blockIds, {
|
|
358
336
|
item,
|
|
@@ -360,9 +338,9 @@ function useModelBlocksVertexAttribute(): UseModelBlocksVertexAttributeReturn {
|
|
|
360
338
|
return applyVertexAttribute(modelId, blockIds);
|
|
361
339
|
}
|
|
362
340
|
async function setModelBlocksVertexAttributeTimeStep(
|
|
363
|
-
modelId:
|
|
364
|
-
blockIds:
|
|
365
|
-
timeStep:
|
|
341
|
+
modelId: ModelId,
|
|
342
|
+
blockIds: BlockId[],
|
|
343
|
+
timeStep: AttributeTimeStep,
|
|
366
344
|
): Promise<void> {
|
|
367
345
|
const name = modelBlocksVertexAttributeName(modelId, blockIds[0]);
|
|
368
346
|
if (name === undefined) {
|
|
@@ -395,10 +373,10 @@ function useModelBlocksVertexAttribute(): UseModelBlocksVertexAttributeReturn {
|
|
|
395
373
|
]);
|
|
396
374
|
}
|
|
397
375
|
async function setModelBlocksVertexAttributeRange(
|
|
398
|
-
modelId:
|
|
399
|
-
blockIds:
|
|
400
|
-
minimum:
|
|
401
|
-
maximum:
|
|
376
|
+
modelId: ModelId,
|
|
377
|
+
blockIds: BlockId[],
|
|
378
|
+
minimum: AttributeRangeMinimum,
|
|
379
|
+
maximum: AttributeRangeMaximum,
|
|
402
380
|
): Promise<unknown> {
|
|
403
381
|
const name = modelBlocksVertexAttributeName(modelId, blockIds[0]);
|
|
404
382
|
const item = modelBlocksVertexAttributeItem(modelId, blockIds[0]);
|
|
@@ -409,9 +387,9 @@ function useModelBlocksVertexAttribute(): UseModelBlocksVertexAttributeReturn {
|
|
|
409
387
|
return applyVertexAttribute(modelId, blockIds);
|
|
410
388
|
}
|
|
411
389
|
async function setModelBlocksVertexAttributeColorMap(
|
|
412
|
-
modelId:
|
|
413
|
-
blockIds:
|
|
414
|
-
colorMap:
|
|
390
|
+
modelId: ModelId,
|
|
391
|
+
blockIds: BlockId[],
|
|
392
|
+
colorMap: AttributeColorMap | undefined,
|
|
415
393
|
): Promise<unknown> {
|
|
416
394
|
const name = modelBlocksVertexAttributeName(modelId, blockIds[0]);
|
|
417
395
|
const item = modelBlocksVertexAttributeItem(modelId, blockIds[0]);
|
|
@@ -421,8 +399,8 @@ function useModelBlocksVertexAttribute(): UseModelBlocksVertexAttributeReturn {
|
|
|
421
399
|
return applyVertexAttribute(modelId, blockIds);
|
|
422
400
|
}
|
|
423
401
|
async function setModelBlocksVertexAttributeNoDataColor(
|
|
424
|
-
modelId:
|
|
425
|
-
blockIds:
|
|
402
|
+
modelId: ModelId,
|
|
403
|
+
blockIds: BlockId[],
|
|
426
404
|
no_data_color: RGBAColor,
|
|
427
405
|
): Promise<unknown> {
|
|
428
406
|
const name = modelBlocksVertexAttributeName(modelId, blockIds[0]);
|
|
@@ -451,4 +429,4 @@ function useModelBlocksVertexAttribute(): UseModelBlocksVertexAttributeReturn {
|
|
|
451
429
|
setModelBlocksVertexAttributeNoDataColor,
|
|
452
430
|
};
|
|
453
431
|
}
|
|
454
|
-
export {
|
|
432
|
+
export { useModelBlocksVertexAttribute };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { BlockId, ModelId } from "@ogw_front/types/identifiers";
|
|
2
|
+
import type { Visibility } from "@ogw_front/types/style";
|
|
1
3
|
import { useModelBlocksCommonStyle } from "./common";
|
|
2
4
|
import { useModelCommonStyle } from "@ogw_internal/stores/data_style/model/common";
|
|
3
5
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
@@ -6,23 +8,23 @@ const schema = viewer_schemas.opengeodeweb_viewer.model.blocks.visibility;
|
|
|
6
8
|
|
|
7
9
|
export function useModelBlocksVisibility(): {
|
|
8
10
|
setModelBlocksVisibility: (
|
|
9
|
-
modelId:
|
|
10
|
-
blocks_ids:
|
|
11
|
-
visibility:
|
|
11
|
+
modelId: ModelId,
|
|
12
|
+
blocks_ids: BlockId[],
|
|
13
|
+
visibility: Visibility,
|
|
12
14
|
) => Promise<unknown>;
|
|
13
|
-
modelBlockVisibility: (
|
|
15
|
+
modelBlockVisibility: (modelId: ModelId, block_id?: BlockId) => unknown;
|
|
14
16
|
} {
|
|
15
17
|
const modelCommonStyle = useModelCommonStyle();
|
|
16
18
|
const modelBlocksCommonStyle = useModelBlocksCommonStyle();
|
|
17
19
|
|
|
18
|
-
function modelBlockVisibility(
|
|
19
|
-
return modelBlocksCommonStyle.modelBlockStyle(
|
|
20
|
+
function modelBlockVisibility(modelId: ModelId, block_id?: BlockId): unknown {
|
|
21
|
+
return modelBlocksCommonStyle.modelBlockStyle(modelId, block_id).visibility;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
async function setModelBlocksVisibility(
|
|
23
|
-
modelId:
|
|
24
|
-
blocks_ids:
|
|
25
|
-
visibility:
|
|
25
|
+
modelId: ModelId,
|
|
26
|
+
blocks_ids: BlockId[],
|
|
27
|
+
visibility: Visibility,
|
|
26
28
|
): Promise<unknown> {
|
|
27
29
|
const result = await modelCommonStyle.setModelTypeVisibility(
|
|
28
30
|
modelId,
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AttributeColorMap,
|
|
3
|
+
AttributeName,
|
|
4
|
+
AttributeRange,
|
|
5
|
+
AttributeRangeMaximum,
|
|
6
|
+
AttributeRangeMinimum,
|
|
7
|
+
} from "@ogw_front/types/attribute";
|
|
8
|
+
import type { ModelId } from "@ogw_front/types/identifiers";
|
|
1
9
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
2
10
|
// oxlint-disable eslint/max-lines
|
|
3
11
|
import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
|
|
@@ -11,32 +19,38 @@ import { useModelCommonStyle } from "@ogw_internal/stores/data_style/model/commo
|
|
|
11
19
|
type ComponentStyleFunctions = Record<"Surface" | "Line" | "Block" | "Corner", any>;
|
|
12
20
|
|
|
13
21
|
interface AttributeAccessors {
|
|
14
|
-
getName: (modelId:
|
|
15
|
-
setName: (modelId:
|
|
16
|
-
getRange: (modelId:
|
|
17
|
-
setRange: (
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
getName: (modelId: ModelId, componentId: string) => string | undefined;
|
|
23
|
+
setName: (modelId: ModelId, componentIds: string[], name: AttributeName) => unknown;
|
|
24
|
+
getRange: (modelId: ModelId, componentId: string) => AttributeRange;
|
|
25
|
+
setRange: (
|
|
26
|
+
modelId: ModelId,
|
|
27
|
+
componentIds: string[],
|
|
28
|
+
minimum: AttributeRangeMinimum,
|
|
29
|
+
maximum: AttributeRangeMaximum,
|
|
30
|
+
) => unknown;
|
|
31
|
+
getColorMap: (modelId: ModelId, componentId: string) => AttributeColorMap | undefined;
|
|
32
|
+
setColorMap: (modelId: ModelId, componentIds: string[], colorMap: AttributeColorMap) => unknown;
|
|
20
33
|
}
|
|
21
34
|
|
|
22
35
|
// The signatures below describe just the per-attribute-kind methods this module reads off each dynamically-typed composable (see the `any` in ComponentStyleFunctions above). `attributeFn` narrows one such method to its known signature so every downstream read/call is a real, checked type instead of `any`.
|
|
23
|
-
type AttributeNameFn = (modelId:
|
|
24
|
-
type SetAttributeNameFn = (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
) =>
|
|
36
|
+
type AttributeNameFn = (modelId: ModelId, componentId: string) => string | undefined;
|
|
37
|
+
type SetAttributeNameFn = (
|
|
38
|
+
modelId: ModelId,
|
|
39
|
+
componentIds: string[],
|
|
40
|
+
name: AttributeName,
|
|
41
|
+
) => unknown;
|
|
42
|
+
type AttributeRangeFn = (modelId: ModelId, componentId: string) => AttributeRange;
|
|
29
43
|
type SetAttributeRangeFn = (
|
|
30
|
-
modelId:
|
|
44
|
+
modelId: ModelId,
|
|
31
45
|
componentIds: string[],
|
|
32
|
-
minimum:
|
|
33
|
-
maximum:
|
|
46
|
+
minimum: AttributeRangeMinimum,
|
|
47
|
+
maximum: AttributeRangeMaximum,
|
|
34
48
|
) => unknown;
|
|
35
|
-
type AttributeColorMapFn = (modelId:
|
|
49
|
+
type AttributeColorMapFn = (modelId: ModelId, componentId: string) => string | undefined;
|
|
36
50
|
type SetAttributeColorMapFn = (
|
|
37
|
-
modelId:
|
|
51
|
+
modelId: ModelId,
|
|
38
52
|
componentIds: string[],
|
|
39
|
-
colorMap:
|
|
53
|
+
colorMap: AttributeColorMap,
|
|
40
54
|
) => unknown;
|
|
41
55
|
type DynamicStyleFunctions = Record<string, unknown>;
|
|
42
56
|
|
|
@@ -48,7 +62,7 @@ function attributeFn<Signature>(method: unknown): Signature {
|
|
|
48
62
|
|
|
49
63
|
// Re-applies the attribute name, range and color map of `firstId` to every id in `componentIds`
|
|
50
64
|
async function applyAttributeAccessors(
|
|
51
|
-
modelId:
|
|
65
|
+
modelId: ModelId,
|
|
52
66
|
componentIds: string[],
|
|
53
67
|
firstId: string,
|
|
54
68
|
accessors: AttributeAccessors,
|
|
@@ -71,26 +85,26 @@ async function applyAttributeAccessors(
|
|
|
71
85
|
|
|
72
86
|
// oxlint-disable-next-line max-lines-per-function
|
|
73
87
|
function useModelColorStyle(componentStyleFunctions: ComponentStyleFunctions): {
|
|
74
|
-
getModelColor: (modelId:
|
|
75
|
-
getModelActiveColoring: (modelId:
|
|
76
|
-
getModelComponentColor: (modelId:
|
|
77
|
-
getModelComponentEffectiveColor: (modelId:
|
|
78
|
-
getModelComponentActiveColoring: (modelId:
|
|
79
|
-
modelComponentTypeColor: (modelId:
|
|
80
|
-
getModelComponentTypeActiveColoring: (modelId:
|
|
81
|
-
setModelComponentTypeColor: (modelId:
|
|
88
|
+
getModelColor: (modelId: ModelId) => RGBAColor | undefined;
|
|
89
|
+
getModelActiveColoring: (modelId: ModelId) => unknown;
|
|
90
|
+
getModelComponentColor: (modelId: ModelId, componentId: string) => unknown;
|
|
91
|
+
getModelComponentEffectiveColor: (modelId: ModelId, componentId: string, type: string) => unknown;
|
|
92
|
+
getModelComponentActiveColoring: (modelId: ModelId, componentId: string) => unknown;
|
|
93
|
+
modelComponentTypeColor: (modelId: ModelId, type: string) => unknown;
|
|
94
|
+
getModelComponentTypeActiveColoring: (modelId: ModelId, type: string) => unknown;
|
|
95
|
+
setModelComponentTypeColor: (modelId: ModelId, type: string, color: RGBAColor) => Promise<void>;
|
|
82
96
|
setModelComponentTypeActiveColoring: (
|
|
83
|
-
modelId:
|
|
97
|
+
modelId: ModelId,
|
|
84
98
|
type: string,
|
|
85
99
|
activeColoring: string,
|
|
86
100
|
) => Promise<void>;
|
|
87
101
|
setModelComponentActiveColoring: (
|
|
88
|
-
modelId:
|
|
102
|
+
modelId: ModelId,
|
|
89
103
|
componentId: string,
|
|
90
104
|
activeColoring: string,
|
|
91
105
|
) => Promise<void>;
|
|
92
106
|
setModelComponentsColor: (
|
|
93
|
-
modelId:
|
|
107
|
+
modelId: ModelId,
|
|
94
108
|
componentIds: string[],
|
|
95
109
|
color: RGBAColor | undefined,
|
|
96
110
|
activeColoring?: string,
|
|
@@ -185,12 +199,12 @@ function useModelColorStyle(componentStyleFunctions: ComponentStyleFunctions): {
|
|
|
185
199
|
},
|
|
186
200
|
},
|
|
187
201
|
};
|
|
188
|
-
function getModelComponentColor(modelId:
|
|
202
|
+
function getModelComponentColor(modelId: ModelId, componentId: string): unknown {
|
|
189
203
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring shape is defined by the data style schema.
|
|
190
204
|
const coloring = dataStyleState.getComponentStyle(modelId, componentId).coloring as StyleValues;
|
|
191
205
|
return coloring.constant;
|
|
192
206
|
}
|
|
193
|
-
function modelComponentTypeColor(modelId:
|
|
207
|
+
function modelComponentTypeColor(modelId: ModelId, type: string): unknown {
|
|
194
208
|
const groupStyle = dataStyleState.getModelComponentTypeStyle(modelId, type);
|
|
195
209
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring shape is defined by the data style schema.
|
|
196
210
|
const groupColoring = groupStyle.coloring as StyleValues;
|
|
@@ -201,7 +215,7 @@ function useModelColorStyle(componentStyleFunctions: ComponentStyleFunctions): {
|
|
|
201
215
|
return groupColoring.constant ?? typeColoring.constant;
|
|
202
216
|
}
|
|
203
217
|
function getModelComponentEffectiveColor(
|
|
204
|
-
modelId:
|
|
218
|
+
modelId: ModelId,
|
|
205
219
|
componentId: string,
|
|
206
220
|
type: string,
|
|
207
221
|
): unknown {
|
|
@@ -211,12 +225,12 @@ function useModelColorStyle(componentStyleFunctions: ComponentStyleFunctions): {
|
|
|
211
225
|
}
|
|
212
226
|
return modelComponentTypeColor(modelId, type);
|
|
213
227
|
}
|
|
214
|
-
function getModelComponentActiveColoring(modelId:
|
|
228
|
+
function getModelComponentActiveColoring(modelId: ModelId, componentId: string): unknown {
|
|
215
229
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring shape is defined by the data style schema.
|
|
216
230
|
const coloring = dataStyleState.getComponentStyle(modelId, componentId).coloring as StyleValues;
|
|
217
231
|
return coloring.active;
|
|
218
232
|
}
|
|
219
|
-
function getModelComponentTypeActiveColoring(modelId:
|
|
233
|
+
function getModelComponentTypeActiveColoring(modelId: ModelId, type: string): unknown {
|
|
220
234
|
const groupStyle = dataStyleState.getModelComponentTypeStyle(modelId, type);
|
|
221
235
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring shape is defined by the data style schema.
|
|
222
236
|
const groupColoring = groupStyle.coloring as StyleValues;
|
|
@@ -227,7 +241,7 @@ function useModelColorStyle(componentStyleFunctions: ComponentStyleFunctions): {
|
|
|
227
241
|
return groupColoring.active ?? typeColoring.active;
|
|
228
242
|
}
|
|
229
243
|
async function setModelComponentsColor(
|
|
230
|
-
modelId:
|
|
244
|
+
modelId: ModelId,
|
|
231
245
|
componentIds: string[],
|
|
232
246
|
color: RGBAColor | undefined,
|
|
233
247
|
activeColoring = "constant",
|
|
@@ -250,7 +264,7 @@ function useModelColorStyle(componentStyleFunctions: ComponentStyleFunctions): {
|
|
|
250
264
|
);
|
|
251
265
|
}
|
|
252
266
|
async function setModelComponentTypeColor(
|
|
253
|
-
modelId:
|
|
267
|
+
modelId: ModelId,
|
|
254
268
|
type: string,
|
|
255
269
|
color: RGBAColor,
|
|
256
270
|
): Promise<void> {
|
|
@@ -267,7 +281,7 @@ function useModelColorStyle(componentStyleFunctions: ComponentStyleFunctions): {
|
|
|
267
281
|
await setModelComponentsColor(modelId, idsForType, color);
|
|
268
282
|
}
|
|
269
283
|
async function setModelComponentTypeActiveColoring(
|
|
270
|
-
modelId:
|
|
284
|
+
modelId: ModelId,
|
|
271
285
|
type: string,
|
|
272
286
|
activeColoring: string,
|
|
273
287
|
): Promise<void> {
|
|
@@ -300,7 +314,7 @@ function useModelColorStyle(componentStyleFunctions: ComponentStyleFunctions): {
|
|
|
300
314
|
await applyAttributeAccessors(modelId, idsForType, firstId, attributeFunctions);
|
|
301
315
|
}
|
|
302
316
|
async function setModelComponentActiveColoring(
|
|
303
|
-
modelId:
|
|
317
|
+
modelId: ModelId,
|
|
304
318
|
componentId: string,
|
|
305
319
|
activeColoring: string,
|
|
306
320
|
): Promise<void> {
|
|
@@ -323,13 +337,13 @@ function useModelColorStyle(componentStyleFunctions: ComponentStyleFunctions): {
|
|
|
323
337
|
}
|
|
324
338
|
await applyAttributeAccessors(modelId, [componentId], componentId, attributeFunctions);
|
|
325
339
|
}
|
|
326
|
-
function getModelColor(modelId:
|
|
340
|
+
function getModelColor(modelId: ModelId): RGBAColor | undefined {
|
|
327
341
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring shape is defined by the data style schema.
|
|
328
342
|
return (dataStyleState.getStyle(modelId).coloring as StyleValues).constant as
|
|
329
343
|
| RGBAColor
|
|
330
344
|
| undefined;
|
|
331
345
|
}
|
|
332
|
-
function getModelActiveColoring(modelId:
|
|
346
|
+
function getModelActiveColoring(modelId: ModelId): unknown {
|
|
333
347
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring shape is defined by the data style schema.
|
|
334
348
|
return (dataStyleState.getStyle(modelId).coloring as StyleValues).active;
|
|
335
349
|
}
|