@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
|
@@ -4,9 +4,11 @@ import {
|
|
|
4
4
|
useModelComponentsPerComponentStyleMutation,
|
|
5
5
|
useModelComponentsStyleMutation,
|
|
6
6
|
} from "./common_mutations";
|
|
7
|
+
import type { ModelId } from "@ogw_front/types/identifiers";
|
|
7
8
|
import type { ParamsOf } from "@ogw_shared/utils/types.js";
|
|
8
9
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
9
10
|
import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
|
|
11
|
+
import type { Visibility } from "@ogw_front/types/style";
|
|
10
12
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
11
13
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
12
14
|
import type viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
@@ -45,7 +47,7 @@ interface UseModelCommonStyleReturn {
|
|
|
45
47
|
component_updates: ComponentStyleUpdate[],
|
|
46
48
|
) => Promise<void>;
|
|
47
49
|
setModelTypeColor: (
|
|
48
|
-
|
|
50
|
+
modelId: ModelId,
|
|
49
51
|
component_ids: string[],
|
|
50
52
|
color: RGBAColor | undefined,
|
|
51
53
|
schema: ModelColorSchema,
|
|
@@ -53,9 +55,9 @@ interface UseModelCommonStyleReturn {
|
|
|
53
55
|
collectionId?: string,
|
|
54
56
|
) => Promise<unknown>;
|
|
55
57
|
setModelTypeVisibility: (
|
|
56
|
-
|
|
58
|
+
modelId: ModelId,
|
|
57
59
|
component_ids: string[],
|
|
58
|
-
visibility:
|
|
60
|
+
visibility: Visibility,
|
|
59
61
|
schema: ModelVisibilitySchema,
|
|
60
62
|
) => Promise<unknown>;
|
|
61
63
|
}
|
|
@@ -68,7 +70,7 @@ export function useModelCommonStyle(): UseModelCommonStyleReturn {
|
|
|
68
70
|
const { mutateComponentStyles } = useModelComponentsStyleMutation();
|
|
69
71
|
const { bulkMutateComponentStylesPerComponent } = useModelComponentsPerComponentStyleMutation();
|
|
70
72
|
async function setModelTypeColor(
|
|
71
|
-
|
|
73
|
+
modelId: ModelId,
|
|
72
74
|
component_ids: string[],
|
|
73
75
|
color: RGBAColor | undefined,
|
|
74
76
|
schema: ModelColorSchema,
|
|
@@ -79,13 +81,13 @@ export function useModelCommonStyle(): UseModelCommonStyleReturn {
|
|
|
79
81
|
return undefined;
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
const viewer_ids = await dataStore.getMeshComponentsViewerIds(
|
|
84
|
+
const viewer_ids = await dataStore.getMeshComponentsViewerIds(modelId, component_ids);
|
|
83
85
|
if (!viewer_ids?.length) {
|
|
84
86
|
return undefined;
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
if (activeColoring === "constant") {
|
|
88
|
-
await mutateComponentStyles(
|
|
90
|
+
await mutateComponentStyles(modelId, component_ids, {
|
|
89
91
|
coloring: {
|
|
90
92
|
constant: color,
|
|
91
93
|
},
|
|
@@ -95,7 +97,7 @@ export function useModelCommonStyle(): UseModelCommonStyleReturn {
|
|
|
95
97
|
throw new Error(`Unknown model color mode: ${activeColoring}`);
|
|
96
98
|
}
|
|
97
99
|
const params = {
|
|
98
|
-
id,
|
|
100
|
+
id: modelId,
|
|
99
101
|
block_ids: viewer_ids,
|
|
100
102
|
color_mode: activeColoring,
|
|
101
103
|
collection_id: collectionId,
|
|
@@ -107,7 +109,7 @@ export function useModelCommonStyle(): UseModelCommonStyleReturn {
|
|
|
107
109
|
{
|
|
108
110
|
response_function: async ({ colors }) => {
|
|
109
111
|
if (activeColoring === "constant") {
|
|
110
|
-
await mutateComponentStyles(
|
|
112
|
+
await mutateComponentStyles(modelId, component_ids, {
|
|
111
113
|
coloring: {
|
|
112
114
|
constant: color,
|
|
113
115
|
},
|
|
@@ -120,7 +122,7 @@ export function useModelCommonStyle(): UseModelCommonStyleReturn {
|
|
|
120
122
|
}
|
|
121
123
|
|
|
122
124
|
await bulkMutateComponentStylesPerComponent(
|
|
123
|
-
|
|
125
|
+
modelId,
|
|
124
126
|
colors.map(({ geode_id, color: color_value }) => ({
|
|
125
127
|
id_component: geode_id,
|
|
126
128
|
values: {
|
|
@@ -136,25 +138,25 @@ export function useModelCommonStyle(): UseModelCommonStyleReturn {
|
|
|
136
138
|
}
|
|
137
139
|
|
|
138
140
|
async function setModelTypeVisibility(
|
|
139
|
-
|
|
141
|
+
modelId: ModelId,
|
|
140
142
|
component_ids: string[],
|
|
141
|
-
visibility:
|
|
143
|
+
visibility: Visibility,
|
|
142
144
|
schema: ModelVisibilitySchema,
|
|
143
145
|
): Promise<unknown> {
|
|
144
146
|
if (!component_ids?.length) {
|
|
145
147
|
return undefined;
|
|
146
148
|
}
|
|
147
149
|
|
|
148
|
-
const viewer_ids = await dataStore.getMeshComponentsViewerIds(
|
|
150
|
+
const viewer_ids = await dataStore.getMeshComponentsViewerIds(modelId, component_ids);
|
|
149
151
|
if (!viewer_ids?.length) {
|
|
150
152
|
return undefined;
|
|
151
153
|
}
|
|
152
|
-
const params = { id, block_ids: viewer_ids, visibility };
|
|
154
|
+
const params = { id: modelId, block_ids: viewer_ids, visibility };
|
|
153
155
|
const result = await viewerStore.request(
|
|
154
156
|
{ schema, params },
|
|
155
157
|
{
|
|
156
158
|
response_function: async () => {
|
|
157
|
-
await mutateComponentStyles(
|
|
159
|
+
await mutateComponentStyles(modelId, component_ids, { visibility });
|
|
158
160
|
},
|
|
159
161
|
},
|
|
160
162
|
);
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
2
|
-
|
|
3
1
|
function groupBy(componentIds: string[], key: (componentId: string) => string): string[][] {
|
|
4
2
|
const groups: Record<string, string[]> = {};
|
|
5
3
|
for (const componentId of componentIds) {
|
|
@@ -10,18 +8,4 @@ function groupBy(componentIds: string[], key: (componentId: string) => string):
|
|
|
10
8
|
return Object.values(groups);
|
|
11
9
|
}
|
|
12
10
|
|
|
13
|
-
interface AttributeStoredConfig {
|
|
14
|
-
minimum: number | undefined;
|
|
15
|
-
maximum: number | undefined;
|
|
16
|
-
colorMap: string | undefined;
|
|
17
|
-
no_data_color: RGBAColor;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface AttributeState {
|
|
21
|
-
name?: string;
|
|
22
|
-
item?: number;
|
|
23
|
-
storedConfigs?: Record<string, { lastItem: number } & Record<string, AttributeStoredConfig>>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
11
|
export { groupBy };
|
|
27
|
-
export type { AttributeState, AttributeStoredConfig };
|
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CornerId, ModelId } from "@ogw_front/types/identifiers";
|
|
2
2
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
3
3
|
import type { StyleValues } from "@ogw_internal/stores/data_style/types.js";
|
|
4
|
+
import { isAttributeValid } from "@ogw_internal/stores/data_style/attribute_valid";
|
|
4
5
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
5
6
|
import { useModelCommonStyle } from "@ogw_internal/stores/data_style/model/common";
|
|
6
7
|
import { useModelCornersCommonStyle } from "./common";
|
|
8
|
+
import { useModelCornersVertexAttribute } from "./vertex";
|
|
7
9
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
8
10
|
|
|
9
11
|
const schema = viewer_schemas.opengeodeweb_viewer.model.corners.color;
|
|
10
12
|
|
|
11
13
|
interface ModelCornersColorApi {
|
|
12
14
|
setModelCornersColor: (
|
|
13
|
-
modelId:
|
|
14
|
-
corners_ids:
|
|
15
|
+
modelId: ModelId,
|
|
16
|
+
corners_ids: CornerId[],
|
|
15
17
|
color: RGBAColor | undefined,
|
|
16
18
|
activeColoring?: string,
|
|
17
19
|
collectionId?: string,
|
|
18
20
|
) => Promise<unknown>;
|
|
19
|
-
modelCornerColoring: (
|
|
20
|
-
modelCornerColor: (
|
|
21
|
-
modelCornerActiveColoring: (
|
|
21
|
+
modelCornerColoring: (modelId: ModelId, corner_id?: CornerId) => StyleValues;
|
|
22
|
+
modelCornerColor: (modelId: ModelId, corner_id?: CornerId) => RGBAColor | undefined;
|
|
23
|
+
modelCornerActiveColoring: (modelId: ModelId, corner_id?: CornerId) => unknown;
|
|
22
24
|
setModelCornersActiveColoring: (
|
|
23
|
-
modelId:
|
|
24
|
-
corners_ids:
|
|
25
|
+
modelId: ModelId,
|
|
26
|
+
corners_ids: CornerId[],
|
|
25
27
|
activeColoring: string,
|
|
26
28
|
collectionId?: string,
|
|
27
29
|
) => Promise<unknown>;
|
|
@@ -33,19 +35,19 @@ export function useModelCornersColor(): ModelCornersColorApi {
|
|
|
33
35
|
const modelCornersCommonStyle = useModelCornersCommonStyle();
|
|
34
36
|
const modelCornersVertexAttribute = useModelCornersVertexAttribute();
|
|
35
37
|
|
|
36
|
-
function modelCornerColoring(
|
|
38
|
+
function modelCornerColoring(modelId: ModelId, corner_id?: CornerId): StyleValues {
|
|
37
39
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring is a StyleValues sub-object stored under a StyleValues index signature.
|
|
38
|
-
return modelCornersCommonStyle.modelCornerStyle(
|
|
40
|
+
return modelCornersCommonStyle.modelCornerStyle(modelId, corner_id).coloring as StyleValues;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
function modelCornerColor(
|
|
43
|
+
function modelCornerColor(modelId: ModelId, corner_id?: CornerId): RGBAColor | undefined {
|
|
42
44
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.constant shape is defined by the data style schema.
|
|
43
|
-
return modelCornerColoring(
|
|
45
|
+
return modelCornerColoring(modelId, corner_id).constant as RGBAColor | undefined;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
async function setModelCornersColor(
|
|
47
|
-
modelId:
|
|
48
|
-
corners_ids:
|
|
49
|
+
modelId: ModelId,
|
|
50
|
+
corners_ids: CornerId[],
|
|
49
51
|
color: RGBAColor | undefined,
|
|
50
52
|
activeColoring = "constant",
|
|
51
53
|
collectionId?: string,
|
|
@@ -61,13 +63,13 @@ export function useModelCornersColor(): ModelCornersColorApi {
|
|
|
61
63
|
return result;
|
|
62
64
|
}
|
|
63
65
|
|
|
64
|
-
function modelCornerActiveColoring(
|
|
65
|
-
return modelCornerColoring(
|
|
66
|
+
function modelCornerActiveColoring(modelId: ModelId, corner_id?: CornerId): unknown {
|
|
67
|
+
return modelCornerColoring(modelId, corner_id).active;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
async function setModelCornersActiveColoring(
|
|
69
|
-
modelId:
|
|
70
|
-
corners_ids:
|
|
71
|
+
modelId: ModelId,
|
|
72
|
+
corners_ids: CornerId[],
|
|
71
73
|
activeColoring: string,
|
|
72
74
|
collectionId?: string,
|
|
73
75
|
): Promise<unknown> {
|
|
@@ -107,7 +109,7 @@ export function useModelCornersColor(): ModelCornersColorApi {
|
|
|
107
109
|
corners_ids[0],
|
|
108
110
|
);
|
|
109
111
|
const attribute = { name, item, minimum, maximum, colorMap, no_data_color };
|
|
110
|
-
if (
|
|
112
|
+
if (isAttributeValid(attribute)) {
|
|
111
113
|
return modelCornersVertexAttribute.setModelCornersVertexAttribute(
|
|
112
114
|
modelId,
|
|
113
115
|
corners_ids,
|
|
@@ -1,62 +1,66 @@
|
|
|
1
|
+
import type { CornerId, 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 useModelCornersCommonStyle(): {
|
|
7
|
-
modelCornersStyle: (
|
|
8
|
-
modelCornerStyle: (
|
|
9
|
-
modelCornerColoring: (
|
|
8
|
+
modelCornersStyle: (modelId: ModelId) => StyleValues;
|
|
9
|
+
modelCornerStyle: (modelId: ModelId, corner_id?: CornerId) => StyleValues;
|
|
10
|
+
modelCornerColoring: (modelId: ModelId, corner_id?: CornerId) => StyleValues;
|
|
10
11
|
mutateModelCornersColoring: (
|
|
11
|
-
|
|
12
|
-
corners_ids:
|
|
12
|
+
modelId: ModelId,
|
|
13
|
+
corners_ids: CornerId[],
|
|
13
14
|
values: StyleValues,
|
|
14
15
|
) => Promise<void>;
|
|
15
|
-
mutateModelCornersTypeColoring: (
|
|
16
|
+
mutateModelCornersTypeColoring: (modelId: ModelId, values: StyleValues) => Promise<void>;
|
|
16
17
|
} {
|
|
17
18
|
const dataStyleState = useDataStyleState();
|
|
18
19
|
const modelCommonStyle = useModelCommonStyle();
|
|
19
20
|
|
|
20
|
-
function modelCornersStyle(
|
|
21
|
-
const { corners } = dataStyleState.getStyle(
|
|
21
|
+
function modelCornersStyle(modelId: ModelId): StyleValues {
|
|
22
|
+
const { corners } = dataStyleState.getStyle(modelId);
|
|
22
23
|
if (corners === undefined) {
|
|
23
24
|
return {};
|
|
24
25
|
}
|
|
25
26
|
return corners;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
function modelComponentTypeCornersStyle(
|
|
29
|
-
const defaultStyle = modelCornersStyle(
|
|
30
|
-
const typeStyle = dataStyleState.getModelComponentTypeStyle(
|
|
29
|
+
function modelComponentTypeCornersStyle(modelId: ModelId): StyleValues {
|
|
30
|
+
const defaultStyle = modelCornersStyle(modelId);
|
|
31
|
+
const typeStyle = dataStyleState.getModelComponentTypeStyle(modelId, "Corner");
|
|
31
32
|
return merge({}, defaultStyle, typeStyle);
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
function modelCornerStyle(
|
|
35
|
+
function modelCornerStyle(modelId: ModelId, corner_id?: CornerId): StyleValues {
|
|
35
36
|
if (corner_id === undefined) {
|
|
36
|
-
return modelComponentTypeCornersStyle(
|
|
37
|
+
return modelComponentTypeCornersStyle(modelId);
|
|
37
38
|
}
|
|
38
|
-
const typeStyle = modelComponentTypeCornersStyle(
|
|
39
|
-
const individualStyle = dataStyleState.getComponentStyle(
|
|
39
|
+
const typeStyle = modelComponentTypeCornersStyle(modelId);
|
|
40
|
+
const individualStyle = dataStyleState.getComponentStyle(modelId, corner_id);
|
|
40
41
|
return merge({}, typeStyle, individualStyle);
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
function modelCornerColoring(
|
|
44
|
+
function modelCornerColoring(modelId: ModelId, corner_id?: CornerId): StyleValues {
|
|
44
45
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring is a StyleValues sub-object stored under a StyleValues index signature.
|
|
45
|
-
return modelCornerStyle(
|
|
46
|
+
return modelCornerStyle(modelId, corner_id).coloring as StyleValues;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
async function mutateModelCornersColoring(
|
|
49
|
-
|
|
50
|
-
corners_ids:
|
|
50
|
+
modelId: ModelId,
|
|
51
|
+
corners_ids: CornerId[],
|
|
51
52
|
values: StyleValues,
|
|
52
53
|
): Promise<void> {
|
|
53
|
-
await modelCommonStyle.mutateComponentStyles(
|
|
54
|
+
await modelCommonStyle.mutateComponentStyles(modelId, corners_ids, {
|
|
54
55
|
coloring: values,
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
async function mutateModelCornersTypeColoring(
|
|
59
|
-
|
|
59
|
+
async function mutateModelCornersTypeColoring(
|
|
60
|
+
modelId: ModelId,
|
|
61
|
+
values: StyleValues,
|
|
62
|
+
): Promise<void> {
|
|
63
|
+
await modelCommonStyle.mutateModelComponentTypeStyle(modelId, "Corner", {
|
|
60
64
|
coloring: values,
|
|
61
65
|
});
|
|
62
66
|
}
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CornerId, ModelId } from "@ogw_front/types/identifiers";
|
|
2
2
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
3
|
+
import type { ValidAttributeInput } from "@ogw_internal/stores/data_style/attribute_types";
|
|
4
|
+
import { isAttributeValid } from "@ogw_internal/stores/data_style/attribute_valid";
|
|
3
5
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
4
6
|
import { useModelCornersColor } from "./color";
|
|
5
7
|
import { useModelCornersCommonStyle } from "./common";
|
|
8
|
+
import { useModelCornersVertexAttribute } from "./vertex";
|
|
6
9
|
import { useModelCornersVisibility } from "./visibility";
|
|
7
10
|
|
|
8
11
|
interface ColorGroup {
|
|
9
12
|
color: RGBAColor | undefined;
|
|
10
|
-
corners_ids:
|
|
13
|
+
corners_ids: CornerId[];
|
|
11
14
|
}
|
|
12
15
|
|
|
13
|
-
interface AttributeGroup {
|
|
14
|
-
|
|
15
|
-
item: number;
|
|
16
|
-
minimum: number;
|
|
17
|
-
maximum: number;
|
|
18
|
-
colorMap: string;
|
|
19
|
-
no_data_color?: RGBAColor;
|
|
20
|
-
corners_ids: string[];
|
|
16
|
+
interface AttributeGroup extends ValidAttributeInput {
|
|
17
|
+
corners_ids: CornerId[];
|
|
21
18
|
}
|
|
22
19
|
|
|
23
20
|
async function setModelCornersDefaultStyle(_id: string): Promise<void> {
|
|
@@ -28,8 +25,8 @@ type ModelCornersStyleApi = ReturnType<typeof useModelCornersCommonStyle> &
|
|
|
28
25
|
ReturnType<typeof useModelCornersVisibility> &
|
|
29
26
|
ReturnType<typeof useModelCornersColor> &
|
|
30
27
|
ReturnType<typeof useModelCornersVertexAttribute> & {
|
|
31
|
-
applyModelCornersStyle: (modelId:
|
|
32
|
-
setModelCornersDefaultStyle: (
|
|
28
|
+
applyModelCornersStyle: (modelId: ModelId) => Promise<void>;
|
|
29
|
+
setModelCornersDefaultStyle: (modelId: ModelId) => Promise<void>;
|
|
33
30
|
};
|
|
34
31
|
|
|
35
32
|
export function useModelCornersStyle(): ModelCornersStyleApi {
|
|
@@ -40,8 +37,8 @@ export function useModelCornersStyle(): ModelCornersStyleApi {
|
|
|
40
37
|
const modelCornersVertexAttribute = useModelCornersVertexAttribute();
|
|
41
38
|
|
|
42
39
|
async function applyModelCornersVisibilityStyle(
|
|
43
|
-
modelId:
|
|
44
|
-
corners_ids:
|
|
40
|
+
modelId: ModelId,
|
|
41
|
+
corners_ids: CornerId[],
|
|
45
42
|
): Promise<unknown[]> {
|
|
46
43
|
const visibilityGroups: Record<string, string[]> = {};
|
|
47
44
|
for (const corner_id of corners_ids) {
|
|
@@ -64,8 +61,8 @@ export function useModelCornersStyle(): ModelCornersStyleApi {
|
|
|
64
61
|
}
|
|
65
62
|
|
|
66
63
|
function groupCornersByActiveColoring(
|
|
67
|
-
modelId:
|
|
68
|
-
corners_ids:
|
|
64
|
+
modelId: ModelId,
|
|
65
|
+
corners_ids: CornerId[],
|
|
69
66
|
): Record<string, string[]> {
|
|
70
67
|
const activeColoringGroups: Record<string, string[]> = {};
|
|
71
68
|
for (const corner_id of corners_ids) {
|
|
@@ -76,7 +73,7 @@ export function useModelCornersStyle(): ModelCornersStyleApi {
|
|
|
76
73
|
return activeColoringGroups;
|
|
77
74
|
}
|
|
78
75
|
|
|
79
|
-
function applyConstantColoring(modelId:
|
|
76
|
+
function applyConstantColoring(modelId: ModelId, corners_ids: CornerId[]): Promise<unknown>[] {
|
|
80
77
|
const colorGroups: Record<string, ColorGroup> = {};
|
|
81
78
|
for (const corner_id of corners_ids) {
|
|
82
79
|
const color = modelColorStyle.modelCornerColor(modelId, corner_id);
|
|
@@ -91,8 +88,8 @@ export function useModelCornersStyle(): ModelCornersStyleApi {
|
|
|
91
88
|
}
|
|
92
89
|
|
|
93
90
|
function groupCornersByVertexAttribute(
|
|
94
|
-
modelId:
|
|
95
|
-
corners_ids:
|
|
91
|
+
modelId: ModelId,
|
|
92
|
+
corners_ids: CornerId[],
|
|
96
93
|
): Record<string, AttributeGroup> {
|
|
97
94
|
const vertexGroups: Record<string, AttributeGroup> = {};
|
|
98
95
|
for (const corner_id of corners_ids) {
|
|
@@ -118,7 +115,7 @@ export function useModelCornersStyle(): ModelCornersStyleApi {
|
|
|
118
115
|
colorMap,
|
|
119
116
|
no_data_color,
|
|
120
117
|
};
|
|
121
|
-
if (!
|
|
118
|
+
if (!isAttributeValid(attribute)) {
|
|
122
119
|
continue;
|
|
123
120
|
}
|
|
124
121
|
const key = [name, item, colorMap, minimum, maximum, JSON.stringify(no_data_color)].join("_");
|
|
@@ -128,7 +125,7 @@ export function useModelCornersStyle(): ModelCornersStyleApi {
|
|
|
128
125
|
return vertexGroups;
|
|
129
126
|
}
|
|
130
127
|
|
|
131
|
-
function applyVertexColoring(modelId:
|
|
128
|
+
function applyVertexColoring(modelId: ModelId, corners_ids: CornerId[]): Promise<unknown>[] {
|
|
132
129
|
const vertexGroups = groupCornersByVertexAttribute(modelId, corners_ids);
|
|
133
130
|
return Object.values(vertexGroups).map(
|
|
134
131
|
async ({ name, item, minimum, maximum, colorMap, no_data_color, corners_ids: ids }) => {
|
|
@@ -150,8 +147,8 @@ export function useModelCornersStyle(): ModelCornersStyleApi {
|
|
|
150
147
|
}
|
|
151
148
|
|
|
152
149
|
async function applyModelCornersColoringStyle(
|
|
153
|
-
modelId:
|
|
154
|
-
corners_ids:
|
|
150
|
+
modelId: ModelId,
|
|
151
|
+
corners_ids: CornerId[],
|
|
155
152
|
): Promise<unknown[]> {
|
|
156
153
|
const activeColoringGroups = groupCornersByActiveColoring(modelId, corners_ids);
|
|
157
154
|
|
|
@@ -173,7 +170,7 @@ export function useModelCornersStyle(): ModelCornersStyleApi {
|
|
|
173
170
|
return results;
|
|
174
171
|
}
|
|
175
172
|
|
|
176
|
-
async function applyModelCornersStyle(modelId:
|
|
173
|
+
async function applyModelCornersStyle(modelId: ModelId): Promise<void> {
|
|
177
174
|
const corners_ids = await dataStore.getCornersGeodeIds(modelId);
|
|
178
175
|
if (corners_ids.length === 0) {
|
|
179
176
|
return;
|