@geode/opengeodeweb-front 10.36.0 → 10.37.0-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/Screenshot.vue +6 -4
- package/app/components/ViewToolbar.vue +4 -2
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +7 -4
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +10 -4
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +7 -4
- package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +5 -2
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +10 -6
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +7 -6
- package/app/components/Viewer/Generic/Model/BlocksOptions.vue +9 -18
- package/app/components/Viewer/Generic/Model/CornersOptions.vue +5 -10
- package/app/components/Viewer/Generic/Model/EdgesOptions.vue +3 -0
- package/app/components/Viewer/Generic/Model/LinesOptions.vue +9 -17
- package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +8 -18
- package/app/components/Viewer/ObjectTree/Views/ModelTree.vue +1 -5
- package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +11 -2
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +7 -6
- package/app/components/Viewer/Surface/PolygonsOptions.vue +10 -6
- package/app/composables/hover_highlight.ts +5 -4
- package/app/composables/project_manager.ts +1 -1
- package/app/composables/use_overlapping_picker.ts +4 -73
- package/app/composables/use_quick_colormap.ts +4 -14
- package/app/stores/back.ts +4 -10
- package/app/stores/camera_manager.ts +1 -1
- package/app/stores/data.ts +1 -1
- package/app/stores/viewer.ts +33 -19
- package/internal/stores/data_style/mesh/cells/cell.ts +26 -23
- package/internal/stores/data_style/mesh/cells/color.ts +8 -6
- package/internal/stores/data_style/mesh/cells/index.ts +13 -6
- package/internal/stores/data_style/mesh/cells/textures.ts +17 -6
- package/internal/stores/data_style/mesh/cells/vertex.ts +29 -23
- package/internal/stores/data_style/mesh/cells/visibility.ts +3 -6
- package/internal/stores/data_style/mesh/edges/color.ts +8 -6
- package/internal/stores/data_style/mesh/edges/edge.ts +26 -23
- package/internal/stores/data_style/mesh/edges/index.ts +13 -3
- package/internal/stores/data_style/mesh/edges/vertex.ts +29 -23
- package/internal/stores/data_style/mesh/edges/visibility.ts +3 -6
- package/internal/stores/data_style/mesh/edges/width.ts +3 -3
- package/internal/stores/data_style/mesh/index.ts +24 -11
- package/internal/stores/data_style/mesh/points/color.ts +8 -6
- package/internal/stores/data_style/mesh/points/index.ts +13 -6
- package/internal/stores/data_style/mesh/points/size.ts +3 -3
- package/internal/stores/data_style/mesh/points/vertex.ts +29 -23
- package/internal/stores/data_style/mesh/points/visibility.ts +5 -11
- package/internal/stores/data_style/mesh/polygons/color.ts +8 -6
- package/internal/stores/data_style/mesh/polygons/index.ts +13 -9
- package/internal/stores/data_style/mesh/polygons/polygon.ts +26 -23
- package/internal/stores/data_style/mesh/polygons/textures.ts +17 -6
- package/internal/stores/data_style/mesh/polygons/vertex.ts +26 -23
- package/internal/stores/data_style/mesh/polygons/visibility.ts +3 -6
- package/internal/stores/data_style/mesh/polyhedra/color.ts +8 -6
- package/internal/stores/data_style/mesh/polyhedra/index.ts +9 -5
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +28 -23
- package/internal/stores/data_style/mesh/polyhedra/vertex.ts +26 -23
- package/internal/stores/data_style/mesh/polyhedra/visibility.ts +3 -6
- package/internal/stores/data_style/model/blocks/color.ts +8 -6
- package/internal/stores/data_style/model/blocks/index.ts +9 -22
- package/internal/stores/data_style/model/blocks/polyhedron.ts +28 -23
- package/internal/stores/data_style/model/blocks/vertex.ts +26 -23
- package/internal/stores/data_style/model/blocks/visibility.ts +3 -3
- package/internal/stores/data_style/model/color.ts +10 -7
- package/internal/stores/data_style/model/common.ts +36 -20
- package/internal/stores/data_style/model/corners/color.ts +8 -6
- package/internal/stores/data_style/model/corners/index.ts +8 -14
- package/internal/stores/data_style/model/corners/vertex.ts +26 -23
- package/internal/stores/data_style/model/corners/visibility.ts +3 -3
- package/internal/stores/data_style/model/edges/visibility.ts +8 -8
- package/internal/stores/data_style/model/lines/color.ts +8 -6
- package/internal/stores/data_style/model/lines/edge.ts +26 -23
- package/internal/stores/data_style/model/lines/index.ts +9 -22
- package/internal/stores/data_style/model/lines/vertex.ts +26 -23
- package/internal/stores/data_style/model/lines/visibility.ts +3 -3
- package/internal/stores/data_style/model/points/index.ts +14 -4
- package/internal/stores/data_style/model/points/size.ts +3 -3
- package/internal/stores/data_style/model/points/visibility.ts +3 -6
- package/internal/stores/data_style/model/surfaces/color.ts +8 -6
- package/internal/stores/data_style/model/surfaces/index.ts +9 -22
- package/internal/stores/data_style/model/surfaces/polygon.ts +29 -23
- package/internal/stores/data_style/model/surfaces/vertex.ts +26 -23
- package/internal/stores/data_style/model/surfaces/visibility.ts +3 -3
- package/internal/stores/data_style/model/visibility.ts +1 -1
- package/internal/stores/data_style/when_defined.ts +13 -0
- package/internal/stores/hybrid_viewer/camera.ts +14 -15
- package/internal/stores/hybrid_viewer/core.ts +1 -1
- package/internal/stores/hybrid_viewer/filters.ts +12 -6
- package/internal/stores/hybrid_viewer/highlight.ts +9 -18
- package/internal/stores/hybrid_viewer/ruler.ts +10 -13
- package/internal/stores/hybrid_viewer/scene.ts +1 -1
- package/internal/utils/viewer_call.ts +1 -1
- package/package.json +4 -4
- package/server/utils/ws_client.ts +4 -4
- package/shared/utils/call_raw.ts +3 -3
- package/shared/utils/call_schema.ts +10 -8
- package/shared/utils/types.ts +6 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
|
|
2
2
|
import fileDownload from "js-file-download";
|
|
3
|
-
import viewer_schemas from "@geode/opengeodeweb-viewer/
|
|
3
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
4
4
|
|
|
5
5
|
import { type DataStyleSnapshot, useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
6
6
|
import { type NewDataItem, useDataStore } from "@ogw_front/stores/data";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ref } from "vue";
|
|
2
|
-
import viewer_schemas from "@geode/opengeodeweb-viewer/
|
|
2
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
3
3
|
|
|
4
4
|
import { type DataItem, useDataStore } from "@ogw_front/stores/data";
|
|
5
5
|
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
@@ -18,12 +18,6 @@ interface ProposedItem {
|
|
|
18
18
|
geode_object_type: string | undefined;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
interface PickedResponse {
|
|
22
|
-
array_ids: string[];
|
|
23
|
-
viewer_id: number | null;
|
|
24
|
-
picked_data?: PickedItem[];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
21
|
interface ViewerIdResult {
|
|
28
22
|
id: string | undefined;
|
|
29
23
|
viewer_id: number | undefined;
|
|
@@ -48,43 +42,6 @@ interface UseOverlappingPickerReturn {
|
|
|
48
42
|
get_viewer_id: (params: GetViewerIdParams) => Promise<ViewerIdResult>;
|
|
49
43
|
}
|
|
50
44
|
|
|
51
|
-
function isPickedItem(entry: unknown): entry is PickedItem {
|
|
52
|
-
return (
|
|
53
|
-
typeof entry === "object" &&
|
|
54
|
-
entry !== null &&
|
|
55
|
-
"id" in entry &&
|
|
56
|
-
typeof entry.id === "string" &&
|
|
57
|
-
(!("viewer_id" in entry) ||
|
|
58
|
-
entry.viewer_id === undefined ||
|
|
59
|
-
typeof entry.viewer_id === "number")
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function isPickedItemArray(value: unknown): value is PickedItem[] {
|
|
64
|
-
return Array.isArray(value) && value.every((entry) => isPickedItem(entry));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function isPickedResponse(value: unknown): value is PickedResponse {
|
|
68
|
-
if (typeof value !== "object" || value === null) {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
if (!("array_ids" in value) || !("viewer_id" in value)) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
const { array_ids, viewer_id } = value;
|
|
75
|
-
if (
|
|
76
|
-
!Array.isArray(array_ids) ||
|
|
77
|
-
!array_ids.every((entry) => typeof entry === "string") ||
|
|
78
|
-
(typeof viewer_id !== "number" && viewer_id !== null)
|
|
79
|
-
) {
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
if ("picked_data" in value) {
|
|
83
|
-
return value.picked_data === undefined || isPickedItemArray(value.picked_data);
|
|
84
|
-
}
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
45
|
export function useOverlappingPicker(): UseOverlappingPickerReturn {
|
|
89
46
|
const dataStore = useDataStore();
|
|
90
47
|
const dataStyleStore = useDataStyleStore();
|
|
@@ -169,41 +126,15 @@ export function useOverlappingPicker(): UseOverlappingPickerReturn {
|
|
|
169
126
|
const ids = viewableChecks.filter((id): id is string => Boolean(id));
|
|
170
127
|
|
|
171
128
|
const result: ViewerIdResult = { id: undefined, viewer_id: undefined };
|
|
172
|
-
// A plain `let` reassigned only from inside the response_function closure
|
|
173
|
-
// Below loses its declared type for TS's control-flow narrowing once
|
|
174
|
-
// Control leaves the closure - wrapping it in an object sidesteps that.
|
|
175
|
-
const responseHolder: { pickedResponse: PickedResponse | undefined } = {
|
|
176
|
-
pickedResponse: undefined,
|
|
177
|
-
};
|
|
178
129
|
const schema = viewer_schemas.opengeodeweb_viewer.viewer.picked_ids;
|
|
179
130
|
const params = { x, y, ids };
|
|
180
|
-
await viewerStore.request(
|
|
181
|
-
{
|
|
182
|
-
schema,
|
|
183
|
-
params,
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
response_function: (response: unknown) => {
|
|
187
|
-
responseHolder.pickedResponse = isPickedResponse(response) ? response : undefined;
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
);
|
|
191
|
-
const { pickedResponse } = responseHolder;
|
|
131
|
+
const { array_ids, viewer_id } = await viewerStore.request({ schema, params });
|
|
192
132
|
|
|
193
|
-
if (
|
|
133
|
+
if (array_ids.length === 0) {
|
|
194
134
|
return result;
|
|
195
135
|
}
|
|
196
136
|
|
|
197
|
-
const {
|
|
198
|
-
|
|
199
|
-
const pickedList: PickedItem[] = [];
|
|
200
|
-
if (picked_data && picked_data.length > 0) {
|
|
201
|
-
pickedList.push(...picked_data);
|
|
202
|
-
} else {
|
|
203
|
-
for (const pickId of array_ids) {
|
|
204
|
-
pickedList.push({ id: pickId, viewer_id: viewer_id ?? undefined });
|
|
205
|
-
}
|
|
206
|
-
}
|
|
137
|
+
const pickedList: PickedItem[] = array_ids.map((pickId) => ({ id: pickId, viewer_id }));
|
|
207
138
|
|
|
208
139
|
if (pickedList.length <= 1) {
|
|
209
140
|
return { id: pickedList[0]?.id, viewer_id: pickedList[0]?.viewer_id };
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { consola } from "consola";
|
|
2
2
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
3
|
-
import viewer_schemas from "@geode/opengeodeweb-viewer/
|
|
4
|
-
|
|
5
|
-
// Runtime guard for the unknown response of viewerStore.request(), used instead of an
|
|
6
|
-
// `as` cast so the shape is actually verified (data_id, when present, must be a string).
|
|
7
|
-
function isPickColormapResult(value: unknown): value is { data_id?: string } {
|
|
8
|
-
return (
|
|
9
|
-
typeof value === "object" &&
|
|
10
|
-
value !== null &&
|
|
11
|
-
(!("data_id" in value) || typeof value.data_id === "string")
|
|
12
|
-
);
|
|
13
|
-
}
|
|
3
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
14
4
|
|
|
15
5
|
export function useQuickColormap(): {
|
|
16
6
|
pickColormap: typeof pickColormap;
|
|
@@ -38,9 +28,9 @@ export function useQuickColormap(): {
|
|
|
38
28
|
try {
|
|
39
29
|
const schema = viewer_schemas.opengeodeweb_viewer.viewer.pick_colormap;
|
|
40
30
|
const params = { x: offsetX, y: offsetY };
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
quickColormap.data_id =
|
|
31
|
+
const { data_id } = await viewerStore.request({ schema, params });
|
|
32
|
+
if (data_id !== undefined && data_id !== "") {
|
|
33
|
+
quickColormap.data_id = data_id;
|
|
44
34
|
quickColormap.x = clientX;
|
|
45
35
|
quickColormap.y = clientY;
|
|
46
36
|
quickColormap.show = true;
|
package/app/stores/back.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { useInfraStore } from "@ogw_front/stores/infra";
|
|
|
9
9
|
|
|
10
10
|
import type {
|
|
11
11
|
JsonRpcSchema,
|
|
12
|
+
MicroserviceVersionSchema,
|
|
12
13
|
ParamsOf,
|
|
13
14
|
RequestHandlers,
|
|
14
15
|
ResponseOf,
|
|
@@ -155,22 +156,15 @@ export const useBackStore = defineStore("back", {
|
|
|
155
156
|
);
|
|
156
157
|
return result;
|
|
157
158
|
},
|
|
158
|
-
async get_version(schema:
|
|
159
|
+
async get_version(schema: MicroserviceVersionSchema | undefined) {
|
|
159
160
|
if (!schema) {
|
|
160
161
|
return undefined;
|
|
161
162
|
}
|
|
162
163
|
const result = await this.request(
|
|
163
164
|
{ schema },
|
|
164
165
|
{
|
|
165
|
-
response_function: (
|
|
166
|
-
|
|
167
|
-
typeof response === "object" &&
|
|
168
|
-
response !== null &&
|
|
169
|
-
"microservice_version" in response &&
|
|
170
|
-
typeof response.microservice_version === "string"
|
|
171
|
-
) {
|
|
172
|
-
this.version = response.microservice_version;
|
|
173
|
-
}
|
|
166
|
+
response_function: ({ microservice_version }) => {
|
|
167
|
+
this.version = microservice_version;
|
|
174
168
|
},
|
|
175
169
|
},
|
|
176
170
|
);
|
|
@@ -6,7 +6,7 @@ import { useObservable } from "@vueuse/rxjs";
|
|
|
6
6
|
import type { CameraOptions } from "@ogw_internal/stores/hybrid_viewer/vtk_types.js";
|
|
7
7
|
import { database } from "@ogw_internal/database/database.js";
|
|
8
8
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
9
|
-
import viewer_schemas from "@geode/opengeodeweb-viewer/
|
|
9
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
10
10
|
|
|
11
11
|
interface CameraPositionRecord {
|
|
12
12
|
id?: number;
|
package/app/stores/data.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { type Table, liveQuery } from "dexie";
|
|
4
4
|
import type { Observable } from "rxjs";
|
|
5
5
|
import { useObservable } from "@vueuse/rxjs";
|
|
6
|
-
import viewer_schemas from "@geode/opengeodeweb-viewer/
|
|
6
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
7
7
|
|
|
8
8
|
// Local imports
|
|
9
9
|
import { type ModelComponentRecord, useDataMesh } from "./data_helpers/mesh.js";
|
package/app/stores/viewer.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { Vector3 } from "@kitware/vtk.js/types";
|
|
|
5
5
|
import { connectImageStream } from "@kitware/vtk.js/Rendering/Misc/RemoteView";
|
|
6
6
|
import { initWebSocketClient } from "@ogw_internal/utils/ws_client";
|
|
7
7
|
import opengeodeweb_front_schemas from "@geode/opengeodeweb-front/opengeodeweb_front_typed_schemas.js";
|
|
8
|
-
import opengeodeweb_viewer_schemas from "@geode/opengeodeweb-viewer/
|
|
8
|
+
import opengeodeweb_viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
9
9
|
|
|
10
10
|
// Local imports
|
|
11
11
|
import {
|
|
@@ -18,7 +18,13 @@ import { useAppStore } from "@ogw_front/stores/app";
|
|
|
18
18
|
import { useInfraStore } from "@ogw_front/stores/infra";
|
|
19
19
|
import { viewer_call } from "@ogw_internal/utils/viewer_call";
|
|
20
20
|
|
|
21
|
-
import type {
|
|
21
|
+
import type {
|
|
22
|
+
JsonRpcSchema,
|
|
23
|
+
MicroserviceVersionSchema,
|
|
24
|
+
ParamsOf,
|
|
25
|
+
RequestHandlers,
|
|
26
|
+
ResponseOf,
|
|
27
|
+
} from "@ogw_shared/utils/types.js";
|
|
22
28
|
// oxlint-disable-next-line import/max-dependencies -- all imports above are required by this store.
|
|
23
29
|
import type { RpcClient } from "@ogw_shared/utils/call_raw.js";
|
|
24
30
|
|
|
@@ -70,18 +76,18 @@ export const useViewerStore = defineStore(
|
|
|
70
76
|
picking_mode.value = value;
|
|
71
77
|
}
|
|
72
78
|
// oxlint-disable-next-line unicorn/consistent-function-scoping
|
|
73
|
-
async function request(
|
|
79
|
+
async function request<Schema extends JsonRpcSchema>(
|
|
74
80
|
{
|
|
75
81
|
schema,
|
|
76
|
-
params
|
|
82
|
+
params,
|
|
77
83
|
timeout = request_timeout,
|
|
78
84
|
}: {
|
|
79
|
-
schema:
|
|
80
|
-
params?:
|
|
85
|
+
schema: Schema;
|
|
86
|
+
params?: ParamsOf<Schema>;
|
|
81
87
|
timeout?: number;
|
|
82
88
|
},
|
|
83
|
-
callbacks: RequestHandlers = {},
|
|
84
|
-
): Promise<
|
|
89
|
+
callbacks: RequestHandlers<ResponseOf<Schema>> = {},
|
|
90
|
+
): Promise<ResponseOf<Schema>> {
|
|
85
91
|
const microservice = {
|
|
86
92
|
$id: "viewer",
|
|
87
93
|
client: client.value,
|
|
@@ -93,26 +99,34 @@ export const useViewerStore = defineStore(
|
|
|
93
99
|
microservice,
|
|
94
100
|
{
|
|
95
101
|
schema,
|
|
96
|
-
params,
|
|
102
|
+
params: params ?? {},
|
|
97
103
|
timeout,
|
|
98
104
|
},
|
|
99
105
|
{
|
|
100
106
|
...callbacks,
|
|
101
107
|
response_function: async (response: unknown) => {
|
|
102
108
|
if (callbacks.response_function) {
|
|
103
|
-
|
|
109
|
+
// The viewer validates its responses against the schema `response` it was generated from.
|
|
110
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion
|
|
111
|
+
await callbacks.response_function(response as ResponseOf<Schema>);
|
|
104
112
|
}
|
|
105
113
|
},
|
|
106
114
|
},
|
|
107
115
|
);
|
|
108
|
-
|
|
116
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion
|
|
117
|
+
return result as ResponseOf<Schema>;
|
|
109
118
|
}
|
|
110
119
|
async function pick_world_position(x: number, y: number): Promise<Vector3> {
|
|
111
120
|
const schema = opengeodeweb_viewer_schemas.opengeodeweb_viewer.viewer.get_point_position;
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
121
|
+
const {
|
|
122
|
+
x: world_x,
|
|
123
|
+
y: world_y,
|
|
124
|
+
z: world_z,
|
|
125
|
+
} = await request({
|
|
126
|
+
schema,
|
|
127
|
+
params: { x: Math.round(x), y: Math.round(y) },
|
|
128
|
+
});
|
|
129
|
+
return [world_x, world_y, world_z];
|
|
116
130
|
}
|
|
117
131
|
async function set_picked_point(x: number, y: number): Promise<void> {
|
|
118
132
|
const [world_x, world_y, world_z] = await pick_world_position(x, y);
|
|
@@ -175,7 +189,9 @@ export const useViewerStore = defineStore(
|
|
|
175
189
|
async function connect(): Promise<void> {
|
|
176
190
|
await ws_connect();
|
|
177
191
|
}
|
|
178
|
-
async function get_version(
|
|
192
|
+
async function get_version(
|
|
193
|
+
schema: MicroserviceVersionSchema | undefined,
|
|
194
|
+
): Promise<{ microservice_version: string } | undefined> {
|
|
179
195
|
if (!schema) {
|
|
180
196
|
return undefined;
|
|
181
197
|
}
|
|
@@ -184,9 +200,7 @@ export const useViewerStore = defineStore(
|
|
|
184
200
|
schema,
|
|
185
201
|
},
|
|
186
202
|
{
|
|
187
|
-
response_function: (
|
|
188
|
-
// oxlint-disable-next-line no-unsafe-type-assertion -- response shape is defined by the version schema.
|
|
189
|
-
const { microservice_version } = response as { microservice_version: string };
|
|
203
|
+
response_function: ({ microservice_version }) => {
|
|
190
204
|
version.value = microservice_version;
|
|
191
205
|
},
|
|
192
206
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DEFAULT_NO_DATA_COLOR } from "@ogw_front/utils/default_styles/constants";
|
|
1
|
+
import { DEFAULT_NO_DATA_COLOR, type RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
2
2
|
// Third party imports
|
|
3
|
-
import viewer_schemas from "@geode/opengeodeweb-viewer/
|
|
3
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
4
4
|
|
|
5
5
|
// Local imports
|
|
6
6
|
import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
|
|
@@ -14,7 +14,7 @@ interface AttributeStoredConfig {
|
|
|
14
14
|
minimum: number | undefined;
|
|
15
15
|
maximum: number | undefined;
|
|
16
16
|
colorMap: string | undefined;
|
|
17
|
-
no_data_color:
|
|
17
|
+
no_data_color: RGBAColor;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
interface AttributeState {
|
|
@@ -29,22 +29,25 @@ interface AttributeInput {
|
|
|
29
29
|
minimum: number | undefined;
|
|
30
30
|
maximum: number | undefined;
|
|
31
31
|
colorMap: string | undefined;
|
|
32
|
-
no_data_color?:
|
|
32
|
+
no_data_color?: RGBAColor;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
name
|
|
37
|
-
item
|
|
38
|
-
minimum
|
|
39
|
-
maximum
|
|
40
|
-
colorMap
|
|
41
|
-
|
|
35
|
+
interface ValidAttributeInput {
|
|
36
|
+
name: string;
|
|
37
|
+
item: number;
|
|
38
|
+
minimum: number;
|
|
39
|
+
maximum: number;
|
|
40
|
+
colorMap: string;
|
|
41
|
+
no_data_color?: RGBAColor;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function isMeshCellsCellAttributeValid(input: AttributeInput): input is ValidAttributeInput {
|
|
42
45
|
return (
|
|
43
|
-
name !== undefined &&
|
|
44
|
-
item !== undefined &&
|
|
45
|
-
minimum !== undefined &&
|
|
46
|
-
maximum !== undefined &&
|
|
47
|
-
colorMap !== undefined
|
|
46
|
+
input.name !== undefined &&
|
|
47
|
+
input.item !== undefined &&
|
|
48
|
+
input.minimum !== undefined &&
|
|
49
|
+
input.maximum !== undefined &&
|
|
50
|
+
input.colorMap !== undefined
|
|
48
51
|
);
|
|
49
52
|
}
|
|
50
53
|
|
|
@@ -59,7 +62,7 @@ function useMeshCellsCellAttributeStyle(): {
|
|
|
59
62
|
name: string | undefined,
|
|
60
63
|
item: number | undefined,
|
|
61
64
|
) => AttributeStoredConfig;
|
|
62
|
-
setMeshCellsCellAttribute: (id: string, input:
|
|
65
|
+
setMeshCellsCellAttribute: (id: string, input: ValidAttributeInput) => Promise<unknown>;
|
|
63
66
|
setMeshCellsCellAttributeName: (id: string, name: string) => Promise<unknown>;
|
|
64
67
|
setMeshCellsCellAttributeItem: (id: string, item: number) => Promise<unknown>;
|
|
65
68
|
setMeshCellsCellAttributeRange: (
|
|
@@ -68,8 +71,8 @@ function useMeshCellsCellAttributeStyle(): {
|
|
|
68
71
|
maximum: number,
|
|
69
72
|
) => Promise<unknown>;
|
|
70
73
|
setMeshCellsCellAttributeColorMap: (id: string, colorMap: string | undefined) => Promise<unknown>;
|
|
71
|
-
meshCellsCellAttributeNoDataColor: (id: string) =>
|
|
72
|
-
setMeshCellsCellAttributeNoDataColor: (id: string, no_data_color:
|
|
74
|
+
meshCellsCellAttributeNoDataColor: (id: string) => RGBAColor;
|
|
75
|
+
setMeshCellsCellAttributeNoDataColor: (id: string, no_data_color: RGBAColor) => Promise<unknown>;
|
|
73
76
|
} {
|
|
74
77
|
const viewerStore = useViewerStore();
|
|
75
78
|
const meshCellsCommonStyle = useMeshCellsCommonStyle();
|
|
@@ -146,7 +149,7 @@ function useMeshCellsCellAttributeStyle(): {
|
|
|
146
149
|
maximum,
|
|
147
150
|
colorMap,
|
|
148
151
|
no_data_color = DEFAULT_NO_DATA_COLOR,
|
|
149
|
-
}:
|
|
152
|
+
}: ValidAttributeInput,
|
|
150
153
|
): Promise<unknown> {
|
|
151
154
|
await mutateMeshCellsCellStyle(id, {
|
|
152
155
|
name,
|
|
@@ -158,7 +161,7 @@ function useMeshCellsCellAttributeStyle(): {
|
|
|
158
161
|
colorMap,
|
|
159
162
|
no_data_color,
|
|
160
163
|
});
|
|
161
|
-
const points = getRGBPointsFromPreset(colorMap
|
|
164
|
+
const points = [...getRGBPointsFromPreset(colorMap)];
|
|
162
165
|
const schema = meshCellsCellAttributeSchemas.attribute;
|
|
163
166
|
const params = {
|
|
164
167
|
id,
|
|
@@ -242,7 +245,7 @@ function useMeshCellsCellAttributeStyle(): {
|
|
|
242
245
|
});
|
|
243
246
|
return applyCellAttribute(id);
|
|
244
247
|
}
|
|
245
|
-
function meshCellsCellAttributeNoDataColor(id: string):
|
|
248
|
+
function meshCellsCellAttributeNoDataColor(id: string): RGBAColor {
|
|
246
249
|
const name = meshCellsCellAttributeName(id);
|
|
247
250
|
const item = meshCellsCellAttributeItem(id);
|
|
248
251
|
const storedConfig = meshCellsCellAttributeStoredConfig(id, name, item);
|
|
@@ -250,7 +253,7 @@ function useMeshCellsCellAttributeStyle(): {
|
|
|
250
253
|
}
|
|
251
254
|
async function setMeshCellsCellAttributeNoDataColor(
|
|
252
255
|
id: string,
|
|
253
|
-
no_data_color:
|
|
256
|
+
no_data_color: RGBAColor,
|
|
254
257
|
): Promise<unknown> {
|
|
255
258
|
const name = meshCellsCellAttributeName(id);
|
|
256
259
|
const item = meshCellsCellAttributeItem(id);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
1
2
|
// Third party imports
|
|
2
|
-
import viewer_schemas from "@geode/opengeodeweb-viewer/
|
|
3
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
3
4
|
|
|
4
5
|
// Local imports
|
|
5
6
|
import { useMeshCellsCommonStyle } from "./common";
|
|
@@ -9,16 +10,17 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
|
9
10
|
const schema = viewer_schemas.opengeodeweb_viewer.mesh.cells.color;
|
|
10
11
|
|
|
11
12
|
export function useMeshCellsColorStyle(): {
|
|
12
|
-
meshCellsColor: (id: string) =>
|
|
13
|
-
setMeshCellsColor: (id: string, color:
|
|
13
|
+
meshCellsColor: (id: string) => RGBAColor | undefined;
|
|
14
|
+
setMeshCellsColor: (id: string, color: RGBAColor) => Promise<unknown>;
|
|
14
15
|
} {
|
|
15
16
|
const viewerStore = useViewerStore();
|
|
16
17
|
const meshCellsCommonStyle = useMeshCellsCommonStyle();
|
|
17
18
|
|
|
18
|
-
function meshCellsColor(id: string):
|
|
19
|
-
|
|
19
|
+
function meshCellsColor(id: string): RGBAColor | undefined {
|
|
20
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.constant shape is defined by the data style schema.
|
|
21
|
+
return meshCellsCommonStyle.meshCellsColoring(id).constant as RGBAColor | undefined;
|
|
20
22
|
}
|
|
21
|
-
async function setMeshCellsColor(id: string, color:
|
|
23
|
+
async function setMeshCellsColor(id: string, color: RGBAColor): Promise<unknown> {
|
|
22
24
|
const params = { id, color };
|
|
23
25
|
const result = await viewerStore.request(
|
|
24
26
|
{
|
|
@@ -8,6 +8,7 @@ import { useMeshCellsColorStyle } from "./color";
|
|
|
8
8
|
import { useMeshCellsCommonStyle } from "./common";
|
|
9
9
|
import { useMeshCellsTexturesStyle } from "./textures";
|
|
10
10
|
import { useMeshCellsVisibilityStyle } from "./visibility";
|
|
11
|
+
import { whenDefined } from "@ogw_internal/stores/data_style/when_defined";
|
|
11
12
|
|
|
12
13
|
// Local constants
|
|
13
14
|
|
|
@@ -58,14 +59,17 @@ async function setMeshCellsActiveColoring(
|
|
|
58
59
|
coloring: { active: type },
|
|
59
60
|
});
|
|
60
61
|
if (type === "constant") {
|
|
61
|
-
const result = await deps.colorStyle.
|
|
62
|
+
const result = await whenDefined(deps.colorStyle.meshCellsColor(id), async (value) => {
|
|
63
|
+
const applied = await deps.colorStyle.setMeshCellsColor(id, value);
|
|
64
|
+
return applied;
|
|
65
|
+
});
|
|
62
66
|
return result;
|
|
63
67
|
}
|
|
64
68
|
if (type === "textures") {
|
|
65
|
-
const result = await deps.texturesStyle.
|
|
66
|
-
id,
|
|
67
|
-
|
|
68
|
-
);
|
|
69
|
+
const result = await whenDefined(deps.texturesStyle.meshCellsTextures(id), async (value) => {
|
|
70
|
+
const applied = await deps.texturesStyle.setMeshCellsTextures(id, value);
|
|
71
|
+
return applied;
|
|
72
|
+
});
|
|
69
73
|
return result;
|
|
70
74
|
}
|
|
71
75
|
if (type === "vertex") {
|
|
@@ -86,7 +90,10 @@ async function applyMeshCellsStyle(
|
|
|
86
90
|
deps: MeshCellsActiveColoringDeps,
|
|
87
91
|
): Promise<unknown[]> {
|
|
88
92
|
const result = await Promise.all([
|
|
89
|
-
visibilityStyle.
|
|
93
|
+
whenDefined(visibilityStyle.meshCellsVisibility(id), async (value) => {
|
|
94
|
+
const applied = await visibilityStyle.setMeshCellsVisibility(id, value);
|
|
95
|
+
return applied;
|
|
96
|
+
}),
|
|
90
97
|
setMeshCellsActiveColoring(id, activeColoringType, deps),
|
|
91
98
|
]);
|
|
92
99
|
return result;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// Third party imports
|
|
2
|
-
import viewer_schemas
|
|
2
|
+
import viewer_schemas, {
|
|
3
|
+
type MeshApplyTexturesParams,
|
|
4
|
+
} from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
3
5
|
|
|
4
6
|
// Local imports
|
|
5
7
|
import { useMeshCellsCommonStyle } from "./common";
|
|
@@ -9,16 +11,25 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
|
9
11
|
const schema = viewer_schemas.opengeodeweb_viewer.mesh.apply_textures;
|
|
10
12
|
|
|
11
13
|
export function useMeshCellsTexturesStyle(): {
|
|
12
|
-
meshCellsTextures: (id: string) =>
|
|
13
|
-
setMeshCellsTextures: (
|
|
14
|
+
meshCellsTextures: (id: string) => MeshApplyTexturesParams["textures"] | undefined;
|
|
15
|
+
setMeshCellsTextures: (
|
|
16
|
+
id: string,
|
|
17
|
+
textures: MeshApplyTexturesParams["textures"],
|
|
18
|
+
) => Promise<unknown>;
|
|
14
19
|
} {
|
|
15
20
|
const viewerStore = useViewerStore();
|
|
16
21
|
const meshCellsCommonStyle = useMeshCellsCommonStyle();
|
|
17
22
|
|
|
18
|
-
function meshCellsTextures(id: string):
|
|
19
|
-
|
|
23
|
+
function meshCellsTextures(id: string): MeshApplyTexturesParams["textures"] | undefined {
|
|
24
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- textures shape is defined by the data style schema.
|
|
25
|
+
return meshCellsCommonStyle.meshCellsColoring(id).textures as
|
|
26
|
+
| MeshApplyTexturesParams["textures"]
|
|
27
|
+
| undefined;
|
|
20
28
|
}
|
|
21
|
-
async function setMeshCellsTextures(
|
|
29
|
+
async function setMeshCellsTextures(
|
|
30
|
+
id: string,
|
|
31
|
+
textures: MeshApplyTexturesParams["textures"],
|
|
32
|
+
): Promise<unknown> {
|
|
22
33
|
const params = { id, textures };
|
|
23
34
|
const result = await viewerStore.request(
|
|
24
35
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DEFAULT_NO_DATA_COLOR } from "@ogw_front/utils/default_styles/constants";
|
|
1
|
+
import { DEFAULT_NO_DATA_COLOR, type RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
2
2
|
// Third party imports
|
|
3
|
-
import viewer_schemas from "@geode/opengeodeweb-viewer/
|
|
3
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
4
4
|
|
|
5
5
|
// Local imports
|
|
6
6
|
import { getRGBPointsFromPreset } from "@ogw_front/utils/colormap";
|
|
@@ -15,7 +15,7 @@ interface AttributeStoredConfig {
|
|
|
15
15
|
minimum: number | undefined;
|
|
16
16
|
maximum: number | undefined;
|
|
17
17
|
colorMap: string | undefined;
|
|
18
|
-
no_data_color:
|
|
18
|
+
no_data_color: RGBAColor;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
interface AttributeState {
|
|
@@ -30,22 +30,25 @@ interface AttributeInput {
|
|
|
30
30
|
minimum: number | undefined;
|
|
31
31
|
maximum: number | undefined;
|
|
32
32
|
colorMap: string | undefined;
|
|
33
|
-
no_data_color?:
|
|
33
|
+
no_data_color?: RGBAColor;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
name
|
|
38
|
-
item
|
|
39
|
-
minimum
|
|
40
|
-
maximum
|
|
41
|
-
colorMap
|
|
42
|
-
|
|
36
|
+
interface ValidAttributeInput {
|
|
37
|
+
name: string;
|
|
38
|
+
item: number;
|
|
39
|
+
minimum: number;
|
|
40
|
+
maximum: number;
|
|
41
|
+
colorMap: string;
|
|
42
|
+
no_data_color?: RGBAColor;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function isMeshCellsVertexAttributeValid(input: AttributeInput): input is ValidAttributeInput {
|
|
43
46
|
return (
|
|
44
|
-
name !== undefined &&
|
|
45
|
-
item !== undefined &&
|
|
46
|
-
minimum !== undefined &&
|
|
47
|
-
maximum !== undefined &&
|
|
48
|
-
colorMap !== undefined
|
|
47
|
+
input.name !== undefined &&
|
|
48
|
+
input.item !== undefined &&
|
|
49
|
+
input.minimum !== undefined &&
|
|
50
|
+
input.maximum !== undefined &&
|
|
51
|
+
input.colorMap !== undefined
|
|
49
52
|
);
|
|
50
53
|
}
|
|
51
54
|
|
|
@@ -59,7 +62,7 @@ interface UseMeshCellsVertexAttributeStyleReturn {
|
|
|
59
62
|
name: string | undefined,
|
|
60
63
|
item: number | undefined,
|
|
61
64
|
) => AttributeStoredConfig;
|
|
62
|
-
setMeshCellsVertexAttribute: (id: string, input:
|
|
65
|
+
setMeshCellsVertexAttribute: (id: string, input: ValidAttributeInput) => Promise<unknown>;
|
|
63
66
|
setMeshCellsVertexAttributeName: (id: string, name: string) => Promise<unknown>;
|
|
64
67
|
setMeshCellsVertexAttributeItem: (id: string, item: number) => Promise<unknown>;
|
|
65
68
|
setMeshCellsVertexAttributeRange: (
|
|
@@ -71,8 +74,11 @@ interface UseMeshCellsVertexAttributeStyleReturn {
|
|
|
71
74
|
id: string,
|
|
72
75
|
colorMap: string | undefined,
|
|
73
76
|
) => Promise<unknown>;
|
|
74
|
-
meshCellsVertexAttributeNoDataColor: (id: string) =>
|
|
75
|
-
setMeshCellsVertexAttributeNoDataColor: (
|
|
77
|
+
meshCellsVertexAttributeNoDataColor: (id: string) => RGBAColor;
|
|
78
|
+
setMeshCellsVertexAttributeNoDataColor: (
|
|
79
|
+
id: string,
|
|
80
|
+
no_data_color: RGBAColor,
|
|
81
|
+
) => Promise<unknown>;
|
|
76
82
|
}
|
|
77
83
|
|
|
78
84
|
// oxlint-disable-next-line max-lines-per-function
|
|
@@ -152,7 +158,7 @@ function useMeshCellsVertexAttributeStyle(): UseMeshCellsVertexAttributeStyleRet
|
|
|
152
158
|
maximum,
|
|
153
159
|
colorMap,
|
|
154
160
|
no_data_color = DEFAULT_NO_DATA_COLOR,
|
|
155
|
-
}:
|
|
161
|
+
}: ValidAttributeInput,
|
|
156
162
|
): Promise<unknown> {
|
|
157
163
|
await mutateMeshCellsVertexStyle(id, {
|
|
158
164
|
name,
|
|
@@ -164,7 +170,7 @@ function useMeshCellsVertexAttributeStyle(): UseMeshCellsVertexAttributeStyleRet
|
|
|
164
170
|
colorMap,
|
|
165
171
|
no_data_color,
|
|
166
172
|
});
|
|
167
|
-
const points = getRGBPointsFromPreset(colorMap
|
|
173
|
+
const points = [...getRGBPointsFromPreset(colorMap)];
|
|
168
174
|
const schema = meshCellsVertexAttributeSchemas.attribute;
|
|
169
175
|
const params = {
|
|
170
176
|
id,
|
|
@@ -248,7 +254,7 @@ function useMeshCellsVertexAttributeStyle(): UseMeshCellsVertexAttributeStyleRet
|
|
|
248
254
|
});
|
|
249
255
|
return applyVertexAttribute(id);
|
|
250
256
|
}
|
|
251
|
-
function meshCellsVertexAttributeNoDataColor(id: string):
|
|
257
|
+
function meshCellsVertexAttributeNoDataColor(id: string): RGBAColor {
|
|
252
258
|
const name = meshCellsVertexAttributeName(id);
|
|
253
259
|
const item = meshCellsVertexAttributeItem(id);
|
|
254
260
|
const storedConfig = meshCellsVertexAttributeStoredConfig(id, name, item);
|
|
@@ -256,7 +262,7 @@ function useMeshCellsVertexAttributeStyle(): UseMeshCellsVertexAttributeStyleRet
|
|
|
256
262
|
}
|
|
257
263
|
async function setMeshCellsVertexAttributeNoDataColor(
|
|
258
264
|
id: string,
|
|
259
|
-
no_data_color:
|
|
265
|
+
no_data_color: RGBAColor,
|
|
260
266
|
): Promise<unknown> {
|
|
261
267
|
const name = meshCellsVertexAttributeName(id);
|
|
262
268
|
const item = meshCellsVertexAttributeItem(id);
|