code cleanup
This commit is contained in:
parent
92bb9c253a
commit
7dcd612879
2 changed files with 24 additions and 44 deletions
|
@ -66,47 +66,24 @@ CAnalyzerConsole::CAnalyzerConsole ( CClient* pNCliP,
|
||||||
QObject::connect ( &TimerErrRateUpdate, SIGNAL ( timeout() ),
|
QObject::connect ( &TimerErrRateUpdate, SIGNAL ( timeout() ),
|
||||||
this, SLOT ( OnTimerErrRateUpdate() ) );
|
this, SLOT ( OnTimerErrRateUpdate() ) );
|
||||||
|
|
||||||
// window events
|
|
||||||
QObject::connect ( this, SIGNAL ( resizeEvent ( QResizeEvent* ) ),
|
|
||||||
this, SLOT ( OnResizeEvent ( QResizeEvent* ) ) );
|
|
||||||
|
|
||||||
|
|
||||||
// Timers ------------------------------------------------------------------
|
// Timers ------------------------------------------------------------------
|
||||||
// start timer for error rate graph
|
// start timer for error rate graph
|
||||||
TimerErrRateUpdate.start ( ERR_RATE_GRAPH_UPDATE_TIME_MS );
|
TimerErrRateUpdate.start ( ERR_RATE_GRAPH_UPDATE_TIME_MS );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAnalyzerConsole::OnResizeEvent ( QResizeEvent* event )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAnalyzerConsole::OnTimerErrRateUpdate()
|
void CAnalyzerConsole::OnTimerErrRateUpdate()
|
||||||
{
|
{
|
||||||
|
// generate current graph image
|
||||||
DrawFrame();
|
DrawFrame();
|
||||||
DrawErrorRateTrace();
|
DrawErrorRateTrace();
|
||||||
|
|
||||||
|
// set new image to the label
|
||||||
pGraphErrRate->setPixmap ( QPixmap().fromImage ( GraphImage ) );
|
pGraphErrRate->setPixmap ( QPixmap().fromImage ( GraphImage ) );
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAnalyzerConsole::DrawFrame()
|
void CAnalyzerConsole::DrawFrame()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
// scale image to correct size
|
|
||||||
GraphImage = GraphImage.scaled (
|
|
||||||
pTabWidgetBufErrRate->width(), pTabWidgetBufErrRate->height() );
|
|
||||||
|
|
||||||
// generate plot grid frame rectangle
|
|
||||||
GraphGridFrame.setRect ( pTabWidgetBufErrRate->x() + iGridFrameOffset,
|
|
||||||
pTabWidgetBufErrRate->y() + iGridFrameOffset,
|
|
||||||
pTabWidgetBufErrRate->width() - 2 * iGridFrameOffset,
|
|
||||||
pTabWidgetBufErrRate->height() - 2 * iGridFrameOffset - iXAxisTextHeight );
|
|
||||||
*/
|
|
||||||
|
|
||||||
// scale image to correct size
|
// scale image to correct size
|
||||||
GraphImage = GraphImage.scaled (
|
GraphImage = GraphImage.scaled (
|
||||||
GraphErrRateCanvasRect.width(), GraphErrRateCanvasRect.height() );
|
GraphErrRateCanvasRect.width(), GraphErrRateCanvasRect.height() );
|
||||||
|
@ -117,8 +94,6 @@ void CAnalyzerConsole::DrawFrame()
|
||||||
GraphErrRateCanvasRect.width() - 2 * iGridFrameOffset,
|
GraphErrRateCanvasRect.width() - 2 * iGridFrameOffset,
|
||||||
GraphErrRateCanvasRect.height() - 2 * iGridFrameOffset - iXAxisTextHeight );
|
GraphErrRateCanvasRect.height() - 2 * iGridFrameOffset - iXAxisTextHeight );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GraphImage.fill ( GraphBackgroundColor.rgb() ); // fill background
|
GraphImage.fill ( GraphBackgroundColor.rgb() ); // fill background
|
||||||
|
|
||||||
// create painter
|
// create painter
|
||||||
|
@ -131,8 +106,6 @@ void CAnalyzerConsole::DrawFrame()
|
||||||
|
|
||||||
void CAnalyzerConsole::DrawErrorRateTrace()
|
void CAnalyzerConsole::DrawErrorRateTrace()
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
// create painter
|
// create painter
|
||||||
QPainter GraphPainter ( &GraphImage );
|
QPainter GraphPainter ( &GraphImage );
|
||||||
|
|
||||||
|
@ -156,18 +129,19 @@ void CAnalyzerConsole::DrawErrorRateTrace()
|
||||||
const double dXSpace =
|
const double dXSpace =
|
||||||
static_cast<double> ( GraphGridFrame.width() ) / ( iNumBuffers - 1 );
|
static_cast<double> ( GraphGridFrame.width() ) / ( iNumBuffers - 1 );
|
||||||
|
|
||||||
// plot the limit line
|
// plot the limit line as dashed line
|
||||||
|
const double dYValLimitInGraph = CalcYPosInGraph ( dMin, dMax, dLogLimit );
|
||||||
|
|
||||||
|
GraphPainter.setPen ( QPen ( QBrush ( LineLimitColor ),
|
||||||
|
iLineWidth,
|
||||||
|
Qt::DashLine ) );
|
||||||
|
|
||||||
// TEST
|
GraphPainter.drawLine ( QPoint ( GraphGridFrame.x(), dYValLimitInGraph ),
|
||||||
const double dYValLimitInGraph = CalcYPosInGraph ( dMin, dMax, dLogLimit );
|
QPoint ( GraphGridFrame.x() +
|
||||||
GraphPainter.setPen ( QPen ( QBrush ( LineLimitColor ), iLineWidth, Qt::DashLine ) );
|
GraphGridFrame.width(), dYValLimitInGraph ) );
|
||||||
GraphPainter.drawLine ( QPoint ( GraphGridFrame.x(), dYValLimitInGraph ),
|
|
||||||
QPoint ( GraphGridFrame.x() + GraphGridFrame.width(), dYValLimitInGraph ) );
|
|
||||||
|
|
||||||
|
|
||||||
// plot the data
|
// plot the data
|
||||||
for ( i = 0; i < iNumBuffers; i++ )
|
for ( int i = 0; i < iNumBuffers; i++ )
|
||||||
{
|
{
|
||||||
// data convert in log domain
|
// data convert in log domain
|
||||||
// check for special case if error rate is 0 (which would lead to -Inf
|
// check for special case if error rate is 0 (which would lead to -Inf
|
||||||
|
@ -187,14 +161,21 @@ GraphPainter.drawLine ( QPoint ( GraphGridFrame.x(), dYValLimitInGraph ),
|
||||||
GraphGridFrame.x() + static_cast<int> ( dXSpace * i ),
|
GraphGridFrame.x() + static_cast<int> ( dXSpace * i ),
|
||||||
CalcYPosInGraph ( dMin, dMax, vecButErrorRates[i] ) );
|
CalcYPosInGraph ( dMin, dMax, vecButErrorRates[i] ) );
|
||||||
|
|
||||||
|
// draw a marker and a solid line which goes from the bottom to the
|
||||||
|
// marker (similar to Matlab stem() function)
|
||||||
|
GraphPainter.setPen ( QPen ( QBrush ( LineColor ),
|
||||||
|
iMarkerSize,
|
||||||
|
Qt::SolidLine,
|
||||||
|
Qt::RoundCap ) );
|
||||||
|
|
||||||
// TEST
|
GraphPainter.drawPoint ( curPoint );
|
||||||
GraphPainter.setPen ( QPen ( QBrush ( LineColor ), iMarkerSize, Qt::SolidLine, Qt::RoundCap ) );
|
|
||||||
GraphPainter.drawPoint ( curPoint );
|
|
||||||
GraphPainter.setPen ( QPen ( QBrush ( LineColor ), iLineWidth ) );
|
|
||||||
GraphPainter.drawLine ( QPoint ( curPoint.x(), GraphGridFrame.y() + GraphGridFrame.height() ), curPoint );
|
|
||||||
|
|
||||||
|
GraphPainter.setPen ( QPen ( QBrush ( LineColor ), iLineWidth ) );
|
||||||
|
|
||||||
|
GraphPainter.drawLine ( QPoint ( curPoint.x(),
|
||||||
|
GraphGridFrame.y() +
|
||||||
|
GraphGridFrame.height() ),
|
||||||
|
curPoint );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,6 @@ protected:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void OnTimerErrRateUpdate();
|
void OnTimerErrRateUpdate();
|
||||||
void OnResizeEvent ( QResizeEvent* event );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ANALYZERCONSOLE_H__FD6BKUBVE723IUH06C2AC__INCLUDED_
|
#endif // ANALYZERCONSOLE_H__FD6BKUBVE723IUH06C2AC__INCLUDED_
|
||||||
|
|
Loading…
Reference in a new issue