16 QPointF p11, QPointF p12, QPointF p21, QPointF p22 )
18 const QLineF line1( p11, p12 );
19 const QLineF line2( p21, p22 );
22 if ( line1.intersect( line2, &pos ) == QLineF::NoIntersection )
74 int numThorns,
int numThornLevels )
77 d_data->numThorns = numThorns;
78 d_data->numThornLevels = numThornLevels;
80 const QColor dark( 128, 128, 255 );
81 const QColor light( 192, 255, 255 );
84 palette.setColor( QPalette::Dark, dark );
85 palette.setColor( QPalette::Light, light );
105 d_data->shrinkFactor = factor;
114 return d_data->shrinkFactor;
127 double radius,
double north, QPalette::ColorGroup cg )
const 130 pal.setCurrentColorGroup( cg );
132 drawRose( painter, pal, center, radius, north, d_data->width,
133 d_data->numThorns, d_data->numThornLevels, d_data->shrinkFactor );
152 const QPointF ¢er,
double radius,
double north,
double width,
153 int numThorns,
int numThornLevels,
double shrinkFactor )
159 numThorns += 4 - numThorns % 4;
161 if ( numThornLevels <= 0 )
162 numThornLevels = numThorns / 4;
164 if ( shrinkFactor >= 1.0 )
167 if ( shrinkFactor <= 0.5 )
172 painter->setPen( Qt::NoPen );
174 for (
int j = 1; j <= numThornLevels; j++ )
176 double step = qPow( 2.0, j ) * M_PI / numThorns;
181 for (
int k = 0; k < 3; k++ )
183 if ( j + k < numThornLevels )
187 double leafWidth = r * width;
188 if ( 2.0 * M_PI / step > 32 )
192 for (
double angle = origin;
201 QPainterPath darkPath;
202 darkPath.moveTo( center );
203 darkPath.lineTo( p );
206 painter->setBrush( palette.brush( QPalette::Dark ) );
207 painter->drawPath( darkPath );
209 QPainterPath lightPath;
210 lightPath.moveTo( center );
211 lightPath.lineTo( p );
214 painter->setBrush( palette.brush( QPalette::Light ) );
215 painter->drawPath( lightPath );
229 d_data->width = width;
230 if ( d_data->width < 0.03 )
231 d_data->width = 0.03;
233 if ( d_data->width > 0.4 )
243 return d_data->width;
259 numThorns += 4 - numThorns % 4;
261 d_data->numThorns = numThorns;
270 return d_data->numThorns;
281 d_data->numThornLevels = numThornLevels;
290 return d_data->numThornLevels;
virtual ~QwtCompassRose()
Destructor.
const QPalette & palette() const
static QPointF qwtIntersection(QPointF p11, QPointF p12, QPointF p21, QPointF p22)
virtual void setPalette(const QPalette &)
Assign a palette.
void setNumThorns(int count)
QPoint qwtPolar2Pos(const QPoint &pole, double radius, double angle)
QwtCompassRose()
Constructor.
TFSIMD_FORCE_INLINE tfScalar angle(const Quaternion &q1, const Quaternion &q2)
double qwtRadians(double degrees)
Translate degrees into radians.
QwtSimpleCompassRose(int numThorns=8, int numThornLevels=-1)
double shrinkFactor() const
virtual void draw(QPainter *, const QPointF ¢er, double radius, double north, QPalette::ColorGroup=QPalette::Active) const
void setNumThornLevels(int count)
int numThornLevels() const
virtual ~QwtSimpleCompassRose()
Destructor.
void setShrinkFactor(double factor)
static void drawRose(QPainter *, const QPalette &, const QPointF ¢er, double radius, double origin, double width, int numThorns, int numThornLevels, double shrinkFactor)