// bytran -|- spectral calculations for portable devices using the HITRAN database
//
// Developed by Dzianis Pliutau (Denis Plutov) and Kostya Roslyakov
// www.bytran.org | bytran@bytran.org
// Copyright (c) 2016 Dzianis Pliutau
// Distributed under the MIT license
//
// The MIT License (MIT)
// Copyright (c) 2016 Dzianis Pliutau
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
// is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.



// Object contains parameters responsible for the vertical axis display and scaling
#ifndef YAXIS_H
#define YAXIS_H

#include <QVector>
#include <QString>

class YAxis
{
public:

    YAxis();

    // Method to set the current displayed value (Attenuation or Radiance)
    quint8 getDisplayedValue();
    void setDisplayedValue(quint8 newDisplayedValue);

    // Methods to get and set the vertical axis plot units
    quint8 getYPlotUnits();
    void setYPlotUnits(quint8 newYPlotUnits);

    // Methods to get and set the minimum vertical axis value
    double getMinYPlot();
    void setMinYPlot(double newMinYPlot);

    // Methods to get and set the maximum vertical axis value
    double getMaxYPlot();
    void setMaxYPlot(double newMaxYPlot);

    // Methods to get the minimum and maximum Attenuation values
    double getMinAtten();
    void setMinAtten(double newMinAtten);
    double getMaxAtten();
    void setMaxAtten(double newMaxAtten);

    // Getting and setting the minimum and maximum cross-sectional values
    double getMinCrossSection();
    void setMinCrossSection(double newMinCrossSection);
    double getMaxCrossSection();
    void setMaxCrossSection(double newMaxCrossSection);

    // Methods to set a variable responsible for auto recalculation of the absorption cross-section scale
    bool getCrossSectionAutoRecalc();
    void setCrossSectionAutoRecalc(bool newCrossSectionAutoRecalc);

    // Methods to get and set the minimum and maximum radiance values
    double getMinRadiance();
    void setMinRadiance(double newMinRadiance);
    double getMaxRadiance();
    void setMaxRadiance(double newMaxRadiance);

    // Methods to set a variable responsible for auto recalculation of the radiance scale
    bool getRadianceAutoRecalc();
    void setRadianceAutoRecalc(bool newRadianceAutoRecalc);

    // Method to enable / disable rulers
    bool getEnableRulers();
    void setEnableRulers(bool newEnableRulers);

    // Methods to get and set the showTotal variable
    bool getShowTotal();
    void setShowTotal(bool newShowTotal);

    // Method to get the vertical axis title (current units)
    QString getYAxisTitle();

    // Method to convert the vertical axis units from the default to current
    double toCurrentFromDefault(double defaultUnitsValue);

private:

    // Parameters related to the vertical axis display and units
    quint8 displayedValue;  // Displayed value (0 - Attenuation, 1 - Cross-section, 2 - Radiance)
    double minAtten;    // Minimum attenuation value along the vertical axis (in the units of absorption, %)
    double maxAtten;    // Maximum attenuation value along the vertical axis (in the units of absorption, %)
    quint8 yPlotUnits;  // Units to display along the verstical axis, 0 - Cross-section, cm^2 / molecule, 1 - Optical depth, 2 - Absorption (%), 3 - Transmission (%)
    double minCrossSection;   // Minimum cross-sectional value
    double maxCrossSection;   // Maximum cross-sectional value
    bool crossSectionAutoRecalc;  // Auto-recalculation of the cross-section axis minimum and maximum values
    double minRadiance;   // Minimum radiance value
    double maxRadiance;   // Maximum radiance value
    bool radianceAutoRecalc;  // Auto=recalculation of the radiance minimum and maximum values

    // Array with the vertical axis titles
    QVector<QString> yAxisTitles;

    // Variable is used to enable / disable rulers
    bool enableRulers;

    // Variable indicating if the total spectrm should be shown or the separate molecules
    bool showTotal;

};

#endif // YAXIS_H
