@eodash/eodash 5.0.0-alpha.2.9 → 5.0.0-rc

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.
Files changed (113) hide show
  1. package/README.md +1 -1
  2. package/core/client/App.vue +13 -1
  3. package/core/client/asWebComponent.js +13 -4
  4. package/core/client/components/DashboardLayout.vue +36 -14
  5. package/core/client/components/Loading.vue +6 -9
  6. package/core/client/components/MobileLayout.vue +16 -14
  7. package/core/client/composables/DefineEodash.js +14 -4
  8. package/core/client/composables/DefineTemplate.js +67 -0
  9. package/core/client/composables/DefineWidgets.js +3 -2
  10. package/core/client/composables/EodashMap.js +360 -0
  11. package/core/client/composables/EodashProcess.js +574 -0
  12. package/core/client/composables/index.js +136 -28
  13. package/core/client/eodash.js +395 -80
  14. package/core/client/eodashSTAC/EodashCollection.js +432 -0
  15. package/core/client/eodashSTAC/createLayers.js +315 -0
  16. package/core/client/eodashSTAC/helpers.js +375 -0
  17. package/core/client/eodashSTAC/triggers.js +43 -0
  18. package/core/client/plugins/axios.js +8 -0
  19. package/core/client/plugins/index.js +2 -1
  20. package/core/client/plugins/vuetify.js +2 -1
  21. package/core/client/store/actions.js +79 -0
  22. package/core/client/store/index.js +4 -18
  23. package/core/client/store/stac.js +99 -9
  24. package/core/client/store/states.js +37 -0
  25. package/core/client/{types.d.ts → types.ts} +66 -20
  26. package/core/client/utils/keys.js +2 -0
  27. package/core/client/utils/states.js +22 -0
  28. package/core/client/views/Dashboard.vue +22 -49
  29. package/core/client/vite-env.d.ts +2 -10
  30. package/dist/client/DashboardLayout-232tRmjz.js +84 -0
  31. package/dist/client/DynamicWebComponent-Cl4LqHU6.js +88 -0
  32. package/dist/client/EodashDatePicker-Pok6bZwU.js +306 -0
  33. package/dist/client/EodashItemFilter-16eMMjTV.js +151 -0
  34. package/dist/client/EodashLayerControl-De7IlCm_.js +120 -0
  35. package/dist/client/EodashLayoutSwitcher-C-3-jjn5.js +52 -0
  36. package/dist/client/EodashMap-CMvbfI6-.js +549 -0
  37. package/dist/client/EodashMapBtns-BeknGDtc.js +107 -0
  38. package/dist/client/EodashProcess-BwKAa9Ee.js +1476 -0
  39. package/dist/client/EodashStacInfo-_BfonNUG.js +85 -0
  40. package/dist/client/EodashTools-PD3XPYuR.js +103 -0
  41. package/dist/client/ExportState-DOrT7M15.js +644 -0
  42. package/dist/client/Footer-CCigxYBo.js +141 -0
  43. package/dist/client/Header-C2cdx4gb.js +437 -0
  44. package/dist/client/IframeWrapper-BgM9aU8f.js +28 -0
  45. package/dist/client/MobileLayout-BdiFjHg7.js +1207 -0
  46. package/dist/client/PopUp--_xn1Cms.js +410 -0
  47. package/dist/client/VImg-9xu2l99m.js +384 -0
  48. package/dist/client/VMain-BUs3kDTd.js +43 -0
  49. package/dist/client/VOverlay-D89omJis.js +1453 -0
  50. package/dist/client/VTooltip-CDu3bErh.js +86 -0
  51. package/dist/client/WidgetsContainer-aFG9yFT6.js +83 -0
  52. package/dist/client/asWebComponent-BRGyP_j5.js +11943 -0
  53. package/dist/client/{style.css → eo-dash.css} +2 -2
  54. package/dist/client/eo-dash.js +2 -6
  55. package/dist/client/forwardRefs-CYrR6bMw.js +245 -0
  56. package/dist/client/index-BZwk0V42.js +199 -0
  57. package/dist/client/ssrBoot-BP7SYRyC.js +22 -0
  58. package/dist/client/transition-DG9nRSW4.js +37 -0
  59. package/dist/node/cli.js +4 -4
  60. package/dist/node/types.d.ts +2 -0
  61. package/package.json +73 -38
  62. package/widgets/EodashDatePicker.vue +176 -134
  63. package/widgets/EodashItemFilter.vue +79 -38
  64. package/widgets/EodashLayerControl.vue +111 -0
  65. package/widgets/EodashLayoutSwitcher.vue +36 -0
  66. package/widgets/EodashMap.vue +108 -133
  67. package/widgets/EodashMapBtns.vue +62 -8
  68. package/widgets/EodashProcess.vue +143 -0
  69. package/widgets/EodashStacInfo.vue +82 -0
  70. package/widgets/EodashTools.vue +83 -0
  71. package/widgets/ExportState.vue +17 -13
  72. package/widgets/PopUp.vue +24 -2
  73. package/core/client/SuspensedDashboard.ce.vue +0 -105
  74. package/core/client/asWebComponent.d.ts +0 -23
  75. package/core/client/store/Actions.js +0 -14
  76. package/core/client/store/States.js +0 -16
  77. package/core/client/utils/eodashSTAC.js +0 -249
  78. package/core/client/utils/helpers.js +0 -38
  79. package/dist/client/DashboardLayout-D0ZF6V2S.js +0 -156
  80. package/dist/client/DynamicWebComponent-CPsMSBHi.js +0 -57
  81. package/dist/client/EodashDatePicker-CBQP7u2X.js +0 -252
  82. package/dist/client/EodashItemFilter-DL2ScI-5.js +0 -7671
  83. package/dist/client/EodashMap-CkKoQlmR.js +0 -86917
  84. package/dist/client/EodashMapBtns-yuO2QmiR.js +0 -36
  85. package/dist/client/ExportState-CCzOhppU.js +0 -558
  86. package/dist/client/Footer-BPAND0yG.js +0 -115
  87. package/dist/client/Header-DLhebNvG.js +0 -350
  88. package/dist/client/IframeWrapper-1GEMHlsW.js +0 -19
  89. package/dist/client/MobileLayout-mGkOYRhu.js +0 -945
  90. package/dist/client/PopUp-1d2bBFjw.js +0 -300
  91. package/dist/client/VImg-DxHcztfM.js +0 -291
  92. package/dist/client/VMain-BLX5vRRn.js +0 -39
  93. package/dist/client/VOverlay-CvrYEmLu.js +0 -967
  94. package/dist/client/WidgetsContainer-CmYjvGm7.js +0 -129
  95. package/dist/client/_commonjsHelpers-DaMA6jEr.js +0 -8
  96. package/dist/client/asWebComponent-B91uK0U7.js +0 -20361
  97. package/dist/client/basedecoder-DHcBySSe-BmCFNFnw.js +0 -88
  98. package/dist/client/decoder-CP4lv0Kb-B6yqkcfC.js +0 -10
  99. package/dist/client/deflate-BXt-9JA_-CWfClgpK.js +0 -10
  100. package/dist/client/eodashSTAC-DBjqe_Ho.js +0 -2788
  101. package/dist/client/eox-stacinfo-l7ALSV90.js +0 -13969
  102. package/dist/client/forwardRefs-BJJiadQP.js +0 -185
  103. package/dist/client/index-Q-bHLjxx.js +0 -153
  104. package/dist/client/jpeg-BAgeD1d3-oeHbFPUL.js +0 -514
  105. package/dist/client/lerc-DzVumYtB-P-KXC0TO.js +0 -1027
  106. package/dist/client/lzw-LAGDNbSC-DkP96qO9.js +0 -84
  107. package/dist/client/packbits-BlDR4Kj5-C66n1-zr.js +0 -24
  108. package/dist/client/pako.esm-CB1uQYY0-DB0PYm1P.js +0 -1081
  109. package/dist/client/raw-CMGvRjfu-BRi6E4i1.js +0 -9
  110. package/dist/client/ssrBoot-yo11mybw.js +0 -17
  111. package/dist/client/transition-CSJhuYGK.js +0 -34
  112. package/dist/client/webfontloader-qotgY98I.js +0 -435
  113. package/dist/client/webimage-BM_pbLN3-L2cGWK5l.js +0 -19
