@geode/opengeodeweb-front 10.44.0-rc.5 → 10.44.0-rc.7
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/assets/geode_objects.ts +1 -0
- package/app/components/BasemapAttribution.vue +28 -0
- package/app/components/Viewer/Basemap/CropOptions.vue +50 -0
- package/app/components/Viewer/Basemap/OpacityOptions.vue +52 -0
- package/app/components/Viewer/ContextMenu/ContextMenu.vue +5 -1
- package/app/components/Viewer/ContextMenu/ContextMenuItem.vue +6 -2
- package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +49 -10
- package/app/components/Viewer/Ui.vue +6 -1
- package/app/composables/project_manager.ts +6 -97
- package/app/composables/project_manager_helpers/reset.ts +34 -0
- package/app/composables/project_manager_helpers/restore.ts +58 -0
- package/app/composables/project_manager_helpers/types.ts +24 -0
- package/app/composables/project_manager_helpers/viewer_session.ts +25 -0
- package/app/composables/viewer_context_menu.ts +10 -0
- package/app/stores/basemap.ts +52 -0
- package/app/stores/basemap_detail.ts +51 -0
- package/app/stores/basemap_helpers/builds.ts +158 -0
- package/app/stores/basemap_helpers/detail_layers.ts +72 -0
- package/app/stores/basemap_helpers/detail_map.ts +62 -0
- package/app/stores/basemap_helpers/detail_refresh.ts +134 -0
- package/app/stores/basemap_helpers/detail_view.ts +94 -0
- package/app/stores/basemap_helpers/extent.ts +40 -0
- package/app/stores/basemap_helpers/georeferenced.ts +50 -0
- package/app/stores/basemap_helpers/layers.ts +66 -0
- package/app/stores/basemap_helpers/settings.ts +87 -0
- package/app/stores/basemap_helpers/viewer.ts +114 -0
- package/app/stores/menu_helpers/basemap.ts +10 -0
- package/app/stores/menu_helpers/menus_data.ts +18 -120
- package/app/stores/menu_helpers/mesh/edged_curve.ts +12 -0
- package/app/stores/menu_helpers/mesh/grid.ts +24 -0
- package/app/stores/menu_helpers/mesh/point_set.ts +11 -0
- package/app/stores/menu_helpers/mesh/solid.ts +29 -0
- package/app/stores/menu_helpers/mesh/surface.ts +22 -0
- package/app/stores/menu_helpers/model.ts +25 -0
- package/app/stores/menu_helpers/types.ts +5 -0
- package/app/stores/viewer.ts +0 -1
- package/app/utils/basemap_tree.ts +76 -0
- package/app/utils/treeview.ts +12 -1
- package/app/utils/visible_map_area.ts +129 -0
- package/internal/stores/hybrid_viewer/vtk_types.ts +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
type MapStyle = "satellite" | "plan" | "routes";
|
|
2
|
+
|
|
3
|
+
interface BasemapTreeGroup {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
children: { id: string; title: string }[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// Tree order and stacking order: from the bottom up, the routes stay readable on top
|
|
10
|
+
const MAP_STYLES: readonly MapStyle[] = ["satellite", "plan", "routes"];
|
|
11
|
+
const MAP_TITLES: Record<MapStyle, string> = {
|
|
12
|
+
satellite: "Satellite",
|
|
13
|
+
plan: "Plan",
|
|
14
|
+
routes: "Routes",
|
|
15
|
+
};
|
|
16
|
+
const BASEMAP_GROUP_ID = "basemap";
|
|
17
|
+
const MAP_ID_PREFIX = `${BASEMAP_GROUP_ID}:`;
|
|
18
|
+
|
|
19
|
+
function mapId(style: MapStyle): string {
|
|
20
|
+
return `${MAP_ID_PREFIX}${style}`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function mapStyleOf(id: string): MapStyle | undefined {
|
|
24
|
+
return MAP_STYLES.find((style) => mapId(style) === id);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function sortedMaps(maps: readonly string[]): MapStyle[] {
|
|
28
|
+
return MAP_STYLES.filter((style) => maps.includes(style));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Tree ids of the basemap: never project data
|
|
32
|
+
function isBasemapId(id: string): boolean {
|
|
33
|
+
return id === BASEMAP_GROUP_ID || id.startsWith(MAP_ID_PREFIX);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function basemapGroup(): BasemapTreeGroup {
|
|
37
|
+
return {
|
|
38
|
+
id: BASEMAP_GROUP_ID,
|
|
39
|
+
title: "Basemap",
|
|
40
|
+
children: MAP_STYLES.map((style) => ({ id: mapId(style), title: MAP_TITLES[style] })),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Each map eye shows or hides its map. The classic tree adds the group and every map on a
|
|
45
|
+
// Group click: that click hides the visible maps, or shows the last visible maps again
|
|
46
|
+
function nextBasemapMaps(
|
|
47
|
+
current: readonly MapStyle[],
|
|
48
|
+
last: readonly MapStyle[],
|
|
49
|
+
added: readonly string[],
|
|
50
|
+
removed: readonly string[],
|
|
51
|
+
): MapStyle[] {
|
|
52
|
+
const addedMaps = added.flatMap((id) => mapStyleOf(id) ?? []);
|
|
53
|
+
if (added.includes(BASEMAP_GROUP_ID) || addedMaps.length > 1) {
|
|
54
|
+
if (current.length === 0) {
|
|
55
|
+
return [...last];
|
|
56
|
+
}
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
const removedMaps = removed.flatMap((id) => mapStyleOf(id) ?? []);
|
|
60
|
+
if (removed.includes(BASEMAP_GROUP_ID) && removedMaps.length === 0) {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
return sortedMaps([...current, ...addedMaps].filter((style) => !removedMaps.includes(style)));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type { MapStyle };
|
|
67
|
+
export {
|
|
68
|
+
BASEMAP_GROUP_ID,
|
|
69
|
+
MAP_STYLES,
|
|
70
|
+
basemapGroup,
|
|
71
|
+
isBasemapId,
|
|
72
|
+
mapId,
|
|
73
|
+
mapStyleOf,
|
|
74
|
+
nextBasemapMaps,
|
|
75
|
+
sortedMaps,
|
|
76
|
+
};
|
package/app/utils/treeview.ts
CHANGED
|
@@ -29,7 +29,18 @@ interface ModelComponentMenuPayload {
|
|
|
29
29
|
targetComponentIds?: string[];
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
// The basemap category and its maps: not project data
|
|
33
|
+
interface BasemapMenuPayload {
|
|
34
|
+
event: MouseEvent;
|
|
35
|
+
itemId: string;
|
|
36
|
+
context_type: "basemap";
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
type TreeMenuPayload =
|
|
40
|
+
| DataMenuPayload
|
|
41
|
+
| GeodeObjectTypeMenuPayload
|
|
42
|
+
| ModelComponentMenuPayload
|
|
43
|
+
| BasemapMenuPayload;
|
|
33
44
|
|
|
34
45
|
export { compareSelections };
|
|
35
46
|
export type {
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { cross, multiplyAccumulate, normalize, subtract } from "@kitware/vtk.js/Common/Core/Math";
|
|
2
|
+
import type { CameraOptions } from "@ogw_internal/stores/hybrid_viewer/vtk_types";
|
|
3
|
+
import type { Vector3 } from "@kitware/vtk.js/types";
|
|
4
|
+
|
|
5
|
+
interface MapBounds {
|
|
6
|
+
x_min: number;
|
|
7
|
+
y_min: number;
|
|
8
|
+
x_max: number;
|
|
9
|
+
y_max: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// A map built by the back: its area and its number of tile columns
|
|
13
|
+
interface MapGrid {
|
|
14
|
+
bounds: MapBounds;
|
|
15
|
+
columns: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type ViewCamera = Pick<
|
|
19
|
+
CameraOptions,
|
|
20
|
+
"position" | "focal_point" | "view_up" | "view_angle" | "distance"
|
|
21
|
+
>;
|
|
22
|
+
|
|
23
|
+
// About one tile level (x2): the map changes by steps, not at every small move
|
|
24
|
+
const DETAIL_RATIO = 1.5;
|
|
25
|
+
const TILE_SIZE = 256;
|
|
26
|
+
const DEGREES = 180;
|
|
27
|
+
const HALF = 2;
|
|
28
|
+
|
|
29
|
+
// The ground size of one pixel of the map
|
|
30
|
+
function mapResolution(grid: MapGrid): number {
|
|
31
|
+
return (grid.bounds.x_max - grid.bounds.x_min) / (grid.columns * TILE_SIZE);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Where a corner ray meets the map plane, or, past the horizon, the base edge in its direction
|
|
35
|
+
function groundPoint(
|
|
36
|
+
origin: Vector3,
|
|
37
|
+
direction: Vector3,
|
|
38
|
+
planeZ: number,
|
|
39
|
+
reach: number,
|
|
40
|
+
): [number, number] {
|
|
41
|
+
const distance = (planeZ - origin[2]) / direction[2];
|
|
42
|
+
if (direction[2] < 0 && distance > 0) {
|
|
43
|
+
return [origin[0] + direction[0] * distance, origin[1] + direction[1] * distance];
|
|
44
|
+
}
|
|
45
|
+
const flat = Math.hypot(direction[0], direction[1]) || 1;
|
|
46
|
+
return [origin[0] + (direction[0] / flat) * reach, origin[1] + (direction[1] / flat) * reach];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// The part of the base map the screen shows, from the rays of its 4 corners
|
|
50
|
+
function visibleMapArea(
|
|
51
|
+
camera: ViewCamera,
|
|
52
|
+
aspect: number,
|
|
53
|
+
planeZ: number,
|
|
54
|
+
base: MapBounds,
|
|
55
|
+
): MapBounds | undefined {
|
|
56
|
+
const forward = subtract(camera.focal_point, camera.position, [0, 0, 0]);
|
|
57
|
+
normalize(forward);
|
|
58
|
+
const right = cross(forward, camera.view_up, [0, 0, 0]);
|
|
59
|
+
normalize(right);
|
|
60
|
+
const upward = cross(right, forward, [0, 0, 0]);
|
|
61
|
+
const halfHeight = Math.tan((camera.view_angle * Math.PI) / DEGREES / HALF);
|
|
62
|
+
const halfWidth = halfHeight * aspect;
|
|
63
|
+
const reach = Math.hypot(base.x_max - base.x_min, base.y_max - base.y_min);
|
|
64
|
+
const corners = [
|
|
65
|
+
[-1, -1],
|
|
66
|
+
[1, -1],
|
|
67
|
+
[1, 1],
|
|
68
|
+
[-1, 1],
|
|
69
|
+
].map(([column = 0, row = 0]) => {
|
|
70
|
+
const direction = multiplyAccumulate(forward, right, column * halfWidth, [0, 0, 0]);
|
|
71
|
+
multiplyAccumulate(direction, upward, row * halfHeight, direction);
|
|
72
|
+
return groundPoint(camera.position, direction, planeZ, reach);
|
|
73
|
+
});
|
|
74
|
+
const xValues = corners.map((corner) => corner[0]);
|
|
75
|
+
const yValues = corners.map((corner) => corner[1]);
|
|
76
|
+
const visibleArea = {
|
|
77
|
+
x_min: Math.max(base.x_min, Math.min(...xValues)),
|
|
78
|
+
y_min: Math.max(base.y_min, Math.min(...yValues)),
|
|
79
|
+
x_max: Math.min(base.x_max, Math.max(...xValues)),
|
|
80
|
+
y_max: Math.min(base.y_max, Math.max(...yValues)),
|
|
81
|
+
};
|
|
82
|
+
if (visibleArea.x_min >= visibleArea.x_max || visibleArea.y_min >= visibleArea.y_max) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
return visibleArea;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// The ground size of one screen pixel at the focal point
|
|
89
|
+
function screenPixelGroundSize(camera: ViewCamera, viewportHeight: number): number {
|
|
90
|
+
return (
|
|
91
|
+
(HALF * camera.distance * Math.tan((camera.view_angle * Math.PI) / DEGREES / HALF)) /
|
|
92
|
+
viewportHeight
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Below this gain the detail would look the same as the base
|
|
97
|
+
function needsSharperMap(baseResolution: number, wanted: number): boolean {
|
|
98
|
+
return baseResolution > DETAIL_RATIO * wanted;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Whether the map area covers the whole visible area
|
|
102
|
+
function covers(area: MapBounds, visible: MapBounds): boolean {
|
|
103
|
+
return (
|
|
104
|
+
visible.x_min >= area.x_min &&
|
|
105
|
+
visible.y_min >= area.y_min &&
|
|
106
|
+
visible.x_max <= area.x_max &&
|
|
107
|
+
visible.y_max <= area.y_max
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// A detail map stays while the view keeps within its area and its step of resolution
|
|
112
|
+
function stillSharp(detail: MapGrid, visible: MapBounds, wanted: number): boolean {
|
|
113
|
+
const resolution = mapResolution(detail);
|
|
114
|
+
return (
|
|
115
|
+
covers(detail.bounds, visible) &&
|
|
116
|
+
resolution <= wanted * DETAIL_RATIO &&
|
|
117
|
+
resolution >= wanted / DETAIL_RATIO
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export type { MapBounds, MapGrid, ViewCamera };
|
|
122
|
+
export {
|
|
123
|
+
covers,
|
|
124
|
+
mapResolution,
|
|
125
|
+
needsSharperMap,
|
|
126
|
+
screenPixelGroundSize,
|
|
127
|
+
stillSharp,
|
|
128
|
+
visibleMapArea,
|
|
129
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Vector3 } from "@kitware/vtk.js/types";
|
|
2
2
|
import type vtkActor from "@kitware/vtk.js/Rendering/Core/Actor";
|
|
3
|
+
import type vtkPolyData from "@kitware/vtk.js/Common/DataModel/PolyData";
|
|
3
4
|
|
|
4
5
|
// The camera state as exchanged with the viewer microservice (snake_case field names, plain arrays) - distinct from vtk.js's own vtkCamera object.
|
|
5
6
|
interface CameraOptions {
|
|
@@ -13,7 +14,7 @@ interface CameraOptions {
|
|
|
13
14
|
|
|
14
15
|
interface HybridDbEntry {
|
|
15
16
|
actor: vtkActor;
|
|
16
|
-
polydata:
|
|
17
|
+
polydata: vtkPolyData;
|
|
17
18
|
mapper: unknown;
|
|
18
19
|
}
|
|
19
20
|
|
package/package.json
CHANGED