Skip to content

Commit 4185fdc

Browse files
authored
Feat: Implementation of COG source change and minor style fix (#2721)
* feat: implemented change of cog source based on time information * fix: spinner style
1 parent 8721d42 commit 4185fdc

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

app/src/components/map/MapOverlay.vue

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,43 @@ export default {
8383
border-bottom: 0;
8484
margin-left: -10px;
8585
margin-bottom: -10px;
86+
}
87+
.loading-indicator {
88+
top: unset;
89+
bottom: 0.5em !important;
90+
left: 0.5em !important;
91+
height: 22px;
92+
pointer-events: none !important;
93+
}
94+
95+
.loading-indicator.hidden {
96+
display: none;
97+
}
98+
99+
@keyframes spinner {
100+
to {
101+
transform: rotate(360deg);
102+
}
103+
}
104+
105+
.spinner:after {
106+
content: "";
107+
box-sizing: border-box;
108+
position: absolute;
109+
top: 50%;
110+
left: 50%;
111+
width: 18px;
112+
height: 18px;
113+
margin-top: -9px;
114+
margin-left: -9px;
115+
border-radius: 50%;
116+
border: 5px solid rgba(180, 180, 180, 0.6);
117+
border-top-color: rgba(0, 0, 0, 0.6);
118+
animation: spinner 0.6s linear infinite;
119+
}
120+
.theme--dark .spinner:after {
121+
border: 5px solid rgba(180, 180, 180, 0.6);
122+
border-top-color: rgba(255, 255, 255, 0.6);
86123
}`;
87124
if ('mapContainer' in this.$parent.$refs && this.$parent.$refs.mapContainer.shadowRoot) {
88125
this.$parent.$refs.mapContainer.shadowRoot.appendChild(style);

app/src/components/map/timeLayerUtils.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import GeoTIFF from 'ol/source/GeoTIFF';
1111

1212
// eslint-disable-next-line import/prefer-default-export
1313
export function updateTimeLayer(layer, config, time, drawnArea, sourceGet = 'updateTime') {
14-
if (config.protocol === 'cog' && !config.features) {
14+
if (config.protocol === 'cog' && 'sources' in config && !config.features) {
1515
const updatedSources = config.sources.map((item) => {
1616
const url = item.url.replace(/{time}/i, config.dateFormatFunction(time));
1717
return { url };
@@ -21,6 +21,13 @@ export function updateTimeLayer(layer, config, time, drawnArea, sourceGet = 'upd
2121
normalize: config.normalize ? config.normalize : false,
2222
interpolate: false,
2323
}));
24+
} else if (Array.isArray(time)) {
25+
// This case if for geotiff assets passed in the time
26+
layer.setSource(new GeoTIFF({
27+
sources: time[1].map((url) => ({ url })),
28+
normalize: config.normalize ? config.normalize : false,
29+
interpolate: false,
30+
}));
2431
} else {
2532
const source = layer.getSource();
2633
const updateTimeFunction = source.get(sourceGet);

0 commit comments

Comments
 (0)