00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef SCALE_ENGINE_H
00030 #define SCALE_ENGINE_H
00031
00032 #include <qwt_scale_engine.h>
00033 #include <qwt_scale_map.h>
00034 #include <float.h>
00035
00036 class ScaleEngine: public QwtScaleEngine
00037 {
00038 public:
00039 ScaleEngine(QwtScaleTransformation::Type type = QwtScaleTransformation::Linear,
00040 double left_break = -DBL_MAX, double right_break = DBL_MAX);
00041 QwtScaleTransformation* transformation() const;
00042 virtual QwtScaleDiv divideScale(double x1, double x2, int maxMajSteps,
00043 int maxMinSteps, double stepSize = 0.0) const;
00044 virtual void autoScale (int maxNumSteps, double &x1, double &x2, double &stepSize) const;
00045
00046 double axisBreakLeft() const;
00047 double axisBreakRight() const;
00048 void setBreakRegion(double from, double to){d_break_left = from; d_break_right = to;};
00049
00050 int breakWidth() const;
00051 void setBreakWidth(int width){d_break_width = width;};
00052
00053 int breakPosition() const;
00054 void setBreakPosition(int pos){d_break_pos = pos;};
00055
00056 double stepBeforeBreak() const;
00057 void setStepBeforeBreak(double step){d_step_before = step;};
00058
00059 double stepAfterBreak() const;
00060 void setStepAfterBreak(double step){d_step_after = step;};
00061
00062 int minTicksBeforeBreak() const;
00063 void setMinTicksBeforeBreak(int ticks){d_minor_ticks_before = ticks;};
00064
00065 int minTicksAfterBreak() const;
00066 void setMinTicksAfterBreak(int ticks){d_minor_ticks_after = ticks;};
00067
00068 bool log10ScaleAfterBreak() const;
00069 void setLog10ScaleAfterBreak(bool on){d_log10_scale_after = on;};
00070
00071 QwtScaleTransformation::Type type() const;
00072 void setType(QwtScaleTransformation::Type type){d_type = type;};
00073
00074 bool hasBreak() const;
00075 void clone(const ScaleEngine *engine);
00076
00077 bool hasBreakDecoration() const;
00078 void drawBreakDecoration(bool draw){d_break_decoration = draw;};
00079
00080 private:
00081 QwtScaleTransformation::Type d_type;
00082 double d_break_left, d_break_right;
00084 int d_break_pos;
00086 double d_step_before, d_step_after;
00088 int d_minor_ticks_before, d_minor_ticks_after;
00090 bool d_log10_scale_after;
00092 int d_break_width;
00094 bool d_break_decoration;
00095 };
00096
00097 class ScaleTransformation: public QwtScaleTransformation
00098 {
00099 public:
00100 ScaleTransformation(const ScaleEngine *engine):QwtScaleTransformation(Other), d_engine(engine){};
00101 virtual double xForm(double x, double, double, double p1, double p2) const;
00102 virtual double invXForm(double x, double s1, double s2, double p1, double p2) const;
00103 QwtScaleTransformation* copy() const;
00104
00105 private:
00107 const ScaleEngine* d_engine;
00108 };
00109
00110 #endif