1 | #ifndef __qwt3d_autoscaler_2003_08_18_12_05__
|
---|
2 | #define __qwt3d_autoscaler_2003_08_18_12_05__
|
---|
3 |
|
---|
4 | #include <vector>
|
---|
5 | #include "qwt3d_global.h"
|
---|
6 | #include "qwt3d_autoptr.h"
|
---|
7 |
|
---|
8 | namespace Qwt3D
|
---|
9 | {
|
---|
10 |
|
---|
11 | //! ABC for autoscaler
|
---|
12 | class QWT3D_EXPORT AutoScaler
|
---|
13 | {
|
---|
14 | friend class qwt3d_ptr<AutoScaler>;
|
---|
15 | protected:
|
---|
16 | //! Returns a new heap based object of the derived class.
|
---|
17 | virtual AutoScaler* clone() const = 0;
|
---|
18 | //! To implement from subclasses
|
---|
19 | virtual int execute(double& a, double& b, double start, double stop, int ivals) = 0;
|
---|
20 | virtual ~AutoScaler(){}
|
---|
21 |
|
---|
22 | private:
|
---|
23 | void destroy() const {delete this;} //!< Used by qwt3d_ptr
|
---|
24 | };
|
---|
25 |
|
---|
26 | //! Automatic beautifying of linear scales
|
---|
27 | class QWT3D_EXPORT LinearAutoScaler : public AutoScaler
|
---|
28 | {
|
---|
29 | friend class LinearScale;
|
---|
30 | protected:
|
---|
31 | LinearAutoScaler();
|
---|
32 | explicit LinearAutoScaler(std::vector<double>& mantisses);
|
---|
33 | //! Returns a new heap based object utilized from qwt3d_ptr
|
---|
34 | AutoScaler* clone() const {return new LinearAutoScaler(*this);}
|
---|
35 | int execute(double& a, double& b, double start, double stop, int ivals);
|
---|
36 |
|
---|
37 | private:
|
---|
38 |
|
---|
39 | double start_, stop_;
|
---|
40 | int intervals_;
|
---|
41 |
|
---|
42 | void init(double start, double stop, int ivals);
|
---|
43 | double anchorvalue(double start, double mantisse, int exponent);
|
---|
44 | int segments(int& l_intervals, int& r_intervals, double start, double stop, double anchor, double mantissa, int exponent);
|
---|
45 | std::vector<double> mantissi_;
|
---|
46 | };
|
---|
47 |
|
---|
48 | } // ns
|
---|
49 |
|
---|
50 |
|
---|
51 | #endif
|
---|