Beispiel #1
0
///
/// \brief SpectrumViewer::SpectrumViewer
/// The constructor for when a spectrum viewer is linked to a MapViewer
/// \param parent
/// \param map_data
/// \param x_axis_description
/// \param y_axis_description
/// \param dataset
/// \param widget_size
/// \param directory
///
SpectrumViewer::SpectrumViewer(MapViewer *parent,
                               MapData *map_data,
                               const QString x_axis_description,
                               const QString y_axis_description,
                               QSharedPointer<VespucciDataset> dataset,
                               QSize widget_size,
                               QString directory) :
    QDialog(parent),
    ui(new Ui::SpectrumViewer)
{
    ui->setupUi(this);
    linked_to_map_ = true;
    map_data_ = map_data;
    spectrum_plot_ = findChild<QCustomPlot *>("spectrum");
    spectrum_plot_->addGraph();
    spectrum_plot_->xAxis->setLabel(x_axis_description);
    spectrum_plot_->yAxis->setLabel(y_axis_description);

    spectrum_plot_->replot();

    QVector<double> plot_data = dataset->PointSpectrum(0);
    QVector<double> wavelength = dataset->WavelengthQVector();

    coordinate_label_ = findChild<QLabel *>("coordinateLabel");
    value_label_ = findChild<QLabel *>("valueLabel");

    spectrum_plot_->graph(0)->addData(wavelength, plot_data);


    spectrum_plot_->xAxis->setRange(dataset->WavelengthRange());
    spectrum_plot_->yAxis->setRange(dataset->PointSpectrumRange(0));
    dataset_ = dataset;
    widget_size_ = widget_size;
    directory_ = directory;

    spectrum_plot_->setInteraction(QCP::iRangeDrag, true);
    spectrum_plot_->setInteraction(QCP::iRangeZoom, true);
}