/**
* This module centralizes somes functions to manipulate elements of the page
*
*/
/**
* Returns the velocity input field
* @returns {Element}
*/
function getVelocityField(){
return document.getElementById("lines-velocity");
}
/**
* Returns the redshift input field
* @returns {Element}
*/
function getRedshiftField(){
return document.getElementById("lines-redshift");
}
/**
* Returns the title of the average spectrum
* @returns {Element}
*/
function getAverageSpectrumTitle(){
return document.getElementById("chart-title");
}
/**
* Returns element displaying the position of the mouse on the single slice
* @returns {Element}
*/
function getSingleSliceMousePosition(){
return document.getElementById('external-mouse-position-1');
}
/**
* Returns element displaying the position of the mouse on the summed slice
* @returns {Element}
*/
function getSummedSliceMousePosition(){
return document.getElementById('external-mouse-position-2');
}
function setSliceChannel(text){
document.getElementById("slice-channel").textContent = text;
}
function setSliceRMS(text){
document.getElementById("slice-rms").textContent = text;
}
function setSummedSliceRMS(text){
document.getElementById("summedslice-rms").textContent = text;
}
/**
* Returns the loading image
* @returns
*/
function getLoading(){
return document.getElementById('loading');
}
/**
* Toggles the loading image
* @param {boolean} isVisible
*/
function showLoaderAction(isVisible) {
if (isVisible) {
getLoading().style.display = 'block';
} else {
getLoading().style.display = 'none';
}
}
/**
* Returns the field containing the status of the SAMP connection
* The status is written in text and must be parsed before use.
* @returns {Element}
*/
function getSampConnectionStatus(){
return document.getElementById("withSamp");
}
/**
* Returns the field containing the root url of the service
* @returns {Element}
*/
function getUrlRoot(){
return document.getElementById("urlRoot");
}
/**
* Returns the field containing the path of the currently opened FITS file
* @returns {Element}
*/
function getFitsFilePath(){
return document.getElementById("relFITSFilePath");
}
/**
* Returns the field containing the FITS file header
* @returns {Element}
*/
function getHeader(){
return document.getElementById("header");
}
/**
* Returns the field containing the name of the product whose data are displayed
* @returns {Element}
*/
function getProduct(){
return document.getElementById("product");
}
/**
* Returns the field containing the default value for LUT select
* @returns {Element}
*/
function getDefaultLUTIndex(){
return document.getElementById("defaultLutIndex");
}
/**
* Returns the field containing the url of the spectroscopy server
* @returns {Element}
*/
function getSpectroServerUrl(){
return document.getElementById("spectroServer");
}
/**
* Returns the color selected in the color palette
* @returns {object} values for ittName, lutName, vmName
*/
function getConfiguration() {
return {
ittName: $('#ITT-selector').find(':selected').text().trim(),
lutName: $('#LUT-selector').find(':selected').text().trim(),
vmName: $('#video-mode-selector').find(':selected').text().trim()
}
}
export{
getVelocityField, getRedshiftField, getAverageSpectrumTitle,
getSingleSliceMousePosition, getSummedSliceMousePosition, getLoading,
showLoaderAction, getSampConnectionStatus, getUrlRoot, getFitsFilePath,
getHeader, getProduct, getDefaultLUTIndex, getSpectroServerUrl, getConfiguration,
setSliceChannel, setSliceRMS, setSummedSliceRMS
}