@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
|
@@ -13,6 +13,7 @@ import PointSet3D from "@ogw_front/assets/img/geode_objects/PointSet3D.svg";
|
|
|
13
13
|
import PolygonalSurface2D from "@ogw_front/assets/img/geode_objects/PolygonalSurface2D.svg";
|
|
14
14
|
import PolygonalSurface3D from "@ogw_front/assets/img/geode_objects/PolygonalSurface3D.svg";
|
|
15
15
|
import PolyhedralSolid3D from "@ogw_front/assets/img/geode_objects/PolyhedralSolid3D.svg";
|
|
16
|
+
// oxlint-disable-next-line import/max-dependencies -- one icon import per geode object.
|
|
16
17
|
import RasterImage2D from "@ogw_front/assets/img/geode_objects/RasterImage2D.svg";
|
|
17
18
|
import RasterImage3D from "@ogw_front/assets/img/geode_objects/RasterImage3D.svg";
|
|
18
19
|
import RegularGrid2D from "@ogw_front/assets/img/geode_objects/RegularGrid2D.svg";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useBasemapStore } from "@ogw_front/stores/basemap";
|
|
3
|
+
|
|
4
|
+
const basemapStore = useBasemapStore();
|
|
5
|
+
// A hidden basemap stays built: its attribution goes with its maps
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<span
|
|
10
|
+
v-if="basemapStore.attribution && basemapStore.maps.length > 0"
|
|
11
|
+
data-testid="basemapAttribution"
|
|
12
|
+
class="basemap-attribution text-caption text-medium-emphasis px-1"
|
|
13
|
+
>
|
|
14
|
+
{{ basemapStore.attribution }}
|
|
15
|
+
</span>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<style scoped>
|
|
19
|
+
.basemap-attribution {
|
|
20
|
+
position: absolute;
|
|
21
|
+
left: 8px;
|
|
22
|
+
bottom: 4px;
|
|
23
|
+
z-index: 1;
|
|
24
|
+
background: rgba(var(--v-theme-surface), 0.6);
|
|
25
|
+
border-radius: 4px;
|
|
26
|
+
pointer-events: none;
|
|
27
|
+
}
|
|
28
|
+
</style>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { MAP_STYLES, mapStyleOf } from "@ogw_front/utils/basemap_tree";
|
|
3
|
+
import ViewerContextMenuItem, {
|
|
4
|
+
type ItemProps,
|
|
5
|
+
} from "@ogw_front/components/Viewer/ContextMenu/ContextMenuItem.vue";
|
|
6
|
+
import { useBasemapStore } from "@ogw_front/stores/basemap";
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
itemProps: ItemProps & { index: number };
|
|
10
|
+
tooltip?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const { itemProps, tooltip = "Crop to data" } = defineProps<Props>();
|
|
14
|
+
const basemapStore = useBasemapStore();
|
|
15
|
+
// A map menu crops that map, the basemap category menu crops every map
|
|
16
|
+
const mapStyles = computed(() => {
|
|
17
|
+
const mapStyle = mapStyleOf(itemProps.id);
|
|
18
|
+
if (mapStyle === undefined) {
|
|
19
|
+
return MAP_STYLES;
|
|
20
|
+
}
|
|
21
|
+
return [mapStyle];
|
|
22
|
+
});
|
|
23
|
+
// Cropped: only the map draped on the top surfaces, without the flat map around
|
|
24
|
+
const cropped = computed(() => mapStyles.value.map((mapStyle) => basemapStore.crop[mapStyle]));
|
|
25
|
+
const indeterminate = computed(() => new Set(cropped.value).size > 1);
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<ViewerContextMenuItem
|
|
30
|
+
data-testid="basemapCropMenu"
|
|
31
|
+
:index="itemProps.index"
|
|
32
|
+
:itemProps="itemProps"
|
|
33
|
+
:tooltip="tooltip"
|
|
34
|
+
btnIcon="mdi-panorama-outline"
|
|
35
|
+
>
|
|
36
|
+
<template #options>
|
|
37
|
+
<v-switch
|
|
38
|
+
:model-value="!indeterminate && cropped.every(Boolean)"
|
|
39
|
+
:indeterminate="indeterminate"
|
|
40
|
+
label="Crop to data"
|
|
41
|
+
data-testid="basemapCrop"
|
|
42
|
+
density="compact"
|
|
43
|
+
color="primary"
|
|
44
|
+
hide-details
|
|
45
|
+
class="px-1"
|
|
46
|
+
@update:model-value="(value) => basemapStore.setCrop(Boolean(value), mapStyles)"
|
|
47
|
+
/>
|
|
48
|
+
</template>
|
|
49
|
+
</ViewerContextMenuItem>
|
|
50
|
+
</template>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import ViewerContextMenuItem, {
|
|
3
|
+
type ItemProps,
|
|
4
|
+
} from "@ogw_front/components/Viewer/ContextMenu/ContextMenuItem.vue";
|
|
5
|
+
import { mapStyleOf } from "@ogw_front/utils/basemap_tree";
|
|
6
|
+
import { useBasemapStore } from "@ogw_front/stores/basemap";
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
itemProps: ItemProps & { index: number };
|
|
10
|
+
tooltip?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const { itemProps, tooltip = "Opacity" } = defineProps<Props>();
|
|
14
|
+
const basemapStore = useBasemapStore();
|
|
15
|
+
const PERCENT = 100;
|
|
16
|
+
const mapStyle = computed(() => mapStyleOf(itemProps.id));
|
|
17
|
+
// The slider works in percent, the store in 0..1
|
|
18
|
+
const opacityPercent = computed({
|
|
19
|
+
get: () => Math.round((mapStyle.value ? basemapStore.opacities[mapStyle.value] : 1) * PERCENT),
|
|
20
|
+
set: (value: number) => {
|
|
21
|
+
if (mapStyle.value) {
|
|
22
|
+
void basemapStore.setOpacity(mapStyle.value, value / PERCENT);
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<ViewerContextMenuItem
|
|
30
|
+
data-testid="basemapOpacityMenu"
|
|
31
|
+
:index="itemProps.index"
|
|
32
|
+
:itemProps="itemProps"
|
|
33
|
+
:tooltip="tooltip"
|
|
34
|
+
btnIcon="mdi-circle-half-full"
|
|
35
|
+
>
|
|
36
|
+
<template #options>
|
|
37
|
+
<div class="d-flex align-center ga-2 px-1">
|
|
38
|
+
<v-slider
|
|
39
|
+
v-model="opacityPercent"
|
|
40
|
+
data-testid="basemapOpacity"
|
|
41
|
+
:min="10"
|
|
42
|
+
:max="100"
|
|
43
|
+
:step="5"
|
|
44
|
+
density="compact"
|
|
45
|
+
color="primary"
|
|
46
|
+
hide-details
|
|
47
|
+
/>
|
|
48
|
+
<span class="text-caption text-right" style="min-width: 4ch">{{ opacityPercent }}%</span>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
</ViewerContextMenuItem>
|
|
52
|
+
</template>
|
|
@@ -196,7 +196,11 @@ function toggleShowName(): void {
|
|
|
196
196
|
@click="toggleShowName"
|
|
197
197
|
/>
|
|
198
198
|
|
|
199
|
-
<InfoCard
|
|
199
|
+
<InfoCard
|
|
200
|
+
v-if="meta_data.viewer_type !== 'basemap'"
|
|
201
|
+
v-model:show="showName"
|
|
202
|
+
:meta-data="meta_data"
|
|
203
|
+
/>
|
|
200
204
|
</div>
|
|
201
205
|
</div>
|
|
202
206
|
</v-menu>
|
|
@@ -27,10 +27,12 @@ interface Props {
|
|
|
27
27
|
index: number;
|
|
28
28
|
itemProps: ItemProps;
|
|
29
29
|
tooltip: string;
|
|
30
|
-
|
|
30
|
+
// An image, or an mdi icon name
|
|
31
|
+
btnImage?: string;
|
|
32
|
+
btnIcon?: string;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
const { index, itemProps, tooltip, btnImage } = defineProps<Props>();
|
|
35
|
+
const { index, itemProps, tooltip, btnImage = "", btnIcon = "" } = defineProps<Props>();
|
|
34
36
|
|
|
35
37
|
const buttonCoords = computed(() => {
|
|
36
38
|
const angle = (index / itemProps.totalItems) * 2 * Math.PI;
|
|
@@ -155,7 +157,9 @@ export type { ItemProps };
|
|
|
155
157
|
elevation="2"
|
|
156
158
|
:style="computedItemStyles"
|
|
157
159
|
>
|
|
160
|
+
<v-icon v-if="btnIcon" :icon="btnIcon" size="28" />
|
|
158
161
|
<v-img
|
|
162
|
+
v-else
|
|
159
163
|
:src="btnImage"
|
|
160
164
|
height="28"
|
|
161
165
|
width="28"
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
// oxlint-disable max-dependencies
|
|
2
3
|
import {
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
type MapStyle,
|
|
5
|
+
basemapGroup,
|
|
6
|
+
isBasemapId,
|
|
7
|
+
mapId,
|
|
8
|
+
nextBasemapMaps,
|
|
9
|
+
} from "@ogw_front/utils/basemap_tree";
|
|
10
|
+
import { type TreeMenuPayload, compareSelections } from "@ogw_front/utils/treeview";
|
|
7
11
|
import CommonTreeView from "@ogw_front/components/Viewer/ObjectTree/Base/CommonTreeView.vue";
|
|
8
12
|
import type { DisplayItem } from "@ogw_front/composables/virtual_tree";
|
|
9
13
|
import ObjectTreeControls from "@ogw_front/components/Viewer/ObjectTree/Base/Controls.vue";
|
|
10
14
|
import ObjectTreeItemLabel from "@ogw_front/components/Viewer/ObjectTree/Base/ItemLabel.vue";
|
|
15
|
+
import { useBasemapStore } from "@ogw_front/stores/basemap";
|
|
11
16
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
12
17
|
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
13
18
|
import { useHoverhighlight } from "@ogw_front/composables/hover_highlight";
|
|
@@ -19,10 +24,11 @@ const treeviewStore = useTreeviewStore();
|
|
|
19
24
|
const dataStore = useDataStore();
|
|
20
25
|
const dataStyleStore = useDataStyleStore();
|
|
21
26
|
const hybridViewerStore = useHybridViewerStore();
|
|
27
|
+
const basemapStore = useBasemapStore();
|
|
22
28
|
const { onHoverEnter, onHoverLeave } = useHoverhighlight();
|
|
23
29
|
|
|
24
30
|
interface Emits {
|
|
25
|
-
"show-menu": [payload:
|
|
31
|
+
"show-menu": [payload: TreeMenuPayload];
|
|
26
32
|
}
|
|
27
33
|
|
|
28
34
|
const emit = defineEmits<Emits>();
|
|
@@ -53,11 +59,40 @@ const {
|
|
|
53
59
|
applySearchFilter,
|
|
54
60
|
} = useTreeFilter(() => treeviewStore.items, { recursiveSort: true });
|
|
55
61
|
|
|
62
|
+
// The basemap category comes first, out of the data sort and filters
|
|
63
|
+
const displayedItems = computed(() => {
|
|
64
|
+
if (!basemapStore.available) {
|
|
65
|
+
return processedItems.value;
|
|
66
|
+
}
|
|
67
|
+
return [basemapGroup(), ...processedItems.value];
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// The basemap rows show the basemap state: they are never stored in the data selection
|
|
71
|
+
const basemapRows = computed<string[]>(() => basemapStore.maps.map((mapStyle) => mapId(mapStyle)));
|
|
72
|
+
|
|
73
|
+
async function showBasemap(maps: MapStyle[]): Promise<void> {
|
|
74
|
+
try {
|
|
75
|
+
await basemapStore.setMaps(maps);
|
|
76
|
+
} catch {
|
|
77
|
+
// Already reported by the request feedback
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Basemap rows are never filtered out by the search
|
|
56
82
|
function onUpdateSelection(val: string[]): void {
|
|
57
|
-
|
|
83
|
+
const { added, removed } = compareSelections(val, basemapRows.value);
|
|
84
|
+
const maps = nextBasemapMaps(basemapStore.maps, basemapStore.shown, added, removed);
|
|
85
|
+
if (maps.join(",") !== basemapStore.maps.join(",")) {
|
|
86
|
+
void showBasemap(maps);
|
|
87
|
+
}
|
|
88
|
+
const data = val.filter((id) => !isBasemapId(id));
|
|
89
|
+
treeviewStore.selection = applySearchFilter(data, treeviewStore.selection);
|
|
58
90
|
}
|
|
59
91
|
|
|
60
|
-
const visibleSelection = computed<string[]>(() =>
|
|
92
|
+
const visibleSelection = computed<string[]>(() => [
|
|
93
|
+
...applySearchFilter(treeviewStore.selection, []),
|
|
94
|
+
...basemapRows.value,
|
|
95
|
+
]);
|
|
61
96
|
|
|
62
97
|
watch(
|
|
63
98
|
() => treeviewStore.selection,
|
|
@@ -88,6 +123,10 @@ watch(
|
|
|
88
123
|
|
|
89
124
|
function showMenu(event: MouseEvent, item: TreeGroupItem): void {
|
|
90
125
|
const actualItem = item.raw || item;
|
|
126
|
+
if (isBasemapId(actualItem.id)) {
|
|
127
|
+
emit("show-menu", { event, itemId: actualItem.id, context_type: "basemap" });
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
91
130
|
if (!actualItem.children) {
|
|
92
131
|
emit("show-menu", { event, itemId: actualItem.id });
|
|
93
132
|
return;
|
|
@@ -155,7 +194,7 @@ function expandAll(): void {
|
|
|
155
194
|
}
|
|
156
195
|
}
|
|
157
196
|
}
|
|
158
|
-
traverse(
|
|
197
|
+
traverse(displayedItems.value);
|
|
159
198
|
opened.value = allIds;
|
|
160
199
|
}
|
|
161
200
|
</script>
|
|
@@ -177,7 +216,7 @@ function expandAll(): void {
|
|
|
177
216
|
:selected="visibleSelection"
|
|
178
217
|
v-model:opened="opened"
|
|
179
218
|
v-model:active="treeviewStore.activeItems"
|
|
180
|
-
:items="
|
|
219
|
+
:items="displayedItems"
|
|
181
220
|
:options="{
|
|
182
221
|
selection: { selectable: true },
|
|
183
222
|
search,
|
|
@@ -198,7 +237,7 @@ function expandAll(): void {
|
|
|
198
237
|
<ObjectTreeItemLabel
|
|
199
238
|
:item="item as unknown as DisplayItem"
|
|
200
239
|
:is-leaf="isLeaf"
|
|
201
|
-
:show-crs="isLeaf"
|
|
240
|
+
:show-crs="isLeaf && !isBasemapId(item.id as string)"
|
|
202
241
|
@contextmenu="showMenu($event, item as unknown as TreeGroupItem)"
|
|
203
242
|
/>
|
|
204
243
|
</template>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
// oxlint-disable max-dependencies
|
|
3
2
|
import {
|
|
4
3
|
type ViewerIdResult,
|
|
5
4
|
useOverlappingPicker,
|
|
6
5
|
} from "@ogw_front/composables/use_overlapping_picker";
|
|
6
|
+
import BasemapAttribution from "@ogw_front/components/BasemapAttribution.vue";
|
|
7
7
|
import OverlappingObjectsPicker from "@ogw_front/components/Viewer/OverlappingObjectsPicker.vue";
|
|
8
8
|
import ProjectCrs from "@ogw_front/components/ProjectCrs.vue";
|
|
9
9
|
import ToolActiveChip from "@ogw_front/components/Viewer/ToolActiveChip.vue";
|
|
@@ -11,6 +11,7 @@ import type { TreeMenuPayload } from "@ogw_front/utils/treeview";
|
|
|
11
11
|
import ViewerContextMenu from "@ogw_front/components/Viewer/ContextMenu/ContextMenu.vue";
|
|
12
12
|
import ViewerObjectTreeLayout from "@ogw_front/components/Viewer/ObjectTree/Layout.vue";
|
|
13
13
|
import { getCurrentInstance } from "vue";
|
|
14
|
+
import { useBasemapDetailStore } from "@ogw_front/stores/basemap_detail";
|
|
14
15
|
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
15
16
|
import { useMenuStore } from "@ogw_front/stores/menu";
|
|
16
17
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
@@ -29,6 +30,8 @@ const emit = defineEmits<{
|
|
|
29
30
|
const menuStore = useMenuStore();
|
|
30
31
|
const viewerStore = useViewerStore();
|
|
31
32
|
const hybridViewerStore = useHybridViewerStore();
|
|
33
|
+
// The sharper map of the visible area follows the camera of this viewer
|
|
34
|
+
useBasemapDetailStore();
|
|
32
35
|
|
|
33
36
|
const hoverHighlightLabel = computed(
|
|
34
37
|
() =>
|
|
@@ -110,6 +113,8 @@ defineExpose({ get_viewer_id });
|
|
|
110
113
|
|
|
111
114
|
<ProjectCrs />
|
|
112
115
|
|
|
116
|
+
<BasemapAttribution />
|
|
117
|
+
|
|
113
118
|
<OverlappingObjectsPicker
|
|
114
119
|
:display-intermediate="displayIntermediate"
|
|
115
120
|
:intermediate-items="intermediateItems"
|
|
@@ -1,37 +1,12 @@
|
|
|
1
|
-
import back_schemas
|
|
2
|
-
type CRSList,
|
|
3
|
-
} from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
|
|
1
|
+
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
|
|
4
2
|
import fileDownload from "js-file-download";
|
|
5
|
-
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
6
3
|
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import type { CameraSnapshot } from "@ogw_internal/stores/hybrid_viewer/camera";
|
|
11
|
-
import type { ModelComponentRecord } from "@ogw_front/stores/data_helpers/mesh.js";
|
|
12
|
-
import type { ModelComponentRelationRecord } from "@ogw_front/stores/data.js";
|
|
13
|
-
import { importWorkflowFromSnapshot } from "@ogw_front/utils/import_workflow";
|
|
14
|
-
import { oldestCrs } from "@ogw_front/utils/crs";
|
|
4
|
+
import type { ProjectSnapshot } from "@ogw_front/composables/project_manager_helpers/types";
|
|
5
|
+
import { resetProject } from "@ogw_front/composables/project_manager_helpers/reset";
|
|
6
|
+
import { restoreProject } from "@ogw_front/composables/project_manager_helpers/restore";
|
|
15
7
|
import { useAppStore } from "@ogw_front/stores/app";
|
|
16
8
|
import { useBackStore } from "@ogw_front/stores/back";
|
|
17
|
-
import { useCrsStore } from "@ogw_front/stores/crs";
|
|
18
9
|
import { useFeedbackStore } from "@ogw_front/stores/feedback";
|
|
19
|
-
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
20
|
-
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
21
|
-
|
|
22
|
-
interface ProjectDataSnapshot {
|
|
23
|
-
items: NewDataItem[];
|
|
24
|
-
modelComponents: ModelComponentRecord[];
|
|
25
|
-
modelComponentsRelations: ModelComponentRelationRecord[];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface ProjectSnapshot {
|
|
29
|
-
treeview?: TreeviewSnapshot;
|
|
30
|
-
data?: ProjectDataSnapshot;
|
|
31
|
-
hybridViewer?: CameraSnapshot;
|
|
32
|
-
dataStyle?: DataStyleSnapshot;
|
|
33
|
-
crs?: { projectCrs?: CRSList };
|
|
34
|
-
}
|
|
35
10
|
|
|
36
11
|
async function exportProject(): Promise<{ result: Blob }> {
|
|
37
12
|
const appStore = useAppStore();
|
|
@@ -47,50 +22,10 @@ async function exportProject(): Promise<{ result: Blob }> {
|
|
|
47
22
|
return { result };
|
|
48
23
|
}
|
|
49
24
|
|
|
50
|
-
async function releaseViewerDatabase(
|
|
51
|
-
client: ReturnType<typeof useViewerStore>["client"],
|
|
52
|
-
): Promise<void> {
|
|
53
|
-
if (
|
|
54
|
-
client !== undefined &&
|
|
55
|
-
client.getConnection !== undefined &&
|
|
56
|
-
client.getConnection().getSession !== undefined
|
|
57
|
-
) {
|
|
58
|
-
await client.getConnection().getSession().call("opengeodeweb_viewer.release_database", [{}]);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
async function importProjectToViewer(
|
|
63
|
-
client: ReturnType<typeof useViewerStore>["client"],
|
|
64
|
-
): Promise<void> {
|
|
65
|
-
if (
|
|
66
|
-
client !== undefined &&
|
|
67
|
-
client.getConnection !== undefined &&
|
|
68
|
-
client.getConnection().getSession !== undefined
|
|
69
|
-
) {
|
|
70
|
-
await client.getConnection().getSession().call("opengeodeweb_viewer.import_project", [{}]);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
25
|
async function importProject(file: File): Promise<void> {
|
|
75
26
|
const backStore = useBackStore();
|
|
76
|
-
const dataStyleStore = useDataStyleStore();
|
|
77
|
-
const viewerStore = useViewerStore();
|
|
78
|
-
const dataStore = useDataStore();
|
|
79
|
-
const treeviewStore = useTreeviewStore();
|
|
80
|
-
const hybridViewerStore = useHybridViewerStore();
|
|
81
|
-
const crsStore = useCrsStore();
|
|
82
|
-
|
|
83
|
-
await viewerStore.ws_connect();
|
|
84
|
-
|
|
85
|
-
await releaseViewerDatabase(viewerStore.client);
|
|
86
|
-
const resetVisualizationSchema = viewer_schemas.opengeodeweb_viewer.viewer.reset_visualization;
|
|
87
|
-
const timeout = undefined;
|
|
88
|
-
await viewerStore.request({ schema: resetVisualizationSchema, timeout });
|
|
89
27
|
|
|
90
|
-
|
|
91
|
-
await dataStore.clear();
|
|
92
|
-
hybridViewerStore.clear();
|
|
93
|
-
crsStore.reset();
|
|
28
|
+
await resetProject();
|
|
94
29
|
|
|
95
30
|
const importProjectSchema = back_schemas.opengeodeweb_back.import_project;
|
|
96
31
|
const form = new FormData();
|
|
@@ -103,34 +38,8 @@ async function importProject(file: File): Promise<void> {
|
|
|
103
38
|
const result = await backStore.request({ schema: importProjectSchema, params: form });
|
|
104
39
|
const snapshot: ProjectSnapshot = result.snapshot;
|
|
105
40
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
await importProjectToViewer(viewerStore.client);
|
|
109
|
-
|
|
110
|
-
treeviewStore.importStores(snapshot.treeview);
|
|
111
|
-
if (snapshot.data !== undefined) {
|
|
112
|
-
await dataStore.importStores(snapshot.data);
|
|
113
|
-
}
|
|
114
|
-
await hybridViewerStore.initHybridViewer();
|
|
115
|
-
|
|
116
|
-
const items = snapshot.data?.items ?? [];
|
|
117
|
-
await importWorkflowFromSnapshot(items);
|
|
118
|
-
// After every data item is added: on partial data the project CRS would follow them.
|
|
119
|
-
// A project saved without a project CRS takes the one of its oldest data, read in the
|
|
120
|
-
// Snapshot: the stored items carry the import time as creation date
|
|
121
|
-
if (snapshot.crs?.projectCrs === undefined) {
|
|
122
|
-
crsStore.importStores({ projectCrs: oldestCrs(snapshot.data?.items ?? []) });
|
|
123
|
-
} else {
|
|
124
|
-
crsStore.importStores(snapshot.crs);
|
|
125
|
-
}
|
|
126
|
-
await hybridViewerStore.importStores(snapshot.hybridViewer);
|
|
127
|
-
if (snapshot.dataStyle !== undefined) {
|
|
128
|
-
await dataStyleStore.importStores(snapshot.dataStyle);
|
|
129
|
-
}
|
|
130
|
-
await dataStyleStore.applyAllStylesFromState();
|
|
41
|
+
await restoreProject(snapshot);
|
|
131
42
|
|
|
132
|
-
treeviewStore.finalizeImportSelection();
|
|
133
|
-
treeviewStore.isImporting = false;
|
|
134
43
|
const feedbackStore = useFeedbackStore();
|
|
135
44
|
feedbackStore.add_success("Project imported successfully");
|
|
136
45
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
2
|
+
|
|
3
|
+
import { releaseViewerDatabase } from "@ogw_front/composables/project_manager_helpers/viewer_session";
|
|
4
|
+
import { useBasemapStore } from "@ogw_front/stores/basemap";
|
|
5
|
+
import { useCrsStore } from "@ogw_front/stores/crs";
|
|
6
|
+
import { useDataStore } from "@ogw_front/stores/data";
|
|
7
|
+
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
8
|
+
import { useTreeviewStore } from "@ogw_front/stores/treeview";
|
|
9
|
+
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
10
|
+
|
|
11
|
+
// Empties the viewer and every store, ready to receive an imported project.
|
|
12
|
+
async function resetProject(): Promise<void> {
|
|
13
|
+
const viewerStore = useViewerStore();
|
|
14
|
+
const dataStore = useDataStore();
|
|
15
|
+
const treeviewStore = useTreeviewStore();
|
|
16
|
+
const hybridViewerStore = useHybridViewerStore();
|
|
17
|
+
const crsStore = useCrsStore();
|
|
18
|
+
const basemapStore = useBasemapStore();
|
|
19
|
+
|
|
20
|
+
await viewerStore.ws_connect();
|
|
21
|
+
|
|
22
|
+
await releaseViewerDatabase(viewerStore.client);
|
|
23
|
+
const resetVisualizationSchema = viewer_schemas.opengeodeweb_viewer.viewer.reset_visualization;
|
|
24
|
+
const timeout = undefined;
|
|
25
|
+
await viewerStore.request({ schema: resetVisualizationSchema, timeout });
|
|
26
|
+
|
|
27
|
+
treeviewStore.clear();
|
|
28
|
+
await dataStore.clear();
|
|
29
|
+
hybridViewerStore.clear();
|
|
30
|
+
crsStore.reset();
|
|
31
|
+
basemapStore.reset();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { resetProject };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ProjectSnapshot } from "@ogw_front/composables/project_manager_helpers/types";
|
|
2
|
+
import { importProjectToViewer } from "@ogw_front/composables/project_manager_helpers/viewer_session";
|
|
3
|
+
import { importWorkflowFromSnapshot } from "@ogw_front/utils/import_workflow";
|
|
4
|
+
import { oldestCrs } from "@ogw_front/utils/crs";
|
|
5
|
+
import { useBasemapStore } from "@ogw_front/stores/basemap";
|
|
6
|
+
import { useCrsStore } from "@ogw_front/stores/crs";
|
|
7
|
+
import { useDataStore } from "@ogw_front/stores/data";
|
|
8
|
+
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
9
|
+
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
10
|
+
import { useTreeviewStore } from "@ogw_front/stores/treeview";
|
|
11
|
+
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
12
|
+
|
|
13
|
+
// After every data item is added: on partial data the project CRS would follow them.
|
|
14
|
+
// A project saved without a project CRS takes the one of its oldest data, read in the
|
|
15
|
+
// Snapshot: the stored items carry the import time as creation date
|
|
16
|
+
function restoreCrs(snapshot: ProjectSnapshot): void {
|
|
17
|
+
const crsStore = useCrsStore();
|
|
18
|
+
if (snapshot.crs?.projectCrs === undefined) {
|
|
19
|
+
crsStore.importStores({ projectCrs: oldestCrs(snapshot.data?.items ?? []) });
|
|
20
|
+
} else {
|
|
21
|
+
crsStore.importStores(snapshot.crs);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Loads a project snapshot into the (already reset) viewer and stores.
|
|
26
|
+
async function restoreProject(snapshot: ProjectSnapshot): Promise<void> {
|
|
27
|
+
const dataStyleStore = useDataStyleStore();
|
|
28
|
+
const viewerStore = useViewerStore();
|
|
29
|
+
const dataStore = useDataStore();
|
|
30
|
+
const treeviewStore = useTreeviewStore();
|
|
31
|
+
const hybridViewerStore = useHybridViewerStore();
|
|
32
|
+
const basemapStore = useBasemapStore();
|
|
33
|
+
|
|
34
|
+
treeviewStore.isImporting = true;
|
|
35
|
+
|
|
36
|
+
await importProjectToViewer(viewerStore.client);
|
|
37
|
+
|
|
38
|
+
treeviewStore.importStores(snapshot.treeview);
|
|
39
|
+
if (snapshot.data !== undefined) {
|
|
40
|
+
await dataStore.importStores(snapshot.data);
|
|
41
|
+
}
|
|
42
|
+
await hybridViewerStore.initHybridViewer();
|
|
43
|
+
|
|
44
|
+
const items = snapshot.data?.items ?? [];
|
|
45
|
+
await importWorkflowFromSnapshot(items);
|
|
46
|
+
restoreCrs(snapshot);
|
|
47
|
+
await basemapStore.importStores(snapshot.basemap);
|
|
48
|
+
await hybridViewerStore.importStores(snapshot.hybridViewer);
|
|
49
|
+
if (snapshot.dataStyle !== undefined) {
|
|
50
|
+
await dataStyleStore.importStores(snapshot.dataStyle);
|
|
51
|
+
}
|
|
52
|
+
await dataStyleStore.applyAllStylesFromState();
|
|
53
|
+
|
|
54
|
+
treeviewStore.finalizeImportSelection();
|
|
55
|
+
treeviewStore.isImporting = false;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { restoreProject };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ModelComponentRelationRecord, NewDataItem } from "@ogw_front/stores/data";
|
|
2
|
+
import type { BasemapSnapshot } from "@ogw_front/stores/basemap";
|
|
3
|
+
import type { CRSList } from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
|
|
4
|
+
import type { CameraSnapshot } from "@ogw_internal/stores/hybrid_viewer/camera";
|
|
5
|
+
import type { DataStyleSnapshot } from "@ogw_front/stores/data_style";
|
|
6
|
+
import type { ModelComponentRecord } from "@ogw_front/stores/data_helpers/mesh.js";
|
|
7
|
+
import type { TreeviewSnapshot } from "@ogw_front/stores/treeview";
|
|
8
|
+
|
|
9
|
+
interface ProjectDataSnapshot {
|
|
10
|
+
items: NewDataItem[];
|
|
11
|
+
modelComponents: ModelComponentRecord[];
|
|
12
|
+
modelComponentsRelations: ModelComponentRelationRecord[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface ProjectSnapshot {
|
|
16
|
+
treeview?: TreeviewSnapshot;
|
|
17
|
+
data?: ProjectDataSnapshot;
|
|
18
|
+
hybridViewer?: CameraSnapshot;
|
|
19
|
+
dataStyle?: DataStyleSnapshot;
|
|
20
|
+
crs?: { projectCrs?: CRSList };
|
|
21
|
+
basemap?: BasemapSnapshot;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type { ProjectSnapshot };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { useViewerStore } from "@ogw_front/stores/viewer";
|
|
2
|
+
|
|
3
|
+
type ViewerClient = ReturnType<typeof useViewerStore>["client"];
|
|
4
|
+
|
|
5
|
+
async function releaseViewerDatabase(client: ViewerClient): Promise<void> {
|
|
6
|
+
if (
|
|
7
|
+
client !== undefined &&
|
|
8
|
+
client.getConnection !== undefined &&
|
|
9
|
+
client.getConnection().getSession !== undefined
|
|
10
|
+
) {
|
|
11
|
+
await client.getConnection().getSession().call("opengeodeweb_viewer.release_database", [{}]);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async function importProjectToViewer(client: ViewerClient): Promise<void> {
|
|
16
|
+
if (
|
|
17
|
+
client !== undefined &&
|
|
18
|
+
client.getConnection !== undefined &&
|
|
19
|
+
client.getConnection().getSession !== undefined
|
|
20
|
+
) {
|
|
21
|
+
await client.getConnection().getSession().call("opengeodeweb_viewer.import_project", [{}]);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { importProjectToViewer, releaseViewerDatabase };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type MenuMetaData, useMenuStore } from "@ogw_front/stores/menu";
|
|
2
2
|
import type { Ref, ShallowRef } from "vue";
|
|
3
|
+
import { BASEMAP_GROUP_ID } from "@ogw_front/utils/basemap_tree";
|
|
3
4
|
import type { TreeMenuPayload } from "@ogw_front/utils/treeview";
|
|
4
5
|
import type { ViewerIdResult } from "@ogw_front/composables/use_overlapping_picker";
|
|
5
6
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
@@ -18,6 +19,15 @@ async function treeMenuTarget(
|
|
|
18
19
|
dataStore: ReturnType<typeof useDataStore>,
|
|
19
20
|
payload: TreeMenuPayload,
|
|
20
21
|
): Promise<MenuTarget | undefined> {
|
|
22
|
+
if (payload.context_type === "basemap") {
|
|
23
|
+
return {
|
|
24
|
+
id: payload.itemId,
|
|
25
|
+
meta_data: {
|
|
26
|
+
viewer_type: "basemap",
|
|
27
|
+
geode_object_type: payload.itemId === BASEMAP_GROUP_ID ? "Basemap" : "Map",
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
21
31
|
if (payload.context_type === "geode_object_type") {
|
|
22
32
|
const [referenceId] = payload.targetIds;
|
|
23
33
|
if (referenceId === undefined) {
|