qwt_polar_spectrogram.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
  2. * QwtPolar Widget Library
  3. * Copyright (C) 2008 Uwe Rathmann
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the Qwt License, Version 1.0
  7. *****************************************************************************/
  8. #ifndef QWT_POLAR_SPECTROGRAM_H
  9. #define QWT_POLAR_SPECTROGRAM_H
  10. #include "qwt_polar_global.h"
  11. #include "qwt_polar_item.h"
  12. #include <qimage.h>
  13. class QwtRasterData;
  14. class QwtColorMap;
  15. /*!
  16. \brief An item, which displays a spectrogram
  17. A spectrogram displays threedimenional data, where the 3rd dimension
  18. ( the intensity ) is displayed using colors. The colors are calculated
  19. from the values using a color map.
  20. \sa QwtRasterData, QwtColorMap
  21. */
  22. class QWT_POLAR_EXPORT QwtPolarSpectrogram: public QwtPolarItem
  23. {
  24. public:
  25. /*!
  26. Attributes to modify the drawing algorithm.
  27. The default setting disables ApproximatedAtan
  28. \sa setPaintAttribute(), testPaintAttribute()
  29. */
  30. enum PaintAttribute
  31. {
  32. /*!
  33. Use qwtFastAtan2 instead of atan2 for translating
  34. widget into polar coordinates.
  35. */
  36. ApproximatedAtan = 0x01
  37. };
  38. //! Paint attributes
  39. typedef QFlags<PaintAttribute> PaintAttributes;
  40. explicit QwtPolarSpectrogram();
  41. virtual ~QwtPolarSpectrogram();
  42. void setData( QwtRasterData *data );
  43. const QwtRasterData *data() const;
  44. void setColorMap( QwtColorMap * );
  45. const QwtColorMap *colorMap() const;
  46. void setPaintAttribute( PaintAttribute, bool on = true );
  47. bool testPaintAttribute( PaintAttribute ) const;
  48. virtual int rtti() const;
  49. virtual void draw( QPainter *painter,
  50. const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
  51. const QPointF &pole, double radius,
  52. const QRectF &canvasRect ) const;
  53. virtual QwtInterval boundingInterval( int scaleId ) const;
  54. protected:
  55. virtual QImage renderImage(
  56. const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
  57. const QPointF &pole, const QRect &rect ) const;
  58. virtual void renderTile(
  59. const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
  60. const QPointF &pole, const QPoint &imagePos,
  61. const QRect &tile, QImage *image ) const;
  62. private:
  63. class TileInfo;
  64. void renderTile( const QwtScaleMap &, const QwtScaleMap &,
  65. const QPointF &pole, TileInfo * ) const;
  66. class PrivateData;
  67. PrivateData *d_data;
  68. };
  69. Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarSpectrogram::PaintAttributes )
  70. #endif