Compare commits
3 Commits
09095592af
...
0ac03f0eb5
| Author | SHA1 | Date | |
|---|---|---|---|
| 0ac03f0eb5 | |||
| edfb72eaef | |||
| 7987abf711 |
@ -271,6 +271,10 @@ sizePolicy1.setHeightForWidth(graphicsView_delete->sizePolicy().hasHeightForWidt
|
|||||||
|
|
||||||
gridLayout_toc->addWidget(m_layerTreeView, 0, 0, 1, 1);
|
gridLayout_toc->addWidget(m_layerTreeView, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
// Connect TOC selection change to populate ImageControl
|
||||||
|
connect(m_layerTreeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||||
|
this, SLOT(onLayerTreeSelectionChanged(QItemSelection,QItemSelection)));
|
||||||
|
|
||||||
dock_layers->setWidget(dock_layersWidgetContents);
|
dock_layers->setWidget(dock_layersWidgetContents);
|
||||||
dock_layersWidgetContents->setStyleSheet(qss_DockWidget_contentWidget);
|
dock_layersWidgetContents->setStyleSheet(qss_DockWidget_contentWidget);
|
||||||
|
|
||||||
@ -479,6 +483,10 @@ sizePolicy1.setHeightForWidth(graphicsView_delete->sizePolicy().hasHeightForWidt
|
|||||||
initControlTabwidget();
|
initControlTabwidget();
|
||||||
m_tabManager = new TabManager(ui.controlTabWidget, this);
|
m_tabManager = new TabManager(ui.controlTabWidget, this);
|
||||||
|
|
||||||
|
// Connect ImageControl band change to re-render (m_ic created in initControlTabwidget)
|
||||||
|
connect(m_ic, SIGNAL(bandSelectionChanged(double,double,double)),
|
||||||
|
this, SLOT(onBandSelectionChanged(double,double,double)));
|
||||||
|
|
||||||
//3D模型看板
|
//3D模型看板
|
||||||
ui.mDockWidgetSimulator->setTile(QString::fromLocal8Bit("3D模型"));
|
ui.mDockWidgetSimulator->setTile(QString::fromLocal8Bit("3D模型"));
|
||||||
//ui.mDockWidgetSimulator->show();
|
//ui.mDockWidgetSimulator->show();
|
||||||
@ -715,6 +723,11 @@ void HPPA::initControlTabwidget()
|
|||||||
connect(ui.close_rgb_camera_btn, SIGNAL(clicked()), this, SLOT(onCloseRgbCamera()));//关闭相机
|
connect(ui.close_rgb_camera_btn, SIGNAL(clicked()), this, SLOT(onCloseRgbCamera()));//关闭相机
|
||||||
connect(m_RgbCamera, SIGNAL(CamClosed()), this, SLOT(onClearLabel()));
|
connect(m_RgbCamera, SIGNAL(CamClosed()), this, SLOT(onClearLabel()));
|
||||||
|
|
||||||
|
//图像控制
|
||||||
|
m_ic = new ImageControl();
|
||||||
|
m_ic->setWindowFlags(Qt::Widget);
|
||||||
|
ui.controlTabWidget->addTab(m_ic, QString::fromLocal8Bit("图像控制"));
|
||||||
|
|
||||||
//升降桌dock
|
//升降桌dock
|
||||||
m_adt = new adjustTable();
|
m_adt = new adjustTable();
|
||||||
m_adt->setWindowFlags(Qt::Widget);
|
m_adt->setWindowFlags(Qt::Widget);
|
||||||
@ -743,6 +756,11 @@ void HPPA::initControlTabwidget()
|
|||||||
connect(m_tmc, SIGNAL(sequenceComplete()), this, SLOT(onsequenceComplete()));
|
connect(m_tmc, SIGNAL(sequenceComplete()), this, SLOT(onsequenceComplete()));
|
||||||
m_tmc->setWindowFlags(Qt::Widget);
|
m_tmc->setWindowFlags(Qt::Widget);
|
||||||
ui.controlTabWidget->addTab(m_tmc, QString::fromLocal8Bit("2轴控制"));
|
ui.controlTabWidget->addTab(m_tmc, QString::fromLocal8Bit("2轴控制"));
|
||||||
|
|
||||||
|
|
||||||
|
// Connect ImageControl band change to re-render (m_ic created in initControlTabwidget)
|
||||||
|
connect(m_ic, SIGNAL(bandSelectionChanged(double,double,double)),
|
||||||
|
this, SLOT(onBandSelectionChanged(double,double,double)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void HPPA::recordFromRobotArm(int fileCounter)
|
void HPPA::recordFromRobotArm(int fileCounter)
|
||||||
@ -762,7 +780,8 @@ void HPPA::recordFromRobotArm(int fileCounter)
|
|||||||
|
|
||||||
if (fileCounter - 1 == 0)
|
if (fileCounter - 1 == 0)
|
||||||
{
|
{
|
||||||
m_imageViewerTabWidget->clear();
|
//m_imageViewerTabWidget->clear();
|
||||||
|
removeAllLayersInRasterGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
onCreateTab("img");
|
onCreateTab("img");
|
||||||
@ -1144,6 +1163,7 @@ void HPPA::onStartRecordStep1()
|
|||||||
if (m_RecordState % 2 == 1)
|
if (m_RecordState % 2 == 1)
|
||||||
{
|
{
|
||||||
//m_imageViewerTabWidget->clear();
|
//m_imageViewerTabWidget->clear();
|
||||||
|
removeAllLayersInRasterGroup();
|
||||||
|
|
||||||
m_Imager->setFileName2Save(imgPath);
|
m_Imager->setFileName2Save(imgPath);
|
||||||
m_Imager->setFrameNumber(this->frame_number->text().toInt());
|
m_Imager->setFrameNumber(this->frame_number->text().toInt());
|
||||||
@ -1169,6 +1189,7 @@ void HPPA::onStartRecordStep1()
|
|||||||
if (m_RecordState % 2 == 1)
|
if (m_RecordState % 2 == 1)
|
||||||
{
|
{
|
||||||
//m_imageViewerTabWidget->clear();
|
//m_imageViewerTabWidget->clear();
|
||||||
|
removeAllLayersInRasterGroup();
|
||||||
|
|
||||||
ui.action_start_recording->setText(QString::fromLocal8Bit("停止采集"));
|
ui.action_start_recording->setText(QString::fromLocal8Bit("停止采集"));
|
||||||
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(255,0,0);}");
|
ui.mainToolBar->widgetForAction(ui.action_start_recording)->setStyleSheet("QWidget{background-color:rgb(255,0,0);}");
|
||||||
@ -1196,6 +1217,7 @@ void HPPA::onStartRecordStep1()
|
|||||||
if (m_RecordState % 2 == 1)
|
if (m_RecordState % 2 == 1)
|
||||||
{
|
{
|
||||||
//m_imageViewerTabWidget->clear();
|
//m_imageViewerTabWidget->clear();
|
||||||
|
removeAllLayersInRasterGroup();
|
||||||
|
|
||||||
m_Imager->setFileName2Save(imgPath);
|
m_Imager->setFileName2Save(imgPath);
|
||||||
m_Imager->setFrameNumber(this->frame_number->text().toInt());
|
m_Imager->setFrameNumber(this->frame_number->text().toInt());
|
||||||
@ -1991,3 +2013,69 @@ void HPPA::onLayerCreatedFromFile(const QString& baseName, const QString& filePa
|
|||||||
|
|
||||||
qDebug() << "LayerFileCreated -> created layer:" << baseName << "path:" << filePath << "index:" << fileIndex;
|
qDebug() << "LayerFileCreated -> created layer:" << baseName << "path:" << filePath << "index:" << fileIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HPPA::onLayerTreeSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected)
|
||||||
|
{
|
||||||
|
Q_UNUSED(deselected);
|
||||||
|
|
||||||
|
if (selected.indexes().isEmpty()) {
|
||||||
|
m_ic->setActiveLayer(nullptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QModelIndex idx = selected.indexes().first();
|
||||||
|
if (!idx.isValid()) {
|
||||||
|
m_ic->setActiveLayer(nullptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LayerTreeNode* node = static_cast<LayerTreeNode*>(idx.internalPointer());
|
||||||
|
if (!node || node->type() != LayerTreeNode::Type::Layer) {
|
||||||
|
m_ic->setActiveLayer(nullptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto* layerNode = static_cast<LayerTreeLayerNode*>(node);
|
||||||
|
MapLayer* mapLayer = layerNode->mapLayer();
|
||||||
|
if (!mapLayer || mapLayer->layerType() != MapLayer::LayerType::Raster) {
|
||||||
|
m_ic->setActiveLayer(nullptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RasterLayer* rl = static_cast<RasterLayer*>(mapLayer);
|
||||||
|
m_ic->setActiveLayer(rl);
|
||||||
|
|
||||||
|
// Also switch to the corresponding tab in the image viewer
|
||||||
|
if (m_MapLayerStore && m_imageViewerTabWidget) {
|
||||||
|
QWidget* widget = m_MapLayerStore->widgetForLayer(mapLayer);
|
||||||
|
if (widget) {
|
||||||
|
int tabIndex = m_imageViewerTabWidget->indexOf(widget);
|
||||||
|
if (tabIndex >= 0) {
|
||||||
|
m_imageViewerTabWidget->setCurrentIndex(tabIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HPPA::onBandSelectionChanged(double rWave, double gWave, double bWave)
|
||||||
|
{
|
||||||
|
RasterLayer* rl = m_ic->activeLayer();
|
||||||
|
if (!rl) return;
|
||||||
|
|
||||||
|
// Find the Mapcavas widget associated with this layer and re-render
|
||||||
|
if (!m_MapLayerStore) return;
|
||||||
|
|
||||||
|
QWidget* container = m_MapLayerStore->widgetForLayer(rl);
|
||||||
|
if (!container) return;
|
||||||
|
|
||||||
|
QList<Mapcavas*> mapcavas = container->findChildren<Mapcavas*>();
|
||||||
|
if (mapcavas.isEmpty()) return;
|
||||||
|
|
||||||
|
RasterLayer::RenderParams params = rl->currentRenderParams();
|
||||||
|
params.rWave = rWave;
|
||||||
|
params.gWave = gWave;
|
||||||
|
params.bWave = bWave;
|
||||||
|
rl->setCurrentRenderParams(params);
|
||||||
|
|
||||||
|
mapcavas[0]->freshmap(params);
|
||||||
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
#include <QItemSelection>
|
||||||
|
|
||||||
#include "ui_HPPA.h"
|
#include "ui_HPPA.h"
|
||||||
#include "resononImager.h"
|
#include "resononImager.h"
|
||||||
@ -37,6 +38,7 @@
|
|||||||
#include "RobotArmControl.h"
|
#include "RobotArmControl.h"
|
||||||
#include "OneMotorControl.h"
|
#include "OneMotorControl.h"
|
||||||
#include "TwoMotorControl.h"
|
#include "TwoMotorControl.h"
|
||||||
|
#include "imageControl.h"
|
||||||
|
|
||||||
#include "hppaConfigFile.h"
|
#include "hppaConfigFile.h"
|
||||||
#include "path_tc.h"
|
#include "path_tc.h"
|
||||||
@ -256,6 +258,7 @@ private:
|
|||||||
|
|
||||||
TabManager* m_tabManager;
|
TabManager* m_tabManager;
|
||||||
|
|
||||||
|
ImageControl* m_ic;
|
||||||
adjustTable* m_adt;
|
adjustTable* m_adt;
|
||||||
PowerControl* m_pc;
|
PowerControl* m_pc;
|
||||||
RobotArmControl* m_rac;
|
RobotArmControl* m_rac;
|
||||||
@ -333,6 +336,8 @@ public Q_SLOTS:
|
|||||||
void removeLayerByTreeIndex();
|
void removeLayerByTreeIndex();
|
||||||
void removeAllLayersInRasterGroup();
|
void removeAllLayersInRasterGroup();
|
||||||
|
|
||||||
|
void onLayerTreeSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
|
||||||
|
void onBandSelectionChanged(double rWave, double gWave, double bWave);
|
||||||
signals:
|
signals:
|
||||||
void StartFocusSignal();
|
void StartFocusSignal();
|
||||||
void StartRecordSignal();
|
void StartRecordSignal();
|
||||||
|
|||||||
@ -111,6 +111,7 @@
|
|||||||
<ClCompile Include="Corning410Imager.cpp" />
|
<ClCompile Include="Corning410Imager.cpp" />
|
||||||
<ClCompile Include="CustomDockWidgetBase.cpp" />
|
<ClCompile Include="CustomDockWidgetBase.cpp" />
|
||||||
<ClCompile Include="hppaConfigFile.cpp" />
|
<ClCompile Include="hppaConfigFile.cpp" />
|
||||||
|
<ClCompile Include="imageControl.cpp" />
|
||||||
<ClCompile Include="ImagerOperationBase.cpp" />
|
<ClCompile Include="ImagerOperationBase.cpp" />
|
||||||
<ClCompile Include="imager_base.cpp" />
|
<ClCompile Include="imager_base.cpp" />
|
||||||
<ClCompile Include="irisximeaimager.cpp" />
|
<ClCompile Include="irisximeaimager.cpp" />
|
||||||
@ -160,6 +161,7 @@
|
|||||||
<ClCompile Include="imagerSimulatioin.cpp" />
|
<ClCompile Include="imagerSimulatioin.cpp" />
|
||||||
<ClCompile Include="ImageViewer.cpp" />
|
<ClCompile Include="ImageViewer.cpp" />
|
||||||
<ClCompile Include="main.cpp" />
|
<ClCompile Include="main.cpp" />
|
||||||
|
<QtUic Include="imgControl.ui" />
|
||||||
<QtUic Include="oneMotorControl.ui" />
|
<QtUic Include="oneMotorControl.ui" />
|
||||||
<QtUic Include="PathPlan.ui" />
|
<QtUic Include="PathPlan.ui" />
|
||||||
<QtUic Include="PowerControl.ui" />
|
<QtUic Include="PowerControl.ui" />
|
||||||
@ -187,6 +189,7 @@
|
|||||||
<QtMoc Include="CaptureCoordinator.h" />
|
<QtMoc Include="CaptureCoordinator.h" />
|
||||||
<QtMoc Include="CustomDockWidgetBase.h" />
|
<QtMoc Include="CustomDockWidgetBase.h" />
|
||||||
<QtMoc Include="Carousel.h" />
|
<QtMoc Include="Carousel.h" />
|
||||||
|
<QtMoc Include="imageControl.h" />
|
||||||
<ClInclude Include="imager_base.h" />
|
<ClInclude Include="imager_base.h" />
|
||||||
<ClInclude Include="irisximeaimager.h" />
|
<ClInclude Include="irisximeaimager.h" />
|
||||||
<QtMoc Include="OneMotorControl.h" />
|
<QtMoc Include="OneMotorControl.h" />
|
||||||
|
|||||||
@ -175,6 +175,9 @@
|
|||||||
<ClCompile Include="LayerTreeViewMenuProvider.cpp">
|
<ClCompile Include="LayerTreeViewMenuProvider.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="imageControl.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtMoc Include="fileOperation.h">
|
<QtMoc Include="fileOperation.h">
|
||||||
@ -276,6 +279,9 @@
|
|||||||
<QtMoc Include="LayerTreeViewMenuProvider.h">
|
<QtMoc Include="LayerTreeViewMenuProvider.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
|
<QtMoc Include="imageControl.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="imageProcessor.h">
|
<ClInclude Include="imageProcessor.h">
|
||||||
@ -349,6 +355,9 @@
|
|||||||
<QtUic Include="twoMotorControl.ui">
|
<QtUic Include="twoMotorControl.ui">
|
||||||
<Filter>Form Files</Filter>
|
<Filter>Form Files</Filter>
|
||||||
</QtUic>
|
</QtUic>
|
||||||
|
<QtUic Include="imgControl.ui">
|
||||||
|
<Filter>Form Files</Filter>
|
||||||
|
</QtUic>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="cpp.hint" />
|
<None Include="cpp.hint" />
|
||||||
|
|||||||
186
HPPA/imageControl.cpp
Normal file
186
HPPA/imageControl.cpp
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
#include "imageControl.h"
|
||||||
|
#include "RasterLayer.h"
|
||||||
|
|
||||||
|
ImageControl::ImageControl(QWidget* parent)
|
||||||
|
: QDialog(parent)
|
||||||
|
{
|
||||||
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
// Connect spinboxes
|
||||||
|
connect(ui.spinRed, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &ImageControl::onSpinRedChanged);
|
||||||
|
connect(ui.spinGreen, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &ImageControl::onSpinGreenChanged);
|
||||||
|
connect(ui.spinBlue, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &ImageControl::onSpinBlueChanged);
|
||||||
|
|
||||||
|
// Connect sliders
|
||||||
|
connect(ui.sliderRed, &QSlider::valueChanged, this, &ImageControl::onSliderRedChanged);
|
||||||
|
connect(ui.sliderGreen, &QSlider::valueChanged, this, &ImageControl::onSliderGreenChanged);
|
||||||
|
connect(ui.sliderBlue, &QSlider::valueChanged, this, &ImageControl::onSliderBlueChanged);
|
||||||
|
|
||||||
|
// Connect preset buttons
|
||||||
|
connect(ui.btnTrueColor, &QPushButton::clicked, this, &ImageControl::onTrueColorClicked);
|
||||||
|
connect(ui.btnColorInfrared, &QPushButton::clicked, this, &ImageControl::onColorInfraredClicked);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageControl::~ImageControl()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageControl::setActiveLayer(RasterLayer* layer)
|
||||||
|
{
|
||||||
|
m_activeLayer = layer;
|
||||||
|
|
||||||
|
if (!layer) {
|
||||||
|
setEnabled(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setEnabled(true);
|
||||||
|
|
||||||
|
// Get wavelength range from the layer
|
||||||
|
double minW = 374.5, maxW = 948.1;
|
||||||
|
if (layer->wavelengthRange(minW, maxW)) {
|
||||||
|
m_minWave = minW;
|
||||||
|
m_maxWave = maxW;
|
||||||
|
}
|
||||||
|
|
||||||
|
blockAllSignals(true);
|
||||||
|
|
||||||
|
// Configure spinbox ranges
|
||||||
|
ui.spinRed->setMinimum(m_minWave);
|
||||||
|
ui.spinRed->setMaximum(m_maxWave);
|
||||||
|
ui.spinGreen->setMinimum(m_minWave);
|
||||||
|
ui.spinGreen->setMaximum(m_maxWave);
|
||||||
|
ui.spinBlue->setMinimum(m_minWave);
|
||||||
|
ui.spinBlue->setMaximum(m_maxWave);
|
||||||
|
|
||||||
|
// Configure slider ranges (integer, multiply by 10 for 0.1 nm resolution)
|
||||||
|
int sliderMin = static_cast<int>(m_minWave * 10.0);
|
||||||
|
int sliderMax = static_cast<int>(m_maxWave * 10.0);
|
||||||
|
ui.sliderRed->setMinimum(sliderMin);
|
||||||
|
ui.sliderRed->setMaximum(sliderMax);
|
||||||
|
ui.sliderGreen->setMinimum(sliderMin);
|
||||||
|
ui.sliderGreen->setMaximum(sliderMax);
|
||||||
|
ui.sliderBlue->setMinimum(sliderMin);
|
||||||
|
ui.sliderBlue->setMaximum(sliderMax);
|
||||||
|
|
||||||
|
// Set current values from layer's render params
|
||||||
|
auto params = layer->currentRenderParams();
|
||||||
|
ui.spinRed->setValue(params.rWave);
|
||||||
|
ui.spinGreen->setValue(params.gWave);
|
||||||
|
ui.spinBlue->setValue(params.bWave);
|
||||||
|
|
||||||
|
ui.sliderRed->setValue(static_cast<int>(params.rWave * 10.0));
|
||||||
|
ui.sliderGreen->setValue(static_cast<int>(params.gWave * 10.0));
|
||||||
|
ui.sliderBlue->setValue(static_cast<int>(params.bWave * 10.0));
|
||||||
|
|
||||||
|
blockAllSignals(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
RasterLayer* ImageControl::activeLayer() const
|
||||||
|
{
|
||||||
|
return m_activeLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageControl::onSpinRedChanged(double val)
|
||||||
|
{
|
||||||
|
ui.sliderRed->blockSignals(true);
|
||||||
|
ui.sliderRed->setValue(static_cast<int>(val * 10.0));
|
||||||
|
ui.sliderRed->blockSignals(false);
|
||||||
|
emitBandChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageControl::onSpinGreenChanged(double val)
|
||||||
|
{
|
||||||
|
ui.sliderGreen->blockSignals(true);
|
||||||
|
ui.sliderGreen->setValue(static_cast<int>(val * 10.0));
|
||||||
|
ui.sliderGreen->blockSignals(false);
|
||||||
|
emitBandChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageControl::onSpinBlueChanged(double val)
|
||||||
|
{
|
||||||
|
ui.sliderBlue->blockSignals(true);
|
||||||
|
ui.sliderBlue->setValue(static_cast<int>(val * 10.0));
|
||||||
|
ui.sliderBlue->blockSignals(false);
|
||||||
|
emitBandChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageControl::onSliderRedChanged(int val)
|
||||||
|
{
|
||||||
|
double wv = val / 10.0;
|
||||||
|
ui.spinRed->blockSignals(true);
|
||||||
|
ui.spinRed->setValue(wv);
|
||||||
|
ui.spinRed->blockSignals(false);
|
||||||
|
emitBandChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageControl::onSliderGreenChanged(int val)
|
||||||
|
{
|
||||||
|
double wv = val / 10.0;
|
||||||
|
ui.spinGreen->blockSignals(true);
|
||||||
|
ui.spinGreen->setValue(wv);
|
||||||
|
ui.spinGreen->blockSignals(false);
|
||||||
|
emitBandChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageControl::onSliderBlueChanged(int val)
|
||||||
|
{
|
||||||
|
double wv = val / 10.0;
|
||||||
|
ui.spinBlue->blockSignals(true);
|
||||||
|
ui.spinBlue->setValue(wv);
|
||||||
|
ui.spinBlue->blockSignals(false);
|
||||||
|
emitBandChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageControl::onTrueColorClicked()
|
||||||
|
{
|
||||||
|
blockAllSignals(true);
|
||||||
|
ui.spinRed->setValue(665.0);
|
||||||
|
ui.spinGreen->setValue(560.0);
|
||||||
|
ui.spinBlue->setValue(490.0);
|
||||||
|
ui.sliderRed->setValue(static_cast<int>(665.0 * 10.0));
|
||||||
|
ui.sliderGreen->setValue(static_cast<int>(560.0 * 10.0));
|
||||||
|
ui.sliderBlue->setValue(static_cast<int>(490.0 * 10.0));
|
||||||
|
blockAllSignals(false);
|
||||||
|
emitBandChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageControl::onColorInfraredClicked()
|
||||||
|
{
|
||||||
|
blockAllSignals(true);
|
||||||
|
ui.spinRed->setValue(800.0);
|
||||||
|
ui.spinGreen->setValue(665.0);
|
||||||
|
ui.spinBlue->setValue(560.0);
|
||||||
|
ui.sliderRed->setValue(static_cast<int>(800.0 * 10.0));
|
||||||
|
ui.sliderGreen->setValue(static_cast<int>(665.0 * 10.0));
|
||||||
|
ui.sliderBlue->setValue(static_cast<int>(560.0 * 10.0));
|
||||||
|
blockAllSignals(false);
|
||||||
|
emitBandChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageControl::emitBandChange()
|
||||||
|
{
|
||||||
|
double r = ui.spinRed->value();
|
||||||
|
double g = ui.spinGreen->value();
|
||||||
|
double b = ui.spinBlue->value();
|
||||||
|
|
||||||
|
// Update active layer's stored render params
|
||||||
|
if (m_activeLayer) {
|
||||||
|
auto params = m_activeLayer->currentRenderParams();
|
||||||
|
params.rWave = r;
|
||||||
|
params.gWave = g;
|
||||||
|
params.bWave = b;
|
||||||
|
m_activeLayer->setCurrentRenderParams(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
emit bandSelectionChanged(r, g, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageControl::blockAllSignals(bool block)
|
||||||
|
{
|
||||||
|
ui.spinRed->blockSignals(block);
|
||||||
|
ui.spinGreen->blockSignals(block);
|
||||||
|
ui.spinBlue->blockSignals(block);
|
||||||
|
ui.sliderRed->blockSignals(block);
|
||||||
|
ui.sliderGreen->blockSignals(block);
|
||||||
|
ui.sliderBlue->blockSignals(block);
|
||||||
|
}
|
||||||
48
HPPA/imageControl.h
Normal file
48
HPPA/imageControl.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
|
||||||
|
#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:
|
||||||
|
void onSpinRedChanged(double val);
|
||||||
|
void onSpinGreenChanged(double val);
|
||||||
|
void onSpinBlueChanged(double val);
|
||||||
|
void onSliderRedChanged(int val);
|
||||||
|
void onSliderGreenChanged(int val);
|
||||||
|
void onSliderBlueChanged(int val);
|
||||||
|
void onTrueColorClicked();
|
||||||
|
void onColorInfraredClicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void emitBandChange();
|
||||||
|
void blockAllSignals(bool block);
|
||||||
|
|
||||||
|
Ui::ImageControl ui;
|
||||||
|
RasterLayer* m_activeLayer = nullptr;
|
||||||
|
double m_minWave = 374.5;
|
||||||
|
double m_maxWave = 948.1;
|
||||||
|
};
|
||||||
155
HPPA/imgControl.ui
Normal file
155
HPPA/imgControl.ui
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>ImageControl</class>
|
||||||
|
<widget class="QWidget" name="ImageControl">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>520</width>
|
||||||
|
<height>360</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Color Adjust</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupAdjustments">
|
||||||
|
<property name="title">
|
||||||
|
<string>Adjustments</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="labelRed">
|
||||||
|
<property name="text">
|
||||||
|
<string>Red</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="spinRed">
|
||||||
|
<property name="minimum">
|
||||||
|
<double>374.500000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>948.100000000000023</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>643.100000000000023</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QSlider" name="sliderRed">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QLabel" name="labelRedNm">
|
||||||
|
<property name="text">
|
||||||
|
<string>nm</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="labelGreen">
|
||||||
|
<property name="text">
|
||||||
|
<string>Green</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="spinGreen">
|
||||||
|
<property name="minimum">
|
||||||
|
<double>374.500000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>948.100000000000023</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>548.799999999999955</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QSlider" name="sliderGreen">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QLabel" name="labelGreenNm">
|
||||||
|
<property name="text">
|
||||||
|
<string>nm</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="labelBlue">
|
||||||
|
<property name="text">
|
||||||
|
<string>Blue</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="spinBlue">
|
||||||
|
<property name="minimum">
|
||||||
|
<double>374.500000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>948.100000000000023</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>461.600000000000023</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QSlider" name="sliderBlue">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="3">
|
||||||
|
<widget class="QLabel" name="labelBlueNm">
|
||||||
|
<property name="text">
|
||||||
|
<string>nm</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupPresets">
|
||||||
|
<property name="title">
|
||||||
|
<string>Presets</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="presetLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnTrueColor">
|
||||||
|
<property name="text">
|
||||||
|
<string>True Color</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnColorInfrared">
|
||||||
|
<property name="text">
|
||||||
|
<string>Color Infrared</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
Reference in New Issue
Block a user