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

    r9383 r11158  
    1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
     1/******************************************************************************
    22 * Qwt Widget Library
    33 * Copyright (C) 1997   Josef Wilgen
    … …  
    1010#include "qwt_scale_engine.h"
    1111#include "qwt_math.h"
    12 #include "qwt_scale_map.h"
    13 #include <qalgorithms.h>
    14 #include <qmath.h>
    15 #include <float.h>
     12#include "qwt_interval.h"
     13#include "qwt_transform.h"
     14
     15#include <qdebug.h>
     16
    1617#include <limits>
    1718
    18 #if QT_VERSION < 0x040601
    19 #define qFabs(x) ::fabs(x)
    20 #define qExp(x) ::exp(x)
    21 #endif
    22 
    2319static inline double qwtLog( double base, double value )
    2420{
    25     return log( value ) / log( base );
    26 }
    27 
    28 static inline QwtInterval qwtLogInterval( double base, const QwtInterval &interval )
     21    return std::log( value ) / std::log( base );
     22}
     23
     24static inline QwtInterval qwtLogInterval( double base, const QwtInterval& interval )
    2925{
    3026    return QwtInterval( qwtLog( base, interval.minValue() ),
    31             qwtLog( base, interval.maxValue() ) );
    32 }
    33 
    34 static inline QwtInterval qwtPowInterval( double base, const QwtInterval &interval )
    35 {
    36     return QwtInterval( qPow( base, interval.minValue() ),
    37             qPow( base, interval.maxValue() ) );
    38 }
    39 
    40 static inline long double qwtIntervalWidthL( const QwtInterval &interval )
    41 {
    42     if ( !interval.isValid() )
    43         return 0.0;
    44 
    45     return static_cast<long double>( interval.maxValue() )
    46         - static_cast<long double>( interval.minValue() );
     27        qwtLog( base, interval.maxValue() ) );
     28}
     29
     30static inline QwtInterval qwtPowInterval( double base, const QwtInterval& interval )
     31{
     32    return QwtInterval( std::pow( base, interval.minValue() ),
     33        std::pow( base, interval.maxValue() ) );
    4734}
    4835
    … …  
    5845    {
    5946        // # ticks per interval
    60         const int numTicks = qCeil( qAbs( intervalSize / minStep ) ) - 1;
     47        const int numTicks = qwtCeil( qAbs( intervalSize / minStep ) ) - 1;
    6148
    6249        // Do the minor steps fit into the interval?
    63         if ( qwtFuzzyCompare( ( numTicks +  1 ) * qAbs( minStep ),
     50        if ( qwtFuzzyCompare( ( numTicks + 1 ) * qAbs( minStep ),
    6451            qAbs( intervalSize ), intervalSize ) > 0 )
    6552        {
    … …  
    8572            const double stepSize = intervalSize / numSteps;
    8673
    87             const double p = ::floor( ::log( stepSize ) / ::log( base ) );
    88             const double fraction = qPow( base, p );
     74            const double p = std::floor( std::log( stepSize ) / std::log( base ) );
     75            const double fraction = std::pow( base, p );
    8976
    9077            for ( uint n = base; n > 1; n /= 2 )
    … …  
    11097
    11198/*!
    112   Ceil a value, relative to an interval
    113 
    114   \param value Value to be ceiled
    115   \param intervalSize Interval size
    116 
    117   \return Rounded value
    118 
    119   \sa floorEps()
    120 */
     99   Ceil a value, relative to an interval
     100
     101   \param value Value to be ceiled
     102   \param intervalSize Interval size
     103
     104   \return Rounded value
     105
     106   \sa floorEps()
     107 */
    121108double QwtScaleArithmetic::ceilEps( double value,
    122109    double intervalSize )
    … …  
    125112
    126113    value = ( value - eps ) / intervalSize;
    127     return ::ceil( value ) * intervalSize;
    128 }
    129 
    130 /*!
    131   Floor a value, relative to an interval
    132 
    133   \param value Value to be floored
    134   \param intervalSize Interval size
    135 
    136   \return Rounded value
    137   \sa floorEps()
    138 */
     114    return std::ceil( value ) * intervalSize;
     115}
     116
     117/*!
     118   Floor a value, relative to an interval
     119
     120   \param value Value to be floored
     121   \param intervalSize Interval size
     122
     123   \return Rounded value
     124   \sa floorEps()
     125 */
    139126double QwtScaleArithmetic::floorEps( double value, double intervalSize )
    140127{
    … …  
    142129
    143130    value = ( value + eps ) / intervalSize;
    144     return ::floor( value ) * intervalSize;
    145 }
    146 
    147 /*!
    148   \brief Divide an interval into steps
    149 
    150   \f$stepSize = (intervalSize - intervalSize * 10e^{-6}) / numSteps\f$
    151 
    152   \param intervalSize Interval size
    153   \param numSteps Number of steps
    154   \return Step size
    155 */
     131    return std::floor( value ) * intervalSize;
     132}
     133
     134/*!
     135   \brief Divide an interval into steps
     136
     137   \f$stepSize = (intervalSize - intervalSize * 10e^{-6}) / numSteps\f$
     138
     139   \param intervalSize Interval size
     140   \param numSteps Number of steps
     141   \return Step size
     142 */
    156143double QwtScaleArithmetic::divideEps( double intervalSize, double numSteps )
    157144{
    … …  
    163150
    164151/*!
    165   Calculate a step size for a given interval
    166 
    167   \param intervalSize Interval size
    168   \param numSteps Number of steps
    169   \param base Base for the division ( usually 10 )
    170 
    171   \return Calculated step size
     152   Calculate a step size for a given interval
     153
     154   \param intervalSize Interval size
     155   \param numSteps Number of steps
     156   \param base Base for the division ( usually 10 )
     157
     158   \return Calculated step size
    172159 */
    173160double QwtScaleArithmetic::divideInterval(
    … …  
    181168        return 0.0;
    182169
    183     const double lx = qwtLog( base, qFabs( v ) );
    184     const double p = ::floor( lx );
    185 
    186     const double fraction = qPow( base, lx - p );
     170    const double lx = qwtLog( base, std::fabs( v ) );
     171    const double p = std::floor( lx );
     172
     173    const double fraction = std::pow( base, lx - p );
    187174
    188175    uint n = base;
    … …  
    190177        n /= 2;
    191178
    192     double stepSize = n * qPow( base, p );
     179    double stepSize = n * std::pow( base, p );
    193180    if ( v < 0 )
    194181        stepSize = -stepSize;
    … …  
    199186class QwtScaleEngine::PrivateData
    200187{
    201 public:
     188  public:
    202189    PrivateData():
    203190        attributes( QwtScaleEngine::NoAttribute ),
    … …  
    228215
    229216/*!
    230   Constructor
    231 
    232   \param base Base of the scale engine
    233   \sa setBase()
     217   Constructor
     218
     219   \param base Base of the scale engine
     220   \sa setBase()
    234221 */
    235222QwtScaleEngine::QwtScaleEngine( uint base )
    236223{
    237     d_data = new PrivateData;
     224    m_data = new PrivateData;
    238225    setBase( base );
    239226}
    … …  
    243230QwtScaleEngine::~QwtScaleEngine ()
    244231{
    245     delete d_data;
     232    delete m_data;
    246233}
    247234
    … …  
    259246
    260247 */
    261 void QwtScaleEngine::setTransformation( QwtTransform *transform )
    262 {
    263     if ( transform != d_data->transform )
    264     {
    265         delete d_data->transform;
    266         d_data->transform = transform;
     248void QwtScaleEngine::setTransformation( QwtTransform* transform )
     249{
     250    if ( transform != m_data->transform )
     251    {
     252        delete m_data->transform;
     253        m_data->transform = transform;
    267254    }
    268255}
    … …  
    273260   NULL is returned, indicating no transformation.
    274261
    275    \return A clone of the transfomation
     262   \return A clone of the transformation
    276263   \sa setTransformation()
    277264 */
    278 QwtTransform *QwtScaleEngine::transformation() const
    279 {
    280     QwtTransform *transform = NULL;
    281     if ( d_data->transform )
    282         transform = d_data->transform->copy();
     265QwtTransform* QwtScaleEngine::transformation() const
     266{
     267    QwtTransform* transform = NULL;
     268    if ( m_data->transform )
     269        transform = m_data->transform->copy();
    283270
    284271    return transform;
    … …  
    290277
    291278    \sa setMargins()
    292 */
     279 */
    293280double QwtScaleEngine::lowerMargin() const
    294281{
    295     return d_data->lowerMargin;
     282    return m_data->lowerMargin;
    296283}
    297284
    … …  
    301288
    302289    \sa setMargins()
    303 */
     290 */
    304291double QwtScaleEngine::upperMargin() const
    305292{
    306     return d_data->upperMargin;
    307 }
    308 
    309 /*!
    310   \brief Specify margins at the scale's endpoints
    311   \param lower minimum distance between the scale's lower boundary and the
     293    return m_data->upperMargin;
     294}
     295
     296/*!
     297   \brief Specify margins at the scale's endpoints
     298   \param lower minimum distance between the scale's lower boundary and the
    312299             smallest enclosed value
    313   \param upper minimum distance between the scale's upper boundary and the
     300   \param upper minimum distance between the scale's upper boundary and the
    314301             greatest enclosed value
    315302
    316   Margins can be used to leave a minimum amount of space between
    317   the enclosed intervals and the boundaries of the scale.
    318 
    319   \warning
    320   \li QwtLogScaleEngine measures the margins in decades.
    321 
    322   \sa upperMargin(), lowerMargin()
    323 */
     303   Margins can be used to leave a minimum amount of space between
     304   the enclosed intervals and the boundaries of the scale.
     305
     306   \warning
     307   \li QwtLogScaleEngine measures the margins in decades.
     308
     309   \sa upperMargin(), lowerMargin()
     310 */
    324311
    325312void QwtScaleEngine::setMargins( double lower, double upper )
    326313{
    327     d_data->lowerMargin = qMax( lower, 0.0 );
    328     d_data->upperMargin = qMax( upper, 0.0 );
    329 }
    330 
    331 /*!
    332   Calculate a step size for an interval size
    333 
    334   \param intervalSize Interval size
    335   \param numSteps Number of steps
    336 
    337   \return Step size
    338 */
     314    m_data->lowerMargin = qwtMaxF( lower, 0.0 );
     315    m_data->upperMargin = qwtMaxF( upper, 0.0 );
     316}
     317
     318/*!
     319   Calculate a step size for an interval size
     320
     321   \param intervalSize Interval size
     322   \param numSteps Number of steps
     323
     324   \return Step size
     325 */
    339326double QwtScaleEngine::divideInterval(
    340327    double intervalSize, int numSteps ) const
    341328{
    342329    return QwtScaleArithmetic::divideInterval(
    343         intervalSize, numSteps, d_data->base );
    344 }
    345 
    346 /*!
    347   Check if an interval "contains" a value
    348 
    349   \param interval Interval
    350   \param value Value
    351 
    352   \return True, when the value is inside the interval
    353 */
     330        intervalSize, numSteps, m_data->base );
     331}
     332
     333/*!
     334   Check if an interval "contains" a value
     335
     336   \param interval Interval
     337   \param value Value
     338
     339   \return True, when the value is inside the interval
     340 */
    354341bool QwtScaleEngine::contains(
    355     const QwtInterval &interval, double value ) const
     342    const QwtInterval& interval, double value ) const
    356343{
    357344    if ( !interval.isValid() )
    … …  
    368355
    369356/*!
    370   Remove ticks from a list, that are not inside an interval
    371 
    372   \param ticks Tick list
    373   \param interval Interval
    374 
    375   \return Stripped tick list
    376 */
    377 QList<double> QwtScaleEngine::strip( const QList<double>& ticks,
    378     const QwtInterval &interval ) const
     357   Remove ticks from a list, that are not inside an interval
     358
     359   \param ticks Tick list
     360   \param interval Interval
     361
     362   \return Stripped tick list
     363 */
     364QList< double > QwtScaleEngine::strip( const QList< double >& ticks,
     365    const QwtInterval& interval ) const
    379366{
    380367    if ( !interval.isValid() || ticks.count() == 0 )
    381         return QList<double>();
     368        return QList< double >();
    382369
    383370    if ( contains( interval, ticks.first() )
    … …  
    387374    }
    388375
    389     QList<double> strippedTicks;
     376    QList< double > strippedTicks;
    390377    for ( int i = 0; i < ticks.count(); i++ )
    391378    {
    … …  
    397384
    398385/*!
    399   \brief Build an interval around a value
    400 
    401   In case of v == 0.0 the interval is [-0.5, 0.5],
    402   otherwide it is [0.5 * v, 1.5 * v]
    403 
    404   \param value Initial value
    405   \return Calculated interval
    406 */
     386   \brief Build an interval around a value
     387
     388   In case of v == 0.0 the interval is [-0.5, 0.5],
     389   otherwise it is [0.5 * v, 1.5 * v]
     390
     391   \param value Initial value
     392   \return Calculated interval
     393 */
    407394
    408395QwtInterval QwtScaleEngine::buildInterval( double value ) const
    409396{
    410397    const double delta = ( value == 0.0 ) ? 0.5 : qAbs( 0.5 * value );
    411 
    412     if ( DBL_MAX - delta < value )
    413         return QwtInterval( DBL_MAX - delta, DBL_MAX );
    414 
    415     if ( -DBL_MAX + delta > value )
    416         return QwtInterval( -DBL_MAX, -DBL_MAX + delta );
     398    const double max = std::numeric_limits< double >::max();
     399
     400    if ( max - delta < value )
     401        return QwtInterval( max - delta, max );
     402
     403    if ( -max + delta > value )
     404        return QwtInterval( -max, -max + delta );
    417405
    418406    return QwtInterval( value - delta, value + delta );
    … …  
    420408
    421409/*!
    422   Change a scale attribute
    423 
    424   \param attribute Attribute to change
    425   \param on On/Off
    426 
    427   \sa Attribute, testAttribute()
    428 */
     410   Change a scale attribute
     411
     412   \param attribute Attribute to change
     413   \param on On/Off
     414
     415   \sa Attribute, testAttribute()
     416 */
    429417void QwtScaleEngine::setAttribute( Attribute attribute, bool on )
    430418{
    431419    if ( on )
    432         d_data->attributes |= attribute;
     420        m_data->attributes |= attribute;
    433421    else
    434         d_data->attributes &= ~attribute;
    435 }
    436 
    437 /*!
    438   \return True, if attribute is enabled.
    439 
    440   \param attribute Attribute to be tested
    441   \sa Attribute, setAttribute()
    442 */
     422        m_data->attributes &= ~attribute;
     423}
     424
     425/*!
     426   \return True, if attribute is enabled.
     427
     428   \param attribute Attribute to be tested
     429   \sa Attribute, setAttribute()
     430 */
    443431bool QwtScaleEngine::testAttribute( Attribute attribute ) const
    444432{
    445     return ( d_data->attributes & attribute );
    446 }
    447 
    448 /*!
    449   Change the scale attribute
    450 
    451   \param attributes Set scale attributes
    452   \sa Attribute, attributes()
    453 */
     433    return ( m_data->attributes & attribute );
     434}
     435
     436/*!
     437   Change the scale attribute
     438
     439   \param attributes Set scale attributes
     440   \sa Attribute, attributes()
     441 */
    454442void QwtScaleEngine::setAttributes( Attributes attributes )
    455443{
    456     d_data->attributes = attributes;
    457 }
    458 
    459 /*!
    460   \return Scale attributes
    461   \sa Attribute, setAttributes(), testAttribute()
    462 */
     444    m_data->attributes = attributes;
     445}
     446
     447/*!
     448   \return Scale attributes
     449   \sa Attribute, setAttributes(), testAttribute()
     450 */
    463451QwtScaleEngine::Attributes QwtScaleEngine::attributes() const
    464452{
    465     return d_data->attributes;
    466 }
    467 
    468 /*!
    469   \brief Specify a reference point
    470   \param reference New reference value
    471 
    472   The reference point is needed if options IncludeReference or
    473   Symmetric are active. Its default value is 0.0.
    474 
    475   \sa Attribute
    476 */
     453    return m_data->attributes;
     454}
     455
     456/*!
     457   \brief Specify a reference point
     458   \param reference New reference value
     459
     460   The reference point is needed if options IncludeReference or
     461   Symmetric are active. Its default value is 0.0.
     462
     463   \sa Attribute
     464 */
    477465void QwtScaleEngine::setReference( double reference )
    478466{
    479     d_data->referenceValue = reference;
    480 }
    481 
    482 /*!
    483   \return the reference value
    484   \sa setReference(), setAttribute()
    485 */
     467    m_data->referenceValue = reference;
     468}
     469
     470/*!
     471   \return the reference value
     472   \sa setReference(), setAttribute()
     473 */
    486474double QwtScaleEngine::reference() const
    487475{
    488     return d_data->referenceValue;
    489 }
    490 
    491 /*!
    492   Set the base of the scale engine
    493 
    494   While a base of 10 is what 99.9% of all applications need
    495   certain scales might need a different base: f.e 2
    496 
    497   The default setting is 10
    498 
    499   \param base Base of the engine
    500 
    501   \sa base()
     476    return m_data->referenceValue;
     477}
     478
     479/*!
     480   Set the base of the scale engine
     481
     482   While a base of 10 is what 99.9% of all applications need
     483   certain scales might need a different base: f.e 2
     484
     485   The default setting is 10
     486
     487   \param base Base of the engine
     488
     489   \sa base()
    502490 */
    503491void QwtScaleEngine::setBase( uint base )
    504492{
    505     d_data->base = qMax( base, 2U );
    506 }
    507 
    508 /*!
    509   \return base Base of the scale engine
    510   \sa setBase()
     493    m_data->base = qMax( base, 2U );
     494}
     495
     496/*!
     497   \return base Base of the scale engine
     498   \sa setBase()
    511499 */
    512500uint QwtScaleEngine::base() const
    513501{
    514     return d_data->base;
    515 }
    516 
    517 /*!
    518   Constructor
    519 
    520   \param base Base of the scale engine
    521   \sa setBase()
     502    return m_data->base;
     503}
     504
     505/*!
     506   Constructor
     507
     508   \param base Base of the scale engine
     509   \sa setBase()
    522510 */
    523511QwtLinearScaleEngine::QwtLinearScaleEngine( uint base ):
    … …  
    532520
    533521/*!
    534   Align and divide an interval
    535 
    536   \param maxNumSteps Max. number of steps
    537   \param x1 First limit of the interval (In/Out)
    538   \param x2 Second limit of the interval (In/Out)
    539   \param stepSize Step size (Out)
    540 
    541   \sa setAttribute()
    542 */
     522   Align and divide an interval
     523
     524   \param maxNumSteps Max. number of steps
     525   \param x1 First limit of the interval (In/Out)
     526   \param x2 Second limit of the interval (In/Out)
     527   \param stepSize Step size (Out)
     528
     529   \sa setAttribute()
     530 */
    543531void QwtLinearScaleEngine::autoScale( int maxNumSteps,
    544     double &x1, double &x2, double &stepSize ) const
     532    double& x1, double& x2, double& stepSize ) const
    545533{
    546534    QwtInterval interval( x1, x2 );
    … …  
    586574
    587575   \return Calculated scale division
    588 */
     576 */
    589577QwtScaleDiv QwtLinearScaleEngine::divideScale( double x1, double x2,
    590578    int maxMajorSteps, int maxMinorSteps, double stepSize ) const
    … …  
    592580    QwtInterval interval = QwtInterval( x1, x2 ).normalized();
    593581
    594     if ( qwtIntervalWidthL( interval ) > std::numeric_limits<double>::max() )
     582    if ( interval.widthL() > std::numeric_limits< double >::max() )
    595583    {
    596584        qWarning() << "QwtLinearScaleEngine::divideScale: overflow";
    … …  
    615603    if ( stepSize != 0.0 )
    616604    {
    617         QList<double> ticks[QwtScaleDiv::NTickTypes];
     605        QList< double > ticks[QwtScaleDiv::NTickTypes];
    618606        buildTicks( interval, stepSize, maxMinorSteps, ticks );
    619607
    … …  
    636624
    637625   \sa buildMajorTicks(), buildMinorTicks
    638 */
     626 */
    639627void QwtLinearScaleEngine::buildTicks(
    640628    const QwtInterval& interval, double stepSize, int maxMinorSteps,
    641     QList<double> ticks[QwtScaleDiv::NTickTypes] ) const
     629    QList< double > ticks[QwtScaleDiv::NTickTypes] ) const
    642630{
    643631    const QwtInterval boundingInterval = align( interval, stepSize );
    … …  
    656644        ticks[i] = strip( ticks[i], interval );
    657645
    658         // ticks very close to 0.0 are
    659         // explicitely set to 0.0
     646        // ticks very close to 0.0 are explicitly set to 0.0
    660647
    661648        for ( int j = 0; j < ticks[i].count(); j++ )
    … …  
    674661
    675662   \return Calculated ticks
    676 */
    677 QList<double> QwtLinearScaleEngine::buildMajorTicks(
    678     const QwtInterval &interval, double stepSize ) const
     663 */
     664QList< double > QwtLinearScaleEngine::buildMajorTicks(
     665    const QwtInterval& interval, double stepSize ) const
    679666{
    680667    int numTicks = qRound( interval.width() / stepSize ) + 1;
    … …  
    682669        numTicks = 10000;
    683670
    684     QList<double> ticks;
     671    QList< double > ticks;
     672    ticks.reserve( numTicks );
    685673
    686674    ticks += interval.minValue();
    … …  
    701689   \param mediumTicks Array to be filled with the calculated medium ticks
    702690
    703 */
     691 */
    704692void QwtLinearScaleEngine::buildMinorTicks(
    705     const QList<double>& majorTicks,
     693    const QList< double >& majorTicks,
    706694    int maxMinorSteps, double stepSize,
    707     QList<double> &minorTicks,
    708     QList<double> &mediumTicks ) const
     695    QList< double >& minorTicks,
     696    QList< double >& mediumTicks ) const
    709697{
    710698    double minStep = qwtStepSize( stepSize, maxMinorSteps, base() );
    … …  
    713701
    714702    // # ticks per interval
    715     const int numTicks = qCeil( qAbs( stepSize / minStep ) ) - 1;
     703    const int numTicks = qwtCeil( qAbs( stepSize / minStep ) ) - 1;
    716704
    717705    int medIndex = -1;
    … …  
    741729
    742730/*!
    743   \brief Align an interval to a step size
    744 
    745   The limits of an interval are aligned that both are integer
    746   multiples of the step size.
    747 
    748   \param interval Interval
    749   \param stepSize Step size
    750 
    751   \return Aligned interval
    752 */
     731   \brief Align an interval to a step size
     732
     733   The limits of an interval are aligned that both are integer
     734   multiples of the step size.
     735
     736   \param interval Interval
     737   \param stepSize Step size
     738
     739   \return Aligned interval
     740 */
    753741QwtInterval QwtLinearScaleEngine::align(
    754     const QwtInterval &interval, double stepSize ) const
     742    const QwtInterval& interval, double stepSize ) const
    755743{
    756744    double x1 = interval.minValue();
    … …  
    761749
    762750    const double eps = 0.000000000001; // since Qt 4.8: qFuzzyIsNull
    763     if ( -DBL_MAX + stepSize <= x1 )
     751    const double max = std::numeric_limits< double >::max();
     752
     753    if ( -max + stepSize <= x1 )
    764754    {
    765755        const double x = QwtScaleArithmetic::floorEps( x1, stepSize );
    … …  
    768758    }
    769759
    770     if ( DBL_MAX - stepSize >= x2 )
     760    if ( max - stepSize >= x2 )
    771761    {
    772762        const double x = QwtScaleArithmetic::ceilEps( x2, stepSize );
    … …  
    779769
    780770/*!
    781   Constructor
    782 
    783   \param base Base of the scale engine
    784   \sa setBase()
     771   Constructor
     772
     773   \param base Base of the scale engine
     774   \sa setBase()
    785775 */
    786776QwtLogScaleEngine::QwtLogScaleEngine( uint base ):
    … …  
    804794
    805795   \sa QwtScaleEngine::setAttribute()
    806 */
     796 */
    807797void QwtLogScaleEngine::autoScale( int maxNumSteps,
    808     double &x1, double &x2, double &stepSize ) const
     798    double& x1, double& x2, double& stepSize ) const
    809799{
    810800    if ( x1 > x2 )
    … …  
    813803    const double logBase = base();
    814804
    815     QwtInterval interval( x1 / qPow( logBase, lowerMargin() ),
    816         x2 * qPow( logBase, upperMargin() ) );
     805    QwtInterval interval( x1 / std::pow( logBase, lowerMargin() ),
     806        x2 * std::pow( logBase, upperMargin() ) );
    817807
    818808    if ( interval.maxValue() / interval.minValue() < logBase )
    … …  
    828818
    829819        QwtInterval linearInterval = QwtInterval( x1, x2 ).normalized();
    830         linearInterval = linearInterval.limited( LOG_MIN, LOG_MAX );
     820        linearInterval = linearInterval.limited(
     821            QwtLogTransform::LogMin, QwtLogTransform::LogMax );
    831822
    832823        if ( linearInterval.maxValue() / linearInterval.minValue() < logBase )
    833824        {
    834             // the aligned scale is still less than one step
    835 
    836 #if 1
    837             // this code doesn't make any sense, but for compatibility
    838             // reasons we keep it until 6.2. But it will be ignored
    839             // in divideScale
    840 
    841             if ( stepSize < 0.0 )
    842                 stepSize = -qwtLog( logBase, qAbs( stepSize ) );
    843             else
    844                 stepSize = qwtLog( logBase, stepSize );
    845 #endif
    846 
     825            stepSize = 0.0;
    847826            return;
    848827        }
    … …  
    850829
    851830    double logRef = 1.0;
    852     if ( reference() > LOG_MIN / 2 )
    853         logRef = qMin( reference(), LOG_MAX / 2 );
     831    if ( reference() > QwtLogTransform::LogMin / 2 )
     832        logRef = qwtMinF( reference(), QwtLogTransform::LogMax / 2 );
    854833
    855834    if ( testAttribute( QwtScaleEngine::Symmetric ) )
    856835    {
    857         const double delta = qMax( interval.maxValue() / logRef,
     836        const double delta = qwtMaxF( interval.maxValue() / logRef,
    858837            logRef / interval.minValue() );
    859838        interval.setInterval( logRef / delta, logRef * delta );
    … …  
    863842        interval = interval.extend( logRef );
    864843
    865     interval = interval.limited( LOG_MIN, LOG_MAX );
     844    interval = interval.limited( QwtLogTransform::LogMin, QwtLogTransform::LogMax );
    866845
    867846    if ( interval.width() == 0.0 )
    … …  
    897876
    898877   \return Calculated scale division
    899 */
     878 */
    900879QwtScaleDiv QwtLogScaleEngine::divideScale( double x1, double x2,
    901880    int maxMajorSteps, int maxMinorSteps, double stepSize ) const
    902881{
    903882    QwtInterval interval = QwtInterval( x1, x2 ).normalized();
    904     interval = interval.limited( LOG_MIN, LOG_MAX );
     883    interval = interval.limited( QwtLogTransform::LogMin, QwtLogTransform::LogMax );
    905884
    906885    if ( interval.width() <= 0 )
    … …  
    937916    if ( stepSize != 0.0 )
    938917    {
    939         QList<double> ticks[QwtScaleDiv::NTickTypes];
     918        QList< double > ticks[QwtScaleDiv::NTickTypes];
    940919        buildTicks( interval, stepSize, maxMinorSteps, ticks );
    941920
    … …  
    958937
    959938   \sa buildMajorTicks(), buildMinorTicks
    960 */
     939 */
    961940void QwtLogScaleEngine::buildTicks(
    962941    const QwtInterval& interval, double stepSize, int maxMinorSteps,
    963     QList<double> ticks[QwtScaleDiv::NTickTypes] ) const
     942    QList< double > ticks[QwtScaleDiv::NTickTypes] ) const
    964943{
    965944    const QwtInterval boundingInterval = align( interval, stepSize );
    … …  
    985964
    986965   \return Calculated ticks
    987 */
    988 QList<double> QwtLogScaleEngine::buildMajorTicks(
    989     const QwtInterval &interval, double stepSize ) const
     966 */
     967QList< double > QwtLogScaleEngine::buildMajorTicks(
     968    const QwtInterval& interval, double stepSize ) const
    990969{
    991970    double width = qwtLogInterval( base(), interval ).width();
    … …  
    995974        numTicks = 10000;
    996975
    997     const double lxmin = ::log( interval.minValue() );
    998     const double lxmax = ::log( interval.maxValue() );
     976    const double lxmin = std::log( interval.minValue() );
     977    const double lxmax = std::log( interval.maxValue() );
    999978    const double lstep = ( lxmax - lxmin ) / double( numTicks - 1 );
    1000979
    1001     QList<double> ticks;
     980    QList< double > ticks;
     981    ticks.reserve( numTicks );
    1002982
    1003983    ticks += interval.minValue();
    1004984
    1005985    for ( int i = 1; i < numTicks - 1; i++ )
    1006         ticks += qExp( lxmin + double( i ) * lstep );
     986        ticks += std::exp( lxmin + double( i ) * lstep );
    1007987
    1008988    ticks += interval.maxValue();
    … …  
    1019999   \param minorTicks Array to be filled with the calculated minor ticks
    10201000   \param mediumTicks Array to be filled with the calculated medium ticks
    1021 */
     1001 */
    10221002void QwtLogScaleEngine::buildMinorTicks(
    1023     const QList<double> &majorTicks,
     1003    const QList< double >& majorTicks,
    10241004    int maxMinorSteps, double stepSize,
    1025     QList<double> &minorTicks,
    1026     QList<double> &mediumTicks ) const
     1005    QList< double >& minorTicks,
     1006    QList< double >& mediumTicks ) const
    10271007{
    10281008    const double logBase = base();
    … …  
    10811061
    10821062        // Do the minor steps fit into the interval?
    1083         if ( qwtFuzzyCompare( ( numTicks +  1 ) * minStep,
     1063        if ( qwtFuzzyCompare( ( numTicks + 1 ) * minStep,
    10841064            stepSize, stepSize ) > 0 )
    10851065        {
    … …  
    10951075
    10961076        // substep factor = base^substeps
    1097         const qreal minFactor = qMax( qPow( logBase, minStep ), qreal( logBase ) );
     1077        const qreal minFactor = qwtMaxF( std::pow( logBase, minStep ), logBase );
    10981078
    10991079        for ( int i = 0; i < majorTicks.count(); i++ )
    … …  
    11141094
    11151095/*!
    1116   \brief Align an interval to a step size
    1117 
    1118   The limits of an interval are aligned that both are integer
    1119   multiples of the step size.
    1120 
    1121   \param interval Interval
    1122   \param stepSize Step size
    1123 
    1124   \return Aligned interval
    1125 */
     1096   \brief Align an interval to a step size
     1097
     1098   The limits of an interval are aligned that both are integer
     1099   multiples of the step size.
     1100
     1101   \param interval Interval
     1102   \param stepSize Step size
     1103
     1104   \return Aligned interval
     1105 */
    11261106QwtInterval QwtLogScaleEngine::align(
    1127     const QwtInterval &interval, double stepSize ) const
     1107    const QwtInterval& interval, double stepSize ) const
    11281108{
    11291109    const QwtInterval intv = qwtLogInterval( base(), interval );
Note: See TracChangeset for help on using the changeset viewer.