追加波列数据3D绘制方法
This commit is contained in:
parent
c7eb736a6e
commit
13eb6cacd3
|
|
@ -29913,6 +29913,12 @@ void QCPItemRect::draw(QCPPainter *painter)
|
||||||
{
|
{
|
||||||
QPointF p1 = topLeft->pixelPosition();
|
QPointF p1 = topLeft->pixelPosition();
|
||||||
QPointF p2 = bottomRight->pixelPosition();
|
QPointF p2 = bottomRight->pixelPosition();
|
||||||
|
if(m_bCustom)
|
||||||
|
{
|
||||||
|
QPointF p1_tmp = QPointF(p1.rx(), p1.ry()+m_y1);
|
||||||
|
p2 = QPointF(p2.rx(), p2.ry()+m_y2);
|
||||||
|
p1 = p1_tmp;
|
||||||
|
}
|
||||||
if (p1.toPoint() == p2.toPoint()) {
|
if (p1.toPoint() == p2.toPoint()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7361,6 +7361,11 @@ public:
|
||||||
QCPItemAnchor *const bottomLeft;
|
QCPItemAnchor *const bottomLeft;
|
||||||
QCPItemAnchor *const left;
|
QCPItemAnchor *const left;
|
||||||
|
|
||||||
|
//jyl
|
||||||
|
bool m_bCustom = false;
|
||||||
|
float m_y1; // 3D变化
|
||||||
|
float m_y2; // 3D变化
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
|
enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,9 @@ extern int g_iCanZoom ;
|
||||||
extern double g_dPixelPerCm;//每厘米像素数
|
extern double g_dPixelPerCm;//每厘米像素数
|
||||||
extern int g_iScale;
|
extern int g_iScale;
|
||||||
|
|
||||||
|
extern int g_iSupport3D;
|
||||||
|
|
||||||
|
|
||||||
extern void AppendConsole(Priority priority, const QString &output);
|
extern void AppendConsole(Priority priority, const QString &output);
|
||||||
|
|
||||||
//曲线绘制(多个)
|
//曲线绘制(多个)
|
||||||
|
|
@ -262,8 +265,15 @@ void FormDraw::s_addWave(QString strUuid, QString strSlfName, QString strWellNam
|
||||||
// curv->setSizePolicy(policy);
|
// curv->setSizePolicy(policy);
|
||||||
|
|
||||||
curv->show();
|
curv->show();
|
||||||
initWave(curv, strSlfName, strWaveName);
|
if(g_iSupport3D)
|
||||||
//initWave_3D(curv, strSlfName, strWaveName);
|
{
|
||||||
|
initWave_3D(curv, strSlfName, strWaveName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
initWave(curv, strSlfName, strWaveName);
|
||||||
|
}
|
||||||
|
|
||||||
connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
|
connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -1259,10 +1269,11 @@ void FormDraw::initWave_3D(QMyCustomPlot *widget, QString strSlfName, QString st
|
||||||
pt = new QPointF[_nSamples+1];
|
pt = new QPointF[_nSamples+1];
|
||||||
//
|
//
|
||||||
float m_flWjMaxFactor=0.6; //外径最大位置占道的比例
|
float m_flWjMaxFactor=0.6; //外径最大位置占道的比例
|
||||||
|
int iMyWidth = widget->axisRect(0)->width();
|
||||||
// 最大外径宽度
|
// 最大外径宽度
|
||||||
float r = m_flWjMaxFactor*(_nSamples-0)/2;
|
float r = m_flWjMaxFactor*(iMyWidth-0)/2;
|
||||||
//
|
//
|
||||||
float centerX = (_nSamples+0)/2.0;
|
float centerX = (iMyWidth+0)/2.0;
|
||||||
float angle = 3.0*3.1415926/2.0;
|
float angle = 3.0*3.1415926/2.0;
|
||||||
float xspeed = (3.1415926/(nPoint-1)); // 半圆
|
float xspeed = (3.1415926/(nPoint-1)); // 半圆
|
||||||
float x=-r;
|
float x=-r;
|
||||||
|
|
@ -1286,6 +1297,18 @@ void FormDraw::initWave_3D(QMyCustomPlot *widget, QString strSlfName, QString st
|
||||||
x += (float)(r*2./(nPoint-1.));
|
x += (float)(r*2./(nPoint-1.));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// 最大外径宽度
|
||||||
|
float *fl_x_Coord = new float[_nSamples+1];
|
||||||
|
float r_Coord = m_flWjMaxFactor*(_nSamples-0)/2;
|
||||||
|
float centerX_Coord = (_nSamples+0)/2.0;
|
||||||
|
float x_Coord=-r_Coord;
|
||||||
|
for (int j=0;j<nPoint; j++)
|
||||||
|
{
|
||||||
|
fl_x_Coord[j] = (centerX + x_Coord);
|
||||||
|
x_Coord += (float)(r_Coord*2./(nPoint-1.));
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------
|
//---------------------------------
|
||||||
//转换新值
|
//转换新值
|
||||||
double** wavedataNew;
|
double** wavedataNew;
|
||||||
|
|
@ -1307,8 +1330,18 @@ void FormDraw::initWave_3D(QMyCustomPlot *widget, QString strSlfName, QString st
|
||||||
int d=1;
|
int d=1;
|
||||||
for (int j=0; j<nPoint-d; j+=d)
|
for (int j=0; j<nPoint-d; j+=d)
|
||||||
{
|
{
|
||||||
int kkPos = pt[j].x();
|
|
||||||
int iPos = i+pt[j].y();
|
float tempValue = -(_SDep + _Rlev*i);
|
||||||
|
|
||||||
|
double lY1 = fl_x_Coord[j]; //
|
||||||
|
double lY2 = fl_x_Coord[j+d]; //
|
||||||
|
//double lY1 = widget->yAxis->pixelToCoord(pt[j].x()); //+10 fl_x_Coord[j]; //
|
||||||
|
//double lY2 = widget->yAxis->pixelToCoord(pt[j+d].x()); //fl_x_Coord[j+d]; //
|
||||||
|
double left_Low = widget->xAxis->pixelToCoord( widget->xAxis->coordToPixel(tempValue)+pt[j].y());// + widget->xAxis->pixelToCoord(pt[j].y());
|
||||||
|
double right_Hight = widget->xAxis->pixelToCoord( widget->xAxis->coordToPixel(tempValue + _Rlev)+pt[j+1].y());// + widget->xAxis->pixelToCoord(pt[j+1].y());
|
||||||
|
|
||||||
|
int kkPos = (lY1+lY2)/2;
|
||||||
|
int iPos = fabs(left_Low + right_Hight + 2*_SDep)/(2*_Rlev);
|
||||||
if(kkPos>=_nSamples || kkPos<0 || iPos>=m_Record || iPos<0)
|
if(kkPos>=_nSamples || kkPos<0 || iPos>=m_Record || iPos<0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -1316,6 +1349,33 @@ void FormDraw::initWave_3D(QMyCustomPlot *widget, QString strSlfName, QString st
|
||||||
{
|
{
|
||||||
wavedataNew[kkPos][iPos] = wavedata[j][i];
|
wavedataNew[kkPos][iPos] = wavedata[j][i];
|
||||||
}
|
}
|
||||||
|
//--------------
|
||||||
|
kkPos = lY1;
|
||||||
|
iPos = fabs(left_Low + _SDep)/_Rlev;
|
||||||
|
if(kkPos>=_nSamples || kkPos<0 || iPos>=m_Record || iPos<0)
|
||||||
|
{
|
||||||
|
qDebug() << "kkPos=" << QString::number(kkPos) << ",iPos=" << QString::number(iPos) << "j=" << QString::number(j) << ",i=" << QString::number(i);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wavedataNew[kkPos][iPos] = wavedata[j][i];
|
||||||
|
|
||||||
|
//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 = lY2;
|
||||||
|
iPos = fabs(right_Hight + _SDep)/_Rlev;
|
||||||
|
if(kkPos>=_nSamples || kkPos<0 || iPos>=m_Record || iPos<0)
|
||||||
|
{
|
||||||
|
qDebug() << "kkPos=" << QString::number(kkPos) << ",iPos=" << QString::number(iPos) << "j=" << QString::number(j) << ",i=" << QString::number(i);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wavedataNew[kkPos][iPos] = wavedata[j][i];
|
||||||
|
|
||||||
|
//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;
|
// kkPos = pt[j].x()+0.5;
|
||||||
// iPos = i+pt[j].y();
|
// iPos = i+pt[j].y();
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,8 @@ QString g_prjname="";
|
||||||
|
|
||||||
//是否隐藏刻度
|
//是否隐藏刻度
|
||||||
int g_iShow = 0;
|
int g_iShow = 0;
|
||||||
|
//是否支持波列3D
|
||||||
|
int g_iSupport3D=0;
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
|
|
@ -223,7 +225,9 @@ void MainWindow::initToolBar()
|
||||||
|
|
||||||
connect(m_newprojectAc, &QAction::triggered, this, &MainWindow::s_New);
|
connect(m_newprojectAc, &QAction::triggered, this, &MainWindow::s_New);
|
||||||
connect(m_openprojectAc, &QAction::triggered, this, &MainWindow::s_Open);
|
connect(m_openprojectAc, &QAction::triggered, this, &MainWindow::s_Open);
|
||||||
connect(m_wellsectionwindowAc, &QAction::triggered, this, &MainWindow::s_showView);//s_Risize
|
connect(m_wellsectionwindowAc, &QAction::triggered, this, &MainWindow::s_showView);
|
||||||
|
connect(m_developmentAc, &QAction::triggered, this, &MainWindow::s_development);
|
||||||
|
|
||||||
// connect(m_compileAc, &QAction::triggered, this, &MainWindow::s_AddOne);
|
// connect(m_compileAc, &QAction::triggered, this, &MainWindow::s_AddOne);
|
||||||
// connect(m_runAc, &QAction::triggered, this, &MainWindow::s_SaveImage);
|
// connect(m_runAc, &QAction::triggered, this, &MainWindow::s_SaveImage);
|
||||||
// connect(m_debugAc, &QAction::triggered, this, &MainWindow::s_DrawImg);
|
// connect(m_debugAc, &QAction::triggered, this, &MainWindow::s_DrawImg);
|
||||||
|
|
@ -412,6 +416,19 @@ void MainWindow::s_showView()
|
||||||
// searchThread->Open(fileFull);
|
// searchThread->Open(fileFull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//开发工具
|
||||||
|
void MainWindow::s_development()
|
||||||
|
{
|
||||||
|
//暂时用作切换3d绘制波列图的切换按钮
|
||||||
|
if(g_iSupport3D==0)
|
||||||
|
{
|
||||||
|
g_iSupport3D=1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
g_iSupport3D=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::s_Risize()
|
void MainWindow::s_Risize()
|
||||||
{
|
{
|
||||||
emit CallManage::getInstance()->sig_Risize();
|
emit CallManage::getInstance()->sig_Risize();
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,8 @@ public slots:
|
||||||
|
|
||||||
//可视解释
|
//可视解释
|
||||||
void s_showView();
|
void s_showView();
|
||||||
|
//开发工具
|
||||||
|
void s_development();
|
||||||
|
|
||||||
void s_ShowCurve(QString strSlfName, QString strName);//曲线数据查看
|
void s_ShowCurve(QString strSlfName, QString strName);//曲线数据查看
|
||||||
void s_ShowTable(QString strSlfName, QString strName);//表格数据查看
|
void s_ShowTable(QString strSlfName, QString strName);//表格数据查看
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user