Commit 92ffa4a3 authored by Caillat Michel's avatar Caillat Michel
Browse files

Adapted to the new olqv_viewer.js

parent e7e20ee3
......@@ -182,7 +182,7 @@
<div id="loading"></div>
<div id="FITSHDR" class="overlay" style="overflow:scroll"></div>
<div id="fullscreen" class="fullscreen">
<div class="sidepanel">
<nav class="navbar navbar-dark bg-dark">
......@@ -196,7 +196,8 @@
<table style="width: 100%">
<tr>
<td align='center'>
<div id="infos-line" style="height:20; width:384; background-color: lightgray"> Integrated flux: ... </div>
<div id="infos-line" style="height:20; width:384; background-color: lightgray"> Integrated
flux: ... </div>
</td>
</tr>
</table>
......@@ -274,27 +275,13 @@
// This is the (hidden) canvas where the images are actually drawn.
let hiddenCanvas = document.getElementById("hiddenSlice");
// This is the function describing the actions performed when an image is loaded
var imageLoadFunction = function (image, src) {
enter(imageLoadFunction.name);
document.getElementById('loading').style.display = 'block';
image.getImage().addEventListener('load', function () {
document.getElementById('loading').style.display = 'none';
hiddenCanvas.getContext('2d').drawImage(image.getImage(), 0, 0);
});
image.getImage().src = src;
image.getImage().crossOrigin = "Anonymous";
exit()
};
var displaySlice = function (relFITSFilePath, sliceIndex, viewer, settings) {
enter(displaySlice.name);
lutName = settings.selectedLUT;
ittName = settings.selectedITT;
vmName = settings.selectedVideoMode;
console.log(`${lutName}, ${ittName}, ${vmName}`);
var updateViewer = function (relFITSFilePath, sliceIndex, viewer) {
enter(updateViewer.name);
document.getElementById('loading').style.display = "block";
ittName = $('#ITTSelector').find(':selected').text().trim();
lutName = $('#LUTSelector').find(':selected').text().trim();
vmName = $('#VideoModeSelector').find(':selected').text().trim();
document.getElementById('loading').style.display = 'block';
$.post('png', { 'si': sliceIndex, 'relFITSFilePath': relFITSFilePath, 'ittName': ittName, 'lutName': lutName, 'vmName': vmName }).done(
function (resp) {
......@@ -316,8 +303,7 @@
}*/
document.getElementById('loading').style.display = "none";
console.log("$.post('/png', {'si': _sliceIndex, 'relFITSFilePath': _relFITSFilePath}).done(: exiting");
}
)
})
exit();
};
......@@ -405,8 +391,6 @@
width = height;
}
$('#LUTSelector').prop('selectedIndex', <%=renderingCapabilities["default_lut_index"] %>);
console.log("Data of '" + relFITSFilePath + "' are contained in " + JSON.stringify(resp.data["result"]));
let extent = [0, 0, width - 1, height - 1];
let raDDtoPixelConverter = new RADDtoPixelConverter(RADECRangeInDegrees[0][0], RADECRangeInDegrees[2][0], extent[0], extent[2]);
......@@ -443,7 +427,6 @@
var is3D = (naxis == 3 && naxis3 > 1) || (naxis == 4 && naxis3 > 1 && naxis4 == 1);
var viewer = new Viewer(relFITSFilePath, width, height, "slice", "hiddenSlice", coordinatesFormatter, is3D);
updateViewer(relFITSFilePath, 0, viewer);
let keyCodeProcessor = new KeyCodeProcessor(viewer);
keyCodeProcessor.open();
......@@ -458,16 +441,21 @@
let settings = new Settings(viewer);
/*<% renderingCapabilities["luts"].forEach(function (lut) { %>*/
settings.setLUT("<%=lut%>");
settings.appendLUT("<%=lut%>");
/*<% }) %>*/
settings.setLUTSelectorIndex(<%=renderingCapabilities["default_lut_index"] %>);
/*<% renderingCapabilities["itts"].forEach(function (itt) { %>*/
settings.setITT("<%=itt%>");
settings.appendITT("<%=itt%>");
/*<% }) %>*/
settings.setITTSelectorIndex(<%=renderingCapabilities["default_itt_index"] %>);
/*<% renderingCapabilities["vmodes"].forEach(function (vmode) { %>*/
settings.setVM("<%=vmode%>");
settings.appendVM("<%=vmode%>");
/*<% }) %>*/
settings.setVideoModeSelectorIndex(<%=renderingCapabilities["default_vmode_index"] %>);
customControls.addButton(settings.getButton());
......@@ -483,7 +471,10 @@
let boxesFactory = new BoxesFactory(viewer, infosBlock);
customControls.addButton(boxesFactory.getButton());
$('a#rccap').click(function () { updateViewer(relFITSFilePath, 0, viewer); });
displaySlice(relFITSFilePath, 0, viewer, settings);
settings.applyBtn.click(function () { displaySlice(relFITSFilePath, 0, viewer, settings); });
console.log('$.post("", {"method": "RADECRangeInDegrees", "fileName": relFITSFilePath}).done(function (resp) { : exiting');
//activate_markers(viewer);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment