Qwt Polar User's Guide: qwt_polar_grid.h Source File

Qwt Polar User's Guide 1.1.1

- Main Page
- Related Pages
- Classes

All Classes Functions Typedefs Enumerations Enumerator Pages
qwt_polar_grid.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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_polar_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_POLAR_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
89 typedef QFlags<DisplayFlag> DisplayFlags;
90
95 enum GridAttribute
96 {
101 AutoScaling = 0x01
102 };
103
105 typedef QFlags<GridAttribute> GridAttributes;
106
107 explicit QwtPolarGrid();
108 virtual ~QwtPolarGrid();
109
110 virtual int rtti() const;
111
112 void setDisplayFlag( DisplayFlag, bool on = true );
113 bool testDisplayFlag( DisplayFlag ) const;
114
115 void setGridAttribute( GridAttribute, bool on = true );
116 bool testGridAttribute( GridAttribute ) const;
117
118 void showGrid( int scaleId, bool show = true );
119 bool isGridVisible( int scaleId ) const;
120
121 void showMinorGrid( int scaleId, bool show = true );
122 bool isMinorGridVisible( int scaleId ) const;
123
124 void showAxis( int axisId, bool show = true );
125 bool isAxisVisible( int axisId ) const;
126
127 void setPen( const QPen &p );
128 void setFont( const QFont & );
129
130 void setMajorGridPen( const QPen &p );
131 void setMajorGridPen( int scaleId, const QPen &p );
132 QPen majorGridPen( int scaleId ) const;
133
134 void setMinorGridPen( const QPen &p );
135 void setMinorGridPen( int scaleId, const QPen &p );
136 QPen minorGridPen( int scaleId ) const;
137
138 void setAxisPen( int axisId, const QPen &p );
139 QPen axisPen( int axisId ) const;
140
141 void setAxisFont( int axisId, const QFont &p );
142 QFont axisFont( int axisId ) const;
143
144 void setScaleDraw( int axisId, QwtScaleDraw * );
145 const QwtScaleDraw *scaleDraw( int axisId ) const;
146 QwtScaleDraw *scaleDraw( int axisId );
147
148 void setAzimuthScaleDraw( QwtRoundScaleDraw * );
149 const QwtRoundScaleDraw *azimuthScaleDraw() const;
150 QwtRoundScaleDraw *azimuthScaleDraw();
151
152 virtual void draw( QPainter *p,
153 const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
154 const QPointF &pole, double radius,
155 const QRectF &rect ) const;
156
157 virtual void updateScaleDiv( const QwtScaleDiv &azimuthMap,
158 const QwtScaleDiv &radialMap, const QwtInterval & );
159
160 virtual int marginHint() const;
161
162 protected:
163 void drawRays( QPainter *, const QRectF &,
164 const QPointF &pole, double radius,
165 const QwtScaleMap &azimuthMap, const QList<double> & ) const;
166 void drawCircles( QPainter *, const QRectF &,
167 const QPointF &pole, const QwtScaleMap &radialMap,
168 const QList<double> & ) const;
169
170 void drawAxis( QPainter *, int axisId ) const;
171
172 private:
173 void updateScaleDraws(
174 const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
175 const QPointF &pole, const double radius ) const;
176
177 private:
178 class GridData;
179 class AxisData;
180 class PrivateData;
181 PrivateData *d_data;
182 };
183
184 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarGrid::DisplayFlags )
185 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarGrid::GridAttributes )
186
187 #endif
QwtPolarItem::marginHint
virtual int marginHint() const
Definition: qwt_polar_item.cpp:481
QwtPolarItem::updateScaleDiv
virtual void updateScaleDiv(const QwtScaleDiv &, const QwtScaleDiv &, const QwtInterval &)
Update the item to changes of the axes scale division.
Definition: qwt_polar_item.cpp:404
QwtPolarGrid::GridAttributes
QFlags< GridAttribute > GridAttributes
Grid attributes.
Definition: qwt_polar_grid.h:105
QwtPolarGrid::DisplayFlag
DisplayFlag
Definition: qwt_polar_grid.h:52
QwtPolarItem::draw
virtual void draw(QPainter *painter, const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap, const QPointF &pole, double radius, const QRectF &canvasRect) const =0
Draw the item.
QwtPolarItem
Base class for items on a polar plot.
Definition: qwt_polar_item.h:37
QwtPolarGrid::GridAttribute
GridAttribute
Grid attributes.
Definition: qwt_polar_grid.h:95
QwtPolarGrid
An item which draws scales and grid lines on a polar plot.
Definition: qwt_polar_grid.h:41
QwtPolarGrid::DisplayFlags
QFlags< DisplayFlag > DisplayFlags
Display flags.
Definition: qwt_polar_grid.h:89
QwtPolarItem::rtti
virtual int rtti() const
Definition: qwt_polar_item.cpp:113