QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_scale_div.h
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 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_SCALE_DIV_H
28#define QWT_SCALE_DIV_H
29
30#include "qwtcore_global.h"
31#include <qlist.h>
32
33class QwtInterval;
34
46class QWTCORE_EXPORT QwtScaleDiv
47{
48public:
51 {
53 NoTick = -1,
54
57
60
63
65 NTickTypes
66 };
67
68 // Constructor with lower and upper bounds
69 explicit QwtScaleDiv(double lowerBound = 0.0, double upperBound = 0.0);
70
71 // Constructor with interval and ticks array
72 explicit QwtScaleDiv(const QwtInterval&, QList< double >[ NTickTypes ]);
73
74 // Constructor with bounds and ticks array
75 explicit QwtScaleDiv(double lowerBound, double upperBound, QList< double >[ NTickTypes ]);
76
77 // Constructor with bounds and separate tick lists
78 explicit QwtScaleDiv(double lowerBound,
79 double upperBound,
80 const QList< double >& minorTicks,
81 const QList< double >& mediumTicks,
82 const QList< double >& majorTicks);
83
84 // Copy constructor
86 // Move constructor
87 QwtScaleDiv(QwtScaleDiv&&) noexcept = default;
88 // Copy assignment
89 QwtScaleDiv& operator=(const QwtScaleDiv&);
90 // Move assignment
91 QwtScaleDiv& operator=(QwtScaleDiv&&) noexcept = default;
92
93 // Equality operator
94 bool operator==(const QwtScaleDiv&) const;
95 // Inequality operator
96 bool operator!=(const QwtScaleDiv&) const;
97 // Fuzzy comparison
98 bool fuzzyCompare(const QwtScaleDiv& other) const;
99
100 // Set the interval
101 void setInterval(double lowerBound, double upperBound);
102 // Set the interval from QwtInterval
103 void setInterval(const QwtInterval&);
104 // Get the interval
105 QwtInterval interval() const;
106
107 // Set the lower bound
108 void setLowerBound(double) noexcept;
109 // Get the lower bound
110 double lowerBound() const noexcept;
111
112 // Set the upper bound
113 void setUpperBound(double) noexcept;
114 // Get the upper bound
115 double upperBound() const noexcept;
116
117 // Get the range (upper - lower)
118 double range() const noexcept;
119
120 // Check if value is within bounds
121 bool contains(double value) const;
122
123 // Set ticks for a specific tick type
124 void setTicks(int tickType, const QList< double >&);
125 // Get ticks for a specific tick type
126 QList< double > ticks(int tickType) const;
127
128 // Check if scale division is empty
129 bool isEmpty() const;
130 // Check if scale is increasing
131 bool isIncreasing() const;
132
133 // Invert the scale division
134 void invert();
135 // Get inverted scale division
136 QwtScaleDiv inverted() const;
137
138 // Get bounded scale division
139 QwtScaleDiv bounded(double lowerBound, double upperBound) const;
140
141private:
142 double m_lowerBound { 0.0 };
143 double m_upperBound { 0.0 };
144 QList< double > m_ticks[ NTickTypes ];
145};
146
147Q_DECLARE_TYPEINFO(QwtScaleDiv, Q_MOVABLE_TYPE);
148
149#ifndef QT_NO_DEBUG_STREAM
150QWTCORE_EXPORT QDebug operator<<(QDebug, const QwtScaleDiv&);
151#endif
152
153#endif
A class representing an interval
Definition qwt_interval.h:39
A class representing a scale division
Definition qwt_scale_div.h:47
QwtScaleDiv(const QwtScaleDiv &)
Copy constructor
TickType
Scale tick types
Definition qwt_scale_div.h:51
@ MediumTick
Medium ticks
Definition qwt_scale_div.h:59
@ MinorTick
Minor ticks
Definition qwt_scale_div.h:56
@ MajorTick
Major ticks
Definition qwt_scale_div.h:62