@eodash/eodash 5.6.1 → 5.7.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/core/client/components/DashboardLayout.vue +1 -1
- package/core/client/components/EodashOverlay.vue +27 -4
- package/core/client/composables/DefineEodash.js +0 -1
- package/core/client/composables/DefineWidgets.js +3 -1
- package/core/client/composables/index.js +6 -2
- package/core/client/eodashSTAC/EodashCollection.js +79 -45
- package/core/client/eodashSTAC/cql.js +64 -0
- package/core/client/eodashSTAC/createLayers.js +192 -125
- package/core/client/eodashSTAC/helpers.js +423 -97
- package/core/client/eodashSTAC/mosaic.js +416 -0
- package/core/client/plugins/axios.js +31 -1
- package/core/client/store/actions.js +1 -1
- package/core/client/store/stac.js +25 -4
- package/core/client/store/states.js +20 -2
- package/core/client/types.ts +155 -29
- package/core/client/utils/bands-editor/exampleSchema.json +50 -50
- package/core/client/utils/index.js +4 -0
- package/core/client/utils/states.js +10 -0
- package/dist/client/{DashboardLayout-CqMb7OXc.js → DashboardLayout-ePbdvUTE.js} +5 -5
- package/dist/client/{DynamicWebComponent-DqKqTf7l.js → DynamicWebComponent-g5SdRbjY.js} +1 -1
- package/dist/client/{EodashChart-PkUQfH0k.js → EodashChart-ChrkA5oS.js} +7 -6
- package/dist/client/{EodashDatePicker-DLJGdTtX.js → EodashDatePicker-CY1TrsDo.js} +3 -3
- package/dist/client/{EodashItemFilter-Dk8KjFcX.js → EodashItemFilter-DzshHDlS.js} +2 -1
- package/dist/client/{EodashLayerControl-CC1Cogrn.js → EodashLayerControl-DMCeMkSd.js} +70 -22
- package/dist/client/{EodashLayoutSwitcher-5WZYd6rr.js → EodashLayoutSwitcher-iJ8mX1rF.js} +3 -3
- package/dist/client/EodashMapBtns-C7Cr7q5Y.js +592 -0
- package/dist/client/EodashStacInfo-K7-iuXa7.js +169 -0
- package/dist/client/{EodashTools-CGZtTh45.js → EodashTools-BEK7e7JM.js} +4 -4
- package/dist/client/{ExportState-Ce0ZnrX_.js → ExportState-CqIzfMYQ.js} +6 -168
- package/dist/client/{Footer-CnZqEiop.js → Footer-1P0cmBOZ.js} +1 -1
- package/dist/client/{Header-Dr5PBIm8.js → Header-CkkBaBNh.js} +2 -2
- package/dist/client/MobileLayout-BPf49kDU.js +118 -0
- package/dist/client/{PopUp-DjvE_71e.js → PopUp-DPZq5SWI.js} +4 -168
- package/dist/client/{ProcessList-kf3olI7W.js → ProcessList-DuI6WpS1.js} +5 -5
- package/dist/client/VDivider-Bj9LG_JV.js +168 -0
- package/dist/client/{VImg-Bj6uWt6j.js → VImg-Ddv5OyMz.js} +2 -2
- package/dist/client/{VMain-Cm0UmKGi.js → VMain-7yqk_qC3.js} +1 -1
- package/dist/client/{VTooltip-DbBu-ky3.js → VTooltip-2hAJyEoa.js} +2 -2
- package/dist/client/{WidgetsContainer-CfLnd44U.js → WidgetsContainer-2DOrlwCB.js} +1 -1
- package/dist/client/{asWebComponent-DfULAbpq.js → asWebComponent-BlFN2lkB.js} +493 -335
- package/dist/client/{async-CIbKXEEe.js → async-B2H8ZwUK.js} +21 -10
- package/dist/client/create-layers-config-u_vn5hPk.js +182 -0
- package/dist/client/dialog-transition-BrMkMiNa.js +170 -0
- package/dist/client/eo-dash.js +1 -1
- package/dist/client/{forwardRefs-yj3VWOK5.js → forwardRefs-DAlror6d.js} +8 -87
- package/dist/client/{handling-s8xt2JwF.js → handling-B6I1V5eG.js} +123 -85
- package/dist/client/{helpers-DAVGYl_f.js → helpers-CBqIUSXJ.js} +3034 -1649
- package/dist/client/index-BWq1ZKaV.js +3168 -0
- package/dist/client/{index-CYz6dT7K.js → index-CJ9UI3ln.js} +2 -2
- package/dist/client/index-DXLz4sFR.js +442 -0
- package/dist/client/{index-4TrjfJ32.js → index-DhKU6KqM.js} +230 -231
- package/dist/client/{index-Bu8BMA9q.js → index-DjQlbWbJ.js} +70 -83
- package/dist/client/material-symbols-outlined.woff2 +0 -0
- package/dist/client/material-symbols-rounded.woff2 +0 -0
- package/dist/client/material-symbols-sharp.woff2 +0 -0
- package/dist/client/material-symbols-subset.woff2 +0 -0
- package/dist/client/mosaic-BFYLEwyx.js +455 -0
- package/dist/client/templates.js +250 -119
- package/dist/client/{transition-DaOsiD4u.js → transition-D_W6Wn9v.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/types.d.ts +4 -0
- package/dist/types/core/client/composables/DefineEodash.d.ts +1 -1
- package/dist/types/core/client/composables/index.d.ts +1 -3
- package/dist/types/core/client/eodashSTAC/EodashCollection.d.ts +62 -31
- package/dist/types/core/client/eodashSTAC/cql.d.ts +15 -0
- package/dist/types/core/client/eodashSTAC/createLayers.d.ts +44 -25
- package/dist/types/core/client/eodashSTAC/helpers.d.ts +78 -18
- package/dist/types/core/client/eodashSTAC/mosaic.d.ts +56 -0
- package/dist/types/core/client/store/stac.d.ts +31 -7
- package/dist/types/core/client/store/states.d.ts +24 -2
- package/dist/types/core/client/types.d.ts +131 -25
- package/dist/types/core/client/utils/states.d.ts +12 -0
- package/dist/types/templates/baseConfig.d.ts +1 -88
- package/dist/types/templates/compare.d.ts +32 -3
- package/dist/types/templates/expert.d.ts +18 -0
- package/dist/types/templates/explore.d.ts +9 -1
- package/dist/types/templates/lite.d.ts +11 -0
- package/dist/types/widgets/EodashChart.vue.d.ts +5 -3
- package/dist/types/widgets/EodashItemCatalog/index.vue.d.ts +129 -2
- package/dist/types/widgets/EodashItemCatalog/methods/filters.d.ts +28 -6
- package/dist/types/widgets/EodashItemCatalog/methods/handlers.d.ts +17 -4
- package/dist/types/widgets/EodashItemCatalog/methods/map.d.ts +16 -4
- package/dist/types/widgets/EodashLayerControl.vue.d.ts +36 -17
- package/dist/types/widgets/EodashMap/EodashMapBtns.vue.d.ts +23 -10
- package/dist/types/widgets/EodashMap/index.vue.d.ts +91 -35
- package/dist/types/widgets/EodashMap/methods/create-layers-config.d.ts +1 -8
- package/dist/types/widgets/EodashMap/methods/index.d.ts +5 -1
- package/dist/types/widgets/EodashMap/methods/use-map-loading.d.ts +1 -0
- package/dist/types/widgets/EodashProcess/index.vue.d.ts +5 -3
- package/dist/types/widgets/EodashProcess/methods/composables.d.ts +1 -1
- package/dist/types/widgets/EodashProcess/methods/handling.d.ts +13 -8
- package/dist/types/widgets/EodashProcess/states.d.ts +1 -1
- package/dist/types/widgets/EodashStacInfo.vue.d.ts +20 -0
- package/dist/types/widgets/EodashTimeSlider/index.vue.d.ts +54 -0
- package/dist/types/widgets/EodashTimeSlider/methods/index.d.ts +34 -0
- package/dist/types/widgets/EodashTimeSlider/types.d.ts +52 -0
- package/dist/types/widgets/EodashTools.vue.d.ts +5 -5
- package/package.json +46 -46
- package/templates/baseConfig.js +36 -6
- package/templates/compare.js +62 -7
- package/templates/expert.js +23 -0
- package/templates/explore.js +11 -5
- package/templates/lite.js +14 -0
- package/widgets/EodashChart.vue +1 -0
- package/widgets/EodashItemCatalog/index.vue +363 -35
- package/widgets/EodashItemCatalog/methods/filters.js +134 -70
- package/widgets/EodashItemCatalog/methods/handlers.js +113 -19
- package/widgets/EodashItemCatalog/methods/map.js +142 -28
- package/widgets/EodashLayerControl.vue +64 -14
- package/widgets/EodashMap/EodashMapBtns.vue +153 -47
- package/widgets/EodashMap/index.vue +101 -105
- package/widgets/EodashMap/methods/btns.js +37 -5
- package/widgets/EodashMap/methods/create-layers-config.js +18 -16
- package/widgets/EodashMap/methods/index.js +89 -8
- package/widgets/EodashMap/methods/use-map-loading.js +52 -0
- package/widgets/EodashProcess/index.vue +2 -1
- package/widgets/EodashProcess/methods/async.js +19 -8
- package/widgets/EodashProcess/methods/composables.js +63 -77
- package/widgets/EodashProcess/methods/custom-endpoints/chart/sentinelhub-endpoint.js +9 -5
- package/widgets/EodashProcess/methods/custom-endpoints/chart/veda-endpoint.js +7 -4
- package/widgets/EodashProcess/methods/handling.js +105 -72
- package/widgets/EodashProcess/states.js +1 -1
- package/widgets/EodashStacInfo.vue +64 -2
- package/widgets/EodashTimeSlider/index.vue +208 -0
- package/widgets/EodashTimeSlider/methods/index.js +236 -0
- package/widgets/EodashTimeSlider/types.ts +54 -0
- package/dist/client/EodashMapBtns-BHrSDNoC.js +0 -435
- package/dist/client/EodashStacInfo-B90wobPc.js +0 -107
- package/dist/client/EodashTimeSlider-5vm7F3ju.js +0 -53
- package/dist/client/MobileLayout-DyMjaeif.js +0 -118
- package/dist/client/index-CugS__t5.js +0 -570
- package/dist/types/widgets/EodashTimeSlider.vue.d.ts +0 -15
- package/widgets/EodashTimeSlider.vue +0 -40
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveComponent, render, h, mergeProps } from 'vue';
|
|
2
|
-
import {
|
|
3
|
-
import { V as VTooltip } from './VTooltip-
|
|
2
|
+
import { O as consoleError, ag as isObject } from './asWebComponent-BlFN2lkB.js';
|
|
3
|
+
import { V as VTooltip } from './VTooltip-2hAJyEoa.js';
|
|
4
4
|
|
|
5
5
|
// Utilities
|
|
6
6
|
function useDirectiveComponent(component, props) {
|
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import { useTemplateRef, ref, computed, onMounted, openBlock, createElementBlock, unref, createElementVNode, createCommentVNode } from 'vue';
|
|
2
|
+
import { S as eodashCollections, af as removeLayers, $ as sanitizeBbox, f as axios, n as mapEl, B as getLayers, H as datetime } from './helpers-CBqIUSXJ.js';
|
|
3
|
+
import '@eox/timecontrol';
|
|
4
|
+
import '@eox/itemfilter';
|
|
5
|
+
import { storeToRefs } from 'pinia';
|
|
6
|
+
import { _ as _export_sfc, H as useSTAcStore } from './asWebComponent-BlFN2lkB.js';
|
|
7
|
+
import { c as createLayersConfig } from './create-layers-config-u_vn5hPk.js';
|
|
8
|
+
import { b as buildCqlFilter, u as useMosaicState, a as useScheduleMosaicUpdate, c as useInitMosaic } from './mosaic-BFYLEwyx.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @param {string} stacEndpoint
|
|
12
|
+
* @param {[string, string]} selectedRange
|
|
13
|
+
* @param {import("../types").TimelineExportEventDetail["selectedRangeItems"]} selectedRangeItems
|
|
14
|
+
* @param {import("vue").Ref<import("stac-ts").StacCollection|null>} selectedStac
|
|
15
|
+
* @param {import("@/types").ItemFilterFilters} filters
|
|
16
|
+
*/
|
|
17
|
+
async function createAnimationLayers(
|
|
18
|
+
stacEndpoint,
|
|
19
|
+
selectedRange,
|
|
20
|
+
selectedRangeItems,
|
|
21
|
+
selectedStac,
|
|
22
|
+
filters,
|
|
23
|
+
) {
|
|
24
|
+
if (eodashCollections[0].isAPI) {
|
|
25
|
+
return await createAPILayers(
|
|
26
|
+
stacEndpoint,
|
|
27
|
+
{ min: selectedRange[0], max: selectedRange[1] },
|
|
28
|
+
mapEl.value?.lonLatExtent,
|
|
29
|
+
selectedStac,
|
|
30
|
+
filters,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
const { collections: hiddenCollections, layers: hiddenLayers } =
|
|
34
|
+
getHiddenLayers([...getLayers()]);
|
|
35
|
+
|
|
36
|
+
return await Promise.all(
|
|
37
|
+
Object.values(selectedRangeItems).flatMap(async (itemSet) => {
|
|
38
|
+
/** @type {Array<{ layers: Record<string, any>[]; date: string }>} */
|
|
39
|
+
const mapLayersArr = [];
|
|
40
|
+
for (const dateItem of itemSet) {
|
|
41
|
+
await createLayersConfig(
|
|
42
|
+
selectedStac.value,
|
|
43
|
+
eodashCollections.filter(
|
|
44
|
+
(collection) =>
|
|
45
|
+
!hiddenCollections.includes(collection.collectionStac?.id ?? ""),
|
|
46
|
+
),
|
|
47
|
+
dateItem.originalDate,
|
|
48
|
+
).then((layers) => {
|
|
49
|
+
//@ts-expect-error createLayersConfig is not typed strictly
|
|
50
|
+
layers = removeLayers(layers, hiddenLayers);
|
|
51
|
+
//@ts-expect-error createLayersConfig is not typed strictly
|
|
52
|
+
layers = restoreLayersVisibility(layers);
|
|
53
|
+
layers = anonimizeLayersCORS(layers);
|
|
54
|
+
mapLayersArr.push({
|
|
55
|
+
layers,
|
|
56
|
+
date: dateItem.originalDate,
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return mapLayersArr;
|
|
61
|
+
}),
|
|
62
|
+
).then((results) => results.flat());
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* @param {string} stacEndpoint
|
|
67
|
+
* @param {{min: string, max: string}} date
|
|
68
|
+
* @param {number[] | undefined} bbox
|
|
69
|
+
* @param {import("vue").Ref<import("stac-ts").StacCollection|null>} selectedStac
|
|
70
|
+
* @param {import("@/types").ItemFilterFilters} filters
|
|
71
|
+
* @return {Promise<Array<{ layers: Record<string, any>[]; date: string }>>}
|
|
72
|
+
*/
|
|
73
|
+
async function createAPILayers(
|
|
74
|
+
stacEndpoint,
|
|
75
|
+
date = { min: "", max: "" },
|
|
76
|
+
bbox,
|
|
77
|
+
selectedStac,
|
|
78
|
+
filters,
|
|
79
|
+
) {
|
|
80
|
+
if (!bbox) {
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
const url = new URL(stacEndpoint + "/search");
|
|
84
|
+
url.searchParams.set("limit", "100");
|
|
85
|
+
url.searchParams.set("collections", selectedStac.value?.id ?? "");
|
|
86
|
+
url.searchParams.set(
|
|
87
|
+
"datetime",
|
|
88
|
+
`${new Date(date.min).toISOString()}/${new Date(date.max).toISOString()}`,
|
|
89
|
+
);
|
|
90
|
+
url.searchParams.set("bbox", sanitizeBbox(bbox).join(","));
|
|
91
|
+
|
|
92
|
+
const stacFilter = buildCqlFilter(filters);
|
|
93
|
+
if (stacFilter) {
|
|
94
|
+
url.searchParams.set("filter", stacFilter);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** @type {import("stac-ts").StacItem[]} */
|
|
98
|
+
const items = await axios
|
|
99
|
+
.get(url.href)
|
|
100
|
+
.then((res) => res.data.features)
|
|
101
|
+
.catch((err) => {
|
|
102
|
+
console.error("[eodash] Error fetching items for animation:", err);
|
|
103
|
+
return [];
|
|
104
|
+
});
|
|
105
|
+
if (!items || !items.length) {
|
|
106
|
+
console.warn("[eodash] No items found for animation.");
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
const { collections: hiddenCollections, layers: hiddenLayers } =
|
|
110
|
+
getHiddenLayers([...getLayers()]);
|
|
111
|
+
return await Promise.all(
|
|
112
|
+
items.map(async (item) => {
|
|
113
|
+
/** @type {Array<{ layers: Record<string, any>[]; date: string }>} */
|
|
114
|
+
const mapLayersArr = [];
|
|
115
|
+
await createLayersConfig(
|
|
116
|
+
selectedStac.value,
|
|
117
|
+
eodashCollections.filter(
|
|
118
|
+
(collection) =>
|
|
119
|
+
!hiddenCollections.includes(collection.collectionStac?.id ?? ""),
|
|
120
|
+
),
|
|
121
|
+
item,
|
|
122
|
+
).then((layers) => {
|
|
123
|
+
//@ts-expect-error createLayersConfig is not typed strictly
|
|
124
|
+
layers = removeLayers(layers, hiddenLayers);
|
|
125
|
+
//@ts-expect-error createLayersConfig is not typed strictly
|
|
126
|
+
layers = restoreLayersVisibility(layers);
|
|
127
|
+
layers = anonimizeLayersCORS(layers);
|
|
128
|
+
mapLayersArr.push({
|
|
129
|
+
layers,
|
|
130
|
+
date: /** @type {string} */ (item.properties.datetime),
|
|
131
|
+
});
|
|
132
|
+
return mapLayersArr;
|
|
133
|
+
});
|
|
134
|
+
return mapLayersArr;
|
|
135
|
+
}),
|
|
136
|
+
).then((results) => results.flat());
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
*
|
|
140
|
+
* @param {Record<string, any>[]} layers
|
|
141
|
+
* @returns {Record<string, any>[]}
|
|
142
|
+
*/
|
|
143
|
+
function anonimizeLayersCORS(layers) {
|
|
144
|
+
return layers.map((layer) => {
|
|
145
|
+
if (layer.type === "Group") {
|
|
146
|
+
layer.layers = anonimizeLayersCORS(layer.layers);
|
|
147
|
+
return layer;
|
|
148
|
+
}
|
|
149
|
+
if (layer.source) {
|
|
150
|
+
layer.source.crossOrigin = "anonymous";
|
|
151
|
+
}
|
|
152
|
+
return layer;
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* returns the list of layers that has visibility hidden
|
|
157
|
+
* @param {import("@eox/map").EoxLayer[]} layers
|
|
158
|
+
* @returns {{ collections: string[]; layers: string[] }}
|
|
159
|
+
*/
|
|
160
|
+
function getHiddenLayers(layers) {
|
|
161
|
+
/** @type {{ collections: string[]; layers: string[] }} */
|
|
162
|
+
const result = { collections: [], layers: [] };
|
|
163
|
+
|
|
164
|
+
for (const layer of layers) {
|
|
165
|
+
// check inner layers if it's a group layer first
|
|
166
|
+
if (layer.type === "Group" && Array.isArray(layer.layers)) {
|
|
167
|
+
const childResult = getHiddenLayers(layer.layers);
|
|
168
|
+
for (const col of childResult.collections) {
|
|
169
|
+
if (!result.collections.includes(col)) {
|
|
170
|
+
result.collections.push(col);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
for (const lyr of childResult.layers) {
|
|
174
|
+
if (!result.layers.includes(lyr)) {
|
|
175
|
+
result.layers.push(lyr);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (!layer.properties?.id) {
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const olLayer = mapEl.value?.getLayerById(layer.properties?.id);
|
|
185
|
+
if (!olLayer) {
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (olLayer.getVisible() === false) {
|
|
190
|
+
const refId = layer.properties.id;
|
|
191
|
+
if (refId) {
|
|
192
|
+
if (refId.includes(";:;")) {
|
|
193
|
+
// Check if this looks like a typical eodash collection ID with separator
|
|
194
|
+
const parts = refId.split(";:;");
|
|
195
|
+
if (parts.length > 2) {
|
|
196
|
+
const prefix = parts[0];
|
|
197
|
+
if (!result.collections.includes(prefix)) {
|
|
198
|
+
result.collections.push(prefix);
|
|
199
|
+
}
|
|
200
|
+
} else {
|
|
201
|
+
// It has a separator but might just be a base layer like `layerId;:;EPSG`
|
|
202
|
+
if (!result.layers.includes(refId)) {
|
|
203
|
+
result.layers.push(refId);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
} else {
|
|
207
|
+
if (!result.layers.includes(refId)) {
|
|
208
|
+
result.layers.push(refId);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return result;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Iterates through a list of layers and updates layer.properties.visible to true
|
|
220
|
+
* if it is set to false
|
|
221
|
+
* @param {import("@eox/map").EoxLayer[]} layers
|
|
222
|
+
* @returns {import("@eox/map").EoxLayer[]}
|
|
223
|
+
*/
|
|
224
|
+
function restoreLayersVisibility(layers) {
|
|
225
|
+
for (const layer of layers) {
|
|
226
|
+
if (layer.properties && layer.properties.visible === false) {
|
|
227
|
+
layer.properties.visible = true;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (layer.type === "Group" && Array.isArray(layer.layers)) {
|
|
231
|
+
restoreLayersVisibility(layer.layers);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return layers;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const _style_0 = "eox-itemfilter[data-v-a90da3dc]{--inline-container-height: 40px}";
|
|
238
|
+
|
|
239
|
+
const _hoisted_1 = [".for", ".animate"];
|
|
240
|
+
const _hoisted_2 = { class: "d-flex g-10 align-center" };
|
|
241
|
+
const _hoisted_3 = [".filterProperties"];
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
const _sfc_main = {
|
|
245
|
+
__name: 'index',
|
|
246
|
+
props: {
|
|
247
|
+
filters: {
|
|
248
|
+
/** @type {import("vue").PropType<import("@eox/itemfilter").EOxItemFilter["filterProperties"]>} */
|
|
249
|
+
type: Array,
|
|
250
|
+
default: () => [],
|
|
251
|
+
},
|
|
252
|
+
animate: {
|
|
253
|
+
type: Boolean,
|
|
254
|
+
default: true,
|
|
255
|
+
},
|
|
256
|
+
useMosaic: {
|
|
257
|
+
type: Boolean,
|
|
258
|
+
default: false,
|
|
259
|
+
},
|
|
260
|
+
mosaicIndicators: {
|
|
261
|
+
/** @type {import("vue").PropType<string[]>} */
|
|
262
|
+
type: Array,
|
|
263
|
+
default: () => [],
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
setup(__props) {
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
/** @type {import("vue").ShallowRef<HTMLElement>} */
|
|
271
|
+
const timesliderEl = useTemplateRef("eoxTimecontrol");
|
|
272
|
+
|
|
273
|
+
const startDate = new Date(datetime.value);
|
|
274
|
+
const endDate = new Date(startDate.getTime() + 24 * 60 * 60 * 1000);
|
|
275
|
+
|
|
276
|
+
const selectedRange = /** @type {import("vue").Ref<[string, string]>} */ (
|
|
277
|
+
ref([startDate, endDate].map((d) => d.toISOString()))
|
|
278
|
+
);
|
|
279
|
+
const initDate = [startDate.toISOString().split("T")[0]];
|
|
280
|
+
|
|
281
|
+
/** @type {import("vue").Ref<import("@/types").ItemFilterFilters>} */
|
|
282
|
+
const currentFilters = ref({});
|
|
283
|
+
|
|
284
|
+
const hasMultipleItems = computed(() => {
|
|
285
|
+
return eodashCollections.some((ec) => {
|
|
286
|
+
const itemLinks = ec.collectionStac?.links.filter((l) => l.rel === "item");
|
|
287
|
+
const itemsLink = ec.collectionStac?.links.some((l) => l.rel === "items");
|
|
288
|
+
return (itemLinks && itemLinks.length > 1) || itemsLink;
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
const store = useSTAcStore();
|
|
293
|
+
const { selectedStac, stacEndpoint } = storeToRefs(store);
|
|
294
|
+
const { mosaicEndpoint } = useMosaicState();
|
|
295
|
+
|
|
296
|
+
const isMosaicEnabled = computed(() => __props.useMosaic && !!mosaicEndpoint.value);
|
|
297
|
+
|
|
298
|
+
const scheduleMosaicUpdate = useScheduleMosaicUpdate();
|
|
299
|
+
|
|
300
|
+
useInitMosaic(
|
|
301
|
+
__props.useMosaic ? mosaicEndpoint.value : null,
|
|
302
|
+
selectedRange,
|
|
303
|
+
__props.mosaicIndicators,
|
|
304
|
+
);
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Handles the selection event from the time control component.
|
|
308
|
+
* It finds the closest item to the "from" selected date
|
|
309
|
+
* and updates the global datetime state with that item's original date.
|
|
310
|
+
*
|
|
311
|
+
* @param {CustomEvent<import("./types").TimelineSelectionEventDetail>} e
|
|
312
|
+
*/
|
|
313
|
+
const onSelect = (e) => {
|
|
314
|
+
const { selectedItems, date } = e.detail;
|
|
315
|
+
// Update the selected range with the new dates
|
|
316
|
+
selectedRange.value = date;
|
|
317
|
+
|
|
318
|
+
// if mosaic is enabled, we don't need to find the closest item,
|
|
319
|
+
// we just update the mosaic layer with the new time range and filters
|
|
320
|
+
if (isMosaicEnabled.value) {
|
|
321
|
+
scheduleMosaicUpdate(
|
|
322
|
+
mosaicEndpoint.value,
|
|
323
|
+
selectedRange.value,
|
|
324
|
+
currentFilters.value,
|
|
325
|
+
);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
const allItems = Object.keys(selectedItems ?? {}).flatMap(
|
|
330
|
+
(id) => selectedItems[id],
|
|
331
|
+
);
|
|
332
|
+
if (!allItems.length) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
const [from] = date;
|
|
336
|
+
const fromDate = new Date(from).getTime();
|
|
337
|
+
|
|
338
|
+
const closestItem = allItems.reduce((prev, curr) => {
|
|
339
|
+
const prevDiff = Math.abs(new Date(prev.originalDate).getTime() - fromDate);
|
|
340
|
+
const currDiff = Math.abs(new Date(curr.originalDate).getTime() - fromDate);
|
|
341
|
+
return currDiff < prevDiff ? curr : prev;
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
if (closestItem) {
|
|
345
|
+
datetime.value = closestItem.originalDate;
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Handles filter changes from eox-itemfilter (e.g. cloud cover slider).
|
|
351
|
+
* Updates the mosaic layer with the new filter state.
|
|
352
|
+
*
|
|
353
|
+
* @param {CustomEvent<import("./types").ItemFilterEventDetail>} e
|
|
354
|
+
*/
|
|
355
|
+
const onFilter = (e) => {
|
|
356
|
+
if (!isMosaicEnabled.value) return;
|
|
357
|
+
const { filters } = e.detail;
|
|
358
|
+
currentFilters.value = filters;
|
|
359
|
+
scheduleMosaicUpdate(mosaicEndpoint.value, selectedRange.value, filters);
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
*
|
|
364
|
+
* @param {CustomEvent<import("./types").TimelineExportEventDetail>} evt
|
|
365
|
+
*/
|
|
366
|
+
const onExport = async (evt) => {
|
|
367
|
+
const { generate, selectedRangeItems, filters } = evt.detail;
|
|
368
|
+
|
|
369
|
+
if (!stacEndpoint.value) {
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
const mapLayers = await createAnimationLayers(
|
|
374
|
+
stacEndpoint.value,
|
|
375
|
+
selectedRange.value,
|
|
376
|
+
selectedRangeItems,
|
|
377
|
+
selectedStac,
|
|
378
|
+
filters,
|
|
379
|
+
);
|
|
380
|
+
|
|
381
|
+
if (!mapLayers?.length) {
|
|
382
|
+
console.warn("[eodash] No map layers generated for the animation.");
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
generate({
|
|
387
|
+
mapLayers,
|
|
388
|
+
});
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
onMounted(() => {
|
|
392
|
+
const parentDiv = timesliderEl.value?.parentElement;
|
|
393
|
+
const layoutItem = parentDiv?.parentElement;
|
|
394
|
+
if (parentDiv && layoutItem && __props.animate) {
|
|
395
|
+
parentDiv.style.overflow = "visible";
|
|
396
|
+
layoutItem.style.overflow = "visible";
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
return (_ctx, _cache) => {
|
|
401
|
+
return (hasMultipleItems.value)
|
|
402
|
+
? (openBlock(), createElementBlock("eox-timecontrol", {
|
|
403
|
+
key: unref(unref(mapEl)),
|
|
404
|
+
ref: "eoxTimecontrol",
|
|
405
|
+
".for": unref(mapEl),
|
|
406
|
+
onSelect: onSelect,
|
|
407
|
+
titleKey: "title",
|
|
408
|
+
class: "pa-4",
|
|
409
|
+
".externalMapRendering": true,
|
|
410
|
+
".animate": __props.animate,
|
|
411
|
+
".initDate": initDate
|
|
412
|
+
}, [
|
|
413
|
+
createElementVNode("div", _hoisted_2, [
|
|
414
|
+
_cache[0] || (_cache[0] = createElementVNode("eox-timecontrol-date", { class: "flex-grow-1" }, null, -1 /* CACHED */)),
|
|
415
|
+
createElementVNode("eox-timecontrol-picker", {
|
|
416
|
+
".range": false,
|
|
417
|
+
".showDots": true,
|
|
418
|
+
".showItems": true,
|
|
419
|
+
".popup": true
|
|
420
|
+
}, null, 32 /* NEED_HYDRATION */),
|
|
421
|
+
(__props.filters.length)
|
|
422
|
+
? (openBlock(), createElementBlock("eox-itemfilter", {
|
|
423
|
+
key: 0,
|
|
424
|
+
class: "mx-4",
|
|
425
|
+
".inlineMode": true,
|
|
426
|
+
showResults: false,
|
|
427
|
+
".filterProperties": __props.filters,
|
|
428
|
+
onFilter: onFilter
|
|
429
|
+
}, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_3))
|
|
430
|
+
: createCommentVNode("v-if", true),
|
|
431
|
+
createElementVNode("eox-timecontrol-timelapse", { onExport: onExport }, null, 32 /* NEED_HYDRATION */)
|
|
432
|
+
]),
|
|
433
|
+
_cache[1] || (_cache[1] = createElementVNode("eox-timecontrol-timeline", { class: "mt-2" }, null, -1 /* CACHED */))
|
|
434
|
+
], 40 /* PROPS, NEED_HYDRATION */, _hoisted_1))
|
|
435
|
+
: createCommentVNode("v-if", true)
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
};
|
|
440
|
+
const index = /*#__PURE__*/_export_sfc(_sfc_main, [['styles',[_style_0]],['__scopeId',"data-v-a90da3dc"]]);
|
|
441
|
+
|
|
442
|
+
export { index as default };
|