Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_scale_engine.h
- Timestamp:
- Nov 3, 2026, 10:53:35 AM (3 weeks ago)
- File:
-
- 1 edited
-
trunk/BNC/qwt/qwt_scale_engine.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_scale_engine.h
r9383 r11158 1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*-*****************************1 /****************************************************************************** 2 2 * Qwt Widget Library 3 3 * Copyright (C) 1997 Josef Wilgen … … 13 13 #include "qwt_global.h" 14 14 #include "qwt_scale_div.h" 15 #include "qwt_interval.h" 16 15 16 class QwtInterval; 17 17 class QwtTransform; 18 18 19 19 /*! 20 \brief Arithmetic including a tolerance 21 */ 20 \brief Arithmetic including a tolerance 21 */ 22 22 class QWT_EXPORT QwtScaleArithmetic 23 23 { 24 public: 24 public: 25 25 static double ceilEps( double value, double intervalSize ); 26 26 static double floorEps( double value, double intervalSize ); … … 33 33 34 34 /*! 35 \brief Base class for scale engines. 36 37 A scale engine tries to find "reasonable" ranges and step sizes 38 for scales. 39 40 The layout of the scale can be varied with setAttribute(). 41 42 Qwt offers implementations for logarithmic and linear scales. 43 */ 35 \brief Base class for scale engines. 36 37 A scale engine tries to find "reasonable" ranges and step sizes 38 for scales. 39 40 The layout of the scale can be varied with setAttribute(). 41 42 Qwt offers implementations for logarithmic and linear scales. 43 */ 44 44 45 45 class QWT_EXPORT QwtScaleEngine 46 46 { 47 public: 47 public: 48 48 /*! 49 49 Layout attributes … … 76 76 }; 77 77 78 //! Layout attributes 79 typedef QFlags<Attribute> Attributes; 78 Q_DECLARE_FLAGS( Attributes, Attribute ) 80 79 81 80 explicit QwtScaleEngine( uint base = 10 ); … … 99 98 100 99 /*! 101 Align and divide an interval 102 103 \param maxNumSteps Max. number of steps 104 \param x1 First limit of the interval (In/Out) 105 \param x2 Second limit of the interval (In/Out) 106 \param stepSize Step size (Return value) 107 */ 100 Align and divide an interval 101 102 \param maxNumSteps Max. number of steps 103 \param x1 First limit of the interval (In/Out) 104 \param x2 Second limit of the interval (In/Out) 105 \param stepSize Step size (Return value) 106 */ 108 107 virtual void autoScale( int maxNumSteps, 109 double &x1, double&x2, double&stepSize ) const = 0;108 double& x1, double& x2, double& stepSize ) const = 0; 110 109 111 110 /*! 112 \brief Calculate a scale division 113 114 \param x1 First interval limit 115 \param x2 Second interval limit 116 \param maxMajorSteps Maximum for the number of major steps 117 \param maxMinorSteps Maximum number of minor steps 118 \param stepSize Step size. If stepSize == 0.0, the scaleEngine 111 \brief Calculate a scale division 112 113 \param x1 First interval limit 114 \param x2 Second interval limit 115 \param maxMajorSteps Maximum for the number of major steps 116 \param maxMinorSteps Maximum number of minor steps 117 \param stepSize Step size. If stepSize == 0.0, the scaleEngine 119 118 calculates one. 120 119 121 \return Calculated scale division 122 */ 120 \return Calculated scale division 121 */ 123 122 virtual QwtScaleDiv divideScale( double x1, double x2, 124 123 int maxMajorSteps, int maxMinorSteps, 125 124 double stepSize = 0.0 ) const = 0; 126 125 127 void setTransformation( QwtTransform * );128 QwtTransform *transformation() const;129 130 protected: 131 bool contains( const QwtInterval &, double value ) const;132 QList< double> strip( const QList<double>&, const QwtInterval& ) const;126 void setTransformation( QwtTransform* ); 127 QwtTransform* transformation() const; 128 129 protected: 130 bool contains( const QwtInterval&, double value ) const; 131 QList< double > strip( const QList< double >&, const QwtInterval& ) const; 133 132 134 133 double divideInterval( double intervalSize, int numSteps ) const; … … 136 135 QwtInterval buildInterval( double value ) const; 137 136 138 private: 137 private: 138 Q_DISABLE_COPY(QwtScaleEngine) 139 139 140 class PrivateData; 140 PrivateData *d_data;141 }; 142 143 /*! 144 \brief A scale engine for linear scales 145 146 The step size will fit into the pattern 147 \f$\left\{ 1,2,5\right\} \cdot 10^{n}\f$, where n is an integer. 148 */ 149 150 class QWT_EXPORT QwtLinearScaleEngine: public QwtScaleEngine 151 { 152 public: 153 QwtLinearScaleEngine( uint base = 10 ); 141 PrivateData* m_data; 142 }; 143 144 /*! 145 \brief A scale engine for linear scales 146 147 The step size will fit into the pattern 148 \f$\left\{ 1,2,5\right\} \cdot 10^{n}\f$, where n is an integer. 149 */ 150 151 class QWT_EXPORT QwtLinearScaleEngine : public QwtScaleEngine 152 { 153 public: 154 explicit QwtLinearScaleEngine( uint base = 10 ); 154 155 virtual ~QwtLinearScaleEngine(); 155 156 156 157 virtual void autoScale( int maxNumSteps, 157 double &x1, double&x2, double&stepSize ) const;158 double& x1, double& x2, double& stepSize ) const QWT_OVERRIDE; 158 159 159 160 virtual QwtScaleDiv divideScale( double x1, double x2, 160 161 int maxMajorSteps, int maxMinorSteps, 161 double stepSize = 0.0 ) const; 162 163 164 protected: 162 double stepSize = 0.0 ) const QWT_OVERRIDE; 163 164 165 protected: 165 166 QwtInterval align( const QwtInterval&, double stepSize ) const; 166 167 167 168 void buildTicks( 168 const QwtInterval &, double stepSize, int maxMinorSteps,169 QList< double> ticks[QwtScaleDiv::NTickTypes] ) const;170 171 QList< double> buildMajorTicks(172 const QwtInterval &interval, double stepSize ) const;173 174 void buildMinorTicks( const QList< double>& majorTicks,169 const QwtInterval&, double stepSize, int maxMinorSteps, 170 QList< double > ticks[QwtScaleDiv::NTickTypes] ) const; 171 172 QList< double > buildMajorTicks( 173 const QwtInterval& interval, double stepSize ) const; 174 175 void buildMinorTicks( const QList< double >& majorTicks, 175 176 int maxMinorSteps, double stepSize, 176 QList< double> &minorTicks, QList<double> &mediumTicks ) const;177 }; 178 179 /*! 180 \brief A scale engine for logarithmic scales 181 182 The step size is measured in *decades* 183 and the major step size will be adjusted to fit the pattern 184 \f$\left\{ 1,2,3,5\right\} \cdot 10^{n}\f$, where n is a natural number 185 including zero. 186 187 \warning the step size as well as the margins are measured in *decades*. 188 */ 189 190 class QWT_EXPORT QwtLogScaleEngine: public QwtScaleEngine 191 { 192 public: 193 QwtLogScaleEngine( uint base = 10 ); 177 QList< double >& minorTicks, QList< double >& mediumTicks ) const; 178 }; 179 180 /*! 181 \brief A scale engine for logarithmic scales 182 183 The step size is measured in *decades* 184 and the major step size will be adjusted to fit the pattern 185 \f$\left\{ 1,2,3,5\right\} \cdot 10^{n}\f$, where n is a natural number 186 including zero. 187 188 \warning the step size as well as the margins are measured in *decades*. 189 */ 190 191 class QWT_EXPORT QwtLogScaleEngine : public QwtScaleEngine 192 { 193 public: 194 explicit QwtLogScaleEngine( uint base = 10 ); 194 195 virtual ~QwtLogScaleEngine(); 195 196 196 197 virtual void autoScale( int maxNumSteps, 197 double &x1, double&x2, double&stepSize ) const;198 double& x1, double& x2, double& stepSize ) const QWT_OVERRIDE; 198 199 199 200 virtual QwtScaleDiv divideScale( double x1, double x2, 200 201 int maxMajorSteps, int maxMinorSteps, 201 double stepSize = 0.0 ) const; 202 203 protected: 202 double stepSize = 0.0 ) const QWT_OVERRIDE; 203 204 protected: 204 205 QwtInterval align( const QwtInterval&, double stepSize ) const; 205 206 206 207 void buildTicks( 207 const QwtInterval &, double stepSize, int maxMinorSteps,208 QList< double> ticks[QwtScaleDiv::NTickTypes] ) const;209 210 QList< double> buildMajorTicks(211 const QwtInterval &interval, double stepSize ) const;212 213 void buildMinorTicks( const QList< double>& majorTicks,208 const QwtInterval&, double stepSize, int maxMinorSteps, 209 QList< double > ticks[QwtScaleDiv::NTickTypes] ) const; 210 211 QList< double > buildMajorTicks( 212 const QwtInterval& interval, double stepSize ) const; 213 214 void buildMinorTicks( const QList< double >& majorTicks, 214 215 int maxMinorSteps, double stepSize, 215 QList< double> &minorTicks, QList<double> &mediumTicks ) const;216 QList< double >& minorTicks, QList< double >& mediumTicks ) const; 216 217 }; 217 218
Note:
See TracChangeset
for help on using the changeset viewer.
