@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,31 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isModelBlocksPolyhedronAttributeValid,
|
|
3
|
-
useModelBlocksPolyhedronAttribute,
|
|
4
|
-
} from "./polyhedron";
|
|
5
|
-
import { isModelBlocksVertexAttributeValid, useModelBlocksVertexAttribute } from "./vertex";
|
|
1
|
+
import type { BlockId, ModelId } from "@ogw_front/types/identifiers";
|
|
6
2
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
7
3
|
import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
|
|
4
|
+
import { isAttributeValid } from "@ogw_internal/stores/data_style/attribute_valid";
|
|
8
5
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
9
6
|
import { useModelBlocksCommonStyle } from "./common";
|
|
7
|
+
import { useModelBlocksPolyhedronAttribute } from "./polyhedron";
|
|
8
|
+
import { useModelBlocksVertexAttribute } from "./vertex";
|
|
10
9
|
import { useModelCommonStyle } from "@ogw_internal/stores/data_style/model/common";
|
|
11
10
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
12
11
|
|
|
13
12
|
const schema = viewer_schemas.opengeodeweb_viewer.model.blocks.color;
|
|
14
13
|
|
|
15
14
|
export function useModelBlocksColor(): {
|
|
16
|
-
modelBlockColoring: (
|
|
17
|
-
modelBlockColor: (
|
|
15
|
+
modelBlockColoring: (modelId: ModelId, block_id?: BlockId) => StyleValues;
|
|
16
|
+
modelBlockColor: (modelId: ModelId, block_id?: BlockId) => RGBAColor | undefined;
|
|
18
17
|
setModelBlocksColor: (
|
|
19
|
-
modelId:
|
|
20
|
-
blocks_ids:
|
|
18
|
+
modelId: ModelId,
|
|
19
|
+
blocks_ids: BlockId[],
|
|
21
20
|
color: RGBAColor | undefined,
|
|
22
21
|
activeColoring?: string,
|
|
23
22
|
collectionId?: string,
|
|
24
23
|
) => Promise<unknown>;
|
|
25
|
-
modelBlockActiveColoring: (
|
|
24
|
+
modelBlockActiveColoring: (modelId: ModelId, block_id?: BlockId) => unknown;
|
|
26
25
|
setModelBlocksActiveColoring: (
|
|
27
|
-
modelId:
|
|
28
|
-
blocks_ids:
|
|
26
|
+
modelId: ModelId,
|
|
27
|
+
blocks_ids: BlockId[],
|
|
29
28
|
activeColoring: string,
|
|
30
29
|
collectionId?: string,
|
|
31
30
|
) => Promise<void>;
|
|
@@ -36,19 +35,19 @@ export function useModelBlocksColor(): {
|
|
|
36
35
|
const modelBlocksVertexAttribute = useModelBlocksVertexAttribute();
|
|
37
36
|
const modelBlocksPolyhedronAttribute = useModelBlocksPolyhedronAttribute();
|
|
38
37
|
|
|
39
|
-
function modelBlockColoring(
|
|
38
|
+
function modelBlockColoring(modelId: ModelId, block_id?: BlockId): StyleValues {
|
|
40
39
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring shape is defined by the data style schema.
|
|
41
|
-
return modelBlocksCommonStyle.modelBlockStyle(
|
|
40
|
+
return modelBlocksCommonStyle.modelBlockStyle(modelId, block_id).coloring as StyleValues;
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
function modelBlockColor(
|
|
43
|
+
function modelBlockColor(modelId: ModelId, block_id?: BlockId): RGBAColor | undefined {
|
|
45
44
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.constant shape is defined by the data style schema.
|
|
46
|
-
return modelBlockColoring(
|
|
45
|
+
return modelBlockColoring(modelId, block_id).constant as RGBAColor | undefined;
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
async function setModelBlocksColor(
|
|
50
|
-
modelId:
|
|
51
|
-
blocks_ids:
|
|
49
|
+
modelId: ModelId,
|
|
50
|
+
blocks_ids: BlockId[],
|
|
52
51
|
color: RGBAColor | undefined,
|
|
53
52
|
activeColoring = "constant",
|
|
54
53
|
collectionId?: string,
|
|
@@ -64,11 +63,11 @@ export function useModelBlocksColor(): {
|
|
|
64
63
|
return result;
|
|
65
64
|
}
|
|
66
65
|
|
|
67
|
-
function modelBlockActiveColoring(
|
|
68
|
-
return modelBlockColoring(
|
|
66
|
+
function modelBlockActiveColoring(modelId: ModelId, block_id?: BlockId): unknown {
|
|
67
|
+
return modelBlockColoring(modelId, block_id).active;
|
|
69
68
|
}
|
|
70
69
|
|
|
71
|
-
async function applyVertexColoring(modelId:
|
|
70
|
+
async function applyVertexColoring(modelId: ModelId, blocks_ids: BlockId[]): Promise<void> {
|
|
72
71
|
const name = modelBlocksVertexAttribute.modelBlocksVertexAttributeName(modelId, blocks_ids[0]);
|
|
73
72
|
const item = modelBlocksVertexAttribute.modelBlocksVertexAttributeItem(modelId, blocks_ids[0]);
|
|
74
73
|
const [minimum, maximum] = modelBlocksVertexAttribute.modelBlocksVertexAttributeRange(
|
|
@@ -84,7 +83,7 @@ export function useModelBlocksColor(): {
|
|
|
84
83
|
blocks_ids[0],
|
|
85
84
|
);
|
|
86
85
|
const attribute = { name, item, minimum, maximum, colorMap, no_data_color };
|
|
87
|
-
if (
|
|
86
|
+
if (isAttributeValid(attribute)) {
|
|
88
87
|
await modelBlocksVertexAttribute.setModelBlocksVertexAttribute(
|
|
89
88
|
modelId,
|
|
90
89
|
blocks_ids,
|
|
@@ -93,7 +92,7 @@ export function useModelBlocksColor(): {
|
|
|
93
92
|
}
|
|
94
93
|
}
|
|
95
94
|
|
|
96
|
-
async function applyPolyhedronColoring(modelId:
|
|
95
|
+
async function applyPolyhedronColoring(modelId: ModelId, blocks_ids: BlockId[]): Promise<void> {
|
|
97
96
|
const name = modelBlocksPolyhedronAttribute.modelBlocksPolyhedronAttributeName(
|
|
98
97
|
modelId,
|
|
99
98
|
blocks_ids[0],
|
|
@@ -115,7 +114,7 @@ export function useModelBlocksColor(): {
|
|
|
115
114
|
blocks_ids[0],
|
|
116
115
|
);
|
|
117
116
|
const attribute = { name, item, minimum, maximum, colorMap, no_data_color };
|
|
118
|
-
if (
|
|
117
|
+
if (isAttributeValid(attribute)) {
|
|
119
118
|
await modelBlocksPolyhedronAttribute.setModelBlocksPolyhedronAttribute(
|
|
120
119
|
modelId,
|
|
121
120
|
blocks_ids,
|
|
@@ -125,8 +124,8 @@ export function useModelBlocksColor(): {
|
|
|
125
124
|
}
|
|
126
125
|
|
|
127
126
|
async function setModelBlocksActiveColoring(
|
|
128
|
-
modelId:
|
|
129
|
-
blocks_ids:
|
|
127
|
+
modelId: ModelId,
|
|
128
|
+
blocks_ids: BlockId[],
|
|
130
129
|
activeColoring: string,
|
|
131
130
|
collectionId?: string,
|
|
132
131
|
): Promise<void> {
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
+
import type { BlockId } from "@ogw_front/types/identifiers";
|
|
1
2
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
3
|
+
import type { ValidAttributeInput } from "@ogw_internal/stores/data_style/attribute_types";
|
|
2
4
|
|
|
3
5
|
interface ColorGroup {
|
|
4
6
|
color: RGBAColor | undefined;
|
|
5
|
-
blocks_ids:
|
|
7
|
+
blocks_ids: BlockId[];
|
|
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
|
-
blocks_ids: string[];
|
|
10
|
+
interface AttributeGroup extends ValidAttributeInput {
|
|
11
|
+
blocks_ids: BlockId[];
|
|
16
12
|
}
|
|
17
13
|
|
|
18
14
|
export type { AttributeGroup, ColorGroup };
|
|
@@ -1,58 +1,62 @@
|
|
|
1
|
+
import type { BlockId, ModelId } 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
|
export function useModelBlocksCommonStyle(): {
|
|
7
|
-
modelBlocksStyle: (
|
|
8
|
-
modelBlockStyle: (
|
|
9
|
-
modelBlockColoring: (
|
|
8
|
+
modelBlocksStyle: (modelId: ModelId) => StyleValues;
|
|
9
|
+
modelBlockStyle: (modelId: ModelId, block_id?: BlockId) => StyleValues;
|
|
10
|
+
modelBlockColoring: (modelId: ModelId, block_id?: BlockId) => StyleValues;
|
|
10
11
|
mutateModelBlocksColoring: (
|
|
11
|
-
|
|
12
|
-
blocks_ids:
|
|
12
|
+
modelId: ModelId,
|
|
13
|
+
blocks_ids: BlockId[],
|
|
13
14
|
values: StyleValues,
|
|
14
15
|
) => Promise<void>;
|
|
15
|
-
mutateModelBlocksTypeColoring: (
|
|
16
|
+
mutateModelBlocksTypeColoring: (modelId: ModelId, values: StyleValues) => Promise<void>;
|
|
16
17
|
} {
|
|
17
18
|
const dataStyleState = useDataStyleState();
|
|
18
19
|
const modelCommonStyle = useModelCommonStyle();
|
|
19
20
|
|
|
20
|
-
function modelBlocksStyle(
|
|
21
|
-
return dataStyleState.getStyle(
|
|
21
|
+
function modelBlocksStyle(modelId: ModelId): StyleValues {
|
|
22
|
+
return dataStyleState.getStyle(modelId).blocks ?? {};
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
function modelComponentTypeBlocksStyle(
|
|
25
|
-
const defaultStyle = modelBlocksStyle(
|
|
26
|
-
const typeStyle = dataStyleState.getModelComponentTypeStyle(
|
|
25
|
+
function modelComponentTypeBlocksStyle(modelId: ModelId): StyleValues {
|
|
26
|
+
const defaultStyle = modelBlocksStyle(modelId);
|
|
27
|
+
const typeStyle = dataStyleState.getModelComponentTypeStyle(modelId, "Block");
|
|
27
28
|
return merge({}, defaultStyle, typeStyle);
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
function modelBlockStyle(
|
|
31
|
+
function modelBlockStyle(modelId: ModelId, block_id?: BlockId): StyleValues {
|
|
31
32
|
if (block_id === undefined) {
|
|
32
|
-
return modelComponentTypeBlocksStyle(
|
|
33
|
+
return modelComponentTypeBlocksStyle(modelId);
|
|
33
34
|
}
|
|
34
|
-
const typeStyle = modelComponentTypeBlocksStyle(
|
|
35
|
-
const individualStyle = dataStyleState.getComponentStyle(
|
|
35
|
+
const typeStyle = modelComponentTypeBlocksStyle(modelId);
|
|
36
|
+
const individualStyle = dataStyleState.getComponentStyle(modelId, block_id);
|
|
36
37
|
return merge({}, typeStyle, individualStyle);
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
function modelBlockColoring(
|
|
40
|
+
function modelBlockColoring(modelId: ModelId, block_id?: BlockId): StyleValues {
|
|
40
41
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring shape is defined by the data style schema.
|
|
41
|
-
return modelBlockStyle(
|
|
42
|
+
return modelBlockStyle(modelId, block_id).coloring as StyleValues;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
async function mutateModelBlocksColoring(
|
|
45
|
-
|
|
46
|
-
blocks_ids:
|
|
46
|
+
modelId: ModelId,
|
|
47
|
+
blocks_ids: BlockId[],
|
|
47
48
|
values: StyleValues,
|
|
48
49
|
): Promise<void> {
|
|
49
|
-
await modelCommonStyle.mutateComponentStyles(
|
|
50
|
+
await modelCommonStyle.mutateComponentStyles(modelId, blocks_ids, {
|
|
50
51
|
coloring: values,
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
async function mutateModelBlocksTypeColoring(
|
|
55
|
-
|
|
55
|
+
async function mutateModelBlocksTypeColoring(
|
|
56
|
+
modelId: ModelId,
|
|
57
|
+
values: StyleValues,
|
|
58
|
+
): Promise<void> {
|
|
59
|
+
await modelCommonStyle.mutateModelComponentTypeStyle(modelId, "Block", {
|
|
56
60
|
coloring: values,
|
|
57
61
|
});
|
|
58
62
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BlockId, ModelId } from "@ogw_front/types/identifiers";
|
|
1
2
|
import {
|
|
2
3
|
applyModelBlocksConstantColoring,
|
|
3
4
|
applyModelBlocksPolyhedronColoring,
|
|
@@ -17,8 +18,8 @@ async function setModelBlocksDefaultStyle(_id: string): Promise<void> {
|
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
type UseModelBlocksStyleReturn = {
|
|
20
|
-
applyModelBlocksStyle: (modelId:
|
|
21
|
-
setModelBlocksDefaultStyle: (
|
|
21
|
+
applyModelBlocksStyle: (modelId: ModelId) => Promise<void>;
|
|
22
|
+
setModelBlocksDefaultStyle: (modelId: ModelId) => Promise<void>;
|
|
22
23
|
} & ReturnType<typeof useModelBlocksCommonStyle> &
|
|
23
24
|
ReturnType<typeof useModelBlocksVisibility> &
|
|
24
25
|
ReturnType<typeof useModelBlocksColor> &
|
|
@@ -39,8 +40,8 @@ export function useModelBlocksStyle(): UseModelBlocksStyleReturn {
|
|
|
39
40
|
const modelBlocksEdgesStyle = useModelBlocksEdgesStyle();
|
|
40
41
|
|
|
41
42
|
async function applyModelBlocksVisibilityStyle(
|
|
42
|
-
modelId:
|
|
43
|
-
blocks_ids:
|
|
43
|
+
modelId: ModelId,
|
|
44
|
+
blocks_ids: BlockId[],
|
|
44
45
|
): Promise<unknown[]> {
|
|
45
46
|
const visibilityGroups: Record<string, string[]> = {};
|
|
46
47
|
for (const block_id of blocks_ids) {
|
|
@@ -63,8 +64,8 @@ export function useModelBlocksStyle(): UseModelBlocksStyleReturn {
|
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
async function applyModelBlocksColoringStyle(
|
|
66
|
-
modelId:
|
|
67
|
-
blocks_ids:
|
|
67
|
+
modelId: ModelId,
|
|
68
|
+
blocks_ids: BlockId[],
|
|
68
69
|
): Promise<unknown[]> {
|
|
69
70
|
const activeColoringGroups: Record<string, string[]> = {};
|
|
70
71
|
for (const block_id of blocks_ids) {
|
|
@@ -103,7 +104,7 @@ export function useModelBlocksStyle(): UseModelBlocksStyleReturn {
|
|
|
103
104
|
return result;
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
async function applyModelBlocksStyle(modelId:
|
|
107
|
+
async function applyModelBlocksStyle(modelId: ModelId): Promise<void> {
|
|
107
108
|
const blocks_ids = await dataStore.getBlocksGeodeIds(modelId);
|
|
108
109
|
if (blocks_ids.length === 0) {
|
|
109
110
|
return;
|