@eodash/eodash 5.0.0-alpha.2.9 → 5.0.0-processing
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/README.md +1 -1
- package/core/client/App.vue +13 -1
- package/core/client/asWebComponent.js +13 -3
- package/core/client/components/DashboardLayout.vue +6 -2
- package/core/client/composables/DefineEodash.js +1 -1
- package/core/client/composables/EodashMap.js +349 -0
- package/core/client/composables/EodashProcess.js +575 -0
- package/core/client/composables/index.js +107 -24
- package/core/client/eodash.js +83 -10
- package/core/client/plugins/axios.js +8 -0
- package/core/client/plugins/index.js +2 -1
- package/core/client/store/Actions.js +63 -12
- package/core/client/store/States.js +19 -0
- package/core/client/store/stac.js +98 -8
- package/core/client/types.d.ts +25 -18
- package/core/client/utils/createLayers.js +313 -0
- package/core/client/utils/eodashSTAC.js +320 -170
- package/core/client/utils/helpers.js +369 -9
- package/core/client/utils/keys.js +2 -0
- package/core/client/utils/states.js +17 -0
- package/core/client/views/Dashboard.vue +17 -46
- package/core/client/vite-env.d.ts +1 -9
- package/dist/client/DashboardLayout-CVMJ4l8M.js +87 -0
- package/dist/client/DynamicWebComponent-Cv8n457T.js +88 -0
- package/dist/client/EodashDatePicker-VVkiPmpc.js +394 -0
- package/dist/client/EodashItemFilter-CugWNQ86.js +194 -0
- package/dist/client/EodashLayerControl-53WghA8G.js +110 -0
- package/dist/client/EodashMap-CQnOePpy.js +486 -0
- package/dist/client/EodashMapBtns-uaRwFtfB.js +66 -0
- package/dist/client/EodashProcess-cF0unIy8.js +1477 -0
- package/dist/client/ExportState-BT8MLAW7.js +644 -0
- package/dist/client/Footer-C6GUG84G.js +141 -0
- package/dist/client/Header-D2dtCWp8.js +437 -0
- package/dist/client/IframeWrapper-BgM9aU8f.js +28 -0
- package/dist/client/MobileLayout-BAo8Wr8T.js +1210 -0
- package/dist/client/PopUp-Bm01q7Ko.js +389 -0
- package/dist/client/VImg-B8AbetCE.js +384 -0
- package/dist/client/VMain-DnGlQUyr.js +43 -0
- package/dist/client/VOverlay-B8Qj7LRG.js +1453 -0
- package/dist/client/WidgetsContainer-CwXRRLS1.js +83 -0
- package/dist/client/asWebComponent-DUUoR7MZ.js +11621 -0
- package/dist/client/eo-dash.js +2 -6
- package/dist/client/forwardRefs-CZJhEAKW.js +245 -0
- package/dist/client/index-DlIO7sJ3.js +199 -0
- package/dist/client/ssrBoot-BP7SYRyC.js +22 -0
- package/dist/client/style.css +2 -2
- package/dist/client/transition-BiR8wMn1.js +37 -0
- package/dist/node/cli.js +4 -4
- package/dist/node/types.d.ts +2 -0
- package/dist/types/core/client/App.vue.d.ts +7 -0
- package/dist/types/core/client/asWebComponent.d.ts +9 -0
- package/dist/types/core/client/components/DashboardLayout.vue.d.ts +2 -0
- package/dist/types/core/client/components/DynamicWebComponent.vue.d.ts +18 -0
- package/dist/types/core/client/components/ErrorAlert.vue.d.ts +2 -0
- package/dist/types/core/client/components/Footer.vue.d.ts +2 -0
- package/dist/types/core/client/components/Header.vue.d.ts +2 -0
- package/dist/types/core/client/components/IframeWrapper.vue.d.ts +7 -0
- package/dist/types/core/client/components/Loading.vue.d.ts +2 -0
- package/dist/types/core/client/components/MobileLayout.vue.d.ts +2 -0
- package/dist/types/core/client/composables/DefineEodash.d.ts +2 -0
- package/dist/types/core/client/composables/DefineTemplate.d.ts +15 -0
- package/dist/types/core/client/composables/DefineWidgets.d.ts +14 -0
- package/dist/types/core/client/composables/EodashMap.d.ts +5 -0
- package/dist/types/core/client/composables/index.d.ts +30 -0
- package/dist/types/core/client/eodash.d.ts +8 -0
- package/dist/types/core/client/main.d.ts +2 -0
- package/dist/types/core/client/plugins/axios.d.ts +2 -0
- package/dist/types/core/client/plugins/index.d.ts +3 -0
- package/dist/types/core/client/plugins/vuetify.d.ts +82 -0
- package/dist/types/core/client/render.d.ts +1 -0
- package/dist/types/core/client/store/Actions.d.ts +12 -0
- package/dist/types/core/client/store/States.d.ts +22 -0
- package/dist/types/core/client/store/index.d.ts +2 -0
- package/dist/types/core/client/store/stac.d.ts +25 -0
- package/dist/types/core/client/types.d.ts +279 -0
- package/dist/types/core/client/utils/createLayers.d.ts +45 -0
- package/dist/types/core/client/utils/eodashSTAC.d.ts +82 -0
- package/dist/types/core/client/utils/helpers.d.ts +84 -0
- package/dist/types/core/client/utils/index.d.ts +2 -0
- package/dist/types/core/client/utils/keys.d.ts +6 -0
- package/dist/types/core/client/utils/states.d.ts +14 -0
- package/dist/types/core/client/views/Dashboard.vue.d.ts +9 -0
- package/dist/types/widgets/EodashDatePicker.vue.d.ts +7 -0
- package/dist/types/widgets/EodashItemFilter.vue.d.ts +42 -0
- package/dist/types/widgets/EodashLayerControl.vue.d.ts +11 -0
- package/dist/types/widgets/EodashLayoutSwitcher.vue.d.ts +9 -0
- package/dist/types/widgets/EodashMap.vue.d.ts +7 -0
- package/dist/types/widgets/EodashMapBtns.vue.d.ts +11 -0
- package/dist/types/widgets/EodashStacInfo.vue.d.ts +21 -0
- package/dist/types/widgets/EodashTools.vue.d.ts +15 -0
- package/dist/types/widgets/ExportState.vue.d.ts +7 -0
- package/dist/types/widgets/PopUp.vue.d.ts +22 -0
- package/dist/types/widgets/WidgetsContainer.vue.d.ts +7 -0
- package/package.json +58 -37
- package/widgets/EodashDatePicker.vue +128 -100
- package/widgets/EodashItemFilter.vue +100 -14
- package/widgets/EodashLayerControl.vue +98 -0
- package/widgets/EodashMap.vue +98 -122
- package/widgets/EodashMapBtns.vue +24 -7
- package/widgets/EodashProcess.vue +151 -0
- package/widgets/ExportState.vue +15 -11
- package/core/client/SuspensedDashboard.ce.vue +0 -105
- package/dist/client/DashboardLayout-D0ZF6V2S.js +0 -156
- package/dist/client/DynamicWebComponent-CPsMSBHi.js +0 -57
- package/dist/client/EodashDatePicker-CBQP7u2X.js +0 -252
- package/dist/client/EodashItemFilter-DL2ScI-5.js +0 -7671
- package/dist/client/EodashMap-CkKoQlmR.js +0 -86917
- package/dist/client/EodashMapBtns-yuO2QmiR.js +0 -36
- package/dist/client/ExportState-CCzOhppU.js +0 -558
- package/dist/client/Footer-BPAND0yG.js +0 -115
- package/dist/client/Header-DLhebNvG.js +0 -350
- package/dist/client/IframeWrapper-1GEMHlsW.js +0 -19
- package/dist/client/MobileLayout-mGkOYRhu.js +0 -945
- package/dist/client/PopUp-1d2bBFjw.js +0 -300
- package/dist/client/VImg-DxHcztfM.js +0 -291
- package/dist/client/VMain-BLX5vRRn.js +0 -39
- package/dist/client/VOverlay-CvrYEmLu.js +0 -967
- package/dist/client/WidgetsContainer-CmYjvGm7.js +0 -129
- package/dist/client/_commonjsHelpers-DaMA6jEr.js +0 -8
- package/dist/client/asWebComponent-B91uK0U7.js +0 -20361
- package/dist/client/basedecoder-DHcBySSe-BmCFNFnw.js +0 -88
- package/dist/client/decoder-CP4lv0Kb-B6yqkcfC.js +0 -10
- package/dist/client/deflate-BXt-9JA_-CWfClgpK.js +0 -10
- package/dist/client/eodashSTAC-DBjqe_Ho.js +0 -2788
- package/dist/client/eox-stacinfo-l7ALSV90.js +0 -13969
- package/dist/client/forwardRefs-BJJiadQP.js +0 -185
- package/dist/client/index-Q-bHLjxx.js +0 -153
- package/dist/client/jpeg-BAgeD1d3-oeHbFPUL.js +0 -514
- package/dist/client/lerc-DzVumYtB-P-KXC0TO.js +0 -1027
- package/dist/client/lzw-LAGDNbSC-DkP96qO9.js +0 -84
- package/dist/client/packbits-BlDR4Kj5-C66n1-zr.js +0 -24
- package/dist/client/pako.esm-CB1uQYY0-DB0PYm1P.js +0 -1081
- package/dist/client/raw-CMGvRjfu-BRi6E4i1.js +0 -9
- package/dist/client/ssrBoot-yo11mybw.js +0 -17
- package/dist/client/transition-CSJhuYGK.js +0 -34
- package/dist/client/webfontloader-qotgY98I.js +0 -435
- package/dist/client/webimage-BM_pbLN3-L2cGWK5l.js +0 -19
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { computed, ref, openBlock, createElementBlock, unref, createCommentVNode } from 'vue';
|
|
2
|
+
import '@eox/layercontrol';
|
|
3
|
+
import '@eox/jsonform';
|
|
4
|
+
import '@eox/timecontrol';
|
|
5
|
+
import 'color-legend-element';
|
|
6
|
+
import { a0 as useSTAcStore, a3 as mapCompareEl, a4 as mapEl, a5 as eodashCompareCollections, a1 as eodashCollections, a6 as getColFromLayer } from './asWebComponent-DUUoR7MZ.js';
|
|
7
|
+
import { storeToRefs } from 'pinia';
|
|
8
|
+
|
|
9
|
+
const _hoisted_1 = { class: "d-flex flex-column fill-height overflow-auto" };
|
|
10
|
+
const _hoisted_2 = ["for"];
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
const _sfc_main = {
|
|
14
|
+
__name: 'EodashLayerControl',
|
|
15
|
+
props: {
|
|
16
|
+
map: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: "first",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
setup(__props) {
|
|
22
|
+
|
|
23
|
+
const props = __props;
|
|
24
|
+
|
|
25
|
+
const { selectedCompareStac, selectedStac } = storeToRefs(useSTAcStore());
|
|
26
|
+
|
|
27
|
+
const showControls = computed(() => {
|
|
28
|
+
if (props.map === "second") {
|
|
29
|
+
return mapCompareEl.value !== null && selectedCompareStac.value !== null;
|
|
30
|
+
}
|
|
31
|
+
return mapEl.value !== null && selectedStac.value !== null;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const eodashCols =
|
|
35
|
+
props.map === "second" ? eodashCompareCollections : eodashCollections;
|
|
36
|
+
const mapElement = props.map === "second" ? mapCompareEl : mapEl;
|
|
37
|
+
|
|
38
|
+
/** @type { import("vue").Ref<HTMLElement & Record<string,any> | null>} */
|
|
39
|
+
const eoxLayercontrol = ref(null);
|
|
40
|
+
|
|
41
|
+
/** @param {CustomEvent<{layer:import('ol/layer').Layer; datetime:string;}>} evt */
|
|
42
|
+
const handleDatetimeUpdate = async (evt) => {
|
|
43
|
+
const { layer, datetime } = evt.detail;
|
|
44
|
+
|
|
45
|
+
const ec = await getColFromLayer(eodashCols, layer);
|
|
46
|
+
|
|
47
|
+
/** @type {Record<string,any>[] | undefined} */
|
|
48
|
+
let updatedLayers = [];
|
|
49
|
+
|
|
50
|
+
if (ec) {
|
|
51
|
+
await ec.fetchCollection();
|
|
52
|
+
updatedLayers = await ec.updateLayerJson(
|
|
53
|
+
datetime,
|
|
54
|
+
layer.get("id"),
|
|
55
|
+
props.map,
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
/** @type {Record<String,any>[] | undefined} */
|
|
59
|
+
const dataLayers = updatedLayers?.find(
|
|
60
|
+
(l) => l?.properties?.id === "AnalysisGroup",
|
|
61
|
+
)?.layers;
|
|
62
|
+
|
|
63
|
+
if (dataLayers?.length) {
|
|
64
|
+
// Add expand to all analysis layers
|
|
65
|
+
dataLayers?.forEach((dl) => {
|
|
66
|
+
dl.properties.layerControlExpand = true;
|
|
67
|
+
dl.properties.layerControlToolsExpand = true;
|
|
68
|
+
});
|
|
69
|
+
// assign layers to the map
|
|
70
|
+
/** @type {HTMLElement & Record<string,any>} */
|
|
71
|
+
(mapElement.value).layers = updatedLayers;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// ----- debounce logic
|
|
76
|
+
/** @type {NodeJS.Timeout | undefined} */
|
|
77
|
+
let timeout;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @param {CustomEvent<{layer:import('ol/layer').Layer; datetime:string;}>} evt
|
|
81
|
+
**/
|
|
82
|
+
const debouncedHandleDateTime = (evt) => {
|
|
83
|
+
clearTimeout(timeout);
|
|
84
|
+
timeout = setTimeout(() => {
|
|
85
|
+
handleDatetimeUpdate(evt);
|
|
86
|
+
}, 500);
|
|
87
|
+
};
|
|
88
|
+
// ------
|
|
89
|
+
|
|
90
|
+
return (_ctx, _cache) => {
|
|
91
|
+
return (openBlock(), createElementBlock("span", _hoisted_1, [
|
|
92
|
+
(showControls.value)
|
|
93
|
+
? (openBlock(), createElementBlock("eox-layercontrol", {
|
|
94
|
+
key: 0,
|
|
95
|
+
for: unref(mapElement),
|
|
96
|
+
".tools": ['datetime', 'info', 'config', 'legend', 'opacity'],
|
|
97
|
+
"onDatetime:updated": debouncedHandleDateTime,
|
|
98
|
+
class: "fill-height",
|
|
99
|
+
toolsAsList: "true",
|
|
100
|
+
ref_key: "eoxLayercontrol",
|
|
101
|
+
ref: eoxLayercontrol
|
|
102
|
+
}, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_2))
|
|
103
|
+
: createCommentVNode("v-if", true)
|
|
104
|
+
]))
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
import { onMounted, onUnmounted, watch, nextTick, ref, computed, openBlock, createElementBlock, createElementVNode } from 'vue';
|
|
2
|
+
import '@eox/map';
|
|
3
|
+
import '@eox/map/src/plugins/advancedLayersAndSources';
|
|
4
|
+
import { a7 as eoxLayersKey, a0 as useSTAcStore, a8 as setMapProjFromCol, a9 as EodashCollection, aa as mapPosition, a4 as mapEl, a3 as mapCompareEl, $ as datetime, a5 as eodashCompareCollections, a1 as eodashCollections } from './asWebComponent-DUUoR7MZ.js';
|
|
5
|
+
import { storeToRefs } from 'pinia';
|
|
6
|
+
import log from 'loglevel';
|
|
7
|
+
import { useEventBus } from '@vueuse/core';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Holder for previous compare map view as it is overwritten by sync
|
|
11
|
+
* @type { {map:import("ol").View } | null} mapElement
|
|
12
|
+
*/
|
|
13
|
+
let viewHolder = null;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Description placeholder
|
|
17
|
+
*
|
|
18
|
+
* @param {import("vue").Ref<HTMLElement & Record<string,any> & {map:import("ol").Map } | null>} mapElement
|
|
19
|
+
* @param {import("vue").Ref<(number | undefined)[]>} mapPosition
|
|
20
|
+
*/
|
|
21
|
+
const useHandleMapMoveEnd = (mapElement, mapPosition) => {
|
|
22
|
+
/** @type {import("openlayers").EventsListenerFunctionType} */
|
|
23
|
+
const handleMoveEnd = (evt) => {
|
|
24
|
+
const map = /** @type {import("openlayers").Map | undefined} */ (
|
|
25
|
+
/** @type {any} */ (evt).map
|
|
26
|
+
);
|
|
27
|
+
const lonlat = mapElement.value?.lonLatCenter;
|
|
28
|
+
const z = map?.getView().getZoom();
|
|
29
|
+
if (
|
|
30
|
+
lonlat &&
|
|
31
|
+
!Number.isNaN(lonlat[0]) &&
|
|
32
|
+
!Number.isNaN(lonlat[1]) &&
|
|
33
|
+
!Number.isNaN(z)
|
|
34
|
+
) {
|
|
35
|
+
mapPosition.value = [lonlat[0], lonlat[1], z];
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
onMounted(() => {
|
|
40
|
+
/** @type {import('ol/Map').default} */
|
|
41
|
+
(mapElement.value?.map)?.on("moveend", handleMoveEnd);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
onUnmounted(() => {
|
|
45
|
+
/** @type {import('ol/Map').default} */
|
|
46
|
+
(mapElement.value?.map)?.un("moveend", handleMoveEnd);
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Creates full layer configuration from indicator and time information
|
|
52
|
+
* @param {import("stac-ts").StacCatalog
|
|
53
|
+
* | import("stac-ts").StacCollection
|
|
54
|
+
* | import("stac-ts").StacItem
|
|
55
|
+
* | null
|
|
56
|
+
* } selectedIndicator
|
|
57
|
+
* @param {EodashCollection[]} eodashCols
|
|
58
|
+
* @param {string} [updatedTime]
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
const createLayersConfig = async (
|
|
62
|
+
selectedIndicator,
|
|
63
|
+
eodashCols,
|
|
64
|
+
updatedTime,
|
|
65
|
+
) => {
|
|
66
|
+
log.debug(
|
|
67
|
+
"Creating layers config",
|
|
68
|
+
selectedIndicator,
|
|
69
|
+
eodashCols,
|
|
70
|
+
updatedTime,
|
|
71
|
+
);
|
|
72
|
+
const layersCollection = [];
|
|
73
|
+
const dataLayers = {
|
|
74
|
+
type: "Group",
|
|
75
|
+
properties: {
|
|
76
|
+
id: "AnalysisGroup",
|
|
77
|
+
title: "Analysis Layers",
|
|
78
|
+
layerControlExpand: true,
|
|
79
|
+
},
|
|
80
|
+
layers: /** @type {Record<string,any>[]}*/ ([]),
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
for (const ec of eodashCols) {
|
|
84
|
+
let layers;
|
|
85
|
+
if (updatedTime) {
|
|
86
|
+
layers = await ec.createLayersJson(new Date(updatedTime));
|
|
87
|
+
} else {
|
|
88
|
+
layers = await ec.createLayersJson();
|
|
89
|
+
}
|
|
90
|
+
// Add expand to all analysis layers
|
|
91
|
+
layers.forEach((dl) => {
|
|
92
|
+
dl.properties.layerControlExpand = true;
|
|
93
|
+
dl.properties.layerControlToolsExpand = true;
|
|
94
|
+
});
|
|
95
|
+
dataLayers.layers.push(...layers);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
layersCollection.push(dataLayers);
|
|
99
|
+
const indicatorLayers =
|
|
100
|
+
//@ts-expect-error indicator is collection
|
|
101
|
+
await EodashCollection.getIndicatorLayers(selectedIndicator);
|
|
102
|
+
|
|
103
|
+
const baseLayers = {
|
|
104
|
+
type: "Group",
|
|
105
|
+
properties: {
|
|
106
|
+
id: "BaseLayersGroup",
|
|
107
|
+
title: "Base Layers",
|
|
108
|
+
},
|
|
109
|
+
layers: /** @type {Record<string,any>[]}*/ ([]),
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const indicatorBaseLayers = indicatorLayers.filter(
|
|
113
|
+
(l) => l.properties.group === "baselayer",
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
if (indicatorBaseLayers.length) {
|
|
117
|
+
// Only one baselayer can be set to visible, let's first set all to
|
|
118
|
+
// false that have not a dedicated property visible, then check
|
|
119
|
+
// if there are more then one visible and only allow one
|
|
120
|
+
let counter = 0;
|
|
121
|
+
let lastPos = 0;
|
|
122
|
+
for (let indx = 0; indx < indicatorBaseLayers.length; indx++) {
|
|
123
|
+
const bl = indicatorBaseLayers[indx];
|
|
124
|
+
if (!("visible" in bl.properties)) {
|
|
125
|
+
bl.properties.visible = false;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (bl.properties.visible) {
|
|
129
|
+
counter++;
|
|
130
|
+
lastPos = indx;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// if none visible set the last one as visible
|
|
135
|
+
if (counter === 0) {
|
|
136
|
+
indicatorBaseLayers[0].properties.visible = true;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// disable all apart from last
|
|
140
|
+
if (counter > 0) {
|
|
141
|
+
indicatorBaseLayers.forEach((bl, indx) => {
|
|
142
|
+
if (indx !== lastPos) {
|
|
143
|
+
bl.properties.visible = false;
|
|
144
|
+
} else {
|
|
145
|
+
bl.properties.visible = true;
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
baseLayers.layers.push(...indicatorBaseLayers);
|
|
151
|
+
|
|
152
|
+
// Add exclusive to baselayers and make sure only one is selected
|
|
153
|
+
baseLayers.layers.forEach((bl) => {
|
|
154
|
+
bl.properties.layerControlExclusive = true;
|
|
155
|
+
});
|
|
156
|
+
} else {
|
|
157
|
+
// Default to some baselayer
|
|
158
|
+
baseLayers.layers.push({
|
|
159
|
+
type: "Tile",
|
|
160
|
+
properties: {
|
|
161
|
+
id: "osm",
|
|
162
|
+
title: "Background",
|
|
163
|
+
layerControlExclusive: true,
|
|
164
|
+
},
|
|
165
|
+
source: {
|
|
166
|
+
type: "OSM",
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (baseLayers.layers.length) {
|
|
172
|
+
layersCollection.push(baseLayers);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const overlayLayers = {
|
|
176
|
+
type: "Group",
|
|
177
|
+
properties: {
|
|
178
|
+
id: "OverlayGroup",
|
|
179
|
+
title: "Overlay Layers",
|
|
180
|
+
},
|
|
181
|
+
layers: /** @type {Record<string,any>[]}*/ ([]),
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const indicatorOverlays = indicatorLayers.filter(
|
|
185
|
+
(l) => l.properties.group === "overlay",
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
if (indicatorOverlays.length) {
|
|
189
|
+
overlayLayers.layers.push(...indicatorOverlays);
|
|
190
|
+
layersCollection.unshift(overlayLayers);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return layersCollection;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Description placeholder
|
|
198
|
+
*
|
|
199
|
+
* @param {import("vue").Ref<HTMLElement & Record<string,any> | null>} mapElement
|
|
200
|
+
* @param {import("vue").Ref<import("stac-ts").StacCollection | null>} selectedIndicator
|
|
201
|
+
* @param {EodashCollection[]} eodashCols
|
|
202
|
+
* @param {import("vue").Ref<string>} datetime
|
|
203
|
+
* @param {import("vue").Ref<Record<string,any>[]>} mapLayers
|
|
204
|
+
* @param {import("vue").Ref<HTMLElement & Record<string,any> | null>} partnerMap
|
|
205
|
+
*/
|
|
206
|
+
const useInitMap = (
|
|
207
|
+
mapElement,
|
|
208
|
+
selectedIndicator,
|
|
209
|
+
eodashCols,
|
|
210
|
+
datetime,
|
|
211
|
+
mapLayers,
|
|
212
|
+
partnerMap,
|
|
213
|
+
) => {
|
|
214
|
+
log.debug(
|
|
215
|
+
"InitMap",
|
|
216
|
+
mapElement.value,
|
|
217
|
+
selectedIndicator.value,
|
|
218
|
+
eodashCols.values,
|
|
219
|
+
datetime.value,
|
|
220
|
+
);
|
|
221
|
+
const layersEvent = useEventBus(eoxLayersKey);
|
|
222
|
+
|
|
223
|
+
const stopIndicatorWatcher = watch(
|
|
224
|
+
[selectedIndicator, datetime],
|
|
225
|
+
async ([updatedStac, updatedTime], [previousStac, previousTime]) => {
|
|
226
|
+
if (updatedStac) {
|
|
227
|
+
log.debug(
|
|
228
|
+
"Selected Indicator watch triggered",
|
|
229
|
+
updatedStac,
|
|
230
|
+
updatedTime,
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
if (mapElement?.value?.id === "main") {
|
|
234
|
+
// Making sure main map gets the viewer that seems to be
|
|
235
|
+
// removed when the second map is no longer rendered
|
|
236
|
+
if (viewHolder !== null) {
|
|
237
|
+
// Set view to previous compare view
|
|
238
|
+
mapElement?.value?.map.setView(viewHolder);
|
|
239
|
+
viewHolder = null;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
let layersCollection = [];
|
|
243
|
+
|
|
244
|
+
const onlyTimeChanged =
|
|
245
|
+
updatedStac?.id === previousStac?.id && updatedTime !== previousTime;
|
|
246
|
+
|
|
247
|
+
const { selectedCompareStac } = storeToRefs(useSTAcStore());
|
|
248
|
+
if (mapElement?.value?.id === "main") {
|
|
249
|
+
// Main map being initialized
|
|
250
|
+
// Set projection based on indicator level information for both maps
|
|
251
|
+
await setMapProjFromCol(updatedStac);
|
|
252
|
+
} else {
|
|
253
|
+
// Compare map being initialized
|
|
254
|
+
if (selectedCompareStac.value !== null) {
|
|
255
|
+
// save view of compare map
|
|
256
|
+
viewHolder = mapElement?.value?.map.getView();
|
|
257
|
+
/** @type {any} */
|
|
258
|
+
(mapElement.value).sync = partnerMap.value;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// We re-crate the configuration if time changed
|
|
263
|
+
if (onlyTimeChanged) {
|
|
264
|
+
layersCollection = await createLayersConfig(
|
|
265
|
+
updatedStac,
|
|
266
|
+
eodashCols,
|
|
267
|
+
updatedTime,
|
|
268
|
+
);
|
|
269
|
+
log.debug(
|
|
270
|
+
"Assigned layers after changing time only",
|
|
271
|
+
JSON.parse(JSON.stringify(layersCollection)),
|
|
272
|
+
);
|
|
273
|
+
mapLayers.value = layersCollection;
|
|
274
|
+
await nextTick(() => {
|
|
275
|
+
layersEvent.emit("time:updated", mapLayers.value);
|
|
276
|
+
});
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/** @type {Record<string,any>[]} */
|
|
281
|
+
layersCollection = await createLayersConfig(
|
|
282
|
+
updatedStac,
|
|
283
|
+
eodashCols,
|
|
284
|
+
datetime.value,
|
|
285
|
+
);
|
|
286
|
+
|
|
287
|
+
// We try to set the current time selection to latest extent date
|
|
288
|
+
let endInterval = null;
|
|
289
|
+
const interval = updatedStac?.extent?.temporal?.interval;
|
|
290
|
+
if (interval && interval.length > 0 && interval[0].length > 1) {
|
|
291
|
+
// @ts-expect-error this is the defined STAC structure
|
|
292
|
+
endInterval = new Date(interval[0][1]);
|
|
293
|
+
log.debug(
|
|
294
|
+
"Indicator load: found stac extent, setting time to latest value",
|
|
295
|
+
endInterval,
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
if (
|
|
299
|
+
endInterval !== null &&
|
|
300
|
+
endInterval.toISOString() !== datetime.value
|
|
301
|
+
) {
|
|
302
|
+
datetime.value = endInterval.toISOString();
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// Try to move map view to extent only when main
|
|
306
|
+
// indicator and map changes
|
|
307
|
+
if (
|
|
308
|
+
mapElement?.value?.id === "main" &&
|
|
309
|
+
updatedStac.extent?.spatial.bbox
|
|
310
|
+
) {
|
|
311
|
+
// Sanitize extent,
|
|
312
|
+
const b = updatedStac.extent?.spatial.bbox[0];
|
|
313
|
+
const sanitizedExtent = [
|
|
314
|
+
b[0] > -180 ? b[0] : -180,
|
|
315
|
+
b[1] > -90 ? b[1] : -90,
|
|
316
|
+
b[2] < 180 ? b[2] : 180,
|
|
317
|
+
b[3] < 90 ? b[3] : 90,
|
|
318
|
+
];
|
|
319
|
+
|
|
320
|
+
const reprojExtent = mapElement.value?.transformExtent(
|
|
321
|
+
sanitizedExtent,
|
|
322
|
+
"EPSG:4326",
|
|
323
|
+
mapElement.value?.map?.getView().getProjection(),
|
|
324
|
+
);
|
|
325
|
+
/** @type {any} */
|
|
326
|
+
(mapElement.value).zoomExtent = reprojExtent;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
log.debug(
|
|
330
|
+
"Assigned layers",
|
|
331
|
+
JSON.parse(JSON.stringify(layersCollection)),
|
|
332
|
+
);
|
|
333
|
+
|
|
334
|
+
mapLayers.value = layersCollection;
|
|
335
|
+
// Emit event to update layers
|
|
336
|
+
await nextTick(() => {
|
|
337
|
+
mapElement.value?.updateComplete.then(() => {
|
|
338
|
+
layersEvent.emit("layers:updated", mapLayers.value);
|
|
339
|
+
});
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
{ immediate: true },
|
|
344
|
+
);
|
|
345
|
+
|
|
346
|
+
onUnmounted(() => {
|
|
347
|
+
stopIndicatorWatcher();
|
|
348
|
+
});
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
const _hoisted_1 = [".enabled"];
|
|
352
|
+
const _hoisted_2 = [".layers"];
|
|
353
|
+
const _hoisted_3 = [".layers"];
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
const _sfc_main = {
|
|
357
|
+
__name: 'EodashMap',
|
|
358
|
+
props: {
|
|
359
|
+
enableCompare: {
|
|
360
|
+
type: Boolean,
|
|
361
|
+
default: false,
|
|
362
|
+
},
|
|
363
|
+
},
|
|
364
|
+
setup(__props) {
|
|
365
|
+
|
|
366
|
+
const props = __props;
|
|
367
|
+
|
|
368
|
+
/** @type {import("vue").Ref<Record<string,any>[]>} */
|
|
369
|
+
const eoxMapLayers = ref([
|
|
370
|
+
{
|
|
371
|
+
type: "Tile",
|
|
372
|
+
source: { type: "OSM" },
|
|
373
|
+
properties: {
|
|
374
|
+
id: "osm",
|
|
375
|
+
title: "Background",
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
]);
|
|
379
|
+
|
|
380
|
+
/** @type {import("vue").Ref<Record<string,any>[]>} */
|
|
381
|
+
const eoxMapCompareLayers = ref([
|
|
382
|
+
{
|
|
383
|
+
type: "Tile",
|
|
384
|
+
source: { type: "OSM" },
|
|
385
|
+
properties: {
|
|
386
|
+
id: "osm",
|
|
387
|
+
title: "Background",
|
|
388
|
+
},
|
|
389
|
+
},
|
|
390
|
+
]);
|
|
391
|
+
|
|
392
|
+
/** @type {import("vue").Ref<(HTMLElement & Record<string,any> & { map:import("ol").Map }) | null>} */
|
|
393
|
+
const eoxMap = ref(null);
|
|
394
|
+
/** @type {import("vue").Ref<(HTMLElement & Record<string,any> & { map:import("ol").Map }) | null>} */
|
|
395
|
+
const compareMap = ref(null);
|
|
396
|
+
|
|
397
|
+
const eoxMapConfig = {
|
|
398
|
+
/** @type {(number|undefined)[] | undefined} */
|
|
399
|
+
center: [15, 48],
|
|
400
|
+
/** @type {number | undefined} */
|
|
401
|
+
zoom: 4,
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
const eoxCompareMapConfig = {
|
|
405
|
+
/** @type {(number|undefined)[] | undefined} */
|
|
406
|
+
center: [15, 48],
|
|
407
|
+
/** @type {number | undefined} */
|
|
408
|
+
zoom: 4,
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
// Check if selected indicator was already set in store
|
|
412
|
+
if (mapPosition && mapPosition.value && mapPosition.value.length === 3) {
|
|
413
|
+
// TODO: do further checks for invalid values?
|
|
414
|
+
// TODO: can we expect the values to be in a specific projection
|
|
415
|
+
eoxMapConfig.center = [mapPosition.value?.[0], mapPosition.value[1]];
|
|
416
|
+
eoxMapConfig.zoom = mapPosition.value[2];
|
|
417
|
+
}
|
|
418
|
+
const { selectedCompareStac } = storeToRefs(useSTAcStore());
|
|
419
|
+
const showCompare = computed(() =>
|
|
420
|
+
props.enableCompare && !!selectedCompareStac.value ? "" : "first",
|
|
421
|
+
);
|
|
422
|
+
|
|
423
|
+
useHandleMapMoveEnd(eoxMap, mapPosition);
|
|
424
|
+
|
|
425
|
+
onMounted(() => {
|
|
426
|
+
const { selectedCompareStac, selectedStac } = storeToRefs(useSTAcStore());
|
|
427
|
+
// assign map Element state to eox map
|
|
428
|
+
mapEl.value = eoxMap.value;
|
|
429
|
+
|
|
430
|
+
if (props.enableCompare) {
|
|
431
|
+
mapCompareEl.value = compareMap.value;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
if (props.enableCompare) {
|
|
435
|
+
useInitMap(
|
|
436
|
+
compareMap,
|
|
437
|
+
//@ts-expect-error todo selectedStac as collection
|
|
438
|
+
selectedCompareStac,
|
|
439
|
+
eodashCompareCollections,
|
|
440
|
+
datetime,
|
|
441
|
+
eoxMapCompareLayers,
|
|
442
|
+
eoxMap,
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
useInitMap(
|
|
447
|
+
eoxMap,
|
|
448
|
+
//@ts-expect-error todo selectedStac as collection
|
|
449
|
+
selectedStac,
|
|
450
|
+
eodashCollections,
|
|
451
|
+
datetime,
|
|
452
|
+
eoxMapLayers,
|
|
453
|
+
compareMap,
|
|
454
|
+
);
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
return (_ctx, _cache) => {
|
|
458
|
+
return (openBlock(), createElementBlock("eox-map-compare", {
|
|
459
|
+
class: "fill-height fill-width overflow-none",
|
|
460
|
+
".enabled": showCompare.value
|
|
461
|
+
}, [
|
|
462
|
+
createElementVNode("eox-map", {
|
|
463
|
+
class: "fill-height fill-width overflow-none",
|
|
464
|
+
slot: "first",
|
|
465
|
+
ref_key: "eoxMap",
|
|
466
|
+
ref: eoxMap,
|
|
467
|
+
".config": eoxMapConfig,
|
|
468
|
+
id: "main",
|
|
469
|
+
".layers": eoxMapLayers.value
|
|
470
|
+
}, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_2),
|
|
471
|
+
createElementVNode("eox-map", {
|
|
472
|
+
class: "fill-height fill-width overflow-none",
|
|
473
|
+
id: "compare",
|
|
474
|
+
slot: "second",
|
|
475
|
+
ref_key: "compareMap",
|
|
476
|
+
ref: compareMap,
|
|
477
|
+
".config": eoxCompareMapConfig,
|
|
478
|
+
".layers": eoxMapCompareLayers.value
|
|
479
|
+
}, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_3)
|
|
480
|
+
], 40 /* PROPS, NEED_HYDRATION */, _hoisted_1))
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ref, openBlock, createElementBlock, createBlock, unref, createCommentVNode } from 'vue';
|
|
2
|
+
import { _ as _export_sfc, ab as makePanelTransparent, V as VBtn, ac as availableMapProjection, ad as changeMapProjection } from './asWebComponent-DUUoR7MZ.js';
|
|
3
|
+
import { mdiMapPlus, mdiEarthBox } from '@mdi/js';
|
|
4
|
+
import ExportState from './ExportState-BT8MLAW7.js';
|
|
5
|
+
|
|
6
|
+
const _sfc_main = {
|
|
7
|
+
__name: 'EodashMapBtns',
|
|
8
|
+
props: {
|
|
9
|
+
exportMap: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: true,
|
|
12
|
+
},
|
|
13
|
+
changeProjection: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: true,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
setup(__props) {
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
const showMapState = ref(false);
|
|
23
|
+
|
|
24
|
+
/** @type {import("vue").Ref<HTMLDivElement|null>} */
|
|
25
|
+
const rootRef = ref(null);
|
|
26
|
+
makePanelTransparent(rootRef);
|
|
27
|
+
|
|
28
|
+
return (_ctx, _cache) => {
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
return (openBlock(), createElementBlock("div", {
|
|
32
|
+
ref_key: "rootRef",
|
|
33
|
+
ref: rootRef,
|
|
34
|
+
class: "d-flex flex-column align-end justify-end my-3 pa-2"
|
|
35
|
+
}, [
|
|
36
|
+
(__props.exportMap)
|
|
37
|
+
? (openBlock(), createBlock(VBtn, {
|
|
38
|
+
key: 0,
|
|
39
|
+
class: "map-btn",
|
|
40
|
+
icon: [unref(mdiMapPlus)],
|
|
41
|
+
onClick: _cache[0] || (_cache[0] = $event => (showMapState.value = !showMapState.value))
|
|
42
|
+
}, null, 8 /* PROPS */, ["icon"]))
|
|
43
|
+
: createCommentVNode("v-if", true),
|
|
44
|
+
(__props.exportMap)
|
|
45
|
+
? (openBlock(), createBlock(ExportState, {
|
|
46
|
+
key: 1,
|
|
47
|
+
modelValue: showMapState.value,
|
|
48
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = $event => ((showMapState).value = $event))
|
|
49
|
+
}, null, 8 /* PROPS */, ["modelValue"]))
|
|
50
|
+
: createCommentVNode("v-if", true),
|
|
51
|
+
(__props.changeProjection && !!unref(availableMapProjection))
|
|
52
|
+
? (openBlock(), createBlock(VBtn, {
|
|
53
|
+
key: 2,
|
|
54
|
+
class: "map-btn",
|
|
55
|
+
icon: [unref(mdiEarthBox)],
|
|
56
|
+
onClick: _cache[2] || (_cache[2] = $event => (unref(changeMapProjection)(unref(availableMapProjection))))
|
|
57
|
+
}, null, 8 /* PROPS */, ["icon"]))
|
|
58
|
+
: createCommentVNode("v-if", true)
|
|
59
|
+
], 512 /* NEED_PATCH */))
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
};
|
|
64
|
+
const EodashMapBtns = /*#__PURE__*/_export_sfc(_sfc_main, [['__scopeId',"data-v-d7a01370"]]);
|
|
65
|
+
|
|
66
|
+
export { EodashMapBtns as default };
|