Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_scale_div.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_scale_div.cpp

    r9383 r11158  
    1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
     1/******************************************************************************
    22 * Qwt Widget Library
    33 * Copyright (C) 1997   Josef Wilgen
    … …  
    99
    1010#include "qwt_scale_div.h"
    11 #include "qwt_math.h"
    12 #include <qalgorithms.h>
    13 
    14 /*!
    15   Construct a division without ticks
    16 
    17   \param lowerBound First boundary
    18   \param upperBound Second boundary
    19 
    20   \note lowerBound might be greater than upperBound for inverted scales
    21  */
    22 QwtScaleDiv::QwtScaleDiv( double lowerBound, double upperBound ):
    23     d_lowerBound( lowerBound ),
    24     d_upperBound( upperBound )
    25 {
    26 }
    27 
    28 /*!
    29   Construct a scale division
    30 
    31   \param interval Interval
    32   \param ticks List of major, medium and minor ticks
    33 */
    34 QwtScaleDiv::QwtScaleDiv( const QwtInterval &interval,
    35         QList<double> ticks[NTickTypes] ):
    36     d_lowerBound( interval.minValue() ),
    37     d_upperBound( interval.maxValue() )
     11#include "qwt_interval.h"
     12
     13/*!
     14   Construct a division without ticks
     15
     16   \param lowerBound First boundary
     17   \param upperBound Second boundary
     18
     19   \note lowerBound might be greater than upperBound for inverted scales
     20 */
     21QwtScaleDiv::QwtScaleDiv( double lowerBound, double upperBound )
     22    : m_lowerBound( lowerBound )
     23    , m_upperBound( upperBound )
     24{
     25}
     26
     27/*!
     28   Construct a scale division
     29
     30   \param interval Interval
     31   \param ticks List of major, medium and minor ticks
     32 */
     33QwtScaleDiv::QwtScaleDiv( const QwtInterval& interval,
     34        QList< double > ticks[NTickTypes] )
     35    : m_lowerBound( interval.minValue() )
     36    , m_upperBound( interval.maxValue() )
    3837{
    3938    for ( int i = 0; i < NTickTypes; i++ )
    40         d_ticks[i] = ticks[i];
    41 }
    42 
    43 /*!
    44   Construct a scale division
    45 
    46   \param lowerBound First boundary
    47   \param upperBound Second boundary
    48   \param ticks List of major, medium and minor ticks
    49 
    50   \note lowerBound might be greater than upperBound for inverted scales
    51 */
     39        m_ticks[i] = ticks[i];
     40}
     41
     42/*!
     43   Construct a scale division
     44
     45   \param lowerBound First boundary
     46   \param upperBound Second boundary
     47   \param ticks List of major, medium and minor ticks
     48
     49   \note lowerBound might be greater than upperBound for inverted scales
     50 */
    5251QwtScaleDiv::QwtScaleDiv( double lowerBound, double upperBound,
    53         QList<double> ticks[NTickTypes] ):
    54     d_lowerBound( lowerBound ),
    55     d_upperBound( upperBound )
     52        QList< double > ticks[NTickTypes] )
     53    : m_lowerBound( lowerBound )
     54    , m_upperBound( upperBound )
    5655{
    5756    for ( int i = 0; i < NTickTypes; i++ )
    58         d_ticks[i] = ticks[i];
    59 }
    60 
    61 /*!
    62   Construct a scale division
    63 
    64   \param lowerBound First boundary
    65   \param upperBound Second boundary
    66   \param minorTicks List of minor ticks
    67   \param mediumTicks List medium ticks
    68   \param majorTicks List of major ticks
    69 
    70   \note lowerBound might be greater than upperBound for inverted scales
    71 */
     57        m_ticks[i] = ticks[i];
     58}
     59
     60/*!
     61   Construct a scale division
     62
     63   \param lowerBound First boundary
     64   \param upperBound Second boundary
     65   \param minorTicks List of minor ticks
     66   \param mediumTicks List medium ticks
     67   \param majorTicks List of major ticks
     68
     69   \note lowerBound might be greater than upperBound for inverted scales
     70 */
    7271QwtScaleDiv::QwtScaleDiv( double lowerBound, double upperBound,
    73         const QList<double> &minorTicks,
    74         const QList<double> &mediumTicks,
    75         const QList<double> &majorTicks ):
    76     d_lowerBound( lowerBound ),
    77     d_upperBound( upperBound )
    78 {
    79     d_ticks[ MinorTick ] = minorTicks;
    80     d_ticks[ MediumTick ] = mediumTicks;
    81     d_ticks[ MajorTick ] = majorTicks;
    82 }
    83 
    84 /*!
    85   Change the interval
    86 
    87   \param lowerBound First boundary
    88   \param upperBound Second boundary
    89 
    90   \note lowerBound might be greater than upperBound for inverted scales
    91 */
     72        const QList< double >& minorTicks,
     73        const QList< double >& mediumTicks,
     74        const QList< double >& majorTicks )
     75    : m_lowerBound( lowerBound )
     76    , m_upperBound( upperBound )
     77{
     78    m_ticks[ MinorTick ] = minorTicks;
     79    m_ticks[ MediumTick ] = mediumTicks;
     80    m_ticks[ MajorTick ] = majorTicks;
     81}
     82
     83/*!
     84   Change the interval
     85
     86   \param lowerBound First boundary
     87   \param upperBound Second boundary
     88
     89   \note lowerBound might be greater than upperBound for inverted scales
     90 */
    9291void QwtScaleDiv::setInterval( double lowerBound, double upperBound )
    9392{
    94     d_lowerBound = lowerBound;
    95     d_upperBound = upperBound;
     93    m_lowerBound = lowerBound;
     94    m_upperBound = upperBound;
    9695}
    9796
    … …  
    10099
    101100   \param interval Interval
    102 */
    103 void QwtScaleDiv::setInterval( const QwtInterval &interval )
    104 {
    105     d_lowerBound = interval.minValue();
    106     d_upperBound = interval.maxValue();
    107 }
    108 
    109 /*!
    110   \return lowerBound -> upperBound
    111 */
     101 */
     102void QwtScaleDiv::setInterval( const QwtInterval& interval )
     103{
     104    m_lowerBound = interval.minValue();
     105    m_upperBound = interval.maxValue();
     106}
     107
     108/*!
     109   \return lowerBound -> upperBound
     110 */
    112111QwtInterval QwtScaleDiv::interval() const
    113112{
    114     return QwtInterval( d_lowerBound, d_upperBound );
    115 }
    116 
    117 /*!
    118   Set the first boundary
    119 
    120   \param lowerBound First boundary
    121   \sa lowerBiound(), setUpperBound()
     113    return QwtInterval( m_lowerBound, m_upperBound );
     114}
     115
     116/*!
     117   Set the first boundary
     118
     119   \param lowerBound First boundary
     120   \sa lowerBound(), setUpperBound()
    122121 */
    123122void QwtScaleDiv::setLowerBound( double lowerBound  )
    124123{
    125     d_lowerBound = lowerBound;
    126 }
    127 
    128 /*!
    129   \return First boundary
    130   \sa upperBound()
    131 */
     124    m_lowerBound = lowerBound;
     125}
     126
     127/*!
     128   \return First boundary
     129   \sa upperBound()
     130 */
    132131double QwtScaleDiv::lowerBound() const
    133132{
    134     return d_lowerBound;
    135 }
    136 
    137 /*!
    138   Set the second boundary
    139 
    140   \param upperBound Second boundary
    141   \sa upperBound(), setLowerBound()
     133    return m_lowerBound;
     134}
     135
     136/*!
     137   Set the second boundary
     138
     139   \param upperBound Second boundary
     140   \sa upperBound(), setLowerBound()
    142141 */
    143142void QwtScaleDiv::setUpperBound( double upperBound  )
    144143{
    145     d_upperBound = upperBound;
    146 }
    147 
    148 /*!
    149   \return upper bound
    150   \sa lowerBound()
    151 */
     144    m_upperBound = upperBound;
     145}
     146
     147/*!
     148   \return upper bound
     149   \sa lowerBound()
     150 */
    152151double QwtScaleDiv::upperBound() const
    153152{
    154     return d_upperBound;
    155 }
    156 
    157 /*!
    158   \return upperBound() - lowerBound()
    159 */
     153    return m_upperBound;
     154}
     155
     156/*!
     157   \return upperBound() - lowerBound()
     158 */
    160159double QwtScaleDiv::range() const
    161160{
    162     return d_upperBound - d_lowerBound;
    163 }
    164 
    165 /*!
    166   \brief Equality operator
    167   \return true if this instance is equal to other
    168 */
    169 bool QwtScaleDiv::operator==( const QwtScaleDiv &other ) const
    170 {
    171     if ( d_lowerBound != other.d_lowerBound ||
    172         d_upperBound != other.d_upperBound )
     161    return m_upperBound - m_lowerBound;
     162}
     163
     164/*!
     165   \brief Equality operator
     166   \return true if this instance is equal to other
     167 */
     168bool QwtScaleDiv::operator==( const QwtScaleDiv& other ) const
     169{
     170    if ( m_lowerBound != other.m_lowerBound ||
     171        m_upperBound != other.m_upperBound )
    173172    {
    174173        return false;
    … …  
    177176    for ( int i = 0; i < NTickTypes; i++ )
    178177    {
    179         if ( d_ticks[i] != other.d_ticks[i] )
     178        if ( m_ticks[i] != other.m_ticks[i] )
    180179            return false;
    181180    }
    … …  
    185184
    186185/*!
    187   \brief Inequality
    188   \return true if this instance is not equal to other
    189 */
    190 bool QwtScaleDiv::operator!=( const QwtScaleDiv &other ) const
     186   \brief Inequality
     187   \return true if this instance is not equal to other
     188 */
     189bool QwtScaleDiv::operator!=( const QwtScaleDiv& other ) const
    191190{
    192191    return ( !( *this == other ) );
    … …  
    196195bool QwtScaleDiv::isEmpty() const
    197196{
    198     return ( d_lowerBound == d_upperBound );
     197    return ( m_lowerBound == m_upperBound );
    199198}
    200199
    … …  
    202201bool QwtScaleDiv::isIncreasing() const
    203202{
    204     return d_lowerBound <= d_upperBound;
    205 }
    206 
    207 /*!
    208   Return if a value is between lowerBound() and upperBound()
    209 
    210   \param value Value
    211   \return true/false
    212 */
     203    return m_lowerBound <= m_upperBound;
     204}
     205
     206/*!
     207   Return if a value is between lowerBound() and upperBound()
     208
     209   \param value Value
     210   \return true/false
     211 */
    213212bool QwtScaleDiv::contains( double value ) const
    214213{
    215     const double min = qMin( d_lowerBound, d_upperBound );
    216     const double max = qMax( d_lowerBound, d_upperBound );
     214    const double min = qMin( m_lowerBound, m_upperBound );
     215    const double max = qMax( m_lowerBound, m_upperBound );
    217216
    218217    return value >= min && value <= max;
    … …  
    225224void QwtScaleDiv::invert()
    226225{
    227     qSwap( d_lowerBound, d_upperBound );
     226    qSwap( m_lowerBound, m_upperBound );
    228227
    229228    for ( int i = 0; i < NTickTypes; i++ )
    230229    {
    231         QList<double>& ticks = d_ticks[i];
     230        QList< double >& ticks = m_ticks[i];
    232231
    233232        const int size = ticks.count();
    … …  
    240239
    241240/*!
    242   \return A scale division with inverted boundaries and ticks
    243   \sa invert()
     241   \return A scale division with inverted boundaries and ticks
     242   \sa invert()
    244243 */
    245244QwtScaleDiv QwtScaleDiv::inverted() const
    … …  
    261260
    262261   \note lowerBound might be greater than upperBound for inverted scales
    263 */
     262 */
    264263QwtScaleDiv QwtScaleDiv::bounded(
    265264    double lowerBound, double upperBound ) const
    … …  
    273272    for ( int tickType = 0; tickType < QwtScaleDiv::NTickTypes; tickType++ )
    274273    {
    275         const QList<double> &ticks = d_ticks[ tickType ];
    276 
    277         QList<double> boundedTicks;
     274        const QList< double >& ticks = m_ticks[ tickType ];
     275
     276        QList< double > boundedTicks;
    278277        for ( int i = 0; i < ticks.size(); i++ )
    279278        {
    … …  
    293292    Assign ticks
    294293
    295    \param type MinorTick, MediumTick or MajorTick
     294   \param tickType MinorTick, MediumTick or MajorTick
    296295   \param ticks Values of the tick positions
    297 */
    298 void QwtScaleDiv::setTicks( int type, const QList<double> &ticks )
    299 {
    300     if ( type >= 0 && type < NTickTypes )
    301         d_ticks[type] = ticks;
     296 */
     297void QwtScaleDiv::setTicks( int tickType, const QList< double >& ticks )
     298{
     299    if ( tickType >= 0 && tickType < NTickTypes )
     300        m_ticks[tickType] = ticks;
    302301}
    303302
    … …  
    305304   Return a list of ticks
    306305
    307    \param type MinorTick, MediumTick or MajorTick
     306   \param tickType MinorTick, MediumTick or MajorTick
    308307   \return Tick list
    309 */
    310 QList<double> QwtScaleDiv::ticks( int type ) const
    311 {
    312     if ( type >= 0 && type < NTickTypes )
    313         return d_ticks[type];
    314 
    315     return QList<double>();
     308 */
     309QList< double > QwtScaleDiv::ticks( int tickType ) const
     310{
     311    if ( tickType >= 0 && tickType < NTickTypes )
     312        return m_ticks[tickType];
     313
     314    return QList< double >();
    316315}
    317316
    318317#ifndef QT_NO_DEBUG_STREAM
    319318
    320 QDebug operator<<( QDebug debug, const QwtScaleDiv &scaleDiv )
     319#include <qdebug.h>
     320
     321QDebug operator<<( QDebug debug, const QwtScaleDiv& scaleDiv )
    321322{
    322323    debug << scaleDiv.lowerBound() << "<->" << scaleDiv.upperBound();
Note: See TracChangeset for help on using the changeset viewer.