代码格式

This commit is contained in:
DESKTOP-450PEFP\mainc 2026-03-11 10:04:38 +08:00
parent c2e148a0ee
commit 24bfc1e7dd

View File

@ -1031,7 +1031,7 @@ void FormDraw::s_AddLine_Property(QString strUuid, QString strSlfName, QString s
}
//qDebug() << "FormDraw s_AddLine_Property";
AppendConsole(PAI_INFO, "FormDraw s_AddLine_Property");
AppendConsole(PAI_INFO, "FormDraw s_AddLine_Property");
if(m_listLineName.contains(strLineName))
{
@ -1069,8 +1069,8 @@ AppendConsole(PAI_INFO, "FormDraw s_AddLine_Property");
//curv->resize(INT_MAX, INT_MAX); // 使用 INT_MAX 来避免16位整数的限制
// QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// curv->setSizePolicy(policy);
// QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// curv->setSizePolicy(policy);
curv->show();
initForm(curv, strSlfName, strLineName,
@ -1083,7 +1083,7 @@ AppendConsole(PAI_INFO, "FormDraw s_AddLine_Property");
//
m_listLineName.push_back(strLineName);
AppendConsole(PAI_INFO, "FormDraw s_AddLine_Property end");
AppendConsole(PAI_INFO, "FormDraw s_AddLine_Property end");
}
void FormDraw::s_addWave(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strWaveName)
@ -1136,8 +1136,8 @@ void FormDraw::s_addWave(QString strUuid, QString strSlfName, QString strWellNam
//curv->resize(INT_MAX, INT_MAX); // 使用 INT_MAX 来避免16位整数的限制
// QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// curv->setSizePolicy(policy);
// QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// curv->setSizePolicy(policy);
curv->show();
@ -1472,40 +1472,40 @@ void FormDraw::s_handleRectRangeChange(QCPRange newRange)
void FormDraw::setupLineStyleDemo(QMyCustomPlot *customPlot)
{
// customPlot->legend->setVisible(true);
// customPlot->legend->setFont(QFont("Helvetica", 9));
// QPen pen;
// QStringList lineNames;
// lineNames << "lsNone" << "lsLine" << "lsStepLeft" << "lsStepRight" << "lsStepCenter" << "lsImpulse";
// customPlot->legend->setVisible(true);
// customPlot->legend->setFont(QFont("Helvetica", 9));
// QPen pen;
// QStringList lineNames;
// lineNames << "lsNone" << "lsLine" << "lsStepLeft" << "lsStepRight" << "lsStepCenter" << "lsImpulse";
// for (int i = QCPGraph::lsNone; i <= QCPGraph::lsImpulse; ++i)
// {
// customPlot->addGraph();
// pen.setColor(QColor(qSin(i*1+1.2)*80+80, qSin(i*0.3+0)*80+80, qSin(i*0.3+1.5)*80+80));
// customPlot->graph()->setPen(pen); // 设置图表的画笔
// customPlot->graph()->setName(lineNames.at(i-QCPGraph::lsNone));
// customPlot->graph()->setLineStyle((QCPGraph::LineStyle)i); // 设置图表线段的风格
// customPlot->graph()->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssCircle, 5)); // 设置图表散点图的样式
// for (int i = QCPGraph::lsNone; i <= QCPGraph::lsImpulse; ++i)
// {
// customPlot->addGraph();
// pen.setColor(QColor(qSin(i*1+1.2)*80+80, qSin(i*0.3+0)*80+80, qSin(i*0.3+1.5)*80+80));
// customPlot->graph()->setPen(pen); // 设置图表的画笔
// customPlot->graph()->setName(lineNames.at(i-QCPGraph::lsNone));
// customPlot->graph()->setLineStyle((QCPGraph::LineStyle)i); // 设置图表线段的风格
// customPlot->graph()->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssCircle, 5)); // 设置图表散点图的样式
// QVector<double> x(15), y(15);
// for (int j=0; j<15; ++j)
// {
// x[j] = j/15.0 * 5*3.14 + 0.01;
// y[j] = 7*qSin(x[j])/x[j] - (i-QCPGraph::lsNone)*5 + (QCPGraph::lsImpulse)*5 + 2;
// }
// customPlot->graph()->setData(x, y);
// customPlot->graph()->rescaleAxes(true);
// }
// // 放大一点
// customPlot->yAxis->scaleRange(1.1, customPlot->yAxis->range().center());
// customPlot->xAxis->scaleRange(1.1, customPlot->xAxis->range().center());
// QVector<double> x(15), y(15);
// for (int j=0; j<15; ++j)
// {
// x[j] = j/15.0 * 5*3.14 + 0.01;
// y[j] = 7*qSin(x[j])/x[j] - (i-QCPGraph::lsNone)*5 + (QCPGraph::lsImpulse)*5 + 2;
// }
// customPlot->graph()->setData(x, y);
// customPlot->graph()->rescaleAxes(true);
// }
// // 放大一点
// customPlot->yAxis->scaleRange(1.1, customPlot->yAxis->range().center());
// customPlot->xAxis->scaleRange(1.1, customPlot->xAxis->range().center());
// customPlot->xAxis->setTicks(true);
// customPlot->yAxis->setTicks(true);
// customPlot->xAxis->setTickLabels(true);
// customPlot->yAxis->setTickLabels(true);
// customPlot->xAxis->setTicks(true);
// customPlot->yAxis->setTicks(true);
// customPlot->xAxis->setTickLabels(true);
// customPlot->yAxis->setTickLabels(true);
// customPlot->axisRect()->setupFullAxesBox();
// customPlot->axisRect()->setupFullAxesBox();
}
void FormDraw::setupSelectionDemo(QMyCustomPlot *customPlot)
@ -1515,22 +1515,22 @@ void FormDraw::setupSelectionDemo(QMyCustomPlot *customPlot)
customPlot->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式
customPlot->setSelectionRectMode(QCP::srmCustom); // 鼠标框选
//customPlot->setSelectionRectMode(QCP::srmSelect); // 鼠标框选
// customPlot->setMultiSelectModifier(Qt::ControlModifier); // 使用ctrl键来多选
// customPlot->xAxis->setSelectableParts(QCPAxis::spAxis | QCPAxis::spAxisLabel | QCPAxis::spTickLabels); // 轴的三个部分都可以被选择
// customPlot->yAxis->setSelectableParts(QCPAxis::spAxis | QCPAxis::spAxisLabel | QCPAxis::spTickLabels);
// customPlot->xAxis->setLabel("xAxis");
// customPlot->yAxis->setLabel("yAxis");
// customPlot->legend->setSelectableParts(QCPLegend::spItems); // 图例本身不能被选择,只有里面的项可以被选择
// customPlot->legend->setSelectedIconBorderPen(Qt::NoPen); // 设置图例里的项被选择时不显示Icon的边框
// customPlot->setMultiSelectModifier(Qt::ControlModifier); // 使用ctrl键来多选
// customPlot->xAxis->setSelectableParts(QCPAxis::spAxis | QCPAxis::spAxisLabel | QCPAxis::spTickLabels); // 轴的三个部分都可以被选择
// customPlot->yAxis->setSelectableParts(QCPAxis::spAxis | QCPAxis::spAxisLabel | QCPAxis::spTickLabels);
// customPlot->xAxis->setLabel("xAxis");
// customPlot->yAxis->setLabel("yAxis");
// customPlot->legend->setSelectableParts(QCPLegend::spItems); // 图例本身不能被选择,只有里面的项可以被选择
// customPlot->legend->setSelectedIconBorderPen(Qt::NoPen); // 设置图例里的项被选择时不显示Icon的边框
//选框黑色虚线
//customPlot->selectionRect()->setPen(QPen(Qt::black,1,Qt::DashLine));
//customPlot->selectionRect()->setBrush(QBrush(QColor(0,0,100,50)));
//
// QPen pen(Qt::NoPen); // 使用无画笔,这样就不会有边框了
// QBrush brush(Qt::transparent); // 使用透明刷子,这样就不会有填充颜色了
// customPlot->selectionRect()->setPen(pen); // 设置选择区域的画笔为无画笔
// customPlot->selectionRect()->setBrush(brush); // 设置选择区域的刷子为透明刷子
// QPen pen(Qt::NoPen); // 使用无画笔,这样就不会有边框了
// QBrush brush(Qt::transparent); // 使用透明刷子,这样就不会有填充颜色了
// customPlot->selectionRect()->setPen(pen); // 设置选择区域的画笔为无画笔
// customPlot->selectionRect()->setBrush(brush); // 设置选择区域的刷子为透明刷子
for (int i=0; i < customPlot->graphCount(); ++i) {
QCPGraph *graph = customPlot->graph(i);
@ -1617,10 +1617,10 @@ void FormDraw::setupSelectionDemo(QMyCustomPlot *customPlot)
void FormDraw::s_selectionRectAccepted(const QRect &rect, QMouseEvent *event)
{
// 转换为坐标轴范围
// double x1 = widget->xAxis->pixelToCoord(rect.left());
// double x2 = widget->xAxis->pixelToCoord(rect.right());
// double y1 = widget->yAxis->pixelToCoord(rect.top());
// double y2 = widget->yAxis->pixelToCoord(rect.bottom());
// double x1 = widget->xAxis->pixelToCoord(rect.left());
// double x2 = widget->xAxis->pixelToCoord(rect.right());
// double y1 = widget->yAxis->pixelToCoord(rect.top());
// double y2 = widget->yAxis->pixelToCoord(rect.bottom());
}
void FormDraw::s_addGanZuangTu(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW)
@ -1821,8 +1821,8 @@ void FormDraw::s_addJykt(QString strUuid, QString strSlfName, QString strWellNam
//curv->resize(INT_MAX, INT_MAX); // 使用 INT_MAX 来避免16位整数的限制
// QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// curv->setSizePolicy(policy);
// QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// curv->setSizePolicy(policy);
curv->show();
@ -1890,8 +1890,8 @@ void FormDraw::s_addDenv(QString strUuid, QString strSlfName, QString strWellNam
//curv->resize(INT_MAX, INT_MAX); // 使用 INT_MAX 来避免16位整数的限制
// QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// curv->setSizePolicy(policy);
// QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// curv->setSizePolicy(policy);
curv->show();
@ -1959,8 +1959,8 @@ void FormDraw::s_addDrawImage(QString strUuid, QString strSlfName, QString strWe
//curv->resize(INT_MAX, INT_MAX); // 使用 INT_MAX 来避免16位整数的限制
// QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// curv->setSizePolicy(policy);
// QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// curv->setSizePolicy(policy);
curv->show();
@ -2006,8 +2006,8 @@ void FormDraw::s_addSantuyibiao(QString strUuid, QString strSlfName, QString str
FormLine *curv = new FormLine(this, strSlfName, strWellName, strTrackName, strLineName);
curv->m_strUuid = m_strUuid;
//背景设置成透明色
// curv->setBackground(Qt::transparent);
// curv->setStyleSheet("background: transparent;");
// curv->setBackground(Qt::transparent);
// curv->setStyleSheet("background: transparent;");
double dHight = 0;
dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm;
@ -2029,8 +2029,8 @@ void FormDraw::s_addSantuyibiao(QString strUuid, QString strSlfName, QString str
int _nSamples = 0;
curv->DrawTvd();
// //
// connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
// //
// connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
//
m_listLineName.push_back(strLineName);
@ -2105,11 +2105,11 @@ void FormDraw::s_addCrack(QString strUuid, QString strSlfName, QString strWellNa
curv->xAxis->ticker()->setTickCount(10);//x个主刻度
curv->yAxis->ticker()->setTickCount(60);//y个主刻度
// //对调XY轴在最前面设置
// QCPAxis *yAxis = curv->yAxis;
// QCPAxis *xAxis = curv->xAxis;
// curv->xAxis = yAxis;
// curv->yAxis = xAxis;
// //对调XY轴在最前面设置
// QCPAxis *yAxis = curv->yAxis;
// QCPAxis *xAxis = curv->xAxis;
// curv->xAxis = yAxis;
// curv->yAxis = xAxis;
//裂缝
QString strWaveName = "FRAC_HOLE.TABLE";
@ -2507,7 +2507,7 @@ void FormDraw::s_addTubingstring(QString strUuid, QString strSlfName, QString st
void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLineName,
double newLeftScale, double newRightScale, QString strScaleType, QColor lineColor, double width, Qt::PenStyle lineStyle, QStringList listOtherProperty)
{
//AppendConsole(PAI_INFO, "FormDraw initForm");
//AppendConsole(PAI_INFO, "FormDraw initForm");
CLogIO *logio=new CLogIO();
logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead);
@ -2620,27 +2620,27 @@ void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLi
//赋值
m_vmax = vmax;
m_vmin = vmin;
//AppendConsole(PAI_INFO, "FormDraw initForm ReadCurve end");
//AppendConsole(PAI_INFO, "FormDraw initForm ReadCurve end");
widget->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables);
//框选-----
// widget->setInteraction(QCP::iRangeDrag, false); // 关闭拖动
// widget->setSelectionRectMode(QCP::SelectionRectMode::srmSelect); // 启用框选放大
// //
// widget->selectionRect()->setPen(QPen(Qt::black, 1, Qt::DashLine)); // 虚线边框
// widget->selectionRect()->setBrush(QBrush(QColor(0,0,100,50))); // 半透明蓝色填充
// //
// QCPSelectionRect *selectionRect = new QCPSelectionRect(widget);
// connect(selectionRect, &QCPSelectionRect::accepted, [=]() {
// // 当选择完成时,获取矩形范围并放大
// QRectF rect = selectionRect->rect(); // 获取选择的矩形区域(像素坐标)
// // 转换为坐标轴范围
// double x1 = widget->xAxis->pixelToCoord(rect.left());
// double x2 = widget->xAxis->pixelToCoord(rect.right());
// double y1 = widget->yAxis->pixelToCoord(rect.top());
// double y2 = widget->yAxis->pixelToCoord(rect.bottom());
// });
// widget->setInteraction(QCP::iRangeDrag, false); // 关闭拖动
// widget->setSelectionRectMode(QCP::SelectionRectMode::srmSelect); // 启用框选放大
// //
// widget->selectionRect()->setPen(QPen(Qt::black, 1, Qt::DashLine)); // 虚线边框
// widget->selectionRect()->setBrush(QBrush(QColor(0,0,100,50))); // 半透明蓝色填充
// //
// QCPSelectionRect *selectionRect = new QCPSelectionRect(widget);
// connect(selectionRect, &QCPSelectionRect::accepted, [=]() {
// // 当选择完成时,获取矩形范围并放大
// QRectF rect = selectionRect->rect(); // 获取选择的矩形区域(像素坐标)
// // 转换为坐标轴范围
// double x1 = widget->xAxis->pixelToCoord(rect.left());
// double x2 = widget->xAxis->pixelToCoord(rect.right());
// double y1 = widget->yAxis->pixelToCoord(rect.top());
// double y2 = widget->yAxis->pixelToCoord(rect.bottom());
// });
widget->m_iX1 = vmin;
widget->m_iX2 = vmax;
@ -2690,11 +2690,11 @@ void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLi
//支持框选
//setupSelectionDemo(widget);
//AppendConsole(PAI_INFO, "FormDraw setupSelectionDemo end");
//AppendConsole(PAI_INFO, "FormDraw setupSelectionDemo end");
//widget->rescaleAxes();
//widget->replot();//屏蔽,缩减时间
//AppendConsole(PAI_INFO, "FormDraw initForm end");
//AppendConsole(PAI_INFO, "FormDraw initForm end");
}
void FormDraw::initWave_3D(QMyCustomPlot *widget, QString strSlfName, QString strWaveName, int &_nSamples)
@ -2713,8 +2713,8 @@ void FormDraw::initWave_3D(QMyCustomPlot *widget, QString strSlfName, QString st
float _SDep,_EDep,_Rlev;
_SDep = _wave.StartDepth;
_EDep = _wave.EndDepth;
// _SDep = 0.0 - m_iY2;
// _EDep = 0.0 - m_iY1;
// _SDep = 0.0 - m_iY2;
// _EDep = 0.0 - m_iY1;
_Rlev = _wave.DepLevel;
int m_Record=(float)(fabs((_EDep-_SDep)/_Rlev+0.5));
@ -2758,11 +2758,11 @@ void FormDraw::initWave_3D(QMyCustomPlot *widget, QString strSlfName, QString st
}
delete[] value;
// vmax = (float)_nSamples;
// vmin = 0;
// vmax = (float)_nSamples;
// vmin = 0;
// m_iY1 = 0.0 -_EDep;
// m_iY2 = 0.0 -_SDep;
// m_iY1 = 0.0 -_EDep;
// m_iY2 = 0.0 -_SDep;
//------------------------
widget->m_iX1 = vmin;
widget->m_iX2 = vmax;
@ -2812,8 +2812,8 @@ void FormDraw::initWave_3D(QMyCustomPlot *widget, QString strSlfName, QString st
//y = cos(angle) * r*m_flVFactor;
//方法2 :按横向等间距分配,图像边缘部分不太好
// flCos[j] = cos(angle);
// flSin[j] = sin(angle);
// flCos[j] = cos(angle);
// flSin[j] = sin(angle);
y = cos(angle)*r*m_flVFactor;
pt[j].setX(centerX + x);
@ -2901,46 +2901,46 @@ void FormDraw::initWave_3D(QMyCustomPlot *widget, QString strSlfName, QString st
//qDebug() << "kkPos=" << QString::number(kkPos) << ",iPos=" << QString::number(iPos) << "j=" << QString::number(j) << ",i=" << QString::number(i) << ",wavedata[j][i]=" << QString::number(wavedata[j][i]);
}
// //----
// kkPos = pt[j].x()+0.5;
// iPos = i+pt[j].y();
// if(kkPos>=_nSamples || kkPos<0 || iPos>=m_Record || iPos<0)
// {
// }
// else
// {
// wavedataNew[kkPos][iPos] = wavedata[j][i];
// }
// //----
// kkPos = pt[j].x()-0.5;
// iPos = i+pt[j].y();
// if(kkPos>=_nSamples || kkPos<0 || iPos>=m_Record || iPos<0)
// {
// }
// else
// {
// wavedataNew[kkPos][iPos] = wavedata[j][i];
// }
// //----
// kkPos = pt[j].x();
// iPos = i+pt[j].y()+0.5;
// if(kkPos>=_nSamples || kkPos<0 || iPos>=m_Record || iPos<0)
// {
// }
// else
// {
// wavedataNew[kkPos][iPos] = wavedata[j][i];
// }
// //----
// kkPos = pt[j].x();
// iPos = i+pt[j].y()-0.5;
// if(kkPos>=_nSamples || kkPos<0 || iPos>=m_Record || iPos<0)
// {
// }
// else
// {
// wavedataNew[kkPos][iPos] = wavedata[j][i];
// }
// //----
// kkPos = pt[j].x()+0.5;
// iPos = i+pt[j].y();
// if(kkPos>=_nSamples || kkPos<0 || iPos>=m_Record || iPos<0)
// {
// }
// else
// {
// wavedataNew[kkPos][iPos] = wavedata[j][i];
// }
// //----
// kkPos = pt[j].x()-0.5;
// iPos = i+pt[j].y();
// if(kkPos>=_nSamples || kkPos<0 || iPos>=m_Record || iPos<0)
// {
// }
// else
// {
// wavedataNew[kkPos][iPos] = wavedata[j][i];
// }
// //----
// kkPos = pt[j].x();
// iPos = i+pt[j].y()+0.5;
// if(kkPos>=_nSamples || kkPos<0 || iPos>=m_Record || iPos<0)
// {
// }
// else
// {
// wavedataNew[kkPos][iPos] = wavedata[j][i];
// }
// //----
// kkPos = pt[j].x();
// iPos = i+pt[j].y()-0.5;
// if(kkPos>=_nSamples || kkPos<0 || iPos>=m_Record || iPos<0)
// {
// }
// else
// {
// wavedataNew[kkPos][iPos] = wavedata[j][i];
// }
}
}
@ -3046,8 +3046,8 @@ void FormDraw::DrawImageNew_NoFilter(QMyCustomPlot *widget, QString strSlfName,
float _SDep,_EDep,_Rlev;
_SDep = _wave.StartDepth;
_EDep = _wave.EndDepth;
// _SDep = 0.0 - m_iY2;
// _EDep = 0.0 - m_iY1;
// _SDep = 0.0 - m_iY2;
// _EDep = 0.0 - m_iY1;
_Rlev = _wave.DepLevel;
int m_Record=(float)(fabs((_EDep-_SDep)/_Rlev+0.5));
@ -3091,8 +3091,8 @@ void FormDraw::DrawImageNew_NoFilter(QMyCustomPlot *widget, QString strSlfName,
}
delete[] value;
// m_iY1 = 0.0 -_EDep;
// m_iY2 = 0.0 -_SDep;
// m_iY1 = 0.0 -_EDep;
// m_iY2 = 0.0 -_SDep;
//------------------------
widget->m_iX1 = vmin;
widget->m_iX2 = vmax;
@ -3143,18 +3143,18 @@ void FormDraw::DrawImageNew_NoFilter(QMyCustomPlot *widget, QString strSlfName,
//colorMap->setGradient(QCPColorGradient::gpPolar);//gpJet);
// 我们还可以创建一个QCPColorGradient实例并向其中添加自己的颜色
// 渐变请参阅QCPColorGradient的文档以获取可能的效果.
// int nIndex=11;
// QVector<MyColorItem> colorList;
// bool inpolation = true;
// int iColorNum = getSystemColor(nIndex, colorList, inpolation);
// //
// QCPColorGradient gradient;
// for(int i=0; i<iColorNum; i++)
// {
// double dbTmpIndex=(double)(i+1)/iColorNum;
// gradient.setColorStopAt(dbTmpIndex, colorList[i].color); // x% 位置的颜色
// }
// colorMap->setGradient(gradient);
// int nIndex=11;
// QVector<MyColorItem> colorList;
// bool inpolation = true;
// int iColorNum = getSystemColor(nIndex, colorList, inpolation);
// //
// QCPColorGradient gradient;
// for(int i=0; i<iColorNum; i++)
// {
// double dbTmpIndex=(double)(i+1)/iColorNum;
// gradient.setColorStopAt(dbTmpIndex, colorList[i].color); // x% 位置的颜色
// }
// colorMap->setGradient(gradient);
QVector <QString> m_qvFiles;
int n=getColorConfig(m_qvFiles);
@ -3183,13 +3183,13 @@ void FormDraw::DrawImageNew_NoFilter(QMyCustomPlot *widget, QString strSlfName,
colorMap->rescaleDataRange();
//----调色板--------
// widget->plotLayout()->addElement(0, 1, colorScale); // 将其添加到主轴矩形的右侧
// colorScale->setType(QCPAxis::atRight); // 刻度应为垂直条,刻度线/坐标轴标签右侧(实际上,右侧已经是默认值)
// colorScale->axis()->setLabel("Magnetic Field Strength");
// //确保轴rect和色标同步其底边距和顶边距以便它们对齐:
// QCPMarginGroup *marginGroup = new QCPMarginGroup(widget);
// widget->axisRect()->setMarginGroup(QCP::msBottom|QCP::msTop, marginGroup);
// colorScale->setMarginGroup(QCP::msBottom|QCP::msTop, marginGroup);
// widget->plotLayout()->addElement(0, 1, colorScale); // 将其添加到主轴矩形的右侧
// colorScale->setType(QCPAxis::atRight); // 刻度应为垂直条,刻度线/坐标轴标签右侧(实际上,右侧已经是默认值)
// colorScale->axis()->setLabel("Magnetic Field Strength");
// //确保轴rect和色标同步其底边距和顶边距以便它们对齐:
// QCPMarginGroup *marginGroup = new QCPMarginGroup(widget);
// widget->axisRect()->setMarginGroup(QCP::msBottom|QCP::msTop, marginGroup);
// colorScale->setMarginGroup(QCP::msBottom|QCP::msTop, marginGroup);
// 重新缩放键x和值y以便可以看到整个颜色图
//widget->rescaleAxes();
@ -3247,9 +3247,9 @@ void FormDraw::initTableLine(QMyCustomPlot *widget, QString strSlfName, QString
ReadData(strSlfName, strLineName);
//------------------------
// int nPointNum = m_FracTabList.count();
// if ( nPointNum < 1 )return ;
// FRAC_TABLE frac = m_FracTabList.at(0);
// int nPointNum = m_FracTabList.count();
// if ( nPointNum < 1 )return ;
// FRAC_TABLE frac = m_FracTabList.at(0);
}
else
{
@ -3264,30 +3264,30 @@ void FormDraw::initTableLine(QMyCustomPlot *widget, QString strSlfName, QString
// bool bFistValue=false;
// float vmax = -9999;
// float vmin = -9999;
// //最大值,最小值
// vmax=vmin=frac.DIR;
// //slf文件读取曲线
// for(int i=0; i<nPointNum; i++)
// {
// frac = m_FracTabList.at(i);
// if(frac.DIR==-9999)
// {
// continue;
// }
// if(bFistValue==false)
// {
// //最大值,最小值默认采用第一个有效值
// bFistValue=true;
// vmax = vmin = frac.DIR;
// }
// if(vmax<frac.DIR)vmax=frac.DIR;
// if(vmin>frac.DIR)vmin=frac.DIR;
// }
// widget->m_iX1 = vmin;
// widget->m_iX2 = vmax;
// bool bFistValue=false;
// float vmax = -9999;
// float vmin = -9999;
// //最大值,最小值
// vmax=vmin=frac.DIR;
// //slf文件读取曲线
// for(int i=0; i<nPointNum; i++)
// {
// frac = m_FracTabList.at(i);
// if(frac.DIR==-9999)
// {
// continue;
// }
// if(bFistValue==false)
// {
// //最大值,最小值默认采用第一个有效值
// bFistValue=true;
// vmax = vmin = frac.DIR;
// }
// if(vmax<frac.DIR)vmax=frac.DIR;
// if(vmin>frac.DIR)vmin=frac.DIR;
// }
// widget->m_iX1 = vmin;
// widget->m_iX2 = vmax;
int iMyWidth = widget->axisRect(0)->width();
float vmax = iMyWidth;
@ -5159,7 +5159,7 @@ void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QStrin
if(strSlfName==""||!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead))
{
delete logio;
// QMessageBox::information(NULL,"提示","SLF文件打开失败请检查",QMessageBox::Yes);
// QMessageBox::information(NULL,"提示","SLF文件打开失败请检查",QMessageBox::Yes);
return;
}
int iIndex=logio->OpenTable(strLineName.toStdString().c_str());
@ -5192,7 +5192,7 @@ void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QStrin
sscanf(buf,"%f",&m_pResult->Depth);
logio->GetTableFieldData(iIndex,2,buf,i+1);
sscanf(buf,"%f",&m_pResult->CorrDepth);
// logio->ReadTable(iIndex,i+1,m_pResult);
// logio->ReadTable(iIndex,i+1,m_pResult);
int Order = m_pResult->Order;
float depth = m_pResult->Depth;
@ -5251,11 +5251,11 @@ void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QStrin
widget->xAxis = yAxis;
widget->yAxis = xAxis;
// //隐藏刻度
// widget->xAxis->setTicks(false);
// widget->yAxis->setTicks(false);
// widget->xAxis2->setTicks(false);
// widget->yAxis2->setTicks(false);
// //隐藏刻度
// widget->xAxis->setTicks(false);
// widget->yAxis->setTicks(false);
// widget->xAxis2->setTicks(false);
// widget->yAxis2->setTicks(false);
//
QString strAliasName = "";
QString strUnit = "";
@ -5267,7 +5267,7 @@ void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QStrin
widget->graph(0)->setSelectable(QCP::SelectionType::stMultipleDataRanges);// stSingleData
widget->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式
// widget->setSelectionRectMode(QCP::srmCustom); // 鼠标框选
// widget->setSelectionRectMode(QCP::srmCustom); // 鼠标框选
}
void FormDraw::CalcDipWidth(int nColumn,float *flWidth,float factor,int x1,int x2,float flHoriRatio)
@ -5395,13 +5395,13 @@ void FormDraw::DrawDip(QMyCustomPlot *widget)
y = -dep;//起始深度
// pDC->setPen(pPen);// [5/22/2019 9:43 hxb]
// rtRect.setLeft(x - GetLineWidth(pDC,m_nRadius));
// rtRect.setRight(x + GetLineWidth(pDC,m_nRadius));
// rtRect.setBottom(y +GetLineWidth(pDC,m_nRadius));
// rtRect.setTop(y -GetLineWidth(pDC,m_nRadius));
// pDC->setPen(PenCircle);
// pDC->drawEllipse(rtRect.center(),m_nRadius,m_nRadius);
// pDC->setPen(pPen);// [5/22/2019 9:43 hxb]
// rtRect.setLeft(x - GetLineWidth(pDC,m_nRadius));
// rtRect.setRight(x + GetLineWidth(pDC,m_nRadius));
// rtRect.setBottom(y +GetLineWidth(pDC,m_nRadius));
// rtRect.setTop(y -GetLineWidth(pDC,m_nRadius));
// pDC->setPen(PenCircle);
// pDC->drawEllipse(rtRect.center(),m_nRadius,m_nRadius);
QCPItemEllipse *qcpItemEllipse = new QCPItemEllipse(widget);
qcpItemEllipse->setPen(pPen);
@ -5415,13 +5415,13 @@ void FormDraw::DrawDip(QMyCustomPlot *widget)
//方位
flVal = GetData(m_Curve.RepCode,(char *)&m_Value[i*m_Curve.CodeLen]);//DDIR
dr=flVal*dgtord;
// // 注意映射方式
// x +=GetLineWidth(pDC,m_nRadius)*sin(dr);
// y -=GetLineWidth(pDC,m_nRadius)*cos(dr);
// float x1=x +GetLineWidth(pDC,m_nTailLen)*sin(dr);
// float y1=y -GetLineWidth(pDC,m_nTailLen)*cos(dr);
// pDC->setPen(pPen);
// pDC->drawLine(QPointF(x,y),QPointF(x1,y1));
// // 注意映射方式
// x +=GetLineWidth(pDC,m_nRadius)*sin(dr);
// y -=GetLineWidth(pDC,m_nRadius)*cos(dr);
// float x1=x +GetLineWidth(pDC,m_nTailLen)*sin(dr);
// float y1=y -GetLineWidth(pDC,m_nTailLen)*cos(dr);
// pDC->setPen(pPen);
// pDC->drawLine(QPointF(x,y),QPointF(x1,y1));
QCPItemLine *qcpItemLine = new QCPItemLine(widget);
qcpItemLine->start->setCoords(y, x);//圆心位置
qcpItemLine->end->setCoords(y, x);//圆心位置
@ -5433,8 +5433,8 @@ void FormDraw::DrawDip(QMyCustomPlot *widget)
//移动对象
// widget->mSizeHandleManager->addItem(qcpItemEllipse, true);
// widget->mSizeHandleManager->addItem(qcpItemLine, true);
// widget->mSizeHandleManager->addItem(qcpItemEllipse, true);
// widget->mSizeHandleManager->addItem(qcpItemLine, true);
k++;
}
@ -5757,13 +5757,13 @@ void FormDraw::DrawStck(QMyCustomPlot *widget)
// pDC->setPen(PenCircle);
// pDC->drawEllipse(rtRect.center(),m_nRadius,m_nRadius);
// QCPItemEllipse *qcpItemEllipse = new QCPItemEllipse(widget);
// qcpItemEllipse->setPen(pPen);
// qcpItemEllipse->m_bCustom = true;
// qcpItemEllipse->m_nRadius = m_nRadius;
// qcpItemEllipse->topLeft->setCoords(y, x);//圆心位置
// qcpItemEllipse->bottomRight->setCoords(y, x);//圆心位置
// qcpItemEllipse->setBrush(cBrushFill);//填充圆的颜色
// QCPItemEllipse *qcpItemEllipse = new QCPItemEllipse(widget);
// qcpItemEllipse->setPen(pPen);
// qcpItemEllipse->m_bCustom = true;
// qcpItemEllipse->m_nRadius = m_nRadius;
// qcpItemEllipse->topLeft->setCoords(y, x);//圆心位置
// qcpItemEllipse->bottomRight->setCoords(y, x);//圆心位置
// qcpItemEllipse->setBrush(cBrushFill);//填充圆的颜色
//方位
@ -5882,23 +5882,23 @@ void FormDraw::DrawTabDip(QMyCustomPlot *widget)
for (i=0; i<nPointNum; i++)
{
frac = m_FracTabList.at(i);
// if ( frac.DEP < -m_iY2 || frac.DEP > -m_iY1)
// {
// continue;
// }
// if ( frac.DEP < -m_iY2 || frac.DEP > -m_iY1)
// {
// continue;
// }
// bDraw = false;
// for (j=0; j<n; j++)
// {
// fd = m_FracDefList.at(j);
// // 裂缝描述表中未保存裂缝名称:
// //比较裂缝名称比较准确,代码更改,如果比较代码会引起不一致性
// if ( (int)(frac.ID) == fd.iCode )
// {
// bDraw = m_bTypeDraw[j];//fd.bDraw;
// break;
// }
// }
// bDraw = false;
// for (j=0; j<n; j++)
// {
// fd = m_FracDefList.at(j);
// // 裂缝描述表中未保存裂缝名称:
// //比较裂缝名称比较准确,代码更改,如果比较代码会引起不一致性
// if ( (int)(frac.ID) == fd.iCode )
// {
// bDraw = m_bTypeDraw[j];//fd.bDraw;
// break;
// }
// }
//if ( bDraw )
{
QBrush cBrush(fd.crColor);
@ -5927,16 +5927,16 @@ void FormDraw::DrawTabDip(QMyCustomPlot *widget)
//x = frac.DIPorS;
y = -frac.DEP;
// int LineWidth = m_nRadius;
// rtRect.setLeft(x - LineWidth);
// rtRect.setRight( x + LineWidth);
// rtRect.setBottom( y + LineWidth);
// rtRect.setTop(y - LineWidth);
// pDC->setPen(pPen);
// pDC->drawEllipse(rtRect.left(),rtRect.top(),rtRect.width(),rtRect.height());
// QPainterPath myPath;
// myPath.addEllipse(rtRect);
// pDC->fillPath(myPath,cBrush);
// int LineWidth = m_nRadius;
// rtRect.setLeft(x - LineWidth);
// rtRect.setRight( x + LineWidth);
// rtRect.setBottom( y + LineWidth);
// rtRect.setTop(y - LineWidth);
// pDC->setPen(pPen);
// pDC->drawEllipse(rtRect.left(),rtRect.top(),rtRect.width(),rtRect.height());
// QPainterPath myPath;
// myPath.addEllipse(rtRect);
// pDC->fillPath(myPath,cBrush);
//CustomEllipse *qcpitemellipse = new CustomEllipse(widget);
@ -5966,41 +5966,41 @@ void FormDraw::DrawTabDip(QMyCustomPlot *widget)
//break;
// x += m_nRadius*sin(dr);
// // 注意映射方式
// y -=m_nRadius*cos(dr);
// //pDC->moveto(x,y);
// float x1=x +m_nTailLen*sin(dr);
// // 注意映射方式
// float y1= y-m_nTailLen*cos(dr);
// x += m_nRadius*sin(dr);
// // 注意映射方式
// y -=m_nRadius*cos(dr);
// //pDC->moveto(x,y);
// float x1=x +m_nTailLen*sin(dr);
// // 注意映射方式
// float y1= y-m_nTailLen*cos(dr);
// pDC->setPen(pPenTail);
// pDC->drawLine(x,y,x1,y1);
// pDC->setPen(pPenTail);
// pDC->drawLine(x,y,x1,y1);
// if ( m_bDrawValue ) //显示倾角、方位
// {
// rtRect.setTop(rtRect.top()-GetLineWidth(pDC,objViewInfo->GetLogUnitFont().pointSize()));
// rtRect.setBottom(rtRect.bottom()+GetLineWidth(pDC,objViewInfo->GetLogUnitFont().pointSize()));
// QString cs1 = QString::number(frac.DIPorS,'f',m_iPrecision);
// QString cs2 = QString::number(frac.DIR,'f',m_iPrecision);
// cs=cs1+"//"+cs2;
// cs.Replace((" "),"");
// if ( frac.DIPorS >= 30 )
// {
// x = 2.*(float)(GetLineWidth(pDC,m_nRadius));
// rtRect.setRight(rtRect.center().x() - x);
// rtRect.setLeft(mrt.left());
// pDC->drawText(rtRect,Qt::AlignVCenter|Qt::AlignHCenter,cs.GetString());
// }
// else
// {
// x = 2.*(float)(GetLineWidth(pDC,m_nRadius));
// rtRect.setLeft(rtRect.center().x() + x);
// rtRect.setRight(mrt.right());
// pDC->drawText(rtRect,Qt::AlignVCenter,cs.GetString());
// }
// }
// if ( m_bDrawValue ) //显示倾角、方位
// {
// rtRect.setTop(rtRect.top()-GetLineWidth(pDC,objViewInfo->GetLogUnitFont().pointSize()));
// rtRect.setBottom(rtRect.bottom()+GetLineWidth(pDC,objViewInfo->GetLogUnitFont().pointSize()));
// QString cs1 = QString::number(frac.DIPorS,'f',m_iPrecision);
// QString cs2 = QString::number(frac.DIR,'f',m_iPrecision);
// cs=cs1+"//"+cs2;
// cs.Replace((" "),"");
// if ( frac.DIPorS >= 30 )
// {
// x = 2.*(float)(GetLineWidth(pDC,m_nRadius));
// rtRect.setRight(rtRect.center().x() - x);
// rtRect.setLeft(mrt.left());
// pDC->drawText(rtRect,Qt::AlignVCenter|Qt::AlignHCenter,cs.GetString());
// }
// else
// {
// x = 2.*(float)(GetLineWidth(pDC,m_nRadius));
// rtRect.setLeft(rtRect.center().x() + x);
// rtRect.setRight(mrt.right());
// pDC->drawText(rtRect,Qt::AlignVCenter,cs.GetString());
// }
// }
}
}
}
@ -6236,50 +6236,50 @@ void FormDraw::addRandomGraph(QMyCustomPlot *widget, QVector<double> x, QVector<
else {
m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_vmax, m_vmin, strScaleType, "curveObject", listOtherProperty);
}
//AppendConsole(PAI_INFO, "FormDraw addRandomGraph");
// widget->addGraph();
// if(strLineName=="")
// {
// strLineName = QString("曲线 %1").arg(widget->graphCount());
// }
// widget->graph()->setName(strLineName);
// //禁用自动重绘:在大量数据更新前禁用自动重绘
// //widget->setNotAntialiasedElements(QCP::aeAll);
// widget->graph()->setData(x, y);
//AppendConsole(PAI_INFO, "FormDraw addRandomGraph");
// widget->addGraph();
// if(strLineName=="")
// {
// strLineName = QString("曲线 %1").arg(widget->graphCount());
// }
// widget->graph()->setName(strLineName);
// //禁用自动重绘:在大量数据更新前禁用自动重绘
// //widget->setNotAntialiasedElements(QCP::aeAll);
// widget->graph()->setData(x, y);
// if(newLeftScale!=-9999)
// {
// widget->graph()->setLineStyle((QCPGraph::LineStyle)(lineStyle));//曲线
// if(newLeftScale!=-9999)
// {
// widget->graph()->setLineStyle((QCPGraph::LineStyle)(lineStyle));//曲线
// widget->graph()->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(1)));
// widget->graph()->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(1)));
// QPen graphPen;
// graphPen.setColor(newlineColor);
// graphPen.setWidthF(width);
// graphPen.setStyle(lineStyle);//实线
// widget->graph()->setPen(graphPen);
// }
// else
// {
// widget->graph()->setLineStyle((QCPGraph::LineStyle)(1));//曲线
// QPen graphPen;
// graphPen.setColor(newlineColor);
// graphPen.setWidthF(width);
// graphPen.setStyle(lineStyle);//实线
// widget->graph()->setPen(graphPen);
// }
// else
// {
// widget->graph()->setLineStyle((QCPGraph::LineStyle)(1));//曲线
// widget->graph()->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(1)));
// // widget->graph()->setScatterStyle(QCPScatterStyle(QPixmap(":/image/file.png")));
// //widget->graph()->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDisc, 5));
// widget->graph()->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(1)));
// // widget->graph()->setScatterStyle(QCPScatterStyle(QPixmap(":/image/file.png")));
// //widget->graph()->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDisc, 5));
// QPen graphPen;
// newlineColor = QColor(std::rand()%245+10, std::rand()%245+10, std::rand()%245+10);
// graphPen.setColor(newlineColor);
// width = 2;
// graphPen.setWidthF(width);
// graphPen.setStyle(Qt::SolidLine);//实线
// widget->graph()->setPen(graphPen);
// //widget->replot();
// }
// //道-对象
// m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_vmax, m_vmin, strScaleType);
//AppendConsole(PAI_INFO, "FormDraw addRandomGraph end");
// QPen graphPen;
// newlineColor = QColor(std::rand()%245+10, std::rand()%245+10, std::rand()%245+10);
// graphPen.setColor(newlineColor);
// width = 2;
// graphPen.setWidthF(width);
// graphPen.setStyle(Qt::SolidLine);//实线
// widget->graph()->setPen(graphPen);
// //widget->replot();
// }
// //道-对象
// m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_vmax, m_vmin, strScaleType);
//AppendConsole(PAI_INFO, "FormDraw addRandomGraph end");
}