Mercurial > hg > svcore
changeset 886:48410857b03c
Add bin-values and bin-value unit to EditableDense3DModel
author | Chris Cannam |
---|---|
date | Thu, 06 Feb 2014 18:26:18 +0000 |
parents | 12a6140b3ae0 |
children | 68f3eaefe297 |
files | data/model/EditableDenseThreeDimensionalModel.cpp data/model/EditableDenseThreeDimensionalModel.h |
diffstat | 2 files changed, 67 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/data/model/EditableDenseThreeDimensionalModel.cpp Thu Feb 06 15:31:16 2014 +0000 +++ b/data/model/EditableDenseThreeDimensionalModel.cpp Thu Feb 06 18:26:18 2014 +0000 @@ -410,6 +410,37 @@ } bool +EditableDenseThreeDimensionalModel::hasBinValues() const +{ + return !m_binValues.empty(); +} + +float +EditableDenseThreeDimensionalModel::getBinValue(size_t n) const +{ + if (n < m_binValues.size()) return m_binValues[n]; + else return 0.f; +} + +void +EditableDenseThreeDimensionalModel::setBinValues(std::vector<float> values) +{ + m_binValues = values; +} + +QString +EditableDenseThreeDimensionalModel::getBinValueUnit() const +{ + return m_binValueUnit; +} + +void +EditableDenseThreeDimensionalModel::setBinValueUnit(QString unit) +{ + m_binValueUnit = unit; +} + +bool EditableDenseThreeDimensionalModel::shouldUseLogValueScale() const { QReadLocker locker(&m_lock);
--- a/data/model/EditableDenseThreeDimensionalModel.h Thu Feb 06 15:31:16 2014 +0000 +++ b/data/model/EditableDenseThreeDimensionalModel.h Thu Feb 06 18:26:18 2014 +0000 @@ -144,6 +144,40 @@ virtual void setBinNames(std::vector<QString> names); /** + * Return true if the bins have values as well as names. (The + * values may have been derived from the names, e.g. by parsing + * numbers from them.) If this returns true, getBinValue() may be + * used to retrieve the values. + */ + virtual bool hasBinValues() const; + + /** + * Return the value of bin n, if any. This is a "vertical scale" + * value which does not vary from one column to the next. This is + * only meaningful if hasBinValues() returns true. + */ + virtual float getBinValue(size_t n) const; + + /** + * Set the values of all bins (separate from their labels). These + * are "vertical scale" values which do not vary from one column + * to the next. + */ + virtual void setBinValues(std::vector<float> values); + + /** + * Obtain the name of the unit of the values returned from + * getBinValue(), if any. + */ + virtual QString getBinValueUnit() const; + + /** + * Set the name of the unit of the values return from + * getBinValue() if any. + */ + virtual void setBinValueUnit(QString unit); + + /** * Return true if the distribution of values in the bins is such * as to suggest a log scale (mapping to colour etc) may be better * than a linear one. @@ -179,6 +213,8 @@ Column expandAndRetrieve(size_t index) const; std::vector<QString> m_binNames; + std::vector<float> m_binValues; + QString m_binValueUnit; size_t m_startFrame; size_t m_sampleRate;