QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_compass_rose.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_COMPASS_ROSE_H
28#define QWT_COMPASS_ROSE_H
29
30#include "qwt_global.h"
31#include <qpalette.h>
32
33class QPainter;
34
40class QWT_EXPORT QwtCompassRose
41{
42public:
43 // Constructor
45 // Destructor
46 virtual ~QwtCompassRose();
47
48 // Sets the palette for the rose
49 virtual void setPalette(const QPalette&);
50 // Returns the palette of the rose
51 const QPalette& palette() const;
52
61 virtual void draw(QPainter* painter,
62 const QPointF& center,
63 double radius,
64 double north,
65 QPalette::ColorGroup colorGroup = QPalette::Active) const = 0;
66
67private:
68 QwtCompassRose(const QwtCompassRose&) = delete;
69 QwtCompassRose& operator=(const QwtCompassRose&) = delete;
70
71 QPalette m_palette;
72};
73
79class QWT_EXPORT QwtSimpleCompassRose : public QwtCompassRose
80{
81public:
82 // Constructs a simple compass rose with specified number of thorns and levels
83 QwtSimpleCompassRose(int numThorns = 8, int numThornLevels = -1);
84 // Destructor
85 ~QwtSimpleCompassRose() override;
86
87 // Sets the width of the rose heads (range: 0.03 to 0.4)
88 void setWidth(double);
89 // Returns the width of the rose heads
90 double width() const;
91
92 // Sets the number of thorns on one level (aligned to multiple of 4, minimum 4)
93 void setNumThorns(int);
94 // Returns the number of thorns
95 int numThorns() const;
96
97 // Sets the number of thorn levels
98 void setNumThornLevels(int);
99 // Returns the number of thorn levels
100 int numThornLevels() const;
101
102 // Sets the shrink factor for thorns with each level (default: 0.9)
103 void setShrinkFactor(double factor);
104 // Returns the shrink factor for thorns
105 double shrinkFactor() const;
106
107 // Set flat style
108 void setFlatStyle(bool);
109 // Return flat style
110 bool flatStyle() const;
111
112 // Draw the rose (override from base class)
113 virtual void
114 draw(QPainter*, const QPointF& center, double radius, double north, QPalette::ColorGroup = QPalette::Active) const override;
115
116 // Static helper to draw a rose with specified parameters
117 static void drawRose(QPainter*,
118 const QPalette&,
119 const QPointF& center,
120 double radius,
121 double north,
122 double width,
123 int numThorns,
124 int numThornLevels,
125 double shrinkFactor,
126 bool flatStyle = true);
127
128private:
129 QWT_DECLARE_PRIVATE(QwtSimpleCompassRose)
130};
131
132#endif
Abstract base class for a compass rose
Definition qwt_compass_rose.h:41
virtual void draw(QPainter *painter, const QPointF &center, double radius, double north, QPalette::ColorGroup colorGroup=QPalette::Active) const =0
Draw the rose
A simple rose for QwtCompass
Definition qwt_compass_rose.h:80