Commit d68d06a3 authored by Caillat Michel's avatar Caillat Michel
Browse files

Code cleanup

parent 7d72fb76
......@@ -265,23 +265,15 @@ var settings;
var boxTool;
var keyCodeProcessor;
var format = function(floatValue) {
let result = floatValue;
if (typeof result === "number" && !Number.isInteger(result)){
result = result.toExponential(4);
}
return result;
};
var infos_line = document.getElementById('infos-line');
var infos_block = document.getElementById('ModalInfosBlockBody');
var populateInfosBlock = function(title, collection) {
infos_block.innerHTML = "<b>"+title+" <br><br>";
for (var k in collection) {
infos_block.innerHTML += k + ":" + format(collection[k]["value"]) + " " + collection[k]["unit"] + "<br>";
}
}
// var populateInfosBlock = function(title, collection) {
// infos_block.innerHTML = "<b>"+title+" <br><br>";
// for (var k in collection) {
// infos_block.innerHTML += k + ":" + format(collection[k]["value"]) + " " + collection[k]["unit"] + "<br>";
// }
// }
function SliceViewer (relFITSFilePath, width, height, RADECRangeInDegrees, FITSHeader, divSlice) {
console.log("SliceViewer : entering");
......@@ -343,6 +335,9 @@ function SliceViewer (relFITSFilePath, width, height, RADECRangeInDegrees, FITSH
let _naxis = parseInt(header["NAXIS"]);
let _naxis1 = parseInt(header["NAXIS1"]);
let _naxis2 = parseInt(header["NAXIS2"]);
if (_naxis > 2) _naxis3 = parseInt(header["NAXIS3"]);
if (_naxis > 4) _naxis4 = parseInt(header["NAXIS4"]);
let _crpix = [parseFloat(header["CRPIX1"]), parseFloat(header["CRPIX2"])];
let _crval = [parseFloat(header["CRVAL1"]), parseFloat(header["CRVAL2"])];
let _cdelt = [parseFloat(header["CDELT1"]), parseFloat(header["CDELT2"])];
......@@ -372,6 +367,10 @@ function SliceViewer (relFITSFilePath, width, height, RADECRangeInDegrees, FITSH
return result;
};
this.is3D = function() {
return (_naxis==3 && _naxis3>1) || (_naxis==4 && _naxis3>1 && _naxis4==1);
}
this.getSliceIndex = function () {
return _sliceIndex;
}
......
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