Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_scale_map.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_map.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_map.h"
    1111#include "qwt_math.h"
     12
    1213#include <qrect.h>
    1314#include <qdebug.h>
    1415
    1516/*!
    16   \brief Constructor
    17 
    18   The scale and paint device intervals are both set to [0,1].
    19 */
    20 QwtScaleMap::QwtScaleMap():
    21     d_s1( 0.0 ),
    22     d_s2( 1.0 ),
    23     d_p1( 0.0 ),
    24     d_p2( 1.0 ),
    25     d_cnv( 1.0 ),
    26     d_ts1( 0.0 ),
    27     d_transform( NULL )
     17   \brief Constructor
     18
     19   The scale and paint device intervals are both set to [0,1].
     20 */
     21QwtScaleMap::QwtScaleMap()
     22    : m_s1( 0.0 )
     23    , m_s2( 1.0 )
     24    , m_p1( 0.0 )
     25    , m_p2( 1.0 )
     26    , m_cnv( 1.0 )
     27    , m_ts1( 0.0 )
     28    , m_transform( NULL )
    2829{
    2930}
    3031
    3132//! Copy constructor
    32 QwtScaleMap::QwtScaleMap( const QwtScaleMap& other ):
    33     d_s1( other.d_s1 ),
    34     d_s2( other.d_s2 ),
    35     d_p1( other.d_p1 ),
    36     d_p2( other.d_p2 ),
    37     d_cnv( other.d_cnv ),
    38     d_ts1( other.d_ts1 ),
    39     d_transform( NULL )
    40 {
    41     if ( other.d_transform )
    42         d_transform = other.d_transform->copy();
    43 }
    44 
    45 /*!
    46   Destructor
    47 */
     33QwtScaleMap::QwtScaleMap( const QwtScaleMap& other )
     34    : m_s1( other.m_s1 )
     35    , m_s2( other.m_s2 )
     36    , m_p1( other.m_p1 )
     37    , m_p2( other.m_p2 )
     38    , m_cnv( other.m_cnv )
     39    , m_ts1( other.m_ts1 )
     40    , m_transform( NULL )
     41{
     42    if ( other.m_transform )
     43        m_transform = other.m_transform->copy();
     44}
     45
     46/*!
     47   Destructor
     48 */
    4849QwtScaleMap::~QwtScaleMap()
    4950{
    50     delete d_transform;
     51    delete m_transform;
    5152}
    5253
    5354//! Assignment operator
    54 QwtScaleMap &QwtScaleMap::operator=( const QwtScaleMap & other )
    55 {
    56     d_s1 = other.d_s1;
    57     d_s2 = other.d_s2;
    58     d_p1 = other.d_p1;
    59     d_p2 = other.d_p2;
    60     d_cnv = other.d_cnv;
    61     d_ts1 = other.d_ts1;
    62 
    63     delete d_transform;
    64     d_transform = NULL;
    65 
    66     if ( other.d_transform )
    67         d_transform = other.d_transform->copy();
     55QwtScaleMap& QwtScaleMap::operator=( const QwtScaleMap& other )
     56{
     57    m_s1 = other.m_s1;
     58    m_s2 = other.m_s2;
     59    m_p1 = other.m_p1;
     60    m_p2 = other.m_p2;
     61    m_cnv = other.m_cnv;
     62    m_ts1 = other.m_ts1;
     63
     64    delete m_transform;
     65    m_transform = NULL;
     66
     67    if ( other.m_transform )
     68        m_transform = other.m_transform->copy();
    6869
    6970    return *this;
    … …  
    7273/*!
    7374   Initialize the map with a transformation
    74 */
    75 void QwtScaleMap::setTransformation( QwtTransform *transform )
    76 {
    77     if ( transform != d_transform )
     75 */
     76void QwtScaleMap::setTransformation( QwtTransform* transform )
     77{
     78    if ( transform != m_transform )
    7879    {
    79         delete d_transform;
    80         d_transform = transform;
     80        delete m_transform;
     81        m_transform = transform;
    8182    }
    8283
    83     setScaleInterval( d_s1, d_s2 );
     84    setScaleInterval( m_s1, m_s2 );
    8485}
    8586
    8687//! Get the transformation
    87 const QwtTransform *QwtScaleMap::transformation() const
    88 {
    89     return d_transform;
    90 }
    91 
    92 /*!
    93   \brief Specify the borders of the scale interval
    94   \param s1 first border
    95   \param s2 second border
    96   \warning scales might be aligned to
     88const QwtTransform* QwtScaleMap::transformation() const
     89{
     90    return m_transform;
     91}
     92
     93/*!
     94   \brief Specify the borders of the scale interval
     95   \param s1 first border
     96   \param s2 second border
     97   \warning scales might be aligned to
    9798           transformation depending boundaries
    98 */
     99 */
    99100void QwtScaleMap::setScaleInterval( double s1, double s2 )
    100101{
    101     d_s1 = s1;
    102     d_s2 = s2;
    103 
    104     if ( d_transform )
     102    m_s1 = s1;
     103    m_s2 = s2;
     104
     105    if ( m_transform )
    105106    {
    106         d_s1 = d_transform->bounded( d_s1 );
    107         d_s2 = d_transform->bounded( d_s2 );
     107        m_s1 = m_transform->bounded( m_s1 );
     108        m_s2 = m_transform->bounded( m_s2 );
    108109    }
    109110
    … …  
    112113
    113114/*!
    114   \brief Specify the borders of the paint device interval
    115   \param p1 first border
    116   \param p2 second border
    117 */
     115   \brief Specify the borders of the paint device interval
     116   \param p1 first border
     117   \param p2 second border
     118 */
    118119void QwtScaleMap::setPaintInterval( double p1, double p2 )
    119120{
    120     d_p1 = p1;
    121     d_p2 = p2;
     121    m_p1 = p1;
     122    m_p2 = p2;
    122123
    123124    updateFactor();
    … …  
    126127void QwtScaleMap::updateFactor()
    127128{
    128     d_ts1 = d_s1;
    129     double ts2 = d_s2;
    130 
    131     if ( d_transform )
     129    m_ts1 = m_s1;
     130    double ts2 = m_s2;
     131
     132    if ( m_transform )
    132133    {
    133         d_ts1 = d_transform->transform( d_ts1 );
    134         ts2 = d_transform->transform( ts2 );
     134        m_ts1 = m_transform->transform( m_ts1 );
     135        ts2 = m_transform->transform( ts2 );
    135136    }
    136137
    137     d_cnv = 1.0;
    138     if ( d_ts1 != ts2 )
    139         d_cnv = ( d_p2 - d_p1 ) / ( ts2 - d_ts1 );
     138    m_cnv = 1.0;
     139    if ( m_ts1 != ts2 )
     140        m_cnv = ( m_p2 - m_p1 ) / ( ts2 - m_ts1 );
    140141}
    141142
    … …  
    149150
    150151   \sa invTransform()
    151 */
    152 QRectF QwtScaleMap::transform( const QwtScaleMap &xMap,
    153     const QwtScaleMap &yMap, const QRectF &rect )
     152 */
     153QRectF QwtScaleMap::transform( const QwtScaleMap& xMap,
     154    const QwtScaleMap& yMap, const QRectF& rect )
    154155{
    155156    double x1 = xMap.transform( rect.left() );
    … …  
    183184   \return Position in scale coordinates
    184185   \sa transform()
    185 */
    186 QPointF QwtScaleMap::invTransform( const QwtScaleMap &xMap,
    187     const QwtScaleMap &yMap, const QPointF &pos )
     186 */
     187QPointF QwtScaleMap::invTransform( const QwtScaleMap& xMap,
     188    const QwtScaleMap& yMap, const QPointF& pos )
    188189{
    189190    return QPointF(
    190191        xMap.invTransform( pos.x() ),
    191192        yMap.invTransform( pos.y() )
    192     );
     193        );
    193194}
    194195
    … …  
    202203
    203204   \sa invTransform()
    204 */
    205 QPointF QwtScaleMap::transform( const QwtScaleMap &xMap,
    206     const QwtScaleMap &yMap, const QPointF &pos )
     205 */
     206QPointF QwtScaleMap::transform( const QwtScaleMap& xMap,
     207    const QwtScaleMap& yMap, const QPointF& pos )
    207208{
    208209    return QPointF(
    209210        xMap.transform( pos.x() ),
    210211        yMap.transform( pos.y() )
    211     );
     212        );
    212213}
    213214
    … …  
    220221   \return Rectangle in scale coordinates
    221222   \sa transform()
    222 */
    223 QRectF QwtScaleMap::invTransform( const QwtScaleMap &xMap,
    224     const QwtScaleMap &yMap, const QRectF &rect )
     223 */
     224QRectF QwtScaleMap::invTransform( const QwtScaleMap& xMap,
     225    const QwtScaleMap& yMap, const QRectF& rect )
    225226{
    226227    const double x1 = xMap.invTransform( rect.left() );
    … …  
    235236#ifndef QT_NO_DEBUG_STREAM
    236237
    237 QDebug operator<<( QDebug debug, const QwtScaleMap &map )
     238QDebug operator<<( QDebug debug, const QwtScaleMap& map )
    238239{
    239240    debug.nospace() << "QwtScaleMap("
    240         << map.transformation()
    241         << ", s:" << map.s1() << "->" << map.s2()
    242         << ", p:" << map.p1() << "->" << map.p2()
    243         << ")";
     241                    << map.transformation()
     242                    << ", s:" << map.s1() << "->" << map.s2()
     243                    << ", p:" << map.p1() << "->" << map.p2()
     244                    << ")";
    244245
    245246    return debug.space();
Note: See TracChangeset for help on using the changeset viewer.