/*! Paint the contour lines \param painter Painter \param xMap Maps x-values into pixel coordinates. \param yMap Maps y-values into pixel coordinates. \param contourLines Contour lines \sa renderContourLines(), defaultContourPen(), contourPen() */ void QwtPlotSpectrogram::drawContourLines( QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtRasterData::ContourLines &contourLines ) const { if ( d_data->data == NULL ) return; const int numLevels = d_data->contourLevels.size(); for ( int l = 0; l < numLevels; l++ ) { const double level = d_data->contourLevels[l]; QPen pen = defaultContourPen(); if ( pen.style() == Qt::NoPen ) pen = contourPen( level ); if ( pen.style() == Qt::NoPen ) continue; painter->setPen( pen ); const QPolygonF &lines = contourLines[level]; for ( int i = 0; i < lines.size(); i += 2 ) { const QPointF p1( xMap.transform( lines[i].x() ), yMap.transform( lines[i].y() ) ); const QPointF p2( xMap.transform( lines[i+1].x() ), yMap.transform( lines[i+1].y() ) ); QwtPainter::drawLine( painter, p1, p2 ); } } }
void Spectrogram::drawContourLines (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtRasterData::ContourLines &contourLines) const { //QwtPlotSpectrogram::drawContourLines(p, xMap, yMap, contourLines); QwtValueList levels = contourLevels(); const int numLevels = (int)levels.size(); for (int l = 0; l < numLevels; l++){ const double level = levels[l]; QPen pen = defaultContourPen(); if ( pen.style() == Qt::NoPen ) pen = contourPen(level); if ( pen.style() == Qt::NoPen ) continue; p->setPen(QwtPainter::scaledPen(pen)); const QPolygonF &lines = contourLines[level]; for ( int i = 0; i < (int)lines.size(); i += 2 ){ const QPointF p1( xMap.xTransform(lines[i].x()), yMap.transform(lines[i].y()) ); const QPointF p2( xMap.xTransform(lines[i + 1].x()), yMap.transform(lines[i + 1].y()) ); p->drawLine(p1, p2); } } if (d_show_labels) updateLabels(p, xMap, yMap, contourLines); }