#include "qmycustomplot.h" #include "CallManage.h" #include "geometryutils.h" #include "TransparentDraggableRect.h" #include "TransparentDraggableResult.h" #include "TransparentDraggableGeoLith.h" #include "TransparentDraggableSwallCore.h" #include "TransparentDraggableGujing.h" #include "transparentdraggableimage.h" #include "TransparentDraggableJiegutext.h" #include "TransparentDraggableMFac.h" #include "TransparentDraggablePhase.h" #include "TransparentDraggableFac.h" #include "transparentdraggableGuan.h" #include "TransparentDraggableLine.h" #include "transparentdraggableSelectRect.h" #include "transparentdraggableRightList.h" #include "qtcommonclass.h" #include "slf.h" //是否隐藏刻度 extern int g_iShow; QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName) : QCustomPlot(parent) { m_strSlfName = strSlfName; m_strWellName = strWellName; m_strTrackName = strTrackName; m_strLineName = strLineName; mSizeHandleManager = new QCPSizeHandleManager(this); setObjectName("QMyCustomPlot"); //this->setOpenGl(true);//不开启,电脑不支持会卡 // this->setNotAntialiasedElements(QCP::aeAll); // 关闭所有抗锯齿 m_newColor = Qt::black; // 开启抗锯齿 this->setAntialiasedElement(QCP::aeAll); //jyl if(g_iShow==1) { yAxis->setTickLabels(true); } else { //隐藏刻度 yAxis->setTickLabels(false); } // xAxis->setTickLabels(false); xAxis2->setTickLabels(false); yAxis2->setTickLabels(false); // make bottom and left axes transfer their ranges to top and right axes: connect(xAxis, SIGNAL(rangeChanged(QCPRange)), xAxis2, SLOT(setRange(QCPRange))); connect(yAxis, SIGNAL(rangeChanged(QCPRange)), yAxis2, SLOT(setRange(QCPRange))); // 在自定义类中 connect(this, SIGNAL(afterReplot()), this, SLOT(drawCustomElements())); //关联信号槽 //左刻度 connect(CallManage::getInstance(), SIGNAL(sig_ChangeLeftScale(QString, QString, QString, QString, QString, double)), this, SLOT(s_ChangeLeftScale(QString, QString, QString, QString, QString, double))); //右刻度 connect(CallManage::getInstance(), SIGNAL(sig_ChangeRightScale(QString, QString, QString, QString, QString, double)), this, SLOT(s_ChangeRightScale(QString, QString, QString, QString, QString, double))); //刻度类型 connect(CallManage::getInstance(), SIGNAL(sig_ChangeScaleType(QString, QString, QString, QString, QString, QString)), this, SLOT(s_ChangeScaleType(QString, QString, QString, QString, QString, QString))); //曲线选中,置顶 connect(CallManage::getInstance(), SIGNAL(sig_Raise(QString, QString, QString, QString, QString, int, QString)), this, SLOT(s_Raise(QString, QString, QString, QString, QString, int, QString))); //颜色 connect(CallManage::getInstance(), SIGNAL(sig_ChangeLineColor(QString, QString, QString, QString, QString, QColor)), this, SLOT(s_ChangeLineColor(QString, QString, QString, QString, QString, QColor))); //线宽 connect(CallManage::getInstance(), SIGNAL(sig_ChangeLineWidth(QString, QString, QString, QString, QString, double)), this, SLOT(s_ChangeLineWidth(QString, QString, QString, QString, QString, double))); //线型 connect(CallManage::getInstance(), SIGNAL(sig_ChangeLineStyle(QString, QString, QString, QString, QString, Qt::PenStyle)), this, SLOT(s_ChangeLineStyle(QString, QString, QString, QString, QString, Qt::PenStyle))); //岩性填充-不填充 connect(CallManage::getInstance(), SIGNAL(sig_ClearFillMode(QString, QString, QString, QString, QString)), this, SLOT(s_ClearFillMode(QString, QString, QString, QString, QString))); //岩性填充-填充 connect(CallManage::getInstance(), SIGNAL(sig_ChangeFillMode(QString, QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QString , QColor, QColor, QString, bool)), this, SLOT(s_ChangeFillMode(QString, QString, QString, QString, QString, QString, QString, QColor, QString, QString, float, float, QString, QColor, QColor, QString, bool))); //添加校深线段 connect(CallManage::getInstance(), SIGNAL(sig_AddShifLineToPlot(QString, QString, QString, QString, QString, double, double)), this, SLOT(s_AddShifLineToPlot(QString, QString, QString, QString, QString, double, double))); //清除当前分段线 connect(CallManage::getInstance(), SIGNAL(sig_DelSelectShiftLineFromPlot(QString, QString, QString, QString, QString)), this, SLOT(s_DelSelectShiftLineFromPlot(QString, QString, QString, QString, QString))); //清除全部分段线 connect(CallManage::getInstance(), SIGNAL(sig_DelAllShiftLineFromPlot(QString, QString, QString, QString, QString)), this, SLOT(s_DelAllShiftLineFromPlot(QString, QString, QString, QString, QString))); //执行校正 connect(CallManage::getInstance(), SIGNAL(sig_RuncorFromPlot(QString, QString, QString, QString, QString)), this, SLOT(s_RuncorFromPlot(QString, QString, QString, QString, QString))); //执行拼接 connect(CallManage::getInstance(), SIGNAL(sig_MergeFromPlot(QString, QString, QString, QString, QString)), this, SLOT(s_MergeFromPlot(QString, QString, QString, QString, QString))); //执行预览 connect(CallManage::getInstance(), SIGNAL(sig_PreMergeFromPlot(QString, QString, QString, QString, QString)), this, SLOT(s_PreMergeFromPlot(QString, QString, QString, QString, QString))); //采用右侧数据,执行预览 connect(CallManage::getInstance(), SIGNAL(sig_PreMerge_FromRightList(QString, QString, QString, QString, QString, QList, QList)), this, SLOT(s_PreMerge_FromRightList(QString, QString, QString, QString, QString, QList, QList))); //关闭预览框 connect(CallManage::getInstance(), SIGNAL(sig_PreMerge_Close(QString, QString, QString, QString, QString)), this, SLOT(s_PreMerge_Close(QString, QString, QString, QString, QString))); //Plot重新加载数据 connect(CallManage::getInstance(), SIGNAL(sig_ReloadPlot(QString, QString, QString)), this, SLOT(s_ReloadPlot(QString, QString, QString))); connect(CallManage::getInstance(), SIGNAL(sig_changeDrawProperty(QVariantList)), this, SLOT(s_changeDrawProperty(QVariantList))); } void QMyCustomPlot::changePropertyWaveUpdate() { if (m_nDrawType == 0 || m_nDrawType == 1) { if (this->m_colorMap) this->m_colorMap->setVisible(false); clearGraphs(); clearItems(); if (this->m_colorMap && this->m_bX2Y) { QCPAxis *yAxis = this->yAxis; QCPAxis *xAxis = this->xAxis; this->xAxis = yAxis; this->yAxis = xAxis; this->m_bX2Y = false; } this->initWave2(m_strSlfName, m_strLineName); } else if (m_nDrawType == 2) { if (this->m_colorMap) this->m_colorMap->setVisible(true); clearGraphs(); clearItems(); this->m_bX2Y = true; this->initWave(m_strSlfName, m_strLineName); } } void QMyCustomPlot::initWave(QString strSlfName, QString strWaveName) { CLogIO *logio = new CLogIO(); logio->Open(strSlfName.toStdString().c_str(), CSlfIO::modeRead); // int index = logio->OpenWave(strWaveName.toStdString().c_str()); if (index < 0) { delete logio; return; } QMyCustomPlot* widget = this; Slf_WAVE _wave; logio->GetWaveInfo(index, &_wave); float _SDep, _EDep, _Rlev; _SDep = _wave.StartDepth; _EDep = _wave.EndDepth; // _SDep = 0.0 - m_iY2; // _EDep = 0.0 - m_iY1; _Rlev = _wave.DepLevel; int m_Record = (float)(fabs((_EDep - _SDep) / _Rlev + 0.5)); int _nSamples = _wave.TimeSamples; if (m_fScaleV <= 0.0f) m_fScaleV = _nSamples; char *value = new char[(_nSamples + 1)*m_Record*_wave.CodeLen + 1]; logio->ReadWave(index, _SDep, m_Record, (void *)value); logio->CloseWave(index); delete logio; bool bFistValue = false; float vmax = -9999;//(float)_nSamples; float vmin = -9999; // double** wavedata = widget->getWavedata(_nSamples, m_Record); //wavedata = new double*[_nSamples]; //for(int kk = 0;kk<_nSamples;kk++){ // wavedata[kk] = new double[m_Record]; //} for (int i = 0; i < m_Record; i++) { for (int kk = 0; kk < _nSamples; kk++) { double val = GetData(_wave.RepCode, (char *)&value[(kk)*_wave.CodeLen + i * _nSamples*_wave.CodeLen]); wavedata[kk][i] = val; if (val == -9999) { continue; } if (bFistValue == false) { //最大值,最小值默认采用第一个有效值 bFistValue = true; vmax = vmin = val; } // if (vmax < val)vmax = val; if (vmin > val)vmin = val; } } delete[] value; // m_iY1 = 0.0 -_EDep; // m_iY2 = 0.0 -_SDep; //------------------------ widget->m_iY1 = m_iY1; widget->m_iY2 = m_iY2; // widget->xAxis->setRange(vmin, vmax); widget->yAxis->setRange(m_iY1, m_iY2); widget->axisRect()->setupFullAxesBox(); // widget->xAxis->ticker()->setTickCount(10);//x个主刻度 widget->yAxis->ticker()->setTickCount(60);//y个主刻度 widget->xAxis->setTicks(false); widget->yAxis->setTicks(false); widget->xAxis2->setTicks(false); widget->yAxis2->setTicks(false); //对调XY轴,在最前面设置 QCPAxis *yAxis = widget->yAxis; QCPAxis *xAxis = widget->xAxis; widget->xAxis = yAxis; widget->yAxis = xAxis; widget->m_fmin = vmin; widget->m_fmax = vmax; //------------------- // set up the QCPColorMap: if (widget->m_colorMap == NULL) { QCPColorMap *colorMap = new QCPColorMap(widget->xAxis, widget->yAxis); widget->m_colorMap = colorMap; int nx = m_Record; int ny = _nSamples; colorMap->data()->setSize(nx, ny); // 我们希望彩色地图有nx*ny的数据点 //colorMap->data()->setRange(QCPRange(m_iY1, m_iY2), QCPRange(vmin, vmax)); // 并在键(x)和值(y)维上跨越坐标范围-4..4 colorMap->data()->setRange(QCPRange(0 - _EDep, 0 - _SDep), QCPRange(vmin, vmax)); // :现在,我们通过访问颜色贴图的QCPColorMapData实例来分配一些数据: this->updateWave(); // 添加色标: QCPColorScale *colorScale = new QCPColorScale(widget); colorMap->setColorScale(colorScale); // 将颜色图与色标关联 // 重新缩放数据维度(颜色),以使所有数据点都位于颜色渐变显示的范围内: colorMap->rescaleDataRange(); this->setSchemeIndex(m_nSchemeIndex, m_nColorNum); } else { this->updateWave(); } } void QMyCustomPlot::initWave2(QString strSlfName, QString strWaveName) { QMyCustomPlot* widget = this; CLogIO *logio = new CLogIO(); logio->Open(strSlfName.toStdString().c_str(), CSlfIO::modeRead); // int index = logio->OpenWave(strWaveName.toStdString().c_str()); if (index < 0) { delete logio; return; } float vmax = 264;// (float)_nSamples; float vmin = 0; //widget->m_iX1 = vmin; //widget->m_iX2 = vmax; // widget->xAxis->setRange(vmin, vmax); widget->yAxis->setRange(m_iY1, m_iY2); widget->axisRect()->setupFullAxesBox(); // widget->xAxis->setTicks(false); widget->yAxis->setTicks(false); widget->xAxis2->setTicks(false); widget->yAxis2->setTicks(false); //注意,不对调XY轴 widget->m_bX2Y = false; Slf_WAVE _wave; logio->GetWaveInfo(index, &_wave); float m_SDep = _wave.StartDepth; float m_EDep = _wave.EndDepth; float m_Rlev = _wave.DepLevel; int m_Record = (float)(fabs((m_EDep - m_SDep) / m_Rlev + 0.5)); int _nSamples = _wave.TimeSamples; char *value = new char[(_nSamples + 1)*m_Record*_wave.CodeLen + 1]; logio->ReadWave(index, m_SDep, m_Record, (void *)value); logio->CloseWave(index); delete logio; MyDataTypeEnum vVdl; int lpoint = 0; int nPoint = _nSamples; float detp = -m_iY2; float edepc = -m_iY1; float m_PlotSdep = -m_iY2; float m_MoveDep = 0.0f; float DifBase = (m_MaxRange - m_Base) / 1; float yscale = m_nWaveHei; yscale = yscale / DifBase; int nStep = m_nWaveJg;// mWaveMes.m_WaveSpace; if (m_nWaveJg < 10) nStep = 10; if (nStep < 1) nStep = 1; float m_r = m_Rlev * nStep; detp = int((detp - m_PlotSdep) / m_r)*m_r + m_PlotSdep; int nOdd = 0; int nidx = 0; for (float dep1 = detp - m_r; dep1 < edepc + m_MoveDep + m_r; dep1 += m_r) { if (dep1 >= m_EDep || dep1 + m_r < m_SDep) { continue; } int iIndex = Slf_Int(dep1 + m_MoveDep, m_SDep, m_Rlev); if (iIndex < 0) { continue; } QVector vals; if (iIndex < 0 || iIndex >= m_Record) continue; vals.resize(nPoint); vVdl.vchar = &((char *)value)[iIndex*_nSamples*_wave.CodeLen]; for (int i = 0; i < nPoint; i++) { float ch = 0.0f; if (i + lpoint < 0) ch = 0; else if (i + lpoint < _nSamples) { if (_wave.RepCode == REPR_CHAR) { ch = vVdl.vchar[i + lpoint]; } else if (_wave.RepCode == REPR_UCHAR) { ch = vVdl.vuchar[i + lpoint]; } else if (_wave.RepCode == REPR_SHORT) { ch = vVdl.vshort[i + lpoint]; if (ch == -32767) ch = 0; } else if (_wave.RepCode == REPR_USHORT) { ch = vVdl.vushort[i + lpoint]; if ((short)ch == -32767) ch = 0; } else if (_wave.RepCode == REPR_FLOAT) { ch = vVdl.vfloat[i + lpoint]; } else ch = GetData(_wave.RepCode, (char *)&vVdl.vchar[(i + lpoint)*_wave.CodeLen]); if (ch == -9999.0 || ch == -99999.0 || ch == -999.25) ch = 0; } else ch = 0; vals[i] = ch; } QVector vx; QVector vy; double dminy = 0.0; for (int i = 0; i < nPoint; i++) { vx << i; double d = (-dep1 - 1) + vals[i] * yscale; vy << d; if (d < dminy) dminy = d; } QCPGraph * graph0 = widget->graph(nidx); if (graph0 == NULL) { graph0 = widget->addGraph(); graph0->setPen(QPen(m_newColor)); } if (m_nDrawType == 0 && m_bOddEven) // 波形&&奇偶配色 { if (nOdd % 2 == 1) graph0->setPen(QPen(QColor(255, 0, 0))); } graph0->setData(vx, vy); if (m_bDrawDepth) { QCPItemText* pText = new QCPItemText(this); pText->setText(QString::number(dminy*-1, 'f', 2)); pText->position->setCoords(30, dminy); if (m_bOddEven && nOdd % 2 == 1) pText->setColor(QColor(255, 0, 0)); else pText->setColor(m_newColor); } //graph->setBrush(QBrush(QColor(255, 0, 0, 100))); nidx++; if (m_bDrawBase || m_nDrawType == 1) // 填充 || 绘制波基线 { QCPGraph * graph1 = widget->graph(nidx); if (graph1 == NULL) { graph1 = widget->addGraph(); graph1->setPen(QPen(m_newColor)); } if (m_bOddEven && nOdd % 2 == 1) graph1->setPen(QPen(QColor(255, 0, 0))); double dx1 = vx[0]; double dx2 = vx[vx.size() - 1]; vx.clear(); vx << dx1 << dx2; vy.clear(); vy << dminy << dminy; graph1->setData(vx, vy); nidx++; if (m_nDrawType == 1) { graph0->setBrush(QBrush(m_newColor)); graph0->setChannelFillGraph(graph1); } } nOdd++; } widget->replot(); delete[]value; } void QMyCustomPlot::initColorTable() { this->setSchemeIndex(m_nSchemeIndex, m_nColorNum); } void QMyCustomPlot::setSchemeIndex(int nidx, int colorNum) { if (m_colorMap == NULL) return; m_nSchemeIndex = nidx; m_nColorNum = colorNum; QtColorTableData::getInstance()->SetCurrentSchemeIndex(nidx); //ColorTableIndex = ind; QtColorTableData::getInstance()->ChangeColorNum(colorNum); QList rgbList = QtColorTableData::getInstance()->GetRgb(); int iColorNum = rgbList.size(); QCPColorGradient gradient; for (int i = 0; i < iColorNum; i++) { QColor acolor = rgbList.at(i); double dbTmpIndex = (double)(i) / iColorNum; gradient.setColorStopAt(dbTmpIndex, acolor); // x% 位置的颜色 //mWaveMes.m_ColorMessage.Color[i] = acolor; } m_colorMap->setGradient(gradient); } double** QMyCustomPlot::getWavedata(int nrow, int ncol) { if (nrow > 0 && m_wavedata) { for (int i = 0; i < m_nRow; i++) { if (m_wavedata[i]) { delete[] m_wavedata[i]; } } delete[] m_wavedata; m_wavedata = NULL; } m_nRow = nrow; m_nCol = ncol; m_wavedata = new double*[nrow]; for (int kk = 0; kk < nrow; kk++) { m_wavedata[kk] = new double[ncol]; } return m_wavedata; } QCPColorMap * QMyCustomPlot::updateWave() { int nx = m_nCol; int ny = m_nRow; // :现在,我们通过访问颜色贴图的QCPColorMapData实例来分配一些数据: double x, y, z; for (int xIndex = 0; xIndex < nx; ++xIndex) { for (int yIndex = 0; yIndex < ny; ++yIndex) { double dz = m_wavedata[yIndex][xIndex]; if (m_nMode == 0) { if (m_wavedata[yIndex][xIndex] == -9999) { dz = m_fmax; } } else if (m_nMode == 1) { if (m_wavedata[yIndex][xIndex] == -9999) { dz = m_fmin; } } else if (m_nMode == 2) { if (m_wavedata[yIndex][xIndex] == -9999) { dz = m_fmax; } else { dz = m_fmin; } } m_colorMap->data()->setCell(nx - xIndex - 1, yIndex, dz); } } return m_colorMap; } float QMyCustomPlot::getScaleV() { return m_fScaleV; } //蝌蚪图,重绘网格线 void QMyCustomPlot::drawCustomElements() { QCPPainter painter(this); //if(!mKedou) { return; } // 绘制自定义背景网格 painter.setPen(QPen(QColor(220, 0, 0), 0, Qt::DotLine)); for (int i=0; i<10; ++i) { double x = xAxis->range().lower + i*xAxis->range().size()/10.0; QPointF p1; QPointF p2; p1.setX(xAxis->coordToPixel(x)); p1.setY(yAxis->coordToPixel(yAxis->range().lower)); // p2.setX(xAxis->coordToPixel(x)); p2.setY(yAxis->coordToPixel(yAxis->range().upper)); // painter.drawLine(p1,p2); } // 绘制自定义标记 painter.setPen(Qt::NoPen); painter.setBrush(QColor(255, 100, 100, 150)); painter.drawEllipse(QPointF(xAxis->coordToPixel(5.0), yAxis->coordToPixel(0.5)), 20, 20); } void QMyCustomPlot::init(QString strName, QVector xx, QVector yy0) { //raise(); //置于上层显示 } //void QMyCustomPlot::mousePressEvent(QMouseEvent *event) //{ // //qDebug() << "mousePress"; // QCustomPlot::mousePressEvent(event); //} void QMyCustomPlot::mousePressEvent(QMouseEvent *event) { // if (event->button() == Qt::LeftButton) { // if (auto *item = itemAt(event->pos(), true)) { // emit mousePress(event); // 由于我们直接返回了,所以要负责将鼠标点击信号发送出去 // // deselectAll(); // mMousePress = true; // mLastPos = event->pos(); // item->setSelected(true); // replot(); // return; // 如果点击的是一个item直接返回,不然QCustomPlot会把事件传递给其它的层对象(例如:轴矩形) // } // } if(m_bDrawCore_PHYSICS)//岩心分析 { //获取鼠标点位置 double x_pos = event->pos().x(); double y_pos = event->pos().y(); double x_val; double y_val; //转为图像位置 x_val = xAxis->pixelToCoord(y_pos); //曲线关联在左右轴判断 y_val = yAxis->pixelToCoord(x_pos); //从选择中获取数据区间 QCPDataRange range; if(graph(0)->selected()){ range = graph(0)->selection().dataRange(); } // 检查选定的区间是否是单个数据点 if (range.size() == 1) { // 获取选定的数据点的下标范围 dataIndex = range.begin(); // 执行特定操作,例如输出下标: }else{ dataIndex = -1; return; } double xx = graph(0)->data()->at(dataIndex)->key; // double yy = graph(0)->data()->at(dataIndex)->value; //// double newYPoint = y_val / yy; //曲线Y轴数据 m_y.at(dataIndex) //// double xDistand = abs(x_val - xx); //曲线X轴数据 m_x.at(dataIndex) //// //鼠标位距离数据点位置判断 //// if (newYPoint > 0.2 && newYPoint < 3 && xDistand < 5) { //// //在此范围(自由设计)则表示选中数据点 //// dataIndex = dataIndex; //// }else{ //// dataIndex = -1; //// } singleOldPosition = xx; //记录了该点在曲线中Y轴的值 m_y.at(dataIndex) singleDragMove = true; } QCustomPlot::mousePressEvent(event); } void QMyCustomPlot::mouseMoveEvent(QMouseEvent *event) { QCustomPlot::mouseMoveEvent(event); // if (mMousePress) { // auto items = selectedItems(); // foreach (auto *item, items) { // if (auto *sizeHandle = qobject_cast(item)) // { // mSizeHandleManager->handleItemResize(sizeHandle, event->pos() - mLastPos); // 控制item缩放 // } // else // { // mSizeHandleManager->handleItemMove(item, event->pos() - mLastPos); // 控制item移动 // } // } // mLastPos = event->pos(); // replot(); // } // else if(m_bDrawCore_PHYSICS)//岩心分析 { if(singleDragMove){ executeSingle(event); } } else { // 当前鼠标位置(像素坐标) //int x_pos = event->pos().x(); int y_pos = event->pos().y(); // 像素坐标转成实际的x,y轴的坐标 //float x_val = yAxis->pixelToCoord(x_pos); float y_val = xAxis->pixelToCoord(y_pos); emit CallManage::getInstance()->sig_MouseMove(m_strUuid, m_strWellName, m_strTrackName, 0-y_val); } } void QMyCustomPlot::mouseReleaseEvent(QMouseEvent *event) { // if (mMousePress) { // mMousePress = false; // if (auto *item = itemAt(event->pos(), true)) { // emit mouseReleaseEvent(event); // 由于我们直接返回了,所以要负责将鼠标点击信号发送出去 // item->setSelected(false); // replot(); // return; // } // } if(m_bDrawCore_PHYSICS)//岩心分析 { dataIndex = -1; singleDragMove = false; //setCursor(Qt::ArrowCursor); replot(QCustomPlot::rpQueuedReplot); } QCustomPlot::mouseReleaseEvent(event); } //单点移动功能 void QMyCustomPlot::executeSingle(QMouseEvent *event) { try { if(dataIndex == -1) { return; } //获取鼠标信息 int x_pos = event->pos().x(); int y_pos = event->pos().y(); // double x_val = xAxis->pixelToCoord(x_pos); // double y_val = yAxis->pixelToCoord(y_pos); double x_val; double y_val; //转为图像位置 x_val = xAxis->pixelToCoord(y_pos); //曲线关联在左右轴判断 y_val = yAxis->pixelToCoord(x_pos); //double xx = graph(0)->data()->at(dataIndex)->key; //double yy = graph(0)->data()->at(dataIndex)->value; // //获取数据改变鼠标的形状 // double newYPoint = y_val / yy; // double xDistand = abs(x_val - xx); // if (newYPoint > 0.2 && newYPoint < 3 && xDistand < 5) { // customPlot->setCursor(Qt::ClosedHandCursor); // }else{ // customPlot->setCursor(Qt::ArrowCursor); // } //更新曲线数据中拖动的那个点数据 for(int i =0; idata()->clear(); graph(0)->setData(m_x, m_y); // graph(0)->data()->remove(dataIndex); // graph(0)->addData(singleOldPosition, y_val); //更新曲线数据 replot(QCustomPlot::rpQueuedReplot); //刷新曲线 } catch (...) { //FERROR("系统发异常!"); } } //槽函数,选中曲线 void QMyCustomPlot::s_LineClicked(int index) { // qDebug() << "s_LineClicked"; // //全部取消选中 // deselectAll(); // //重新选中 // QCPGraph *graph = this->graph(index); // if (graph) // { // //qDebug() << "s_LineClicked graph"; // graph->setSelection(QCPDataSelection(graph->data()->dataRange())); // QCPPlottableLegendItem *item = legend->itemWithPlottable(graph); // if (item) // { // //qDebug() << "s_LineClicked item"; // //仅显示当前被选中的曲线 // item->setSelected(true); // replot(); // } // } } void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event) { m_event = event; //曲线 if(m_addRandomGraph) { QMenu menu(this); menu.addAction(QIcon(::GetImagePath() + "icon/ZonePoint.png"), "添加分段线", this, &QMyCustomPlot::onAddShiftLine); menu.addAction(QIcon(::GetImagePath() + "icon/ClearZonePoint.png"), "清除当前分段线", this, &QMyCustomPlot::onDelSelectShiftLine); menu.addAction(QIcon(::GetImagePath() + "icon/ClearZone.png"), "清除全部分段线", this, &QMyCustomPlot::onDelAllShiftLine); menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑曲线", this, &QMyCustomPlot::onEditLine); menu.exec(event->globalPos()); } // QAction *resetAction = menu.addAction("添加框图"); // connect(resetAction, &QAction::triggered, this, &QMyCustomPlot::onAddRect); // if (selectedGraphs().size() > 0)//选中曲线 // { // menu.addAction("删除选中曲线", this, SLOT(removeSelectedGraph())); // } } //右键--添加分段线 void QMyCustomPlot::onAddShiftLine() { double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度 double left_Low = right_Hight; //通知界面,增加一条校深线段 emit CallManage::getInstance()->sig_AddShiftLine(m_strUuid, left_Low, right_Hight); } //右键--清除当前分段线 void QMyCustomPlot::onDelSelectShiftLine() { //通知界面,清除当前分段线 emit CallManage::getInstance()->sig_DelSelectShiftLine(m_strUuid); } //右键--清除全部分段线 void QMyCustomPlot::onDelAllShiftLine() { //通知界面,清除全部分段线 emit CallManage::getInstance()->sig_DelAllShiftLine(m_strUuid); } //右键--编辑曲线 void QMyCustomPlot::onEditLine() { if(m_bEditRect) { QMessageBox::information(nullptr, "提示", "当前正在编辑曲线,请先完成编辑!"); return; } this->setInteractions(QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables | QCP::iMultiSelect); // 轴、图例、图表可以被选择,并且是多选的方式 this->setSelectionRectMode(QCP::srmCustom); // 鼠标框选 if(m_bFirstTimeConnect) { //信号槽只绑定一次,避免重复绑定 m_bFirstTimeConnect = false; for (int i=0; i < this->graphCount(); ++i) { QCPGraph *graph = this->graph(i); graph->setSelectable(QCP::stDataRange); break; } connect(this->selectionRect(), &QCPSelectionRect::accepted, [this](){ if(this->m_bDrawRect == false) { this->m_bDrawRect = true; return; } // 当选择完成时,获取矩形范围并放大 QRectF rect = this->selectionRect()->rect(); // 获取选择的矩形区域(像素坐标) m_bEditRect=true;//当前是否正在编辑曲线。 // 转换为坐标轴范围 double top = rect.top(); double bottom = rect.bottom(); double right_Hight = this->xAxis->pixelToCoord(top); double left_Low = this->xAxis->pixelToCoord(bottom); float rlev=0; if(m_x.size()>=2) { rlev = abs(m_x[1] - m_x[0]); } // int left_Low_Number=0; int right_Hight_Number=0; for(int i =0; i= (3*rlev) )//至少选中5个点 { // for (int j=right_Hight_Number; jsetPen(QPen(Qt::blue)); // qcpItemLine->setLayer("overlay"); // 确保在最上层 // qcpItemLine->start->setCoords(this->m_x[j], this->m_y[j]); // qcpItemLine->end->setCoords(this->m_x[j+1], this->m_y[j+1]); // } // this->replot(); // QPixmap p = this->grab(QRect(rect.x(), rect.y(), rect.width(), rect.height())); // p.save("./Rectpicture.png", "png"); //添加图形 this->addSelectRectToPlot(m_x[left_Low_Number], m_x[right_Hight_Number], left_Low_Number, right_Hight_Number);//left_Low, right_Hight //取消框选 this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables); this->setSelectionRectMode(QCP::srmNone); } }); } } void QMyCustomPlot::onAddRect() { double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度 double left_Low = right_Hight-5; //添加图形 //emit CallManage::getInstance()->sig_addImageToPlot(this, left_Low, right_Hight, ":/image/file.png"); addImageToPlot(left_Low, right_Hight, ":/image/file.png"); } void QMyCustomPlot::addImageToPlot(double left_Low, double right_Hight, const QString imagePath) { QtCommonClass *qtCommon = new QtCommonClass(this); QString strUuid = qtCommon->getUUid(); // 在初始化代码中 TransparentDraggableImage *dragRect = new TransparentDraggableImage(this, strUuid); //图片,提前设值,后面setRange改变 dragRect->setResult(imagePath); // 设置初始范围 dragRect->setRange(left_Low, right_Hight); // 可选:设置颜色 dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色 //最小宽度 dragRect->setMinWidth(0.1); //dragRect->setTitle(strText); m_mapDraggable_Image[strUuid] = dragRect; } void QMyCustomPlot::addSelectRectToPlot(double left_Low, double right_Hight, int left_Low_Number, int right_Hight_Number) { //qDebug() << "QMyCustomPlot addSelectRectToPlot"; QtCommonClass *qtCommon = new QtCommonClass(this); QString strUuid = qtCommon->getUUid(); // 在初始化代码中 TransparentDraggableSelectRect *dragRect = new TransparentDraggableSelectRect(this, strUuid); //图片,提前设值,后面setRange改变 dragRect->setNumber(left_Low_Number, right_Hight_Number); // 设置初始范围 dragRect->setRange(left_Low, right_Hight); // 可选:设置颜色 dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色 //最小宽度 dragRect->setMinWidth(0.1); //dragRect->setTitle(strText); m_mapDraggable_SelectRect[strUuid] = dragRect; } //预览 void QMyCustomPlot::addRightListToPlot( QList new_DepthList, QList new_ValueListt) { //qDebug() << "QMyCustomPlot addSelectRectToPlot"; QtCommonClass *qtCommon = new QtCommonClass(this); QString strUuid = qtCommon->getUUid(); // 在初始化代码中 TransparentDraggableRightList *dragRect = new TransparentDraggableRightList(this, strUuid); //图片,提前设值,后面setRange改变 dragRect->setRightList(new_DepthList, new_ValueListt); // 设置初始范围 dragRect->setRange(new_DepthList[new_DepthList.size()-1], new_DepthList[0]); // 可选:设置颜色 dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色 //最小宽度 dragRect->setMinWidth(0.1); //dragRect->setTitle(strText); m_mapDraggable_RightList[strUuid] = dragRect; } //校深线段 void QMyCustomPlot::s_AddShifLineToPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double left_Low, double right_Hight) { if(m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_strLineName == strLineName) { } else { return; } addLineToPlot(left_Low, right_Hight, ""); } //清除当前分段线 void QMyCustomPlot::s_DelSelectShiftLineFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName) { if(m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_strLineName == strLineName) { } else { return; } if(m_SelectShiftLine) { TransparentDraggableLine *pDraggableLine = (TransparentDraggableLine *)m_SelectShiftLine; pDraggableLine->deleteRect(); } } //清除全部分段线 void QMyCustomPlot::s_DelAllShiftLineFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName) { if(m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_strLineName == strLineName) { } else { return; } TransparentDraggableLine *pDraggableLine =NULL; QMap::Iterator it = m_mapDraggable_Line.begin(); while( it != m_mapDraggable_Line.end() ) { pDraggableLine = (TransparentDraggableLine*)it.value(); it++; pDraggableLine->deleteRect(); } } //执行校正 void QMyCustomPlot::s_RuncorFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName) { if(m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_strLineName == strLineName) { } else { return; } QList left_Low_List; QList right_Hight_List; TransparentDraggableLine *pDraggableLine =NULL; QMap::Iterator it = m_mapDraggable_Line.begin(); while( it != m_mapDraggable_Line.end() ) { pDraggableLine = (TransparentDraggableLine*)it.value(); left_Low_List.append(0-pDraggableLine->m_left_Low); right_Hight_List.append(0-pDraggableLine->m_right_Hight); // it++; } if(left_Low_List.size()<=0) { QMessageBox::warning(nullptr, "提示", "无校正深度线或深度移动量!"); return; } //执行校正 emit CallManage::getInstance()->sig_Runcor_List(m_strUuid, left_Low_List, right_Hight_List); } //执行拼接 void QMyCustomPlot::s_MergeFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName) { if(m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_strLineName == strLineName) { } else { return; } QList left_Low_List; QList right_Hight_List; TransparentDraggableLine *pDraggableLine =NULL; QMap::Iterator it = m_mapDraggable_Line.begin(); while( it != m_mapDraggable_Line.end() ) { pDraggableLine = (TransparentDraggableLine*)it.value(); left_Low_List.append(0-pDraggableLine->m_left_Low); right_Hight_List.append(0-pDraggableLine->m_right_Hight); // it++; } if(left_Low_List.size()<=0) { QMessageBox::warning(nullptr, "提示", "曲线拼接深度点不存在,无法拼接!请先设置拼接深度点。"); return; } //执行拼接 emit CallManage::getInstance()->sig_Merge_List(m_strUuid, left_Low_List, right_Hight_List); } //关闭预览框 void QMyCustomPlot::s_PreMerge_Close(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName) { if(m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_strLineName == strLineName) { } else { return; } TransparentDraggableRightList *pDraggableRect =NULL; { QMap::Iterator it = this->m_mapDraggable_RightList.begin(); if( it != this->m_mapDraggable_RightList.end() ) { pDraggableRect = (TransparentDraggableRightList*)it.value(); pDraggableRect->deleteRect(); } } } void QMyCustomPlot::s_PreMerge_FromRightList(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QList new_DepthList, QList new_ValueList) { if(m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_strLineName == strLineName) { } else { return; } //预览 addRightListToPlot(new_DepthList, new_ValueList); } //执行预览 void QMyCustomPlot::s_PreMergeFromPlot(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName) { if(m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_strLineName == strLineName) { } else { return; } QList left_Low_List; QList right_Hight_List; TransparentDraggableLine *pDraggableLine =NULL; QMap::Iterator it = m_mapDraggable_Line.begin(); while( it != m_mapDraggable_Line.end() ) { pDraggableLine = (TransparentDraggableLine*)it.value(); left_Low_List.append(0-pDraggableLine->m_left_Low); right_Hight_List.append(0-pDraggableLine->m_right_Hight); // it++; } if(left_Low_List.size()<=0) { QMessageBox::warning(nullptr, "提示", "曲线拼接深度点不存在,无法拼接!请先设置拼接深度点。"); return; } //执行预览 emit CallManage::getInstance()->sig_PreMerge_List(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, left_Low_List, right_Hight_List); } //Plot重新加载数据 void QMyCustomPlot::s_ReloadPlot(QString strUuid, QString strSlfName, QString strLineName) { if(m_strSlfName == strSlfName && m_strLineName == strLineName) { } else { return; } //读取slf CLogIO *logio=new CLogIO(); logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead); // int index=logio->OpenCurve(strLineName.toStdString().c_str()); if(index<0) { delete logio; return; } Slf_CURVE curveinfo; float *val; DWORD count; float sdep,edep,rlev; // logio->GetCurveInfo(index,&curveinfo); sdep=curveinfo.StartDepth; edep=curveinfo.EndDepth; rlev=curveinfo.DepLevel; // count=(curveinfo.EndDepth-curveinfo.StartDepth)/curveinfo.DepLevel+1.5; val=new float[count]; logio->ReadCurve(index,curveinfo.StartDepth,count,&val[0]); logio->CloseCurve(index); delete logio; //slf文件读取曲线 QVector x, y; for(int i=0; idata()->clear(); graph(0)->setData(m_x, m_y); replot(QCustomPlot::rpQueuedReplot); //刷新曲线 } void QMyCustomPlot::s_changeDrawProperty(QVariantList vlist) { QString strUuid = vlist.at(0).toString(); QString strSlfName = vlist.at(1).toString(); QString strWellName = vlist.at(2).toString(); QString strTrackName = vlist.at(3).toString(); QString strLineName = vlist.at(4).toString(); if (m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_strLineName == strLineName) { QString strProperty = vlist.at(5).toString(); QVariant varVal = vlist.at(6).toString(); if ("类型" == strProperty) { m_nDrawType = varVal.toInt(); this->changePropertyWaveUpdate(); } else if ("绘制波深度" == strProperty) { m_bDrawDepth = varVal.toBool(); this->changePropertyWaveUpdate(); } else if ("绘制波基线" == strProperty) { m_bDrawBase = varVal.toBool(); this->changePropertyWaveUpdate(); } else if ("奇偶配色" == strProperty) { m_bOddEven = varVal.toBool(); this->changePropertyWaveUpdate(); } else if ("波列基值" == strProperty) { m_Base = varVal.toFloat(); this->changePropertyWaveUpdate(); } else if ("波形间隔" == strProperty) { m_nWaveJg = varVal.toInt(); this->changePropertyWaveUpdate(); } else if ("波形高度" == strProperty) { m_nWaveHei = varVal.toInt(); this->changePropertyWaveUpdate(); } else if ("颜色" == strProperty) { m_newColor = varVal.value(); this->changePropertyWaveUpdate(); } else if ("方式" == strProperty) { m_nMode = varVal.toFloat(); this->updateWave(); } else if ("左刻度" == strProperty) { } else if ("右刻度" == strProperty) { if (m_colorMap) { m_fScaleV = varVal.toFloat(); float f = 264 / m_fScaleV; m_colorMap->data()->setValueRange(QCPRange(m_fmin, m_fmax*f)); } } else if ("最大振幅" == strProperty) { m_MaxRange = varVal.toDouble(); this->changePropertyWaveUpdate(); } else if ("色板" == strProperty) { this->setSchemeIndex(varVal.toInt(), m_nColorNum); } else if ("变密度颜色级数" == strProperty) { this->setSchemeIndex(m_nSchemeIndex, varVal.toInt()); } this->replot(); } } void QMyCustomPlot::addLineToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor) { QtCommonClass *qtCommon = new QtCommonClass(this); QString strUuid = qtCommon->getUUid(); // 在初始化代码中 TransparentDraggableLine *dragRect = new TransparentDraggableLine(this, strUuid); // 设置初始范围 dragRect->setRange(left_Low, right_Hight); // 可选:设置颜色 dragRect->setColor(crColor); // 半透明白色 //最小宽度 dragRect->setMinWidth(0.1); dragRect->setTitle(strText); m_mapDraggable_Line[strUuid] = dragRect; } void QMyCustomPlot::addTextToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor) { QtCommonClass *qtCommon = new QtCommonClass(this); QString strUuid = qtCommon->getUUid(); // 在初始化代码中 TransparentDraggableRect *dragRect = new TransparentDraggableRect(this, strUuid); // 设置初始范围 dragRect->setRange(left_Low, right_Hight); // 可选:设置颜色 dragRect->setColor(crColor); // 半透明白色 //最小宽度 dragRect->setMinWidth(0.1); dragRect->setTitle(strText); m_mapDraggable_Rect[strUuid] = dragRect; } void QMyCustomPlot::addResultToPlot(double left_Low, double right_Hight, QString myResult, QString &strUuid, QString strText) { //获取上方Rect TransparentDraggableResult *upDragRect = nullptr; if(strUuid!="") { upDragRect = (TransparentDraggableResult *)m_mapDraggable_Result[strUuid]; } // QtCommonClass *qtCommon = new QtCommonClass(this); strUuid = qtCommon->getUUid(); // 在初始化代码中 TransparentDraggableResult *dragRect = new TransparentDraggableResult(this, upDragRect, strUuid); //图片,提前设值,后面setRange改变 dragRect->setResult(myResult); // 设置初始范围 dragRect->setRange(left_Low, right_Hight); // 可选:设置颜色 dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色 //最小宽度 dragRect->setMinWidth(0.1); dragRect->setTitle(strText); m_mapDraggable_Result[strUuid] = dragRect; } void QMyCustomPlot::addSwallCoreToPlot(double Depth, QString LithologyImage, QString OilGasImage, QString ColorImage, double Sideleft, double width, int ind) { QtCommonClass *qtCommon = new QtCommonClass(this); QString strUuid = qtCommon->getUUid(); // 在初始化代码中 TransparentDraggableSwallCore *dragRect = new TransparentDraggableSwallCore(this, strUuid); //图片,提前设值,后面setRange改变 dragRect->setOil(OilGasImage); dragRect->setLith(LithologyImage); dragRect->setTitle(QString::number(ind)); // 设置初始范围 double h = 40; double x1 = this->xAxis->coordToPixel(Depth); // double Depth2 = this->xAxis->pixelToCoord(x1-h); dragRect->setRange(Depth, Depth2); // 可选:设置颜色 dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色255, 100, 100, 80 //最小宽度 dragRect->setMinWidth(0.1); //dragRect->setColor(myColor); m_mapDraggable_SwallCore[strUuid] = dragRect; //刷新 //this->replot(); } void QMyCustomPlot::addGeoLithToPlot(double left_Low, double right_Hight, const QString myLith, const QString myOil, const QString myColor) { QtCommonClass *qtCommon = new QtCommonClass(this); QString strUuid = qtCommon->getUUid(); // 在初始化代码中 TransparentDraggableGeoLith *dragRect = new TransparentDraggableGeoLith(this, strUuid); //图片,提前设值,后面setRange改变 dragRect->setOil(myOil); dragRect->setLith(myLith, myColor); // 设置初始范围 dragRect->setRange(left_Low, right_Hight); // 可选:设置颜色 dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色255, 100, 100, 80 //最小宽度 dragRect->setMinWidth(0.1); //dragRect->setColor(myColor); m_mapDraggable_GeoLith[strUuid] = dragRect; //刷新 //this->replot(); } void QMyCustomPlot::addGujingToPlot(double left_Low, double right_Hight, const QString strResult) { QtCommonClass *qtCommon = new QtCommonClass(this); QString strUuid = qtCommon->getUUid(); // 在初始化代码中 TransparentDraggableGujing *dragRect = new TransparentDraggableGujing(this, strUuid); //图片,提前设值,后面setRange改变 dragRect->setResult(strResult); // 设置初始范围 dragRect->setRange(left_Low, right_Hight); // 可选:设置颜色 dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色 //最小宽度 dragRect->setMinWidth(0.1); //dragRect->setTitle(strText); m_mapDraggable_Gujing[strUuid] = dragRect; } //气测/FMT/射孔/文本 void QMyCustomPlot::addJiegutextToPlot(double left_Low, double right_Hight, const QStringList strText, int &iMaxNum, QColor crColor) { QtCommonClass *qtCommon = new QtCommonClass(this); QString strUuid = qtCommon->getUUid(); // 在初始化代码中 TransparentDraggableJiegutext *dragRect = new TransparentDraggableJiegutext(this, strUuid, 1.0, strText); // 设置初始范围 dragRect->setRange(left_Low, right_Hight); // 可选:设置颜色 dragRect->setColor(crColor); // 半透明白色 //最小宽度 dragRect->setMinWidth(0.1); //dragRect->setTitle(strText);//直接创建时赋值 m_mapDraggable_Jiegutext[strUuid] = dragRect; // iMaxNum = dragRect->iMaxNum; } //沉积相-微相 void QMyCustomPlot::addMFacToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor) { QtCommonClass *qtCommon = new QtCommonClass(this); QString strUuid = qtCommon->getUUid(); // 在初始化代码中 TransparentDraggableMFac *dragRect = new TransparentDraggableMFac(this, strUuid); // 设置初始范围 dragRect->setRange(left_Low, right_Hight); // 可选:设置颜色 dragRect->setColor(crColor); // 半透明白色 //最小宽度 dragRect->setMinWidth(0.1); dragRect->setTitle(strText); m_mapDraggable_MFac[strUuid] = dragRect; } //沉积相-亚相 void QMyCustomPlot::addPhaseToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor) { QtCommonClass *qtCommon = new QtCommonClass(this); QString strUuid = qtCommon->getUUid(); // 在初始化代码中 TransparentDraggablePhase *dragRect = new TransparentDraggablePhase(this, strUuid); // 设置初始范围 dragRect->setRange(left_Low, right_Hight); // 可选:设置颜色 dragRect->setColor(crColor); // 半透明白色 //最小宽度 dragRect->setMinWidth(0.1); dragRect->setTitle(strText); m_mapDraggable_Phase[strUuid] = dragRect; } //沉积相-相 void QMyCustomPlot::addFacToPlot(double left_Low, double right_Hight, const QString strText, QColor crColor) { QtCommonClass *qtCommon = new QtCommonClass(this); QString strUuid = qtCommon->getUUid(); // 在初始化代码中 TransparentDraggableFac *dragRect = new TransparentDraggableFac(this, strUuid); // 设置初始范围 dragRect->setRange(left_Low, right_Hight); // 可选:设置颜色 dragRect->setColor(crColor); // 半透明白色 //最小宽度 dragRect->setMinWidth(0.1); dragRect->setTitle(strText); m_mapDraggable_Fac[strUuid] = dragRect; } //套管 void QMyCustomPlot::addGuanToPlot(double left_Low, double right_Hight, const QString imagePath, float in) { QtCommonClass *qtCommon = new QtCommonClass(this); QString strUuid = qtCommon->getUUid(); // 在初始化代码中 TransparentDraggableGuan *dragRect = new TransparentDraggableGuan(this, strUuid); //长度 dragRect->setOin(in); //图片,提前设值,后面setRange改变 dragRect->setResult(imagePath); // 设置初始范围 dragRect->setRange(left_Low, right_Hight); // 可选:设置颜色 dragRect->setColor(QColor(255, 255, 255, 80)); // 半透明红色 //最小宽度 dragRect->setMinWidth(0.1); //dragRect->setTitle(strText); m_mapDraggable_Guan[strUuid] = dragRect; } void QMyCustomPlot::onResetZoom() { // //rescaleAxes(); // //x,y互换 // yAxis->setRange(m_iX1, m_iX2); // xAxis->setRange(m_iY1, m_iY2); // // // replot(); } void QMyCustomPlot::removeSelectedGraph() { // if (selectedGraphs().size() > 0) // { // QString strLineName = selectedGraphs().first()->name(); // qDebug() << "removeSelectedGraph name=" << strLineName; // removeGraph(selectedGraphs().first()); // replot(); // //emit CallManage::getInstance()->sig_DelCurve(m_indexID, strLineName); // } } void QMyCustomPlot::removeSelectedGraphByTitle() { // if (selectedGraphs().size() > 0) // { // QString strLineName = selectedGraphs().first()->name(); // qDebug() << "removeSelectedGraph name=" << strLineName; // removeGraph(selectedGraphs().first()); // replot(); // emit CallManage::getInstance()->sig_DelCurve(m_indexID, strLineName); // } } void QMyCustomPlot::s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int iTableType, QString strFormInfoType) { if(m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_strLineName == strLineName && iTableType==3) { raise(); } } //属性-左刻度 void QMyCustomPlot::s_ChangeLeftScale(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double newLeftScale) { if(m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_strLineName == strLineName) { m_iX1 = newLeftScale; yAxis->setRange(m_iX1, m_iX2); // replot(); } else if(m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_newTargetLine == strLineName) { //其他曲线 s_ChangeFillMode(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, m_newFillType, m_newTargetLine, m_newColor, m_newLithosImage, m_newHeadFill, newLeftScale, m_vMax, m_strOtherScaleType, m_frontColor, m_backColor, m_newFillMode, true); } } //属性-右刻度 void QMyCustomPlot::s_ChangeRightScale(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double newRightScale) { if(m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_strLineName == strLineName) { m_iX2 = newRightScale; yAxis->setRange(m_iX1, m_iX2); // replot(); } else if(m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_newTargetLine == strLineName) { //其他曲线 s_ChangeFillMode(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, m_newFillType, m_newTargetLine, m_newColor, m_newLithosImage, m_newHeadFill, m_vMin, newRightScale, m_strOtherScaleType, m_frontColor, m_backColor, m_newFillMode, true); } } //属性-刻度类型 void QMyCustomPlot::s_ChangeScaleType(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strScaleType) { if(m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_strLineName == strLineName) { m_strScaleType = strScaleType; if(m_strScaleType=="对数") { yAxis->setScaleType(QCPAxis::stLogarithmic); } else //if(m_strScaleType=="线性") { yAxis->setScaleType(QCPAxis::stLinear); } // replot(); } else if(m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_newTargetLine == strLineName) { //其他曲线 s_ChangeFillMode(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, m_newFillType, m_newTargetLine, m_newColor, m_newLithosImage, m_newHeadFill, m_vMin, m_vMax, strScaleType, m_frontColor, m_backColor, m_newFillMode, true); } } //属性-颜色 void QMyCustomPlot::s_ChangeLineColor(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QColor lineColor) { if(m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_strLineName == strLineName) { QCPGraph* graph =this->graph(0); if(graph) { QPen pen = graph->pen(); pen.setColor(lineColor); graph->setPen(pen); // replot(); } } } //属性-线宽 void QMyCustomPlot::s_ChangeLineWidth(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, double width) { if(m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_strLineName == strLineName) { QCPGraph* graph = this->graph(0); if(graph) { QPen pen = graph->pen(); pen.setWidthF(width); graph->setPen(pen); // replot(); } } } //属性-线型 void QMyCustomPlot::s_ChangeLineStyle(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, Qt::PenStyle lineStyle) { if(m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_strLineName == strLineName) { QPen pen = this->graph(0)->pen(); pen.setStyle(lineStyle); graph(0)->setPen(pen); // replot(); } } //岩性填充-不填充 void QMyCustomPlot::s_ClearFillMode(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName) { if(m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_strLineName == strLineName) { //清空填充 if(this->graphCount() > 1) { this->removeGraph(1); } if(graph(0)) { graph(0)->setBrush(Qt::NoBrush); // replot(); } } } //岩性填充-填充 void QMyCustomPlot::s_ChangeFillMode(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill, float vMin, float vMax, QString strOtherScaleType, QColor frontColor, QColor backColor, QString newFillMode, bool bFillNow) { if(m_strUuid == strUuid && m_strSlfName == strSlfName && m_strWellName == strWellName && m_strTrackName == strTrackName && m_strLineName == strLineName) { //其他曲线 m_newFillType = newFillType; m_newTargetLine = newTargetLine; m_newColor = newColor; m_newLithosImage = newLithosImage; m_newHeadFill = newHeadFill; m_vMin = vMin; m_vMax = vMax; m_strOtherScaleType = strOtherScaleType; m_frontColor = frontColor; m_backColor = backColor; m_newFillMode = newFillMode; m_bFillNow = bFillNow; //默认true,只有模板存在填充时,才会false if(m_bFillNow==false) { return; } //填充 if(this->graphCount() > 1) { this->removeGraph(1); } //graph(1) QVector x, y; if(newTargetLine=="左界道") { x.append(m_iY1); y.append(m_iX1); // x.append(m_iY2); y.append(m_iX1); // this->addGraph(); } else if(newTargetLine=="右界道") { x.append(m_iY1); y.append(m_iX2); // x.append(m_iY2); y.append(m_iX2); // this->addGraph(); } else if(newTargetLine=="对称线") { CLogIO *logio=new CLogIO(); logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead); int index=logio->OpenCurve(strLineName.toStdString().c_str()); if(index<0) { delete logio; } else { Slf_CURVE curveinfo; float *val; float sdep,edep,rlev; float vmax,vmin; // logio->GetCurveInfo(index,&curveinfo); sdep=curveinfo.StartDepth; edep=curveinfo.EndDepth; rlev=curveinfo.DepLevel; // int count=(curveinfo.EndDepth-curveinfo.StartDepth)/curveinfo.DepLevel+1.5; val=new float[count]; logio->ReadCurve(index,curveinfo.StartDepth,count,&val[0]); logio->CloseCurve(index); delete logio; for(int i=0; iyAxis2->setRange(m_iY1, m_iY2); if(m_strScaleType=="对数") { this->xAxis2->setRange(log(m_iX1), log(m_iX2)); } else //if(m_strScaleType=="线性") { this->xAxis2->setRange(m_iX1, m_iX2); } this->addGraph(yAxis2, xAxis2); } else//其他曲线 { if(newFillMode=="左填充") { float iX1_Tmp=m_iX1; float iX2_Tmp=m_iX2; if(m_strScaleType=="对数") { iX1_Tmp=log(m_iX1); iX2_Tmp=log(m_iX2); } //其他曲线(左填充) CLogIO *logio=new CLogIO(); logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead); //读取基线信息 int indexBaseCurv = logio->OpenCurve(strLineName.toStdString().c_str()); if(indexBaseCurv < 0) { this->addGraph();//空曲线 delete logio; } else { //其他曲线 int index=logio->OpenCurve(newTargetLine.toStdString().c_str()); if(index<0) { this->addGraph();//空曲线 delete logio; } else { Slf_CURVE curveinfo; float *val; float sdep,edep,rlev; // logio->GetCurveInfo(index,&curveinfo); sdep=curveinfo.StartDepth; edep=curveinfo.EndDepth; rlev=curveinfo.DepLevel; // int count=(curveinfo.EndDepth-curveinfo.StartDepth)/curveinfo.DepLevel+1.5; val=new float[count]; logio->ReadCurve(index,curveinfo.StartDepth,count,&val[0]); logio->CloseCurve(index); //读完基线再关闭 // delete logio; float vMax_Tmp=vMax; float vMin_Tmp=vMin; if(strOtherScaleType=="对数") { vMax_Tmp=log(vMax); vMin_Tmp=log(vMin); } float newVal = 0.0; for(int i=0; iReadCurve(indexBaseCurv, 0-x0, 1, &BaseY0); if(m_strScaleType=="对数") { BaseY0_Tmp=log(BaseY0); BaseY0 = BaseY0_Tmp; } // if(i+1ReadCurve(indexBaseCurv, 0-x1, 1, &BaseY1); if(m_strScaleType=="对数") { BaseY1_Tmp=log(BaseY1); BaseY1 = BaseY1_Tmp; } if(BaseY0<=y0 && BaseY1<=y1) { //基线在左,采用基线值 //y0=BaseY0; y0_old = (BaseY0-iX1_Tmp)/(iX2_Tmp-iX1_Tmp)*(vMax_Tmp-vMin_Tmp) + vMin_Tmp; // x.append(x0); y.append(y0_old); } else if(BaseY0>=y0 && BaseY1>=y1) { //基线在右,直接赋值 x.append(x0); y.append(y0_old); } else if(BaseY0<=y0 && BaseY1>=y1) { //基线起点在左,采用基线值 //y0=BaseY0; y0_old = (BaseY0-iX1_Tmp)/(iX2_Tmp-iX1_Tmp)*(vMax_Tmp-vMin_Tmp) + vMin_Tmp; // x.append(x0); y.append(y0_old); //插值 float xNew=x0-rlev*(y0-BaseY0)/((BaseY1-y1)+(y0-BaseY0));//(BaseY1-y1); float yNew=(y0-y1)/(x0-x1)*(xNew-x1) + y1; float yNew_Old=(yNew-iX1_Tmp)/(iX2_Tmp-iX1_Tmp)*(vMax_Tmp-vMin_Tmp) + vMin_Tmp; // x.append(xNew); y.append(yNew_Old); } else if(BaseY0>=y0 && BaseY1<=y1) { //基线在右,直接赋值 x.append(x0); y.append(y0_old); //插值 float xNew=x0-rlev*(y0-BaseY0)/((BaseY1-y1)+(y0-BaseY0));//(BaseY1-y1); float yNew=(BaseY0-BaseY1)/(x0-x1)*(xNew-x1) + BaseY1; float yNew_Old=(yNew-iX1_Tmp)/(iX2_Tmp-iX1_Tmp)*(vMax_Tmp-vMin_Tmp) + vMin_Tmp; // x.append(xNew); y.append(yNew_Old); } } else { //最后一个点 if(BaseY0CloseCurve(indexBaseCurv); delete logio; // this->yAxis2->setRange(m_iY1, m_iY2); this->xAxis2->setRange(vMin_Tmp, vMax_Tmp); this->addGraph(yAxis2, xAxis2); } } } else if(newFillMode=="右填充") { float iX1_Tmp=m_iX1; float iX2_Tmp=m_iX2; if(m_strScaleType=="对数") { iX1_Tmp=log(m_iX1); iX2_Tmp=log(m_iX2); } //其他曲线(右填充) CLogIO *logio=new CLogIO(); logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead); //读取基线信息 int indexBaseCurv = logio->OpenCurve(strLineName.toStdString().c_str()); if(indexBaseCurv < 0) { this->addGraph();//空曲线 delete logio; } else { //其他曲线 int index=logio->OpenCurve(newTargetLine.toStdString().c_str()); if(index<0) { this->addGraph();//空曲线 delete logio; } else { Slf_CURVE curveinfo; float *val; float sdep,edep,rlev; // logio->GetCurveInfo(index,&curveinfo); sdep=curveinfo.StartDepth; edep=curveinfo.EndDepth; rlev=curveinfo.DepLevel; // int count=(curveinfo.EndDepth-curveinfo.StartDepth)/curveinfo.DepLevel+1.5; val=new float[count]; logio->ReadCurve(index,curveinfo.StartDepth,count,&val[0]); logio->CloseCurve(index); //读完基线再关闭 // delete logio; float vMax_Tmp=vMax; float vMin_Tmp=vMin; if(strOtherScaleType=="对数") { vMax_Tmp=log(vMax); vMin_Tmp=log(vMin); } float newVal = 0.0; for(int i=0; iReadCurve(indexBaseCurv, 0-x0, 1, &BaseY0); if(m_strScaleType=="对数") { BaseY0_Tmp=log(BaseY0); BaseY0 = BaseY0_Tmp; } // if(i+1ReadCurve(indexBaseCurv, 0-x1, 1, &BaseY1); if(m_strScaleType=="对数") { BaseY1_Tmp=log(BaseY1); BaseY1 = BaseY1_Tmp; } if(BaseY0<=y0 && BaseY1<=y1) { //基线在左,直接赋值 x.append(x0); y.append(y0_old); } else if(BaseY0>=y0 && BaseY1>=y1) { //基线在右,采用基线值 //y0=BaseY0; y0_old = (BaseY0-iX1_Tmp)/(iX2_Tmp-iX1_Tmp)*(vMax_Tmp-vMin_Tmp) + vMin_Tmp; // x.append(x0); y.append(y0_old); } else if(BaseY0<=y0 && BaseY1>=y1) { //基线起点在左,直接赋值 x.append(x0); y.append(y0_old); //插值 float xNew=x0-rlev*(y0-BaseY0)/((BaseY1-y1)+(y0-BaseY0));//(BaseY1-y1); float yNew=(y0-y1)/(x0-x1)*(xNew-x1) + y1; float yNew_Old=(yNew-iX1_Tmp)/(iX2_Tmp-iX1_Tmp)*(vMax_Tmp-vMin_Tmp) + vMin_Tmp; // x.append(xNew); y.append(yNew_Old); } else if(BaseY0>=y0 && BaseY1<=y1) { //基线在右,采用基线值 //y0=BaseY0; y0_old = (BaseY0-iX1_Tmp)/(iX2_Tmp-iX1_Tmp)*(vMax_Tmp-vMin_Tmp) + vMin_Tmp; // x.append(x0); y.append(y0_old); //插值 float xNew=x0-rlev*(y0-BaseY0)/((BaseY1-y1)+(y0-BaseY0));//(BaseY1-y1); float yNew=(BaseY0-BaseY1)/(x0-x1)*(xNew-x1) + BaseY1; float yNew_Old=(yNew-iX1_Tmp)/(iX2_Tmp-iX1_Tmp)*(vMax_Tmp-vMin_Tmp) + vMin_Tmp; // x.append(xNew); y.append(yNew_Old); } } else { //最后一个点 if(BaseY0>y0) { //基线在右,采用基线值 //y0=BaseY0; y0_old = (BaseY0-iX1_Tmp)/(iX2_Tmp-iX1_Tmp)*(vMax_Tmp-vMin_Tmp) + vMin_Tmp; } x.append(x0); y.append(y0_old); } } logio->CloseCurve(indexBaseCurv); delete logio; // this->yAxis2->setRange(m_iY1, m_iY2); this->xAxis2->setRange(vMin_Tmp, vMax_Tmp); this->addGraph(yAxis2, xAxis2); } } } else //填充 { //其他曲线 CLogIO *logio=new CLogIO(); logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead); int index=logio->OpenCurve(newTargetLine.toStdString().c_str()); if(index<0) { this->addGraph(); delete logio; } else { Slf_CURVE curveinfo; float *val; float sdep,edep,rlev; // logio->GetCurveInfo(index,&curveinfo); sdep=curveinfo.StartDepth; edep=curveinfo.EndDepth; rlev=curveinfo.DepLevel; // int count=(curveinfo.EndDepth-curveinfo.StartDepth)/curveinfo.DepLevel+1.5; val=new float[count]; logio->ReadCurve(index,curveinfo.StartDepth,count,&val[0]); logio->CloseCurve(index); delete logio; float vMax_Tmp=vMax; float vMin_Tmp=vMin; if(strOtherScaleType=="对数") { vMax_Tmp=log(vMax); vMin_Tmp=log(vMin); } float newVal = 0.0; for(int i=0; iyAxis2->setRange(m_iY1, m_iY2); this->xAxis2->setRange(vMin_Tmp, vMax_Tmp); this->addGraph(yAxis2, xAxis2); } } } this->graph(1)->setData(x, y); graph(1)->setLineStyle(graph(0)->lineStyle());//曲线 graph(1)->setScatterStyle(graph(0)->scatterStyle()); //graph(1)->setPen(QColor(255, 255, 255)); graph(1)->setPen(QColor(0, 0, 0));//(graph(0)->pen()); // if(newFillType == "岩性模式") { QColor oldFrontColor(0, 0, 0); // 原始颜色 QColor oldBackColor(255, 255, 255); // 原始颜色 // QImage image(newLithosImage); for (int y = 0; y < image.height(); ++y) { for (int x = 0; x < image.width(); ++x) { QColor pixelColor = QColor(image.pixel(x, y)); if (pixelColor == oldFrontColor) { image.setPixelColor(x, y, m_frontColor); // 使用 setPixelColor 来设置新颜色 } if (pixelColor == oldBackColor) { image.setPixelColor(x, y, m_backColor); // 使用 setPixelColor 来设置新颜色 } } } // graph(0)->setBrush(QBrush(QPixmap::fromImage(image))); //graph(0)->setBrush(QBrush(QPixmap(newLithosImage))); } else if(newFillType == "颜色模式") { graph(0)->setBrush(QBrush(newColor)); } else if(newFillType == "成像化") { } graph(0)->setChannelFillGraph( this->graph(1)); // replot(); //update(); } } //void QMyCustomPlot::mouseMoveEvent(QMouseEvent *event) //{ // // 当前鼠标位置(像素坐标) // //int x_pos = event->pos().x(); // int y_pos = event->pos().y(); // // 像素坐标转成实际的x,y轴的坐标 // //float x_val = yAxis->pixelToCoord(x_pos); // float y_val = xAxis->pixelToCoord(y_pos); // emit CallManage::getInstance()->sig_MouseMove(m_strUuid, m_strWellName, m_strTrackName, 0-y_val); // QCustomPlot::mouseMoveEvent(event); //} void QMyCustomPlot::addRandomGraph(QVector x, QVector y, QString strSlfName, QString strLineName, QString strAliasName, QString strUnit, double newLeftScale, double newRightScale, QString strScaleType, QColor &newlineColor, double width, Qt::PenStyle lineStyle) { //AppendConsole(PAI_INFO, "FormDraw addRandomGraph"); m_addRandomGraph=true; m_x.append(x); m_y.append(y); addGraph(); if(strLineName=="") { strLineName = QString("曲线 %1").arg(graphCount()); } graph()->setName(strLineName); //禁用自动重绘:在大量数据更新前禁用自动重绘 //setNotAntialiasedElements(QCP::aeAll); //graph()->setData(x, y); if(newLeftScale!=-9999) { if(m_bDrawCore_PHYSICS)//岩心分析 { graph()->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsImpulse));//杆状线 graph()->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssCircle)));//圆圈 } else { graph()->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsLine));//曲线 graph()->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssDot)));//点 } QPen graphPen; graphPen.setColor(newlineColor); graphPen.setWidthF(width); graphPen.setStyle(lineStyle);//实线 graph()->setPen(graphPen); } else { if(m_bDrawCore_PHYSICS)//岩心分析 { graph()->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsImpulse));//杆状线 graph()->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssCircle)));//圆圈 } else { graph()->setLineStyle((QCPGraph::LineStyle)(QCPGraph::lsLine));//曲线 graph()->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)(QCPScatterStyle::ssDot)));//点 } // graph()->setScatterStyle(QCPScatterStyle(QPixmap(":/image/file.png"))); //graph()->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDisc, 5)); QPen graphPen; newlineColor = QColor(std::rand()%245+10, std::rand()%245+10, std::rand()%245+10); graphPen.setColor(newlineColor); width = 2; graphPen.setWidthF(width); graphPen.setStyle(Qt::SolidLine);//实线 graph()->setPen(graphPen); //replot(); } if(x.size()setData(x, y); replot(); //replot(QCustomPlot::rpRefreshHint);// 仅刷新可见部分,跳过轴计算等 } else { graph()->setData(x.mid(0,m_iSplitNum), y.mid(0,m_iSplitNum)); replot(); m_iCurNum = m_iSplitNum; QTimer::singleShot(100, this, SLOT(slot_time())); } } void QMyCustomPlot::slot_time() { if(m_iCurNum >= m_x.size()) { //处理完成 return; } // if(m_x.size() <= m_iCurNum+m_iSplitNum) { graph()->addData(m_x.mid(m_iCurNum), m_y.mid(m_iCurNum)); m_iCurNum = m_x.size(); //处理完成,填充 //默认true,只有模板存在填充时,才会false if(m_bFillNow==false) { s_ChangeFillMode(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, m_newFillType, m_newTargetLine, m_newColor, m_newLithosImage, m_newHeadFill, m_vMin, m_vMax, m_strOtherScaleType, m_frontColor, m_backColor, m_newFillMode, true); } replot(); } else { graph()->addData(m_x.mid(m_iCurNum, m_iSplitNum), m_y.mid(m_iCurNum, m_iSplitNum)); m_iCurNum = m_iCurNum + m_iSplitNum; //replot(); QTimer::singleShot(100, this, SLOT(slot_time())); } //replot(); }