优化大量曲线上下滚动卡顿问题
This commit is contained in:
parent
8c7bf0fed0
commit
1e4d815759
|
|
@ -176,6 +176,8 @@ signals:
|
||||||
//改变缩放比例
|
//改变缩放比例
|
||||||
void sig_changeScale(QString strUuid, int iNewScale);
|
void sig_changeScale(QString strUuid, int iNewScale);
|
||||||
|
|
||||||
|
//自定义滚动条
|
||||||
|
void sig_vertScrollBarChanged_setGeometry(QString strUuid, int iNewValue, int low, int upper);
|
||||||
//自定义滚动条
|
//自定义滚动条
|
||||||
void sig_vertScrollBarChanged(QString strUuid, int iNewValue, int low, int upper);
|
void sig_vertScrollBarChanged(QString strUuid, int iNewValue, int low, int upper);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
#include "formline.h"
|
#include "formline.h"
|
||||||
#include "PropertyWidget.h"
|
#include "PropertyWidget.h"
|
||||||
#include "DrawTvd.h"
|
#include "DrawTvd.h"
|
||||||
|
#include "DepthProgress.h"
|
||||||
|
|
||||||
//以下参数从配置文件读取
|
//以下参数从配置文件读取
|
||||||
extern int g_iOneWidth; //道宽
|
extern int g_iOneWidth; //道宽
|
||||||
|
|
@ -480,6 +481,11 @@ void FormDraw::DisplayLines(QJsonArray linesArray)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//进度提示
|
||||||
|
char s[200];
|
||||||
|
DepthProgress mDepthProgress;
|
||||||
|
mDepthProgress.CreatProgress(0, iCount,"加载..");
|
||||||
|
|
||||||
for (int id = 0; id < iCount; id++)
|
for (int id = 0; id < iCount; id++)
|
||||||
{
|
{
|
||||||
if (mapLines.contains(id))
|
if (mapLines.contains(id))
|
||||||
|
|
@ -578,10 +584,16 @@ void FormDraw::DisplayLines(QJsonArray linesArray)
|
||||||
{
|
{
|
||||||
DisplayType_One(lineObjInfo);
|
DisplayType_One(lineObjInfo);
|
||||||
}
|
}
|
||||||
|
//中间
|
||||||
|
sprintf(s,"加载中,共计%d条,正在加载第%d条..", iCount, id);
|
||||||
|
mDepthProgress.SetShowName(s);
|
||||||
|
mDepthProgress.SetDepth(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
mDepthProgress.DelProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 岩心分析
|
// 岩心分析
|
||||||
|
|
|
||||||
|
|
@ -170,8 +170,9 @@ void MainWindow::ReadConfig()
|
||||||
qtCommon->readShowScale(configPath, iShow);
|
qtCommon->readShowScale(configPath, iShow);
|
||||||
g_iShow = iShow;
|
g_iShow = iShow;
|
||||||
|
|
||||||
|
//(0:采用最大30000像素高度, 1:采用屏幕工作区域高度, 其他数字:高度采用g_iHeight_MyCustom的值)
|
||||||
|
int iHeight = 10000;
|
||||||
//读取,MyCustom界面高度
|
//读取,MyCustom界面高度
|
||||||
int iHeight = 1;
|
|
||||||
//qtCommon->readHeight(configPath, iHeight);
|
//qtCommon->readHeight(configPath, iHeight);
|
||||||
g_iHeight_MyCustom = iHeight;
|
g_iHeight_MyCustom = iHeight;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -222,8 +222,53 @@ void MainWindowCurve::s_mouseWheel(QWheelEvent *event)
|
||||||
//自定义滚动条
|
//自定义滚动条
|
||||||
void MainWindowCurve::vertScrollBarChanged(int value)
|
void MainWindowCurve::vertScrollBarChanged(int value)
|
||||||
{
|
{
|
||||||
//通知界面缩放
|
int low = -m_iY1;
|
||||||
emit CallManage::getInstance()->sig_vertScrollBarChanged(m_strUuid, value, -m_iY1, -m_iY2);
|
int upper = -m_iY2;
|
||||||
|
|
||||||
|
int iHeightOfScreen = 30000;//QApplication::desktop()->height();
|
||||||
|
if(g_iHeight_MyCustom == 0)
|
||||||
|
{
|
||||||
|
iHeightOfScreen = 30000;
|
||||||
|
}
|
||||||
|
else if(g_iHeight_MyCustom == 1)
|
||||||
|
{
|
||||||
|
iHeightOfScreen = g_WorkSpace_Height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iHeightOfScreen = g_iHeight_MyCustom;
|
||||||
|
}
|
||||||
|
|
||||||
|
double dScrollHeight = (iHeightOfScreen-g_WorkSpace_Height)/g_dPixelPerCm/100.0 * (double)m_iScale;
|
||||||
|
|
||||||
|
double dScrollHeight_setGeometry = iHeightOfScreen/g_dPixelPerCm/100.0 * (double)m_iScale;
|
||||||
|
//
|
||||||
|
double dDelta = value - upper;
|
||||||
|
int iNumShow = dDelta/dScrollHeight;
|
||||||
|
if(dDelta - (iNumShow * dScrollHeight) > 0)
|
||||||
|
{
|
||||||
|
iNumShow++;
|
||||||
|
}
|
||||||
|
if(m_iCurPage == iNumShow)
|
||||||
|
{
|
||||||
|
int iCurValue = dDelta - (iNumShow-1)*dScrollHeight;
|
||||||
|
//通知界面重设范围
|
||||||
|
emit CallManage::getInstance()->sig_vertScrollBarChanged_setGeometry(m_strUuid, iCurValue, dScrollHeight_setGeometry, 0);
|
||||||
|
}
|
||||||
|
else if(iNumShow>0)
|
||||||
|
{
|
||||||
|
m_iCurPage = iNumShow;
|
||||||
|
//通知界面重设范围
|
||||||
|
emit CallManage::getInstance()->sig_vertScrollBarChanged(m_strUuid, (iNumShow-1)*dScrollHeight_setGeometry, -m_iY1, -m_iY2);
|
||||||
|
|
||||||
|
// //
|
||||||
|
// int iCurValue = dDelta - (iNumShow-1)*dScrollHeight;
|
||||||
|
// //通知界面重设范围
|
||||||
|
// emit CallManage::getInstance()->sig_vertScrollBarChanged_setGeometry(m_strUuid, iCurValue, dScrollHeight, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//通知界面重设范围
|
||||||
|
//emit CallManage::getInstance()->sig_vertScrollBarChanged(m_strUuid, value, -m_iY1, -m_iY2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2562,15 +2607,15 @@ void copyFile(const QString &sourcePath, const QString &destinationPath) {
|
||||||
// =4 to svg
|
// =4 to svg
|
||||||
void MainWindowCurve::_slotExport(QPrinter &printer, int IsBmp, QString pngName, QString strTmpName)
|
void MainWindowCurve::_slotExport(QPrinter &printer, int IsBmp, QString pngName, QString strTmpName)
|
||||||
{
|
{
|
||||||
//Small模式,出图的原始图片是否采用小图片(默认0:大图--缺点出图时占用内存大, 1:小图--缺点小图拼接容易有缝隙)
|
// //Small模式,出图的原始图片是否采用小图片(默认0:大图--缺点出图时占用内存大, 1:小图--缺点小图拼接容易有缝隙)
|
||||||
if(g_iSmallPrint==0)
|
// if(g_iSmallPrint==0)
|
||||||
{
|
// {
|
||||||
//首先调整为最大图,减少打印空隙
|
// //首先调整为最大图,减少打印空隙
|
||||||
//MyCustom界面高度g_iHeight_MyCustom的值 (0:采用最大30000像素高度, 1:采用屏幕工作区域高度, 其他数字:高度采用g_iHeight_MyCustom的值)
|
// //MyCustom界面高度g_iHeight_MyCustom的值 (0:采用最大30000像素高度, 1:采用屏幕工作区域高度, 其他数字:高度采用g_iHeight_MyCustom的值)
|
||||||
g_iHeight_MyCustom = 0;
|
// g_iHeight_MyCustom = 0;
|
||||||
//打印出图,改变深度
|
// //打印出图,改变深度
|
||||||
changeDepthForPrint();
|
// changeDepthForPrint();
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
printer.setPageMargins(0.0,0.0,0.0,0.0,QPrinter::DevicePixel);
|
printer.setPageMargins(0.0,0.0,0.0,0.0,QPrinter::DevicePixel);
|
||||||
|
|
@ -2815,6 +2860,8 @@ void MainWindowCurve::_slotExport(QPrinter &printer, int IsBmp, QString pngName,
|
||||||
images.append(convertToQImage(pPixmap_wellTrackInfo)); // 将QPixmap转换为QImage并存储到列表中
|
images.append(convertToQImage(pPixmap_wellTrackInfo)); // 将QPixmap转换为QImage并存储到列表中
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double newValue = 0;
|
||||||
|
double newValue_last = 0;
|
||||||
//int iPreH = 6;
|
//int iPreH = 6;
|
||||||
int iLoop = 0;
|
int iLoop = 0;
|
||||||
for(iLoop = 0; iLoop<iNum; iLoop++)
|
for(iLoop = 0; iLoop<iNum; iLoop++)
|
||||||
|
|
@ -2831,7 +2878,12 @@ void MainWindowCurve::_slotExport(QPrinter &printer, int IsBmp, QString pngName,
|
||||||
// {
|
// {
|
||||||
// newValue = (tmp-iPreH*iLoop)/g_dPixelPerCm/100.0 * (double)m_iScale;
|
// newValue = (tmp-iPreH*iLoop)/g_dPixelPerCm/100.0 * (double)m_iScale;
|
||||||
// }
|
// }
|
||||||
ui->verticalScrollBar->setValue(newValue);//设置右侧滚动条
|
|
||||||
|
newValue_last = newValue;
|
||||||
|
//ui->verticalScrollBar->setValue(newValue);//设置右侧滚动条
|
||||||
|
//通知界面重设范围
|
||||||
|
emit CallManage::getInstance()->sig_vertScrollBarChanged(m_strUuid, newValue, -m_iY1, -m_iY2);
|
||||||
|
|
||||||
if(iLoop==iNum-1)
|
if(iLoop==iNum-1)
|
||||||
{
|
{
|
||||||
//最后1页
|
//最后1页
|
||||||
|
|
@ -2961,16 +3013,17 @@ void MainWindowCurve::_slotExport(QPrinter &printer, int IsBmp, QString pngName,
|
||||||
mDepthProgress.DelProgress();
|
mDepthProgress.DelProgress();
|
||||||
|
|
||||||
//Small模式,出图的原始图片是否采用小图片(默认0:大图--缺点出图时占用内存大, 1:小图--缺点小图拼接容易有缝隙)
|
//Small模式,出图的原始图片是否采用小图片(默认0:大图--缺点出图时占用内存大, 1:小图--缺点小图拼接容易有缝隙)
|
||||||
if(g_iSmallPrint==0)
|
// if(g_iSmallPrint==0)
|
||||||
{
|
// {
|
||||||
//恢复调整为最小图,减少卡顿
|
// //恢复调整为最小图,减少卡顿
|
||||||
//MyCustom界面高度g_iHeight_MyCustom的值 (0:采用最大30000像素高度, 1:采用屏幕工作区域高度, 其他数字:高度采用g_iHeight_MyCustom的值)
|
// //MyCustom界面高度g_iHeight_MyCustom的值 (0:采用最大30000像素高度, 1:采用屏幕工作区域高度, 其他数字:高度采用g_iHeight_MyCustom的值)
|
||||||
g_iHeight_MyCustom = 1;
|
// g_iHeight_MyCustom = 1;
|
||||||
//打印出图,改变深度
|
// //打印出图,改变深度
|
||||||
changeDepthForPrint();
|
// changeDepthForPrint();
|
||||||
}
|
// }
|
||||||
|
|
||||||
ui->verticalScrollBar->setValue(-m_iY2);//设置右侧滚动条
|
//ui->verticalScrollBar->setValue(-m_iY1);//设置右侧滚动条
|
||||||
|
ui->verticalScrollBar->setValue(newValue_last);//设置右侧滚动条
|
||||||
if(bOK)
|
if(bOK)
|
||||||
{
|
{
|
||||||
QMessageBox::information(NULL,"提示","图件输出完成!",QMessageBox::Ok);
|
QMessageBox::information(NULL,"提示","图件输出完成!",QMessageBox::Ok);
|
||||||
|
|
@ -4144,8 +4197,11 @@ void MainWindowCurve::Open(QString fileFull)
|
||||||
//重置右侧滚动条
|
//重置右侧滚动条
|
||||||
ui->verticalScrollBar->setRange(-m_iY2, -m_iY1);
|
ui->verticalScrollBar->setRange(-m_iY2, -m_iY1);
|
||||||
ui->verticalScrollBar->setValue(-m_iY2);
|
ui->verticalScrollBar->setValue(-m_iY2);
|
||||||
|
|
||||||
|
QMessageBox::information(NULL,"提示","模板加载完成!",QMessageBox::Ok);
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "JSON 模板文件打开失败:" << file.errorString();
|
qWarning() << "JSON 模板文件打开失败:" << file.errorString();
|
||||||
|
QMessageBox::information(NULL,"提示","模板加载失败!",QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4419,16 +4475,31 @@ void MainWindowCurve::changeDepthForPrint()
|
||||||
progressBar->hide();
|
progressBar->hide();
|
||||||
|
|
||||||
|
|
||||||
double dHight = 0;
|
// double dHight = 0;
|
||||||
dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm;
|
// dHight = (m_iY2-m_iY1)*100.0/(double)m_iScale * g_dPixelPerCm;
|
||||||
if(g_iShow==1)
|
// if(g_iShow==1)
|
||||||
|
// {
|
||||||
|
// //显示刻度
|
||||||
|
// dHight = dHight+30;
|
||||||
|
// }
|
||||||
|
// if(dHight>32767)
|
||||||
|
// {
|
||||||
|
// dHight = 32767;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 屏幕高度
|
||||||
|
int iHeightOfScreen = 30000;//QApplication::desktop()->height();
|
||||||
|
if(g_iHeight_MyCustom == 0)
|
||||||
{
|
{
|
||||||
//显示刻度
|
iHeightOfScreen = 30000;
|
||||||
dHight = dHight+30;
|
|
||||||
}
|
}
|
||||||
if(dHight>32767)
|
else if(g_iHeight_MyCustom == 1)
|
||||||
{
|
{
|
||||||
dHight = 32767;
|
iHeightOfScreen = g_WorkSpace_Height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iHeightOfScreen = g_iHeight_MyCustom;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
|
|
@ -4456,26 +4527,12 @@ void MainWindowCurve::changeDepthForPrint()
|
||||||
FormWell *widgetWell = (FormWell*)myWidget;//获得widget
|
FormWell *widgetWell = (FormWell*)myWidget;//获得widget
|
||||||
if(widgetWell)
|
if(widgetWell)
|
||||||
{
|
{
|
||||||
widgetWell->setRowHeight(dHight, progressBar, iSplit);
|
widgetWell->setRowHeight(iHeightOfScreen, progressBar, iSplit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 屏幕高度
|
|
||||||
int iHeightOfScreen = 30000;//QApplication::desktop()->height();
|
|
||||||
if(g_iHeight_MyCustom == 0)
|
|
||||||
{
|
|
||||||
iHeightOfScreen = 30000;
|
|
||||||
}
|
|
||||||
else if(g_iHeight_MyCustom == 1)
|
|
||||||
{
|
|
||||||
iHeightOfScreen = g_WorkSpace_Height;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
iHeightOfScreen = g_iHeight_MyCustom;
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
//获取井well前2行的高度
|
//获取井well前2行的高度
|
||||||
int iTableSize_Head = 100 + m_nObjLayerH;
|
int iTableSize_Head = 100 + m_nObjLayerH;
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ public:
|
||||||
int m_iScale=200;
|
int m_iScale=200;
|
||||||
double m_iY1=-1000;
|
double m_iY1=-1000;
|
||||||
double m_iY2=0;
|
double m_iY2=0;
|
||||||
|
int m_iCurPage = 1;//当前页
|
||||||
public:
|
public:
|
||||||
//展示所有井
|
//展示所有井
|
||||||
void DisplayWells(QJsonArray wellsArray);
|
void DisplayWells(QJsonArray wellsArray);
|
||||||
|
|
|
||||||
|
|
@ -11910,6 +11910,25 @@ void QMyCustomPlot::addQCPItemLine(QMyCustomPlot *widget, float cx, float cy, co
|
||||||
pLine->setPoints(myPolygon);
|
pLine->setPoints(myPolygon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QMyCustomPlot::vertScrollBarChanged_setGeometry(QString strUuid, int value, int low, int upper)
|
||||||
|
{
|
||||||
|
if(m_strUuid==strUuid)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//上移或下移
|
||||||
|
QRect geoRect = geometry();
|
||||||
|
//
|
||||||
|
double dDelta = value; //- upper
|
||||||
|
double dPercent = dDelta / (low-upper);
|
||||||
|
|
||||||
|
setGeometry(0, -(dPercent*geoRect.height()), geoRect.width(), geoRect.height());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//自定义滚动条
|
//自定义滚动条
|
||||||
void QMyCustomPlot::vertScrollBarChanged(QString strUuid, int value, int low, int upper)
|
void QMyCustomPlot::vertScrollBarChanged(QString strUuid, int value, int low, int upper)
|
||||||
{
|
{
|
||||||
|
|
@ -11920,6 +11939,8 @@ void QMyCustomPlot::vertScrollBarChanged(QString strUuid, int value, int low, in
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
QRect geoRect = geometry();
|
||||||
|
setGeometry(0, 0, geoRect.width(), geoRect.height());
|
||||||
|
|
||||||
//
|
//
|
||||||
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
|
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
|
||||||
|
|
|
||||||
|
|
@ -408,6 +408,7 @@ public slots:
|
||||||
void slot_time();
|
void slot_time();
|
||||||
//自定义滚动条
|
//自定义滚动条
|
||||||
void vertScrollBarChanged(QString strUuid, int value, int low, int upper);
|
void vertScrollBarChanged(QString strUuid, int value, int low, int upper);
|
||||||
|
void vertScrollBarChanged_setGeometry(QString strUuid, int value, int low, int upper);
|
||||||
//信号槽刷新
|
//信号槽刷新
|
||||||
void slot_replot();
|
void slot_replot();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user