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