曲线第二比例属性编辑器设置,第二比例大小,自动计算二比例,绘制左二比例,绘制右二比例,二比例连续折返

This commit is contained in:
DESKTOP-450PEFP\mainc 2026-04-17 17:53:36 +08:00
parent 82d997aeb0
commit c1c0b72e17
5 changed files with 434 additions and 110 deletions

View File

@ -1946,16 +1946,26 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
} }
else if(m_strCurrentProperty == Curve_Property) else if(m_strCurrentProperty == Curve_Property)
{ {
QString strGroup = "";
if (1 == pProperty->getParentItem().count())
{
QtProperty * pParentProperty = *(pProperty->getParentItem().begin());
strGroup = pParentProperty->propertyName();
}
bool bhv = false; bool bhv = false;
bool bDraw = false; bool bDraw = false;
QStringList slist; QStringList slist;
slist << "曲线名称" << "曲线单位" << "曲线刻度" << "单比例连续折返"; slist << "曲线名称" << "曲线单位" << "曲线刻度" << "单比例连续折返"
<< "线宽" << "颜色" << "线型"
<< "第二比例大小" << "自动计算二比例"
<< "绘制左二比例" << "左二比例连续折返" << "左二比例左刻度" << "左二比例右刻度"
<< "绘制右二比例" << "右二比例连续折返" << "右二比例左刻度" << "右二比例右刻度";
for (int i = 0; i < slist.length(); i++) for (int i = 0; i < slist.length(); i++)
{ {
if (slist.at(i) == m_propertyData[pProperty]) if (slist.at(i) == m_propertyData[pProperty])
{ {
bhv = true; bhv = true;
bDraw = m_formInfo->setInfoProperty(m_propertyData[pProperty], variant); bDraw = m_formInfo->setInfoProperty(m_propertyData[pProperty], variant, strGroup);
break; break;
} }
} }
@ -1971,6 +1981,7 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
listCond << m_strLineName; listCond << m_strLineName;
listCond << m_propertyData[pProperty]; listCond << m_propertyData[pProperty];
listCond << variant; listCond << variant;
listCond << strGroup;
emit CallManage::getInstance()->sig_changeDrawProperty(listCond); emit CallManage::getInstance()->sig_changeDrawProperty(listCond);
} }
} }
@ -2062,56 +2073,56 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
m_formInfo->m_nRightCross = variant.toInt(); m_formInfo->m_nRightCross = variant.toInt();
emit CallManage::getInstance()->sig_ChangeCross(m_strUuid, m_strTrackUuid); emit CallManage::getInstance()->sig_ChangeCross(m_strUuid, m_strTrackUuid);
} }
else if("颜色" == m_propertyData[pProperty]) //else if("颜色" == m_propertyData[pProperty])
{ //{
//qDebug() << "颜色->改变"; // //qDebug() << "颜色->改变";
//曲线颜色 // //曲线颜色
// 假设variant已经被设置为包含QColor // // 假设variant已经被设置为包含QColor
QColor newColor = variant.value<QColor>(); // QColor newColor = variant.value<QColor>();
emit CallManage::getInstance()->sig_ChangeLineColor(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newColor); // emit CallManage::getInstance()->sig_ChangeLineColor(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newColor);
} //}
else if("线宽" == m_propertyData[pProperty]) //else if("线宽" == m_propertyData[pProperty])
{ //{
//qDebug() << "线宽->改变"; // //qDebug() << "线宽->改变";
double newWidth = variant.value<double>(); // double newWidth = variant.value<double>();
emit CallManage::getInstance()->sig_ChangeLineWidth(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newWidth); // emit CallManage::getInstance()->sig_ChangeLineWidth(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newWidth);
} //}
else if("线型" == m_propertyData[pProperty]) //else if("线型" == m_propertyData[pProperty])
{ //{
//qDebug() << "线型->改变"; // //qDebug() << "线型->改变";
Qt::PenStyle newStyle = Qt::SolidLine; // Qt::PenStyle newStyle = Qt::SolidLine;
int iStyle = variant.value<int>(); // int iStyle = variant.value<int>();
switch(iStyle) // switch(iStyle)
{ // {
case 0: // case 0:
//无 // //无
newStyle = Qt::NoPen; // newStyle = Qt::NoPen;
break; // break;
case 1: // case 1:
//实线 // //实线
newStyle = Qt::SolidLine; // newStyle = Qt::SolidLine;
break; // break;
case 2: // case 2:
//虚线 // //虚线
newStyle = Qt::DashLine; // newStyle = Qt::DashLine;
break; // break;
case 3: // case 3:
//点线 // //点线
newStyle = Qt::DotLine; // newStyle = Qt::DotLine;
break; // break;
case 4: // case 4:
//虚点线 // //虚点线
newStyle = Qt::DashDotLine; // newStyle = Qt::DashDotLine;
break; // break;
case 5: // case 5:
//虚点点线 // //虚点点线
newStyle = Qt::DashDotDotLine; // newStyle = Qt::DashDotDotLine;
break; // break;
default: // default:
break; // break;
} // }
emit CallManage::getInstance()->sig_ChangeLineStyle(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newStyle); // emit CallManage::getInstance()->sig_ChangeLineStyle(m_strUuid, m_strSlfName, m_strWellName, m_strTrackName, m_strLineName, newStyle);
} //}
else if("曲线" == m_propertyData[pProperty]) else if("曲线" == m_propertyData[pProperty])
{ {
//qDebug() << "曲线->改变"; //qDebug() << "曲线->改变";

View File

@ -27,6 +27,9 @@ FormInfo::FormInfo(QWidget *parent, QString strSlfName, QString strWellName, QSt
m_strTrackName = strTrackName; m_strTrackName = strTrackName;
m_strLineName = strLineName; m_strLineName = strLineName;
m_lineColor = lineColor; m_lineColor = lineColor;
m_twoBLlineColor = lineColor;
// //
m_dWidth = 3; m_dWidth = 3;
m_lineStyle = Qt::SolidLine; m_lineStyle = Qt::SolidLine;
@ -1040,19 +1043,23 @@ void FormInfo::paintEvent(QPaintEvent* event)
if(m_strType=="waveObject" if(m_strType=="waveObject"
|| m_strType=="curveObject") || m_strType=="curveObject")
{ {
QFont oldFont = painter.font(); int nbay = rect.height() - 5;
painter.setFont(m_curveUnitFont);
painter.drawText(rect.left()+10, rect.top() + rect.height() * 2 / 3, rect.width(), rect.height() / 3, Qt::AlignCenter, m_strUnit);
painter.setFont(oldFont);
// 显示刻度 // 显示刻度
if (m_bShowScale) if (m_bShowScale)
{ {
painter.setFont(m_curveScaleFont); drawScale(painter, rect);
QFontMetrics fm1(m_curveScaleFont);
QRect textRect = fm1.boundingRect(QString::number(m_vmax, 'f', 0));
painter.drawText(rect.left() + 10, rect.top() + rect.height() * 2 / 3, rect.width(), rect.height() / 3, Qt::AlignLeft | Qt::AlignVCenter, QString::number(m_vmin));// +" ~ " + QString::number(m_vmax));
painter.drawText(rect.left() + 10, rect.top() + rect.height() * 2 / 3, rect.width() - textRect.width(), rect.height() / 3, Qt::AlignRight | Qt::AlignVCenter, QString::number(m_vmax));
} }
QFont oldFont = painter.font();
painter.setFont(m_curveUnitFont);
QFontMetrics fm2(m_curveUnitFont);
QRect tRect = fm2.boundingRect(m_strUnit);
painter.drawText(rect.width()/2- tRect.width()/2, nbay - 6, m_strUnit);
painter.setFont(oldFont);
painter.setPen(QPen(m_lineColor, m_dWidth, m_lineStyle));
// 刻度线
painter.drawLine(rect.x()-5, nbay, rect.x()+ rect.width()-5, nbay);
} }
} }
@ -1345,6 +1352,70 @@ void FormInfo::paintEvent(QPaintEvent* event)
QWidget::paintEvent(event); QWidget::paintEvent(event);
} }
void FormInfo::drawScale(QPainter& painter, const QRect& rect)
{
int nbay = rect.height() - 5;
QVector<QStringList> vecScale;
if (m_strType == "curveObject") // 曲线
{
if (m_twoBLSize > 0) // 第二比例大小
{
if (m_twoBLDrawLeft) // 绘制左二比例
{
if (m_twoBLAuto) // 自动计算二比例
{
float ftm = (m_vmax - m_vmin)*m_twoBLSize;
vecScale << QStringList({ QString::number(m_vmax) , QString::number(m_vmax + ftm) });
}
else
{
if (m_twoBLLeftLeft.length() > 0 || m_twoBLLeftRight.length() > 0)
{
vecScale << QStringList({ m_twoBLLeftLeft , m_twoBLLeftRight });
}
}
}
vecScale << QStringList({ QString::number(m_vmin) , QString::number(m_vmax) });
if (m_twoBLDrawRight) // 绘制右二比例
{
if (m_twoBLAuto) // 自动计算二比例
{
float ftm = (m_vmax - m_vmin)*m_twoBLSize;
vecScale << QStringList({ QString::number(m_vmin - ftm) , QString::number(m_vmin) });
}
else
{
if (m_twoBLRightLeft.length() > 0 || m_twoBLRightRight.length() > 0)
{
vecScale << QStringList({ m_twoBLRightLeft , m_twoBLRightRight });
}
}
}
}
else
vecScale << QStringList({ QString::number(m_vmin) , QString::number(m_vmax) });
}
else
vecScale << QStringList({ QString::number(m_vmin) , QString::number(m_vmax) });
painter.setFont(m_curveScaleFont);
QFontMetrics fm1(m_curveScaleFont);
QRect textRect = fm1.boundingRect(QString::number(m_vmin, 'f', 0));
int ntxthei = textRect.height() - 4;
int nyy = nbay - ntxthei * vecScale.size() - 3;
for (int i = 0; i < vecScale.size(); i++)
{
const QStringList& slist = vecScale.at(i);
QRect textRect = fm1.boundingRect(slist.at(1));
int y = nyy + (i + 1) * ntxthei;
painter.drawText(rect.x() + 3, y, slist.at(0));
painter.drawText(rect.width() - textRect.width() - 3, y, slist.at(1));
}
}
void FormInfo::paintClassify(QPainter &painter, int compassCenterY) void FormInfo::paintClassify(QPainter &painter, int compassCenterY)
{ {
// 绘制分类 // 绘制分类
@ -1592,6 +1663,7 @@ void FormInfo::setCpLineWidth(int cpLineWidth)
void FormInfo::setLineWidth(double dWidth) void FormInfo::setLineWidth(double dWidth)
{ {
m_dWidth = dWidth; m_dWidth = dWidth;
m_twoBLWidth = m_dWidth;
} }
double FormInfo::getLineWidth() double FormInfo::getLineWidth()
@ -1650,47 +1722,48 @@ QColor FormInfo::getBackColor()
return m_backColor; return m_backColor;
} }
bool FormInfo::setInfoProperty(QString strProName, QVariant val) bool FormInfo::setInfoProperty(QString strProName, QVariant val, QString strGp)
{ {
bool bDraw = false; bool bDraw = true;
if ("显示名称" == strProName) if ("显示名称" == strProName)
{ {
bDraw = false;
this->m_strAliasName = val.toString(); this->m_strAliasName = val.toString();
} }
else if ("显示单位" == strProName) else if ("显示单位" == strProName)
{ {
bDraw = false;
this->m_strUnit = val.toString(); this->m_strUnit = val.toString();
} }
else if ("曲线名称" == strProName || "字体" == strProName) else if ("曲线名称" == strProName || "字体" == strProName)
{ {
bDraw = false;
this->m_curveNameFont = val.value<QFont>(); this->m_curveNameFont = val.value<QFont>();
} }
else if ("曲线单位" == strProName) else if ("曲线单位" == strProName)
{ {
bDraw = false;
this->m_curveUnitFont = val.value<QFont>(); this->m_curveUnitFont = val.value<QFont>();
} }
else if ("曲线刻度" == strProName) else if ("曲线刻度" == strProName)
{ {
bDraw = false;
this->m_curveScaleFont = val.value<QFont>(); this->m_curveScaleFont = val.value<QFont>();
} }
else if ("类型" == strProName) else if ("类型" == strProName)
{ {
bDraw = true;
this->m_nDrawType = val.toInt(); this->m_nDrawType = val.toInt();
} }
else if ("方式" == strProName) else if ("方式" == strProName)
{ {
bDraw = true;
this->m_nFillType = val.toInt(); this->m_nFillType = val.toInt();
} }
else if ("左刻度" == strProName) else if ("左刻度" == strProName)
{ {
bDraw = true;
this->m_vmin = val.toDouble(); this->m_vmin = val.toDouble();
} }
else if ("右刻度" == strProName) else if ("右刻度" == strProName)
{ {
bDraw = true;
this->m_vmax = val.toDouble(); this->m_vmax = val.toDouble();
} }
else if ("幅度刻度" == strProName) else if ("幅度刻度" == strProName)
@ -1699,52 +1772,98 @@ bool FormInfo::setInfoProperty(QString strProName, QVariant val)
} }
else if ("最大振幅" == strProName) else if ("最大振幅" == strProName)
{ {
bDraw = true;
this->m_fMaxAmp = val.toFloat(); this->m_fMaxAmp = val.toFloat();
} }
else if ("显示刻度" == strProName) else if ("显示刻度" == strProName)
{ {
bDraw = false;
this->m_bShowScale = val.toBool(); this->m_bShowScale = val.toBool();
} }
else if ("绘制波深度" == strProName) else if ("绘制波深度" == strProName)
{ {
bDraw = true;
this->m_bDrawDepth = val.toBool(); this->m_bDrawDepth = val.toBool();
} }
else if ("绘制波基线" == strProName) else if ("绘制波基线" == strProName)
{ {
bDraw = true;
this->m_bDrawBase = val.toBool(); this->m_bDrawBase = val.toBool();
} }
else if ("奇偶配色" == strProName) else if ("奇偶配色" == strProName)
{ {
bDraw = true;
this->m_bOddEven = val.toBool(); this->m_bOddEven = val.toBool();
} }
else if ("波列基值" == strProName) else if ("波列基值" == strProName)
{ {
bDraw = true;
this->m_fWaveBase = val.toFloat(); this->m_fWaveBase = val.toFloat();
} }
else if ("波形间隔" == strProName) else if ("波形间隔" == strProName)
{ {
bDraw = true;
this->m_nWaveJg = val.toInt(); this->m_nWaveJg = val.toInt();
} }
else if ("波形高度" == strProName) else if ("波形高度" == strProName)
{ {
bDraw = true;
this->m_fWaveHei = val.toInt(); this->m_fWaveHei = val.toInt();
} }
else if ("线型" == strProName)
{
if ("曲线第二比例" == strGp)
m_twoBLlineStyle = (Qt::PenStyle)val.toInt();
else
this->m_lineStyle = (Qt::PenStyle)val.toInt();
}
else if ("颜色" == strProName) else if ("颜色" == strProName)
{ {
bDraw = true; if ("曲线第二比例" == strGp)
m_twoBLlineColor = val.value<QColor>();
else
this->m_lineColor = val.value<QColor>(); this->m_lineColor = val.value<QColor>();
} }
else if ("线宽" == strProName) else if ("线宽" == strProName)
{ {
if ("曲线第二比例" == strGp)
m_twoBLWidth = val.toInt();
else
this->m_dWidth = val.toInt(); this->m_dWidth = val.toInt();
} }
else if ("第二比例大小" == strProName)
{
m_twoBLSize = val.toInt();
}
else if ("自动计算二比例" == strProName)
{
m_twoBLAuto = val.toBool();
}
else if ("绘制左二比例" == strProName)
{
m_twoBLDrawLeft = val.toBool();
}
else if ("左二比例连续折返" == strProName)
{
m_twoBLLeftConBackAndForth = val.toBool();
}
else if ("左二比例左刻度" == strProName)
{
m_twoBLLeftLeft = val.toString();
}
else if ("左二比例右刻度" == strProName)
{
m_twoBLLeftRight = val.toString();
}
else if ("绘制右二比例" == strProName)
{
m_twoBLDrawRight = val.toBool();
}
else if ("右二比例连续折返" == strProName)
{
m_twoBLRightConBackAndForth = val.toBool();
}
else if ("右二比例左刻度" == strProName)
{
m_twoBLRightLeft = val.toString();
}
else if ("右二比例右刻度" == strProName)
{
m_twoBLRightRight = val.toString();
}
else if ("色板" == strProName) else if ("色板" == strProName)
{ {
this->m_nSchemeIndex = val.toInt(); this->m_nSchemeIndex = val.toInt();
@ -1757,40 +1876,36 @@ bool FormInfo::setInfoProperty(QString strProName, QVariant val)
} }
else if ("垂向绘制" == strProName) else if ("垂向绘制" == strProName)
{ {
bDraw = false;
this->m_bVerticaDrawing = val.toBool(); this->m_bVerticaDrawing = val.toBool();
} }
else if ("旋转角度(°)" == strProName) else if ("旋转角度(°)" == strProName)
{ {
bDraw = false;
this->m_nRotationAngle = val.toInt(); this->m_nRotationAngle = val.toInt();
} }
else if ("结论占比%" == strProName) else if ("结论占比%" == strProName)
{ {
bDraw = true;
this->m_nConclusionProportion = val.toInt(); this->m_nConclusionProportion = val.toInt();
} }
else if ("显示位置(cm)" == strProName) else if ("显示位置(cm)" == strProName)
{ {
bDraw = true;
this->m_nShowPos = val.toInt(); this->m_nShowPos = val.toInt();
} }
else if ("显示层号" == strProName) else if ("显示层号" == strProName)
{ {
bDraw = true;
this->m_bShowLayerNo = val.toBool(); this->m_bShowLayerNo = val.toBool();
} }
else if ("层号字体" == strProName) else if ("层号字体" == strProName)
{ {
bDraw = true;
this->m_layerFont = val.value<QFont>(); this->m_layerFont = val.value<QFont>();
} }
else if ("层号旋转" == strProName) else if ("层号旋转" == strProName)
{ {
bDraw = true;
this->m_fLayerRotate = val.toFloat(); this->m_fLayerRotate = val.toFloat();
} }
else if ("单比例连续折返" == strProName) else if ("单比例连续折返" == strProName)
{ {
bDraw = true;
this->m_bConBackAndForth = val.toBool(); this->m_bConBackAndForth = val.toBool();
} }

