@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,17 +1,27 @@
|
|
|
1
1
|
// oxlint-disable eslint/max-lines
|
|
2
|
+
import type {
|
|
3
|
+
AttributeColorMap,
|
|
4
|
+
AttributeItem,
|
|
5
|
+
AttributeName,
|
|
6
|
+
AttributeRange,
|
|
7
|
+
AttributeRangeMaximum,
|
|
8
|
+
AttributeRangeMinimum,
|
|
9
|
+
} from "@ogw_front/types/attribute";
|
|
10
|
+
import type {
|
|
11
|
+
AttributeState,
|
|
12
|
+
AttributeStoredConfig,
|
|
13
|
+
} from "@ogw_internal/stores/data_style/attribute_types";
|
|
2
14
|
import {
|
|
3
|
-
type AttributeState,
|
|
4
|
-
type AttributeStoredConfig,
|
|
5
|
-
groupBy,
|
|
6
|
-
} from "@ogw_internal/stores/data_style/model/component_style";
|
|
7
|
-
import {
|
|
8
|
-
DEFAULT_NO_DATA_COLOR,
|
|
9
15
|
EDGES_DEFAULT_COLOR,
|
|
10
16
|
EDGES_DEFAULT_VISIBILITY,
|
|
11
17
|
EDGES_DEFAULT_WIDTH,
|
|
12
18
|
type RGBAColor,
|
|
13
19
|
} from "@ogw_front/utils/default_styles/constants";
|
|
20
|
+
import type { Visibility, Width } from "@ogw_front/types/style";
|
|
21
|
+
import type { ModelId } from "@ogw_front/types/identifiers";
|
|
22
|
+
import { defaultAttributeStoredConfig } from "@ogw_internal/stores/data_style/attribute_default";
|
|
14
23
|
import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
|
|
24
|
+
import { groupBy } from "@ogw_internal/stores/data_style/model/component_style";
|
|
15
25
|
import merge from "lodash/merge";
|
|
16
26
|
import { useAttributeTimeStepStyle } from "@ogw_internal/stores/data_style/time_step";
|
|
17
27
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
@@ -39,8 +49,8 @@ type EdgesRequestSchema =
|
|
|
39
49
|
| EdgesSchemas["attribute"]["vertex"]["attribute"];
|
|
40
50
|
|
|
41
51
|
interface EdgesStyle {
|
|
42
|
-
visibility?:
|
|
43
|
-
width?:
|
|
52
|
+
visibility?: Visibility;
|
|
53
|
+
width?: Width;
|
|
44
54
|
coloring?: {
|
|
45
55
|
active?: string;
|
|
46
56
|
constant?: RGBAColor;
|
|
@@ -59,7 +69,7 @@ function useModelComponentEdgesStyle(type: EdgesComponentType) {
|
|
|
59
69
|
const schemas = modelSchemas[COMPONENT_TYPE_KEYS[type]].edges;
|
|
60
70
|
|
|
61
71
|
// Without an explicit edges style, components follow the model edges style
|
|
62
|
-
function edgesStyle(modelId:
|
|
72
|
+
function edgesStyle(modelId: ModelId, componentId?: string): EdgesStyle {
|
|
63
73
|
// oxlint-disable-next-line no-unsafe-type-assertion -- edges shape is defined by the data style schema.
|
|
64
74
|
const modelEdges = (dataStyleState.getStyle(modelId).edges ?? {}) as EdgesStyle;
|
|
65
75
|
// oxlint-disable-next-line no-unsafe-type-assertion -- edges shape is defined by the data style schema.
|
|
@@ -82,73 +92,71 @@ function useModelComponentEdgesStyle(type: EdgesComponentType) {
|
|
|
82
92
|
);
|
|
83
93
|
}
|
|
84
94
|
|
|
85
|
-
function vertexAttribute(modelId:
|
|
95
|
+
function vertexAttribute(modelId: ModelId, componentId?: string): AttributeState {
|
|
86
96
|
return edgesStyle(modelId, componentId).coloring?.vertex ?? {};
|
|
87
97
|
}
|
|
88
98
|
|
|
89
|
-
function edgesVisibility(modelId:
|
|
99
|
+
function edgesVisibility(modelId: ModelId, componentId?: string): Visibility {
|
|
90
100
|
return edgesStyle(modelId, componentId).visibility ?? EDGES_DEFAULT_VISIBILITY;
|
|
91
101
|
}
|
|
92
102
|
|
|
93
|
-
function edgesWidth(modelId:
|
|
103
|
+
function edgesWidth(modelId: ModelId, componentId?: string): Width {
|
|
94
104
|
return edgesStyle(modelId, componentId).width ?? EDGES_DEFAULT_WIDTH;
|
|
95
105
|
}
|
|
96
106
|
|
|
97
|
-
function edgesColor(modelId:
|
|
107
|
+
function edgesColor(modelId: ModelId, componentId?: string): RGBAColor {
|
|
98
108
|
return edgesStyle(modelId, componentId).coloring?.constant ?? EDGES_DEFAULT_COLOR;
|
|
99
109
|
}
|
|
100
110
|
|
|
101
|
-
function activeColoring(modelId:
|
|
111
|
+
function activeColoring(modelId: ModelId, componentId?: string): string {
|
|
102
112
|
return edgesStyle(modelId, componentId).coloring?.active ?? "constant";
|
|
103
113
|
}
|
|
104
114
|
|
|
105
|
-
function vertexAttributeName(modelId:
|
|
115
|
+
function vertexAttributeName(modelId: ModelId, componentId?: string): AttributeName | undefined {
|
|
106
116
|
return vertexAttribute(modelId, componentId).name;
|
|
107
117
|
}
|
|
108
118
|
|
|
109
|
-
function lastItem(
|
|
119
|
+
function lastItem(
|
|
120
|
+
modelId: ModelId,
|
|
121
|
+
componentId: string | undefined,
|
|
122
|
+
name?: AttributeName,
|
|
123
|
+
): number {
|
|
110
124
|
const { storedConfigs } = vertexAttribute(modelId, componentId);
|
|
111
125
|
return name === undefined ? 0 : (storedConfigs?.[name]?.lastItem ?? 0);
|
|
112
126
|
}
|
|
113
127
|
|
|
114
|
-
function vertexAttributeItem(modelId:
|
|
128
|
+
function vertexAttributeItem(modelId: ModelId, componentId?: string): AttributeItem {
|
|
115
129
|
const { name, item } = vertexAttribute(modelId, componentId);
|
|
116
130
|
return item ?? lastItem(modelId, componentId, name);
|
|
117
131
|
}
|
|
118
132
|
|
|
119
|
-
function storedConfig(modelId:
|
|
133
|
+
function storedConfig(modelId: ModelId, componentId: string | undefined): AttributeStoredConfig {
|
|
120
134
|
const { name, storedConfigs } = vertexAttribute(modelId, componentId);
|
|
121
135
|
const item = vertexAttributeItem(modelId, componentId);
|
|
122
136
|
const config = name === undefined ? undefined : storedConfigs?.[name]?.[item];
|
|
123
137
|
// A stored config may be partial, missing fields fall back to the defaults
|
|
124
|
-
return {
|
|
125
|
-
minimum: undefined,
|
|
126
|
-
maximum: undefined,
|
|
127
|
-
colorMap: undefined,
|
|
128
|
-
no_data_color: DEFAULT_NO_DATA_COLOR,
|
|
129
|
-
...config,
|
|
130
|
-
};
|
|
138
|
+
return { ...defaultAttributeStoredConfig(), ...config };
|
|
131
139
|
}
|
|
132
140
|
|
|
133
|
-
function vertexAttributeRange(
|
|
134
|
-
modelId: string,
|
|
135
|
-
componentId?: string,
|
|
136
|
-
): [number | undefined, number | undefined] {
|
|
141
|
+
function vertexAttributeRange(modelId: ModelId, componentId?: string): AttributeRange {
|
|
137
142
|
const { minimum, maximum } = storedConfig(modelId, componentId);
|
|
138
143
|
return [minimum, maximum];
|
|
139
144
|
}
|
|
140
145
|
|
|
141
|
-
function vertexAttributeColorMap(
|
|
146
|
+
function vertexAttributeColorMap(
|
|
147
|
+
modelId: ModelId,
|
|
148
|
+
componentId?: string,
|
|
149
|
+
): AttributeColorMap | undefined {
|
|
142
150
|
return storedConfig(modelId, componentId).colorMap;
|
|
143
151
|
}
|
|
144
152
|
|
|
145
|
-
function vertexAttributeNoDataColor(modelId:
|
|
153
|
+
function vertexAttributeNoDataColor(modelId: ModelId, componentId?: string): RGBAColor {
|
|
146
154
|
return storedConfig(modelId, componentId).no_data_color;
|
|
147
155
|
}
|
|
148
156
|
|
|
149
157
|
// The type style is updated too when every component of the type is targeted
|
|
150
158
|
async function mutateEdges(
|
|
151
|
-
modelId:
|
|
159
|
+
modelId: ModelId,
|
|
152
160
|
componentIds: string[],
|
|
153
161
|
values: EdgesStyle,
|
|
154
162
|
): Promise<void> {
|
|
@@ -163,7 +171,7 @@ function useModelComponentEdgesStyle(type: EdgesComponentType) {
|
|
|
163
171
|
}
|
|
164
172
|
|
|
165
173
|
async function requestEdges(
|
|
166
|
-
modelId:
|
|
174
|
+
modelId: ModelId,
|
|
167
175
|
componentIds: string[],
|
|
168
176
|
schema: EdgesRequestSchema,
|
|
169
177
|
values: Record<string, unknown> & { style: EdgesStyle },
|
|
@@ -191,9 +199,9 @@ function useModelComponentEdgesStyle(type: EdgesComponentType) {
|
|
|
191
199
|
}
|
|
192
200
|
|
|
193
201
|
async function setVisibility(
|
|
194
|
-
modelId:
|
|
202
|
+
modelId: ModelId,
|
|
195
203
|
componentIds: string[],
|
|
196
|
-
visibility:
|
|
204
|
+
visibility: Visibility,
|
|
197
205
|
): Promise<unknown> {
|
|
198
206
|
const result = await requestEdges(modelId, componentIds, schemas.visibility, {
|
|
199
207
|
visibility,
|
|
@@ -203,9 +211,9 @@ function useModelComponentEdgesStyle(type: EdgesComponentType) {
|
|
|
203
211
|
}
|
|
204
212
|
|
|
205
213
|
async function setWidth(
|
|
206
|
-
modelId:
|
|
214
|
+
modelId: ModelId,
|
|
207
215
|
componentIds: string[],
|
|
208
|
-
width:
|
|
216
|
+
width: Width,
|
|
209
217
|
): Promise<unknown> {
|
|
210
218
|
const result = await requestEdges(modelId, componentIds, schemas.width, {
|
|
211
219
|
width,
|
|
@@ -215,7 +223,7 @@ function useModelComponentEdgesStyle(type: EdgesComponentType) {
|
|
|
215
223
|
}
|
|
216
224
|
|
|
217
225
|
async function setColor(
|
|
218
|
-
modelId:
|
|
226
|
+
modelId: ModelId,
|
|
219
227
|
componentIds: string[],
|
|
220
228
|
color: RGBAColor,
|
|
221
229
|
): Promise<unknown> {
|
|
@@ -226,7 +234,7 @@ function useModelComponentEdgesStyle(type: EdgesComponentType) {
|
|
|
226
234
|
return result;
|
|
227
235
|
}
|
|
228
236
|
|
|
229
|
-
async function applyVertexAttribute(modelId:
|
|
237
|
+
async function applyVertexAttribute(modelId: ModelId, componentIds: string[]): Promise<unknown> {
|
|
230
238
|
const [referenceId] = componentIds;
|
|
231
239
|
const name = vertexAttributeName(modelId, referenceId);
|
|
232
240
|
const item = vertexAttributeItem(modelId, referenceId);
|
|
@@ -253,7 +261,7 @@ function useModelComponentEdgesStyle(type: EdgesComponentType) {
|
|
|
253
261
|
}
|
|
254
262
|
|
|
255
263
|
async function mutateVertexAttribute(
|
|
256
|
-
modelId:
|
|
264
|
+
modelId: ModelId,
|
|
257
265
|
componentIds: string[],
|
|
258
266
|
values: AttributeState,
|
|
259
267
|
): Promise<void> {
|
|
@@ -261,7 +269,7 @@ function useModelComponentEdgesStyle(type: EdgesComponentType) {
|
|
|
261
269
|
}
|
|
262
270
|
|
|
263
271
|
async function mutateStoredConfig(
|
|
264
|
-
modelId:
|
|
272
|
+
modelId: ModelId,
|
|
265
273
|
componentIds: string[],
|
|
266
274
|
config: Partial<AttributeStoredConfig>,
|
|
267
275
|
): Promise<void> {
|
|
@@ -274,7 +282,7 @@ function useModelComponentEdgesStyle(type: EdgesComponentType) {
|
|
|
274
282
|
}
|
|
275
283
|
|
|
276
284
|
async function setActiveColoring(
|
|
277
|
-
modelId:
|
|
285
|
+
modelId: ModelId,
|
|
278
286
|
componentIds: string[],
|
|
279
287
|
activeColoringType: string,
|
|
280
288
|
): Promise<unknown> {
|
|
@@ -288,9 +296,9 @@ function useModelComponentEdgesStyle(type: EdgesComponentType) {
|
|
|
288
296
|
}
|
|
289
297
|
|
|
290
298
|
async function setVertexAttributeName(
|
|
291
|
-
modelId:
|
|
299
|
+
modelId: ModelId,
|
|
292
300
|
componentIds: string[],
|
|
293
|
-
name:
|
|
301
|
+
name: AttributeName,
|
|
294
302
|
): Promise<unknown> {
|
|
295
303
|
const item = lastItem(modelId, componentIds[0], name);
|
|
296
304
|
await mutateVertexAttribute(modelId, componentIds, { name, item });
|
|
@@ -299,9 +307,9 @@ function useModelComponentEdgesStyle(type: EdgesComponentType) {
|
|
|
299
307
|
}
|
|
300
308
|
|
|
301
309
|
async function setVertexAttributeItem(
|
|
302
|
-
modelId:
|
|
310
|
+
modelId: ModelId,
|
|
303
311
|
componentIds: string[],
|
|
304
|
-
item:
|
|
312
|
+
item: AttributeItem,
|
|
305
313
|
): Promise<unknown> {
|
|
306
314
|
await mutateVertexAttribute(modelId, componentIds, { item });
|
|
307
315
|
const result = await applyVertexAttribute(modelId, componentIds);
|
|
@@ -309,10 +317,10 @@ function useModelComponentEdgesStyle(type: EdgesComponentType) {
|
|
|
309
317
|
}
|
|
310
318
|
|
|
311
319
|
async function setVertexAttributeRange(
|
|
312
|
-
modelId:
|
|
320
|
+
modelId: ModelId,
|
|
313
321
|
componentIds: string[],
|
|
314
|
-
minimum:
|
|
315
|
-
maximum:
|
|
322
|
+
minimum: AttributeRangeMinimum,
|
|
323
|
+
maximum: AttributeRangeMaximum,
|
|
316
324
|
): Promise<unknown> {
|
|
317
325
|
await mutateStoredConfig(modelId, componentIds, { minimum, maximum });
|
|
318
326
|
const result = await applyVertexAttribute(modelId, componentIds);
|
|
@@ -320,9 +328,9 @@ function useModelComponentEdgesStyle(type: EdgesComponentType) {
|
|
|
320
328
|
}
|
|
321
329
|
|
|
322
330
|
async function setVertexAttributeColorMap(
|
|
323
|
-
modelId:
|
|
331
|
+
modelId: ModelId,
|
|
324
332
|
componentIds: string[],
|
|
325
|
-
colorMap:
|
|
333
|
+
colorMap: AttributeColorMap | undefined,
|
|
326
334
|
): Promise<unknown> {
|
|
327
335
|
await mutateStoredConfig(modelId, componentIds, { colorMap });
|
|
328
336
|
const result = await applyVertexAttribute(modelId, componentIds);
|
|
@@ -330,7 +338,7 @@ function useModelComponentEdgesStyle(type: EdgesComponentType) {
|
|
|
330
338
|
}
|
|
331
339
|
|
|
332
340
|
async function setVertexAttributeNoDataColor(
|
|
333
|
-
modelId:
|
|
341
|
+
modelId: ModelId,
|
|
334
342
|
componentIds: string[],
|
|
335
343
|
no_data_color: RGBAColor,
|
|
336
344
|
): Promise<unknown> {
|
|
@@ -339,7 +347,7 @@ function useModelComponentEdgesStyle(type: EdgesComponentType) {
|
|
|
339
347
|
return result;
|
|
340
348
|
}
|
|
341
349
|
|
|
342
|
-
async function styledComponentIds(modelId:
|
|
350
|
+
async function styledComponentIds(modelId: ModelId): Promise<string[]> {
|
|
343
351
|
const componentIds = await dataStore.getMeshComponentGeodeIds(modelId, type);
|
|
344
352
|
if (dataStyleState.getModelComponentTypeStyle(modelId, type).edges !== undefined) {
|
|
345
353
|
return componentIds;
|
|
@@ -350,7 +358,7 @@ function useModelComponentEdgesStyle(type: EdgesComponentType) {
|
|
|
350
358
|
}
|
|
351
359
|
|
|
352
360
|
// The model edges routes override every component, so the explicit edges styles follow
|
|
353
|
-
async function mutateStyledEdges(modelId:
|
|
361
|
+
async function mutateStyledEdges(modelId: ModelId, values: EdgesStyle): Promise<void> {
|
|
354
362
|
const componentIds = await styledComponentIds(modelId);
|
|
355
363
|
if (componentIds.length > 0) {
|
|
356
364
|
await mutateEdges(modelId, componentIds, values);
|
|
@@ -358,7 +366,7 @@ function useModelComponentEdgesStyle(type: EdgesComponentType) {
|
|
|
358
366
|
}
|
|
359
367
|
|
|
360
368
|
// Only components with an explicit edges style are sent, the others follow the model edges
|
|
361
|
-
async function applyEdgesStyle(modelId:
|
|
369
|
+
async function applyEdgesStyle(modelId: ModelId): Promise<void> {
|
|
362
370
|
const componentIds = await styledComponentIds(modelId);
|
|
363
371
|
function style(componentId?: string): EdgesStyle {
|
|
364
372
|
return edgesStyle(modelId, componentId);
|
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
EDGES_COMPONENT_TYPES,
|
|
6
6
|
useModelComponentEdgesStyle,
|
|
7
7
|
} from "@ogw_internal/stores/data_style/model/edges/component";
|
|
8
|
+
import type { ModelId } from "@ogw_front/types/identifiers";
|
|
9
|
+
import type { Visibility } from "@ogw_front/types/style";
|
|
8
10
|
import { useModelEdgesCommonStyle } from "./common";
|
|
9
11
|
import { useModelEdgesWidthStyle } from "./width";
|
|
10
12
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
@@ -14,9 +16,9 @@ import { whenDefined } from "@ogw_internal/stores/data_style/when_defined";
|
|
|
14
16
|
const schema = viewer_schemas.opengeodeweb_viewer.model.edges.visibility;
|
|
15
17
|
|
|
16
18
|
interface ModelEdgesVisibilityStyleApi {
|
|
17
|
-
modelEdgesVisibility: (
|
|
18
|
-
setModelEdgesVisibility: (
|
|
19
|
-
applyModelEdgesStyle: (
|
|
19
|
+
modelEdgesVisibility: (modelId: ModelId) => Visibility | undefined;
|
|
20
|
+
setModelEdgesVisibility: (modelId: ModelId, visibility: Visibility) => Promise<unknown>;
|
|
21
|
+
applyModelEdgesStyle: (modelId: ModelId) => Promise<unknown[]>;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export function useModelEdgesVisibilityStyle(): ModelEdgesVisibilityStyleApi {
|
|
@@ -27,24 +29,27 @@ export function useModelEdgesVisibilityStyle(): ModelEdgesVisibilityStyleApi {
|
|
|
27
29
|
useModelComponentEdgesStyle(type),
|
|
28
30
|
);
|
|
29
31
|
|
|
30
|
-
function modelEdgesVisibility(
|
|
31
|
-
const { visibility } = modelEdgesCommonStyle.modelEdgesStyle(
|
|
32
|
+
function modelEdgesVisibility(modelId: ModelId): Visibility | undefined {
|
|
33
|
+
const { visibility } = modelEdgesCommonStyle.modelEdgesStyle(modelId);
|
|
32
34
|
if (typeof visibility === "boolean") {
|
|
33
35
|
return visibility;
|
|
34
36
|
}
|
|
35
37
|
return undefined;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
|
-
async function setModelEdgesVisibility(
|
|
39
|
-
|
|
40
|
+
async function setModelEdgesVisibility(
|
|
41
|
+
modelId: ModelId,
|
|
42
|
+
visibility: Visibility,
|
|
43
|
+
): Promise<unknown> {
|
|
44
|
+
const params = { id: modelId, visibility };
|
|
40
45
|
const result = await viewerStore.request(
|
|
41
46
|
{ schema, params },
|
|
42
47
|
{
|
|
43
48
|
response_function: async () => {
|
|
44
49
|
await Promise.all([
|
|
45
|
-
modelEdgesCommonStyle.mutateModelEdgesStyle(
|
|
50
|
+
modelEdgesCommonStyle.mutateModelEdgesStyle(modelId, { visibility }),
|
|
46
51
|
...componentsEdgesStyles.map(async (edgesStyle) => {
|
|
47
|
-
await edgesStyle.mutateStyledEdges(
|
|
52
|
+
await edgesStyle.mutateStyledEdges(modelId, { visibility });
|
|
48
53
|
}),
|
|
49
54
|
]);
|
|
50
55
|
},
|
|
@@ -53,15 +58,18 @@ export function useModelEdgesVisibilityStyle(): ModelEdgesVisibilityStyleApi {
|
|
|
53
58
|
return result;
|
|
54
59
|
}
|
|
55
60
|
|
|
56
|
-
async function applyModelEdgesStyle(
|
|
57
|
-
const visibilityResult = await whenDefined(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
async function applyModelEdgesStyle(modelId: ModelId): Promise<unknown[]> {
|
|
62
|
+
const visibilityResult = await whenDefined(
|
|
63
|
+
modelEdgesVisibility(modelId),
|
|
64
|
+
async (visibility) => {
|
|
65
|
+
const applied = await setModelEdgesVisibility(modelId, visibility);
|
|
66
|
+
return applied;
|
|
67
|
+
},
|
|
68
|
+
);
|
|
61
69
|
const widthResult = await whenDefined(
|
|
62
|
-
modelEdgesWidthStyle.modelEdgesWidth(
|
|
70
|
+
modelEdgesWidthStyle.modelEdgesWidth(modelId),
|
|
63
71
|
async (width) => {
|
|
64
|
-
const applied = await modelEdgesWidthStyle.setModelEdgesWidth(
|
|
72
|
+
const applied = await modelEdgesWidthStyle.setModelEdgesWidth(modelId, width);
|
|
65
73
|
return applied;
|
|
66
74
|
},
|
|
67
75
|
);
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
EDGES_COMPONENT_TYPES,
|
|
7
7
|
useModelComponentEdgesStyle,
|
|
8
8
|
} from "@ogw_internal/stores/data_style/model/edges/component";
|
|
9
|
+
import type { ModelId } from "@ogw_front/types/identifiers";
|
|
10
|
+
import type { Width } from "@ogw_front/types/style";
|
|
9
11
|
import { useModelEdgesCommonStyle } from "./common";
|
|
10
12
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
11
13
|
|
|
@@ -13,8 +15,8 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
|
13
15
|
const schema = viewer_schemas.opengeodeweb_viewer.model.edges.width;
|
|
14
16
|
|
|
15
17
|
export function useModelEdgesWidthStyle(): {
|
|
16
|
-
modelEdgesWidth: (
|
|
17
|
-
setModelEdgesWidth: (
|
|
18
|
+
modelEdgesWidth: (modelId: ModelId) => Width | undefined;
|
|
19
|
+
setModelEdgesWidth: (modelId: ModelId, width: Width) => Promise<unknown>;
|
|
18
20
|
} {
|
|
19
21
|
const viewerStore = useViewerStore();
|
|
20
22
|
const modelEdgesCommonStyle = useModelEdgesCommonStyle();
|
|
@@ -22,13 +24,13 @@ export function useModelEdgesWidthStyle(): {
|
|
|
22
24
|
useModelComponentEdgesStyle(type),
|
|
23
25
|
);
|
|
24
26
|
|
|
25
|
-
function modelEdgesWidth(
|
|
27
|
+
function modelEdgesWidth(modelId: ModelId): Width | undefined {
|
|
26
28
|
// oxlint-disable-next-line no-unsafe-type-assertion -- edges style values are dynamically typed at runtime.
|
|
27
|
-
return modelEdgesCommonStyle.modelEdgesStyle(
|
|
29
|
+
return modelEdgesCommonStyle.modelEdgesStyle(modelId).width as Width | undefined;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
async function setModelEdgesWidth(
|
|
31
|
-
const params = { id, width };
|
|
32
|
+
async function setModelEdgesWidth(modelId: ModelId, width: Width): Promise<unknown> {
|
|
33
|
+
const params = { id: modelId, width };
|
|
32
34
|
const result = await viewerStore.request(
|
|
33
35
|
{
|
|
34
36
|
schema,
|
|
@@ -37,9 +39,9 @@ export function useModelEdgesWidthStyle(): {
|
|
|
37
39
|
{
|
|
38
40
|
response_function: async () => {
|
|
39
41
|
const [mutateResult] = await Promise.all([
|
|
40
|
-
modelEdgesCommonStyle.mutateModelEdgesStyle(
|
|
42
|
+
modelEdgesCommonStyle.mutateModelEdgesStyle(modelId, { width }),
|
|
41
43
|
...componentsEdgesStyles.map(async (edgesStyle) => {
|
|
42
|
-
await edgesStyle.mutateStyledEdges(
|
|
44
|
+
await edgesStyle.mutateStyledEdges(modelId, { width });
|
|
43
45
|
}),
|
|
44
46
|
]);
|
|
45
47
|
return mutateResult;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ComputedRef } from "vue";
|
|
2
|
+
import type { ModelId } from "@ogw_front/types/identifiers";
|
|
2
3
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
3
4
|
import { useDataStyleState } from "@ogw_internal/stores/data_style/state";
|
|
4
5
|
import { useModelBlocksStyle } from "./blocks";
|
|
@@ -19,9 +20,9 @@ type UseModelStyleReturn = ReturnType<typeof useModelColorStyle> &
|
|
|
19
20
|
ReturnType<typeof useModelLinesStyle> &
|
|
20
21
|
ReturnType<typeof useModelPointsStyle> &
|
|
21
22
|
ReturnType<typeof useModelSurfacesStyle> & {
|
|
22
|
-
visibleMeshComponents: (modelId:
|
|
23
|
-
applyModelStyle: (modelId:
|
|
24
|
-
setModelMeshComponentsDefaultStyle: (modelId:
|
|
23
|
+
visibleMeshComponents: (modelId: ModelId) => ComputedRef<string[]>;
|
|
24
|
+
applyModelStyle: (modelId: ModelId) => Promise<unknown[]>;
|
|
25
|
+
setModelMeshComponentsDefaultStyle: (modelId: ModelId) => Promise<unknown[]>;
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
// oxlint-disable-next-line max-lines-per-function, max-statements
|
|
@@ -45,11 +46,11 @@ function useModelStyle(): UseModelStyleReturn {
|
|
|
45
46
|
const modelColorStyle = useModelColorStyle(componentStyleFunctions);
|
|
46
47
|
const modelVisibilityStyle = useModelVisibilityStyle(componentStyleFunctions);
|
|
47
48
|
|
|
48
|
-
function visibleMeshComponents(modelId:
|
|
49
|
+
function visibleMeshComponents(modelId: ModelId): ComputedRef<string[]> {
|
|
49
50
|
return useModelSelection(modelId, dataStyleState);
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
async function applyModelStyle(modelId:
|
|
53
|
+
async function applyModelStyle(modelId: ModelId): Promise<unknown[]> {
|
|
53
54
|
const style = dataStyleState.getStyle(modelId);
|
|
54
55
|
|
|
55
56
|
const results = await Promise.all([
|
|
@@ -72,7 +73,7 @@ function useModelStyle(): UseModelStyleReturn {
|
|
|
72
73
|
return results;
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
async function setModelMeshComponentsDefaultStyle(modelId:
|
|
76
|
+
async function setModelMeshComponentsDefaultStyle(modelId: ModelId): Promise<unknown[]> {
|
|
76
77
|
await dataStore.item(modelId);
|
|
77
78
|
const results = await Promise.all([
|
|
78
79
|
modelBlocksStyle.setModelBlocksDefaultStyle(modelId),
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { AttributeGroup, ColorGroup } from "./coloring_groups";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { ModelId } from "@ogw_front/types/identifiers";
|
|
3
|
+
import { isAttributeValid } from "@ogw_internal/stores/data_style/attribute_valid";
|
|
4
4
|
import type { useModelLinesColor } from "./color";
|
|
5
|
+
import type { useModelLinesEdgeAttribute } from "./edge";
|
|
6
|
+
import type { useModelLinesVertexAttribute } from "./vertex";
|
|
5
7
|
|
|
6
8
|
type ColorStyle = ReturnType<typeof useModelLinesColor>;
|
|
7
9
|
type VertexAttributeStyle = ReturnType<typeof useModelLinesVertexAttribute>;
|
|
8
10
|
type EdgeAttributeStyle = ReturnType<typeof useModelLinesEdgeAttribute>;
|
|
9
11
|
|
|
10
12
|
function applyModelLinesConstantColoring(
|
|
11
|
-
modelId:
|
|
13
|
+
modelId: ModelId,
|
|
12
14
|
type_lines_ids: string[],
|
|
13
15
|
modelColorStyle: ColorStyle,
|
|
14
16
|
): Promise<unknown>[] {
|
|
@@ -26,7 +28,7 @@ function applyModelLinesConstantColoring(
|
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
function groupModelLinesVertexAttributes(
|
|
29
|
-
modelId:
|
|
31
|
+
modelId: ModelId,
|
|
30
32
|
type_lines_ids: string[],
|
|
31
33
|
modelLinesVertexAttribute: VertexAttributeStyle,
|
|
32
34
|
): Record<string, AttributeGroup> {
|
|
@@ -51,7 +53,7 @@ function groupModelLinesVertexAttributes(
|
|
|
51
53
|
colorMap,
|
|
52
54
|
no_data_color,
|
|
53
55
|
};
|
|
54
|
-
if (!
|
|
56
|
+
if (!isAttributeValid(attribute)) {
|
|
55
57
|
continue;
|
|
56
58
|
}
|
|
57
59
|
const key = [name, item, colorMap, minimum, maximum, JSON.stringify(no_data_color)].join("_");
|
|
@@ -62,7 +64,7 @@ function groupModelLinesVertexAttributes(
|
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
function applyModelLinesVertexColoring(
|
|
65
|
-
modelId:
|
|
67
|
+
modelId: ModelId,
|
|
66
68
|
type_lines_ids: string[],
|
|
67
69
|
modelLinesVertexAttribute: VertexAttributeStyle,
|
|
68
70
|
): Promise<unknown>[] {
|
|
@@ -87,7 +89,7 @@ function applyModelLinesVertexColoring(
|
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
function groupModelLinesEdgeAttributes(
|
|
90
|
-
modelId:
|
|
92
|
+
modelId: ModelId,
|
|
91
93
|
type_lines_ids: string[],
|
|
92
94
|
modelLinesEdgeAttribute: EdgeAttributeStyle,
|
|
93
95
|
): Record<string, AttributeGroup> {
|
|
@@ -112,7 +114,7 @@ function groupModelLinesEdgeAttributes(
|
|
|
112
114
|
colorMap,
|
|
113
115
|
no_data_color,
|
|
114
116
|
};
|
|
115
|
-
if (!
|
|
117
|
+
if (!isAttributeValid(attribute)) {
|
|
116
118
|
continue;
|
|
117
119
|
}
|
|
118
120
|
const key = [name, item, colorMap, minimum, maximum, JSON.stringify(no_data_color)].join("_");
|
|
@@ -123,7 +125,7 @@ function groupModelLinesEdgeAttributes(
|
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
function applyModelLinesEdgeColoring(
|
|
126
|
-
modelId:
|
|
128
|
+
modelId: ModelId,
|
|
127
129
|
type_lines_ids: string[],
|
|
128
130
|
modelLinesEdgeAttribute: EdgeAttributeStyle,
|
|
129
131
|
): Promise<unknown>[] {
|
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isModelLinesVertexAttributeValid, useModelLinesVertexAttribute } from "./vertex";
|
|
1
|
+
import type { LineId, ModelId } 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 { useModelLinesCommonStyle } from "./common";
|
|
8
|
+
import { useModelLinesEdgeAttribute } from "./edge";
|
|
9
|
+
import { useModelLinesVertexAttribute } 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.lines.color;
|
|
11
13
|
|
|
12
14
|
export function useModelLinesColor(): {
|
|
13
15
|
setModelLinesColor: (
|
|
14
|
-
modelId:
|
|
15
|
-
lines_ids:
|
|
16
|
+
modelId: ModelId,
|
|
17
|
+
lines_ids: LineId[],
|
|
16
18
|
color: RGBAColor | undefined,
|
|
17
19
|
activeColoring?: string,
|
|
18
20
|
collectionId?: string,
|
|
19
21
|
) => Promise<unknown>;
|
|
20
|
-
modelLineColoring: (
|
|
21
|
-
modelLineColor: (
|
|
22
|
-
modelLineActiveColoring: (
|
|
22
|
+
modelLineColoring: (modelId: ModelId, line_id?: LineId) => StyleValues;
|
|
23
|
+
modelLineColor: (modelId: ModelId, line_id?: LineId) => RGBAColor | undefined;
|
|
24
|
+
modelLineActiveColoring: (modelId: ModelId, line_id?: LineId) => unknown;
|
|
23
25
|
setModelLinesActiveColoring: (
|
|
24
|
-
modelId:
|
|
25
|
-
lines_ids:
|
|
26
|
+
modelId: ModelId,
|
|
27
|
+
lines_ids: LineId[],
|
|
26
28
|
activeColoring: string,
|
|
27
29
|
collectionId?: string,
|
|
28
30
|
) => Promise<unknown>;
|
|
@@ -33,19 +35,19 @@ export function useModelLinesColor(): {
|
|
|
33
35
|
const modelLinesVertexAttribute = useModelLinesVertexAttribute();
|
|
34
36
|
const modelLinesEdgeAttribute = useModelLinesEdgeAttribute();
|
|
35
37
|
|
|
36
|
-
function modelLineColoring(
|
|
38
|
+
function modelLineColoring(modelId: ModelId, line_id?: LineId): StyleValues {
|
|
37
39
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring shape is defined by the data style schema.
|
|
38
|
-
return modelLinesCommonStyle.modelLineStyle(
|
|
40
|
+
return modelLinesCommonStyle.modelLineStyle(modelId, line_id).coloring as StyleValues;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
function modelLineColor(
|
|
43
|
+
function modelLineColor(modelId: ModelId, line_id?: LineId): RGBAColor | undefined {
|
|
42
44
|
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.constant shape is defined by the data style schema.
|
|
43
|
-
return modelLineColoring(
|
|
45
|
+
return modelLineColoring(modelId, line_id).constant as RGBAColor | undefined;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
async function setModelLinesColor(
|
|
47
|
-
modelId:
|
|
48
|
-
lines_ids:
|
|
49
|
+
modelId: ModelId,
|
|
50
|
+
lines_ids: LineId[],
|
|
49
51
|
color: RGBAColor | undefined,
|
|
50
52
|
activeColoring = "constant",
|
|
51
53
|
collectionId?: string,
|
|
@@ -61,11 +63,11 @@ export function useModelLinesColor(): {
|
|
|
61
63
|
return result;
|
|
62
64
|
}
|
|
63
65
|
|
|
64
|
-
function modelLineActiveColoring(
|
|
65
|
-
return modelLineColoring(
|
|
66
|
+
function modelLineActiveColoring(modelId: ModelId, line_id?: LineId): unknown {
|
|
67
|
+
return modelLineColoring(modelId, line_id).active;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
|
-
async function applyVertexColoring(modelId:
|
|
70
|
+
async function applyVertexColoring(modelId: ModelId, lines_ids: LineId[]): Promise<unknown> {
|
|
69
71
|
const name = modelLinesVertexAttribute.modelLinesVertexAttributeName(modelId, lines_ids[0]);
|
|
70
72
|
const item = modelLinesVertexAttribute.modelLinesVertexAttributeItem(modelId, lines_ids[0]);
|
|
71
73
|
const [minimum, maximum] = modelLinesVertexAttribute.modelLinesVertexAttributeRange(
|
|
@@ -81,7 +83,7 @@ export function useModelLinesColor(): {
|
|
|
81
83
|
lines_ids[0],
|
|
82
84
|
);
|
|
83
85
|
const attribute = { name, item, minimum, maximum, colorMap, no_data_color };
|
|
84
|
-
if (
|
|
86
|
+
if (isAttributeValid(attribute)) {
|
|
85
87
|
const result = await modelLinesVertexAttribute.setModelLinesVertexAttribute(
|
|
86
88
|
modelId,
|
|
87
89
|
lines_ids,
|
|
@@ -92,7 +94,7 @@ export function useModelLinesColor(): {
|
|
|
92
94
|
return undefined;
|
|
93
95
|
}
|
|
94
96
|
|
|
95
|
-
async function applyEdgeColoring(modelId:
|
|
97
|
+
async function applyEdgeColoring(modelId: ModelId, lines_ids: LineId[]): Promise<unknown> {
|
|
96
98
|
const name = modelLinesEdgeAttribute.modelLinesEdgeAttributeName(modelId, lines_ids[0]);
|
|
97
99
|
const item = modelLinesEdgeAttribute.modelLinesEdgeAttributeItem(modelId, lines_ids[0]);
|
|
98
100
|
const [minimum, maximum] = modelLinesEdgeAttribute.modelLinesEdgeAttributeRange(
|
|
@@ -105,7 +107,7 @@ export function useModelLinesColor(): {
|
|
|
105
107
|
lines_ids[0],
|
|
106
108
|
);
|
|
107
109
|
const attribute = { name, item, minimum, maximum, colorMap, no_data_color };
|
|
108
|
-
if (
|
|
110
|
+
if (isAttributeValid(attribute)) {
|
|
109
111
|
const result = await modelLinesEdgeAttribute.setModelLinesEdgeAttribute(
|
|
110
112
|
modelId,
|
|
111
113
|
lines_ids,
|
|
@@ -117,8 +119,8 @@ export function useModelLinesColor(): {
|
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
async function setModelLinesActiveColoring(
|
|
120
|
-
modelId:
|
|
121
|
-
lines_ids:
|
|
122
|
+
modelId: ModelId,
|
|
123
|
+
lines_ids: LineId[],
|
|
122
124
|
activeColoring: string,
|
|
123
125
|
collectionId?: string,
|
|
124
126
|
): Promise<unknown> {
|