Qwt User's Guide 6.3.0
Loading...
Searching...
No Matches
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
17class QPainter;
18class QPen;
19class QwtScaleMap;
20class QwtScaleDiv;
22class QwtScaleDraw;
23
41class QWT_EXPORT QwtPolarGrid : public QwtPolarItem
42{
43 public:
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
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
180Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarGrid::DisplayFlags )
181Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarGrid::GridAttributes )
182
183#endif
A class representing an interval.
An item which draws scales and grid lines on a polar plot.
GridAttribute
Grid attributes.
QFlags< GridAttribute > GridAttributes
QFlags< DisplayFlag > DisplayFlags
Base class for items on a polar plot.
virtual int rtti() const
A class for drawing round scales.
A class representing a scale division.
A class for drawing scales.
A scale map.