@@ -0,0 +1,111 @@
1
+ <template>
2
+ <span class="d-flex flex-column fill-height overflow-auto">
3
+ <eox-layercontrol
4
+ v-if="showControls"
5
+ v-bind="config"
6
+ :for="mapElement"
7
+ @datetime:updated="debouncedHandleDateTime"
8
+ class="fill-height"
9
+ toolsAsList="true"
10
+ style="--eox-background-color: transparent"
11
+ ref="eoxLayercontrol"
12
+ />
13
+ </span>
14
+ </template>
15
+ <script setup>
16
+ import "@eox/layercontrol";
17
+
18
+ import "@eox/jsonform";
19
+ import "@eox/timecontrol";
20
+ import "color-legend-element";
21
+
22
+ import { computed, ref } from "vue";
23
+ import { mapEl, mapCompareEl } from "@/store/states";
24
+ import { getColFromLayer } from "@/eodashSTAC/helpers";
25
+ import { eodashCollections, eodashCompareCollections } from "@/utils/states";
26
+ import { storeToRefs } from "pinia";
27
+ import { useSTAcStore } from "@/store/stac";
28
+
29
+ const props = defineProps({
30
+ map: {
31
+ type: String,
32
+ default: "first",
33
+ },
34
+ tools: {
35
+ type: Array,
36
+ default: () => ["datetime", "info", "config", "legend", "opacity"],
37
+ },
38
+ cssVars: {
39
+ type: Object,
40
+ },
41
+ });
42
+
43
+ const config = {
44
+ tools: props.tools,
45
+ style: props.cssVars,
46
+ };
47
+
48
+ const { selectedCompareStac, selectedStac } = storeToRefs(useSTAcStore());
49
+ const showControls = computed(() => {
50
+ if (props.map === "second") {
51
+ return mapCompareEl.value !== null && selectedCompareStac.value !== null;
52
+ }
53
+ return mapEl.value !== null && selectedStac.value !== null;
54
+ });
55
+
56
+ const eodashCols =
57
+ props.map === "second" ? eodashCompareCollections : eodashCollections;
58
+ const mapElement = props.map === "second" ? mapCompareEl : mapEl;
59
+
60
+ /** @type { import("vue").Ref<HTMLElement & Record<string,any> | null>} */
61
+ const eoxLayercontrol = ref(null);
62
+
63
+ /** @param {CustomEvent<{layer:import('ol/layer').Layer; datetime:string;}>} evt */
64
+ const handleDatetimeUpdate = async (evt) => {
65
+ const { layer, datetime } = evt.detail;
66
+
67
+ const ec = await getColFromLayer(eodashCols, layer);
68
+
69
+ /** @type {Record<string,any>[] | undefined} */
70
+ let updatedLayers = [];
71
+
72
+ if (ec) {
73
+ await ec.fetchCollection();
74
+ updatedLayers = await ec.updateLayerJson(
75
+ datetime,
76
+ layer.get("id"),
77
+ props.map,
78
+ );
79
+ }
80
+ /** @type {Record<String,any>[] | undefined} */
81
+ const dataLayers = updatedLayers?.find(
82
+ (l) => l?.properties?.id === "AnalysisGroup",
83
+ )?.layers;
84
+
85
+ if (dataLayers?.length) {
86
+ // Add expand to all analysis layers
87
+ dataLayers?.forEach((dl) => {
88
+ dl.properties.layerControlExpand = true;
89
+ dl.properties.layerControlToolsExpand = true;
90
+ });
91
+ // assign layers to the map
92
+ /** @type {HTMLElement & Record<string,any>} */
93
+ (mapElement.value).layers = updatedLayers;
94
+ }
95
+ };
96
+
97
+ // ----- debounce logic
98
+ /** @type {NodeJS.Timeout | undefined} */
99
+ let timeout;
100
+
101
+ /**
102
+ * @param {CustomEvent<{layer:import('ol/layer').Layer; datetime:string;}>} evt
103
+ **/
104
+ const debouncedHandleDateTime = (evt) => {
105
+ clearTimeout(timeout);
106
+ timeout = setTimeout(() => {
107
+ handleDatetimeUpdate(evt);
108
+ }, 500);
109
+ };
110
+ // ------
111
+ </script>
@@ -0,0 +1,36 @@
1
+ <template>
2
+ <div ref="rootRef">
3
+ <v-tooltip :text="`Switch to ${target} mode`">
4
+ <template v-slot:activator="{ props }">
5
+ <v-icon
6
+ v-bind="props"
7
+ @click="activeTemplate = target"
8
+ :icon="[icon]"
9
+ ></v-icon>
10
+ </template>
11
+ </v-tooltip>
12
+ </div>
13
+ </template>
14
+
15
+ <script setup>
16
+ import { activeTemplate } from "@/store/states";
17
+ import { mdiViewDashboard } from "@mdi/js";
18
+ import { makePanelTransparent } from "@/composables";
19
+ import { ref } from "vue";
20
+
21
+ defineProps({
22
+ target: {
23
+ type: String,
24
+ default: "main",
25
+ },
26
+ // mdi/js icon
27
+ icon: {
28
+ type: String,
29
+ default: mdiViewDashboard,
30
+ },
31
+ });
32
+
33
+ /** @type {import("vue").Ref<HTMLDivElement|null>} */
34
+ const rootRef = ref(null);
35
+ makePanelTransparent(rootRef);
36
+ </script>
@@ -1,153 +1,128 @@
1
1
  <template>
