添加波列-波形属性,绘制波深度、绘制波基线、奇偶配色、最大振幅、波列基值
This commit is contained in:
parent
1255631d7f
commit
8223afefd9
|
|
@ -134,7 +134,8 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
|
|||
QStringList slist;
|
||||
slist << "显示名称" << "显示单位" << "曲线名称" << "曲线单位" << "曲线刻度"
|
||||
<< "类型" << "方式" << "左刻度" << "右刻度" << "幅度刻度" << "最大振幅" << "颜色" << "线宽"
|
||||
<< "波形间隔" << "显示刻度" << "色板" << "变密度颜色级数";
|
||||
<< "绘制波深度" << "绘制波基线" << "奇偶配色"
|
||||
<< "波列基值" << "波形间隔" << "波形高度" << "显示刻度" << "色板" << "变密度颜色级数";
|
||||
for (int i = 0; i < slist.length(); i++)
|
||||
{
|
||||
if (slist.at(i) == m_propertyData[pProperty])
|
||||
|
|
|
|||
|
|
@ -621,12 +621,33 @@ bool FormInfo::setInfoProperty(QString strProName, QVariant val)
|
|||
}
|
||||
else if ("最大振幅" == strProName)
|
||||
{
|
||||
bDraw = true;
|
||||
this->m_fMaxAmp = val.toFloat();
|
||||
}
|
||||
else if ("显示刻度" == strProName)
|
||||
{
|
||||
this->m_bShowScale = val.toBool();
|
||||
}
|
||||
else if ("绘制波深度" == strProName)
|
||||
{
|
||||
bDraw = true;
|
||||
this->m_bDrawDepth = val.toBool();
|
||||
}
|
||||
else if ("绘制波基线" == strProName)
|
||||
{
|
||||
bDraw = true;
|
||||
this->m_bDrawBase = val.toBool();
|
||||
}
|
||||
else if ("奇偶配色" == strProName)
|
||||
{
|
||||
bDraw = true;
|
||||
this->m_bOddEven = val.toBool();
|
||||
}
|
||||
else if ("波列基值" == strProName)
|
||||
{
|
||||
bDraw = true;
|
||||
this->m_fWaveBase = val.toFloat();
|
||||
}
|
||||
else if ("波形间隔" == strProName)
|
||||
{
|
||||
bDraw = true;
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ void QMyCustomPlot::changePropertyWaveUpdate()
|
|||
this->m_colorMap->setVisible(false);
|
||||
|
||||
clearGraphs();
|
||||
clearItems();
|
||||
|
||||
if (this->m_bX2Y)
|
||||
{
|
||||
|
|
@ -128,6 +129,7 @@ void QMyCustomPlot::changePropertyWaveUpdate()
|
|||
if (this->m_colorMap)
|
||||
this->m_colorMap->setVisible(true);
|
||||
clearGraphs();
|
||||
clearItems();
|
||||
|
||||
this->m_bX2Y = true;
|
||||
this->initWave(m_strSlfName, m_strLineName);
|
||||
|
|
@ -306,9 +308,9 @@ void QMyCustomPlot::initWave2(QString strSlfName, QString strWaveName)
|
|||
float edepc = -m_iY1;
|
||||
float m_PlotSdep = -m_iY2;
|
||||
float m_MoveDep = 0.0f;
|
||||
float m_MaxRange = 1023.0f;
|
||||
float m_Base = 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)
|
||||
|
|
@ -318,6 +320,7 @@ void QMyCustomPlot::initWave2(QString strSlfName, QString strWaveName)
|
|||
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)
|
||||
{
|
||||
|
|
@ -338,7 +341,6 @@ void QMyCustomPlot::initWave2(QString strSlfName, QString strWaveName)
|
|||
vals.resize(nPoint);
|
||||
vVdl.vchar = &((char *)value)[iIndex*_nSamples*_wave.CodeLen];
|
||||
|
||||
float nmy = 0;
|
||||
for (int i = 0; i < nPoint; i++)
|
||||
{
|
||||
float ch = 0.0f;
|
||||
|
|
@ -369,10 +371,6 @@ void QMyCustomPlot::initWave2(QString strSlfName, QString strWaveName)
|
|||
}
|
||||
else ch = 0;
|
||||
vals[i] = ch;
|
||||
if (ch > nmy)
|
||||
{
|
||||
nmy = ch;
|
||||
}
|
||||
}
|
||||
|
||||
QVector<double> vx;
|
||||
|
|
@ -382,7 +380,7 @@ void QMyCustomPlot::initWave2(QString strSlfName, QString strWaveName)
|
|||
{
|
||||
vx << i;
|
||||
|
||||
double d = (-dep1 - 1) + vals[i] / (nmy/ m_nWaveHei);
|
||||
double d = (-dep1 - 1) + vals[i] * yscale;
|
||||
vy << d;
|
||||
if (d < dminy)
|
||||
dminy = d;
|
||||
|
|
@ -394,11 +392,27 @@ void QMyCustomPlot::initWave2(QString strSlfName, QString strWaveName)
|
|||
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_nDrawType == 1)
|
||||
if (m_bDrawBase || m_nDrawType == 1) // 填充 || 绘制波基线
|
||||
{
|
||||
QCPGraph * graph1 = widget->graph(nidx);
|
||||
if (graph1 == NULL)
|
||||
|
|
@ -406,6 +420,8 @@ void QMyCustomPlot::initWave2(QString strSlfName, QString strWaveName)
|
|||
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();
|
||||
|
|
@ -414,10 +430,14 @@ void QMyCustomPlot::initWave2(QString strSlfName, QString strWaveName)
|
|||
vy << dminy << dminy;
|
||||
graph1->setData(vx, vy);
|
||||
nidx++;
|
||||
|
||||
graph0->setBrush(QBrush(m_newColor));
|
||||
graph0->setChannelFillGraph(graph1);
|
||||
if (m_nDrawType == 1)
|
||||
{
|
||||
graph0->setBrush(QBrush(m_newColor));
|
||||
graph0->setChannelFillGraph(graph1);
|
||||
}
|
||||
}
|
||||
|
||||
nOdd++;
|
||||
}
|
||||
widget->replot();
|
||||
|
||||
|
|
@ -1303,30 +1323,50 @@ void QMyCustomPlot::s_changeDrawProperty(QVariantList vlist)
|
|||
m_strLineName == strLineName)
|
||||
{
|
||||
QString strProperty = vlist.at(5).toString();
|
||||
QString strValue = vlist.at(6).toString();
|
||||
QVariant varVal = vlist.at(6).toString();
|
||||
if ("类型" == strProperty)
|
||||
{
|
||||
m_nDrawType = strValue.toInt();
|
||||
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 = strValue.toInt();
|
||||
m_nWaveJg = varVal.toInt();
|
||||
this->changePropertyWaveUpdate();
|
||||
}
|
||||
else if ("波形高度" == strProperty)
|
||||
{
|
||||
m_nWaveHei = strValue.toInt();
|
||||
m_nWaveHei = varVal.toInt();
|
||||
this->changePropertyWaveUpdate();
|
||||
}
|
||||
else if ("颜色" == strProperty)
|
||||
{
|
||||
m_newColor = vlist.at(6).value<QColor>();
|
||||
m_newColor = varVal.value<QColor>();
|
||||
this->changePropertyWaveUpdate();
|
||||
}
|
||||
else if ("方式" == strProperty)
|
||||
{
|
||||
m_nMode = strValue.toFloat();
|
||||
m_nMode = varVal.toFloat();
|
||||
this->updateWave();
|
||||
}
|
||||
else if ("左刻度" == strProperty)
|
||||
|
|
@ -1337,18 +1377,23 @@ void QMyCustomPlot::s_changeDrawProperty(QVariantList vlist)
|
|||
{
|
||||
if (m_colorMap)
|
||||
{
|
||||
m_fScaleV = strValue.toFloat();
|
||||
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(strValue.toInt(), m_nColorNum);
|
||||
this->setSchemeIndex(varVal.toInt(), m_nColorNum);
|
||||
}
|
||||
else if ("变密度颜色级数" == strProperty)
|
||||
{
|
||||
this->setSchemeIndex(m_nSchemeIndex, strValue.toInt());
|
||||
this->setSchemeIndex(m_nSchemeIndex, varVal.toInt());
|
||||
}
|
||||
this->replot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,6 +88,11 @@ public:
|
|||
float m_fmax;
|
||||
int m_nColorNum = 256;
|
||||
int m_nSchemeIndex = 1;
|
||||
bool m_bDrawDepth = false; // 绘制波深度
|
||||
bool m_bDrawBase = false; // 绘制波基线
|
||||
bool m_bOddEven = false; // 奇偶配色
|
||||
float m_Base = 0.0f;
|
||||
float m_MaxRange = 1023.0f;
|
||||
int m_nWaveJg = 100;
|
||||
int m_nWaveHei = 1;
|
||||
public:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user