qwt_scale_engine.h
Go to the documentation of this file.
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2  * Qwt Widget Library
3  * Copyright (C) 1997 Josef Wilgen
4  * Copyright (C) 2002 Uwe Rathmann
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the Qwt License, Version 1.0
8  *****************************************************************************/
9 
10 #ifndef QWT_SCALE_ENGINE_H
11 #define QWT_SCALE_ENGINE_H
12 
13 #include "qwt_global.h"
14 #include "qwt_scale_div.h"
15 #include "qwt_interval.h"
16 
17 class QwtTransform;
18 
23 {
24 public:
25  static double ceilEps( double value, double intervalSize );
26  static double floorEps( double value, double intervalSize );
27 
28  static double divideEps( double interval, double steps );
29 
30  static double divideInterval( double interval,
31  int numSteps, uint base );
32 };
33 
46 {
47 public:
54  enum Attribute
55  {
57  NoAttribute = 0x00,
58 
60  IncludeReference = 0x01,
61 
63  Symmetric = 0x02,
64 
72  Floating = 0x04,
73 
75  Inverted = 0x08
76  };
77 
79  typedef QFlags<Attribute> Attributes;
80 
81  explicit QwtScaleEngine( uint base = 10 );
82  virtual ~QwtScaleEngine();
83 
84  void setBase( uint base );
85  uint base() const;
86 
87  void setAttribute( Attribute, bool on = true );
88  bool testAttribute( Attribute ) const;
89 
90  void setAttributes( Attributes );
91  Attributes attributes() const;
92 
93  void setReference( double reference );
94  double reference() const;
95 
96  void setMargins( double lower, double upper );
97  double lowerMargin() const;
98  double upperMargin() const;
99 
108  virtual void autoScale( int maxNumSteps,
109  double &x1, double &x2, double &stepSize ) const = 0;
110 
123  virtual QwtScaleDiv divideScale( double x1, double x2,
124  int maxMajorSteps, int maxMinorSteps,
125  double stepSize = 0.0 ) const = 0;
126 
127  void setTransformation( QwtTransform * );
128  QwtTransform *transformation() const;
129 
130 protected:
131  bool contains( const QwtInterval &, double val ) const;
132  QList<double> strip( const QList<double>&, const QwtInterval & ) const;
133 
134  double divideInterval( double interval, int numSteps ) const;
135 
136  QwtInterval buildInterval( double v ) const;
137 
138 private:
139  Q_DISABLE_COPY(QwtScaleEngine)
140 
141  class PrivateData;
142  PrivateData *d_data;
143 };
144 
153 {
154 public:
155  explicit QwtLinearScaleEngine( uint base = 10 );
156  virtual ~QwtLinearScaleEngine();
157 
158  virtual void autoScale( int maxSteps,
159  double &x1, double &x2, double &stepSize ) const;
160 
161  virtual QwtScaleDiv divideScale( double x1, double x2,
162  int numMajorSteps, int numMinorSteps,
163  double stepSize = 0.0 ) const;
164 
165 
166 protected:
167  QwtInterval align( const QwtInterval&, double stepSize ) const;
168 
169  void buildTicks(
170  const QwtInterval &, double stepSize, int maxMinSteps,
171  QList<double> ticks[QwtScaleDiv::NTickTypes] ) const;
172 
173  QList<double> buildMajorTicks(
174  const QwtInterval &interval, double stepSize ) const;
175 
176  void buildMinorTicks( const QList<double>& majorTicks,
177  int maxMinorSteps, double stepSize,
178  QList<double> &minorTicks, QList<double> &mediumTicks ) const;
179 };
180 
193 {
194 public:
195  explicit QwtLogScaleEngine( uint base = 10 );
196  virtual ~QwtLogScaleEngine();
197 
198  virtual void autoScale( int maxSteps,
199  double &x1, double &x2, double &stepSize ) const;
200 
201  virtual QwtScaleDiv divideScale( double x1, double x2,
202  int numMajorSteps, int numMinorSteps,
203  double stepSize = 0.0 ) const;
204 
205 protected:
206  QwtInterval align( const QwtInterval&, double stepSize ) const;
207 
208  void buildTicks(
209  const QwtInterval &, double stepSize, int maxMinSteps,
210  QList<double> ticks[QwtScaleDiv::NTickTypes] ) const;
211 
212  QList<double> buildMajorTicks(
213  const QwtInterval &interval, double stepSize ) const;
214 
215  void buildMinorTicks( const QList<double>& majorTicks,
216  int maxMinorSteps, double stepSize,
217  QList<double> &minorTicks, QList<double> &mediumTicks ) const;
218 };
219 
220 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtScaleEngine::Attributes )
221 
222 #endif
A scale engine for logarithmic scales.
A class representing an interval.
Definition: qwt_interval.h:26
#define QWT_EXPORT
Definition: qwt_global.h:38
Arithmetic including a tolerance.
A class representing a scale division.
Definition: qwt_scale_div.h:36
CONSTEXPR_F fields align(second_tag, fields f) noexcept
T value
A transformation between coordinate systems.
Definition: qwt_transform.h:35
Number of valid tick types.
Definition: qwt_scale_div.h:55
QFlags< Attribute > Attributes
Layout attributes.
virtual void autoScale(int maxNumSteps, double &x1, double &x2, double &stepSize) const =0
A scale engine for linear scales.
virtual QwtScaleDiv divideScale(double x1, double x2, int maxMajorSteps, int maxMinorSteps, double stepSize=0.0) const =0
Calculate a scale division.
Base class for scale engines.


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:17