Mercurial > hg > svcore
comparison data/model/SparseValueModel.h @ 1599:ce185d4dd408 bqaudiostream
Merge from default branch
author | Chris Cannam |
---|---|
date | Wed, 23 Jan 2019 14:43:43 +0000 |
parents | ad5f892c0c4d |
children | 0e0947896fd3 |
comparison
equal
deleted
inserted
replaced
1598:d2555df635ec | 1599:ce185d4dd408 |
---|---|
11 published by the Free Software Foundation; either version 2 of the | 11 published by the Free Software Foundation; either version 2 of the |
12 License, or (at your option) any later version. See the file | 12 License, or (at your option) any later version. See the file |
13 COPYING included with this distribution for more information. | 13 COPYING included with this distribution for more information. |
14 */ | 14 */ |
15 | 15 |
16 #ifndef _SPARSE_VALUE_MODEL_H_ | 16 #ifndef SV_SPARSE_VALUE_MODEL_H |
17 #define _SPARSE_VALUE_MODEL_H_ | 17 #define SV_SPARSE_VALUE_MODEL_H |
18 | 18 |
19 #include "SparseModel.h" | 19 #include "SparseModel.h" |
20 #include "base/UnitDatabase.h" | 20 #include "base/UnitDatabase.h" |
21 | 21 |
22 #include "system/System.h" | 22 #include "system/System.h" |
51 using SparseModel<PointType>::m_points; | 51 using SparseModel<PointType>::m_points; |
52 using SparseModel<PointType>::modelChanged; | 52 using SparseModel<PointType>::modelChanged; |
53 using SparseModel<PointType>::getPoints; | 53 using SparseModel<PointType>::getPoints; |
54 using SparseModel<PointType>::tr; | 54 using SparseModel<PointType>::tr; |
55 | 55 |
56 QString getTypeName() const { return tr("Sparse Value"); } | 56 QString getTypeName() const override { return tr("Sparse Value"); } |
57 | 57 |
58 virtual float getValueMinimum() const { return m_valueMinimum; } | 58 virtual float getValueMinimum() const { return m_valueMinimum; } |
59 virtual float getValueMaximum() const { return m_valueMaximum; } | 59 virtual float getValueMaximum() const { return m_valueMaximum; } |
60 | 60 |
61 virtual QString getScaleUnits() const { return m_units; } | 61 virtual QString getScaleUnits() const { return m_units; } |
62 virtual void setScaleUnits(QString units) { | 62 virtual void setScaleUnits(QString units) { |
63 m_units = units; | 63 m_units = units; |
64 UnitDatabase::getInstance()->registerUnit(units); | 64 UnitDatabase::getInstance()->registerUnit(units); |
65 } | 65 } |
66 | 66 |
67 virtual void addPoint(const PointType &point) | 67 void addPoint(const PointType &point) override |
68 { | 68 { |
69 bool allChange = false; | 69 bool allChange = false; |
70 | 70 |
71 if (!ISNAN(point.value) && !ISINF(point.value)) { | 71 if (!ISNAN(point.value) && !ISINF(point.value)) { |
72 if (!m_haveExtents || point.value < m_valueMinimum) { | 72 if (!m_haveExtents || point.value < m_valueMinimum) { |
82 | 82 |
83 SparseModel<PointType>::addPoint(point); | 83 SparseModel<PointType>::addPoint(point); |
84 if (allChange) emit modelChanged(); | 84 if (allChange) emit modelChanged(); |
85 } | 85 } |
86 | 86 |
87 virtual void deletePoint(const PointType &point) | 87 void deletePoint(const PointType &point) override |
88 { | 88 { |
89 SparseModel<PointType>::deletePoint(point); | 89 SparseModel<PointType>::deletePoint(point); |
90 | 90 |
91 if (point.value == m_valueMinimum || | 91 if (point.value == m_valueMinimum || |
92 point.value == m_valueMaximum) { | 92 point.value == m_valueMaximum) { |
111 emit modelChanged(); | 111 emit modelChanged(); |
112 } | 112 } |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 virtual void toXml(QTextStream &stream, | 116 void toXml(QTextStream &stream, |
117 QString indent = "", | 117 QString indent = "", |
118 QString extraAttributes = "") const | 118 QString extraAttributes = "") const override |
119 { | 119 { |
120 std::cerr << "SparseValueModel::toXml: extraAttributes = \"" | 120 std::cerr << "SparseValueModel::toXml: extraAttributes = \"" |
121 << extraAttributes.toStdString() << std::endl; | 121 << extraAttributes.toStdString() << std::endl; |
122 | 122 |
123 SparseModel<PointType>::toXml | 123 SparseModel<PointType>::toXml |