qwt_scale_engine.h
Go to the documentation of this file.
1 /******************************************************************************
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 
16 class QwtInterval;
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 intervalSize, double numSteps );
29 
30  static double divideInterval( double intervalSize,
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 
78  Q_DECLARE_FLAGS( Attributes, Attribute )
79 
80  explicit QwtScaleEngine( uint base = 10 );
81  virtual ~QwtScaleEngine();
82 
83  void setBase( uint base );
84  uint base() const;
85 
86  void setAttribute( Attribute, bool on = true );
87  bool testAttribute( Attribute ) const;
88 
89  void setAttributes( Attributes );
90  Attributes attributes() const;
91 
92  void setReference( double );
93  double reference() const;
94 
95  void setMargins( double lower, double upper );
96  double lowerMargin() const;
97  double upperMargin() const;
98 
107  virtual void autoScale( int maxNumSteps,
108  double& x1, double& x2, double& stepSize ) const = 0;
109 
122  virtual QwtScaleDiv divideScale( double x1, double x2,
123  int maxMajorSteps, int maxMinorSteps,
124  double stepSize = 0.0 ) const = 0;
125 
126  void setTransformation( QwtTransform* );
127  QwtTransform* transformation() const;
128 
129  protected:
130  bool contains( const QwtInterval&, double value ) const;
131  QList< double > strip( const QList< double >&, const QwtInterval& ) const;
132 
133  double divideInterval( double intervalSize, int numSteps ) const;
134 
135  QwtInterval buildInterval( double value ) const;
136 
137  private:
138  Q_DISABLE_COPY(QwtScaleEngine)
139 
140  class PrivateData;
141  PrivateData* m_data;
142 };
143 
152 {
153  public:
154  explicit QwtLinearScaleEngine( uint base = 10 );
155  virtual ~QwtLinearScaleEngine();
156 
157  virtual void autoScale( int maxNumSteps,
158  double& x1, double& x2, double& stepSize ) const QWT_OVERRIDE;
159 
160  virtual QwtScaleDiv divideScale( double x1, double x2,
161  int maxMajorSteps, int maxMinorSteps,
162  double stepSize = 0.0 ) const QWT_OVERRIDE;
163 
164 
165  protected:
166  QwtInterval align( const QwtInterval&, double stepSize ) const;
167 
168  void buildTicks(
169  const QwtInterval&, double stepSize, int maxMinorSteps,
171 
172  QList< double > buildMajorTicks(
173  const QwtInterval& interval, double stepSize ) const;
174 
175  void buildMinorTicks( const QList< double >& majorTicks,
176  int maxMinorSteps, double stepSize,
177  QList< double >& minorTicks, QList< double >& mediumTicks ) const;
178 };
179 
192 {
193  public:
194  explicit QwtLogScaleEngine( uint base = 10 );
195  virtual ~QwtLogScaleEngine();
196 
197  virtual void autoScale( int maxNumSteps,
198  double& x1, double& x2, double& stepSize ) const QWT_OVERRIDE;
199 
200  virtual QwtScaleDiv divideScale( double x1, double x2,
201  int maxMajorSteps, int maxMinorSteps,
202  double stepSize = 0.0 ) const QWT_OVERRIDE;
203 
204  protected:
205  QwtInterval align( const QwtInterval&, double stepSize ) const;
206 
207  void buildTicks(
208  const QwtInterval&, double stepSize, int maxMinorSteps,
210 
211  QList< double > buildMajorTicks(
212  const QwtInterval& interval, double stepSize ) const;
213 
214  void buildMinorTicks( const QList< double >& majorTicks,
215  int maxMinorSteps, double stepSize,
216  QList< double >& minorTicks, QList< double >& mediumTicks ) const;
217 };
218 
219 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtScaleEngine::Attributes )
220 
221 #endif
QwtScaleEngine::PrivateData
Definition: qwt_scale_engine.cpp:186
sol::reference
basic_reference< false > reference
Definition: forward.hpp:1100
qwt_scale_div.h
QwtLogScaleEngine
A scale engine for logarithmic scales.
Definition: qwt_scale_engine.h:191
QwtTransform
A transformation between coordinate systems.
Definition: qwt_transform.h:35
QwtScaleEngine::Attribute
Attribute
Definition: qwt_scale_engine.h:54
qwt_global.h
QwtLinearScaleEngine
A scale engine for linear scales.
Definition: qwt_scale_engine.h:151
QList< double >
QwtInterval
A class representing an interval.
Definition: qwt_interval.h:22
QwtScaleDiv::NTickTypes
@ NTickTypes
Number of valid tick types.
Definition: qwt_scale_div.h:52
QwtScaleEngine::divideScale
virtual QwtScaleDiv divideScale(double x1, double x2, int maxMajorSteps, int maxMinorSteps, double stepSize=0.0) const =0
Calculate a scale division.
QwtScaleEngine::autoScale
virtual void autoScale(int maxNumSteps, double &x1, double &x2, double &stepSize) const =0
QwtScaleEngine
Base class for scale engines.
Definition: qwt_scale_engine.h:45
sol::detail::align
constexpr std::uintptr_t align(std::size_t alignment, std::uintptr_t ptr, std::size_t &space)
Definition: sol.hpp:10963
PJ::Attributes
std::unordered_map< PlotAttribute, QVariant > Attributes
Definition: plotdatabase.h:58
QwtScaleArithmetic
Arithmetic including a tolerance.
Definition: qwt_scale_engine.h:22
QWT_OVERRIDE
#define QWT_OVERRIDE
Definition: qwt_global.h:53
QWT_EXPORT
#define QWT_EXPORT
Definition: qwt_global.h:38
QwtScaleDiv
A class representing a scale division.
Definition: qwt_scale_div.h:33


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:46