QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_plot_spectrogram.h
1/******************************************************************************
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 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_PLOT_SPECTROGRAM_H
28#define QWT_PLOT_SPECTROGRAM_H
29
30#include "qwt_global.h"
31#include "qwt_raster_data.h"
32#include "qwt_plot_rasteritem.h"
33
34class QwtColorMap;
35template< typename T >
36class QList;
37
54class QWT_EXPORT QwtPlotSpectrogram : public QwtPlotRasterItem
55{
56public:
65 {
67 ImageMode = 0x01,
68
70 ContourMode = 0x02
71 };
72
73 Q_DECLARE_FLAGS(DisplayModes, DisplayMode)
74
75 // Constructor
76 explicit QwtPlotSpectrogram(const QString& title = QString());
77 // Destructor
78 ~QwtPlotSpectrogram() override;
79
80 // Set a display mode
81 void setDisplayMode(DisplayMode, bool on = true);
82 // Test a display mode
83 bool testDisplayMode(DisplayMode) const;
84
85 // Set the raster data
86 void setData(QwtRasterData* data);
87 // Get the raster data (const)
88 const QwtRasterData* data() const;
89 // Get the raster data
90 QwtRasterData* data();
91
92 // Set the color map
93 void setColorMap(QwtColorMap*);
94 // Get the color map
95 const QwtColorMap* colorMap() const;
96
97 // Set the color table size
98 void setColorTableSize(int numColors);
99 // Get the color table size
100 int colorTableSize() const;
101
102 // Get the interval for an axis
103 virtual QwtInterval interval(Qt::Axis) const override;
104 // Get the pixel hint
105 virtual QRectF pixelHint(const QRectF&) const override;
106
107 // Set the default contour pen with color, width and style
108 void setDefaultContourPen(const QColor&, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine);
109 // Set the default contour pen
110 void setDefaultContourPen(const QPen&);
111 // Get the default contour pen
112 QPen defaultContourPen() const;
113
114 // Get the contour pen for a specific level
115 virtual QPen contourPen(double level) const;
116
117 // Set a conrec flag
118 void setConrecFlag(QwtRasterData::ConrecFlag, bool on);
119 // Test a conrec flag
120 bool testConrecFlag(QwtRasterData::ConrecFlag) const;
121
122 // Set the contour levels
123 void setContourLevels(const QList< double >&);
124 // Get the contour levels
125 QList< double > contourLevels() const;
126
127 // Get the runtime type information
128 virtual int rtti() const override;
129
130 // Draw the spectrogram
131 virtual void draw(QPainter*, const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& canvasRect) const override;
132
133protected:
137 virtual QImage
138 renderImage(const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& area, const QSize& imageSize) const override;
139
143 virtual QSize contourRasterSize(const QRectF&, const QRect&) const;
144
148 virtual QwtRasterData::ContourLines renderContourLines(const QRectF& rect, const QSize& raster) const;
149
153 virtual void
154 drawContourLines(QPainter*, const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QwtRasterData::ContourLines&) const;
155
159 void renderTile(const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRect& tile, QImage*) const;
160
161private:
162 QWT_DECLARE_PRIVATE(QwtPlotSpectrogram)
163};
164
165Q_DECLARE_OPERATORS_FOR_FLAGS(QwtPlotSpectrogram::DisplayModes)
166
167#endif
Definition qwt_raster_data.h:38
Definition qwt_raster_data.h:40
QwtColorMap is used to map values into colors.
Definition qwt_colormap.h:33
A class representing an interval
Definition qwt_interval.h:39
virtual int rtti() const
Runtime type information
Definition qwt_plot_item.cpp:155
A class, which displays raster data
Definition qwt_plot_rasteritem.h:55
virtual void draw(QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const override
Draw the raster data
Definition qwt_plot_rasteritem.cpp:574
virtual QRectF pixelHint(const QRectF &) const
Pixel hint
Definition qwt_plot_rasteritem.cpp:560
virtual QwtInterval interval(Qt::Axis) const
Get the bounding interval for an axis
Definition qwt_plot_rasteritem.cpp:715
A plot item, which displays a spectrogram
Definition qwt_plot_spectrogram.h:55
DisplayMode
Display modes
Definition qwt_plot_spectrogram.h:65
QwtRasterData defines an interface to any type of raster data.
Definition qwt_raster_data.h:63
ConrecFlag
Flags to modify the contour algorithm
Definition qwt_raster_data.h:103
A scale map
Definition qwt_scale_map.h:44