Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_series_store.h
- Timestamp:
- Nov 3, 2026, 10:53:35 AM (5 weeks ago)
- File:
-
- 1 edited
-
trunk/BNC/qwt/qwt_series_store.h (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_series_store.h
r9383 r11158 1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*-*****************************1 /****************************************************************************** 2 2 * Qwt Widget Library 3 3 * Copyright (C) 1997 Josef Wilgen … … 15 15 16 16 /*! 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 */ 24 24 class QwtAbstractSeriesStore 25 25 { 26 protected:26 public: 27 27 //! Destructor 28 28 virtual ~QwtAbstractSeriesStore() {} 29 29 30 protected: 30 31 #ifndef QWT_PYTHON_WRAPPER 31 32 //! dataChanged() indicates, that the series has been changed. … … 33 34 34 35 /*! 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; 39 40 40 41 //! \return Bounding rectangle of the stored series … … 46 47 // Needed for generating the python bindings, but not for using them ! 47 48 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 ); } 50 51 virtual size_t dataSize() const { return 0; } 51 52 #endif … … 53 54 54 55 /*! 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. 63 64 */ 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>();65 template< typename T > 66 class QwtSeriesStore : public virtual QwtAbstractSeriesStore 67 { 68 public: 69 /*! 70 \brief Constructor 71 The store contains no series 72 */ 73 explicit QwtSeriesStore(); 73 74 74 75 //! 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 82 83 it when its not used anymore. 83 */ 84 void setData( QwtSeriesData< T> *series );84 */ 85 void setData( QwtSeriesData< T >* series ); 85 86 86 87 //! \return the the series data 87 QwtSeriesData< T> *data();88 QwtSeriesData< T >* data(); 88 89 89 90 //! \return the the series data 90 const QwtSeriesData< T> *data() const;91 const QwtSeriesData< T >* data() const; 91 92 92 93 /*! 93 94 \param index Index 94 95 \return Sample at position index 95 */ 96 */ 96 97 T sample( int index ) const; 97 98 98 99 /*! 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 106 107 or an invalid rectangle, when no series is stored 107 108 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; 130 131 }; 131 132 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() const152 { 153 return d_series;154 } 155 156 template <typename T>157 inline T QwtSeriesStore< T>::sample( int index ) const158 { 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 )133 template< typename T > 134 QwtSeriesStore< T >::QwtSeriesStore() 135 : m_series( NULL ) 136 { 137 } 138 139 template< typename T > 140 QwtSeriesStore< T >::~QwtSeriesStore() 141 { 142 delete m_series; 143 } 144 145 template< typename T > 146 inline QwtSeriesData< T >* QwtSeriesStore< T >::data() 147 { 148 return m_series; 149 } 150 151 template< typename T > 152 inline const QwtSeriesData< T >* QwtSeriesStore< T >::data() const 153 { 154 return m_series; 155 } 156 157 template< typename T > 158 inline T QwtSeriesStore< T >::sample( int index ) const 159 { 160 return m_series ? m_series->sample( index ) : T(); 161 } 162 163 template< typename T > 164 void QwtSeriesStore< T >::setData( QwtSeriesData< T >* series ) 165 { 166 if ( m_series != series ) 166 167 { 167 delete d_series;168 d_series = series;168 delete m_series; 169 m_series = series; 169 170 dataChanged(); 170 171 } 171 172 } 172 173 173 template <typename T>174 size_t QwtSeriesStore< T>::dataSize() const175 { 176 if ( d_series == NULL )174 template< typename T > 175 size_t QwtSeriesStore< T >::dataSize() const 176 { 177 if ( m_series == NULL ) 177 178 return 0; 178 179 179 return d_series->size();180 } 181 182 template <typename T>183 QRectF QwtSeriesStore< T>::dataRect() const184 { 185 if ( d_series == NULL )180 return m_series->size(); 181 } 182 183 template< typename T > 184 QRectF QwtSeriesStore< T >::dataRect() const 185 { 186 if ( m_series == NULL ) 186 187 return QRectF( 1.0, 1.0, -2.0, -2.0 ); // invalid 187 188 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 192 template< typename T > 193 void QwtSeriesStore< T >::setRectOfInterest( const QRectF& rect ) 194 { 195 if ( m_series ) 196 m_series->setRectOfInterest( rect ); 197 } 198 199 template< typename T > 200 QwtSeriesData< T >* QwtSeriesStore< T >::swapData( QwtSeriesData< T >* series ) 201 { 202 QwtSeriesData< T >* swappedSeries = m_series; 203 m_series = series; 203 204 204 205 return swappedSeries;
Note:
See TracChangeset
for help on using the changeset viewer.
