70 lines
1.8 KiB
C++
70 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include <QDialog>
|
|
#include <QNetworkRequest>
|
|
#include <QNetworkReply>
|
|
#include <QNetworkAccessManager>
|
|
#include <vector>
|
|
|
|
#include "ui_imgControl.h"
|
|
|
|
class RasterLayer;
|
|
|
|
class ImageControl : public QDialog
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
ImageControl(QWidget* parent = nullptr);
|
|
~ImageControl();
|
|
|
|
// Populate controls from a RasterLayer's wavelength info and current render params
|
|
void setActiveLayer(RasterLayer* layer);
|
|
RasterLayer* activeLayer() const;
|
|
|
|
public Q_SLOTS:
|
|
|
|
Q_SIGNALS:
|
|
// Emitted when user changes any of the R/G/B wavelength values
|
|
void bandSelectionChanged(double rWave, double gWave, double bWave);
|
|
|
|
private Q_SLOTS:
|
|
// Sync slider position while dragging spinbox (no render)
|
|
void onSpinRedValueChanged(double val);
|
|
void onSpinGreenValueChanged(double val);
|
|
void onSpinBlueValueChanged(double val);
|
|
|
|
// Sync spinbox display while dragging slider (no render)
|
|
void onSliderRedValueChanged(int val);
|
|
void onSliderGreenValueChanged(int val);
|
|
void onSliderBlueValueChanged(int val);
|
|
|
|
// Commit: spinbox Enter key pressed / focus lost
|
|
void onSpinRedEditingFinished();
|
|
void onSpinGreenEditingFinished();
|
|
void onSpinBlueEditingFinished();
|
|
|
|
// Commit: slider mouse released
|
|
void onSliderRedReleased();
|
|
void onSliderGreenReleased();
|
|
void onSliderBlueReleased();
|
|
|
|
void onTrueColorClicked();
|
|
void onColorInfraredClicked();
|
|
|
|
private:
|
|
void emitBandChange();
|
|
void blockAllSignals(bool block);
|
|
|
|
// Find the band index whose wavelength is closest to the given value
|
|
int nearestBandIndex(double wave) const;
|
|
// Set spinbox and slider to wavelength of the given band index
|
|
void setControlsToBandIndex(QDoubleSpinBox* spin, QSlider* slider, int idx);
|
|
|
|
Ui::ImageControl ui;
|
|
RasterLayer* m_activeLayer = nullptr;
|
|
double m_minWave = 374.5;
|
|
double m_maxWave = 948.1;
|
|
std::vector<double> m_wavelengths; // band wavelengths from header
|
|
};
|