qwt_raster_data.h 2.73 KB
Newer Older
pixhawk's avatar
pixhawk committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
 * Qwt Widget Library
 * Copyright (C) 1997   Josef Wilgen
 * Copyright (C) 2002   Uwe Rathmann
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the Qwt License, Version 1.0
 *****************************************************************************/

// vim: expandtab

#ifndef QWT_RASTER_DATA_H
#define QWT_RASTER_DATA_H 1

#include <qmap.h>
#include "qwt_global.h"
#include "qwt_double_rect.h"
#include "qwt_double_interval.h"

#if QT_VERSION >= 0x040000
#include <qlist.h>
#include <QPolygonF>

#if defined(QWT_TEMPLATEDLL)
// MOC_SKIP_BEGIN
template class QWT_EXPORT QMap<double, QPolygonF>;
// MOC_SKIP_END
#endif

#else
#include <qvaluelist.h>
#include "qwt_array.h"
#include "qwt_double_rect.h"
#if defined(QWT_TEMPLATEDLL)
// MOC_SKIP_BEGIN
#ifndef QWTARRAY_TEMPLATE_QWTDOUBLEPOINT // by mjo3
#define QWTARRAY_TEMPLATE_QWTDOUBLEPOINT
template class QWT_EXPORT QwtArray<QwtDoublePoint>;
#endif //end of QWTARRAY_TEMPLATE_QWTDOUBLEPOINT
#ifndef QMAP_TEMPLATE_DOUBLE_QWTDOUBLEPOINT // by mjo3
#define QMAP_TEMPLATE_DOUBLE_QWTDOUBLEPOINT
template class QWT_EXPORT QMap<double, QwtArray<QwtDoublePoint> >;
#endif //end of QMAP_TEMPLATE_QWTDOUBLEPOINT
// MOC_SKIP_END
#endif
#endif

class QwtScaleMap;

/*!
  \brief QwtRasterData defines an interface to any type of raster data.
*/
class QWT_EXPORT QwtRasterData
{
public:
#if QT_VERSION >= 0x040000
    typedef QMap<double, QPolygonF> ContourLines;
#else
    typedef QMap<double, QwtArray<QwtDoublePoint> > ContourLines;
#endif

    enum ConrecAttribute
    {
        IgnoreAllVerticesOnLevel = 1,
        IgnoreOutOfRange = 2
    };

    QwtRasterData();
    QwtRasterData(const QwtDoubleRect &);
    virtual ~QwtRasterData();

    //! Clone the data
    virtual QwtRasterData *copy() const = 0;

    virtual void setBoundingRect(const QwtDoubleRect &);
    QwtDoubleRect boundingRect() const;

    virtual QSize rasterHint(const QwtDoubleRect &) const;

    virtual void initRaster(const QwtDoubleRect &, const QSize& raster);
    virtual void discardRaster();

    //! \return the value at a raster position
    virtual double value(double x, double y) const = 0;

    //! \return the range of the values
    virtual QwtDoubleInterval range() const = 0;

#if QT_VERSION >= 0x040000
    virtual ContourLines contourLines(const QwtDoubleRect &rect,
        const QSize &raster, const QList<double> &levels, 
        int flags) const;
#else
    virtual ContourLines contourLines(const QwtDoubleRect &rect,
        const QSize &raster, const QValueList<double> &levels, 
        int flags) const;
#endif

    class Contour3DPoint;
    class ContourPlane;

private:
    QwtDoubleRect d_boundingRect;
};

#endif