/// /// \brief SpectrumViewer::SpectrumViewer /// A constructor for using a spectrum viewer to view VCA endmembers /// \param parent /// \param dataset /// \param endmember /// \param directory /// SpectrumViewer::SpectrumViewer(DataViewer *parent, QSharedPointer<VespucciDataset> dataset, int endmember, QString directory, QString type) : QDialog(parent), ui(new Ui::SpectrumViewer) { ui->setupUi(this); dataset_ = dataset; coordinate_label_ = findChild<QLabel *>("coordinateLabel"); value_label_ = findChild<QLabel *>("valueLabel"); coordinate_label_->setVisible(false); value_label_->setVisible(false); spectrum_plot_ = findChild<QCustomPlot *>("spectrum"); spectrum_plot_->addGraph(); spectrum_plot_->xAxis->setLabel(dataset->x_axis_description()); spectrum_plot_->yAxis->setLabel(dataset->y_axis_description()); QVector<double> plot_data; spectrum_plot_->replot(); if (type == "VCA"){ plot_data = dataset_->vertex_components_data()->EndmemberQVec(endmember); } QVector<double> wavelength = dataset->WavelengthQVector(); coordinate_label_ = findChild<QLabel *>("coordinateLabel"); value_label_ = findChild<QLabel *>("valueLabel"); spectrum_plot_->graph(0)->addData(wavelength, plot_data); directory_ = directory; spectrum_plot_->setInteraction(QCP::iRangeDrag, true); spectrum_plot_->setInteraction(QCP::iRangeZoom, true); spectrum_plot_->rescaleAxes(); }
SpectrumViewer::SpectrumViewer(SpectrumSelectionDialog *parent, QSharedPointer<VespucciDataset> dataset): QDialog(parent), ui(new Ui::SpectrumViewer) { ui->setupUi(this); cout << "alternative SpectrumViewer constructor" << endl; dataset_ = dataset; cout << "find labels " << endl; coordinate_label_ = findChild<QLabel *>("coordinateLabel"); value_label_ = findChild<QLabel *>("valueLabel"); cout << "edit labels" << endl; coordinate_label_->setVisible(false); value_label_->setVisible(false); cout << "find plot" << endl; spectrum_plot_ = findChild<QCustomPlot *>("spectrum"); cout << "set labels" << endl; spectrum_plot_->addGraph(); spectrum_plot_->xAxis->setLabel(dataset->x_axis_description()); spectrum_plot_->yAxis->setLabel(dataset->y_axis_description()); cout << "set data" << endl; QVector<double> wavelength = dataset->WavelengthQVector(); QVector<double> plot_data = dataset->PointSpectrum(0); spectrum_plot_->graph(0)->addData(wavelength, plot_data); dataset_ = dataset; spectrum_plot_->setInteraction(QCP::iRangeDrag, true); spectrum_plot_->setInteraction(QCP::iRangeZoom, true); spectrum_plot_->rescaleAxes(); cout << "end of constructor" << endl; }
/// /// \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); }