@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,28 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isModelSurfacesVertexAttributeValid, useModelSurfacesVertexAttribute } from "./vertex";
|
|
1
|
+
import type { ModelId, SurfaceId } from "@ogw_front/types/identifiers";
|
|
3
2
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
4
3
|
import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
|
|
4
|
+
import { isAttributeValid } from "@ogw_internal/stores/data_style/attribute_valid";
|
|
5
5
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
6
6
|
import { useModelCommonStyle } from "@ogw_internal/stores/data_style/model/common";
|
|
7
7
|
import { useModelSurfacesCommonStyle } from "./common";
|
|
8
|
+
import { useModelSurfacesPolygonAttribute } from "./polygon";
|
|
9
|
+
import { useModelSurfacesVertexAttribute } from "./vertex";
|
|
8
10
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
9
11
|
|
|
10
12
|
const schema = viewer_schemas.opengeodeweb_viewer.model.surfaces.color;
|
|
11
13
|
|
|
12
14
|
export function useModelSurfacesColor(): {
|
|
13
15
|
setModelSurfacesColor: (
|
|
14
|
-
modelId:
|
|
15
|
-
surfaces_ids:
|
|
16
|
+
modelId: ModelId,
|
|
17
|
+
surfaces_ids: SurfaceId[],
|
|
16
18
|
color: RGBAColor | undefined,
|
|
17
19
|
activeColoring?: string,
|
|
18
20
|
collectionId?: string,
|
|
19
21
|
) => Promise<unknown>;
|
|
20
|
-
modelSurfaceColoring: (
|
|
21
|
-
modelSurfaceColor: (
|
|
22
|
-
modelSurfaceActiveColoring: (
|
|
22
|
+
modelSurfaceColoring: (modelId: ModelId, surface_id?: SurfaceId) => StyleValues;
|
|
23
|
+
modelSurfaceColor: (modelId: ModelId, surface_id?: SurfaceId) => RGBAColor | undefined;
|
|
24
|
+
modelSurfaceActiveColoring: (modelId: ModelId, surface_id?: SurfaceId) => unknown;
|
|
23
25
|
setModelSurfacesActiveColoring: (
|
|
24
|
-
modelId:
|
|
25
|
-
surfaces_ids:
|
|
26
|
+
modelId: ModelId,
|
|
27
|
+
surfaces_ids: SurfaceId[],
|
|
26
28
|
activeColoring: string,
|
|
27
29
|
collectionId?: string,
|
|
28
30
|
) => Promise<unknown>;
|
|
@@ -33,19 +35,19 @@ export function useModelSurfacesColor(): {
|
|
|
33
35
|
const modelSurfacesVertexAttribute = useModelSurfacesVertexAttribute();
|
|
34
36
|
const modelSurfacesPolygonAttribute = useModelSurfacesPolygonAttribute();
|
|
35
37
|
|
|
36
|
-
function modelSurfaceColoring(
|
|
38
|
+
function modelSurfaceColoring(modelId: ModelId, surface_id?: SurfaceId): StyleValues {
|
|
37
39
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring shape is defined by the data style schema.
|
|
38
|
-
return modelSurfacesCommonStyle.modelSurfaceStyle(
|
|
40
|
+
return modelSurfacesCommonStyle.modelSurfaceStyle(modelId, surface_id).coloring as StyleValues;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
function modelSurfaceColor(
|
|
43
|
+
function modelSurfaceColor(modelId: ModelId, surface_id?: SurfaceId): RGBAColor | undefined {
|
|
42
44
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.constant shape is defined by the data style schema.
|
|
43
|
-
return modelSurfaceColoring(
|
|
45
|
+
return modelSurfaceColoring(modelId, surface_id).constant as RGBAColor | undefined;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
async function setModelSurfacesColor(
|
|
47
|
-
modelId:
|
|
48
|
-
surfaces_ids:
|
|
49
|
+
modelId: ModelId,
|
|
50
|
+
surfaces_ids: SurfaceId[],
|
|
49
51
|
color: RGBAColor | undefined,
|
|
50
52
|
activeColoring = "constant",
|
|
51
53
|
collectionId?: string,
|
|
@@ -61,11 +63,14 @@ export function useModelSurfacesColor(): {
|
|
|
61
63
|
return result;
|
|
62
64
|
}
|
|
63
65
|
|
|
64
|
-
function modelSurfaceActiveColoring(
|
|
65
|
-
return modelSurfaceColoring(
|
|
66
|
+
function modelSurfaceActiveColoring(modelId: ModelId, surface_id?: SurfaceId): unknown {
|
|
67
|
+
return modelSurfaceColoring(modelId, surface_id).active;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
|
-
async function applyVertexColoring(
|
|
70
|
+
async function applyVertexColoring(
|
|
71
|
+
modelId: ModelId,
|
|
72
|
+
surfaces_ids: SurfaceId[],
|
|
73
|
+
): Promise<unknown> {
|
|
69
74
|
const name = modelSurfacesVertexAttribute.modelSurfacesVertexAttributeName(
|
|
70
75
|
modelId,
|
|
71
76
|
surfaces_ids[0],
|
|
@@ -87,7 +92,7 @@ export function useModelSurfacesColor(): {
|
|
|
87
92
|
surfaces_ids[0],
|
|
88
93
|
);
|
|
89
94
|
const attribute = { name, item, minimum, maximum, colorMap, no_data_color };
|
|
90
|
-
if (
|
|
95
|
+
if (isAttributeValid(attribute)) {
|
|
91
96
|
const result = await modelSurfacesVertexAttribute.setModelSurfacesVertexAttribute(
|
|
92
97
|
modelId,
|
|
93
98
|
surfaces_ids,
|
|
@@ -98,7 +103,10 @@ export function useModelSurfacesColor(): {
|
|
|
98
103
|
return undefined;
|
|
99
104
|
}
|
|
100
105
|
|
|
101
|
-
async function applyPolygonColoring(
|
|
106
|
+
async function applyPolygonColoring(
|
|
107
|
+
modelId: ModelId,
|
|
108
|
+
surfaces_ids: SurfaceId[],
|
|
109
|
+
): Promise<unknown> {
|
|
102
110
|
const name = modelSurfacesPolygonAttribute.modelSurfacesPolygonAttributeName(
|
|
103
111
|
modelId,
|
|
104
112
|
surfaces_ids[0],
|
|
@@ -120,7 +128,7 @@ export function useModelSurfacesColor(): {
|
|
|
120
128
|
surfaces_ids[0],
|
|
121
129
|
);
|
|
122
130
|
const attribute = { name, item, minimum, maximum, colorMap, no_data_color };
|
|
123
|
-
if (
|
|
131
|
+
if (isAttributeValid(attribute)) {
|
|
124
132
|
const result = await modelSurfacesPolygonAttribute.setModelSurfacesPolygonAttribute(
|
|
125
133
|
modelId,
|
|
126
134
|
surfaces_ids,
|
|
@@ -132,8 +140,8 @@ export function useModelSurfacesColor(): {
|
|
|
132
140
|
}
|
|
133
141
|
|
|
134
142
|
async function setModelSurfacesActiveColoring(
|
|
135
|
-
modelId:
|
|
136
|
-
surfaces_ids:
|
|
143
|
+
modelId: ModelId,
|
|
144
|
+
surfaces_ids: SurfaceId[],
|
|
137
145
|
activeColoring: string,
|
|
138
146
|
collectionId?: string,
|
|
139
147
|
): Promise<unknown> {
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
2
|
+
import type { SurfaceId } from "@ogw_front/types/identifiers";
|
|
3
|
+
import type { ValidAttributeInput } from "@ogw_internal/stores/data_style/attribute_types";
|
|
2
4
|
|
|
3
5
|
interface ColorGroup {
|
|
4
6
|
color: RGBAColor | undefined;
|
|
5
|
-
surfaces_ids:
|
|
7
|
+
surfaces_ids: SurfaceId[];
|
|
6
8
|
}
|
|
7
9
|
|
|
8
|
-
interface AttributeGroup {
|
|
9
|
-
|
|
10
|
-
item: number;
|
|
11
|
-
minimum: number;
|
|
12
|
-
maximum: number;
|
|
13
|
-
colorMap: string;
|
|
14
|
-
no_data_color?: RGBAColor;
|
|
15
|
-
surfaces_ids: string[];
|
|
10
|
+
interface AttributeGroup extends ValidAttributeInput {
|
|
11
|
+
surfaces_ids: SurfaceId[];
|
|
16
12
|
}
|
|
17
13
|
|
|
18
14
|
export type { AttributeGroup, ColorGroup };
|
|
@@ -1,60 +1,64 @@
|
|
|
1
|
+
import type { ModelId, SurfaceId } from "@ogw_front/types/identifiers";
|
|
1
2
|
import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
|
|
2
3
|
import merge from "lodash/merge";
|
|
3
4
|
import { useDataStyleState } from "@ogw_internal/stores/data_style/state";
|
|
4
5
|
import { useModelCommonStyle } from "@ogw_internal/stores/data_style/model/common";
|
|
5
6
|
|
|
6
7
|
interface UseModelSurfacesCommonStyleReturn {
|
|
7
|
-
modelSurfacesStyle: (
|
|
8
|
-
modelSurfaceStyle: (
|
|
9
|
-
modelSurfaceColoring: (
|
|
8
|
+
modelSurfacesStyle: (modelId: ModelId) => StyleValues;
|
|
9
|
+
modelSurfaceStyle: (modelId: ModelId, surface_id?: SurfaceId) => StyleValues;
|
|
10
|
+
modelSurfaceColoring: (modelId: ModelId, surface_id?: SurfaceId) => StyleValues;
|
|
10
11
|
mutateModelSurfacesColoring: (
|
|
11
|
-
|
|
12
|
-
surfaces_ids: readonly
|
|
12
|
+
modelId: ModelId,
|
|
13
|
+
surfaces_ids: readonly SurfaceId[],
|
|
13
14
|
values: StyleValues,
|
|
14
15
|
) => Promise<void>;
|
|
15
|
-
mutateModelSurfacesTypeColoring: (
|
|
16
|
+
mutateModelSurfacesTypeColoring: (modelId: ModelId, values: StyleValues) => Promise<void>;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export function useModelSurfacesCommonStyle(): UseModelSurfacesCommonStyleReturn {
|
|
19
20
|
const dataStyleState = useDataStyleState();
|
|
20
21
|
const modelCommonStyle = useModelCommonStyle();
|
|
21
22
|
|
|
22
|
-
function modelSurfacesStyle(
|
|
23
|
-
return dataStyleState.getStyle(
|
|
23
|
+
function modelSurfacesStyle(modelId: ModelId): StyleValues {
|
|
24
|
+
return dataStyleState.getStyle(modelId).surfaces ?? {};
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
function modelComponentTypeSurfacesStyle(
|
|
27
|
-
const defaultStyle = modelSurfacesStyle(
|
|
28
|
-
const typeStyle = dataStyleState.getModelComponentTypeStyle(
|
|
27
|
+
function modelComponentTypeSurfacesStyle(modelId: ModelId): StyleValues {
|
|
28
|
+
const defaultStyle = modelSurfacesStyle(modelId);
|
|
29
|
+
const typeStyle = dataStyleState.getModelComponentTypeStyle(modelId, "Surface");
|
|
29
30
|
return merge({}, defaultStyle, typeStyle);
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
function modelSurfaceStyle(
|
|
33
|
+
function modelSurfaceStyle(modelId: ModelId, surface_id?: SurfaceId): StyleValues {
|
|
33
34
|
if (surface_id === undefined) {
|
|
34
|
-
return modelComponentTypeSurfacesStyle(
|
|
35
|
+
return modelComponentTypeSurfacesStyle(modelId);
|
|
35
36
|
}
|
|
36
|
-
const typeStyle = modelComponentTypeSurfacesStyle(
|
|
37
|
-
const individualStyle = dataStyleState.getComponentStyle(
|
|
37
|
+
const typeStyle = modelComponentTypeSurfacesStyle(modelId);
|
|
38
|
+
const individualStyle = dataStyleState.getComponentStyle(modelId, surface_id);
|
|
38
39
|
return merge({}, typeStyle, individualStyle);
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
function modelSurfaceColoring(
|
|
42
|
+
function modelSurfaceColoring(modelId: ModelId, surface_id?: SurfaceId): StyleValues {
|
|
42
43
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring shape is defined by the data style schema.
|
|
43
|
-
return modelSurfaceStyle(
|
|
44
|
+
return modelSurfaceStyle(modelId, surface_id).coloring as StyleValues;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
async function mutateModelSurfacesColoring(
|
|
47
|
-
|
|
48
|
-
surfaces_ids: readonly
|
|
48
|
+
modelId: ModelId,
|
|
49
|
+
surfaces_ids: readonly SurfaceId[],
|
|
49
50
|
values: StyleValues,
|
|
50
51
|
): Promise<void> {
|
|
51
|
-
await modelCommonStyle.mutateComponentStyles(
|
|
52
|
+
await modelCommonStyle.mutateComponentStyles(modelId, [...surfaces_ids], {
|
|
52
53
|
coloring: values,
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
async function mutateModelSurfacesTypeColoring(
|
|
57
|
-
|
|
57
|
+
async function mutateModelSurfacesTypeColoring(
|
|
58
|
+
modelId: ModelId,
|
|
59
|
+
values: StyleValues,
|
|
60
|
+
): Promise<void> {
|
|
61
|
+
await modelCommonStyle.mutateModelComponentTypeStyle(modelId, "Surface", {
|
|
58
62
|
coloring: values,
|
|
59
63
|
});
|
|
60
64
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ModelId, SurfaceId } from "@ogw_front/types/identifiers";
|
|
1
2
|
import {
|
|
2
3
|
applyModelSurfacesConstantColoring,
|
|
3
4
|
applyModelSurfacesPolygonColoring,
|
|
@@ -23,8 +24,8 @@ type UseModelSurfacesStyleReturn = ReturnType<typeof useModelSurfacesCommonStyle
|
|
|
23
24
|
ReturnType<typeof useModelSurfacesEdgesStyle> &
|
|
24
25
|
ReturnType<typeof useModelSurfacesVertexAttribute> &
|
|
25
26
|
ReturnType<typeof useModelSurfacesPolygonAttribute> & {
|
|
26
|
-
applyModelSurfacesStyle: (modelId:
|
|
27
|
-
setModelSurfacesDefaultStyle: (
|
|
27
|
+
applyModelSurfacesStyle: (modelId: ModelId) => Promise<void>;
|
|
28
|
+
setModelSurfacesDefaultStyle: (modelId: ModelId) => Promise<void>;
|
|
28
29
|
};
|
|
29
30
|
|
|
30
31
|
// oxlint-disable-next-line max-lines-per-function
|
|
@@ -39,8 +40,8 @@ export function useModelSurfacesStyle(): UseModelSurfacesStyleReturn {
|
|
|
39
40
|
const modelSurfacesEdgesStyle = useModelSurfacesEdgesStyle();
|
|
40
41
|
|
|
41
42
|
async function applyModelSurfacesVisibilityStyle(
|
|
42
|
-
modelId:
|
|
43
|
-
surfaces_ids:
|
|
43
|
+
modelId: ModelId,
|
|
44
|
+
surfaces_ids: SurfaceId[],
|
|
44
45
|
): Promise<void> {
|
|
45
46
|
const visibilityGroups: Record<string, string[]> = {};
|
|
46
47
|
for (const surfaces_id of surfaces_ids) {
|
|
@@ -62,8 +63,8 @@ export function useModelSurfacesStyle(): UseModelSurfacesStyleReturn {
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
async function applyModelSurfacesColoringStyle(
|
|
65
|
-
modelId:
|
|
66
|
-
surfaces_ids:
|
|
66
|
+
modelId: ModelId,
|
|
67
|
+
surfaces_ids: SurfaceId[],
|
|
67
68
|
): Promise<unknown[]> {
|
|
68
69
|
const activeColoringGroups: Record<string, string[]> = {};
|
|
69
70
|
for (const surfaces_id of surfaces_ids) {
|
|
@@ -107,7 +108,7 @@ export function useModelSurfacesStyle(): UseModelSurfacesStyleReturn {
|
|
|
107
108
|
return results;
|
|
108
109
|
}
|
|
109
110
|
|
|
110
|
-
async function applyModelSurfacesStyle(modelId:
|
|
111
|
+
async function applyModelSurfacesStyle(modelId: ModelId): Promise<void> {
|
|
111
112
|
const surfaces_ids = await dataStore.getSurfacesGeodeIds(modelId);
|
|
112
113
|
if (surfaces_ids.length === 0) {
|
|
113
114
|
return;
|