summaryrefslogtreecommitdiffstats
path: root/lib/tqwtplot3d/include/qwt3d_autoscaler.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tqwtplot3d/include/qwt3d_autoscaler.h')
-rw-r--r--lib/tqwtplot3d/include/qwt3d_autoscaler.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/lib/tqwtplot3d/include/qwt3d_autoscaler.h b/lib/tqwtplot3d/include/qwt3d_autoscaler.h
new file mode 100644
index 0000000..31c7497
--- /dev/null
+++ b/lib/tqwtplot3d/include/qwt3d_autoscaler.h
@@ -0,0 +1,51 @@
+#ifndef __qwt3d_autoscaler_2003_08_18_12_05__
+#define __qwt3d_autoscaler_2003_08_18_12_05__
+
+#include <vector>
+#include "qwt3d_global.h"
+#include "qwt3d_autoptr.h"
+
+namespace Qwt3D
+{
+
+//! ABC for autoscaler
+class QWT3D_EXPORT AutoScaler
+{
+friend class qwt3d_ptr<AutoScaler>;
+protected:
+ //! Returns a new heap based object of the derived class.
+ virtual AutoScaler* clone() const = 0;
+ //! To implement from subclasses
+ virtual int execute(double& a, double& b, double start, double stop, int ivals) = 0;
+ virtual ~AutoScaler(){}
+
+private:
+ void destroy() const {delete this;} //!< Used by qwt3d_ptr
+};
+
+//! Automatic beautifying of linear scales
+class QWT3D_EXPORT LinearAutoScaler : public AutoScaler
+{
+friend class LinearScale;
+protected:
+ LinearAutoScaler();
+ explicit LinearAutoScaler(std::vector<double>& mantisses);
+ //! Returns a new heap based object utilized from qwt3d_ptr
+ AutoScaler* clone() const {return new LinearAutoScaler(*this);}
+ int execute(double& a, double& b, double start, double stop, int ivals);
+
+private:
+
+ double start_, stop_;
+ int intervals_;
+
+ void init(double start, double stop, int ivals);
+ double anchorvalue(double start, double mantisse, int exponent);
+ int segments(int& l_intervals, int& r_intervals, double start, double stop, double anchor, double mantissa, int exponent);
+ std::vector<double> mantissi_;
+};
+
+} // ns
+
+
+#endif