2
- <eox-map
2
+ <eox-map-compare
3
3
  class="fill-height fill-width overflow-none"
4
- ref="eoxMap"
5
- :config="eoxMapConfig"
6
- />
4
+ .enabled="showCompare"
5
+ >
6
+ <eox-map
7
+ class="fill-height fill-width overflow-none"
8
+ slot="first"
9
+ ref="eoxMap"
10
+ id="main"
11
+ .animationOptions="animationOptions"
12
+ .center="initialCenter"
13
+ .zoom="initialZoom"
14
+ .layers="eoxMapLayers"
15
+ />
16
+ <eox-map
17
+ class="fill-height fill-width overflow-none"
18
+ id="compare"
19
+ slot="second"
20
+ ref="compareMap"
21
+ .layers="eoxMapCompareLayers"
22
+ />
23
+ </eox-map-compare>
7
24
  </template>
8
25
  <script setup>
9
- import { inject, onMounted, onUnmounted, reactive, ref, watch } from "vue";
10
- import { toAbsolute } from "stac-js/src/http.js";
11
- import { EodashCollection, extractCollectionUrls } from "@/utils/eodashSTAC";
12
- import { eodashKey } from "@/utils/keys";
13
- import { datetime, mapPosition } from "@/store/States";
26
+ import "@eox/map";
27
+ import "@eox/map/src/plugins/advancedLayersAndSources";
28
+ import { computed, onMounted, ref, toRaw } from "vue";
29
+ import { datetime, mapEl, mapPosition, mapCompareEl } from "@/store/states";
14
30
  import { storeToRefs } from "pinia";
