多臂井径绘图
This commit is contained in:
parent
0a4918b725
commit
46862278ed
|
|
@ -38,6 +38,10 @@ CDrawNrad::CDrawNrad(QMyCustomPlot *myCustomPlot, QString strSlfName, QString cs
|
|||
m_flWjMaxFactor = 0.6;
|
||||
m_flWjMinFactor = 0.5;
|
||||
m_flVFactor = 0.8; //椭圆纵向半径占横向半径比例
|
||||
m_nVertGrid = 20; //纵向网格间隔
|
||||
|
||||
ReadData(strSlfName, csCurve);
|
||||
DrawNrad(strSlfName, csCurve);
|
||||
}
|
||||
|
||||
CDrawNrad::~CDrawNrad(void)
|
||||
|
|
@ -272,41 +276,95 @@ void CDrawNrad::DrawNrad(QString strSlfName, QString csCurve)
|
|||
}
|
||||
|
||||
x = tempf;
|
||||
|
||||
// y坐标不计算,按采样间隔计算得来
|
||||
tempf = y + pt[j].y();
|
||||
tempf = m_myCustomPlot->xAxis->pixelToCoord( m_myCustomPlot->xAxis->coordToPixel(-y)+pt[j].y());//y + pt[j].y();
|
||||
|
||||
ptCal[npoint][j].setX(x);
|
||||
ptCal[npoint][j].setY(tempf);
|
||||
}
|
||||
npoint++;
|
||||
}
|
||||
|
||||
// 绘制横线
|
||||
QPointF *ptOld = new QPointF[nDrawArm2+1];
|
||||
pPen.setColor(m_crHorzLine);
|
||||
pPen.setWidth(m_nHorzLineWidth);
|
||||
|
||||
QPointF *ptOld = new QPointF[nDrawArm2+1];
|
||||
for (i=0;i<npoint; i+=m_nVertGrid)
|
||||
{
|
||||
QVector<double> xVec, yVec;
|
||||
for (j=0; j<nDrawArm2; j++)
|
||||
{
|
||||
ptOld[j] = ptCal[i][j];
|
||||
|
||||
//pDC->drawPolyline(ptOld,nDrawArm2);
|
||||
xVec.append(ptOld[j].x());
|
||||
yVec.append(ptOld[j].y());
|
||||
}
|
||||
|
||||
for (j=0; j<nDrawArm2-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(yVec, xVec);
|
||||
// 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(m_crHorzLine);
|
||||
// graphPen.setWidthF(m_nHorzLineWidth);
|
||||
// graphPen.setStyle(Qt::SolidLine);//实线
|
||||
// m_myCustomPlot->graph()->setPen(graphPen);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
delete [] ptOld;
|
||||
// 绘制竖线
|
||||
pPen.setColor(m_crVertLine);
|
||||
pPen.setWidth(m_nVertLineWidth);
|
||||
|
||||
// 绘制竖线
|
||||
ptOld = new QPointF[npoint+1];
|
||||
for (i=0;i<nDrawArm2; i++)
|
||||
{
|
||||
QVector<double> xVec, yVec;
|
||||
for (j=0; j<npoint; j++)
|
||||
{
|
||||
ptOld[j] = ptCal[j][i];
|
||||
//pDC->drawPolyline(ptOld,npoint);
|
||||
xVec.append(ptOld[j].x());
|
||||
yVec.append(ptOld[j].y());
|
||||
}
|
||||
{
|
||||
//
|
||||
m_myCustomPlot->addGraph();
|
||||
QString strLineName = "";
|
||||
if(strLineName=="")
|
||||
{
|
||||
strLineName = QString("曲线 %1").arg(m_myCustomPlot->graphCount());
|
||||
}
|
||||
m_myCustomPlot->graph()->setName(strLineName);
|
||||
m_myCustomPlot->graph()->setData(yVec, xVec);
|
||||
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(m_crVertLine);
|
||||
graphPen.setWidthF(m_nVertLineWidth);
|
||||
graphPen.setStyle(Qt::SolidLine);//实线
|
||||
m_myCustomPlot->graph()->setPen(graphPen);
|
||||
}
|
||||
}
|
||||
delete [] ptOld;
|
||||
|
||||
// 清理、释放内存
|
||||
delete [] value;
|
||||
delete [] Data ;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@
|
|||
#include <QObject>
|
||||
#include "qmycustomplot.h"
|
||||
|
||||
//多臂井径
|
||||
//注意,按比例缩放,需要重绘,因为y轴会被拉伸,导致半圆失真
|
||||
class CDrawNrad:public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include "ObjTubingstringResult.h"
|
||||
#include "ObjGeostratums.h"
|
||||
#include "ObjTextResult.h"
|
||||
#include "DrawNrad.h"
|
||||
|
||||
//以下参数从配置文件读取
|
||||
extern int g_iIndex;
|
||||
|
|
@ -1516,6 +1517,9 @@ void FormDraw::s_addJiegutext(QString strUuid, QString strSlfName, QString strWe
|
|||
CObjTextResult *objTextResult = new CObjTextResult();
|
||||
objTextResult->LoadFromSLF(curv, strSlfName, strWaveName);
|
||||
|
||||
// QString strWaveName = "FCA2";
|
||||
// CDrawNrad *drawNrad = new CDrawNrad(curv, strSlfName, strWaveName);
|
||||
|
||||
//
|
||||
connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user