@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";
|
|
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,97 +35,62 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
|
17
35
|
const attributeSchema =
|
|
18
36
|
viewer_schemas.opengeodeweb_viewer.model.surfaces.attribute.vertex.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 isModelSurfacesVertexAttributeValid(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 UseModelSurfacesVertexAttributeReturn {
|
|
62
|
-
modelSurfacesVertexAttributeName: (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
modelSurfacesVertexAttributeTimeStep: (
|
|
39
|
+
modelSurfacesVertexAttributeName: (
|
|
40
|
+
modelId: ModelId,
|
|
41
|
+
surfaceId?: SurfaceId,
|
|
42
|
+
) => AttributeName | undefined;
|
|
43
|
+
modelSurfacesVertexAttributeItem: (modelId: ModelId, surfaceId?: SurfaceId) => AttributeItem;
|
|
44
|
+
modelSurfacesVertexAttributeRange: (modelId: ModelId, surfaceId?: SurfaceId) => AttributeRange;
|
|
45
|
+
modelSurfacesVertexAttributeTimeStep: (
|
|
46
|
+
modelId: ModelId,
|
|
47
|
+
surfaceId?: SurfaceId,
|
|
48
|
+
) => AttributeTimeStep | undefined;
|
|
69
49
|
setModelSurfacesVertexAttributeTimeStep: (
|
|
70
|
-
modelId:
|
|
71
|
-
surfaceIds:
|
|
72
|
-
timeStep:
|
|
50
|
+
modelId: ModelId,
|
|
51
|
+
surfaceIds: SurfaceId[],
|
|
52
|
+
timeStep: AttributeTimeStep,
|
|
73
53
|
) => Promise<void>;
|
|
74
|
-
modelSurfacesVertexAttributeColorMap: (
|
|
54
|
+
modelSurfacesVertexAttributeColorMap: (
|
|
55
|
+
modelId: ModelId,
|
|
56
|
+
surfaceId?: SurfaceId,
|
|
57
|
+
) => AttributeColorMap | undefined;
|
|
75
58
|
modelSurfacesVertexAttributeStoredConfig: (
|
|
76
|
-
modelId:
|
|
77
|
-
surfaceId:
|
|
78
|
-
name:
|
|
79
|
-
item:
|
|
59
|
+
modelId: ModelId,
|
|
60
|
+
surfaceId: SurfaceId | undefined,
|
|
61
|
+
name: AttributeName | undefined,
|
|
62
|
+
item: AttributeItem | undefined,
|
|
80
63
|
) => AttributeStoredConfig;
|
|
81
64
|
setModelSurfacesVertexAttribute: (
|
|
82
|
-
modelId:
|
|
83
|
-
surfaceIds:
|
|
65
|
+
modelId: ModelId,
|
|
66
|
+
surfaceIds: SurfaceId[],
|
|
84
67
|
input: ValidAttributeInput,
|
|
85
68
|
) => Promise<unknown>;
|
|
86
69
|
setModelSurfacesVertexAttributeName: (
|
|
87
|
-
modelId:
|
|
88
|
-
surfaceIds:
|
|
89
|
-
name:
|
|
70
|
+
modelId: ModelId,
|
|
71
|
+
surfaceIds: SurfaceId[],
|
|
72
|
+
name: AttributeName,
|
|
90
73
|
) => Promise<unknown>;
|
|
91
74
|
setModelSurfacesVertexAttributeItem: (
|
|
92
|
-
modelId:
|
|
93
|
-
surfaceIds:
|
|
94
|
-
item:
|
|
75
|
+
modelId: ModelId,
|
|
76
|
+
surfaceIds: SurfaceId[],
|
|
77
|
+
item: AttributeItem,
|
|
95
78
|
) => Promise<unknown>;
|
|
96
79
|
setModelSurfacesVertexAttributeRange: (
|
|
97
|
-
modelId:
|
|
98
|
-
surfaceIds:
|
|
99
|
-
minimum:
|
|
100
|
-
maximum:
|
|
80
|
+
modelId: ModelId,
|
|
81
|
+
surfaceIds: SurfaceId[],
|
|
82
|
+
minimum: AttributeRangeMinimum,
|
|
83
|
+
maximum: AttributeRangeMaximum,
|
|
101
84
|
) => Promise<unknown>;
|
|
102
85
|
setModelSurfacesVertexAttributeColorMap: (
|
|
103
|
-
modelId:
|
|
104
|
-
surfaceIds:
|
|
105
|
-
colorMap:
|
|
86
|
+
modelId: ModelId,
|
|
87
|
+
surfaceIds: SurfaceId[],
|
|
88
|
+
colorMap: AttributeColorMap | undefined,
|
|
106
89
|
) => Promise<unknown>;
|
|
107
|
-
modelSurfacesVertexAttributeNoDataColor: (modelId:
|
|
90
|
+
modelSurfacesVertexAttributeNoDataColor: (modelId: ModelId, surfaceId?: SurfaceId) => RGBAColor;
|
|
108
91
|
setModelSurfacesVertexAttributeNoDataColor: (
|
|
109
|
-
modelId:
|
|
110
|
-
surfaceIds:
|
|
92
|
+
modelId: ModelId,
|
|
93
|
+
surfaceIds: SurfaceId[],
|
|
111
94
|
no_data_color: RGBAColor,
|
|
112
95
|
) => Promise<unknown>;
|
|
113
96
|
}
|
|
@@ -123,9 +106,9 @@ type ModelSurfacesVertexAttributeGetters = Pick<
|
|
|
123
106
|
| "modelSurfacesVertexAttributeTimeStep"
|
|
124
107
|
> & {
|
|
125
108
|
modelSurfacesVertexAttributeLastItem: (
|
|
126
|
-
modelId:
|
|
109
|
+
modelId: ModelId,
|
|
127
110
|
componentId: string | undefined,
|
|
128
|
-
name:
|
|
111
|
+
name: AttributeName | undefined,
|
|
129
112
|
) => number;
|
|
130
113
|
};
|
|
131
114
|
|
|
@@ -134,17 +117,17 @@ function useModelSurfacesVertexAttributeGetters(
|
|
|
134
117
|
modelSurfacesCommonStyle: ReturnType<typeof useModelSurfacesCommonStyle>,
|
|
135
118
|
): ModelSurfacesVertexAttributeGetters {
|
|
136
119
|
const { attributeTimeStep } = useAttributeTimeStepStyle();
|
|
137
|
-
function modelSurfacesVertexAttribute(modelId:
|
|
120
|
+
function modelSurfacesVertexAttribute(modelId: ModelId, surfaceId?: SurfaceId): AttributeState {
|
|
138
121
|
return (
|
|
139
122
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.vertex shape is defined by the data style schema.
|
|
140
123
|
modelSurfacesCommonStyle.modelSurfaceColoring(modelId, surfaceId).vertex as AttributeState
|
|
141
124
|
);
|
|
142
125
|
}
|
|
143
126
|
function modelSurfacesVertexAttributeStoredConfig(
|
|
144
|
-
modelId:
|
|
145
|
-
surfaceId:
|
|
146
|
-
name:
|
|
147
|
-
item:
|
|
127
|
+
modelId: ModelId,
|
|
128
|
+
surfaceId: SurfaceId | undefined,
|
|
129
|
+
name: AttributeName | undefined,
|
|
130
|
+
item: AttributeItem | undefined,
|
|
148
131
|
): AttributeStoredConfig {
|
|
149
132
|
const { storedConfigs } = modelSurfacesVertexAttribute(modelId, surfaceId);
|
|
150
133
|
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
@@ -152,23 +135,18 @@ function useModelSurfacesVertexAttributeGetters(
|
|
|
152
135
|
if (itemConfig !== undefined) {
|
|
153
136
|
return itemConfig;
|
|
154
137
|
}
|
|
155
|
-
return
|
|
156
|
-
minimum: undefined,
|
|
157
|
-
maximum: undefined,
|
|
158
|
-
colorMap: undefined,
|
|
159
|
-
no_data_color: DEFAULT_NO_DATA_COLOR,
|
|
160
|
-
};
|
|
138
|
+
return defaultAttributeStoredConfig();
|
|
161
139
|
}
|
|
162
140
|
function modelSurfacesVertexAttributeName(
|
|
163
|
-
modelId:
|
|
164
|
-
surfaceId?:
|
|
165
|
-
):
|
|
141
|
+
modelId: ModelId,
|
|
142
|
+
surfaceId?: SurfaceId,
|
|
143
|
+
): AttributeName | undefined {
|
|
166
144
|
return modelSurfacesVertexAttribute(modelId, surfaceId).name;
|
|
167
145
|
}
|
|
168
146
|
function modelSurfacesVertexAttributeLastItem(
|
|
169
|
-
modelId:
|
|
170
|
-
surfaceId:
|
|
171
|
-
name:
|
|
147
|
+
modelId: ModelId,
|
|
148
|
+
surfaceId: SurfaceId | undefined,
|
|
149
|
+
name: AttributeName | undefined,
|
|
172
150
|
): number {
|
|
173
151
|
const { storedConfigs } = modelSurfacesVertexAttribute(modelId, surfaceId);
|
|
174
152
|
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
@@ -177,7 +155,10 @@ function useModelSurfacesVertexAttributeGetters(
|
|
|
177
155
|
}
|
|
178
156
|
return 0;
|
|
179
157
|
}
|
|
180
|
-
function modelSurfacesVertexAttributeItem(
|
|
158
|
+
function modelSurfacesVertexAttributeItem(
|
|
159
|
+
modelId: ModelId,
|
|
160
|
+
surfaceId?: SurfaceId,
|
|
161
|
+
): AttributeItem {
|
|
181
162
|
const vertexAttribute = modelSurfacesVertexAttribute(modelId, surfaceId);
|
|
182
163
|
return (
|
|
183
164
|
vertexAttribute.item ??
|
|
@@ -185,9 +166,9 @@ function useModelSurfacesVertexAttributeGetters(
|
|
|
185
166
|
);
|
|
186
167
|
}
|
|
187
168
|
function modelSurfacesVertexAttributeRange(
|
|
188
|
-
modelId:
|
|
189
|
-
surfaceId?:
|
|
190
|
-
):
|
|
169
|
+
modelId: ModelId,
|
|
170
|
+
surfaceId?: SurfaceId,
|
|
171
|
+
): AttributeRange {
|
|
191
172
|
const name = modelSurfacesVertexAttributeName(modelId, surfaceId);
|
|
192
173
|
const item = modelSurfacesVertexAttributeItem(modelId, surfaceId);
|
|
193
174
|
const storedConfig = modelSurfacesVertexAttributeStoredConfig(modelId, surfaceId, name, item);
|
|
@@ -195,24 +176,27 @@ function useModelSurfacesVertexAttributeGetters(
|
|
|
195
176
|
return [minimum, maximum];
|
|
196
177
|
}
|
|
197
178
|
function modelSurfacesVertexAttributeColorMap(
|
|
198
|
-
modelId:
|
|
199
|
-
surfaceId?:
|
|
200
|
-
):
|
|
179
|
+
modelId: ModelId,
|
|
180
|
+
surfaceId?: SurfaceId,
|
|
181
|
+
): AttributeColorMap | undefined {
|
|
201
182
|
const name = modelSurfacesVertexAttributeName(modelId, surfaceId);
|
|
202
183
|
const item = modelSurfacesVertexAttributeItem(modelId, surfaceId);
|
|
203
184
|
const storedConfig = modelSurfacesVertexAttributeStoredConfig(modelId, surfaceId, name, item);
|
|
204
185
|
return storedConfig.colorMap;
|
|
205
186
|
}
|
|
206
|
-
function modelSurfacesVertexAttributeNoDataColor(
|
|
187
|
+
function modelSurfacesVertexAttributeNoDataColor(
|
|
188
|
+
modelId: ModelId,
|
|
189
|
+
surfaceId?: SurfaceId,
|
|
190
|
+
): RGBAColor {
|
|
207
191
|
const name = modelSurfacesVertexAttributeName(modelId, surfaceId);
|
|
208
192
|
const item = modelSurfacesVertexAttributeItem(modelId, surfaceId);
|
|
209
193
|
const storedConfig = modelSurfacesVertexAttributeStoredConfig(modelId, surfaceId, name, item);
|
|
210
194
|
return storedConfig.no_data_color;
|
|
211
195
|
}
|
|
212
196
|
function modelSurfacesVertexAttributeTimeStep(
|
|
213
|
-
modelId:
|
|
214
|
-
surfaceId?:
|
|
215
|
-
):
|
|
197
|
+
modelId: ModelId,
|
|
198
|
+
surfaceId?: SurfaceId,
|
|
199
|
+
): AttributeTimeStep | undefined {
|
|
216
200
|
return attributeTimeStep(
|
|
217
201
|
modelId,
|
|
218
202
|
attributeSchema.$id,
|
|
@@ -248,8 +232,8 @@ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeRetur
|
|
|
248
232
|
} = useModelSurfacesVertexAttributeGetters(modelSurfacesCommonStyle);
|
|
249
233
|
const viewerStore = useViewerStore();
|
|
250
234
|
async function mutateModelSurfacesVertexStyle(
|
|
251
|
-
modelId:
|
|
252
|
-
surfaceIds:
|
|
235
|
+
modelId: ModelId,
|
|
236
|
+
surfaceIds: SurfaceId[],
|
|
253
237
|
values: Record<string, unknown>,
|
|
254
238
|
): Promise<void> {
|
|
255
239
|
const tasks: Promise<void>[] = [
|
|
@@ -268,10 +252,10 @@ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeRetur
|
|
|
268
252
|
await Promise.all(tasks);
|
|
269
253
|
}
|
|
270
254
|
async function setModelSurfacesVertexAttributeStoredConfig(
|
|
271
|
-
modelId:
|
|
272
|
-
surfaceIds:
|
|
273
|
-
name:
|
|
274
|
-
item:
|
|
255
|
+
modelId: ModelId,
|
|
256
|
+
surfaceIds: SurfaceId[],
|
|
257
|
+
name: AttributeName | undefined,
|
|
258
|
+
item: AttributeItem | undefined,
|
|
275
259
|
config: Partial<AttributeStoredConfig>,
|
|
276
260
|
): Promise<void> {
|
|
277
261
|
await mutateModelSurfacesVertexStyle(modelId, surfaceIds, {
|
|
@@ -279,8 +263,8 @@ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeRetur
|
|
|
279
263
|
});
|
|
280
264
|
}
|
|
281
265
|
async function setModelSurfacesVertexAttribute(
|
|
282
|
-
modelId:
|
|
283
|
-
surfaceIds:
|
|
266
|
+
modelId: ModelId,
|
|
267
|
+
surfaceIds: SurfaceId[],
|
|
284
268
|
{
|
|
285
269
|
name,
|
|
286
270
|
item,
|
|
@@ -315,7 +299,7 @@ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeRetur
|
|
|
315
299
|
});
|
|
316
300
|
return result;
|
|
317
301
|
}
|
|
318
|
-
async function applyVertexAttribute(modelId:
|
|
302
|
+
async function applyVertexAttribute(modelId: ModelId, surfaceIds: SurfaceId[]): Promise<unknown> {
|
|
319
303
|
const name = modelSurfacesVertexAttributeName(modelId, surfaceIds[0]);
|
|
320
304
|
const item = modelSurfacesVertexAttributeItem(modelId, surfaceIds[0]);
|
|
321
305
|
const storedConfig = modelSurfacesVertexAttributeStoredConfig(
|
|
@@ -332,16 +316,16 @@ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeRetur
|
|
|
332
316
|
colorMap: storedConfig.colorMap,
|
|
333
317
|
no_data_color: storedConfig.no_data_color,
|
|
334
318
|
};
|
|
335
|
-
if (
|
|
319
|
+
if (isAttributeValid(attribute)) {
|
|
336
320
|
const result = await setModelSurfacesVertexAttribute(modelId, surfaceIds, attribute);
|
|
337
321
|
return result;
|
|
338
322
|
}
|
|
339
323
|
return undefined;
|
|
340
324
|
}
|
|
341
325
|
async function setModelSurfacesVertexAttributeName(
|
|
342
|
-
modelId:
|
|
343
|
-
surfaceIds:
|
|
344
|
-
name:
|
|
326
|
+
modelId: ModelId,
|
|
327
|
+
surfaceIds: SurfaceId[],
|
|
328
|
+
name: AttributeName,
|
|
345
329
|
): Promise<unknown> {
|
|
346
330
|
const item = modelSurfacesVertexAttributeLastItem(modelId, surfaceIds[0], name);
|
|
347
331
|
await mutateModelSurfacesVertexStyle(modelId, surfaceIds, { name, item });
|
|
@@ -349,18 +333,18 @@ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeRetur
|
|
|
349
333
|
return result;
|
|
350
334
|
}
|
|
351
335
|
async function setModelSurfacesVertexAttributeItem(
|
|
352
|
-
modelId:
|
|
353
|
-
surfaceIds:
|
|
354
|
-
item:
|
|
336
|
+
modelId: ModelId,
|
|
337
|
+
surfaceIds: SurfaceId[],
|
|
338
|
+
item: AttributeItem,
|
|
355
339
|
): Promise<unknown> {
|
|
356
340
|
await mutateModelSurfacesVertexStyle(modelId, surfaceIds, { item });
|
|
357
341
|
const result = await applyVertexAttribute(modelId, surfaceIds);
|
|
358
342
|
return result;
|
|
359
343
|
}
|
|
360
344
|
async function setModelSurfacesVertexAttributeTimeStep(
|
|
361
|
-
modelId:
|
|
362
|
-
surfaceIds:
|
|
363
|
-
timeStep:
|
|
345
|
+
modelId: ModelId,
|
|
346
|
+
surfaceIds: SurfaceId[],
|
|
347
|
+
timeStep: AttributeTimeStep,
|
|
364
348
|
): Promise<void> {
|
|
365
349
|
const name = modelSurfacesVertexAttributeName(modelId, surfaceIds[0]);
|
|
366
350
|
if (name === undefined) {
|
|
@@ -393,10 +377,10 @@ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeRetur
|
|
|
393
377
|
]);
|
|
394
378
|
}
|
|
395
379
|
async function setModelSurfacesVertexAttributeRange(
|
|
396
|
-
modelId:
|
|
397
|
-
surfaceIds:
|
|
398
|
-
minimum:
|
|
399
|
-
maximum:
|
|
380
|
+
modelId: ModelId,
|
|
381
|
+
surfaceIds: SurfaceId[],
|
|
382
|
+
minimum: AttributeRangeMinimum,
|
|
383
|
+
maximum: AttributeRangeMaximum,
|
|
400
384
|
): Promise<unknown> {
|
|
401
385
|
const name = modelSurfacesVertexAttributeName(modelId, surfaceIds[0]);
|
|
402
386
|
const item = modelSurfacesVertexAttributeItem(modelId, surfaceIds[0]);
|
|
@@ -408,9 +392,9 @@ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeRetur
|
|
|
408
392
|
return result;
|
|
409
393
|
}
|
|
410
394
|
async function setModelSurfacesVertexAttributeColorMap(
|
|
411
|
-
modelId:
|
|
412
|
-
surfaceIds:
|
|
413
|
-
colorMap:
|
|
395
|
+
modelId: ModelId,
|
|
396
|
+
surfaceIds: SurfaceId[],
|
|
397
|
+
colorMap: AttributeColorMap | undefined,
|
|
414
398
|
): Promise<unknown> {
|
|
415
399
|
const name = modelSurfacesVertexAttributeName(modelId, surfaceIds[0]);
|
|
416
400
|
const item = modelSurfacesVertexAttributeItem(modelId, surfaceIds[0]);
|
|
@@ -421,8 +405,8 @@ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeRetur
|
|
|
421
405
|
return result;
|
|
422
406
|
}
|
|
423
407
|
async function setModelSurfacesVertexAttributeNoDataColor(
|
|
424
|
-
modelId:
|
|
425
|
-
surfaceIds:
|
|
408
|
+
modelId: ModelId,
|
|
409
|
+
surfaceIds: SurfaceId[],
|
|
426
410
|
no_data_color: RGBAColor,
|
|
427
411
|
): Promise<unknown> {
|
|
428
412
|
const name = modelSurfacesVertexAttributeName(modelId, surfaceIds[0]);
|
|
@@ -457,4 +441,4 @@ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeRetur
|
|
|
457
441
|
setModelSurfacesVertexAttributeNoDataColor,
|
|
458
442
|
};
|
|
459
443
|
}
|
|
460
|
-
export {
|
|
444
|
+
export { useModelSurfacesVertexAttribute };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ModelId, SurfaceId } from "@ogw_front/types/identifiers";
|
|
2
|
+
import type { Visibility } from "@ogw_front/types/style";
|
|
1
3
|
import { useModelCommonStyle } from "@ogw_internal/stores/data_style/model/common";
|
|
2
4
|
import { useModelSurfacesCommonStyle } from "./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.surfaces.visibility;
|
|
|
6
8
|
|
|
7
9
|
export function useModelSurfacesVisibility(): {
|
|
8
10
|
setModelSurfacesVisibility: (
|
|
9
|
-
modelId:
|
|
10
|
-
surfaces_ids: readonly
|
|
11
|
-
visibility:
|
|
11
|
+
modelId: ModelId,
|
|
12
|
+
surfaces_ids: readonly SurfaceId[],
|
|
13
|
+
visibility: Visibility,
|
|
12
14
|
) => Promise<unknown>;
|
|
13
|
-
modelSurfaceVisibility: (
|
|
15
|
+
modelSurfaceVisibility: (modelId: ModelId, surface_id?: SurfaceId) => unknown;
|
|
14
16
|
} {
|
|
15
17
|
const modelCommonStyle = useModelCommonStyle();
|
|
16
18
|
const modelSurfacesCommonStyle = useModelSurfacesCommonStyle();
|
|
17
19
|
|
|
18
|
-
function modelSurfaceVisibility(
|
|
19
|
-
return modelSurfacesCommonStyle.modelSurfaceStyle(
|
|
20
|
+
function modelSurfaceVisibility(modelId: ModelId, surface_id?: SurfaceId): unknown {
|
|
21
|
+
return modelSurfacesCommonStyle.modelSurfaceStyle(modelId, surface_id).visibility;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
async function setModelSurfacesVisibility(
|
|
23
|
-
modelId:
|
|
24
|
-
surfaces_ids: readonly
|
|
25
|
-
visibility:
|
|
25
|
+
modelId: ModelId,
|
|
26
|
+
surfaces_ids: readonly SurfaceId[],
|
|
27
|
+
visibility: Visibility,
|
|
26
28
|
): Promise<unknown> {
|
|
27
29
|
const result = await modelCommonStyle.setModelTypeVisibility(
|
|
28
30
|
modelId,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type ComponentStyleFunctions, dispatchToComponentTypes } from "./visibility_dispatch";
|
|
2
2
|
import { MESH_COMPONENT_TYPES } from "@ogw_front/utils/default_styles";
|
|
3
|
+
import type { ModelId } from "@ogw_front/types/identifiers";
|
|
4
|
+
import type { Visibility } from "@ogw_front/types/style";
|
|
3
5
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
4
6
|
import { useDataStyleState } from "@ogw_internal/stores/data_style/state";
|
|
5
7
|
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
@@ -10,20 +12,20 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed
|
|
|
10
12
|
|
|
11
13
|
const model_schemas = viewer_schemas.opengeodeweb_viewer.model;
|
|
12
14
|
interface UseModelVisibilityStyleReturn {
|
|
13
|
-
modelVisibility: (modelId:
|
|
14
|
-
setModelVisibility: (modelId:
|
|
15
|
+
modelVisibility: (modelId: ModelId) => Visibility | undefined;
|
|
16
|
+
setModelVisibility: (modelId: ModelId, visibility: Visibility) => Promise<unknown>;
|
|
15
17
|
setModelComponentsVisibility: (
|
|
16
|
-
modelId:
|
|
18
|
+
modelId: ModelId,
|
|
17
19
|
componentIds: string[],
|
|
18
|
-
visibility:
|
|
20
|
+
visibility: Visibility,
|
|
19
21
|
) => Promise<unknown[]>;
|
|
20
22
|
setModelComponentTypeVisibility: (
|
|
21
|
-
modelId:
|
|
23
|
+
modelId: ModelId,
|
|
22
24
|
componentType: string,
|
|
23
|
-
visibility:
|
|
25
|
+
visibility: Visibility,
|
|
24
26
|
) => Promise<void>;
|
|
25
|
-
modelComponentVisibility: (modelId:
|
|
26
|
-
modelComponentTypeVisibility: (modelId:
|
|
27
|
+
modelComponentVisibility: (modelId: ModelId, componentId: string) => Visibility;
|
|
28
|
+
modelComponentTypeVisibility: (modelId: ModelId, componentType: string) => Visibility;
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
// oxlint-disable-next-line max-lines-per-function
|
|
@@ -35,10 +37,10 @@ function useModelVisibilityStyle(
|
|
|
35
37
|
const hybridViewerStore = useHybridViewerStore();
|
|
36
38
|
const viewerStore = useViewerStore();
|
|
37
39
|
const modelCommonStyle = useModelCommonStyle();
|
|
38
|
-
function modelVisibility(modelId:
|
|
40
|
+
function modelVisibility(modelId: ModelId): Visibility | undefined {
|
|
39
41
|
return dataStyleState.getStyle(modelId).visibility;
|
|
40
42
|
}
|
|
41
|
-
async function setModelVisibility(modelId:
|
|
43
|
+
async function setModelVisibility(modelId: ModelId, visibility: Visibility): Promise<unknown> {
|
|
42
44
|
const schema = model_schemas.visibility;
|
|
43
45
|
const params = {
|
|
44
46
|
id: modelId,
|
|
@@ -65,9 +67,9 @@ function useModelVisibilityStyle(
|
|
|
65
67
|
return result;
|
|
66
68
|
}
|
|
67
69
|
async function setModelComponentTypeVisibility(
|
|
68
|
-
modelId:
|
|
70
|
+
modelId: ModelId,
|
|
69
71
|
componentType: string,
|
|
70
|
-
visibility:
|
|
72
|
+
visibility: Visibility,
|
|
71
73
|
): Promise<void> {
|
|
72
74
|
await modelCommonStyle.mutateModelComponentTypeStyle(modelId, componentType, {
|
|
73
75
|
visibility,
|
|
@@ -87,9 +89,9 @@ function useModelVisibilityStyle(
|
|
|
87
89
|
);
|
|
88
90
|
}
|
|
89
91
|
async function setModelComponentsVisibility(
|
|
90
|
-
modelId:
|
|
92
|
+
modelId: ModelId,
|
|
91
93
|
componentIds: string[],
|
|
92
|
-
visibility:
|
|
94
|
+
visibility: Visibility,
|
|
93
95
|
): Promise<unknown[]> {
|
|
94
96
|
const typeIds = componentIds.filter((id) => MESH_COMPONENT_TYPES.includes(id));
|
|
95
97
|
const individualIds = componentIds.filter((id) => !MESH_COMPONENT_TYPES.includes(id));
|
|
@@ -113,11 +115,11 @@ function useModelVisibilityStyle(
|
|
|
113
115
|
const results = await Promise.all(promises);
|
|
114
116
|
return results;
|
|
115
117
|
}
|
|
116
|
-
function modelComponentVisibility(modelId:
|
|
118
|
+
function modelComponentVisibility(modelId: ModelId, componentId: string): Visibility {
|
|
117
119
|
const selection = useModelSelection(modelId, dataStyleState);
|
|
118
120
|
return selection.value.includes(componentId);
|
|
119
121
|
}
|
|
120
|
-
function modelComponentTypeVisibility(modelId:
|
|
122
|
+
function modelComponentTypeVisibility(modelId: ModelId, componentType: string): Visibility {
|
|
121
123
|
const selection = useModelSelection(modelId, dataStyleState);
|
|
122
124
|
return selection.value.includes(componentType);
|
|
123
125
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { GeodeIdentified, ModelId } from "@ogw_front/types/identifiers";
|
|
1
2
|
import { MESH_COMPONENT_TYPES } from "@ogw_front/utils/default_styles";
|
|
2
3
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
3
4
|
|
|
@@ -5,8 +6,7 @@ import { useDataStore } from "@ogw_front/stores/data";
|
|
|
5
6
|
// oxlint-disable-next-line no-explicit-any
|
|
6
7
|
type ComponentStyleFunctions = Record<"Surface" | "Line" | "Block" | "Corner", any>;
|
|
7
8
|
|
|
8
|
-
interface ModelComponent {
|
|
9
|
-
geode_id: string;
|
|
9
|
+
interface ModelComponent extends GeodeIdentified {
|
|
10
10
|
type: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -22,7 +22,7 @@ async function callComponentStyleFunction(
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
async function getModelComponentsMap(
|
|
25
|
-
modelId:
|
|
25
|
+
modelId: ModelId,
|
|
26
26
|
): Promise<{ allComponents: ModelComponent[]; componentsMap: Record<string, ModelComponent> }> {
|
|
27
27
|
const dataStore = useDataStore();
|
|
28
28
|
const results = await Promise.all(
|
|
@@ -80,7 +80,7 @@ function groupIdsByComponentType(
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
async function dispatchToComponentTypes(
|
|
83
|
-
modelId:
|
|
83
|
+
modelId: ModelId,
|
|
84
84
|
componentIds: string[],
|
|
85
85
|
action: string,
|
|
86
86
|
{ componentStyleFunctions }: { componentStyleFunctions: ComponentStyleFunctions },
|
|
@@ -6,14 +6,15 @@ import type {
|
|
|
6
6
|
StyleValues,
|
|
7
7
|
} from "./types";
|
|
8
8
|
import { type SharedState, getSharedState } from "./state_shared";
|
|
9
|
+
import type { ModelId } from "@ogw_front/types/identifiers";
|
|
9
10
|
import { getDefaultSceneStyle } from "@ogw_front/utils/default_styles";
|
|
10
11
|
import { getTable } from "@ogw_internal/database/database";
|
|
11
12
|
import merge from "lodash/merge";
|
|
12
13
|
|
|
13
14
|
interface DataStyleStateApi extends SharedState {
|
|
14
15
|
getStyle: (objectId: string) => ObjectStyle;
|
|
15
|
-
getComponentStyle: (modelId:
|
|
16
|
-
getModelComponentTypeStyle: (modelId:
|
|
16
|
+
getComponentStyle: (modelId: ModelId, componentId: string) => ModelComponentStyle;
|
|
17
|
+
getModelComponentTypeStyle: (modelId: ModelId, componentType: string) => ModelComponentTypeStyle;
|
|
17
18
|
mutateStyle: (objectId: string, styleValues: StyleValues) => Promise<string>;
|
|
18
19
|
objectVisibility: ComputedRef<(objectId: string) => boolean | undefined>;
|
|
19
20
|
selectedObjects: ComputedRef<string[]>;
|
|
@@ -52,7 +53,7 @@ export function useDataStyleState(): DataStyleStateApi {
|
|
|
52
53
|
function getStyle(objectId: string): ObjectStyle {
|
|
53
54
|
const style = styles.value[objectId];
|
|
54
55
|
if (style === undefined) {
|
|
55
|
-
return {
|
|
56
|
+
return { data_id: objectId };
|
|
56
57
|
}
|
|
57
58
|
return { ...toRaw(style) };
|
|
58
59
|
}
|
|
@@ -62,18 +63,18 @@ export function useDataStyleState(): DataStyleStateApi {
|
|
|
62
63
|
const currentStyle = getStyle(objectId);
|
|
63
64
|
merge(currentStyle, styleValues);
|
|
64
65
|
const savedId = await dataStyleTable.put(
|
|
65
|
-
structuredClone({ ...toRaw(currentStyle),
|
|
66
|
+
structuredClone({ ...toRaw(currentStyle), data_id: objectId }),
|
|
66
67
|
);
|
|
67
68
|
return savedId;
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
function getComponentStyle(modelId:
|
|
71
|
+
function getComponentStyle(modelId: ModelId, componentId: string): ModelComponentStyle {
|
|
71
72
|
const cacheKey = `${modelId}_${componentId}`;
|
|
72
73
|
return merge({ coloring: {} }, componentStyles.value[cacheKey]);
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
function getModelComponentTypeStyle(
|
|
76
|
-
modelId:
|
|
77
|
+
modelId: ModelId,
|
|
77
78
|
componentType: string,
|
|
78
79
|
): ModelComponentTypeStyle {
|
|
79
80
|
const cacheKey = `${modelId}_${componentType}`;
|