Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_series_store.h


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

deprecated functions exchanged libs updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/qwt/qwt_series_store.h

    r9383 r11158  
    1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
     1/******************************************************************************
    22 * Qwt Widget Library
    33 * Copyright (C) 1997   Josef Wilgen
    … …  
    1515
    1616/*!
    17   \brief Bridge between QwtSeriesStore and QwtPlotSeriesItem
    18 
    19   QwtAbstractSeriesStore is an abstract interface only
    20   to make it possible to isolate the template based methods ( QwtSeriesStore )
    21   from the regular methods ( QwtPlotSeriesItem ) to make it possible
    22   to derive from QwtPlotSeriesItem without any hassle with templates.
    23 */
     17   \brief Bridge between QwtSeriesStore and QwtPlotSeriesItem
     18
     19   QwtAbstractSeriesStore is an abstract interface only
     20   to make it possible to isolate the template based methods ( QwtSeriesStore )
     21   from the regular methods ( QwtPlotSeriesItem ) to make it possible
     22   to derive from QwtPlotSeriesItem without any hassle with templates.
     23 */
    2424class QwtAbstractSeriesStore
    2525{
    26 protected:
     26  public:
    2727    //! Destructor
    2828    virtual ~QwtAbstractSeriesStore() {}
    2929
     30  protected:
    3031#ifndef QWT_PYTHON_WRAPPER
    3132    //! dataChanged() indicates, that the series has been changed.
    … …  
    3334
    3435    /*!
    35       Set a the "rectangle of interest" for the stored series
    36       \sa QwtSeriesData<T>::setRectOfInterest()
    37      */
    38     virtual void setRectOfInterest( const QRectF & ) = 0;
     36       Set a the "rectangle of interest" for the stored series
     37       \sa QwtSeriesData<T>::setRectOfInterest()
     38     */
     39    virtual void setRectOfInterest( const QRectF& ) = 0;
    3940
    4041    //! \return Bounding rectangle of the stored series
    … …  
    4647    // Needed for generating the python bindings, but not for using them !
    4748    virtual void dataChanged() {}
    48     virtual void setRectOfInterest( const QRectF & ) {}
    49     virtual QRectF dataRect() const { return  QRectF( 0.0, 0.0, -1.0, -1.0 ); }
     49    virtual void setRectOfInterest( const QRectF& ) {}
     50    virtual QRectF dataRect() const { return QRectF( 0.0, 0.0, -1.0, -1.0 ); }
    5051    virtual size_t dataSize() const { return 0; }
    5152#endif
    … …  
    5354
    5455/*!
    55   \brief Class storing a QwtSeriesData object
    56 
    57   QwtSeriesStore and QwtPlotSeriesItem are intended as base classes for all
    58   plot items iterating over a series of samples. Both classes share
    59   a virtual base class ( QwtAbstractSeriesStore ) to bridge between them.
    60 
    61   QwtSeriesStore offers the template based part for the plot item API, so
    62   that QwtPlotSeriesItem can be derived without any hassle with templates.
     56   \brief Class storing a QwtSeriesData object
     57
     58   QwtSeriesStore and QwtPlotSeriesItem are intended as base classes for all
     59   plot items iterating over a series of samples. Both classes share
     60   a virtual base class ( QwtAbstractSeriesStore ) to bridge between them.
     61
     62   QwtSeriesStore offers the template based part for the plot item API, so
     63   that QwtPlotSeriesItem can be derived without any hassle with templates.
    6364 */
    64 template <typename T>
    65 class QwtSeriesStore: public virtual QwtAbstractSeriesStore
    66 {
    67 public:
    68     /*!
    69       \brief Constructor
    70       The store contains no series
    71     */
    72     explicit QwtSeriesStore<T>();
     65template< typename T >
     66class QwtSeriesStore : public virtual QwtAbstractSeriesStore
     67{
     68  public:
     69    /*!
     70       \brief Constructor
     71       The store contains no series
     72     */
     73    explicit QwtSeriesStore();
    7374
    7475    //! Destructor
    75     ~QwtSeriesStore<T>();
    76 
    77     /*!
    78       Assign a series of samples
    79 
    80       \param series Data
    81       \warning The item takes ownership of the data object, deleting
     76    ~QwtSeriesStore();
     77
     78    /*!
     79       Assign a series of samples
     80
     81       \param series Data
     82       \warning The item takes ownership of the data object, deleting
    8283               it when its not used anymore.
    83     */
    84     void setData( QwtSeriesData<T> *series );
     84     */
     85    void setData( QwtSeriesData< T >* series );
    8586
    8687    //! \return the the series data
    87     QwtSeriesData<T> *data();
     88    QwtSeriesData< T >* data();
    8889
    8990    //! \return the the series data
    90     const QwtSeriesData<T> *data() const;
     91    const QwtSeriesData< T >* data() const;
    9192
    9293    /*!
    9394        \param index Index
    9495        \return Sample at position index
    95     */
     96     */
    9697    T sample( int index ) const;
    9798
    9899    /*!
    99       \return Number of samples of the series
    100       \sa setData(), QwtSeriesData<T>::size()
    101     */
    102     virtual size_t dataSize() const;
    103 
    104     /*!
    105       \return Bounding rectangle of the series
     100       \return Number of samples of the series
     101       \sa setData(), QwtSeriesData<T>::size()
     102     */
     103    virtual size_t dataSize() const QWT_OVERRIDE;
     104
     105    /*!
     106       \return Bounding rectangle of the series
    106107              or an invalid rectangle, when no series is stored
    107108
    108       \sa QwtSeriesData<T>::boundingRect()
    109     */
    110     virtual QRectF dataRect() const;
    111 
    112     /*!
    113       Set a the "rect of interest" for the series
    114 
    115       \param rect Rectangle of interest
    116       \sa QwtSeriesData<T>::setRectOfInterest()
    117     */
    118     virtual void setRectOfInterest( const QRectF &rect );
    119 
    120     /*!
    121       Replace a series without deleting the previous one
    122 
    123       \param series New series
    124       \return Previously assigned series
    125      */
    126     QwtSeriesData<T> *swapData( QwtSeriesData<T> *series );
    127 
    128 private:
    129     QwtSeriesData<T> *d_series;
     109       \sa QwtSeriesData<T>::boundingRect()
     110     */
     111    virtual QRectF dataRect() const QWT_OVERRIDE;
     112
     113    /*!
     114       Set a the "rect of interest" for the series
     115
     116       \param rect Rectangle of interest
     117       \sa QwtSeriesData<T>::setRectOfInterest()
     118     */
     119    virtual void setRectOfInterest( const QRectF& rect ) QWT_OVERRIDE;
     120
     121    /*!
     122       Replace a series without deleting the previous one
     123
     124       \param series New series
     125       \return Previously assigned series
     126     */
     127    QwtSeriesData< T >* swapData( QwtSeriesData< T >* series );
     128
     129  private:
     130    QwtSeriesData< T >* m_series;
    130131};
    131132
    132 template <typename T>
    133 QwtSeriesStore<T>::QwtSeriesStore():
    134     d_series( NULL )
    135 {
    136 }
    137 
    138 template <typename T>
    139 QwtSeriesStore<T>::~QwtSeriesStore()
    140 {
    141     delete d_series;
    142 }
    143 
    144 template <typename T>
    145 inline QwtSeriesData<T> *QwtSeriesStore<T>::data()
    146 {
    147     return d_series;
    148 }
    149 
    150 template <typename T>
    151 inline const QwtSeriesData<T> *QwtSeriesStore<T>::data() const
    152 {
    153     return d_series;
    154 }
    155 
    156 template <typename T>
    157 inline T QwtSeriesStore<T>::sample( int index ) const
    158 {
    159     return d_series ? d_series->sample( index ) : T();
    160 }
    161 
    162 template <typename T>
    163 void QwtSeriesStore<T>::setData( QwtSeriesData<T> *series )
    164 {
    165     if ( d_series != series )
     133template< typename T >
     134QwtSeriesStore< T >::QwtSeriesStore()
     135    : m_series( NULL )
     136{
     137}
     138
     139template< typename T >
     140QwtSeriesStore< T >::~QwtSeriesStore()
     141{
     142    delete m_series;
     143}
     144
     145template< typename T >
     146inline QwtSeriesData< T >* QwtSeriesStore< T >::data()
     147{
     148    return m_series;
     149}
     150
     151template< typename T >
     152inline const QwtSeriesData< T >* QwtSeriesStore< T >::data() const
     153{
     154    return m_series;
     155}
     156
     157template< typename T >
     158inline T QwtSeriesStore< T >::sample( int index ) const
     159{
     160    return m_series ? m_series->sample( index ) : T();
     161}
     162
     163template< typename T >
     164void QwtSeriesStore< T >::setData( QwtSeriesData< T >* series )
     165{
     166    if ( m_series != series )
    166167    {
    167         delete d_series;
    168         d_series = series;
     168        delete m_series;
     169        m_series = series;
    169170        dataChanged();
    170171    }
    171172}
    172173
    173 template <typename T>
    174 size_t QwtSeriesStore<T>::dataSize() const
    175 {
    176     if ( d_series == NULL )
     174template< typename T >
     175size_t QwtSeriesStore< T >::dataSize() const
     176{
     177    if ( m_series == NULL )
    177178        return 0;
    178179
    179     return d_series->size();
    180 }
    181 
    182 template <typename T>
    183 QRectF QwtSeriesStore<T>::dataRect() const
    184 {
    185     if ( d_series == NULL )
     180    return m_series->size();
     181}
     182
     183template< typename T >
     184QRectF QwtSeriesStore< T >::dataRect() const
     185{
     186    if ( m_series == NULL )
    186187        return QRectF( 1.0, 1.0, -2.0, -2.0 ); // invalid
    187188
    188     return d_series->boundingRect();
    189 }
    190 
    191 template <typename T>
    192 void QwtSeriesStore<T>::setRectOfInterest( const QRectF &rect )
    193 {
    194     if ( d_series )
    195         d_series->setRectOfInterest( rect );
    196 }
    197 
    198 template <typename T>
    199 QwtSeriesData<T>* QwtSeriesStore<T>::swapData( QwtSeriesData<T> *series )
    200 {
    201     QwtSeriesData<T> * swappedSeries = d_series;
    202     d_series = series;
     189    return m_series->boundingRect();
     190}
     191
     192template< typename T >
     193void QwtSeriesStore< T >::setRectOfInterest( const QRectF& rect )
     194{
     195    if ( m_series )
     196        m_series->setRectOfInterest( rect );
     197}
     198
     199template< typename T >
     200QwtSeriesData< T >* QwtSeriesStore< T >::swapData( QwtSeriesData< T >* series )
     201{
     202    QwtSeriesData< T >* swappedSeries = m_series;
     203    m_series = series;
    203204
    204205    return swappedSeries;
Note: See TracChangeset for help on using the changeset viewer.