diff --git a/logPlus/3rd_qcustomplot/v2_1/qcustomplot.cpp b/logPlus/3rd_qcustomplot/v2_1/qcustomplot.cpp index 2ad85ad..6a40394 100644 --- a/logPlus/3rd_qcustomplot/v2_1/qcustomplot.cpp +++ b/logPlus/3rd_qcustomplot/v2_1/qcustomplot.cpp @@ -26,6 +26,9 @@ #include "qcustomplot.h" #include "smoothcurve.h" +//是否隐藏刻度 +extern int g_iShow; + /* including file 'src/vector2d.cpp' */ /* modified 2021-03-29T02:30:44, size 7973 */ @@ -3269,10 +3272,18 @@ void QCPLayoutElement::setOuterRect(const QRect &rect) void QCPLayoutElement::setMargins(const QMargins &margins) { //jyl -// if (mMargins != margins) { -// mMargins = margins; -// mRect = mOuterRect.adjusted(mMargins.left(), mMargins.top(), -mMargins.right(), -mMargins.bottom()); -// } + if(g_iShow==1) + { + if (mMargins != margins) { + mMargins = margins; + mRect = mOuterRect.adjusted(mMargins.left(), mMargins.top(), -mMargins.right(), -mMargins.bottom()); + } + } + else + { + //隐藏刻度 + } + } /*! @@ -3287,9 +3298,16 @@ void QCPLayoutElement::setMargins(const QMargins &margins) void QCPLayoutElement::setMinimumMargins(const QMargins &margins) { //jyl -// if (mMinimumMargins != margins) { -// mMinimumMargins = margins; -// } + if(g_iShow==1) + { + if (mMinimumMargins != margins) { + mMinimumMargins = margins; + } + } + else + { + //隐藏刻度 + } } /*! @@ -14216,6 +14234,12 @@ void QCustomPlot::setOpenGl(bool enabled, int multisampling) #endif } +//jyl 隐藏刻度 +void QCustomPlot::setShowScale(int iShow) +{ + g_iShow = iShow; +} + /*! Sets the viewport of this QCustomPlot. Usually users of QCustomPlot don't need to change the viewport manually. diff --git a/logPlus/3rd_qcustomplot/v2_1/qcustomplot.h b/logPlus/3rd_qcustomplot/v2_1/qcustomplot.h index 963c656..3e9538e 100644 --- a/logPlus/3rd_qcustomplot/v2_1/qcustomplot.h +++ b/logPlus/3rd_qcustomplot/v2_1/qcustomplot.h @@ -4277,6 +4277,9 @@ public: return mOpenGl; } + //jyl 隐藏刻度 + void setShowScale(int iShow); + // setters: void setViewport(const QRect &rect); void setBufferDevicePixelRatio(double ratio); diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index b97746c..d34d742 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -19,7 +19,7 @@ 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; extern int g_iX2; @@ -116,8 +116,12 @@ void FormDraw::s_addLine(QString strUuid, QString strSlfName, QString strWellNam double dHight = 0; dHight = (g_iY2-g_iY1)*100.0/(double)g_iScale * g_dPixelPerCm; - - qDebug() << "FormDraw dHight=" << QString::number((int)dHight-3184); + if(g_iShow==1) + { + //显示刻度 + dHight = dHight+30; + } + qDebug() << "FormDraw dHight=" << QString::number((int)dHight); if(dHight>32767) { dHight = 32767; @@ -173,8 +177,13 @@ AppendConsole(PAI_INFO, "FormDraw s_AddLine_Property"); double dHight = 0; dHight = (g_iY2-g_iY1)*100.0/(double)g_iScale * g_dPixelPerCm; + if(g_iShow==1) + { + //显示刻度 + dHight = dHight+30; + } - qDebug() << "FormDraw dHight=" << QString::number((int)dHight-3184); + qDebug() << "FormDraw dHight=" << QString::number((int)dHight); if(dHight>32767) { dHight = 32767; @@ -230,8 +239,13 @@ void FormDraw::s_addWave(QString strUuid, QString strSlfName, QString strWellNam double dHight = 0; dHight = (g_iY2-g_iY1)*100.0/(double)g_iScale * g_dPixelPerCm; + if(g_iShow==1) + { + //显示刻度 + dHight = dHight+30; + } - qDebug() << "FormDraw dHight=" << QString::number((int)dHight-3184); + qDebug() << "FormDraw dHight=" << QString::number((int)dHight); if(dHight>32767) { dHight = 32767; @@ -284,8 +298,13 @@ void FormDraw::s_addTableLine(QString strUuid, QString strSlfName, QString strWe double dHight = 0; dHight = (g_iY2-g_iY1)*100.0/(double)g_iScale * g_dPixelPerCm; + if(g_iShow==1) + { + //显示刻度 + dHight = dHight+30; + } - qDebug() << "FormDraw dHight=" << QString::number((int)dHight-3184); + qDebug() << "FormDraw dHight=" << QString::number((int)dHight); if(dHight>32767) { dHight = 32767; @@ -1244,6 +1263,15 @@ void FormDraw::initTableLine(QMyCustomPlot *widget, QString strSlfName, QString widget->yAxis = xAxis; // DrawTabDip(widget); + + QString strAliasName = ""; + QString strUnit = ""; + QColor newlineColor=QColor(0,0,0); + double width=2; + QString strScaleType = ""; + //道-对象 + m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, vmax, vmin, strScaleType, "tableObject"); + } void FormDraw::CalcDipWidth(int nColumn,float *flWidth,float factor,int x1,int x2,float flHoriRatio) @@ -1285,12 +1313,18 @@ void FormDraw::DrawTabDip(QMyCustomPlot *widget) dgtord=3.14159265/180.; // m_nCircleWidth = 1; - m_nTailWidth = 1; - m_nRadius = 4; + m_nRadius = 6; m_crCircle = QColor(0,0,0); + // + m_nTailWidth = 2; + m_nTailLen = 10; m_crTail = QColor(0,0,0); - CalcDipWidth(9,flWidth, 1.2, 0, g_iOneWidth, 1.); + int iMyWidth = widget->axisRect(0)->width(); //setSizeConstraintRect() + int iMyHeight = widget->axisRect(0)->height(); //setSizeConstraintRect() + qDebug() << "iMyWidth=" << QString::number(iMyWidth) << ", iMyHeight=" << QString::number(iMyHeight); + + CalcDipWidth(9,flWidth, 1.2, 0, iMyWidth, 1.); n = m_FracDefList.count(); for (i=0; im_nRadius = m_nRadius; qcpItemEllipse->topLeft->setCoords(y, x);//圆心位置 qcpItemEllipse->bottomRight->setCoords(y, x);//圆心位置 - //qcpItemEllipse->setBrush(cBrush);//填充圆的颜色 + qcpItemEllipse->setBrush(cBrush);//填充圆的颜色 //方位 dr=frac.DIR *dgtord; + + // QCPItemStraightLine *qcpItemLine = new QCPItemStraightLine(widget); + // qcpItemLine->point1->setCoords(y, x);//圆心位置 + // qcpItemLine->point2->setCoords(y, x);//圆心位置 QCPItemLine *qcpItemLine = new QCPItemLine(widget); + qcpItemLine->start->setCoords(y, x);//圆心位置 + qcpItemLine->end->setCoords(y, x);//圆心位置 qcpItemLine->setPen(pPenTail); qcpItemLine->m_bCustom = true; qcpItemLine->m_nTailLen = m_nTailLen; //尾长 qcpItemLine->m_nRadius = m_nRadius; //半径 qcpItemLine->m_dr = dr; - qcpItemLine->start->setCoords(y, x);//圆心位置 - qcpItemLine->end->setCoords(y, x);//圆心位置 + //break; diff --git a/logPlus/formtrack.cpp b/logPlus/formtrack.cpp index 1efb59c..20602e0 100644 --- a/logPlus/formtrack.cpp +++ b/logPlus/formtrack.cpp @@ -48,6 +48,10 @@ FormTrack::FormTrack(QWidget *parent, QString strWellName, QString strTrackName) connect(this, SIGNAL(sig_AddWave(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString)), this, SLOT(s_addWave(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString))); + //波列 + connect(this, SIGNAL(sig_AddTableLine(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString)), + this, SLOT(s_AddTableLine(QString, QString, QString, QString, QString, QString, QColor, double, float, float, QString))); + //曲线选中,置顶 connect(CallManage::getInstance(), SIGNAL(sig_Raise(QString, QString, QString, QString, QString)), this, SLOT(s_Raise(QString, QString, QString, QString, QString))); @@ -181,7 +185,7 @@ void FormTrack::s_addWave(QString strSlfName, QString strWellName, QString strTr void FormTrack::s_AddTableLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType) { - qDebug() << "FormTrack s_addWave"; + qDebug() << "FormTrack s_AddTableLine"; ui->tableWidget->m_strUuid = m_strUuid; int row = ui->tableWidget->rowCount(); diff --git a/logPlus/formwell.cpp b/logPlus/formwell.cpp index a9fc8dc..dacc232 100644 --- a/logPlus/formwell.cpp +++ b/logPlus/formwell.cpp @@ -7,7 +7,7 @@ extern int g_iY1; extern int g_iY2; extern double g_dPixelPerCm;//每厘米像素数 extern int g_iScale; - +extern int g_iShow; //显示刻度 //井+道名 FormWell::FormWell(QWidget *parent, QString strWellName) : QWidget(parent), @@ -100,6 +100,11 @@ void FormWell::s_NewTrack(QString strUuid, QString strWellName, QString strSlfNa { double dHight = 0; dHight = (g_iY2-g_iY1)*100.0/(double)g_iScale * g_dPixelPerCm; + if(g_iShow==1) + { + //显示刻度 + dHight = dHight+30; + } if(dHight>32767) { dHight = 32767; @@ -192,6 +197,11 @@ void FormWell::s_NewTrack_No_Line(QString strUuid, QString strWellName, QString { double dHight = 0; dHight = (g_iY2-g_iY1)*100.0/(double)g_iScale * g_dPixelPerCm; + if(g_iShow==1) + { + //显示刻度 + dHight = dHight+30; + } if(dHight>32767) { dHight = 32767; diff --git a/logPlus/mainwindow.cpp b/logPlus/mainwindow.cpp index 68e6949..9d993a9 100644 --- a/logPlus/mainwindow.cpp +++ b/logPlus/mainwindow.cpp @@ -42,6 +42,9 @@ int g_iCanZoom = 0; int g_iScale = 200;//2500 QString g_prjname=""; +//是否隐藏刻度 +int g_iShow = 0; + MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) @@ -123,6 +126,11 @@ void MainWindow::ReadConfig() // qtCommon->readXyRange(configPath, g_iX1, g_iX2, g_iY1, g_iY2); + + //读取,是否隐藏刻度 + int iShow = 0; + qtCommon->readShowScale(configPath, iShow); + g_iShow = iShow; } CallManage* MainWindow::getInstanceCallManage() { diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index 2407724..47fa9f6 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -19,6 +19,7 @@ extern int g_iY1; extern int g_iY2; extern double g_dPixelPerCm;//每厘米像素数 extern int g_iScale; +extern int g_iShow; //显示刻度 extern int g_iRows; extern int g_iCols; @@ -450,6 +451,11 @@ void MainWindowCurve::s_NewWell(QString strWellName) { double dHight = 0; dHight = (g_iY2-g_iY1)*100.0/(double)g_iScale * g_dPixelPerCm; + if(g_iShow==1) + { + //显示刻度 + dHight = dHight+30; + } if(dHight>32767) { dHight = 32767; @@ -1122,6 +1128,11 @@ void MainWindowCurve::slot_time() double dHight = 0; dHight = (g_iY2-g_iY1)*100.0/(double)g_iScale * g_dPixelPerCm; + if(g_iShow==1) + { + //显示刻度 + dHight = dHight+30; + } if(dHight>32767) { dHight = 32767; diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 1ebc022..9d1468e 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -3,6 +3,9 @@ #include "geometryutils.h" #include "TransparentDraggableRect.h" +//是否隐藏刻度 +extern int g_iShow; + QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName) : QCustomPlot(parent) { @@ -17,9 +20,17 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel this->setNotAntialiasedElements(QCP::aeAll); // 关闭所有抗锯齿 //jyl - xAxis->setTickLabels(false); - yAxis->setTickLabels(false); + if(g_iShow==1) + { + yAxis->setTickLabels(true); + } + else + { + //隐藏刻度 + yAxis->setTickLabels(false); + } // + xAxis->setTickLabels(false); xAxis2->setTickLabels(false); yAxis2->setTickLabels(false); diff --git a/logPlus/qtcommonclass.cpp b/logPlus/qtcommonclass.cpp index 866d790..e6f1160 100644 --- a/logPlus/qtcommonclass.cpp +++ b/logPlus/qtcommonclass.cpp @@ -46,6 +46,16 @@ double QtCommonClass::readConfigSize(QString filePathName, int &iIndex, int &iNu return 0; } +//读取,是否隐藏刻度 +double QtCommonClass::readShowScale(QString filePathName, int &iShow) +{ + QSettings set(filePathName, QSettings::IniFormat); + set.beginGroup("config"); + iShow = set.value("iShow", "0").toInt(); + set.endGroup(); + + return 0; +} double QtCommonClass::readXyRange(QString filePathName, int &iX1, int &iX2, int &iY1, int &iY2) { QSettings set(filePathName, QSettings::IniFormat); diff --git a/logPlus/qtcommonclass.h b/logPlus/qtcommonclass.h index c896f16..1e96ce8 100644 --- a/logPlus/qtcommonclass.h +++ b/logPlus/qtcommonclass.h @@ -19,6 +19,8 @@ public: //读取 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); double readXyRange(QString filePathName, int &iX1, int &iX2, int &iY1, int &iY2);