source: pacpusframework/branches/2.0-beta1/include/extlib/qwtplot3d/qwt3d_scale.h@ 89

Last change on this file since 89 was 89, checked in by morasjul, 11 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 2.8 KB
Line 
1#ifndef qwt3d_scale_h__2004_06_02_22_02_begin_guarded_code
2#define qwt3d_scale_h__2004_06_02_22_02_begin_guarded_code
3
4#include <qstring.h>
5#include "qwt3d_types.h"
6#include "qwt3d_autoscaler.h"
7#include "qwt3d_autoptr.h"
8
9namespace Qwt3D
10{
11
12/*!
13The class encapsulates non-visual scales.
14She is utilized by Axis and also collaborates closely with AutoScaler.
15A Scale allows control over all aspects of tic generation including
16arbitrary transformations of tic values into corresponding strings.
17The strings contain what eventually will be shown as tic labels.\n
18Standard linear and logarithmic scales have been integrated yet into the Axis
19interface. User-defined axes can be derived from Scale, LinearScale et al.
20*/
21class QWT3D_EXPORT Scale
22{
23 friend class Axis;
24 friend class qwt3d_ptr<Scale>;
25
26 protected:
27 Scale();
28 virtual ~Scale(){}
29 virtual QString ticLabel(unsigned int idx) const;
30
31 virtual void setLimits(double start, double stop);
32 virtual void setMajors(int val) {majorintervals_p=val;} //!< Sets number of major intervals
33 virtual void setMinors(int val) {minorintervals_p=val;} //!< Sets number of minor intervals per major interval
34 virtual void setMajorLimits(double start, double stop);
35
36 int majors() const {return majorintervals_p;} //!< Returns major intervals
37 int minors() const {return minorintervals_p;} //!< Returns minor intervals
38
39 //! Derived classes should return a new heap based object here.
40 virtual Scale* clone() const = 0;
41 //! This function should setup the 2 vectors for major and minor positions;
42 virtual void calculate() = 0;
43 virtual int autoscale(double& a, double& b, double start, double stop, int ivals);
44
45 std::vector<double> majors_p, minors_p;
46 double start_p, stop_p;
47 int majorintervals_p, minorintervals_p;
48 double mstart_p, mstop_p;
49
50 private:
51 void destroy() const {delete this;} //!< Used by qwt3d_ptr
52};
53
54//! The standard (1:1) mapping class for axis numbering
55class QWT3D_EXPORT LinearScale : public Scale
56{
57 friend class Axis;
58 friend class qwt3d_ptr<Scale>;
59protected:
60 int autoscale(double& a, double& b, double start, double stop, int ivals);
61 //! Returns a new heap based object utilized from qwt3d_ptr
62 Scale* clone() const {return new LinearScale(*this);}
63 void calculate();
64 LinearAutoScaler autoscaler_p;
65};
66
67//! log10 scale
68class QWT3D_EXPORT LogScale : public Scale
69{
70 friend class Axis;
71 friend class qwt3d_ptr<Scale>;
72protected:
73 QString ticLabel(unsigned int idx) const;
74 void setMinors(int val);
75 //! Standard ctor
76 LogScale();
77 //! Returns a new heap based object utilized from qwt3d_ptr
78 Scale* clone() const {return new LogScale;}
79 void calculate();
80private:
81 void setupCounter(double& k, int& step);
82};
83
84} // namespace Qwt3D
85
86
87#endif /* include guarded */
Note: See TracBrowser for help on using the repository browser.