View File

@ -34,6 +34,9 @@ private:
protected: protected:
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event);
// 绘制刻度
void drawScale(QPainter& painter, const QRect& rect);
public slots: public slots:
void dragEnterEvent(QDragEnterEvent* event); void dragEnterEvent(QDragEnterEvent* event);
void dragMoveEvent(QDragMoveEvent* event); void dragMoveEvent(QDragMoveEvent* event);
@ -375,7 +378,7 @@ public:
void setBackColor(QColor backColor); void setBackColor(QColor backColor);
QColor getBackColor(); QColor getBackColor();
bool setInfoProperty(QString strProName, QVariant val); bool setInfoProperty(QString strProName, QVariant val, QString strGp="");
int getFillTypeIndex(); int getFillTypeIndex();

View File

@ -5005,11 +5005,39 @@ void QMyCustomPlot::s_changeDrawProperty(QVariantList vlist)
m_nWaveHei = varVal.toInt(); m_nWaveHei = varVal.toInt();
this->changePropertyWaveUpdate(); this->changePropertyWaveUpdate();
} }
else if ("颜色" == strProperty) else if ("线宽" == strProperty || "线型" == strProperty || "颜色" == strProperty)
{ {
m_newColor = varVal.value<QColor>(); QString strGroupVal = vlist.at(7).toString();
this->changePropertyWaveUpdate(); this->changeGrapProperty(strGroupVal);
} }
//else if ("线型" == strProperty)
//{
// QCPGraph* graph = this->graph(0);
// if (graph)
// {
// QPen pen = graph->pen();
// pen.setStyle((Qt::PenStyle)varVal.toInt());
// graph->setPen(pen);
// }
//}
// else if ("颜色" == strProperty)
//{
// m_newColor = varVal.value<QColor>();
// QString strGroupVal = vlist.at(7).toString();
// if ("曲线线型" == strGroupVal)
// {
// QCPGraph* graph = this->graph(0);
// if (graph)
// {
// QPen pen = graph->pen();
// pen.setColor(m_newColor);
// graph->setPen(pen);
// }
// }
// else
// this->changePropertyWaveUpdate();
// }
else if ("方式" == strProperty) else if ("方式" == strProperty)
{ {
m_nMode = varVal.toFloat(); m_nMode = varVal.toFloat();
@ -5063,8 +5091,31 @@ void QMyCustomPlot::s_changeDrawProperty(QVariantList vlist)
} }
else if ("单比例连续折返" == strProperty) else if ("单比例连续折返" == strProperty)
{ {
QCPGraph *graph = this->graph(1);
if (graph)
graph->setVisible(false);
graph = this->graph(2);
if (graph)
graph->setVisible(false);
this->updateCurveConBackAndForth(); this->updateCurveConBackAndForth();
} }
else if ("第二比例大小" == strProperty || "左二比例连续折返" == strProperty || "右二比例连续折返" == strProperty)
{
this->updateCurveTwoBackAndForth();
}
else if ("绘制左二比例" == strProperty)
{
QCPGraph *graph = this->graph(1);
if (graph)
graph->setVisible(varVal.toBool());
}
else if ("绘制右二比例" == strProperty)
{
QCPGraph *graph = this->graph(2);
if (graph)
graph->setVisible(varVal.toBool());
}
this->replot(); this->replot();
} }
} }
@ -5697,7 +5748,14 @@ void QMyCustomPlot::s_ChangeLeftScale(QString strUuid, QString strSlfName, QStri
double upper = m_iX2 + rg * m_nRightCross; double upper = m_iX2 + rg * m_nRightCross;
yAxis->setRange(lower, upper); yAxis->setRange(lower, upper);
updateCurveConBackAndForth(true); FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
if (pInfo)
{
if (pInfo->m_bConBackAndForth)
updateCurveConBackAndForth();
if (pInfo->m_twoBLSize > 0)
updateCurveTwoBackAndForth();
}
// //
replot(); replot();
} }
@ -5730,7 +5788,14 @@ void QMyCustomPlot::s_ChangeRightScale(QString strUuid, QString strSlfName, QStr
double upper = m_iX2 + rg * m_nRightCross; double upper = m_iX2 + rg * m_nRightCross;
yAxis->setRange(lower, upper); yAxis->setRange(lower, upper);
updateCurveConBackAndForth(true); FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
if (pInfo)
{
if (pInfo->m_bConBackAndForth)
updateCurveConBackAndForth();
if (pInfo->m_twoBLSize > 0)
updateCurveTwoBackAndForth();
}
// //
replot(); replot();
} }
@ -6758,7 +6823,7 @@ void QMyCustomPlot::slot_replot()
void QMyCustomPlot::addRandomGraph(QVector<double> x, QVector<double> y, QString strSlfName, QString strLineName, QString strAliasName, QString strUnit, void QMyCustomPlot::addRandomGraph(QVector<double> x, QVector<double> y, QString strSlfName, QString strLineName, QString strAliasName, QString strUnit,
double newLeftScale, double newRightScale, QString strScaleType, QColor &newlineColor, double width, Qt::PenStyle lineStyle) double newLeftScale, double newRightScale, QString strScaleType, QColor &newlineColor, double& width, Qt::PenStyle lineStyle)
{ {
//AppendConsole(PAI_INFO, "FormDraw addRandomGraph"); //AppendConsole(PAI_INFO, "FormDraw addRandomGraph");
@ -10223,7 +10288,7 @@ void QMyCustomPlot::setColGridVisible(bool bvis)
} }
} }
void QMyCustomPlot::updateCurveConBackAndForth(bool bkd) void QMyCustomPlot::updateCurveConBackAndForth()
{ {
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);
if (pInfo == NULL) if (pInfo == NULL)
@ -10231,12 +10296,6 @@ void QMyCustomPlot::updateCurveConBackAndForth(bool bkd)
return; return;
} }
if (bkd)
{
if (!pInfo->m_bConBackAndForth)
return;
}
int nzflag = 0; int nzflag = 0;
m_showX.clear(); m_showX.clear();
m_showY.clear(); m_showY.clear();
@ -10244,7 +10303,7 @@ void QMyCustomPlot::updateCurveConBackAndForth(bool bkd)
{ {
m_showX.append(m_x.at(i)); m_showX.append(m_x.at(i));
double dy = m_y.at(i); double dy = m_y.at(i);
if (pInfo->m_bConBackAndForth) if (pInfo->m_bConBackAndForth) // 单比例连续折返
{ {
if (dy > pInfo->m_vmax) if (dy > pInfo->m_vmax)
{ {
@ -10294,6 +10353,139 @@ void QMyCustomPlot::updateCurveConBackAndForth(bool bkd)
} }
void QMyCustomPlot::updateCurveTwoBackAndForth()
{
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
if (pInfo == NULL)
{
return;
}
if (pInfo->m_bConBackAndForth)
return;
QVector<double> tmpLeftX;
QVector<double> tmpLeftY;
QVector<double> tmpRightX;
QVector<double> tmpRightY;
for (int i = 0; i < m_y.size(); i++)
{
tmpLeftX.append(m_x.at(i));
tmpRightX.append(m_x.at(i));
double dy = m_y.at(i);
if (pInfo->m_twoBLSize > 0) // 第二比例大小
{
if (dy > pInfo->m_vmax)
{
dy = pInfo->m_vmin + ((dy - pInfo->m_vmax) / pInfo->m_twoBLSize);
tmpLeftY.append(dy);
}
else
{
if(pInfo->m_twoBLLeftConBackAndForth)
tmpLeftY.append(pInfo->m_vmin);
else
tmpLeftY.append(-9999);
}
if (dy >-1000 && dy < pInfo->m_vmin)
{
dy = pInfo->m_vmax - ((pInfo->m_vmin - dy) / pInfo->m_twoBLSize);
tmpRightY.append(dy);
}
else
{
if (pInfo->m_twoBLRightConBackAndForth)
tmpRightY.append(pInfo->m_vmax);
else
tmpRightY.append(9999);
}
}
}
QCPGraph *graph = this->graph(1);// addGraph();
if (!graph)
{
graph = this->addGraph();
QPen pen = graph->pen();
pen.setColor(pInfo->m_twoBLlineColor);
pen.setWidthF(pInfo->m_twoBLWidth);
pen.setStyle(pInfo->m_twoBLlineStyle);
graph->setPen(pen);
}
if (pInfo->m_twoBLDrawLeft)
graph->setVisible(true);
else
graph->setVisible(false);
graph->setData(tmpLeftX, tmpLeftY);
graph = this->graph(2);// addGraph();
if (!graph)
{
graph = this->addGraph();
QPen pen = graph->pen();
pen.setColor(pInfo->m_twoBLlineColor);
pen.setWidthF(pInfo->m_twoBLWidth);
pen.setStyle(pInfo->m_twoBLlineStyle);
graph->setPen(pen);
}
if (pInfo->m_twoBLDrawRight)
graph->setVisible(true);
else
graph->setVisible(false);
graph->setData(tmpRightX, tmpRightY);
replot();
}
void QMyCustomPlot::changeGrapProperty(QString strGroup)
{
FormInfo* pInfo = m_formTrack->getFormInfoByParameters(m_strUuid, m_strWellName, m_strTrackName, m_strLineName);
if (pInfo == NULL)
{
return;
}
if (strGroup == "曲线第二比例")
{
QCPGraph* graph = this->graph(1); // 左二比例
if (graph)
{
QPen pen = graph->pen();
pen.setColor(pInfo->m_twoBLlineColor);
pen.setWidthF(pInfo->m_twoBLWidth);
pen.setStyle(pInfo->m_twoBLlineStyle);
graph->setPen(pen);
}
graph = this->graph(2); // 右二比例
if (graph)
{
QPen pen = graph->pen();
pen.setColor(pInfo->m_twoBLlineColor);
pen.setWidthF(pInfo->m_twoBLWidth);
pen.setStyle(pInfo->m_twoBLlineStyle);
graph->setPen(pen);
}
}
else
{
if ("曲线线型" == strGroup)
{
QCPGraph* graph = this->graph(0);
if (graph)
{
QPen pen = graph->pen();
pen.setColor(pInfo->m_lineColor);
pen.setWidthF(pInfo->m_dWidth);
pen.setStyle(pInfo->m_lineStyle);
graph->setPen(pen);
}
}
else
this->changePropertyWaveUpdate(); // 波列
}
}
//道宽改变后,避免井壁取心等组件变形,需要重新刷新 //道宽改变后,避免井壁取心等组件变形,需要重新刷新
void QMyCustomPlot::resetPosition() void QMyCustomPlot::resetPosition()
{ {

View File

@ -106,8 +106,11 @@ public:
void setColGridVisible(bool bvis); void setColGridVisible(bool bvis);
// 单比例连续折返 // 单比例连续折返
void updateCurveConBackAndForth(bool bkd = false); void updateCurveConBackAndForth();
// 二比例
void updateCurveTwoBackAndForth();
//
void changeGrapProperty(QString strGroup);
protected: protected:
@ -377,7 +380,7 @@ public:
//曲线 //曲线
void addRandomGraph(QVector<double> x, QVector<double> y, QString strSlfName, QString strLineName, QString strAliasName, QString strUnit, void addRandomGraph(QVector<double> x, QVector<double> y, QString strSlfName, QString strLineName, QString strAliasName, QString strUnit,
double newLeftScale, double newRightScale, QString strScaleType, QColor &newlineColor, double width, Qt::PenStyle lineStyle); double newLeftScale, double newRightScale, QString strScaleType, QColor &newlineColor, double& width, Qt::PenStyle lineStyle);
//文字结论 //文字结论
void addTextToPlot(double left_Low, double right_Hight, const QString strText, bool bRefresh=true, QColor crColor=QColor(255, 255, 255, 80)); void addTextToPlot(double left_Low, double right_Hight, const QString strText, bool bRefresh=true, QColor crColor=QColor(255, 255, 255, 80));