Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_series_data.cpp
- Timestamp:
- Nov 3, 2026, 10:53:35 AM (3 weeks ago)
- File:
-
- 1 edited
-
trunk/BNC/qwt/qwt_series_data.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_series_data.cpp
r9383 r11158 1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*-*****************************1 /****************************************************************************** 2 2 * Qwt Widget Library 3 3 * Copyright (C) 1997 Josef Wilgen … … 9 9 10 10 #include "qwt_series_data.h" 11 #include "qwt_ math.h"12 13 static inline QRectF qwtBoundingRect( const QPointF &sample )11 #include "qwt_point_polar.h" 12 13 static inline QRectF qwtBoundingRect( const QPointF& sample ) 14 14 { 15 15 return QRectF( sample.x(), sample.y(), 0.0, 0.0 ); 16 16 } 17 17 18 static inline QRectF qwtBoundingRect( const QwtPoint3D &sample )18 static inline QRectF qwtBoundingRect( const QwtPoint3D& sample ) 19 19 { 20 20 return QRectF( sample.x(), sample.y(), 0.0, 0.0 ); 21 21 } 22 22 23 static inline QRectF qwtBoundingRect( const QwtPointPolar &sample )23 static inline QRectF qwtBoundingRect( const QwtPointPolar& sample ) 24 24 { 25 25 return QRectF( sample.azimuth(), sample.radius(), 0.0, 0.0 ); 26 26 } 27 27 28 static inline QRectF qwtBoundingRect( const QwtIntervalSample &sample )28 static inline QRectF qwtBoundingRect( const QwtIntervalSample& sample ) 29 29 { 30 30 return QRectF( sample.interval.minValue(), sample.value, … … 32 32 } 33 33 34 static inline QRectF qwtBoundingRect( const QwtSetSample &sample )34 static inline QRectF qwtBoundingRect( const QwtSetSample& sample ) 35 35 { 36 36 if ( sample.set.empty() ) … … 52 52 } 53 53 54 static inline QRectF qwtBoundingRect( const QwtOHLCSample &sample )54 static inline QRectF qwtBoundingRect( const QwtOHLCSample& sample ) 55 55 { 56 56 const QwtInterval interval = sample.boundingInterval(); … … 58 58 } 59 59 60 /*! 61 \brief Calculate the bounding rectangle of a series subset 62 63 Slow implementation, that iterates over the series. 64 65 \param series Series 66 \param from Index of the first sample, <= 0 means from the beginning 67 \param to Index of the last sample, < 0 means to the end 68 69 \return Bounding rectangle 70 */ 71 72 template <class T> 73 QRectF qwtBoundingRectT( 74 const QwtSeriesData<T>& series, int from, int to ) 60 static inline QRectF qwtBoundingRect( const QwtVectorFieldSample& sample ) 61 { 62 /* 63 When displaying a sample as an arrow its length will be 64 proportional to the magnitude - but not the same. 65 As the factor between length and magnitude is not known 66 we can't include vx/vy into the bounding rectangle. 67 */ 68 69 return QRectF( sample.x, sample.y, 0, 0 ); 70 } 71 72 /*! 73 \brief Calculate the bounding rectangle of a series subset 74 75 Slow implementation, that iterates over the series. 76 77 \param series Series 78 \param from Index of the first sample, <= 0 means from the beginning 79 \param to Index of the last sample, < 0 means to the end 80 81 \return Bounding rectangle 82 */ 83 84 template< class T > 85 QRectF qwtBoundingRectT( const QwtSeriesData< T >& series, int from, int to ) 75 86 { 76 87 QRectF boundingRect( 1.0, 1.0, -2.0, -2.0 ); // invalid; … … 113 124 114 125 /*! 115 \brief Calculate the bounding rectangle of a series subset 116 117 Slow implementation, that iterates over the series. 118 119 \param series Series 120 \param from Index of the first sample, <= 0 means from the beginning 121 \param to Index of the last sample, < 0 means to the end 122 123 \return Bounding rectangle 124 */ 125 QRectF qwtBoundingRect( 126 const QwtSeriesData<QPointF> &series, int from, int to ) 127 { 128 return qwtBoundingRectT<QPointF>( series, from, to ); 129 } 130 131 /*! 132 \brief Calculate the bounding rectangle of a series subset 133 134 Slow implementation, that iterates over the series. 135 136 \param series Series 137 \param from Index of the first sample, <= 0 means from the beginning 138 \param to Index of the last sample, < 0 means to the end 139 140 \return Bounding rectangle 141 */ 142 QRectF qwtBoundingRect( 143 const QwtSeriesData<QwtPoint3D> &series, int from, int to ) 144 { 145 return qwtBoundingRectT<QwtPoint3D>( series, from, to ); 146 } 147 148 /*! 149 \brief Calculate the bounding rectangle of a series subset 150 151 The horizontal coordinates represent the azimuth, the 152 vertical coordinates the radius. 153 154 Slow implementation, that iterates over the series. 155 156 \param series Series 157 \param from Index of the first sample, <= 0 means from the beginning 158 \param to Index of the last sample, < 0 means to the end 159 160 \return Bounding rectangle 161 */ 162 QRectF qwtBoundingRect( 163 const QwtSeriesData<QwtPointPolar> &series, int from, int to ) 164 { 165 return qwtBoundingRectT<QwtPointPolar>( series, from, to ); 166 } 167 168 /*! 169 \brief Calculate the bounding rectangle of a series subset 170 171 Slow implementation, that iterates over the series. 172 173 \param series Series 174 \param from Index of the first sample, <= 0 means from the beginning 175 \param to Index of the last sample, < 0 means to the end 176 177 \return Bounding rectangle 178 */ 179 QRectF qwtBoundingRect( 180 const QwtSeriesData<QwtIntervalSample>& series, int from, int to ) 181 { 182 return qwtBoundingRectT<QwtIntervalSample>( series, from, to ); 183 } 184 185 /*! 186 \brief Calculate the bounding rectangle of a series subset 187 188 Slow implementation, that iterates over the series. 189 190 \param series Series 191 \param from Index of the first sample, <= 0 means from the beginning 192 \param to Index of the last sample, < 0 means to the end 193 194 \return Bounding rectangle 195 */ 196 QRectF qwtBoundingRect( 197 const QwtSeriesData<QwtOHLCSample>& series, int from, int to ) 198 { 199 return qwtBoundingRectT<QwtOHLCSample>( series, from, to ); 200 } 201 202 /*! 203 \brief Calculate the bounding rectangle of a series subset 204 205 Slow implementation, that iterates over the series. 206 207 \param series Series 208 \param from Index of the first sample, <= 0 means from the beginning 209 \param to Index of the last sample, < 0 means to the end 210 211 \return Bounding rectangle 212 */ 213 QRectF qwtBoundingRect( 214 const QwtSeriesData<QwtSetSample>& series, int from, int to ) 215 { 216 return qwtBoundingRectT<QwtSetSample>( series, from, to ); 217 } 218 219 /*! 220 Constructor 221 \param samples Samples 222 */ 223 QwtPointSeriesData::QwtPointSeriesData( 224 const QVector<QPointF> &samples ): 225 QwtArraySeriesData<QPointF>( samples ) 226 { 227 } 228 229 /*! 230 \brief Calculate the bounding rectangle 231 232 The bounding rectangle is calculated once by iterating over all 233 points and is stored for all following requests. 234 235 \return Bounding rectangle 236 */ 237 QRectF QwtPointSeriesData::boundingRect() const 238 { 239 if ( d_boundingRect.width() < 0.0 ) 240 d_boundingRect = qwtBoundingRect( *this ); 241 242 return d_boundingRect; 243 } 244 245 /*! 246 Constructor 247 \param samples Samples 248 */ 249 QwtPoint3DSeriesData::QwtPoint3DSeriesData( 250 const QVector<QwtPoint3D> &samples ): 251 QwtArraySeriesData<QwtPoint3D>( samples ) 252 { 253 } 254 255 /*! 256 \brief Calculate the bounding rectangle 257 258 The bounding rectangle is calculated once by iterating over all 259 points and is stored for all following requests. 260 261 \return Bounding rectangle 262 */ 263 QRectF QwtPoint3DSeriesData::boundingRect() const 264 { 265 if ( d_boundingRect.width() < 0.0 ) 266 d_boundingRect = qwtBoundingRect( *this ); 267 268 return d_boundingRect; 269 } 270 271 /*! 272 Constructor 273 \param samples Samples 274 */ 275 QwtIntervalSeriesData::QwtIntervalSeriesData( 276 const QVector<QwtIntervalSample> &samples ): 277 QwtArraySeriesData<QwtIntervalSample>( samples ) 278 { 279 } 280 281 /*! 282 \brief Calculate the bounding rectangle 283 284 The bounding rectangle is calculated once by iterating over all 285 points and is stored for all following requests. 286 287 \return Bounding rectangle 288 */ 289 QRectF QwtIntervalSeriesData::boundingRect() const 290 { 291 if ( d_boundingRect.width() < 0.0 ) 292 d_boundingRect = qwtBoundingRect( *this ); 293 294 return d_boundingRect; 295 } 296 297 /*! 298 Constructor 299 \param samples Samples 300 */ 301 QwtSetSeriesData::QwtSetSeriesData( 302 const QVector<QwtSetSample> &samples ): 303 QwtArraySeriesData<QwtSetSample>( samples ) 304 { 305 } 306 307 /*! 308 \brief Calculate the bounding rectangle 309 310 The bounding rectangle is calculated once by iterating over all 311 points and is stored for all following requests. 312 313 \return Bounding rectangle 314 */ 315 QRectF QwtSetSeriesData::boundingRect() const 316 { 317 if ( d_boundingRect.width() < 0.0 ) 318 d_boundingRect = qwtBoundingRect( *this ); 319 320 return d_boundingRect; 321 } 322 323 /*! 324 Constructor 325 \param samples Samples 326 */ 327 QwtTradingChartData::QwtTradingChartData( 328 const QVector<QwtOHLCSample> &samples ): 329 QwtArraySeriesData<QwtOHLCSample>( samples ) 330 { 331 } 332 333 /*! 334 \brief Calculate the bounding rectangle 335 336 The bounding rectangle is calculated once by iterating over all 337 points and is stored for all following requests. 338 339 \return Bounding rectangle 340 */ 341 QRectF QwtTradingChartData::boundingRect() const 342 { 343 if ( d_boundingRect.width() < 0.0 ) 344 d_boundingRect = qwtBoundingRect( *this ); 345 346 return d_boundingRect; 347 } 126 \brief Calculate the bounding rectangle of a series subset 127 128 Slow implementation, that iterates over the series. 129 130 \param series Series 131 \param from Index of the first sample, <= 0 means from the beginning 132 \param to Index of the last sample, < 0 means to the end 133 134 \return Bounding rectangle 135 */ 136 QRectF qwtBoundingRect( const QwtSeriesData< QPointF >& series, int from, int to ) 137 { 138 return qwtBoundingRectT< QPointF >( series, from, to ); 139 } 140 141 /*! 142 \brief Calculate the bounding rectangle of a series subset 143 144 Slow implementation, that iterates over the series. 145 146 \param series Series 147 \param from Index of the first sample, <= 0 means from the beginning 148 \param to Index of the last sample, < 0 means to the end 149 150 \return Bounding rectangle 151 */ 152 QRectF qwtBoundingRect( 153 const QwtSeriesData< QwtPoint3D >& series, int from, int to ) 154 { 155 return qwtBoundingRectT< QwtPoint3D >( series, from, to ); 156 } 157 158 /*! 159 \brief Calculate the bounding rectangle of a series subset 160 161 The horizontal coordinates represent the azimuth, the 162 vertical coordinates the radius. 163 164 Slow implementation, that iterates over the series. 165 166 \param series Series 167 \param from Index of the first sample, <= 0 means from the beginning 168 \param to Index of the last sample, < 0 means to the end 169 170 \return Bounding rectangle 171 */ 172 QRectF qwtBoundingRect( 173 const QwtSeriesData< QwtPointPolar >& series, int from, int to ) 174 { 175 return qwtBoundingRectT< QwtPointPolar >( series, from, to ); 176 } 177 178 /*! 179 \brief Calculate the bounding rectangle of a series subset 180 181 Slow implementation, that iterates over the series. 182 183 \param series Series 184 \param from Index of the first sample, <= 0 means from the beginning 185 \param to Index of the last sample, < 0 means to the end 186 187 \return Bounding rectangle 188 */ 189 QRectF qwtBoundingRect( 190 const QwtSeriesData< QwtIntervalSample >& series, int from, int to ) 191 { 192 return qwtBoundingRectT< QwtIntervalSample >( series, from, to ); 193 } 194 195 /*! 196 \brief Calculate the bounding rectangle of a series subset 197 198 Slow implementation, that iterates over the series. 199 200 \param series Series 201 \param from Index of the first sample, <= 0 means from the beginning 202 \param to Index of the last sample, < 0 means to the end 203 204 \return Bounding rectangle 205 */ 206 QRectF qwtBoundingRect( 207 const QwtSeriesData< QwtOHLCSample >& series, int from, int to ) 208 { 209 return qwtBoundingRectT< QwtOHLCSample >( series, from, to ); 210 } 211 212 /*! 213 \brief Calculate the bounding rectangle of a series subset 214 215 Slow implementation, that iterates over the series. 216 217 \param series Series 218 \param from Index of the first sample, <= 0 means from the beginning 219 \param to Index of the last sample, < 0 means to the end 220 221 \return Bounding rectangle 222 */ 223 QRectF qwtBoundingRect( 224 const QwtSeriesData< QwtSetSample >& series, int from, int to ) 225 { 226 return qwtBoundingRectT< QwtSetSample >( series, from, to ); 227 } 228 229 /*! 230 \brief Calculate the bounding rectangle of a series subset 231 232 Slow implementation, that iterates over the series. 233 234 \param series Series 235 \param from Index of the first sample, <= 0 means from the beginning 236 \param to Index of the last sample, < 0 means to the end 237 238 \return Bounding rectangle 239 */ 240 QRectF qwtBoundingRect( 241 const QwtSeriesData< QwtVectorFieldSample >& series, int from, int to ) 242 { 243 return qwtBoundingRectT< QwtVectorFieldSample >( series, from, to ); 244 }
Note:
See TracChangeset
for help on using the changeset viewer.
