波列数据展示优化,比例和深度信息记录到模板文件

This commit is contained in:
jiayulong 2025-11-24 15:36:38 +08:00
parent b9591839be
commit 336e873ab3
11 changed files with 178 additions and 28 deletions

View File

@ -70,9 +70,10 @@ signals:
//岩性填充-不填充
void sig_ClearFillMode(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
//岩性填充-填充
//bFillNow 是否立刻填充。针对模板加载时,不立刻填充,等加载完成所有曲线再填充
void sig_ChangeFillMode(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill,
float vMin, float vMax, QString strOtherScaleType, QColor frontColor, QColor backColor, QString newFillMode);
float vMin, float vMax, QString strOtherScaleType, QColor frontColor, QColor backColor, QString newFillMode, bool bFillNow);
//置顶层,并取消其他表格的选中状态
void sig_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);

View File

@ -8,6 +8,8 @@
extern int g_iScale;
extern double g_dPixelPerCm;//每厘米像素数
extern int g_iY1;
extern int g_iY2;
PropertyWidget::PropertyWidget(const QString &title, QWidget *parent , Qt::WindowFlags flags )
:QDockWidget(title,parent,flags)
@ -163,6 +165,38 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
emit CallManage::getInstance()->sig_changeScale(g_iScale);
}
}
else if("开始深度(m)" == m_propertyData[pProperty])
{
//qDebug() << "开始深度(m)->改变";
//当前属性类型
if(m_strCurrentProperty == Well_Property)
{
double newStartDepth = variant.value<double>();
g_iY2 = 0 - newStartDepth;
if(g_iY2 < g_iY1)
{
return;
}
//通知界面缩放
emit CallManage::getInstance()->sig_changeScale(g_iScale);
}
}
else if("终止深度(m)" == m_propertyData[pProperty])
{
//qDebug() << "终止深度(m)->改变";
//当前属性类型
if(m_strCurrentProperty == Well_Property)
{
double newEndDepth = variant.value<double>();
g_iY1 = 0 - newEndDepth;
if(g_iY2 < g_iY1)
{
return;
}
//通知界面缩放
emit CallManage::getInstance()->sig_changeScale(g_iScale);
}
}
else if("左刻度" == m_propertyData[pProperty])
{
//qDebug() << "左刻度->改变";
@ -611,7 +645,7 @@ void PropertyWidget::ChangFillProperty()
{
emit CallManage::getInstance()->sig_ChangeFillMode(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName,
newFillType, newTargetLine, newColor, newLithosImage, newHeadFill,
vMin, vMax, strOtherScaleType, frontColor, backColor, newFillMode);
vMin, vMax, strOtherScaleType, frontColor, backColor, newFillMode, true);
}
}
@ -727,6 +761,19 @@ void PropertyWidget::initWidgetProperty()
_CreateVariantPropertyItem("水平格线", "中格线间隔(m)", 2.0, QVariant::Double);
}
void PropertyWidget::initWellProperty()
{
//初始化,清空
InitCurrentViewInfo();
//当前属性类型
m_strCurrentProperty = Well_Property;
//
_CreateVariantPropertyItem("通常", "开始深度(m)", 0-g_iY2, QVariant::Double);
_CreateVariantPropertyItem("通常", "终止深度(m)", 0-g_iY1, QVariant::Double);
}
void PropertyWidget::initCurveProperty(FormInfo *formInfo, QStringList strListOtherLine, QList<float> listMin, QList<float> listMax, QStringList strListOtherScaleType)
{
//初始化,清空

View File

@ -20,8 +20,9 @@
//当前曲线类型
#define Widget_Property "Widget_Property"
#define Curve_Property "Curve_Property"
#define Head_Property "Head_Property"
#define Well_Property "Well_Property" //井
#define Curve_Property "Curve_Property" //曲线
#define Head_Property "Head_Property" //图头,单元格
#pragma execution_character_set("utf-8")
@ -78,6 +79,8 @@ public:
void InitCurrentViewInfo(); //初始化属性,清空
void initWidgetProperty(); //可视解释整体属性
//井
void initWellProperty();
//曲线
void initCurveProperty(FormInfo *formInfo, QStringList strListOtherLine, QList<float> listMin, QList<float> listMax, QStringList strListOtherScaleType);
//图头

View File

@ -278,6 +278,12 @@ void FormDraw::setRowHeight(double dHight, QProgressBar *progressBar, int iSplit
//
QMyCustomPlot *form = (QMyCustomPlot*)childWidget;
form->setGeometry(0, 0, g_iOneWidth, (int)dHight);//7500-3184
//深度改变
form->xAxis->setRange(g_iY1, g_iY2);
//emit CallManage::getInstance()->sig_ChangeLeftScale(m_strUuid, form->m_strSlfName, m_strWellName, m_strTrackName, form->m_strLineName, form->m_iX1);
form->replot();//屏蔽,缩减时间
}
}
i++;
@ -790,10 +796,10 @@ void FormDraw::initWave(QMyCustomPlot *widget, QString strSlfName, QString strWa
Slf_WAVE _wave;
logio->GetWaveInfo(index, &_wave);
float _SDep,_EDep,_Rlev;
// _SDep = _wave.StartDepth;
// _EDep = _wave.EndDepth;
_SDep = 0.0 - g_iY2;
_EDep = 0.0 - g_iY1;
_SDep = _wave.StartDepth;
_EDep = _wave.EndDepth;
// _SDep = 0.0 - g_iY2;
// _EDep = 0.0 - g_iY1;
_Rlev = _wave.DepLevel;
int m_Record=(float)(fabs((_EDep-_SDep)/_Rlev+0.5));
@ -857,7 +863,8 @@ void FormDraw::initWave(QMyCustomPlot *widget, QString strSlfName, QString strWa
int nx = m_Record;
int ny = _nSamples;
colorMap->data()->setSize(nx, ny); // 我们希望彩色地图有nx*ny的数据点
colorMap->data()->setRange(QCPRange(g_iY1, g_iY2), QCPRange(vmin, vmax)); // 并在键x和值y维上跨越坐标范围-4..4
//colorMap->data()->setRange(QCPRange(g_iY1, g_iY2), QCPRange(vmin, vmax)); // 并在键x和值y维上跨越坐标范围-4..4
colorMap->data()->setRange(QCPRange(0-_EDep, 0-_SDep), QCPRange(vmin, vmax));
// 现在我们通过访问颜色贴图的QCPColorMapData实例来分配一些数据
double x, y, z;
for (int xIndex=0; xIndex<nx; ++xIndex)
@ -866,6 +873,7 @@ void FormDraw::initWave(QMyCustomPlot *widget, QString strSlfName, QString strWa
{
if(wavedata[yIndex][xIndex]==-9999)
{
colorMap->data()->setCell(nx-xIndex-1, yIndex, vmin);
continue;
}
//colorMap->data()->setCell(xIndex, yIndex, wavedata[yIndex][xIndex]);

View File

@ -52,8 +52,8 @@ FormInfo::FormInfo(QWidget *parent, QString strSlfName, QString strWellName, QSt
//岩性填充-不填充
connect(CallManage::getInstance(), SIGNAL(sig_ClearFillMode(QString, QString, QString, QString, QString)), this, SLOT(s_ClearFillMode(QString, QString, QString, QString, QString)));
//岩性填充-填充
connect(CallManage::getInstance(), SIGNAL(sig_ChangeFillMode(QString, QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QString, QColor, QColor, QString)),
this, SLOT(s_ChangeFillMode(QString, QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QString, QColor, QColor, QString)));
connect(CallManage::getInstance(), SIGNAL(sig_ChangeFillMode(QString, QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QString, QColor, QColor, QString, bool)),
this, SLOT(s_ChangeFillMode(QString, QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QString, QColor, QColor, QString, bool)));
}
@ -466,7 +466,7 @@ void FormInfo::s_ClearFillMode(QString strUuid, QString strSlfName, QString strW
//岩性填充-填充
void FormInfo::s_ChangeFillMode(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill,
float vMin, float vMax, QString strOtherScaleType, QColor frontColor, QColor backColor, QString newFillMode)
float vMin, float vMax, QString strOtherScaleType, QColor frontColor, QColor backColor, QString newFillMode, bool bFillNow)
{
if(m_strUuid == strUuid &&
m_strSlfName == strSlfName &&

View File

@ -52,7 +52,7 @@ public slots:
//岩性填充-填充
void s_ChangeFillMode(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill,
float vMin, float vMax, QString strOtherScaleType, QColor frontColor, QColor backColor, QString newFillMode);
float vMin, float vMax, QString strOtherScaleType, QColor frontColor, QColor backColor, QString newFillMode, bool bFillNow);
public:
QString m_strUuid;

View File

@ -10,6 +10,7 @@
#include "newheaddialog.h"
#include "formhead.h"
//#include "qmytablewidget.h"
#include "PropertyWidget.h"
extern int g_iOneWidth; //道宽
extern QString g_prjname;
@ -92,6 +93,8 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) :
ui->tableWidget_2->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
ui->tableWidget_2->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
connect(ui->tableWidget_2, SIGNAL(itemClicked(QTableWidgetItem*)), this, SLOT(onItemClicked(QTableWidgetItem*)));
//-------------------------------------
ui->tableWidget_3->hide();
ui->tableWidget_3->verticalHeader()->hide();
@ -103,8 +106,10 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) :
connect(CallManage::getInstance(), SIGNAL(sig_mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
connect(CallManage::getInstance(), SIGNAL(sig_changeScale(int)), this, SLOT(s_changeScale(int)));
//曲线选中,置顶
connect(CallManage::getInstance(), SIGNAL(sig_Raise(QString, QString, QString, QString, QString)), this, SLOT(s_Raise(QString, QString, QString, QString, QString)));
//数据组织与管理树
//图头
m_dock1=new QDockWidget(tr(""),this);
m_dock1->setFeatures(QDockWidget::NoDockWidgetFeatures);//QDockWidget::DockWidgetMovable
//dock1->setAllowedAreas(Qt::TopDockWidgetArea);
@ -117,6 +122,8 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) :
QWidget* lEmptyWidget = new QWidget();
m_dock1->setTitleBarWidget(lEmptyWidget);
delete lTitleBar;
//隐藏
m_dock1->hide();
//属性编辑器
// m_propertyWidget = PropertyService();
@ -359,6 +366,9 @@ QJsonObject MainWindowCurve::makeJson()
QJsonObject rootObj;
//
rootObj["prjname"] = g_prjname;
rootObj["iScale"] = g_iScale;
rootObj["iY1"] = g_iY1;
rootObj["iY2"] = g_iY2;
// 创建JSON数组并填充数据
QJsonArray subcaseArray;
@ -457,6 +467,7 @@ void MainWindowCurve::s_NewWell(QString strWellName)
m_listWell.push_back(strWellName);
}
}
//ui->tableWidget_2->resizeColumnsToContents(); // 调整列宽以适应内容
// 设置右键菜单策略
@ -464,6 +475,34 @@ void MainWindowCurve::s_NewWell(QString strWellName)
// connect(ui->tableWidget_2, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotContextMenu(QPoint)));
}
void MainWindowCurve::mousePressEvent(QMouseEvent *event)
{
QMainWindow::mousePressEvent(event); // 将事件操作权返回给父类
// 在事件处理中添加一个打印输出,用于显示鼠标在界面上的位置
qDebug()<< "mouse clicked at" << event->pos();
PropertyService()->initWidgetProperty();
//取消所有选中单元格
emit CallManage::getInstance()->sig_Raise(m_strUuid, "", "", "", "");
}
void MainWindowCurve::s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName)
{
//选中了曲线置顶
//取消表格选中状态
ui->tableWidget_2->clearSelection();
}
void MainWindowCurve::onItemClicked(QTableWidgetItem* item)
{
qDebug() << "MainWindowCurve onItemClicked";
PropertyService()->initWellProperty();
//取消所有选中单元格
emit CallManage::getInstance()->sig_Raise(m_strUuid, "", "", "", "");
}
void MainWindowCurve::s_NewTrack()
{
if(ui->tableWidget_2->columnCount()==0)
@ -1014,7 +1053,39 @@ void MainWindowCurve::Open(QString fileFull)
}
}
}
//
if (object.contains("iScale"))
{
QJsonValue value = object.value("iScale");
if (value.isDouble()) {
int iScale = value.toInt();
qDebug() << "iScale:" << QString::number(iScale);
//
g_iScale = iScale;
}
}
//
if (object.contains("iY1"))
{
QJsonValue value = object.value("iY1");
if (value.isDouble()) {
int iY1 = value.toInt();
qDebug() << "iY1:" << QString::number(iY1);
//
g_iY1 = iY1;
}
}
//
if (object.contains("iY2"))
{
QJsonValue value = object.value("iY2");
if (value.isDouble()) {
int iY2 = value.toInt();
qDebug() << "iY2:" << QString::number(iY2);
//
g_iY2 = iY2;
}
}
//
if (object.contains("wells"))
{
@ -1055,7 +1126,7 @@ void MainWindowCurve::slot_time()
progressBar->show();
double dHight = 0;
dHight = (g_iY2-g_iY1)*100.0/(double)g_iScale * g_dPixelPerCm *10;
dHight = (g_iY2-g_iY1)*100.0/(double)g_iScale * g_dPixelPerCm;
if(dHight>32767)
{
dHight = 32767;
@ -1654,8 +1725,9 @@ void MainWindowCurve::DisplayLine_One(QJsonObject lineObjInfo)
}
else //if(newFillMode=="填充")
{
// emit CallManage::getInstance()->sig_ChangeFillMode(m_strUuid, strSlfName, strWellName, strTrackName, strLineName,
// newFillType, newTargetLine, newColor, newLithosImage, newHeadFill,
// new_vMin, new_vMax, strOtherScaleType, frontColor, backColor, newFillMode);
//模板不立刻填充bFillNow=false
emit CallManage::getInstance()->sig_ChangeFillMode(m_strUuid, strSlfName, strWellName, strTrackName, strLineName,
newFillType, newTargetLine, newColor, newLithosImage, newHeadFill,
new_vMin, new_vMax, strOtherScaleType, frontColor, backColor, newFillMode, false);
}
}

