# Conflicts:
#	logPlus/mainwindowcurve.cpp
This commit is contained in:
DESKTOP-450PEFP\mainc 2025-12-30 16:16:36 +08:00
commit fe7d7fa801
8 changed files with 179 additions and 91 deletions

View File

@ -94,10 +94,10 @@ void TransparentDraggableSwallCore::drawLith(double left_Low, double right_Hight
return;
}
double x1 = mPlot->xAxis->coordToPixel(left_Low);
double x1 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2)+m_fImageHeight;
double x2 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2);
double y1 = mPlot->yAxis->coordToPixel(lY1);
double y2 = mPlot->yAxis->coordToPixel(lY1+(lY2-lY1)/5);
double y1 = mPlot->yAxis->coordToPixel(lY1)+(m_fLeftSpace+m_fTriangleLen);
double y2 = mPlot->yAxis->coordToPixel(lY1)+m_fImageWidth+(m_fLeftSpace+m_fTriangleLen);
bool bWidthBig = false;
double newWidth = y2-y1;
@ -253,9 +253,9 @@ void TransparentDraggableSwallCore::drawOil(double left_Low, double right_Hight,
}
double x1 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2);
double x2 = mPlot->xAxis->coordToPixel(right_Hight);
double y1 = mPlot->yAxis->coordToPixel(lY1);
double y2 = mPlot->yAxis->coordToPixel(lY1+(lY2-lY1)/5);
double x2 = mPlot->xAxis->coordToPixel((left_Low+right_Hight)/2)-m_fImageHeight;
double y1 = mPlot->yAxis->coordToPixel(lY1)+(m_fLeftSpace+m_fTriangleLen);
double y2 = mPlot->yAxis->coordToPixel(lY1)+m_fImageWidth+(m_fLeftSpace+m_fTriangleLen);
bool bWidthBig = false;
double newWidth = y2-y1;
@ -327,8 +327,8 @@ void TransparentDraggableSwallCore::setRange(double left_Low, double right_Hight
double lY1 = mPlot->yAxis->range().lower;//+10
double lY2 = mPlot->yAxis->range().upper;
mRect->topLeft->setCoords(left_Low, lY1);
mRect->bottomRight->setCoords(right_Hight, lY1+(lY2-lY1)/3);
mRect->topLeft->setCoords(left_Low, lY1+(m_fLeftSpace+m_fTriangleLen));
mRect->bottomRight->setCoords(right_Hight, lY1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+m_fColorWordLen);
// //位置与rect不一样否则图像反转
// mPixmap_Color->topLeft->setCoords(right_Hight, lY1+(lY2-lY1)/4);
@ -347,11 +347,21 @@ void TransparentDraggableSwallCore::setRange(double left_Low, double right_Hight
// 设置父锚点,定位点
//mItemTitle->position->setParentAnchor(mRect->bottom);
mItemTitle->position->setCoords(mRect->bottomRight->coords().x(), //(mRect->topLeft->coords().x() + mRect->bottomRight->coords().x())/2,
lY1+(lY2-lY1)/4); //(mRect->topLeft->coords().y() + mRect->bottomRight->coords().y())/2); // 设置文本在矩形中心位置
lY1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+20); //(mRect->topLeft->coords().y() + mRect->bottomRight->coords().y())/2); // 设置文本在矩形中心位置
//mRect->topLeft->setCoords(left, mPlot->yAxis->range().upper);
//mRect->bottomRight->setCoords(right, mPlot->yAxis->range().lower);
//三角形2边
m_qcpItemLine1->start->setCoords((left_Low+right_Hight)/2, lY1+m_fLeftSpace);
m_qcpItemLine1->end->setCoords(left_Low, lY1+(m_fLeftSpace+m_fTriangleLen));
//
m_qcpItemLine2->start->setCoords((left_Low+right_Hight)/2, lY1+m_fLeftSpace);
m_qcpItemLine2->end->setCoords(right_Hight, lY1+(m_fLeftSpace+m_fTriangleLen));
//
m_qcpItemLine3->start->setCoords((left_Low+right_Hight)/2, lY1+m_fLeftSpace);
m_qcpItemLine3->end->setCoords((left_Low+right_Hight)/2, lY1+(m_fLeftSpace+m_fTriangleLen));
updateHandles();
mPlot->replot();
}
@ -389,6 +399,10 @@ void TransparentDraggableSwallCore::deleteRect()
mPlot->removeItem(mPixmap_Oil);
//mPlot->removeItem(mPixmap_Color);
mPlot->removeItem(mItemTitle);
//三角形2边
mPlot->removeItem(m_qcpItemLine1);
mPlot->removeItem(m_qcpItemLine2);
mPlot->removeItem(m_qcpItemLine3);
mPlot->replot();
this->deleteLater();
@ -411,7 +425,7 @@ void TransparentDraggableSwallCore::initRect()
mRect = new QCPItemRect(mPlot);
mRect->setLayer("overlay"); // 确保在最上层
mRect->setBrush(QBrush(QColor(255, 255, 255, 50))); // 半透明蓝色100, 100, 255, 50
mRect->setPen(QPen(QColor(70, 70, 255, 200)));
mRect->setPen(QPen(QColor(0, 0, 0, 200)));
// // 创建左右边界控制点
// mLeftHandle = new QCPItemRect(mPlot);
@ -458,6 +472,16 @@ void TransparentDraggableSwallCore::initRect()
//mItemTitle->position->setType(QCPItemPosition::ptAxisRectRatio);
mItemTitle->position->setCoords(0.5, 0);
mItemTitle->setLayer("overlay");
//三角形2边
m_qcpItemLine1 = new QCPItemLine(mPlot);
m_qcpItemLine1->setPen(QPen(QColor(0, 0, 0, 200)));
//
m_qcpItemLine2 = new QCPItemLine(mPlot);
m_qcpItemLine2->setPen(QPen(QColor(0, 0, 0, 200)));
//
m_qcpItemLine3 = new QCPItemLine(mPlot);
m_qcpItemLine3->setPen(QPen(QColor(0, 0, 0, 200)));
}
void TransparentDraggableSwallCore::updateHandles()

