Mercurial > hg > svcore
changeset 1255:ca9032dd2811 3.0-integration
Merge from branch piper
author | Chris Cannam |
---|---|
date | Sat, 05 Nov 2016 10:41:41 +0000 |
parents | 303039dd9e05 (diff) cbdd534f517a (current diff) |
children | d8d6d01505ed |
files | |
diffstat | 3 files changed, 26 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/base/ColumnOp.h Sat Nov 05 10:40:22 2016 +0000 +++ b/base/ColumnOp.h Sat Nov 05 10:41:41 2016 +0000 @@ -194,9 +194,9 @@ int by0 = int(sy0 + 0.0001); int by1 = int(sy1 + 0.0001); if (by1 < by0 + 1) by1 = by0 + 1; - if (by1 >= bins) by1 = by1 - 1; + if (by1 >= bins) by1 = bins - 1; - for (int bin = by0; bin < by1; ++bin) { + for (int bin = by0; bin <= by1; ++bin) { float value = in[bin];
--- a/data/model/EditableDenseThreeDimensionalModel.cpp Sat Nov 05 10:40:22 2016 +0000 +++ b/data/model/EditableDenseThreeDimensionalModel.cpp Sat Nov 05 10:41:41 2016 +0000 @@ -265,6 +265,17 @@ } EditableDenseThreeDimensionalModel::Column +EditableDenseThreeDimensionalModel::rightHeight(const Column &c) const +{ + if (int(c.size()) == m_yBinCount) return c; + else { + Column cc(c); + cc.resize(m_yBinCount, 0.0); + return cc; + } +} + +EditableDenseThreeDimensionalModel::Column EditableDenseThreeDimensionalModel::expandAndRetrieve(int index) const { // See comment above m_trunc declaration in header @@ -272,11 +283,11 @@ assert(index >= 0 && index < int(m_data.size())); Column c = m_data.at(index); if (index == 0) { - return c; + return rightHeight(c); } int trunc = (int)m_trunc[index]; if (trunc == 0) { - return c; + return rightHeight(c); } bool top = true; int tdist = trunc; @@ -316,8 +327,6 @@ bool allChange = false; -// if (values.size() > m_yBinCount) m_yBinCount = values.size(); - for (int i = 0; in_range_for(values, i); ++i) { float value = values[i]; if (ISNAN(value) || ISINF(value)) {
--- a/data/model/EditableDenseThreeDimensionalModel.h Sat Nov 05 10:40:22 2016 +0000 +++ b/data/model/EditableDenseThreeDimensionalModel.h Sat Nov 05 10:41:41 2016 +0000 @@ -44,7 +44,7 @@ EditableDenseThreeDimensionalModel(sv_samplerate_t sampleRate, int resolution, - int yBinCount, + int height, CompressionType compression, bool notifyOnAdd = true); @@ -75,12 +75,19 @@ virtual int getWidth() const; /** - * Return the number of bins in each set of bins. + * Return the number of bins in each column. */ virtual int getHeight() const; /** - * Set the number of bins in each set of bins. + * Set the number of bins in each column. + * + * You can set (via setColumn) a vector of any length as a column, + * but any column being retrieved will be resized to this height + * (or the height that was supplied to the constructor, if this is + * never called) on retrieval. That is, the model owner determines + * the height of the model at a single stroke; the columns + * themselves don't have any effect on the height of the model. */ virtual void setHeight(int sz); @@ -203,6 +210,7 @@ std::vector<signed char> m_trunc; void truncateAndStore(int index, const Column & values); Column expandAndRetrieve(int index) const; + Column rightHeight(const Column &c) const; std::vector<QString> m_binNames; std::vector<float> m_binValues;