##// END OF EJS Templates
Added domain->type() implementation for log domains
Marek Rosa -
r2286:3e8125190339
parent child
Show More
@@ -1,113 +1,113
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 // W A R N I N G
22 22 // -------------
23 23 //
24 24 // This file is not part of the QtCommercial Chart API. It exists purely as an
25 25 // implementation detail. This header file may change from version to
26 26 // version without notice, or even be removed.
27 27 //
28 28 // We mean it.
29 29
30 30 #ifndef ABSTRACTDOMAIN_H
31 31 #define ABSTRACTDOMAIN_H
32 32 #include "qchartglobal.h"
33 33 #include <QRectF>
34 34 #include <QSizeF>
35 35 #include <QDebug>
36 36
37 37 QTCOMMERCIALCHART_BEGIN_NAMESPACE
38 38
39 39 class QAbstractAxis;
40 40
41 41 class QTCOMMERCIALCHART_AUTOTEST_EXPORT AbstractDomain: public QObject
42 42 {
43 43 Q_OBJECT
44 44 public:
45 enum DomainType { UndefinedDomain, XYDomain, XLogYDomain, LogXYDomain, XLogYLogDomain };
45 enum DomainType { UndefinedDomain, XYDomain, XLogYDomain, LogXYDomain, LogXLogYDomain };
46 46 public:
47 47 explicit AbstractDomain(QObject *object = 0);
48 48 virtual ~AbstractDomain();
49 49
50 50 void setSize(const QSizeF& size);
51 51 QSizeF size() const;
52 52
53 53 virtual DomainType type() = 0;
54 54
55 55 virtual void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) = 0;
56 56 void setRangeX(qreal min, qreal max);
57 57 void setRangeY(qreal min, qreal max);
58 58 void setMinX(qreal min);
59 59 void setMaxX(qreal max);
60 60 void setMinY(qreal min);
61 61 void setMaxY(qreal max);
62 62
63 63 qreal minX() const { return m_minX; }
64 64 qreal maxX() const { return m_maxX; }
65 65 qreal minY() const { return m_minY; }
66 66 qreal maxY() const { return m_maxY; }
67 67
68 68 qreal spanX() const;
69 69 qreal spanY() const;
70 70 bool isEmpty() const;
71 71
72 72 void blockAxisSignals(bool block);
73 73 bool axisSignalsBlocked() const { return m_axisSignalsBlocked; }
74 74
75 75 friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const AbstractDomain &domain1, const AbstractDomain &domain2);
76 76 friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const AbstractDomain &domain1, const AbstractDomain &domain2);
77 77 friend QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const AbstractDomain &domain);
78 78
79 79 virtual void zoomIn(const QRectF &rect) = 0;
80 80 virtual void zoomOut(const QRectF &rect) = 0;
81 81 virtual void move(qreal dx, qreal dy) = 0;
82 82
83 83 virtual QPointF calculateGeometryPoint(const QPointF &point) const = 0;
84 84 virtual QPointF calculateDomainPoint(const QPointF &point) const = 0;
85 85 virtual QVector<QPointF> calculateGeometryPoints(const QList<QPointF>& vector) const = 0;
86 86
87 87 virtual bool attachAxis(QAbstractAxis* axis);
88 88 virtual bool detachAxis(QAbstractAxis* axis);
89 89
90 90 static void looseNiceNumbers(qreal &min, qreal &max, int &ticksCount);
91 91 static qreal niceNumber(qreal x, bool ceiling);
92 92
93 93 Q_SIGNALS:
94 94 void updated();
95 95 void rangeHorizontalChanged(qreal min, qreal max);
96 96 void rangeVerticalChanged(qreal min, qreal max);
97 97
98 98 public Q_SLOTS:
99 99 void handleVerticalAxisRangeChanged(qreal min,qreal max);
100 100 void handleHorizontalAxisRangeChanged(qreal min,qreal max);
101 101
102 102 protected:
103 103 qreal m_minX;
104 104 qreal m_maxX;
105 105 qreal m_minY;
106 106 qreal m_maxY;
107 107 QSizeF m_size;
108 108 bool m_axisSignalsBlocked;
109 109 };
110 110
111 111 QTCOMMERCIALCHART_END_NAMESPACE
112 112
113 113 #endif // ABSTRACTDOMAIN_H
@@ -1,70 +1,72
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 // W A R N I N G
22 22 // -------------
23 23 //
24 24 // This file is not part of the QtCommercial Chart API. It exists purely as an
25 25 // implementation detail. This header file may change from version to
26 26 // version without notice, or even be removed.
27 27 //
28 28 // We mean it.
29 29
30 30 #ifndef LOGXLOGYDOMAIN_H
31 31 #define LOGXLOGYDOMAIN_H
32 32 #include "abstractdomain_p.h"
33 33 #include <QRectF>
34 34 #include <QSizeF>
35 35
36 36 QTCOMMERCIALCHART_BEGIN_NAMESPACE
37 37
38 38 class QTCOMMERCIALCHART_AUTOTEST_EXPORT LogXLogYDomain: public AbstractDomain
39 39 {
40 40 Q_OBJECT
41 41 public:
42 42 explicit LogXLogYDomain(QObject *object = 0);
43 43 virtual ~LogXLogYDomain();
44 44
45 DomainType type(){ return AbstractDomain::XLogYLogDomain;}
46
45 47 void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
46 48
47 49 friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const LogXLogYDomain &domain1, const LogXLogYDomain &domain2);
48 50 friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const LogXLogYDomain &domain1, const LogXLogYDomain &domain2);
49 51 friend QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXLogYDomain &domain);
50 52
51 53 void zoomIn(const QRectF &rect);
52 54 void zoomOut(const QRectF &rect);
53 55 void move(qreal dx, qreal dy);
54 56
55 57 QPointF calculateGeometryPoint(const QPointF &point) const;
56 58 QPointF calculateDomainPoint(const QPointF &point) const;
57 59 QVector<QPointF> calculateGeometryPoints(const QList<QPointF>& vector) const;
58 60
59 61 private:
60 62 qreal m_logMinX;
61 63 qreal m_logMaxX;
62 64 qreal m_logBaseX;
63 65 qreal m_logMinY;
64 66 qreal m_logMaxY;
65 67 qreal m_logBaseY;
66 68 };
67 69
68 70 QTCOMMERCIALCHART_END_NAMESPACE
69 71
70 72 #endif // LOGXLOGYDOMAIN_H
@@ -1,67 +1,69
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 // W A R N I N G
22 22 // -------------
23 23 //
24 24 // This file is not part of the QtCommercial Chart API. It exists purely as an
25 25 // implementation detail. This header file may change from version to
26 26 // version without notice, or even be removed.
27 27 //
28 28 // We mean it.
29 29
30 30 #ifndef LOGXYDOMAIN_H
31 31 #define LOGXYDOMAIN_H
32 32 #include "abstractdomain_p.h"
33 33 #include <QRectF>
34 34 #include <QSizeF>
35 35
36 36 QTCOMMERCIALCHART_BEGIN_NAMESPACE
37 37
38 38 class QTCOMMERCIALCHART_AUTOTEST_EXPORT LogXYDomain: public AbstractDomain
39 39 {
40 40 Q_OBJECT
41 41 public:
42 42 explicit LogXYDomain(QObject *object = 0);
43 43 virtual ~LogXYDomain();
44 44
45 DomainType type(){ return AbstractDomain::LogXYDomain;}
46
45 47 void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
46 48
47 49 friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const LogXYDomain &domain1, const LogXYDomain &domain2);
48 50 friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const LogXYDomain &domain1, const LogXYDomain &domain2);
49 51 friend QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXYDomain &domain);
50 52
51 53 void zoomIn(const QRectF &rect);
52 54 void zoomOut(const QRectF &rect);
53 55 void move(qreal dx, qreal dy);
54 56
55 57 QPointF calculateGeometryPoint(const QPointF &point) const;
56 58 QPointF calculateDomainPoint(const QPointF &point) const;
57 59 QVector<QPointF> calculateGeometryPoints(const QList<QPointF>& vector) const;
58 60
59 61 private:
60 62 qreal m_logMinX;
61 63 qreal m_logMaxX;
62 64 qreal m_logBaseX;
63 65 };
64 66
65 67 QTCOMMERCIALCHART_END_NAMESPACE
66 68
67 69 #endif // LOGXYDOMAIN_H
@@ -1,67 +1,69
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 // W A R N I N G
22 22 // -------------
23 23 //
24 24 // This file is not part of the QtCommercial Chart API. It exists purely as an
25 25 // implementation detail. This header file may change from version to
26 26 // version without notice, or even be removed.
27 27 //
28 28 // We mean it.
29 29
30 30 #ifndef XLOGYDOMAIN_H
31 31 #define XLOGYDOMAIN_H
32 32 #include "abstractdomain_p.h"
33 33 #include <QRectF>
34 34 #include <QSizeF>
35 35
36 36 QTCOMMERCIALCHART_BEGIN_NAMESPACE
37 37
38 38 class QTCOMMERCIALCHART_AUTOTEST_EXPORT XLogYDomain: public AbstractDomain
39 39 {
40 40 Q_OBJECT
41 41 public:
42 42 explicit XLogYDomain(QObject *object = 0);
43 43 virtual ~XLogYDomain();
44 44
45 DomainType type(){ return AbstractDomain::XLogYDomain;}
46
45 47 void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
46 48
47 49 friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const XLogYDomain &domain1, const XLogYDomain &domain2);
48 50 friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const XLogYDomain &domain1, const XLogYDomain &domain2);
49 51 friend QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const XLogYDomain &domain);
50 52
51 53 void zoomIn(const QRectF &rect);
52 54 void zoomOut(const QRectF &rect);
53 55 void move(qreal dx, qreal dy);
54 56
55 57 QPointF calculateGeometryPoint(const QPointF &point) const;
56 58 QPointF calculateDomainPoint(const QPointF &point) const;
57 59 QVector<QPointF> calculateGeometryPoints(const QList<QPointF>& vector) const;
58 60
59 61 private:
60 62 qreal m_logMinY;
61 63 qreal m_logMaxY;
62 64 qreal m_logBaseY;
63 65 };
64 66
65 67 QTCOMMERCIALCHART_END_NAMESPACE
66 68
67 69 #endif // XLOGYDOMAIN_H
General Comments 0
You need to be logged in to leave comments. Login now