112 lines
3.5 KiB
C++
112 lines
3.5 KiB
C++
|
#include "LAMPDataShowClass.h"
|
|||
|
|
|||
|
LAMPDataShowClass::LAMPDataShowClass(QWidget *parent)
|
|||
|
: QMainWindow(parent)
|
|||
|
{
|
|||
|
ui.setupUi(this);
|
|||
|
|
|||
|
// <20><><EFBFBD>Ӳ˵<D3B2><CBB5><EFBFBD>
|
|||
|
QMenu* FileOpenMenu = this->ui.menuFile->addMenu(u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|||
|
QAction* action_openfile_tiff = FileOpenMenu->addAction(u8"tiff<EFBFBD>ļ<EFBFBD>"); // <20><><EFBFBD>Ӳ˵<D3B2><CBB5><EFBFBD>
|
|||
|
QObject::connect(action_openfile_tiff, SIGNAL(triggered()), this, SLOT(on_action_openfile_tiff_triggered()));
|
|||
|
|
|||
|
QMenu* ComplexFileOpenMenu = this->ui.menuFile->addMenu(u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|||
|
QAction* action_openfile_tiff_complex = ComplexFileOpenMenu->addAction(u8"tiff<EFBFBD>ļ<EFBFBD>"); // <20><><EFBFBD>Ӳ˵<D3B2><CBB5><EFBFBD>
|
|||
|
QObject::connect(action_openfile_tiff_complex, SIGNAL(triggered()), this, SLOT(on_action_openfile_tiff_complex_triggered()));
|
|||
|
QAction* action_openfile_envi_complex = ComplexFileOpenMenu->addAction(u8"envi<EFBFBD>ļ<EFBFBD>"); // <20><><EFBFBD>Ӳ˵<D3B2><CBB5><EFBFBD>
|
|||
|
QObject::connect(action_openfile_envi_complex, SIGNAL(triggered()), this, SLOT(on_action_openfile_envi_complex_triggered()));
|
|||
|
|
|||
|
this->setContextMenuPolicy(Qt::CustomContextMenu);
|
|||
|
|
|||
|
this->ui.listWidgetContent->setContextMenuPolicy(Qt::CustomContextMenu);
|
|||
|
}
|
|||
|
|
|||
|
LAMPDataShowClass::~LAMPDataShowClass()
|
|||
|
{}
|
|||
|
|
|||
|
|
|||
|
void LAMPDataShowClass::add_DataTree(TaskNode* node) {
|
|||
|
|
|||
|
QListWidgetItem* itemtemp = new QListWidgetItem(this->ui.listWidgetContent);
|
|||
|
itemtemp->setSizeHint(node->sizeHint());
|
|||
|
this->ui.listWidgetContent->setItemWidget(itemtemp, node);
|
|||
|
this->ui.listWidgetContent->addItem(itemtemp);
|
|||
|
|
|||
|
}
|
|||
|
void ShowComplexMatrixPlot(QCustomPlot* customPlot, const Eigen::MatrixXcd& complexMatrix) {
|
|||
|
int nx = complexMatrix.rows(); // <20><><EFBFBD><EFBFBD>
|
|||
|
int ny = complexMatrix.cols(); // <20><><EFBFBD><EFBFBD>
|
|||
|
// <20><><EFBFBD><EFBFBD> Color Map
|
|||
|
QCPColorMap* colorMap = new QCPColorMap(customPlot->xAxis, customPlot->yAxis);
|
|||
|
colorMap->data()->setSize(nx, ny); // <20><><EFBFBD><EFBFBD> Color Map <20>Ĵ<EFBFBD>С
|
|||
|
colorMap->data()->setRange(QCPRange(0, nx), QCPRange(0, ny)); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD>Χ
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
for (int xIndex = 0; xIndex < nx; ++xIndex) {
|
|||
|
for (int yIndex = 0; yIndex < ny; ++yIndex) {
|
|||
|
double magnitude = std::abs(complexMatrix(xIndex, yIndex)); // <20><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> std::arg() <20><>ȡ<EFBFBD><C8A1>λ
|
|||
|
colorMap->data()->setCell(xIndex, yIndex, magnitude);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
colorMap->setGradient(QCPColorGradient::gpJet);
|
|||
|
colorMap->rescaleDataRange(true);
|
|||
|
customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
|
|||
|
customPlot->rescaleAxes();
|
|||
|
customPlot->replot();
|
|||
|
}
|
|||
|
|
|||
|
void LAMPDataShowClass::on_action_openfile_tiff_triggered()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
void LAMPDataShowClass::on_action_openfile_envi_triggered() {
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void LAMPDataShowClass::on_action_openfile_tiff_complex_triggered()
|
|||
|
{
|
|||
|
ComplexDataShowNode* node = new ComplexDataShowNode();
|
|||
|
node->bangdindWindows(this);
|
|||
|
node->TaskXmlPath = getOpenFilePath(nullptr, u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", u8" tiff<66>ļ<EFBFBD>(*.tiff ,*.tif)");
|
|||
|
if (!isExists(node->TaskXmlPath)) {
|
|||
|
return;
|
|||
|
}
|
|||
|
else {}
|
|||
|
node->OpenData(node->TaskXmlPath);
|
|||
|
this->add_DataTree(node);
|
|||
|
node->ExcuteTask();
|
|||
|
}
|
|||
|
|
|||
|
void LAMPDataShowClass::on_action_openfile_envi_complex_triggered()
|
|||
|
{
|
|||
|
ComplexDataShowNode* node = new ComplexDataShowNode();
|
|||
|
node->bangdindWindows(this);
|
|||
|
node->TaskXmlPath = getOpenFilePath(nullptr, u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", u8"envi<EFBFBD>ļ<EFBFBD>(*.dat ) ");
|
|||
|
if (!isExists(node->TaskXmlPath)) {
|
|||
|
return;
|
|||
|
}
|
|||
|
else {}
|
|||
|
node->OpenData(node->TaskXmlPath);
|
|||
|
this->add_DataTree(node);
|
|||
|
node->ExcuteTask();
|
|||
|
}
|
|||
|
|
|||
|
void LAMPDataShowClass::load_complex_data(QString path)
|
|||
|
{
|
|||
|
ComplexDataShowNode* node = new ComplexDataShowNode();
|
|||
|
node->bangdindWindows(this);
|
|||
|
node->TaskXmlPath = path;
|
|||
|
if (!isExists(node->TaskXmlPath)) {
|
|||
|
return;
|
|||
|
}
|
|||
|
else {}
|
|||
|
node->OpenData(node->TaskXmlPath);
|
|||
|
this->add_DataTree(node);
|
|||
|
node->ExcuteTask();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|