15
31
  import { useSTAcStore } from "@/store/stac";
16
- import "@eox/map";
17
- import "@eox/map/dist/eox-map-advanced-layers-and-sources.js";
18
-
19
- const eodashConfig = /** @type {import("@/types").Eodash} */ (
20
- inject(eodashKey)
21
- );
22
-
23
- /** @type {import("vue").Ref<(HTMLElement & Record<string,unknown>) | null>} */
24
- const eoxMap = ref(null);
32
+ import { eodashCollections, eodashCompareCollections } from "@/utils/states";
33
+ import { useHandleMapMoveEnd, useInitMap } from "@/composables/EodashMap";
34
+ import { inAndOut } from "ol/easing.js";
35
+ const props = defineProps({
36
+ enableCompare: {
37
+ type: Boolean,
38
+ default: false,
39
+ },
40
+ /** @type {import("vue").PropType<[number,number]>} */
41
+ center: {
42
+ //@ts-expect-error todo
43
+ type: Array,
44
+ default: () => [15, 48],
45
+ },
46
+ zoom: {
47
+ type: Number,
48
+ default: 4,
49
+ },
50
+ });
25
51
 
26
- const eoxMapConfig = reactive({
27
- /** @type {(number|undefined)[] | undefined} */
28
- center: [15, 48],
29
- /** @type {number | undefined} */
30
- zoom: 4,
31
- // TODO: we should probably introduce some way of defining
32
- layers: [
33
- {
34
- type: "Vector",
35
- source: {
36
- type: "Vector",
37
- url: "https://openlayers.org/data/vector/ecoregions.json",
38
- format: "GeoJSON",
39
- },
40
- },
41
- {
42
- type: "Tile",
43
- properties: {
44
- id: "osm",
45
- title: "Background",
46
- },
47
- source: {
48
- type: "OSM",
49
- },
52
+ const initialCenter = toRaw([
53
+ mapPosition.value?.[0] ?? props.center?.[0],
54
+ mapPosition.value?.[1] ?? props.center?.[1],
55
+ ]);
56
+ const initialZoom = toRaw(mapPosition.value?.[2] ?? props.zoom);
57
+ /** @type {import("vue").Ref<Record<string,any>[]>} */
58
+ const eoxMapLayers = ref([
59
+ {
60
+ type: "Tile",
61
+ source: { type: "OSM" },
62
+ properties: {
63
+ id: "osm",
64
+ title: "Background",
50
65
  },
51
- ],
52
- });
66
+ },
67
+ ]);
53
68
 
54
- // Check if selected indicator was already set in store
55
- if (mapPosition && mapPosition.value && mapPosition.value.length === 3) {
56
- // TODO: do further checks for invalid values?
57
- // TODO: can we expect the values to be in a specific projection
58
- eoxMapConfig.center = [mapPosition.value?.[0], mapPosition.value[1]];
59
- eoxMapConfig.zoom = mapPosition.value[2];
60
- }
69
+ /** @type {import("vue").Ref<Record<string,any>[]>} */
70
+ const eoxMapCompareLayers = ref([
71
+ {
72
+ type: "Tile",
73
+ source: { type: "OSM" },
74
+ properties: {
75
+ id: "osm",
76
+ title: "Background",
77
+ },
78
+ },
79
+ ]);
61
80
 
62
- /** @type {import("openlayers").EventsListenerFunctionType} */
63
- const handleMoveEnd = (evt) => {
64
- const map = /** @type {import("openlayers").Map | undefined} */ (
65
- /** @type {any} */ (evt).map
66
- );
67
- /*
68
- const currentProj = map?.getView().getProjection();
69
- const transFunc = getTransform(currentProj?.getCode(), 'EPSG:4326');
70
- const [x, y] = transFunc(map?.getView().getCenter() ?? [0, 0], undefined, undefined);
71
- */
72
- const [x, y] = map?.getView().getCenter() ?? [0, 0];
73
- const z = map?.getView().getZoom();
74
- if (!Number.isNaN(x) && !Number.isNaN(y) && !Number.isNaN(z)) {
75
- mapPosition.value = [x, y, z];
76
- }
81
+ const animationOptions = {
82
+ duration: 1200,
83
+ easing: inAndOut,
77
84
  };
78
85
 
79
- const store = useSTAcStore();
86
+ /** @type {import("vue").Ref<(HTMLElement & Record<string,any> & { map:import("ol").Map }) | null>} */
87
+ const eoxMap = ref(null);
88
+ /** @type {import("vue").Ref<(HTMLElement & Record<string,any> & { map:import("ol").Map }) | null>} */
89
+ const compareMap = ref(null);
90
+ const { selectedCompareStac } = storeToRefs(useSTAcStore());
91
+ const showCompare = computed(() =>
92
+ props.enableCompare && !!selectedCompareStac.value ? "" : "first",
93
+ );
80
94
 
81
- onMounted(() => {
82
- /** @type {import('ol/Map').default} */
83
- (eoxMap.value?.map)?.on("moveend", handleMoveEnd);
95
+ useHandleMapMoveEnd(eoxMap, mapPosition);
84
96
 
85
- const { selectedStac } = storeToRefs(store);
97
+ onMounted(() => {
98
+ const { selectedCompareStac, selectedStac } = storeToRefs(useSTAcStore());
99
+ // assign map Element state to eox map
100
+ mapEl.value = eoxMap.value;
86
101
 
87
- watch(
88
- [selectedStac, datetime],
89
- async ([updatedStac, updatedTime]) => {
90
- if (updatedStac) {
91
- const parentCollUrl = toAbsolute(
92
- `./${updatedStac.id}/collection.json`,
93
- eodashConfig.stacEndpoint,
94
- );
95
- const collectionUrls = extractCollectionUrls(
96
- selectedStac.value,
97
- parentCollUrl,
98
- );
99
- /** @type {import("@/utils/eodashSTAC").EodashCollection[]} */
100
- const eodashCollections = [];
101
- collectionUrls.forEach((cu) => {
102
- eodashCollections.push(new EodashCollection(cu));
103
- });
104
- const layersCollection = [];
105
- for (let idx = 0; idx < eodashCollections.length; idx++) {
106
- const ec = eodashCollections[idx];
107
- let layers;
108
- if (updatedTime) {
109
- layers = await ec.createLayersJson(new Date(updatedTime));
110
- } else {
111
- layers = await ec.createLayersJson();
112
- }
113
- if (layers) {
114
- layersCollection.push(...layers);
115
- }
116
- }
117
- // TODO: add base layers and overlays as defined in the top collection / indicator
118
- // Probably best also to introduce background and overlay groups
119
- // For now adding OSM as background
120
- layersCollection.push({
121
- type: "Tile",
122
- properties: {
123
- id: "osm",
124
- title: "Background",
125
- },
126
- source: {
127
- type: "OSM",
128
- },
129
- });
102
+ if (props.enableCompare) {
103
+ mapCompareEl.value = compareMap.value;
104
+ }
130
105
 
131
- // TODO: we can check if the collection / indicator has a specific
132
- // projection it wants to be displayed in the map we can register
133
- // and set the attribute here, e.g. like following
134
- /*
135
- (el)?.registerProjection(
136
- 'EPSG:3031','+proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs +type=crs'
137
- );
138
- (el)?.projection = "EPSG:3031";
139
- */
106
+ if (props.enableCompare) {
107
+ useInitMap(
108
+ compareMap,
109
+ //@ts-expect-error todo selectedStac as collection
110
+ selectedCompareStac,
111
+ eodashCompareCollections,
112
+ datetime,
113
+ eoxMapCompareLayers,
114
+ eoxMap,
115
+ );
116
+ }
140
117
 
141
- /** @type {any} */
142
- (eoxMap.value).layers = layersCollection;
143
- }
144
- },
145
- { immediate: true },
118
+ useInitMap(
119
+ eoxMap,
120
+ //@ts-expect-error todo selectedStac as collection
121
+ selectedStac,
122
+ eodashCollections,
123
+ datetime,
124
+ eoxMapLayers,
125
+ compareMap,
146
126
  );
147
127
  });
148
-
149
- onUnmounted(() => {
150
- /** @type {import('ol/Map').default} */
151
- (eoxMap.value?.map)?.un("moveend", handleMoveEnd);
152
- });
153
128
  </script>
@@ -1,27 +1,80 @@
1
1
  <template>
2
- <div ref="rootRef" class="d-flex align-end justify-end my-3 pa-2">
2
+ <div ref="rootRef" class="d-flex flex-column align-end justify-end my-3 pa-2">
3
3
  <v-btn
4
+ v-if="exportMap"
4
5
  class="map-btn"
5
6
  :icon="[mdiMapPlus]"
6
7
  @click="showMapState = !showMapState"
7
8
  />
8
- <ExportState :header="header" :code="code" v-model="showMapState" />
9
+ <ExportState v-if="exportMap" v-model="showMapState" />
10
+
11
+ <v-btn
12
+ class="map-btn"
13
+ :icon="[mdiEarthBox]"
14
+ v-if="changeProjection && !!availableMapProjection"
15
+ @click="changeMapProjection(availableMapProjection)"
16
+ />
17
+ <v-btn
18
+ class="map-btn"
19
+ :icon="[mdiCompare]"
20
+ v-if="compareIndicators"
21
+ @click="showCompareIndicators = !showCompareIndicators"
22
+ />
23
+ <PopUp
24
+ v-model="showCompareIndicators"
25
+ :maxWidth="popupWidth"
26
+ :maxHeight="popupHeight"
27
+ >
28
+ <EodashItemFilter
29
+ :enableCompare="true"
30
+ filters-title=""
31
+ results-title="Select an indicator to compare"
32
+ :filter-properties="[]"
33
+ @select="onSelectCompareIndicator"
34
+ />
35
+ </PopUp>
9
36
  </div>
10
37
  </template>
11
38
  <script setup>
12
39
  import { makePanelTransparent } from "@/composables";
13
- import { mdiMapPlus } from "@mdi/js";
40
+ import { changeMapProjection, setActiveTemplate } from "@/store/actions";
41
+ import { availableMapProjection } from "@/store/states";
42
+ import { mdiCompare, mdiEarthBox, mdiMapPlus } from "@mdi/js";
14
43
  import ExportState from "^/ExportState.vue";
15
- import { ref } from "vue";
16
- const header = "Export Map";
17
- const code = `<h2>
18
- code example
19
- </h2>`;
44
+ import { computed, ref } from "vue";
45
+ import PopUp from "./PopUp.vue";
46
+ import EodashItemFilter from "./EodashItemFilter.vue";
47
+ import { useDisplay } from "vuetify/lib/framework.mjs";
48
+
49
+ defineProps({
50
+ exportMap: {
51
+ type: Boolean,
52
+ default: true,
53
+ },
54
+ changeProjection: {
55
+ type: Boolean,
56
+ default: true,
57
+ },
58
+ compareIndicators: {
59
+ type: Boolean,
60
+ default: true,
61
+ },
62
+ });
63
+ const { smAndDown } = useDisplay();
64
+ const popupWidth = computed(() => (smAndDown ? "70%" : "500px"));
65
+ const popupHeight = computed(() => (smAndDown ? "90%" : "500px"));
20
66
 
21
67
  const showMapState = ref(false);
68
+ const showCompareIndicators = ref(false);
22
69
 
23
70
  /** @type {import("vue").Ref<HTMLDivElement|null>} */
24
71
  const rootRef = ref(null);
72
+
73
+ const onSelectCompareIndicator = () => {
74
+ setActiveTemplate("compare");
75
+ showCompareIndicators.value = !showCompareIndicators.value;
76
+ };
77
+
25
78
  makePanelTransparent(rootRef);
26
79
  </script>
27
80
  <style scoped>
@@ -29,5 +82,6 @@ makePanelTransparent(rootRef);
29
82
  width: 36px;
30
83
  height: 36px;
31
84
  border-radius: 25%;
85
+ margin: 4px;
32
86
  }
33
87
  </style>
@@ -0,0 +1,143 @@
1
+ <template>
2
+ <div class="process-container">
3
+ <eox-jsonform
4
+ v-if="jsonformSchema"
5
+ ref="jsonformEl"
6
+ .schema="jsonformSchema"
7
+ ></eox-jsonform>
8
+ <eox-chart
9
+ class="chart"
10
+ v-if="isProcessed && chartSpec"
11
+ .spec="toRaw(chartSpec)"
12
+ .dataValues="toRaw(chartData)"
13
+ />
14
+ <span>
15
+ <v-btn
16
+ v-if="!autoExec"
17
+ :loading="loading"
18
+ style="float: right; margin-right: 20px"
19
+ @click="startProcess"
20
+ color="primary"
21
+ >
22
+ Execute
23
+ </v-btn>
24
+ </span>
25
+ </div>
26
+ </template>
27
+ <script setup>
28
+ import "@eox/chart";
29
+ import "@eox/drawtools";
30
+ import "@eox/jsonform";
31
+
32
+ import { onMounted, ref, toRaw } from "vue";
33
+ import { useSTAcStore } from "@/store/stac";
34
+ import { storeToRefs } from "pinia";
35
+ import { mapEl } from "@/store/states";
36
+ import { useOnLayersUpdate } from "@/composables";
37
+ import { useEventBus } from "@vueuse/core";
38
+ import { eoxLayersKey } from "@/utils/keys";
39
+ import {
40
+ handleProcesses,
41
+ initProcess,
42
+ useAutoExec,
43
+ } from "@/composables/EodashProcess";
44
+
45
+ const layersEvents = useEventBus(eoxLayersKey);
46
+ const { selectedStac } = storeToRefs(useSTAcStore());
47
+
48
+ /** @type {import("vue").Ref<import("vega").Spec|null>} */
49
+ const chartSpec = ref(null);
50
+
51
+ /** @type {import("vue").Ref<Record<string,any>|null>} */
52
+ const chartData = ref(null);
53
+ const isProcessed = ref(false);
54
+
55
+ /** @type {import("vue").Ref<Record<string,any>|null>} */
56
+ const jsonformSchema = ref(null);
57
+
58
+ /** @type {import("vue").Ref<import("@eox/jsonform").EOxJSONForm | null>} */
59
+ const jsonformEl = ref(null);
60
+ const loading = ref(false);
61
+
62
+ const autoExec = ref(false);
63
+
64
+ const isPolling = ref(false);
65
+
66
+ onMounted(async () => {
67
+ // wait for the layers to be rendered
68
+ if (mapEl.value?.layers.length <= 1) {
69
+ layersEvents.once(async () => {
70
+ await initProcess({
71
+ //@ts-expect-error TODO
72
+ selectedStac,
73
+ jsonformEl,
74
+ jsonformSchema,
75
+ chartSpec,
76
+ isProcessed,
77
+ loading,
78
+ isPolling,
79
+ });
80
+ });
81
+ } else {
82
+ await initProcess({
83
+ //@ts-expect-error TODO
84
+ selectedStac,
85
+ jsonformEl,
86
+ jsonformSchema,
87
+ chartSpec,
88
+ isProcessed,
89
+ loading,
90
+ isPolling,
91
+ });
92
+ }
93
+ });
94
+
95
+ useOnLayersUpdate(
96
+ async () =>
97
+ await initProcess({
98
+ //@ts-expect-error TODO
99
+ selectedStac,
100
+ jsonformEl,
101
+ jsonformSchema,
102
+ chartSpec,
103
+ isProcessed,
104
+ loading,
105
+ isPolling,
106
+ }),
107
+ );
108
+
109
+ const startProcess = async () => {
110
+ const errors = jsonformEl.value?.editor.validate();
111
+ if (errors?.length) {
112
+ console.warn("[eodash] Form validation failed", errors);
113
+ return;
114
+ }
115
+ await handleProcesses({
116
+ jsonformEl,
117
+ jsonformSchema,
118
+ chartSpec,
119
+ chartData,
120
+ loading,
121
+ //@ts-expect-error TODO
122
+ selectedStac,
123
+ isProcessed,
124
+ isPolling,
125
+ });
126
+ isProcessed.value = true;
127
+ };
128
+ useAutoExec(autoExec, jsonformEl, jsonformSchema, startProcess);
129
+ </script>
130
+ <style>
131
+ .chart {
132
+ height: 400px;
133
+ width: 100%;
134
+ }
135
+
136
+ .process-container {
137
+ height: 100%;
138
+ overflow-y: auto;
139
+ }
140
+ eox-chart {
141
+ --background-color: transparent;
142
+ }
143
+ </style>