View File

@ -76,6 +76,10 @@ private:
QCPItemText *mItemTitle;
QString mstrTitle="";
QString m_strUuid = "";
//三角形2边
QCPItemLine *m_qcpItemLine1;
QCPItemLine *m_qcpItemLine2;
QCPItemLine *m_qcpItemLine3;
QString m_Lith;
QString m_Oil;
@ -92,6 +96,15 @@ private:
// 添加最小宽度成员变量
double mMinWidth;
//
float m_fLeftSpace=0; //左侧空白长度
float m_fTriangleLen=40;//三角形长度
//
float m_fImageWidth=70;//图片长度
float m_fImageHeight=20;//图片高度
//
float m_fColorWordLen=40;//颜色文字长度
};
#endif // TRANSPARENTDRAGGABLESWALLCORE_H

View File

@ -1198,14 +1198,6 @@ void FormDraw::s_addDrawImage(QString strUuid, QString strSlfName, QString strWe
//图像 成像
DrawImageNew_NoFilter(curv, strSlfName, "");
//道-对象
QString strAliasName = "井斜方位图";
QString strUnit = "(°)";
QColor newlineColor=QColor(0,0,0);
double width=2;
QString strScaleType = "";
//道-对象
m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_RightVal, m_LeftVal, strScaleType, "DrawImageObject");
//
connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
@ -2070,7 +2062,7 @@ void FormDraw::DrawImageNew_NoFilter(QMyCustomPlot *widget, QString strSlfName,
// 重新缩放键x和值y以便可以看到整个颜色图
//widget->rescaleAxes();
QString strAliasName = "";
QString strAliasName = "成图";
QString strUnit = "";
QColor newlineColor=QColor(0,0,0);
double width=2;
@ -4434,9 +4426,10 @@ void FormDraw::DrawDenv(QMyCustomPlot *widget, QString strSlfName)
m_csCurveAZIM=("AZIM");
m_csCurveDEVI=("DEVI");
m_nCircleLineWidth = 2 ;
m_nTailWidth=2;
m_TailColor=qRgb(255,0,0);
m_crPointFill=qRgb(0,255,0);
m_crPointFillDenv=qRgb(0,0,0);
m_crCirCleColor = qRgb(0,0,255);
m_nRadius = 4;
m_nTailLen=8;
@ -4479,7 +4472,7 @@ void FormDraw::DrawDenv(QMyCustomPlot *widget, QString strSlfName)
//
QPen pPen(m_TailColor,m_nTailWidth);
QPen pPen2(m_crCirCleColor,m_nCircleLineWidth);
QBrush cBrush(m_crPointFill);
QBrush cBrush(m_crPointFillDenv);
float tempf,flVal;
int i,j,nPointNum=0,tempi;

View File

@ -155,6 +155,7 @@ public:
//井斜方位图
QString m_csCurveAZIM, m_csCurveDEVI; // 方位/倾角/可信度 曲线名
QColor m_TailColor,m_crCirCleColor;// add m_crCirCleColor圆线颜色
QColor m_crPointFillDenv;
//文字结论
void initWords(QMyCustomPlot *widget, QString strSlfName, QString strLineName);

View File

@ -370,10 +370,20 @@ void FormWell::s_NewCol(QStringList listdt)
QJsonObject FormWell::makeJson()
{
//
QString slffilename=QString("");
int ind=m_strSlfName.lastIndexOf('\\');
int ind2=m_strSlfName.lastIndexOf('/');
if(ind2>ind) ind=ind2;
if(ind>-1) {
slffilename=m_strSlfName.mid(ind+1);
}
// 创建根对象
QJsonObject rootObj;
//
rootObj["WellName"] = m_strWellName;
rootObj["SlfName"] = slffilename;
// 创建JSON数组并填充数据
QJsonArray subcaseArray;

View File

@ -28,6 +28,7 @@ private:
public:
QString m_strUuid;
QString m_strWellName;
QString m_strSlfName="";
public:
QJsonObject makeJson();

View File

@ -103,7 +103,7 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) :
connect(this, SIGNAL(sig_NewTrackChangeWidth(QString)), this, SLOT(s_NewTrackChangeWidth(QString)));
connect(this, SIGNAL(sig_NewWell(QString)), this, SLOT(s_NewWell(QString)));
//connect(this, SIGNAL(sig_NewWell(QString, QString)), this, SLOT(s_NewWell(QString, QString)));
connect(CallManage::getInstance(), SIGNAL(sig_mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
connect(CallManage::getInstance(), SIGNAL(sig_changeScale(int)), this, SLOT(s_changeScale(int)));
@ -399,7 +399,7 @@ QStringList MainWindowCurve::insertCol(int nW)
{
//井没创建,创建井+道+曲线
//新建井
s_NewWell(strWellName);
s_NewWell(strWellName, strSlfName);
m_listWell.push_back(strWellName);
column= 0;
@ -590,7 +590,7 @@ QJsonObject MainWindowCurve::makeJson()
return rootObj;
}
void MainWindowCurve::s_NewWell(QString strWellName)
void MainWindowCurve::s_NewWell(QString strWellName, QString strSlfName)
{
//因为tableWidget需要提前规定好行数与列数
int rowcount = 2; //总行数
@ -627,6 +627,7 @@ void MainWindowCurve::s_NewWell(QString strWellName)
ui->tableWidget_2->setRowHeight(i, 100);
//
QTableWidgetItem* item = new QTableWidgetItem(strWellName);
item->setData(Qt::UserRole + 1, strSlfName);
item->setFlags(item->flags() & (~Qt::ItemIsEditable));
item->setTextAlignment(Qt::AlignCenter); //设置文本居中
ui->tableWidget_2->setItem(i, columnCount, item);
@ -651,6 +652,7 @@ void MainWindowCurve::s_NewWell(QString strWellName)
//
FormWell *widgetWell = new FormWell(this, strWellName);
widgetWell->m_strUuid = m_strUuid;
widgetWell->m_strSlfName = strSlfName;
ui->tableWidget_2->setCellWidget(i, columnCount, widgetWell);
//
@ -679,15 +681,25 @@ void MainWindowCurve::mousePressEvent(QMouseEvent *event)
void MainWindowCurve::s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName)
{
//选中了曲线置顶
//取消表格选中状态
ui->tableWidget_2->clearSelection();
if(m_strUuid == strUuid)
{
//
}
else {
//选中了曲线置顶
//取消表格选中状态
ui->tableWidget_2->clearSelection();
}
}
void MainWindowCurve::onItemClicked(QTableWidgetItem* item)
{
qDebug() << "MainWindowCurve onItemClicked";
//曲线
QString strWellName = item->text();
//QString strSlfName = item->data(Qt::UserRole+1).toString();
PropertyService()->initWellProperty();
//取消所有选中单元格
emit CallManage::getInstance()->sig_Raise(m_strUuid, "", "", "", "");
@ -730,29 +742,29 @@ void MainWindowCurve::s_NewDepth()
{
int column = -1;
int nW = 100;
QString strSlfName = "";
QString strLeft = m_leftWidgets->getLeftTreeString();
if(strLeft.length() > 0)
{
QStringList list = strLeft.split("#@@#");//QString字符串分割函数
if (list.size() > 3)
{
strSlfName = list[0];
QString strWellName = list[1];
// QString strLineName = list[2];
// QString strType = list[3];
// QString strSlfName = "";
// QString strLeft = m_leftWidgets->getLeftTreeString();
// if(strLeft.length() > 0)
// {
// QStringList list = strLeft.split("#@@#");//QString字符串分割函数
// if (list.size() > 3)
// {
// strSlfName = list[0];
// QString strWellName = list[1];
// // QString strLineName = list[2];
// // QString strType = list[3];
if(!m_listWell.contains(strWellName))
{
//井没创建,创建井+道+曲线
//新建井
s_NewWell(strWellName);
m_listWell.push_back(strWellName);
// if(!m_listWell.contains(strWellName))
// {
// //井没创建,创建井+道+曲线
// //新建井
// s_NewWell(strWellName, strSlfName);
// m_listWell.push_back(strWellName);
column= 0;
}
}
}
// column= 0;
// }
// }
// }
if(ui->tableWidget_2->columnCount()==0)
{
@ -782,6 +794,8 @@ void MainWindowCurve::s_NewDepth()
}
QString strWellName = ui->tableWidget_2->item(0, column)->text();
//直接从选中的井获取data记录slf路径
QString strSlfName = ui->tableWidget_2->item(0, column)->data(Qt::UserRole+1).toString();
//设置列宽
ui->tableWidget_2->setColumnWidth(column, iWidth+nW+8);
@ -817,16 +831,16 @@ void MainWindowCurve::s_pinLvAc()
void MainWindowCurve::s_NewGanZhuangTu()
{
QString strSlfName = "";
QString strLeft = m_leftWidgets->getLeftTreeString();
if(strLeft.length() > 0)
{
QStringList list = strLeft.split("#@@#");//QString字符串分割函数
if (list.size() > 3)
{
strSlfName = list[0];
}
}
// QString strSlfName = "";
// QString strLeft = m_leftWidgets->getLeftTreeString();
// if(strLeft.length() > 0)
// {
// QStringList list = strLeft.split("#@@#");//QString字符串分割函数
// if (list.size() > 3)
// {
// strSlfName = list[0];
// }
// }
if(ui->tableWidget_2->columnCount()==0)
{
@ -850,6 +864,9 @@ void MainWindowCurve::s_NewGanZhuangTu()
}
QString strWellName = ui->tableWidget_2->item(0, column)->text();
//直接从选中的井获取data记录slf路径
QString strSlfName = ui->tableWidget_2->item(0, column)->data(Qt::UserRole+1).toString();
int iWidth = ui->tableWidget_2->columnWidth(column);
int nW = 320;
@ -881,16 +898,16 @@ void MainWindowCurve::s_roseAc()
//井眼垮塌矢量图
void MainWindowCurve::s_Jykt()
{
QString strSlfName = "";
QString strLeft = m_leftWidgets->getLeftTreeString();
if(strLeft.length() > 0)
{
QStringList list = strLeft.split("#@@#");//QString字符串分割函数
if (list.size() > 3)
{
strSlfName = list[0];
}
}
// QString strSlfName = "";
// QString strLeft = m_leftWidgets->getLeftTreeString();
// if(strLeft.length() > 0)
// {
// QStringList list = strLeft.split("#@@#");//QString字符串分割函数
// if (list.size() > 3)
// {
// strSlfName = list[0];
// }
// }
if(ui->tableWidget_2->columnCount()==0)
{
@ -916,6 +933,9 @@ void MainWindowCurve::s_Jykt()
}
QString strWellName = ui->tableWidget_2->item(0, column)->text();
//直接从选中的井获取data记录slf路径
QString strSlfName = ui->tableWidget_2->item(0, column)->data(Qt::UserRole+1).toString();
int iWidth = ui->tableWidget_2->columnWidth(column);
int nW = 320;
@ -929,16 +949,16 @@ void MainWindowCurve::s_Jykt()
//井斜方位图
void MainWindowCurve::s_Denv()
{
QString strSlfName = "";
QString strLeft = m_leftWidgets->getLeftTreeString();
if(strLeft.length() > 0)
{
QStringList list = strLeft.split("#@@#");//QString字符串分割函数
if (list.size() > 3)
{
strSlfName = list[0];
}
}
// QString strSlfName = "";
// QString strLeft = m_leftWidgets->getLeftTreeString();
// if(strLeft.length() > 0)
// {
// QStringList list = strLeft.split("#@@#");//QString字符串分割函数
// if (list.size() > 3)
// {
// strSlfName = list[0];
// }
// }
if(ui->tableWidget_2->columnCount()==0)
{
@ -964,6 +984,9 @@ void MainWindowCurve::s_Denv()
}
QString strWellName = ui->tableWidget_2->item(0, column)->text();
//直接从选中的井获取data记录slf路径
QString strSlfName = ui->tableWidget_2->item(0, column)->data(Qt::UserRole+1).toString();
int iWidth = ui->tableWidget_2->columnWidth(column);
int nW = 320;
@ -977,16 +1000,16 @@ void MainWindowCurve::s_Denv()
//图像 成图
void MainWindowCurve::s_DrawImage()
{
QString strSlfName = "";
QString strLeft = m_leftWidgets->getLeftTreeString();
if(strLeft.length() > 0)
{
QStringList list = strLeft.split("#@@#");//QString字符串分割函数
if (list.size() > 3)
{
strSlfName = list[0];
}
}
// QString strSlfName = "";
// QString strLeft = m_leftWidgets->getLeftTreeString();
// if(strLeft.length() > 0)
// {
// QStringList list = strLeft.split("#@@#");//QString字符串分割函数
// if (list.size() > 3)
// {
// strSlfName = list[0];
// }
// }
if(ui->tableWidget_2->columnCount()==0)
{
@ -1012,6 +1035,9 @@ void MainWindowCurve::s_DrawImage()
}
QString strWellName = ui->tableWidget_2->item(0, column)->text();
//直接从选中的井获取data记录slf路径
QString strSlfName = ui->tableWidget_2->item(0, column)->data(Qt::UserRole+1).toString();
int iWidth = ui->tableWidget_2->columnWidth(column);
int nW = 320;
@ -1077,7 +1103,7 @@ void MainWindowCurve::NewWellAndTrack(QString strWellName, QString strSlfName, Q
{
//井没创建,创建井+道+曲线
//新建井
s_NewWell(strWellName);
s_NewWell(strWellName, strSlfName);
m_listWell.push_back(strWellName);
//新建道+曲线
@ -1707,6 +1733,7 @@ void MainWindowCurve::DisplayWells(QJsonArray wellsArray)
void MainWindowCurve::DisplayWell_One(QJsonObject wellObjInfo)
{
QString strWellName = "";
QString strSlfName = "";
QJsonArray tracksArray;
if (wellObjInfo.contains("WellName"))
@ -1718,10 +1745,29 @@ void MainWindowCurve::DisplayWell_One(QJsonObject wellObjInfo)
//新建井
//mainWindowCurve->s_NewWell(strWellName);
s_NewWell(strWellName);
//s_NewWell(strWellName);
}
}
if (wellObjInfo.contains("SlfName"))
{
QJsonValue value = wellObjInfo.value("SlfName");
if (value.isString()) {
strSlfName = value.toString();
qDebug() << "strSlfName:" << strSlfName;
//新建井
//mainWindowCurve->s_NewWell(strWellName);
//s_NewWell(strWellName);
}
}
//新建井
QString folderPath = GetLogdataPath();
folderPath = folderPath + g_prjname;
strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName;
s_NewWell(strWellName, strSlfName);
//
if (wellObjInfo.contains("formTracks"))
{

View File

@ -101,7 +101,7 @@ signals:
void sig_NewWell(QString strWellName);
public slots:
void s_NewWell(QString strWellName);//新建井
void s_NewWell(QString strWellName, QString strSlfName);//新建井
void s_NewTrackChangeWidth(QString strWellName);//新建道后,改变井宽
void s_NewTrack_No_Line(QString strWellName, QString strTrackName);//新建空白道,没有曲线
void s_AddLine_Property(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,