修改了ImageShowDialogClass,允许用户查看垂直向、水平向的图像像素值

pull/3/head
陈增辉 2024-11-06 20:32:02 +08:00
parent 88e8fda6d8
commit 9da9f6f153
14 changed files with 839 additions and 278 deletions

View File

@ -7,16 +7,16 @@
<entry key="Debug">
<value>
<PerProfileState>
<option name="myQmlPath" value="C:/vcpkg/installed/x64-windows/qml" />
<option name="myQtBinPath" value="C:/vcpkg/installed/x64-windows/tools/qt5/bin" />
<option name="myQmlPath" value="$PROJECT_DIR$/../../../vcpkg/installed/x64-windows/qml" />
<option name="myQtBinPath" value="$PROJECT_DIR$/../../../vcpkg/installed/x64-windows/tools/qt5/bin" />
</PerProfileState>
</value>
</entry>
<entry key="Release">
<value>
<PerProfileState>
<option name="myQmlPath" value="C:/vcpkg/installed/x64-windows/qml" />
<option name="myQtBinPath" value="C:/vcpkg/installed/x64-windows/tools/qt5/bin" />
<option name="myQmlPath" value="$PROJECT_DIR$/../../../vcpkg/installed/x64-windows/qml" />
<option name="myQtBinPath" value="$PROJECT_DIR$/../../../vcpkg/installed/x64-windows/tools/qt5/bin" />
</PerProfileState>
</value>
</entry>

View File

@ -2,5 +2,7 @@
<project version="4">
<component name="BackendCodeEditorSettings">
<option name="/Default/Housekeeping/GlobalSettingsUpgraded/IsUpgraded/@EntryValue" value="true" type="bool" />
<option name="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003Aio_002Eh_002Fl_003AC_0021_003FDev_003FPCL_003Finclude_003Fpcl_002D1_002E14_003Fpcl_003Fio_003Fio_002Eh/@EntryIndexedValue" value="ExplicitlyExcluded" type="string" />
<option name="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003Aio_002Eh_002Fl_003AC_0021_003FDev_003FPCL_003Finclude_003Fpcl_002D1_002E14_003Fpcl_003Fio_003Fio_002Eh/@EntryIndexRemoved" />
</component>
</project>

View File

@ -39,7 +39,7 @@ find_path(CGNS_DIRS
NAMES
include/cgnslib.h
PATHS
C:/vcpkg/installed/x64-windows
D:/vcpkg/installed/x64-windows
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH
)

View File

