曲线跨道实现

This commit is contained in:
DESKTOP-450PEFP\mainc 2026-03-08 23:22:36 +08:00
parent 6513750e75
commit 1aa2fcb4f6
13 changed files with 301 additions and 48 deletions

View File

@ -108,6 +108,8 @@ signals:
void sig_ChangeRightScale(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double newRightScale); void sig_ChangeRightScale(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double newRightScale);
//刻度类型 //刻度类型
void sig_ChangeScaleType(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strScaleType); void sig_ChangeScaleType(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strScaleType);
//左右跨道
void sig_ChangeCross(QString strUuid, QString strTrackUuid);
//线颜色 //线颜色
void sig_ChangeLineColor(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QColor lineColor); void sig_ChangeLineColor(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QColor lineColor);
@ -116,6 +118,8 @@ signals:
//线型 //线型
void sig_ChangeLineStyle(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, Qt::PenStyle lineStyle); void sig_ChangeLineStyle(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, Qt::PenStyle lineStyle);
void sig_ReplotFinished(QString strUuid);
//绘制方式 //绘制方式
//曲线 //曲线
void sig_ChangeDrawLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, bool bDrawLine); void sig_ChangeDrawLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, bool bDrawLine);

View File

@ -81,6 +81,7 @@ void PropertyWidget::InitCurrentViewInfo(bool bAll)
m_tdGujing = NULL; m_tdGujing = NULL;
// //
m_strUuid = ""; m_strUuid = "";
m_strTrackUuid = "";
m_strSlfName = ""; m_strSlfName = "";
m_strWellName = ""; m_strWellName = "";
m_strTrackName = ""; m_strTrackName = "";
@ -414,7 +415,9 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
if(m_strCurrentProperty == Curve_Property) if(m_strCurrentProperty == Curve_Property)
{ {
double newLeftScale = variant.value<double>(); double newLeftScale = variant.value<double>();
m_formInfo->m_vmin = newLeftScale;
emit CallManage::getInstance()->sig_ChangeLeftScale(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newLeftScale); emit CallManage::getInstance()->sig_ChangeLeftScale(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newLeftScale);
emit CallManage::getInstance()->sig_ChangeCross(m_strUuid, m_strTrackUuid);
//更新填充 //更新填充
ChangFillProperty(); ChangFillProperty();
} }
@ -426,7 +429,9 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
if(m_strCurrentProperty == Curve_Property) if(m_strCurrentProperty == Curve_Property)
{ {
double newRightScale = variant.value<double>(); double newRightScale = variant.value<double>();
m_formInfo->m_vmax = newRightScale;
emit CallManage::getInstance()->sig_ChangeRightScale(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newRightScale); emit CallManage::getInstance()->sig_ChangeRightScale(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newRightScale);
emit CallManage::getInstance()->sig_ChangeCross(m_strUuid, m_strTrackUuid);
//更新填充 //更新填充
ChangFillProperty(); ChangFillProperty();
} }
@ -439,10 +444,27 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
{ {
QString newScaleType = pProperty->valueText(); QString newScaleType = pProperty->valueText();
emit CallManage::getInstance()->sig_ChangeScaleType(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newScaleType); emit CallManage::getInstance()->sig_ChangeScaleType(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newScaleType);
//更新填充 //更新填充
ChangFillProperty(); ChangFillProperty();
} }
} }
else if ("左跨道个数" == m_propertyData[pProperty])
{
if (m_strCurrentProperty == Curve_Property)
{
m_formInfo->m_nLeftCross = variant.toInt();
emit CallManage::getInstance()->sig_ChangeCross(m_strUuid, m_strTrackUuid);
}
}
else if ("右跨道个数" == m_propertyData[pProperty])
{
if (m_strCurrentProperty == Curve_Property)
{
m_formInfo->m_nRightCross = variant.toInt();
emit CallManage::getInstance()->sig_ChangeCross(m_strUuid, m_strTrackUuid);
}
}
else if("颜色" == m_propertyData[pProperty]) else if("颜色" == m_propertyData[pProperty])
{ {
//qDebug() << "颜色->改变"; //qDebug() << "颜色->改变";
@ -1170,6 +1192,7 @@ void PropertyWidget::initCurveProperty(FormInfo *formInfo, QStringList strListOt
//初始化,清空 //初始化,清空
InitCurrentViewInfo(); InitCurrentViewInfo();
m_strUuid = formInfo->m_strUuid; m_strUuid = formInfo->m_strUuid;
m_strTrackUuid = formInfo->m_strTrackUuid;
m_formInfo = formInfo; m_formInfo = formInfo;
// //
@ -1230,6 +1253,8 @@ void PropertyWidget::initCurveProperty(FormInfo *formInfo, QStringList strListOt
_CreateVariantPropertyItem("刻度设置", "左刻度", formInfo->m_vmin, QVariant::Double); _CreateVariantPropertyItem("刻度设置", "左刻度", formInfo->m_vmin, QVariant::Double);
_CreateVariantPropertyItem("刻度设置", "右刻度", formInfo->m_vmax, QVariant::Double); _CreateVariantPropertyItem("刻度设置", "右刻度", formInfo->m_vmax, QVariant::Double);
_CreateEnumPropertyItem("刻度设置", "刻度类型", listScaleType.indexOf(formInfo->m_strScaleType), listScaleType); _CreateEnumPropertyItem("刻度设置", "刻度类型", listScaleType.indexOf(formInfo->m_strScaleType), listScaleType);
_CreateVariantPropertyItem("刻度设置", "左跨道个数", formInfo->m_nLeftCross, QVariant::Int);
_CreateVariantPropertyItem("刻度设置", "右跨道个数", formInfo->m_nRightCross, QVariant::Int);
// //
_CreateVariantPropertyItem("曲线线型", "线宽", formInfo->m_dWidth, QVariant::Double, 1, 20); _CreateVariantPropertyItem("曲线线型", "线宽", formInfo->m_dWidth, QVariant::Double, 1, 20);
_CreateVariantPropertyItem("曲线线型", "颜色", formInfo->m_lineColor, QVariant::Color); _CreateVariantPropertyItem("曲线线型", "颜色", formInfo->m_lineColor, QVariant::Color);
@ -1361,7 +1386,7 @@ void PropertyWidget::initProperty(FormInfo *formInfo)
m_formInfo = formInfo; m_formInfo = formInfo;
m_strUuid = formInfo->m_strUuid; m_strUuid = formInfo->m_strUuid;
m_strTrackUuid = formInfo->m_strTrackUuid;
// //
m_strSlfName = formInfo->m_strSlfName; m_strSlfName = formInfo->m_strSlfName;
m_strWellName = formInfo->m_strWellName; m_strWellName = formInfo->m_strWellName;

View File

@ -56,6 +56,7 @@ private:
public: public:
QString m_strUuid; QString m_strUuid;
QString m_strTrackUuid;
QString m_strSlfName; QString m_strSlfName;
QString m_strWellName; QString m_strWellName;
QString m_strTrackName; QString m_strTrackName;

View File

@ -219,6 +219,10 @@ void FormDraw::setDrawData(QStringList listdt, QJsonObject objInfo)
connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*))); connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
QTimer::singleShot(100, this, [=]() {
emit CallManage::getInstance()->sig_ReplotFinished(m_strUuid);
});
// //
m_listLineName.push_back(strLineName); m_listLineName.push_back(strLineName);
} }
@ -736,24 +740,79 @@ void FormDraw::DisplayType_One(QJsonObject objInfo)
} }
void FormDraw::crossTrackSetting()
{
if (m_formTrack == NULL || m_vecCurv.size() <= 0)
return;
int nleft = 0; // 最大左跨道
int nright = 0; // 最大右跨道
int nSingleW = m_formTrack->width();
QRect rt = m_formTrack->geometry();
for (int i = 0; i < m_vecCurv.size(); i++)
{
QMyCustomPlot *pCurvPlot = m_vecCurv.at(i);
if (!pCurvPlot)
continue;
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(pCurvPlot->m_strUuid, pCurvPlot->m_strWellName,
pCurvPlot->m_strTrackName, pCurvPlot->m_strLineName);
if (pInfo == NULL)
continue;
if (pInfo->m_nLeftCross > nleft)
nleft = pInfo->m_nLeftCross;
if (pInfo->m_nRightCross > nright)
nright = pInfo->m_nRightCross;
}
for (int i = 0; i < m_vecCurv.size(); i++)
{
QMyCustomPlot *pCurvPlot = m_vecCurv.at(i);
if (!pCurvPlot)
continue;
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(pCurvPlot->m_strUuid, pCurvPlot->m_strWellName,
pCurvPlot->m_strTrackName, pCurvPlot->m_strLineName);
if (pInfo == NULL)
continue;
pCurvPlot->m_iX1 = pInfo->m_vmin;
pCurvPlot->m_iX2 = pInfo->m_vmax;
pCurvPlot->m_nLeftCross = pInfo->m_nLeftCross;
pCurvPlot->m_nRightCross = pInfo->m_nRightCross;
QCPRange yRange;// = pCurvPlot->yAxis->range();
double rg = pCurvPlot->m_iX2 - pCurvPlot->m_iX1;
yRange.lower = pCurvPlot->m_iX1 - rg * nleft;
yRange.upper = pCurvPlot->m_iX2 + rg * nright;
pCurvPlot->yAxis->setRange(yRange);
int nnw = (nleft + nright + 1) * nSingleW;
QRect plotRt = pCurvPlot->geometry();
plotRt.setWidth(nnw);
pCurvPlot->setGeometry(plotRt);
pCurvPlot->replot();
}
QRect selfRt = this->geometry();
selfRt.setX(rt.x() - (nleft * nSingleW));
selfRt.setWidth((nleft + nright + 1)*nSingleW);
this->setGeometry(selfRt);
}
void FormDraw::paintEvent(QPaintEvent*) void FormDraw::paintEvent(QPaintEvent*)
{ {
// QPainter painter(this); //if (m_listLineName.size() > 0 && m_listLineName.at(0) == "AC")
// QRect rect = this->rect(); //{
// //背景透明 // QPainter painter(this);
// painter.fillRect(rect.left(), rect.top(), rect.width(), rect.height(), QColor(0, 0, 0, 0)); //QColor(67, 67, 67, 100) // QRect rect = this->rect();
// //背景透明
// painter.setPen(QPen(Qt::green,2,Qt::DashLine)); // painter.fillRect(rect.left(), rect.top(), rect.width(), rect.height(), QColor(200, 0, 0)); //QColor(67, 67, 67, 100)
// //painter.setBrush(QBrush(Qt::red,Qt::SolidPattern)); //}
//// QFont font1("微软雅黑", 10, false, false); //fontSize 10
//// painter.setFont(font1);
//// painter.setPen(QColor(0, 0, 0)); // fontColor QColor(220, 220, 220)
//// painter.drawText(rect.left() + 10, 10, QStringLiteral("画图")); // titleBarText QStringLiteral("动画")
// QRect rectRound(rect.left()+2,rect.top()+4, rect.width()-3, rect.height()-4);
// painter.drawRoundRect(rectRound);
} }
@ -874,13 +933,11 @@ void FormDraw::s_addLine(QString strUuid, QString strSlfName, QString strWellNam
// //
QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strLineName); QMyCustomPlot *curv = new QMyCustomPlot(this, strSlfName, strWellName, strTrackName, strLineName);
m_curv = curv;
curv->m_strUuid = m_strUuid; curv->m_strUuid = m_strUuid;
//背景设置成透明色 //背景设置成透明色
curv->setBackground(Qt::transparent); curv->setBackground(Qt::transparent);
curv->setStyleSheet("background: transparent;"); curv->setStyleSheet("background: transparent;");
//
//QRect rect = this->rect();
//curv->setGeometry(rect.left(),rect.top(), rect.width(), rect.height());
double dHight = 0; double dHight = 0;
dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm; dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm;
@ -895,21 +952,18 @@ void FormDraw::s_addLine(QString strUuid, QString strSlfName, QString strWellNam
dHight = 32767; dHight = 32767;
} }
//curv->setMaximumHeight((int)dHight);
//curv->setViewport(QRect(0, 0, g_iOneWidth, (int)dHight));//7500-3184
curv->setGeometry(0, 0, g_iOneWidth, (int)dHight);//7500-3184 curv->setGeometry(0, 0, g_iOneWidth, (int)dHight);//7500-3184
//curv->resize(INT_MAX, INT_MAX); // 使用 INT_MAX 来避免16位整数的限制
// QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// curv->setSizePolicy(policy);
curv->show(); curv->show();
initForm(curv, strSlfName, strLineName); initForm(curv, strSlfName, strLineName);
connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*))); connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
QTimer::singleShot(100, this, [=]() {
emit CallManage::getInstance()->sig_ReplotFinished(m_strUuid);
});
// //
m_listLineName.push_back(strLineName); m_listLineName.push_back(strLineName);
} }
void FormDraw::s_AddLine_Property(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, void FormDraw::s_AddLine_Property(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
@ -971,7 +1025,9 @@ AppendConsole(PAI_INFO, "FormDraw s_AddLine_Property");
newLeftScale, newRightScale, strScaleType, lineColor, width, lineStyle, listOtherProperty); newLeftScale, newRightScale, strScaleType, lineColor, width, lineStyle, listOtherProperty);
connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*))); connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
QTimer::singleShot(100, this, [=]() {
emit CallManage::getInstance()->sig_ReplotFinished(m_strUuid);
});
// //
m_listLineName.push_back(strLineName); m_listLineName.push_back(strLineName);
@ -1048,6 +1104,9 @@ void FormDraw::s_addWave(QString strUuid, QString strSlfName, QString strWellNam
curv->replot(); curv->replot();
connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*))); connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
QTimer::singleShot(100, this, [=]() {
emit CallManage::getInstance()->sig_ReplotFinished(m_strUuid);
});
// //
m_listWaveName.push_back(strWaveName); m_listWaveName.push_back(strWaveName);
@ -1199,6 +1258,7 @@ void FormDraw::s_delLine(QString strUuid, QString strWellName, QString strTrackN
if(strObjName=="QMyCustomPlot") if(strObjName=="QMyCustomPlot")
{ {
QMyCustomPlot *form = (QMyCustomPlot*)childWidget; QMyCustomPlot *form = (QMyCustomPlot*)childWidget;
m_vecCurv.removeAll(form);
if(form->m_strLineName == strLineName) if(form->m_strLineName == strLineName)
{ {
childWidget->deleteLater(); // 安排控件的删除,稍后执行 childWidget->deleteLater(); // 安排控件的删除,稍后执行
@ -2643,22 +2703,11 @@ void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLi
{ {
widget->yAxis->setScaleType(QCPAxis::stLinear); widget->yAxis->setScaleType(QCPAxis::stLinear);
} }
// 加入曲线列表
m_vecCurv << widget;
// // if (m_formTrack == NULL)
// widget->yAxis->setRange(vmin, vmax); return;
// widget->xAxis->setRange(m_iY1, m_iY2);
// widget->axisRect()->setupFullAxesBox();
// //
// widget->yAxis->ticker()->setTickCount(10);//x个主刻度
// widget->xAxis->ticker()->setTickCount(60);//y个主刻度
// //slf文件读取曲线
// QVector<double> x, y;
// for(int i=0; i<count; i++)
// {
// x.append(-(sdep+ rlev*i));
// y.append(val[i]);
// }
if(newLeftScale!=-9999) if(newLeftScale!=-9999)
{ {

View File

@ -58,6 +58,10 @@ public:
void DisplayLine_One(QJsonObject lineObjInfo); void DisplayLine_One(QJsonObject lineObjInfo);
void DisplayType_One(QJsonObject objInfo); void DisplayType_One(QJsonObject objInfo);
void DisplayType_Gujing(QJsonObject lineObjInfo);//固井结论 void DisplayType_Gujing(QJsonObject lineObjInfo);//固井结论
// 跨道设置
void crossTrackSetting();
private: private:
Ui::FormDraw *ui; Ui::FormDraw *ui;
@ -88,7 +92,11 @@ public:
double m_iY1=0; double m_iY1=0;
double m_iY2=0; double m_iY2=0;
FormTrack *m_formTrack; QMyCustomPlot *m_curv = NULL;
// 曲线列表
QVector<QMyCustomPlot*> m_vecCurv;
FormTrack *m_formTrack = NULL;
QStringList m_listLineName; QStringList m_listLineName;
QStringList m_listWaveName; QStringList m_listWaveName;

View File

@ -71,6 +71,7 @@ public slots:
public: public:
QString m_strUuid; QString m_strUuid;
QString m_strTrackUuid="";
QString m_strSlfName; QString m_strSlfName;
QString m_strWellName; QString m_strWellName;
QString m_strTrackName; QString m_strTrackName;
@ -91,6 +92,8 @@ public:
float m_vmin;//左刻度 float m_vmin;//左刻度
float m_vmax;//右刻度 float m_vmax;//右刻度
QString m_strScaleType;//刻度类型(线性,对数) QString m_strScaleType;//刻度类型(线性,对数)
qint8 m_nLeftCross = 0; // 左跨道个数
qint8 m_nRightCross = 0; // 右跨道个数
QFont m_curveNameFont; // 曲线名称字体 QFont m_curveNameFont; // 曲线名称字体
QFont m_curveUnitFont; // 曲线单位字体 QFont m_curveUnitFont; // 曲线单位字体

View File

@ -2,6 +2,7 @@
#include "ui_formtrack.h" #include "ui_formtrack.h"
#include <QDebug> #include <QDebug>
#include "CallManage.h" #include "CallManage.h"
#include "geometryutils.h"
extern int g_iOneWidth; //道宽 extern int g_iOneWidth; //道宽
@ -12,6 +13,7 @@ FormTrack::FormTrack(QWidget *parent, QString strWellName, QString strTrackName)
{ {
ui->setupUi(this); ui->setupUi(this);
m_strTrackUuid = getUUid();
m_strWellName = strWellName; m_strWellName = strWellName;
m_strTrackName = strTrackName; m_strTrackName = strTrackName;
@ -136,6 +138,43 @@ FormTrack::~FormTrack()
{ {
delete ui; delete ui;
} }
FormInfo* FormTrack::getFormInfo()
{
return m_formInfo;
}
QString FormTrack::getTrackUuid()
{
return m_strTrackUuid;
}
FormInfo* FormTrack::getFormInfoByParameters(QString strUuid, QString strWellName,
QString strTrackName, QString strLineName )
{
//
int rowCount = ui->tableWidget->rowCount();
for (int i = 0; i < rowCount; i++)
{
if (ui->tableWidget->cellWidget(i, 0) != nullptr)
{
auto myWidget = ui->tableWidget->cellWidget(i, 0);
FormInfo *formInfo = qobject_cast<FormInfo*>(myWidget);//获得widget
if (formInfo)
{
if (strUuid == formInfo->m_strUuid
&& formInfo->m_strWellName == strWellName
&& formInfo->m_strTrackName == strTrackName
&& formInfo->m_strLineName == strLineName)
{
return formInfo;
}
}
}
}
return NULL;
}
// //
// void FormTrack::setTrackPropert(QJsonObject trackObj) // void FormTrack::setTrackPropert(QJsonObject trackObj)
// { // {
@ -287,8 +326,10 @@ FormInfo* FormTrack::setDrawDt(QStringList listdt, QJsonObject obj)
//曲线信息栏 //曲线信息栏
FormInfo *formInfo = new FormInfo(this, strSlfName, strWellName, m_strTrackName, strLineName, lineColor); FormInfo *formInfo = new FormInfo(this, strSlfName, strWellName, m_strTrackName, strLineName, lineColor);
m_formInfo = formInfo;
formInfo->initProperty(obj); formInfo->initProperty(obj);
formInfo->m_strUuid = m_strUuid; formInfo->m_strUuid = m_strUuid;
formInfo->m_strTrackUuid = m_strTrackUuid;
formInfo->m_strAliasName = strAliasName; formInfo->m_strAliasName = strAliasName;
formInfo->m_strScaleType = strScaleType; formInfo->m_strScaleType = strScaleType;
formInfo->m_strType = strType; formInfo->m_strType = strType;
@ -318,7 +359,9 @@ void FormTrack::s_addLine(QString strSlfName, QString strWellName, QString strTr
//曲线信息栏 //曲线信息栏
FormInfo *formInfo = new FormInfo(this, strSlfName, strWellName, strTrackName, strLineName, lineColor); FormInfo *formInfo = new FormInfo(this, strSlfName, strWellName, strTrackName, strLineName, lineColor);
m_formInfo = formInfo;
formInfo->m_strUuid = m_strUuid; formInfo->m_strUuid = m_strUuid;
formInfo->m_strTrackUuid = m_strTrackUuid;
formInfo->m_strAliasName = strAliasName; formInfo->m_strAliasName = strAliasName;
formInfo->m_strUnit = strUnit; formInfo->m_strUnit = strUnit;
formInfo->m_strScaleType = strScaleType; formInfo->m_strScaleType = strScaleType;

View File

@ -49,13 +49,24 @@ public:
explicit FormTrack(QWidget *parent = nullptr, QString strWellName="", QString strTrackName=""); explicit FormTrack(QWidget *parent = nullptr, QString strWellName="", QString strTrackName="");
~FormTrack(); ~FormTrack();
FormInfo* getFormInfo();
// 获取道id
QString getTrackUuid();
// 根据条件获取FormInfo
FormInfo* getFormInfoByParameters(QString strUuid, QString strWellName,
QString strTrackName, QString strLineName);
private: private:
Ui::FormTrack *ui; Ui::FormTrack *ui;
public: public:
QString m_strUuid; QString m_strUuid;
// 道ID
QString m_strTrackUuid = "";
QString m_strWellName; QString m_strWellName;
QString m_strTrackName; QString m_strTrackName;
FormInfo *m_formInfo = NULL;
// 创建自定义单元格委托 // 创建自定义单元格委托
//NoLRBorderDelegate *m_delegate; //NoLRBorderDelegate *m_delegate;

View File

@ -30,6 +30,9 @@ FormWell::FormWell(QWidget *parent, QString strWellName) :
ui->tableWidget->setStyleSheet( "QTableView::item:selected {color:#57595B; background:#E4E4E4;}"); ui->tableWidget->setStyleSheet( "QTableView::item:selected {color:#57595B; background:#E4E4E4;}");
// 假设你的类中有一个槽函数onTableRowsInserted(QModelIndex parent, int first, int last)
//connect(ui->tableWidget->model(), &QAbstractItemModel::columnsInserted,
// this, &FormWell::onTableColumnsInserted);
// 设置右键菜单策略 // 设置右键菜单策略
ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu); ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu);
// 连接信号和槽 // 连接信号和槽
@ -47,6 +50,13 @@ FormWell::FormWell(QWidget *parent, QString strWellName) :
connect(CallManage::getInstance(), SIGNAL(sig_NewCol(QStringList)), this, SLOT(s_NewCol(QStringList))); connect(CallManage::getInstance(), SIGNAL(sig_NewCol(QStringList)), this, SLOT(s_NewCol(QStringList)));
connect(CallManage::getInstance(), SIGNAL(sig_ChangeCross(QString, QString)),
this, SLOT(s_ChangeCross(QString, QString)));
connect(CallManage::getInstance(), SIGNAL(sig_ReplotFinished(QString)),
this, SLOT(s_ReplotFinished(QString)));
QtColorTableData::getInstance()->LoadScheme(); QtColorTableData::getInstance()->LoadScheme();
} }
@ -113,6 +123,8 @@ QVector<QWidget *> FormWell::new_track(QStringList listdt, QString strTrackName)
ui->tableWidget->setRowHeight(i, 100); ui->tableWidget->setRowHeight(i, 100);
// //
FormTrackTop* trackTop= new FormTrackTop(this, strSlfName, strWellName, strTrackName); FormTrackTop* trackTop= new FormTrackTop(this, strSlfName, strWellName, strTrackName);
// if ("curveObject" == strType)
// trackTop->setFixedWidth(nW/2);
vec << trackTop; vec << trackTop;
trackTop->m_strUuid = m_strUuid; trackTop->m_strUuid = m_strUuid;
trackTop->m_nTrackW = nW / static_cast<int>(g_dPixelPerCm); trackTop->m_nTrackW = nW / static_cast<int>(g_dPixelPerCm);
@ -125,6 +137,8 @@ QVector<QWidget *> FormWell::new_track(QStringList listdt, QString strTrackName)
//曲线名称栏 //曲线名称栏
formTrack = new FormTrack(this, strWellName, strTrackName); formTrack = new FormTrack(this, strWellName, strTrackName);
// if ("curveObject" == strType)
// formTrack->setFixedWidth(nW / 2);
vec << formTrack; vec << formTrack;
formTrack->m_strUuid = m_strUuid; formTrack->m_strUuid = m_strUuid;
formTrack->show(); formTrack->show();
@ -160,9 +174,26 @@ QVector<QWidget *> FormWell::new_track(QStringList listdt, QString strTrackName)
ui->tableWidget->setCellWidget(i, columnCount, formDraw); ui->tableWidget->setCellWidget(i, columnCount, formDraw);
} }
} }
m_mapFormDraw.insert(formTrack->getTrackUuid(), vec);
return vec; return vec;
} }
int FormWell::getTableWidgetColumn(QString strTrackUuid)
{
int nret = -1;
int nColCount = ui->tableWidget->columnCount();
for (int i = 0; i < nColCount; i++)
{
FormTrack* pTrack = qobject_cast<FormTrack*>(ui->tableWidget->cellWidget(1, i));
if (pTrack && pTrack->getTrackUuid() == strTrackUuid)
{
nret = i;
break;
}
}
return nret;
}
void FormWell::s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int iTableType, QString strFormInfoType) void FormWell::s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int iTableType, QString strFormInfoType)
{ {
if(m_strUuid == strUuid && if(m_strUuid == strUuid &&
@ -178,6 +209,36 @@ void FormWell::s_Raise(QString strUuid, QString strSlfName, QString strWellName,
} }
} }
void FormWell::s_ChangeCross(QString strUuid, QString strTrackUuid)
{
const QVector<QWidget*>& vecWgt = m_mapFormDraw.value(strTrackUuid);
if (vecWgt.size() <= 2)
return;
FormDraw *formDraw = qobject_cast<FormDraw*>(vecWgt.at(2));
if (formDraw == NULL || formDraw->m_curv == NULL)
return;
formDraw->crossTrackSetting();
return;
}
void FormWell::s_ReplotFinished(QString strUuid)
{
if (m_strUuid != strUuid)
return;
int newColCount = ui->tableWidget->columnCount();
for (int i = 0; i < newColCount; i++)
{
FormDraw *formDraw = qobject_cast<FormDraw*>(ui->tableWidget->cellWidget(2, i));
if (formDraw == NULL)
continue;
formDraw->crossTrackSetting();
}
}
void FormWell::s_NewTrack(QString strUuid, QString strWellName, QString strSlfName, QString strLineName, QString strType,int nW) void FormWell::s_NewTrack(QString strUuid, QString strWellName, QString strSlfName, QString strLineName, QString strType,int nW)
{ {
QStringList listdt; QStringList listdt;
@ -427,7 +488,28 @@ void FormWell::setRowHeight(double dHight, QProgressBar *progressBar, int iSplit
} }
} }
} }
QTimer::singleShot(100, this, [=]() {
this->s_ReplotFinished(m_strUuid);
});
} }
//
//void FormWell::onTableColumnsInserted(const QModelIndex &parent, int first, int last)
//{
// // 当行被插入时,此函数被自动调用
// int newRowCount = ui->tableWidget->rowCount();
// int newColCount = ui->tableWidget->columnCount();
// qDebug() << "表格行数已变化!新的行数为:" << newRowCount << " 列:"<< newColCount;
// qDebug() << "新插入的行范围是从:" << first << " 到 " << last;
// for (int i = 0; i < newColCount; i++)
// {
// FormDraw *formDraw = qobject_cast<FormDraw*>(ui->tableWidget->cellWidget(2, i));
// if (formDraw == NULL)
// continue;
//
// formDraw->crossTrackSetting();
// }
//}
void FormWell::s_NewCol(QStringList listdt) void FormWell::s_NewCol(QStringList listdt)
{ {

View File

@ -25,6 +25,9 @@ public:
QVector<QWidget*> new_track(QStringList listdt, QString strTrackName = ""); QVector<QWidget*> new_track(QStringList listdt, QString strTrackName = "");
// 根据道ID获取列索引
int getTableWidgetColumn(QString strTrackUuid);
private: private:
Ui::FormWell *ui; Ui::FormWell *ui;
@ -37,6 +40,9 @@ public:
double m_iY2=0; double m_iY2=0;
QWidget *m_parent; QWidget *m_parent;
// 道图形
QMap<QString, QVector<QWidget*>> m_mapFormDraw;
public: public:
QJsonObject makeJson(); QJsonObject makeJson();
QStringList getLineList(QString strWellName, QString strTrackName); QStringList getLineList(QString strWellName, QString strTrackName);
@ -46,6 +52,8 @@ public:
int setColWidth(int iCurrentCol, int iNewWidth); int setColWidth(int iCurrentCol, int iNewWidth);
public slots: public slots:
//void onTableColumnsInserted(const QModelIndex &parent, int first, int last);
void s_NewCol(QStringList listdt); void s_NewCol(QStringList listdt);
void s_NewTrack(QString strUuid, QString strWellName, QString strSlfName, QString strLineName, QString strType,int nW); void s_NewTrack(QString strUuid, QString strWellName, QString strSlfName, QString strLineName, QString strType,int nW);
@ -56,11 +64,16 @@ public slots:
void s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int iTableType, QString strFormInfoType); void s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int iTableType, QString strFormInfoType);
void s_ChangeCross(QString strUuid, QString strTrackUuid);//
void s_ReplotFinished(QString strUuid);
//图头右键菜单响应函数 //图头右键菜单响应函数
void slotContextMenu(QPoint pos); void slotContextMenu(QPoint pos);
void slotDeleteSelectTrack(); void slotDeleteSelectTrack();
void resizeWindow(); void resizeWindow();
}; };
#endif // FORMWELL_H #endif // FORMWELL_H