View File

@ -36,6 +36,9 @@ public slots:
void slot_time();
//改变缩放比例
void s_changeScale(int iNewScale);
void onItemClicked(QTableWidgetItem* item);
void mousePressEvent(QMouseEvent *event);
void s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
public slots:
void dragEnterEvent(QDragEnterEvent* event);

View File

@ -46,8 +46,8 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel
//岩性填充-不填充
connect(CallManage::getInstance(), SIGNAL(sig_ClearFillMode(QString, QString, QString, QString, QString)), this, SLOT(s_ClearFillMode(QString, QString, QString, QString, QString)));
//岩性填充-填充
connect(CallManage::getInstance(), SIGNAL(sig_ChangeFillMode(QString, QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QString , QColor, QColor, QString)),
this, SLOT(s_ChangeFillMode(QString, QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QString, QColor, QColor, QString)));
connect(CallManage::getInstance(), SIGNAL(sig_ChangeFillMode(QString, QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QString , QColor, QColor, QString, bool)),
this, SLOT(s_ChangeFillMode(QString, QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QString, QColor, QColor, QString, bool)));
}
@ -200,7 +200,7 @@ void QMyCustomPlot::s_ChangeLeftScale(QString strUuid, QString strSlfName, QStri
//其他曲线
s_ChangeFillMode(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName,
m_newFillType, m_newTargetLine, m_newColor, m_newLithosImage, m_newHeadFill,
newLeftScale, m_vMax, m_strOtherScaleType, m_frontColor, m_backColor, m_newFillMode);
newLeftScale, m_vMax, m_strOtherScaleType, m_frontColor, m_backColor, m_newFillMode, true);
}
}
@ -227,7 +227,7 @@ void QMyCustomPlot::s_ChangeRightScale(QString strUuid, QString strSlfName, QStr
//其他曲线
s_ChangeFillMode(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName,
m_newFillType, m_newTargetLine, m_newColor, m_newLithosImage, m_newHeadFill,
m_vMin, newRightScale, m_strOtherScaleType, m_frontColor, m_backColor, m_newFillMode);
m_vMin, newRightScale, m_strOtherScaleType, m_frontColor, m_backColor, m_newFillMode, true);
}
}
@ -263,7 +263,7 @@ void QMyCustomPlot::s_ChangeScaleType(QString strUuid, QString strSlfName, QStri
//其他曲线
s_ChangeFillMode(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName,
m_newFillType, m_newTargetLine, m_newColor, m_newLithosImage, m_newHeadFill,
m_vMin, m_vMax, strScaleType, m_frontColor, m_backColor, m_newFillMode);
m_vMin, m_vMax, strScaleType, m_frontColor, m_backColor, m_newFillMode, true);
}
}
@ -341,7 +341,7 @@ void QMyCustomPlot::s_ClearFillMode(QString strUuid, QString strSlfName, QString
//岩性填充-填充
void QMyCustomPlot::s_ChangeFillMode(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill,
float vMin, float vMax, QString strOtherScaleType, QColor frontColor, QColor backColor, QString newFillMode)
float vMin, float vMax, QString strOtherScaleType, QColor frontColor, QColor backColor, QString newFillMode, bool bFillNow)
{
if(m_strUuid == strUuid &&
@ -362,7 +362,13 @@ void QMyCustomPlot::s_ChangeFillMode(QString strUuid, QString strSlfName, QStrin
m_frontColor = frontColor;
m_backColor = backColor;
m_newFillMode = newFillMode;
m_bFillNow = bFillNow;
//默认true只有模板存在填充时才会false
if(m_bFillNow==false)
{
return;
}
//填充
if(this->graphCount() > 1)
{
@ -984,6 +990,15 @@ void QMyCustomPlot::slot_time()
{
graph()->addData(m_x.mid(m_iCurNum), m_y.mid(m_iCurNum));
m_iCurNum = m_x.size();
//处理完成,填充
//默认true只有模板存在填充时才会false
if(m_bFillNow==false)
{
s_ChangeFillMode(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName,
m_newFillType, m_newTargetLine, m_newColor, m_newLithosImage, m_newHeadFill,
m_vMin, m_vMax, m_strOtherScaleType, m_frontColor, m_backColor, m_newFillMode, true);
}
replot();
}
else

View File

@ -44,6 +44,7 @@ public:
QColor m_frontColor;//岩性前景色
QColor m_backColor;//岩性背景色
QString m_newFillMode;
bool m_bFillNow = true;
QContextMenuEvent *m_event;
@ -91,7 +92,7 @@ public slots:
//岩性填充-填充
void s_ChangeFillMode(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill,
float vMin, float vMax, QString strOtherScaleType, QColor frontColor, QColor backColor, QString newFillMode);
float vMin, float vMax, QString strOtherScaleType, QColor frontColor, QColor backColor, QString newFillMode, bool bFillNow);
void onAddRect();

View File

@ -9,13 +9,13 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<width>300</width>
<height>800</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>400</width>
<width>300</width>
<height>451</height>
</size>
</property>