QtiPlot  0.9.8.2
ReciprocalScaleEngine.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : ReciprocalScaleEngine.h
3  Project : QtiPlot
4  --------------------------------------------------------------------
5  Copyright : (C) 2009 by Ion Vasilief
6  Email (use @ for *) : ion_vasilief*yahoo.fr
7  Description : Return a transformation for reciprocal (1/t) scales
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 
30 #ifndef RECIPROCAL_SCALE_ENGINE_H
31 #define RECIPROCAL_SCALE_ENGINE_H
32 
33 #include <qwt_scale_engine.h>
34 #include <qwt_scale_map.h>
35 #include <ScaleEngine.h>
36 
38 {
39 public:
41  virtual double xForm(double x, double, double, double p1, double p2) const;
42  virtual double invXForm(double x, double s1, double s2, double p1, double p2) const;
43  QwtScaleTransformation* copy() const;
44 };
45 
50 class ReciprocalScaleEngine: public QwtScaleEngine
51 {
52 public:
53  virtual void autoScale(int maxSteps,
54  double &x1, double &x2, double &stepSize) const;
55 
56  virtual QwtScaleDiv divideScale(double x1, double x2,
57  int numMajorSteps, int numMinorSteps,
58  double stepSize = 0.0) const;
59 
60  virtual QwtScaleTransformation *transformation() const;
61 
62 protected:
63  QwtDoubleInterval align(const QwtDoubleInterval&,
64  double stepSize) const;
65 
66 private:
67  void buildTicks(
68  const QwtDoubleInterval &, double stepSize, int maxMinSteps,
69  QwtValueList ticks[QwtScaleDiv::NTickTypes]) const;
70 
71  void buildMinorTicks(
72  const QwtValueList& majorTicks,
73  int maxMinMark, double step,
74  QwtValueList &, QwtValueList &) const;
75 
76  QwtValueList buildMajorTicks(
77  const QwtDoubleInterval &interval, double stepSize) const;
78 };
79 
80 #endif
A scale engine for reciprocal (1/t) scales.
Definition: ReciprocalScaleEngine.h:50
Definition: ReciprocalScaleEngine.h:37
virtual double invXForm(double x, double s1, double s2, double p1, double p2) const
Definition: ReciprocalScaleEngine.cpp:253
ReciprocalScaleTransformation(const ScaleEngine *engine)
Definition: ReciprocalScaleEngine.h:40
Definition: ScaleEngine.h:38
QwtScaleTransformation * copy() const
Create a clone of the transformation.
Definition: ReciprocalScaleEngine.cpp:242
Definition: ScaleEngine.h:54
virtual double xForm(double x, double, double, double p1, double p2) const
Definition: ReciprocalScaleEngine.cpp:247