qwt_raster_data.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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_RASTER_DATA_H
  10. #define QWT_RASTER_DATA_H 1
  11. #include "qwt_global.h"
  12. #include "qwt_interval.h"
  13. #include <qmap.h>
  14. #include <qlist.h>
  15. #include <qpolygon.h>
  16. class QwtScaleMap;
  17. /*!
  18. \brief QwtRasterData defines an interface to any type of raster data.
  19. QwtRasterData is an abstract interface, that is used by
  20. QwtPlotRasterItem to find the values at the pixels of its raster.
  21. Often a raster item is used to display values from a matrix. Then the
  22. derived raster data class needs to implement some sort of resampling,
  23. that maps the raster of the matrix into the requested raster of
  24. the raster item ( depending on resolution and scales of the canvas ).
  25. */
  26. class QWT_EXPORT QwtRasterData
  27. {
  28. public:
  29. //! Contour lines
  30. typedef QMap<double, QPolygonF> ContourLines;
  31. //! Flags to modify the contour algorithm
  32. enum ConrecFlag
  33. {
  34. //! Ignore all vertices on the same level
  35. IgnoreAllVerticesOnLevel = 0x01,
  36. //! Ignore all values, that are out of range
  37. IgnoreOutOfRange = 0x02
  38. };
  39. //! Flags to modify the contour algorithm
  40. typedef QFlags<ConrecFlag> ConrecFlags;
  41. QwtRasterData();
  42. virtual ~QwtRasterData();
  43. virtual void setInterval( Qt::Axis, const QwtInterval & );
  44. const QwtInterval &interval(Qt::Axis) const;
  45. virtual QRectF pixelHint( const QRectF & ) const;
  46. virtual void initRaster( const QRectF &, const QSize& raster );
  47. virtual void discardRaster();
  48. /*!
  49. \return the value at a raster position
  50. \param x X value in plot coordinates
  51. \param y Y value in plot coordinates
  52. */
  53. virtual double value( double x, double y ) const = 0;
  54. virtual ContourLines contourLines( const QRectF &rect,
  55. const QSize &raster, const QList<double> &levels,
  56. ConrecFlags ) const;
  57. class Contour3DPoint;
  58. class ContourPlane;
  59. private:
  60. // Disabled copy constructor and operator=
  61. QwtRasterData( const QwtRasterData & );
  62. QwtRasterData &operator=( const QwtRasterData & );
  63. QwtInterval d_intervals[3];
  64. };
  65. /*!
  66. \return Bounding interval for a axis
  67. \sa setInterval
  68. */
  69. inline const QwtInterval &QwtRasterData::interval( Qt::Axis axis) const
  70. {
  71. return d_intervals[axis];
  72. }
  73. Q_DECLARE_OPERATORS_FOR_FLAGS( QwtRasterData::ConrecFlags )
  74. #endif