qwt_matrix_raster_data.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
  2. * Qwt Widget Library
  3. * Copyright (C) 1997 Josef Wilgen
  4. * Copyright (C) 2002 Uwe Rathmann
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the Qwt License, Version 1.0
  8. *****************************************************************************/
  9. #ifndef QWT_MATRIX_RASTER_DATA_H
  10. #define QWT_MATRIX_RASTER_DATA_H 1
  11. #include "qwt_global.h"
  12. #include "qwt_raster_data.h"
  13. #include <qvector.h>
  14. /*!
  15. \brief A class representing a matrix of values as raster data
  16. QwtMatrixRasterData implements an interface for a matrix of
  17. equidistant values, that can be used by a QwtPlotRasterItem.
  18. It implements a couple of resampling algorithms, to provide
  19. values for positions, that or not on the value matrix.
  20. */
  21. class QWT_EXPORT QwtMatrixRasterData: public QwtRasterData
  22. {
  23. public:
  24. /*!
  25. \brief Resampling algorithm
  26. The default setting is NearestNeighbour;
  27. */
  28. enum ResampleMode
  29. {
  30. /*!
  31. Return the value from the matrix, that is nearest to the
  32. the requested position.
  33. */
  34. NearestNeighbour,
  35. /*!
  36. Interpolate the value from the distances and values of the
  37. 4 surrounding values in the matrix,
  38. */
  39. BilinearInterpolation
  40. };
  41. QwtMatrixRasterData();
  42. virtual ~QwtMatrixRasterData();
  43. void setResampleMode(ResampleMode mode);
  44. ResampleMode resampleMode() const;
  45. virtual void setInterval( Qt::Axis, const QwtInterval & );
  46. void setValueMatrix( const QVector<double> &values, int numColumns );
  47. const QVector<double> valueMatrix() const;
  48. void setValue( int row, int col, double value );
  49. int numColumns() const;
  50. int numRows() const;
  51. virtual QRectF pixelHint( const QRectF & ) const;
  52. virtual double value( double x, double y ) const;
  53. private:
  54. void update();
  55. class PrivateData;
  56. PrivateData *d_data;
  57. };
  58. #endif