Skip to content

Commit

Permalink
Merge branch 'main' of gh_morandd:FAIRiCUBE/webvisualization
Browse files Browse the repository at this point in the history
  • Loading branch information
morandd committed Nov 29, 2024
2 parents 716a954 + 142abd3 commit c543195
Show file tree
Hide file tree
Showing 7 changed files with 377 additions and 3 deletions.
331 changes: 331 additions & 0 deletions public/Logo_FAIRiCUBE_RGB 1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/fairicubelogo2_108520563.jpeg
Binary file not shown.
9 changes: 9 additions & 0 deletions public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/components/Colorbar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,16 @@ function updateColorbar() {
for (const value of stops){
const div = document.createElement('div');
// Creat a label that shows three significant digits
try {
const label = value.toPrecision(3);
div.innerHTML = label;
colorbar.appendChild(div);
} catch (e) {
console.log(`Error in updateColorbar. E=`,e);
console.log(`Error in updateColorbar. value`,value);
console.log(`Error in updateColorbar. stops`,stops);
}

}
colorbar.style.background = getPaletteAsGradient();
return;
Expand Down
7 changes: 6 additions & 1 deletion src/components/Map.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { getInterpolateBand1AsColor } from '../scripts/palette.js';
import { transformExtent, Projection, get as getProjection, fromLonLat } from 'ol/proj';
import {register,fromEPSGCode} from 'ol/proj/proj4';
import proj4 from 'proj4'
import {getQGISColorfile} from '../scripts/parseQGISColorfile.js';
import {getQGISColorfile, getPalettenameFile} from '../scripts/parseQGISColorfile.js';


let source : any = null;
Expand Down Expand Up @@ -117,6 +117,11 @@ async function buildMapForGeotiff() {
}
});

// Launch an async function to try and get a .palettename.txt for this URL
// This will trigger a "newpalette" event if found
getPalettenameFile();


// Launch an async function to try and get a QGIS colorfile for the palette
// This will trigger a "newpalette" event if a QGIS colorfile is found
getQGISColorfile();
Expand Down
21 changes: 21 additions & 0 deletions src/scripts/parseQGISColorfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,27 @@ export async function getQGISColorfile(){
}
}


/**
* Try and get the .palettename.txt file for the URL
* This will trigger a "newpalette" event if found
* @returns
*/
export async function getPalettenameFile(){
const url = localStorage.getItem('url');
if (!url) return null;
try {
const palettenameurl = url.replace('.tif', '.palettename.txt');
const response = await fetch(palettenameurl);
if (!response.ok) return null;
const text = await response.text();
localStorage.setItem('palettename', text);
document.dispatchEvent(new Event('newpalette'));
} catch (e) {
}
}


/**
* Returns a function which accepts a value in the domain
* of the QGISColorfile and returns a color.
Expand Down
5 changes: 3 additions & 2 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ html {

@keyframes shift-right {
0% { transform: translateX(0); }
50% { transform: translateX(1rem); }
50% { transform: translateX(0.7rem); }
100% { transform: translateX(0); }
}

Expand Down Expand Up @@ -49,11 +49,12 @@ details.stactreeview {
cursor: pointer;
display: inline-block;
background-image: url('/fairicube_logo_400x297.jpg');
background-image: url('/Logo_FAIRiCUBE_RGB 1.svg');
background-size: contain;
background-repeat: no-repeat;
background-position: center;
vertical-align: middle;
mix-blend-mode: multiply; /* Set white as transparent */
/*mix-blend-mode: multiply; /* Set white as transparent */
position: relative;
transition: transform 0.4s ease-in-out;
transform: translateX(0);
Expand Down

0 comments on commit c543195

Please sign in to comment.