优化裂痕绘图方法,提升速度
This commit is contained in:
parent
b27ab19ef8
commit
414d131a3c
|
|
@ -22,7 +22,15 @@ CPickFrac::CPickFrac(QMyCustomPlot *myCustomPlot, QString strSlfName, QString cs
|
|||
m_bTypeDraw[i] = true;
|
||||
}
|
||||
|
||||
//支持框选------------------
|
||||
//myCustomPlot->m_bDrawCore_PHYSICS = true;
|
||||
|
||||
ReadData(strSlfName, csCurve);
|
||||
|
||||
// myCustomPlot->setSelectionRectMode(QCP::SelectionRectMode::srmSelect);
|
||||
// myCustomPlot->graph(0)->setSelectable(QCP::SelectionType::stMultipleDataRanges);// stSingleData
|
||||
// myCustomPlot->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式
|
||||
|
||||
}
|
||||
|
||||
CPickFrac::~CPickFrac(void)
|
||||
|
|
@ -147,7 +155,7 @@ void CPickFrac::drawOne(FRAC_TABLE_Crack frac, QString cs, int iType, int nLineW
|
|||
int j,nPoint=360;
|
||||
float x,y,h,oy;
|
||||
float PI,xScale,xx;
|
||||
PI=2.*3.14159265/nPoint;
|
||||
PI=2.*3.14159265/(float)nPoint;
|
||||
h = frac.AorX/2.0;
|
||||
oy = -(frac.DEP+h);
|
||||
|
||||
|
|
@ -169,12 +177,32 @@ void CPickFrac::drawOne(FRAC_TABLE_Crack frac, QString cs, int iType, int nLineW
|
|||
xVec.append(x);
|
||||
yVec.append(y);
|
||||
}
|
||||
for(j=0; j<nPoint-1; j++)
|
||||
{
|
||||
QCPItemLine *qcpItemLine = new QCPItemLine(m_myCustomPlot);
|
||||
qcpItemLine->start->setCoords(yVec[j], xVec[j]);
|
||||
qcpItemLine->end->setCoords(yVec[j+1], xVec[j+1]);
|
||||
qcpItemLine->setPen(pPen);
|
||||
// for(j=0; j<nPoint-1; j++)
|
||||
// {
|
||||
// QCPItemLine *qcpItemLine = new QCPItemLine(m_myCustomPlot);
|
||||
// qcpItemLine->start->setCoords(yVec[j], xVec[j]);
|
||||
// qcpItemLine->end->setCoords(yVec[j+1], xVec[j+1]);
|
||||
// qcpItemLine->setPen(pPen);
|
||||
// }
|
||||
|
||||
{
|
||||
//
|
||||
m_myCustomPlot->addGraph();
|
||||
QString strLineName = "";
|
||||
if(strLineName=="")
|
||||
{
|
||||
strLineName = QString("曲线 %1").arg(m_myCustomPlot->graphCount());
|
||||
}
|
||||
m_myCustomPlot->graph()->setName(strLineName);
|
||||
m_myCustomPlot->graph()->setData(xVec, yVec);
|
||||
m_myCustomPlot->graph()->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsLine));//lsNone 曲线 lsLine
|
||||
m_myCustomPlot->graph()->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssDot)));//ssNone点ssDot
|
||||
//
|
||||
QPen graphPen;
|
||||
graphPen.setColor(crColor);
|
||||
graphPen.setWidthF(nLineWidth);
|
||||
graphPen.setStyle(Qt::SolidLine);//实线
|
||||
m_myCustomPlot->graph()->setPen(graphPen);
|
||||
}
|
||||
break;
|
||||
case 2: //连线
|
||||
|
|
@ -182,8 +210,8 @@ void CPickFrac::drawOne(FRAC_TABLE_Crack frac, QString cs, int iType, int nLineW
|
|||
for(j=0; j<nPoint-1; j++)
|
||||
{
|
||||
QCPItemLine *qcpItemLine = new QCPItemLine(m_myCustomPlot);
|
||||
qcpItemLine->start->setCoords(-frac.point[j].y, frac.point[j].x);
|
||||
qcpItemLine->end->setCoords(-frac.point[j+1].y, frac.point[j+1].x);
|
||||
qcpItemLine->start->setCoords(frac.point[j].x, -frac.point[j].y);
|
||||
qcpItemLine->end->setCoords(frac.point[j+1].x, -frac.point[j+1].y);
|
||||
qcpItemLine->setPen(pPen);
|
||||
j++;//j+2
|
||||
}
|
||||
|
|
@ -193,14 +221,14 @@ void CPickFrac::drawOne(FRAC_TABLE_Crack frac, QString cs, int iType, int nLineW
|
|||
for(j=0; j<nPoint; j++)
|
||||
{
|
||||
QCPItemLine *qcpItemLine = new QCPItemLine(m_myCustomPlot);
|
||||
qcpItemLine->start->setCoords(-frac.point[j].y, frac.point[j].x);
|
||||
qcpItemLine->start->setCoords(frac.point[j].x, -frac.point[j].y);
|
||||
if(j>=(nPoint-1))
|
||||
{
|
||||
qcpItemLine->end->setCoords(-frac.point[0].y, frac.point[0].x);
|
||||
qcpItemLine->end->setCoords(frac.point[0].x, -frac.point[0].y);
|
||||
}
|
||||
else
|
||||
{
|
||||
qcpItemLine->end->setCoords(-frac.point[j+1].y, frac.point[j+1].x);
|
||||
qcpItemLine->end->setCoords(frac.point[j+1].x, -frac.point[j+1].y);
|
||||
}
|
||||
qcpItemLine->setPen(pPen);
|
||||
}
|
||||
|
|
@ -211,8 +239,8 @@ void CPickFrac::drawOne(FRAC_TABLE_Crack frac, QString cs, int iType, int nLineW
|
|||
if(nPoint>=2)
|
||||
{
|
||||
QCPItemStraightLine *qcpItemLine = new QCPItemStraightLine(m_myCustomPlot);
|
||||
qcpItemLine->point1->setCoords(-frac.point[0].y, frac.point[0].x);//位置
|
||||
qcpItemLine->point2->setCoords(-frac.point[1].y, frac.point[1].x);//位置
|
||||
qcpItemLine->point1->setCoords(frac.point[0].x, -frac.point[0].y);//位置
|
||||
qcpItemLine->point2->setCoords(frac.point[1].x, -frac.point[1].y);//位置
|
||||
qcpItemLine->setPen(pPen);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1297,16 +1297,16 @@ 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";
|
||||
int _nSamples = 360;
|
||||
|
||||
//注意,没有对调XY轴
|
||||
CPickFrac *pickFrac = new CPickFrac(curv, strSlfName, strWaveName, iMyWidth);
|
||||
|
||||
//
|
||||
|
|
@ -2231,6 +2231,7 @@ void FormDraw::initWave2(QMyCustomPlot *widget, QString strSlfName, QString strW
|
|||
// widget->xAxis = yAxis;
|
||||
// widget->yAxis = xAxis;
|
||||
|
||||
//注意,不对调XY轴
|
||||
float nPerHight = 50;//25
|
||||
float nSpace = 1;
|
||||
for (int i=0; i<m_Record; i++)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user