Changeset 8127 in ntrip for trunk/BNC/qwt/qwt_plot_spectrogram.cpp
- Timestamp:
- May 10, 2017, 3:20:54 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_plot_spectrogram.cpp
r4271 r8127 24 24 #endif 25 25 26 #define DEBUG_RENDER 0 27 28 #if DEBUG_RENDER 29 #include <QElapsedTimer> 30 #endif 31 26 32 class QwtPlotSpectrogram::PrivateData 27 33 { 28 34 public: 29 35 PrivateData(): 30 data( NULL ), 31 renderThreadCount( 1 ) 36 data( NULL ) 32 37 { 33 38 colorMap = new QwtLinearColorMap(); … … 35 40 36 41 conrecFlags = QwtRasterData::IgnoreAllVerticesOnLevel; 42 #if 0 37 43 conrecFlags |= QwtRasterData::IgnoreOutOfRange; 44 #endif 38 45 } 39 46 ~PrivateData() … … 46 53 QwtColorMap *colorMap; 47 54 DisplayModes displayMode; 48 49 uint renderThreadCount;50 55 51 56 QList<double> contourLevels; … … 108 113 } 109 114 115 legendChanged(); 110 116 itemChanged(); 111 117 } … … 123 129 124 130 /*! 125 Rendering an image from the raster data can often be done126 parallel on a multicore system.127 128 \param numThreads Number of threads to be used for rendering.129 If numThreads is set to 0, the system specific130 ideal thread count is used.131 132 The default thread count is 1 ( = no additional threads )133 134 \warning Rendering in multiple threads is only supported for Qt >= 4.4135 \sa renderThreadCount(), renderImage(), renderTile()136 */137 void QwtPlotSpectrogram::setRenderThreadCount( uint numThreads )138 {139 d_data->renderThreadCount = numThreads;140 }141 142 /*!143 \return Number of threads to be used for rendering.144 If numThreads is set to 0, the system specific145 ideal thread count is used.146 147 \warning Rendering in multiple threads is only supported for Qt >= 4.4148 \sa setRenderThreadCount(), renderImage(), renderTile()149 */150 uint QwtPlotSpectrogram::renderThreadCount() const151 {152 return d_data->renderThreadCount;153 }154 155 /*!156 131 Change the color map 157 132 … … 173 148 174 149 invalidateCache(); 150 151 legendChanged(); 175 152 itemChanged(); 176 153 } … … 183 160 { 184 161 return d_data->colorMap; 162 } 163 164 /*! 165 Build and assign the default pen for the contour lines 166 167 In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it 168 non cosmetic ( see QPen::isCosmetic() ). This method has been introduced 169 to hide this incompatibility. 170 171 \param color Pen color 172 \param width Pen width 173 \param style Pen style 174 175 \sa pen(), brush() 176 */ 177 void QwtPlotSpectrogram::setDefaultContourPen( 178 const QColor &color, qreal width, Qt::PenStyle style ) 179 { 180 setDefaultContourPen( QPen( color, width, style ) ); 185 181 } 186 182 … … 200 196 { 201 197 d_data->defaultContourPen = pen; 198 199 legendChanged(); 202 200 itemChanged(); 203 201 } … … 266 264 \return true, is enabled 267 265 266 The default setting enables QwtRasterData::IgnoreAllVerticesOnLevel 267 268 268 \sa setConrecClag(), renderContourLines(), 269 269 QwtRasterData::contourLines() … … 288 288 d_data->contourLevels = levels; 289 289 qSort( d_data->contourLevels ); 290 291 legendChanged(); 290 292 itemChanged(); 291 293 } 292 294 293 295 /*! 294 \ brief Return the levels of the contour lines.296 \return Levels of the contour lines. 295 297 296 298 The levels are sorted in increasing order. … … 384 386 \brief Render an image from data and color map. 385 387 386 For each pixel of rectthe value is mapped into a color.388 For each pixel of area the value is mapped into a color. 387 389 388 390 \param xMap X-Scale Map … … 421 423 d_data->data->initRaster( area, image.size() ); 422 424 425 #if DEBUG_RENDER 426 QElapsedTimer time; 427 time.start(); 428 #endif 429 423 430 #if QT_VERSION >= 0x040400 && !defined(QT_NO_QFUTURE) 424 uint numThreads = d_data->renderThreadCount;431 uint numThreads = renderThreadCount(); 425 432 426 433 if ( numThreads <= 0 ) … … 456 463 #endif 457 464 465 #if DEBUG_RENDER 466 const qint64 elapsed = time.elapsed(); 467 qDebug() << "renderImage" << imageSize << elapsed; 468 #endif 469 458 470 d_data->data->discardRaster(); 459 471 … … 486 498 const double ty = yMap.invTransform( y ); 487 499 488 QRgb *line = ( QRgb * )image->scanLine( y);500 QRgb *line = reinterpret_cast<QRgb *>( image->scanLine( y ) ); 489 501 line += tile.left(); 490 502 … … 521 533 \brief Return the raster to be used by the CONREC contour algorithm. 522 534 523 A larger size will improve the precisi sion of the CONREC algorithm,535 A larger size will improve the precision of the CONREC algorithm, 524 536 but will slow down the time that is needed to calculate the lines. 525 537 … … 527 539 the resolution depending on pixelSize(). 528 540 529 \param area Rect , where to calculate the contour lines530 \param rect Rect in pixel coordinates, where to paint the contour lines541 \param area Rectangle, where to calculate the contour lines 542 \param rect Rectangle in pixel coordinates, where to paint the contour lines 531 543 \return Raster to be used by the CONREC contour algorithm. 532 544 … … 556 568 \param rect Rectangle, where to calculate the contour lines 557 569 \param raster Raster, used by the CONREC algorithm 570 \return Calculated contour lines 558 571 559 572 \sa contourLevels(), setConrecFlag(), … … 586 599 if ( d_data->data == NULL ) 587 600 return; 588 589 const QwtInterval intensityRange = d_data->data->interval( Qt::ZAxis );590 601 591 602 const int numLevels = d_data->contourLevels.size(); … … 622 633 \param xMap Maps x-values into pixel coordinates. 623 634 \param yMap Maps y-values into pixel coordinates. 624 \param canvasRect Contents rect of the canvas in painter coordinates635 \param canvasRect Contents rectangle of the canvas in painter coordinates 625 636 626 637 \sa setDisplayMode(), renderImage(),
Note:
See TracChangeset
for help on using the changeset viewer.