View File

@ -2139,6 +2139,7 @@ QStringList MainWindowCurve::getSelectWell_New()
{ {
//选中道 //选中道
//不在此处处理 //不在此处处理
return sret;
} }
else else
{ {
@ -2149,6 +2150,7 @@ QStringList MainWindowCurve::getSelectWell_New()
sret << strWellName << strSlfName; sret << strWellName << strSlfName;
return sret; return sret;
} }
return sret;
} }
QStringList MainWindowCurve::getSelectWell() QStringList MainWindowCurve::getSelectWell()

View File

@ -2291,6 +2291,7 @@ bool QMyCustomPlot::CopyToSLFFile(QString targetSLFFileName, bool deleteFromSrc,
else logio->CopyFromFile(a_cslfio,curvename); else logio->CopyFromFile(a_cslfio,curvename);
delete[] curvename; delete[] curvename;
delete logio; delete logio;
return true;
} }
void QMyCustomPlot::onAddRect() void QMyCustomPlot::onAddRect()
@ -3095,7 +3096,11 @@ void QMyCustomPlot::s_ChangeLeftScale(QString strUuid, QString strSlfName, QStri
m_strLineName == strLineName) m_strLineName == strLineName)
{ {
m_iX1 = newLeftScale; m_iX1 = newLeftScale;
yAxis->setRange(m_iX1, m_iX2);
double rg = m_iX2 - m_iX1;
double lower = m_iX1 - rg * m_nLeftCross;
double upper = m_iX2 + rg * m_nRightCross;
yAxis->setRange(lower, upper);
// //
replot(); replot();
} }
@ -3122,7 +3127,11 @@ void QMyCustomPlot::s_ChangeRightScale(QString strUuid, QString strSlfName, QStr
m_strLineName == strLineName) m_strLineName == strLineName)
{ {
m_iX2 = newRightScale; m_iX2 = newRightScale;
yAxis->setRange(m_iX1, m_iX2);
double rg = m_iX2 - m_iX1;
double lower = m_iX1 - rg * m_nLeftCross;
double upper = m_iX2 + rg * m_nRightCross;
yAxis->setRange(lower, upper);
// //
replot(); replot();
} }

View File

@ -53,6 +53,7 @@ protected:
//virtual void mouseMoveEvent(QMouseEvent *event); //virtual void mouseMoveEvent(QMouseEvent *event);
public: public:
// 井UUID
QString m_strUuid; QString m_strUuid;
QString m_strSlfName; QString m_strSlfName;
QString m_strWellName; QString m_strWellName;
@ -62,6 +63,8 @@ public:
// //
float m_iX1, m_iX2; float m_iX1, m_iX2;
float m_iY1, m_iY2; float m_iY1, m_iY2;
qint8 m_nLeftCross = 0; // 左跨道个数
qint8 m_nRightCross = 0; // 右跨道个数
//填充曲线 //填充曲线
QCPGraph *graph_Fill=nullptr; QCPGraph *graph_Fill=nullptr;