diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index e828d2b..191b122 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -2889,6 +2889,21 @@ void PropertyWidget::initCurveProperty(FormInfo *formInfo, QStringList strListOt _CreateVariantPropertyItem("显示设置", "单比例连续折返", formInfo->m_bConBackAndForth, QVariant::Bool); + _CreateVariantPropertyItem("曲线第二比例", "线宽", formInfo->m_twoBLWidth, QVariant::Int); + _CreateVariantPropertyItem("曲线第二比例", "颜色", formInfo->m_twoBLlineColor, QVariant::Color); + _CreateEnumPropertyItem("曲线第二比例", "线型", (int)formInfo->m_twoBLlineStyle, listStyle); + _CreateVariantPropertyItem("曲线第二比例", "第二比例大小", formInfo->m_twoBLSize, QVariant::Int); + _CreateVariantPropertyItem("曲线第二比例", "自动计算二比例", formInfo->m_twoBLAuto, QVariant::Bool); + _CreateVariantPropertyItem("曲线第二比例", "绘制左二比例", formInfo->m_twoBLDrawLeft, QVariant::Bool); + _CreateVariantPropertyItem("曲线第二比例", "左二比例连续折返", formInfo->m_twoBLLeftConBackAndForth, QVariant::Bool); + _CreateVariantPropertyItem("曲线第二比例", "左二比例左刻度", formInfo->m_twoBLLeftLeft, QVariant::String); + _CreateVariantPropertyItem("曲线第二比例", "左二比例右刻度", formInfo->m_twoBLLeftRight, QVariant::String); + _CreateVariantPropertyItem("曲线第二比例", "绘制右二比例", formInfo->m_twoBLDrawRight, QVariant::Bool); + _CreateVariantPropertyItem("曲线第二比例", "右二比例连续折返", formInfo->m_twoBLRightConBackAndForth, QVariant::Bool); + _CreateVariantPropertyItem("曲线第二比例", "右二比例左刻度", formInfo->m_twoBLRightLeft, QVariant::String); + _CreateVariantPropertyItem("曲线第二比例", "右二比例右刻度", formInfo->m_twoBLRightRight, QVariant::String); + + //绘制方式 _CreateVariantPropertyItem("绘制方式", "曲线", formInfo->m_bDrawLine, QVariant::Bool); _CreateVariantPropertyItem("绘制方式", "绘制对称曲线", formInfo->m_bDrawSymmetry, QVariant::Bool); diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 5a1f30d..0e35236 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -16,17 +16,7 @@ #include "DrawTvd.h" //以下参数从配置文件读取 -extern int g_iIndex; -extern int g_iNum; extern int g_iOneWidth; //道宽 -extern int g_iHeadHigh; //道头高度 -extern int g_iTitleHigh; //道对象高度 -extern int g_iCurveHigh;//曲线高度 -extern int g_iMove; //道头偏移 -extern int g_iPointNum; // number of points in graph -extern int g_iLineNum; // number of Line - -extern int g_iWidth; //道宽 extern int g_iShow; //显示刻度 // extern int g_iX1; diff --git a/logPlus/forminfo.h b/logPlus/forminfo.h index 4d55e5b..26c1abf 100644 --- a/logPlus/forminfo.h +++ b/logPlus/forminfo.h @@ -116,6 +116,21 @@ public: bool m_bConBackAndForth = false; // 单比例连续折返 + // 曲线第二比例 + int m_twoBLWidth = 3; // 线宽 + QColor m_twoBLlineColor; // 颜色 + Qt::PenStyle m_twoBLlineStyle= Qt::SolidLine; // 线形 + int m_twoBLSize = 0; // 第二比例大小 + bool m_twoBLAuto = true; // 自动计算二比例 + bool m_twoBLDrawLeft = true; // 绘制左二比例 + bool m_twoBLLeftConBackAndForth = true; // 左二比例连续折返 + QString m_twoBLLeftLeft = ""; // 左二比例左刻度 + QString m_twoBLLeftRight = ""; // 左二比例右刻度 + bool m_twoBLDrawRight = false; // 绘制右二比例 + bool m_twoBLRightConBackAndForth = false; // 右二比例连续折返 + QString m_twoBLRightLeft = ""; // 右二比例左刻度 + QString m_twoBLRightRight = ""; // 右二比例右刻度 + //绘制方式 bool m_bDrawLine = true; // 曲线 bool m_bDrawGan = false; // 杆状 diff --git a/logPlus/formwell.cpp b/logPlus/formwell.cpp index 5eec6b7..1a1b6fd 100644 --- a/logPlus/formwell.cpp +++ b/logPlus/formwell.cpp @@ -12,6 +12,11 @@ extern int g_iOneWidth; //道宽 extern double g_dPixelPerCm;//每厘米像素数 extern int g_iShow; //显示刻度 + +//MyCustom界面高度 +extern int g_iHeight_MyCustom; +extern int g_WorkSpace_Height; + //井+道名 FormWell::FormWell(QWidget *parent, QString strWellName) : QWidget(parent), @@ -244,6 +249,19 @@ QVector FormWell::new_track(QStringList listdt, QString strTrackName) // 屏幕高度 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; + } + ui->tableWidget->setRowHeight(i, (int)iHeightOfScreen); //曲线绘制栏 @@ -674,6 +692,19 @@ void FormWell::setRowHeight(double dHight, QProgressBar *progressBar, int 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; + } + //int iHeightOfRow = ui->tableWidget->rowHeight(2); //设置高度 diff --git a/logPlus/mainwindow.cpp b/logPlus/mainwindow.cpp index fa61522..df96a0c 100644 --- a/logPlus/mainwindow.cpp +++ b/logPlus/mainwindow.cpp @@ -27,18 +27,9 @@ #include "mainwindowsplitter.h" using namespace pai::gui; -//以下参数从配置文件读取 -int g_iIndex = 0; -int g_iNum = 0; -int g_iOneWidth = 200; //道宽 -int g_iHeadHigh = 30; //道头高度 -int g_iTitleHigh = 303; //道对象高度 -int g_iCurveHigh = 3020;//曲线高度 -int g_iMove = 12; //道头偏移 -int g_iPointNum = 30000; // number of points in graph -int g_iLineNum = 0; // number of Line -int g_iWidth = 2500; //道宽 // +int g_iOneWidth = 4; //道宽 +//以下参数从配置文件读取 int g_iX1 = -15; int g_iX2 = 15; int g_iY1 = -3000; @@ -52,6 +43,12 @@ int g_iShow = 0; //是否支持波列3D int g_iSupport3D=0; +//MyCustom界面高度g_iHeight_MyCustom的值 (0:采用最大30000像素高度, 1:采用屏幕工作区域高度, 其他数字:高度采用g_iHeight_MyCustom的值) +int g_iHeight_MyCustom = 0; +//主mainwindow工作区域宽度、高度 +int g_WorkSpace_Width = 0; +int g_WorkSpace_Height = 0; + MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) @@ -67,6 +64,9 @@ MainWindow::MainWindow(QWidget *parent) : //加载样式 loadStyle(":/qrc/qss/flatgray.css"); + // 显示并最大化窗口,在加载完样式后调用 + showMaximized(); + ReadConfig(); initTitleBar(); //菜单栏 @@ -99,6 +99,16 @@ MainWindow::MainWindow(QWidget *parent) : //关联信号槽,测井信息表数据查看 connect(CallManage::getInstance(), SIGNAL(sig_WelllogInformation(QString)), this, SLOT(s_WelllogInformation(QString))); + + QTimer::singleShot(100, this, [=]() { + QRect geoRect = m_centerWidgets->geometry(); + g_WorkSpace_Width = geoRect.width(); + g_WorkSpace_Height = geoRect.height();// -9 -100 -300 -100 -4;//-iconToolbar -Margin -well -table -line + + // +// QRect geoRect_TabBar = m_centerWidgets->m_pTabBar->geometry(); +// g_WorkSpace_Height = g_WorkSpace_Height - geoRect_TabBar.height(); + }); } MainWindow::~MainWindow() @@ -140,17 +150,7 @@ void MainWindow::ReadConfig() //从配置文件读取 QtCommonClass *qtCommon = new QtCommonClass(this); - qtCommon->readConfigSize(configPath, iIndex, iNum, iOneWidth, iHeadHigh, iTitleHigh, iCurveHigh, iMove, iPointNum, iLineNum); - - g_iIndex = iIndex; - g_iNum = iNum; g_iOneWidth = 4; //道宽 - g_iHeadHigh = iHeadHigh; //道头高度 - g_iTitleHigh = iTitleHigh; //道对象高度 - g_iCurveHigh = iCurveHigh;//曲线高度 - g_iMove = iMove; //道头偏移 - g_iPointNum = iPointNum; // number of points in graph - g_iLineNum = iLineNum; // number of Line // qtCommon->readXyRange(configPath, g_iX1, g_iX2, g_iY1, g_iY2); @@ -159,6 +159,11 @@ void MainWindow::ReadConfig() int iShow = 0; qtCommon->readShowScale(configPath, iShow); g_iShow = iShow; + + //读取,MyCustom界面高度 + int iHeight = 0; + qtCommon->readHeight(configPath, iHeight); + g_iHeight_MyCustom = iHeight; } void MainWindow::loadStyle(const QString &qssFile) @@ -307,8 +312,6 @@ void MainWindow::initWorkSpaceView() m_stackedWidget_Center->setCurrentWidget(m_centerWidgets);//默认展示 this->setCentralWidget(m_stackedWidget_Center); - - //---- //MainWindowCurve *mainWindowNew2 = new MainWindowCurve();//中间工作区 //m_centerWidgets->addTab(mainWindowNew2, "解释视图2"); diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index fd37ca2..b67cc66 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -41,6 +41,10 @@ extern int g_SelectWellIndex; //extern int g_iColsWidth; //extern int g_iRowsHight; +//MyCustom界面高度 +extern int g_iHeight_MyCustom; +extern int g_WorkSpace_Height; + MainWindowCurve::MainWindowCurve(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindowCurve) @@ -2580,10 +2584,10 @@ void MainWindowCurve::_slotExport(QPrinter &printer, int IsBmp, QString pngName, iWidth += ui->tableWidget_2->columnWidth(j); } iWidth += 9*2 + (ui->tableWidget_2->columnCount()+1) +40;//左右margin + 边框n+1 - if(iWidth < ui->tableWidget_2->width()) - { - iWidth = ui->tableWidget_2->width(); - } +// if(iWidth < ui->tableWidget_2->width()) +// { +// iWidth = ui->tableWidget_2->width(); +// } // bool bVisible = m_dock1->isVisible(); @@ -2656,8 +2660,21 @@ void MainWindowCurve::_slotExport(QPrinter &printer, int IsBmp, QString pngName, //打印页数------------------------------ 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_dPixelPerCm/100.0 * (double)m_iScale; - double dDeep = -m_iY1 - (-m_iY2); + double dDeep = m_iY2-m_iY1; int iNumShow = dDeep/dScrollHeight; if(dDeep - (iNumShow * dScrollHeight) > 0) { @@ -2666,7 +2683,7 @@ void MainWindowCurve::_slotExport(QPrinter &printer, int IsBmp, QString pngName, //进度提示 char s[200]; DepthProgress mDepthProgress; - mDepthProgress.CreatProgress(0,iNumShow,"开始打印.."); + mDepthProgress.CreatProgress(0,iNumShow+2,"开始打印.."); //中间 //重新设置well表格高度,防止有人拖拽改变高度后,出图高度不一致 @@ -2678,19 +2695,15 @@ void MainWindowCurve::_slotExport(QPrinter &printer, int IsBmp, QString pngName, // 获取客户区几何信息(不含边框)centralwidget QRect geoRect = ui->centralwidget->geometry(); - ui->centralwidget->setGeometry(geoRect.x(), geoRect.y(), iWidth, iHight+40); + ui->centralwidget->setGeometry(geoRect.x(), geoRect.y(), iMaxWidth, iHight+40); //获取井well前2行的高度 int iTableSize_Head = 0; getTableSize_Head(iTableSize_Head); // int iTableWellTrack_height = ui->tableWidget_2->rowHeight(0) + (9+4) + iTableSize_Head +1; - // 屏幕高度 -// int iHeightOfScreen = 30000;//QApplication::desktop()->height(); -// double dScrollHeight = iHeightOfScreen/g_dPixelPerCm/100.0 * (double)m_iScale; //图片高度 int iTotalSize_Height = iHight_Head+iHight_Tail; - //double dDeep = -m_iY1 - (-m_iY2); int iNum = dDeep/dScrollHeight; double dLastHeight = iHeightOfScreen; if(dDeep - (iNum * dScrollHeight) > 0) @@ -2743,9 +2756,15 @@ void MainWindowCurve::_slotExport(QPrinter &printer, int IsBmp, QString pngName, images.append(convertToQImage(pPixmap_Head)); // 将QPixmap转换为QImage并存储到列表中 } } + //中间 + sprintf(s,"图片生成中,共计%d页,正在生成第%d页..", iNumShow+2, 1);//道头是第1页 + mDepthProgress.SetShowName(s); + mDepthProgress.SetDepth(1); + // ui->verticalScrollBar->hide(); //隐藏右侧滚动条 ui->verticalScrollBar->setValue(-m_iY2);//设置右侧滚动条 + ui->centralwidget->setGeometry(geoRect.x(), geoRect.y(), iMaxWidth, iHight+40); QPixmap pPixmap_wellTrackInfo = this->grab(QRect(geoRect.x(), geoRect.y(), iMaxWidth, iTableWellTrack_height)); //保存,方便查看 pPixmap_wellTrackInfo.save(tmpPath + "0.png"); @@ -2762,25 +2781,30 @@ void MainWindowCurve::_slotExport(QPrinter &printer, int IsBmp, QString pngName, int iLoop = 0; for(iLoop = 0; iLoop1) + { + newValue = (tmp-1)/g_dPixelPerCm/100.0 * (double)m_iScale; + } ui->verticalScrollBar->setValue(newValue);//设置右侧滚动条 if(iLoop==iNum-1) { //最后1页 - ui->centralwidget->setGeometry(geoRect.x(), geoRect.y(), iWidth, iHight+40); - QPixmap pPixmap = this->grab(QRect(geoRect.x(), geoRect.y()+iTableWellTrack_height, iMaxWidth, dLastHeight-2)); + ui->centralwidget->setGeometry(geoRect.x(), geoRect.y(), iMaxWidth, iHight+40); + QPixmap pPixmap = this->grab(QRect(geoRect.x(), geoRect.y()+iTableWellTrack_height, iMaxWidth, dLastHeight-4)); //保存,方便查看 pPixmap.save(tmpPath + QString::number(iLoop+1) + ".png"); if(IsBmp == 0 || IsBmp == 4) { //pdf,svg - painter.drawPixmap(0, iHight_Head + iTableWellTrack_height + (iHeightOfScreen-2)*iLoop, pPixmap); + painter.drawPixmap(0, iHight_Head + iTableWellTrack_height + (iHeightOfScreen-4)*iLoop, pPixmap); } else { @@ -2788,14 +2812,14 @@ void MainWindowCurve::_slotExport(QPrinter &printer, int IsBmp, QString pngName, } } else{ - ui->centralwidget->setGeometry(geoRect.x(), geoRect.y(), iWidth, iHight+40); - QPixmap pPixmap = this->grab(QRect(geoRect.x(), geoRect.y()+iTableWellTrack_height, iMaxWidth, iHeightOfScreen-2)); + ui->centralwidget->setGeometry(geoRect.x(), geoRect.y(), iMaxWidth, iHight+40); + QPixmap pPixmap = this->grab(QRect(geoRect.x(), geoRect.y()+iTableWellTrack_height, iMaxWidth, iHeightOfScreen-4)); //保存,方便查看 pPixmap.save(tmpPath + QString::number(iLoop+1) + ".png"); if(IsBmp == 0 || IsBmp == 4) { //pdf,svg - painter.drawPixmap(0, iHight_Head + iTableWellTrack_height + (iHeightOfScreen-2)*iLoop, pPixmap); + painter.drawPixmap(0, iHight_Head + iTableWellTrack_height + (iHeightOfScreen-4)*iLoop, pPixmap); } else { @@ -2808,15 +2832,23 @@ void MainWindowCurve::_slotExport(QPrinter &printer, int IsBmp, QString pngName, { //pdf,svg //双道头 - painter.drawPixmap(0, iHight_Head + iTableWellTrack_height + (iHeightOfScreen-2)*(iNum-1) + (dLastHeight-2), pPixmap_wellTrackInfo); + sprintf(s,"图片生成中,共计%d页,正在生成第%d页..", iNumShow+2, iNumShow+2);//双道头是最一页 + mDepthProgress.SetShowName(s); + mDepthProgress.SetDepth(iNumShow+2); + // + painter.drawPixmap(0, iHight_Head + iTableWellTrack_height + (iHeightOfScreen-4)*(iNum-1) + (dLastHeight-4), pPixmap_wellTrackInfo); //尾 - painter.drawPixmap(0, iHight_Head + iTableWellTrack_height*2 + (iHeightOfScreen-2)*(iNum-1) + (dLastHeight-2), pPixmap_Tail); + painter.drawPixmap(0, iHight_Head + iTableWellTrack_height*2 + (iHeightOfScreen-4)*(iNum-1) + (dLastHeight-4), pPixmap_Tail); //结束 painter.end(); } else { //双道头 + sprintf(s,"图片生成中,共计%d页,正在生成第%d页..", iNumShow+2, iNumShow+2);//双道头是最一页 + mDepthProgress.SetShowName(s); + mDepthProgress.SetDepth(iNumShow+2); + // images.append(convertToQImage(pPixmap_wellTrackInfo)); // 将QPixmap转换为QImage并存储到列表中 //尾 if(iHight_Tail) diff --git a/logPlus/mainwindowcurve.ui b/logPlus/mainwindowcurve.ui index 7bcfa7c..c7dc279 100644 --- a/logPlus/mainwindowcurve.ui +++ b/logPlus/mainwindowcurve.ui @@ -25,7 +25,7 @@ 9 - 9 + 0 @@ -52,11 +52,10 @@ 0 0 800 - 23 + 21 - toolBar diff --git a/logPlus/qtcommonclass.cpp b/logPlus/qtcommonclass.cpp index e6f1160..5ec278a 100644 --- a/logPlus/qtcommonclass.cpp +++ b/logPlus/qtcommonclass.cpp @@ -24,23 +24,12 @@ QString QtCommonClass::getUUid() return strId; } -//读取 -double QtCommonClass::readConfigSize(QString filePathName, int &iIndex, int &iNum, int &iOneWidth, int &iHeadHigh, int &iTitleHigh, int &iCurveHigh, int &iMove, int &iPointNum, int &iLineNum) +//读取,MyCustom界面高度 +double QtCommonClass::readHeight(QString filePathName, int &iHeight) { QSettings set(filePathName, QSettings::IniFormat); set.beginGroup("config"); - iIndex = set.value("iIndex", "0").toInt(); - iNum = set.value("iNum", "0").toInt(); - iOneWidth = set.value("iOneWidth", "200").toInt(); - // - iHeadHigh = set.value("iHeadHigh", "30").toInt(); - iTitleHigh = set.value("iTitleHigh", "303").toInt(); - iCurveHigh = set.value("iCurveHigh", "3020").toInt(); - // - iMove = set.value("iMove", "12").toInt(); - iPointNum = set.value("iPointNum", "30000").toInt(); - iLineNum = set.value("iLineNum", "0").toInt(); - + iHeight = set.value("iHeight", "1").toInt(); set.endGroup(); return 0; diff --git a/logPlus/qtcommonclass.h b/logPlus/qtcommonclass.h index 1e96ce8..c9ce9dd 100644 --- a/logPlus/qtcommonclass.h +++ b/logPlus/qtcommonclass.h @@ -17,10 +17,10 @@ public: public: QString getUUid(); - //读取 - double readConfigSize(QString filePathName, int &iIndex, int &iNum, int &iOneWidth, int &iHeadHigh, int &iTitleHigh, int &iCurveHigh, int &iMove, int &iPointNum, int &iLineNum); //读取,是否隐藏刻度 double readShowScale(QString filePathName, int &iShow); + //读取,MyCustom界面高度 + double readHeight(QString filePathName, int &iHeight); double readXyRange(QString filePathName, int &iX1, int &iX2, int &iY1, int &iY2);