@ -101,10 +101,10 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set_property(TARGET OpenCASCADE::Tcl86 APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_property(TARGET OpenCASCADE::Tk86 APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(OpenCASCADE::Freetype PROPERTIES
IMPORTED_IMPLIB_RELEASE "C:/vcpkg/installed/x64-windows/lib/freetype.lib"
IMPORTED_LOCATION_RELEASE "C:/vcpkg/installed/x64-windows/bin/freetype.dll"
IMPORTED_IMPLIB_DEBUG "C:/vcpkg/installed/x64-windows/debug/lib/freetyped.lib"
IMPORTED_LOCATION_DEBUG "C:/vcpkg/installed/x64-windows/debug/bin/freetyped.dll"
IMPORTED_IMPLIB_RELEASE "D:/vcpkg/installed/x64-windows/lib/freetype.lib"
IMPORTED_LOCATION_RELEASE "D:/vcpkg/installed/x64-windows/bin/freetype.dll"
IMPORTED_IMPLIB_DEBUG "D:/vcpkg/installed/x64-windows/debug/lib/freetyped.lib"
IMPORTED_LOCATION_DEBUG "D:/vcpkg/installed/x64-windows/debug/bin/freetyped.dll"
)
set_target_properties(OpenCASCADE::Tcl86 PROPERTIES
IMPORTED_IMPLIB_RELEASE "${OpenCASCADE_LIBRARY_DIRS}/tcl86.lib"

View File

@ -54,16 +54,18 @@ namespace MainWidget
void MeshViewProvider::updateMeshActorSlot()
{
qDebug()<<"updateMeshActorSlot started!!!";
const int nk = _meshData->getKernalCount();
for (int i = 0; i < nk; ++i)
{
auto Kernal = _meshData->getKernalAt(i);
// qDebug()<<"Kernel is nullptr" << nullptr!=Kernal;
if (!_viewObjects.contains(Kernal))
{
auto vobj = new MeshKernalViewObj(Kernal); // 创建一个新的视图
_viewObjects.insert(Kernal, vobj);
updateDisplayModel(Kernal);
updateGraphOption(Kernal);
updateDisplayModel(Kernal); qDebug()<<"updateDisplayModel !!!";
updateGraphOption(Kernal); qDebug()<<"updatupdateGraphOption !!!";
vtkActor **ac = vobj->getActor();
_preWindow->AppendActor(ac[0]);
_preWindow->AppendActor(ac[1]);
@ -77,6 +79,8 @@ namespace MainWidget
continue;
this->removeDisplay(ker);
}
qDebug()<<"updateMeshActorSlot finished!!!";
}
void MeshViewProvider::highLighKernel(MeshData::MeshKernal *k)

File diff suppressed because it is too large Load Diff

View File

@ -111,7 +111,6 @@ namespace Plugins {
}
else{
qDebug() << "loading Plugin dll Failure: " << plugpath;
}
emit updateActionStates();

View File

@ -22,9 +22,7 @@ namespace MeshData
void MeshThreadBase::defaultMeshFinished()
{
ModuleBase::ThreadTask::threadTaskFinished();
Py::PythonAgent::getInstance()->unLock();
qDebug()<<"MeshThreadBase::defaultMeshFinished";
if (_threadRuning)
{
QString information{};
@ -39,7 +37,7 @@ namespace MeshData
// emit _mainwindow->updateActionsStatesSig();
emit _mainwindow->getSubWindowManager()->openPreWindowSig();
emit _mainwindow->updatePreMeshActorSig();
qDebug()<<"MeshThreadBase::defaultMeshFinished";
information = QString("Successful Import Mesh From \"%1\"").arg(_fileName);
msg.type = Common::Message::Normal;
msg.message = information;
@ -77,6 +75,9 @@ namespace MeshData
emit showInformation(information);
emit _mainwindow->printMessageToMessageWindow(msg);
}
qDebug()<<"MeshThreadBase::defaultMeshFinished";
ModuleBase::ThreadTask::threadTaskFinished();
Py::PythonAgent::getInstance()->unLock();
// emit showInformation(information);
// emit _mainwindow->printMessageToMessageWindow(msg);

View File

@ -54,8 +54,6 @@ namespace MeshData {
}
if(dataset != nullptr) {
// 网格面片三角化
// emit _mainwindow->printMessage(Common::Message::Normal,
// u8"surface triangulation .....");
MeshKernal* k = new MeshKernal;
k->setName(name);
k->setPath(path);
@ -79,7 +77,10 @@ namespace MeshData {
k->setMeshData(dataset);
_meshData->appendMeshKernal(k);
return true;
}
}else{
qDebug()<<"read Error";
return false;
}
return false;
}
@ -87,10 +88,10 @@ namespace MeshData {
{
if(!_threadRuning)
return nullptr;
QTextCodec* codec = QTextCodec::codecForName("GB18030");
QByteArray ba = codec->fromUnicode(_fileName);
// QTextCodec* codec = QTextCodec::codecForName("GB18030");
// QByteArray ba = codec->fromUnicode(_fileName);
_vtkReader = vtkSmartPointer<vtkDataSetReader>::New();
_vtkReader->SetFileName(ba);
_vtkReader->SetFileName(_fileName.toLocal8Bit().constData());
_vtkReader->SetReadAllColorScalars(false);
_vtkReader->SetReadAllScalars(false);
_vtkReader->SetReadAllVectors(false);
@ -105,9 +106,9 @@ namespace MeshData {
{
if(!_threadRuning)
return nullptr;
QTextCodec* codec = QTextCodec::codecForName("GB18030");
QByteArray ba = codec->fromUnicode(_fileName);
// QTextCodec* codec = QTextCodec::codecForName("GB18030");
// QByteArray ba = codec->fromUnicode(_fileName);
// qDebug()<<"Load stl file : "<<_fileName;
_stlReader = vtkSmartPointer<vtkSTLReader>::New();
_stlReader->SetFileName(_fileName.toLocal8Bit().constData());
// _stlReader->SetMerging(true);
@ -119,10 +120,10 @@ namespace MeshData {
{
if(!_threadRuning)
return nullptr;
QTextCodec* codec = QTextCodec::codecForName("GB18030");
QByteArray ba = codec->fromUnicode(_fileName);
// QTextCodec* codec = QTextCodec::codecForName("GB18030");
// QByteArray ba = codec->fromUnicode(_fileName);
_tecplotReader = vtkSmartPointer<vtkTecplotReader>::New();
_tecplotReader->SetFileName(ba);
_tecplotReader->SetFileName(_fileName.toLocal8Bit().constData());
_tecplotReader->Update();
vtkMultiBlockDataSet* mudataset = _tecplotReader->GetOutput();
// blockDataSet = mudataset;//add for multi zone test

View File

@ -313,47 +313,12 @@ namespace WBFZ {
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_with_rgba(new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_filtered( new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr output( new pcl::PointCloud<pcl::PointXYZRGBA>); // 输出结果
pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals(new pcl::PointCloud<pcl::PointNormal>); // 法线向量
pcl::search::KdTree<pcl::PointNormal>::Ptr tree2(new pcl::search::KdTree<pcl::PointNormal>);
pcl::io::vtkPolyDataToPointCloud(inpolyData, *cloud_with_rgba);
qDebug()<<"cloud_with_rgba "<<cloud_with_rgba->size();
PointCloudOperator::PointCloudCommon::NormalEstimation(cloud_with_rgba, cloud_with_normals);
tree2->setInputCloud(cloud_with_normals); // 构建搜索树
std::shared_ptr<pcl::PolygonMesh> mesh (new pcl::PolygonMesh); // 非智能指针,需要释放
pcl::GreedyProjectionTriangulation<pcl::PointNormal> gp3; // 定义三角化对象
gp3.setSearchRadius(_SearchRadius); // 设置连接点之间的最大距离(即三角形的最大边长)
gp3.setMu(_Mu); // 设置被样本点搜索其临近点的最远距离,为了适应点云密度的变化
gp3.setMaximumNearestNeighbors(_MaximumNearestNeighbors); // 设置样本点可搜索的邻域个数
gp3.setMaximumSurfaceAngle(_MaximumSurfaceAngle); // 设置某点法线方向偏离样本点法线方向的最大角度
gp3.setMinimumAngle(_MaximumAngle); // 设置三角化后得到三角形内角的最小角度
gp3.setMaximumAngle(_MinimumAngle); // 设置三角化后得到三角形内角的最大角度
gp3.setNormalConsistency(false); // 设置该参数保证法线朝向一致
gp3.setInputCloud(cloud_with_normals); // 设置输入点云为有向点云
gp3.setSearchMethod(tree2); // 设置搜索方式
gp3.reconstruct(*mesh); // 重建提取三角化 -- 这里会导致程序崩溃,可能存在内存泄露,
// DebugInfo("remesh over GP \n");
// return false;
size_t pointcount = PointCloudOperator::PointCloudCommon::mesh2vtk(*mesh, polydata2);
vtkSmartPointer<vtkGeometryFilter> geofilter=vtkSmartPointer<vtkGeometryFilter>::New();
geofilter->SetInputData(polydata2);
geofilter->Update();
polydata=geofilter->GetOutput();
qDebug()<<"cellToPointFilter successfully!! wait for writing file dataset : "<<inpolyData->GetNumberOfPoints()<<" "<<inpolyData->GetNumberOfCells();
// if(PointCloudOperator::PointCloudMeshOperator::GP(inpolyData,polydata,_SearchRadius,_Mu,_MaximumNearestNeighbors,_MaximumSurfaceAngle,_MaximumAngle,_MinimumAngle)){
//
// }else{
// return false;
// }
if(PointCloudOperator::PointCloudMeshOperator::GP(inpolyData,polydata,_SearchRadius,_Mu,_MaximumNearestNeighbors,_MaximumSurfaceAngle,_MaximumAngle,_MinimumAngle)){
}else{
return false;
}
DebugInfo("PCLGPMeshAlg successfully!! wait for writing file dataset : %d \n",nullptr==polydata);
if(nullptr!=polydata){

View File

@ -1,4 +1,5 @@
#include "ImageShowDialogClass.h"

#include "ImageShowDialogClass.h"
#include "ui_ImageShowDialogClass.h"
ImageShowDialogClass ::ImageShowDialogClass(QWidget *parent)
: QDialog(parent)
@ -12,7 +13,7 @@ ImageShowDialogClass ::ImageShowDialogClass(QWidget *parent)
this->menubar = new QMenuBar(this);
QMenu* windowsMenu = this->menubar->addMenu(u8"数据");
QAction* action_cursor_enable = windowsMenu->addAction(u8"打开游标");
//QObject::connect(action_cursor_enable,SIGNAL(triggered()),this,SLOT(on_action_cursor_enable_trigged()));
QObject::connect(action_cursor_enable,SIGNAL(triggered()),this,SLOT(on_action_cursor_enable_trigged()));
this->tracer=new QCPItemTracer(this->ui->m_plot);
this->m_plot = ui->m_plot;
@ -37,48 +38,92 @@ ImageShowDialogClass ::ImageShowDialogClass(QWidget *parent)
ImageShowDialogClass::~ImageShowDialogClass()
{}
//
//void ImageShowDialogClass::on_action_cursor_enable_trigged()
//{
// this->desCursor = new ImageShowCursorDesClass();
//
//
// QObject::connect(this->desCursor, SIGNAL(windowsClose()), this, SLOT(on_action_descursor_close_trigged()));
//
//
// this->desCursorflag = true;
// for (size_t i = 0; i < this->getGraphCount(); i++) {
// if (this->getGraphClass(i) == LAMPDATASHOWCLASS::LAMPColorMap) {
// this->HlineCursorflag = true;
// this->VlineCursorflag = true;
// }
// }
//
// //下面的代码就是设置游标的外观
// this->setMouseTracking(true);
// tracer->setInterpolating(false);//禁用插值
// tracer->setPen(QPen(Qt::DashLine));//虚线游标
// tracer->setStyle(QCPItemTracer::tsPlus);//游标样式:十字星、圆圈、方框
// tracer->setBrush(Qt::red);//游标颜色
//
// if (this->graphclass == LAMPDATASHOWCLASS::LAMPColorMap) {
// this->HlineCursor = new ImageShowCursorLineClass();
// this->VlineCursor = new ImageShowCursorLineClass();
// QObject::connect(this->HlineCursor, SIGNAL(windowsClose()), this, SLOT(on_action_Hlinecursor_close_trigged()));
// QObject::connect(this->VlineCursor, SIGNAL(windowsClose()), this, SLOT(on_action_VVlinecursor_close_trigged()));
// QObject::connect(this->ui->m_plot->xAxis, SIGNAL(rangeChanged(QCPRange)), this->HlineCursor, SLOT(xAxisRangeChanged(QCPRange)));
// QObject::connect(this->ui->m_plot->yAxis, SIGNAL(rangeChanged(QCPRange)), this->HlineCursor, SLOT(xAxisRangeChanged(QCPRange)));
// this->HlineCursor->show();
// this->VlineCursor->show();
// }
// this->desCursor->show();
//}
//
//
void ImageShowDialogClass::on_action_cursor_enable_trigged()
{
this->desCursor = new ImageShowCursorDesClass(this);
this->desCursorflag = true;
for (size_t i = 0; i < this->getGraphCount(); i++) {
if (this->getGraphClass(i) == LAMPDATASHOWCLASS::LAMPColorMap) {
this->HlineCursorflag = true;
this->VlineCursorflag = true;
}
}
//下面的代码就是设置游标的外观
this->setMouseTracking(true);
tracer->setInterpolating(false);//禁用插值
tracer->setPen(QPen(Qt::DashLine));//虚线游标
tracer->setStyle(QCPItemTracer::tsPlus);//游标样式:十字星、圆圈、方框
tracer->setBrush(Qt::red);//游标颜色
if (this->graphclass == LAMPDATASHOWCLASS::LAMPColorMap) {
this->HlineCursor = new ImageShowCursorLineClass(this);
this->VlineCursor = new ImageShowCursorLineClass(this);
QObject::connect(this->HlineCursor, SIGNAL(windowsClose()), this, SLOT(on_action_Hlinecursor_close_trigged()));
QObject::connect(this->VlineCursor, SIGNAL(windowsClose()), this, SLOT(on_action_VVlinecursor_close_trigged()));
QObject::connect(this->ui->m_plot->xAxis, SIGNAL(rangeChanged(QCPRange)), this->HlineCursor, SLOT(xAxisRangeChanged(QCPRange)));
QObject::connect(this->ui->m_plot->yAxis, SIGNAL(rangeChanged(QCPRange)), this->HlineCursor, SLOT(xAxisRangeChanged(QCPRange)));
this->HlineCursor->show();
this->VlineCursor->show();
}
this->desCursor->show();
QObject::connect(this->desCursor, SIGNAL(windowsClose()), this, SLOT(on_action_descursor_close_trigged()));
}
void ImageShowDialogClass::Plot(QVector<double> xs, QVector<double> ys)
{
}
void ImageShowDialogClass::Scatter(double dx,double dy)
{
QVector<double>xs(0);
QVector<double>ys(0);
xs.push_back(dx);
ys.push_back(dy);
// 设置画笔风格
QPen drawPen;
drawPen.setColor(Qt::red);
drawPen.setWidth(4);
// 绘制散点
QCPGraph* curGraph = ui->m_plot->addGraph();
curGraph->setPen(drawPen);
curGraph->setLineStyle(QCPGraph::lsNone);
curGraph->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssCircle, 2));
curGraph->setData(xs, ys);
ui->m_plot->xAxis->setVisible(true);
ui->m_plot->yAxis->setVisible(true);
}
void ImageShowDialogClass::Scatter(QVector<double> xs, QVector<double> ys)
{
// 设置画笔风格
QPen drawPen;
drawPen.setColor(Qt::red);
drawPen.setWidth(4);
// 绘制散点
QCPGraph* curGraph = ui->m_plot->addGraph();
curGraph->setPen(drawPen);
curGraph->setLineStyle(QCPGraph::lsNone);
curGraph->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssCircle, 2));
curGraph->setData(xs, ys);
ui->m_plot->xAxis->setVisible(true);
ui->m_plot->yAxis->setVisible(true);
}
void ImageShowDialogClass::load_double_MatrixX_data(Eigen::MatrixXd data, QString name)
{
this->setWindowTitle(name);
this->graphclass = LAMPDATASHOWCLASS::LAMPColorMap;
int nx = data.rows(); // 行数
int ny = data.cols(); // 列数
// 创建 Color Map
@ -103,6 +148,7 @@ void ImageShowDialogClass::load_double_MatrixX_data(Eigen::MatrixXd data, QStrin
void ImageShowDialogClass::load_double_MatrixX_data(Eigen::MatrixXd X, Eigen::MatrixXd Y, Eigen::MatrixXd data, QString name)
{
this->graphclass = LAMPDATASHOWCLASS::LAMPColorMap;
int nx = data.cols(); // 行数
int ny = data.rows(); // 列数
// 创建 Color Map
@ -164,31 +210,30 @@ LAMPDATASHOWCLASS ImageShowDialogClass::getGraphClass(size_t i)
return LAMPDATASHOWCLASS::NOWINDOWS;
}
}
//size_t ImageShowDialogClass::getGraphCount()
//{
// return this->m_plot->graphCount();
//}
//
//void ImageShowDialogClass::on_action_descursor_close_trigged()
//{
// this->desCursorflag = false;
//}
//
//void ImageShowDialogClass::on_action_Hlinecursor_close_trigged()
//{
// this->HlineCursorflag = false;
//}
//
//void ImageShowDialogClass::on_action_VVlinecursor_close_trigged()
//{
// this->VlineCursorflag = false;
//}
size_t ImageShowDialogClass::getGraphCount()
{
return this->m_plot->graphCount();
}
void ImageShowDialogClass::on_action_descursor_close_trigged()
{
this->desCursorflag = false;
}
void ImageShowDialogClass::on_action_Hlinecursor_close_trigged()
{
this->HlineCursorflag = false;
}
void ImageShowDialogClass::on_action_VVlinecursor_close_trigged()
{
this->VlineCursorflag = false;
}
void ImageShowDialogClass::updateCursor(QMouseEvent *event)
{
if (this->desCursorflag &&this->HlineCursorflag &&this->VlineCursorflag) {
//下面的代码就是设置游标的外观
this->setMouseTracking(false);
@ -199,20 +244,46 @@ void ImageShowDialogClass::updateCursor(QMouseEvent *event)
double x=this->m_plot->xAxis->pixelToCoord(pos.x()); // 将鼠标位置映射到图表坐标系中
double y = this->m_plot->yAxis->pixelToCoord(pos.y());
this->statusbar->showMessage(u8"X: "+QString::number(x,'f', 6)+" y: "+QString::number(y, 'f', 6));
if (this->desCursorflag) {
if (this->graphclass == LAMPDATASHOWCLASS::LAMPColorMap) {
QCPColorMap* colorMap = dynamic_cast<QCPColorMap*>(this->ui->m_plot->plottable(0));
double dataValue = colorMap->data()->data(x, y);
this->desCursor->updateCursorContent(u8"X: " + QString::number(x, 'f', 6) + " y: " + QString::number(y, 'f', 6) +u8"\n" +u8"DataValue: "+QString::number(dataValue));
double xMin = this->m_plot->xAxis->range().lower;
double xMax = this->m_plot->xAxis->range().upper;
double yMin = this->m_plot->yAxis->range().lower;
double yMax = this->m_plot->yAxis->range().upper;
long XCount = 1000;
double xdelte = (xMax - xMin) / (XCount-1);
double ydelte = (yMax - yMin) / (XCount-1);
qDebug() << xMin << "," << xMax << " " << yMin << "," << yMax << " " << XCount<<" "<<xdelte<<" "<<ydelte;
QVector<double> Hx(XCount);
QVector<double> Hy(XCount);
QVector<double> Vx(XCount);
QVector<double> Vy(XCount);
for (long i = 0; i < XCount; i++)
{
Hx[i] = i * xdelte + xMin;
Hy[i] = colorMap->data()->data(Hx[i], y);
Vx[i] = i * ydelte + yMin;
Vy[i] = colorMap->data()->data(x, Vx[i]);
}
this->HlineCursor->UpdatePlotLine(Hx, Hy, u8"水平"); // 水平
this->VlineCursor->UpdatePlotLine(Vx, Vy, u8"垂直"); // 垂直
}
else if (this->graphclass == LAMPDATASHOWCLASS::LAMPGraph) {
}
else if (this->graphclass == LAMPDATASHOWCLASS::LAMPScatterStyle) {
}
else {
this->desCursor->updateCursorContent(u8"无法识别图像类型");
@ -233,14 +304,16 @@ ImageShowCursorDesClass::ImageShowCursorDesClass(QWidget* parent)
{
// 创建 QLabel
label = new QLabel(this);
QFont font;
font.setPointSize(20); // 设置字体大小为20
label->setFont(font);
// 创建布局
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(label);
// 设置布局
setLayout(layout);
this->resize(100, 50);
}
ImageShowCursorDesClass::~ImageShowCursorDesClass()
@ -254,13 +327,13 @@ void ImageShowCursorDesClass::closeEvent(QCloseEvent* event)
void ImageShowCursorDesClass::updateCursorContent(QString content) {
this->label->setText(content);
}
ImageShowCursorLineClass::ImageShowCursorLineClass(QWidget* parent)
ImageShowCursorLineClass::ImageShowCursorLineClass(QWidget* parent):QDialog(parent)
{
this->menubar = new QMenuBar(this);
//QMenu* toolMenu = this->menubar->addMenu(u8"工具");
@ -273,7 +346,7 @@ ImageShowCursorLineClass::ImageShowCursorLineClass(QWidget* parent)
this->tracerYText = nullptr;
// 创建 QLabel
this->customPlot = new QCustomPlot(this);
// 创建布局
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(this->customPlot);
@ -285,10 +358,13 @@ ImageShowCursorLineClass::ImageShowCursorLineClass(QWidget* parent)
this->tracerXText = new QCPItemText(this->customPlot);
QObject::connect(this->customPlot, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(updateCursor(QMouseEvent*)));
this->customPlot->legend->setVisible(true);
this->setMinimumWidth(600);
this->setMinimumHeight(400);
}
ImageShowCursorLineClass::~ImageShowCursorLineClass()
{
}
void ImageShowCursorLineClass::loadPlotLine(QVector<double> xs, QVector<double> dataValues,QString Name)
@ -303,6 +379,14 @@ void ImageShowCursorLineClass::loadPlotLine(QVector<double> xs, QVector<double>
min_y = min_y > dataValues[i] ? dataValues[i] : min_y;
max_y = max_y < dataValues[i] ? dataValues[i] : max_y;
}
double min_x = xs[0];
double max_x = xs[0];
for (size_t i = 0; i < xs.count(); i++) {
min_x = min_x > xs[i] ? xs[i] : min_x;
max_x = max_x < xs[i] ? xs[i] : max_x;
}
customPlot->xAxis->setRange(min_x, max_x);
customPlot->yAxis->setRange(min_y, max_y);
customPlot->legend->setVisible(true);
customPlot->replot();
@ -317,6 +401,13 @@ void ImageShowCursorLineClass::loadPlotLine(QVector<double> xs, QVector<double>
tracer->setGraph(graph); // 确保游标跟随
this->m_graphMap.insert(Name, graph);
this->TrackName = Name;
}
void ImageShowCursorLineClass::UpdatePlotLine(QVector<double> xs, QVector<double> dataValues, QString Name)
{
this->customPlot->clearGraphs();
this->loadPlotLine(xs, dataValues, Name);
}
void ImageShowCursorLineClass::updateCursor(QMouseEvent* event)
@ -371,4 +462,4 @@ void ImageShowCursorLineClass::load_new_compare_line()
}

View File

@ -1,12 +1,12 @@
#pragma once

#ifndef IMAGESHOWDIALOGCLASS_H
#define IMAGESHOWDIALOGCLASS_H
#include "WBFZExchangePluginAPI.h"
#include "AllHead.h"
#include "BaseConstVariable.h"
#include <QDialog>
#include "TaskTreeClass.h"
#include "qwt_plot_spectrogram.h"
#include <QLabel>
#include "qcustomplot.h"
#include <Eigen/Core>
#include <Eigen/Dense>
//===========================
@ -51,7 +51,7 @@ protected:
};
class ImageShowCursorLineClass :public QDialog {
class ImageShowCursorLineClass :public QDialog {
Q_OBJECT
public:
QMenuBar* menubar;
@ -74,6 +74,7 @@ public:
public:
void loadPlotLine(QVector<double> xs, QVector<double> dataValues, QString Name);
void UpdatePlotLine(QVector<double> xs, QVector<double> dataValues, QString Name);
void updateCursor(QMouseEvent* event);
@ -122,6 +123,11 @@ public:
ImageShowDialogClass(QWidget *parent = nullptr);
~ImageShowDialogClass();
public:
void Plot(QVector<double> xs, QVector<double> ys);
void Scatter(double dx, double dy);
void Scatter(QVector<double> xs, QVector<double> ys);
void load_double_MatrixX_data(Eigen::MatrixXd data, QString name);
void load_double_MatrixX_data(Eigen::MatrixXd X,Eigen::MatrixXd Y,Eigen::MatrixXd data, QString name);
void remove_Data( QString name);
@ -136,11 +142,13 @@ public slots:
public slots: // cursor
// void on_action_cursor_enable_trigged();
// void on_action_descursor_close_trigged();
// void on_action_Hlinecursor_close_trigged();
// void on_action_VVlinecursor_close_trigged();
void on_action_cursor_enable_trigged();
void on_action_descursor_close_trigged();
void on_action_Hlinecursor_close_trigged();
void on_action_VVlinecursor_close_trigged();
};
#endif
#endif

View File

@ -47,6 +47,4 @@ void ShowComplexMatrixPlot(QCustomPlot* customPlot, const Eigen::MatrixXcd& c
#endif

View File

@ -219,6 +219,7 @@ namespace WBFZ {
void Register(GUI::MainWindow* m, QList<Plugins::PluginBase*>* ps)
{
DebugInfo("WBFZExchangePlugin::pclStatisticalRemoveFilter Register\n");
Plugins::PluginBase* p = new WBFZ::WBFZExchangePlugin(m);
ps->append(p);
}