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