Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_compass_rose.cpp


Ignore:
Timestamp:
Nov 3, 2026, 10:53:35 AM (3 weeks ago)
Author:
stuerze
Message:

deprecated functions exchanged libs updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/qwt/qwt_compass_rose.cpp

    r9383 r11158  
    1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
     1/******************************************************************************
    22 * Qwt Widget Library
    33 * Copyright (C) 1997   Josef Wilgen
    … …  
    1010#include "qwt_compass_rose.h"
    1111#include "qwt_point_polar.h"
    12 #include "qwt_painter.h"
     12
    1313#include <qpainter.h>
    1414#include <qpainterpath.h>
    … …  
    2121
    2222    QPointF pos;
     23#if QT_VERSION >= 0x050e00
     24    if ( line1.intersects( line2, &pos ) == QLineF::NoIntersection )
     25#else
    2326    if ( line1.intersect( line2, &pos ) == QLineF::NoIntersection )
     27#endif
    2428        return QPointF();
    2529
    … …  
    2731}
    2832
     33//! Constructor
     34QwtCompassRose::QwtCompassRose()
     35{
     36}
     37
     38//! Destructor
     39QwtCompassRose::~QwtCompassRose()
     40{
     41}
     42
     43//! Assign a palette
     44void QwtCompassRose::setPalette( const QPalette& p )
     45{
     46    m_palette = p;
     47}
     48
     49//! \return Current palette
     50const QPalette& QwtCompassRose::palette() const
     51{
     52    return m_palette;
     53}
     54
    2955class QwtSimpleCompassRose::PrivateData
    3056{
    31 public:
    32     PrivateData():
    33         width( 0.2 ),
    34         numThorns( 8 ),
    35         numThornLevels( -1 ),
    36         shrinkFactor( 0.9 )
     57  public:
     58    PrivateData()
     59        : width( 0.2 )
     60        , numThorns( 8 )
     61        , numThornLevels( -1 )
     62        , shrinkFactor( 0.9 )
    3763    {
    3864    }
    … …  
    4975   \param numThorns Number of thorns
    5076   \param numThornLevels Number of thorn levels
    51 */
     77 */
    5278QwtSimpleCompassRose::QwtSimpleCompassRose(
    5379    int numThorns, int numThornLevels )
    5480{
    55     d_data = new PrivateData();
    56     d_data->numThorns = numThorns;
    57     d_data->numThornLevels = numThornLevels;
     81    m_data = new PrivateData();
     82    m_data->numThorns = numThorns;
     83    m_data->numThornLevels = numThornLevels;
    5884
    5985    const QColor dark( 128, 128, 255 );
    … …  
    7096QwtSimpleCompassRose::~QwtSimpleCompassRose()
    7197{
    72     delete d_data;
    73 }
    74 
    75 /*!
    76   Set the Factor how to shrink the thorns with each level
    77   The default value is 0.9.
    78 
    79   \param factor Shrink factor
    80   \sa shrinkFactor()
    81 */
     98    delete m_data;
     99}
     100
     101/*!
     102   Set the Factor how to shrink the thorns with each level
     103   The default value is 0.9.
     104
     105   \param factor Shrink factor
     106   \sa shrinkFactor()
     107 */
    82108void QwtSimpleCompassRose::setShrinkFactor( double factor )
    83109{
    84     d_data->shrinkFactor = factor;
    85 }
    86 
    87 /*!
    88   \return Factor how to shrink the thorns with each level
    89   \sa setShrinkFactor()
    90 */
     110    m_data->shrinkFactor = factor;
     111}
     112
     113/*!
     114   \return Factor how to shrink the thorns with each level
     115   \sa setShrinkFactor()
     116 */
    91117double QwtSimpleCompassRose::shrinkFactor() const
    92118{
    93     return d_data->shrinkFactor;
     119    return m_data->shrinkFactor;
    94120}
    95121
    … …  
    102128   \param north Position
    103129   \param cg Color group
    104 */
    105 void QwtSimpleCompassRose::draw( QPainter *painter, const QPointF &center,
     130 */
     131void QwtSimpleCompassRose::draw( QPainter* painter, const QPointF& center,
    106132    double radius, double north, QPalette::ColorGroup cg ) const
    107133{
    … …  
    109135    pal.setCurrentColorGroup( cg );
    110136
    111     drawRose( painter, pal, center, radius, north, d_data->width,
    112         d_data->numThorns, d_data->numThornLevels, d_data->shrinkFactor );
     137    drawRose( painter, pal, center, radius, north, m_data->width,
     138        m_data->numThorns, m_data->numThornLevels, m_data->shrinkFactor );
    113139}
    114140
    … …  
    125151   \param numThornLevels Number of thorn levels
    126152   \param shrinkFactor Factor to shrink the thorns with each level
    127 */
     153 */
    128154void QwtSimpleCompassRose::drawRose(
    129     QPainter *painter,
    130     const QPalette &palette,
    131     const QPointF &center, double radius, double north, double width,
     155    QPainter* painter,
     156    const QPalette& palette,
     157    const QPointF& center, double radius, double north, double width,
    132158    int numThorns, int numThornLevels, double shrinkFactor )
    133159{
    … …  
    153179    for ( int j = 1; j <= numThornLevels; j++ )
    154180    {
    155         double step =  qPow( 2.0, j ) * M_PI / numThorns;
     181        double step = std::pow( 2.0, j ) * M_PI / numThorns;
    156182        if ( step > M_PI_2 )
    157183            break;
    … …  
    203229
    204230   \param width Width
    205 */
     231 */
    206232void QwtSimpleCompassRose::setWidth( double width )
    207233{
    208     d_data->width = width;
    209     if ( d_data->width < 0.03 )
    210         d_data->width = 0.03;
    211 
    212     if ( d_data->width > 0.4 )
    213         d_data->width = 0.4;
    214 }
    215 
    216 /*!
    217   \return Width of the rose
    218   \sa setWidth()
     234    m_data->width = width;
     235    if ( m_data->width < 0.03 )
     236        m_data->width = 0.03;
     237
     238    if ( m_data->width > 0.4 )
     239        m_data->width = 0.4;
     240}
     241
     242/*!
     243   \return Width of the rose
     244   \sa setWidth()
    219245 */
    220246double QwtSimpleCompassRose::width() const
    221247{
    222     return d_data->width;
    223 }
    224 
    225 /*!
    226   Set the number of thorns on one level
    227   The number is aligned to a multiple of 4, with a minimum of 4
    228 
    229   \param numThorns Number of thorns
    230   \sa numThorns(), setNumThornLevels()
    231 */
     248    return m_data->width;
     249}
     250
     251/*!
     252   Set the number of thorns on one level
     253   The number is aligned to a multiple of 4, with a minimum of 4
     254
     255   \param numThorns Number of thorns
     256   \sa numThorns(), setNumThornLevels()
     257 */
    232258void QwtSimpleCompassRose::setNumThorns( int numThorns )
    233259{
    … …  
    238264        numThorns += 4 - numThorns % 4;
    239265
    240     d_data->numThorns = numThorns;
     266    m_data->numThorns = numThorns;
    241267}
    242268
    … …  
    244270   \return Number of thorns
    245271   \sa setNumThorns(), setNumThornLevels()
    246 */
     272 */
    247273int QwtSimpleCompassRose::numThorns() const
    248274{
    249     return d_data->numThorns;
    250 }
    251 
    252 /*!
    253   Set the of thorns levels
    254 
    255   \param numThornLevels Number of thorns levels
    256   \sa setNumThorns(), numThornLevels()
    257 */
     275    return m_data->numThorns;
     276}
     277
     278/*!
     279   Set the of thorns levels
     280
     281   \param numThornLevels Number of thorns levels
     282   \sa setNumThorns(), numThornLevels()
     283 */
    258284void QwtSimpleCompassRose::setNumThornLevels( int numThornLevels )
    259285{
    260     d_data->numThornLevels = numThornLevels;
     286    m_data->numThornLevels = numThornLevels;
    261287}
    262288
    … …  
    264290   \return Number of thorn levels
    265291   \sa setNumThorns(), setNumThornLevels()
    266 */
     292 */
    267293int QwtSimpleCompassRose::numThornLevels() const
    268294{
    269     return d_data->numThornLevels;
    270 }
     295    return m_data->numThornLevels;
     296}
Note: See TracChangeset for help on using the changeset viewer.