Qwt User's Guide 6.2.0

qwt_polar_grid.h
1 /******************************************************************************
2 * QwtPolar Widget Library
3 * Copyright (C) 2008 Uwe Rathmann
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the Qwt License, Version 1.0
7 *****************************************************************************/
8
9 #ifndef QWT_POLAR_GRID_H
10 #define QWT_POLAR_GRID_H
11
12 #include "qwt_global.h"
13 #include "qwt_polar.h"
14 #include "qwt_polar_item.h"
15 #include "qwt_polar_plot.h"
16
17 class QPainter;
18 class QPen;
19 class QwtScaleMap;
20 class QwtScaleDiv;
21 class QwtRoundScaleDraw;
22 class QwtScaleDraw;
23
41 class QWT_EXPORT QwtPolarGrid : public QwtPolarItem
42 {
43 public:
52 enum DisplayFlag
53 {
58 SmartOriginLabel = 1,
59
64 HideMaxRadiusLabel = 2,
65
72 ClipAxisBackground = 4,
73
78 SmartScaleDraw = 8,
79
85 ClipGridLines = 16
86 };
87
88 Q_DECLARE_FLAGS( DisplayFlags, DisplayFlag )
89
90
94 enum GridAttribute
95 {
100 AutoScaling = 0x01
101 };
102
103 Q_DECLARE_FLAGS( GridAttributes, GridAttribute )
104
105 explicit QwtPolarGrid();
106 virtual ~QwtPolarGrid();
107
108 virtual int rtti() const QWT_OVERRIDE;
109
110 void setDisplayFlag( DisplayFlag, bool on = true );
111 bool testDisplayFlag( DisplayFlag ) const;
112
113 void setGridAttribute( GridAttribute, bool on = true );
114 bool testGridAttribute( GridAttribute ) const;
115
116 void showGrid( int scaleId, bool show = true );
117 bool isGridVisible( int scaleId ) const;
118
119 void showMinorGrid( int scaleId, bool show = true );
120 bool isMinorGridVisible( int scaleId ) const;
121
122 void showAxis( int axisId, bool show = true );
123 bool isAxisVisible( int axisId ) const;
124
125 void setPen( const QPen& p );
126 void setFont( const QFont& );
127
128 void setMajorGridPen( const QPen& p );
129 void setMajorGridPen( int scaleId, const QPen& p );
130 QPen majorGridPen( int scaleId ) const;
131
132 void setMinorGridPen( const QPen& p );
133 void setMinorGridPen( int scaleId, const QPen& p );
134 QPen minorGridPen( int scaleId ) const;
135
136 void setAxisPen( int axisId, const QPen& p );
137 QPen axisPen( int axisId ) const;
138
139 void setAxisFont( int axisId, const QFont& p );
140 QFont axisFont( int axisId ) const;
141
142 void setScaleDraw( int axisId, QwtScaleDraw* );
143 const QwtScaleDraw* scaleDraw( int axisId ) const;
144 QwtScaleDraw* scaleDraw( int axisId );
145
146 void setAzimuthScaleDraw( QwtRoundScaleDraw* );
147 const QwtRoundScaleDraw* azimuthScaleDraw() const;
148 QwtRoundScaleDraw* azimuthScaleDraw();
149
150 virtual void draw( QPainter* p,
151 const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
152 const QPointF& pole, double radius,
153 const QRectF& rect ) const QWT_OVERRIDE;
154
155 virtual void updateScaleDiv( const QwtScaleDiv& azimuthMap,
156 const QwtScaleDiv& radialMap, const QwtInterval& ) QWT_OVERRIDE;
157
158 virtual int marginHint() const QWT_OVERRIDE;
159
160 protected:
161 void drawRays( QPainter*, const QRectF&,
162 const QPointF& pole, double radius,
163 const QwtScaleMap& azimuthMap, const QList< double >& ) const;
164 void drawCircles( QPainter*, const QRectF&,
165 const QPointF& pole, const QwtScaleMap& radialMap,
166 const QList< double >& ) const;
167
168 void drawAxis( QPainter*, int axisId ) const;
169
170 private:
171 void updateScaleDraws(
172 const QwtScaleMap& azimuthMap, const QwtScaleMap& radialMap,
173 const QPointF& pole, const double radius ) const;
174
175 private:
176 class PrivateData;
177 PrivateData* m_data;
178 };
179
180 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarGrid::DisplayFlags )
181 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarGrid::GridAttributes )
182
183 #endif
QList
Definition: qwt_abstract_legend.h:17
QwtInterval
A class representing an interval.
Definition: qwt_interval.h:23
QwtPolarGrid
An item which draws scales and grid lines on a polar plot.
Definition: qwt_polar_grid.h:42
QwtPolarGrid::GridAttribute
GridAttribute
Grid attributes.
Definition: qwt_polar_grid.h:95
QwtPolarGrid::GridAttributes
QFlags< GridAttribute > GridAttributes
Definition: qwt_polar_grid.h:103
QwtPolarGrid::DisplayFlags
QFlags< DisplayFlag > DisplayFlags
Definition: qwt_polar_grid.h:88
QwtPolarGrid::DisplayFlag
DisplayFlag
Definition: qwt_polar_grid.h:53
QwtPolarItem
Base class for items on a polar plot.
Definition: qwt_polar_item.h:38
QwtPolarItem::rtti
virtual int rtti() const
Definition: qwt_polar_item.cpp:112
QwtRoundScaleDraw
A class for drawing round scales.
Definition: qwt_round_scale_draw.h:32
QwtScaleDiv
A class representing a scale division.
Definition: qwt_scale_div.h:34
QwtScaleDraw
A class for drawing scales.
Definition: qwt_scale_draw.h:36
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:27