Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_samples.h
- Timestamp:
- Nov 3, 2026, 10:53:35 AM (3 weeks ago)
- File:
-
- 1 edited
-
trunk/BNC/qwt/qwt_samples.h (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_samples.h
r8127 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 #ifndef QWT_SAMPLES_H 11 #define QWT_SAMPLES_H 111 #define QWT_SAMPLES_H 12 12 13 13 #include "qwt_global.h" 14 14 #include "qwt_interval.h" 15 15 16 #include <qvector.h> 16 17 #include <qrect.h> … … 19 20 class QWT_EXPORT QwtIntervalSample 20 21 { 21 public: 22 public: 22 23 QwtIntervalSample(); 23 QwtIntervalSample( double, const QwtInterval & );24 QwtIntervalSample( double, const QwtInterval& ); 24 25 QwtIntervalSample( double value, double min, double max ); 25 26 26 bool operator==( const QwtIntervalSample & ) const;27 bool operator!=( const QwtIntervalSample & ) const;27 bool operator==( const QwtIntervalSample& ) const; 28 bool operator!=( const QwtIntervalSample& ) const; 28 29 29 30 //! Value … … 35 36 36 37 /*! 37 Constructor 38 The value is set to 0.0, the interval is invalid 39 */ 40 inline QwtIntervalSample::QwtIntervalSample() :41 value( 0.0 ) 38 Constructor 39 The value is set to 0.0, the interval is invalid 40 */ 41 inline QwtIntervalSample::QwtIntervalSample() 42 : value( 0.0 ) 42 43 { 43 44 } 44 45 45 46 //! Constructor 46 inline QwtIntervalSample::QwtIntervalSample( 47 double v, const QwtInterval &intv ): 48 value( v ), 49 interval( intv ) 47 inline QwtIntervalSample::QwtIntervalSample( double v, const QwtInterval& intv ) 48 : value( v ) 49 , interval( intv ) 50 50 { 51 51 } 52 52 53 53 //! Constructor 54 inline QwtIntervalSample::QwtIntervalSample( 55 double v, double min, double max ): 56 value( v ), 57 interval( min, max ) 54 inline QwtIntervalSample::QwtIntervalSample( double v, double min, double max ) 55 : value( v ) 56 , interval( min, max ) 58 57 { 59 58 } 60 59 61 60 //! Compare operator 62 inline bool QwtIntervalSample::operator==( 63 const QwtIntervalSample &other ) const 61 inline bool QwtIntervalSample::operator==( const QwtIntervalSample& other ) const 64 62 { 65 63 return value == other.value && interval == other.interval; … … 67 65 68 66 //! Compare operator 69 inline bool QwtIntervalSample::operator!=( 70 const QwtIntervalSample &other ) const 67 inline bool QwtIntervalSample::operator!=( const QwtIntervalSample& other ) const 71 68 { 72 69 return !( *this == other ); … … 76 73 class QWT_EXPORT QwtSetSample 77 74 { 78 public: 75 public: 79 76 QwtSetSample(); 80 QwtSetSample( double, const QVector< double>& = QVector<double>() );81 82 bool operator==( const QwtSetSample &other ) const;83 bool operator!=( const QwtSetSample &other ) const;77 explicit QwtSetSample( double, const QVector< double >& = QVector< double >( ) ); 78 79 bool operator==( const QwtSetSample& other ) const; 80 bool operator!=( const QwtSetSample& other ) const; 84 81 85 82 double added() const; … … 89 86 90 87 //! Vector of values associated to value 91 QVector< double> set;88 QVector< double > set; 92 89 }; 93 90 94 91 /*! 95 Constructor 96 The value is set to 0.0 97 */ 98 inline QwtSetSample::QwtSetSample() :99 value( 0.0 ) 100 { 101 } 102 103 /*! 104 Constructor 105 106 \param v Value 107 \param s Set of values 108 */ 109 inline QwtSetSample::QwtSetSample( double v, const QVector< double > &s ):110 value( v ) ,111 set( s ) 92 Constructor 93 The value is set to 0.0 94 */ 95 inline QwtSetSample::QwtSetSample() 96 : value( 0.0 ) 97 { 98 } 99 100 /*! 101 Constructor 102 103 \param v Value 104 \param s Set of values 105 */ 106 inline QwtSetSample::QwtSetSample( double v, const QVector< double >& s ) 107 : value( v ) 108 , set( s ) 112 109 { 113 110 } 114 111 115 112 //! Compare operator 116 inline bool QwtSetSample::operator==( const QwtSetSample &other ) const113 inline bool QwtSetSample::operator==( const QwtSetSample& other ) const 117 114 { 118 115 return value == other.value && set == other.set; … … 120 117 121 118 //! Compare operator 122 inline bool QwtSetSample::operator!=( const QwtSetSample &other ) const119 inline bool QwtSetSample::operator!=( const QwtSetSample& other ) const 123 120 { 124 121 return !( *this == other ); … … 143 140 144 141 \sa QwtTradingChartData 145 */ 142 */ 146 143 class QWT_EXPORT QwtOHLCSample 147 144 { 148 public: 145 public: 149 146 QwtOHLCSample( double time = 0.0, 150 147 double open = 0.0, double high = 0.0, … … 156 153 157 154 /*! 158 Time of the sample, usually a number representing 159 a specific interval - like a day. 160 */ 155 Time of the sample, usually a number representing 156 a specific interval - like a day. 157 */ 161 158 double time; 162 159 … … 174 171 }; 175 172 176 177 /*! 178 Constructor 179 180 \param t Time value 181 \param o Open value 182 \param h High value 183 \param l Low value 184 \param c Close value 185 */ 186 inline QwtOHLCSample::QwtOHLCSample( double t, 187 double o, double h, double l, double c ): 188 time( t ), 189 open( o ), 190 high( h ), 191 low( l ), 192 close( c ) 193 { 194 } 195 196 /*! 197 \brief Check if a sample is valid 198 199 A sample is valid, when all of the following checks are true: 200 201 - low <= high 202 - low <= open <= high 203 - low <= close <= high 204 205 \return True, when the sample is valid 173 /*! 174 Constructor 175 176 \param t Time value 177 \param o Open value 178 \param h High value 179 \param l Low value 180 \param c Close value 181 */ 182 inline QwtOHLCSample::QwtOHLCSample( 183 double t, double o, double h, double l, double c ) 184 : time( t ) 185 , open( o ) 186 , high( h ) 187 , low( l ) 188 , close( c ) 189 { 190 } 191 192 /*! 193 \brief Check if a sample is valid 194 195 A sample is valid, when all of the following checks are true: 196 197 - low <= high 198 - low <= open <= high 199 - low <= close <= high 200 201 \return True, when the sample is valid 206 202 */ 207 203 inline bool QwtOHLCSample::isValid() const 208 204 { 209 205 return ( low <= high ) 210 && ( open >= low ) 211 && ( open <= high ) 212 && ( close >= low ) 213 && ( close <= high ); 206 && ( open >= low ) 207 && ( open <= high ) 208 && ( close >= low ) 209 && ( close <= high ); 214 210 } 215 211 … … 237 233 } 238 234 235 /*! 236 \brief Sample used in vector fields 237 238 A vector field sample is a position and a vector - usually 239 representing some direction and magnitude - attached to this position. 240 241 \sa QwtVectorFieldData 242 */ 243 class QWT_EXPORT QwtVectorFieldSample 244 { 245 public: 246 QwtVectorFieldSample( double x = 0.0, double y = 0.0, 247 double vx = 0.0, double vy = 0.0 ); 248 249 QwtVectorFieldSample( const QPointF& pos, 250 double vx = 0.0, double vy = 0.0 ); 251 252 QPointF pos() const; 253 254 bool isNull() const; 255 256 //! x coordinate of the position 257 double x; 258 259 //! y coordinate of the position 260 double y; 261 262 //! x coordinate of the vector 263 double vx; 264 265 //! y coordinate of the vector 266 double vy; 267 }; 268 269 /*! 270 \brief Constructor 271 272 \param posX x coordinate of the position 273 \param posY y coordinate of the position 274 \param vectorX x coordinate of the vector 275 \param vectorY y coordinate of the vector 276 */ 277 inline QwtVectorFieldSample::QwtVectorFieldSample( 278 double posX, double posY, double vectorX, double vectorY ) 279 : x( posX ) 280 , y( posY ) 281 , vx( vectorX ) 282 , vy( vectorY ) 283 { 284 } 285 286 /*! 287 \brief Constructor 288 289 \param pos Position 290 \param vectorX x coordinate of the vector 291 \param vectorY y coordinate of the vector 292 */ 293 inline QwtVectorFieldSample::QwtVectorFieldSample( 294 const QPointF& pos, double vectorX, double vectorY ) 295 : x( pos.x() ) 296 , y( pos.y() ) 297 , vx( vectorX ) 298 , vy( vectorY ) 299 { 300 } 301 302 //! \return x/y coordinates as QPointF 303 inline QPointF QwtVectorFieldSample::pos() const 304 { 305 return QPointF( x, y ); 306 } 307 308 //! \return true, if vx and vy are 0 309 inline bool QwtVectorFieldSample::isNull() const 310 { 311 return ( vx == 0.0 ) && ( vy == 0.0 ); 312 } 313 239 314 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
