Mercurial > hg > svcore
comparison data/model/EditableDenseThreeDimensionalModel.h @ 1365:3382d914e110
Merge from branch 3.0-integration
author | Chris Cannam |
---|---|
date | Fri, 13 Jan 2017 10:29:44 +0000 |
parents | 2ff5e411151d |
children | 48e9f538e6e9 |
comparison
equal
deleted
inserted
replaced
1272:6a7ea3bd0e10 | 1365:3382d914e110 |
---|---|
42 BasicMultirateCompression | 42 BasicMultirateCompression |
43 }; | 43 }; |
44 | 44 |
45 EditableDenseThreeDimensionalModel(sv_samplerate_t sampleRate, | 45 EditableDenseThreeDimensionalModel(sv_samplerate_t sampleRate, |
46 int resolution, | 46 int resolution, |
47 int yBinCount, | 47 int height, |
48 CompressionType compression, | 48 CompressionType compression, |
49 bool notifyOnAdd = true); | 49 bool notifyOnAdd = true); |
50 | 50 |
51 virtual bool isOK() const; | 51 virtual bool isOK() const; |
52 | 52 |
73 * Return the number of columns. | 73 * Return the number of columns. |
74 */ | 74 */ |
75 virtual int getWidth() const; | 75 virtual int getWidth() const; |
76 | 76 |
77 /** | 77 /** |
78 * Return the number of bins in each set of bins. | 78 * Return the number of bins in each column. |
79 */ | 79 */ |
80 virtual int getHeight() const; | 80 virtual int getHeight() const; |
81 | 81 |
82 /** | 82 /** |
83 * Set the number of bins in each set of bins. | 83 * Set the number of bins in each column. |
84 * | |
85 * You can set (via setColumn) a vector of any length as a column, | |
86 * but any column being retrieved will be resized to this height | |
87 * (or the height that was supplied to the constructor, if this is | |
88 * never called) on retrieval. That is, the model owner determines | |
89 * the height of the model at a single stroke; the columns | |
90 * themselves don't have any effect on the height of the model. | |
84 */ | 91 */ |
85 virtual void setHeight(int sz); | 92 virtual void setHeight(int sz); |
86 | 93 |
87 /** | 94 /** |
88 * Return the minimum value of the value in each bin. | 95 * Return the minimum value of the value in each bin. |
101 | 108 |
102 /** | 109 /** |
103 * Set the maximum value of the value in a bin. | 110 * Set the maximum value of the value in a bin. |
104 */ | 111 */ |
105 virtual void setMaximumLevel(float sz); | 112 virtual void setMaximumLevel(float sz); |
106 | |
107 /** | |
108 * Return true if there are data available for the given column. | |
109 */ | |
110 virtual bool isColumnAvailable(int x) const { return x < getWidth(); } | |
111 | 113 |
112 /** | 114 /** |
113 * Get the set of bin values at the given column. | 115 * Get the set of bin values at the given column. |
114 */ | 116 */ |
115 virtual Column getColumn(int x) const; | 117 virtual Column getColumn(int x) const; |
192 virtual void toXml(QTextStream &out, | 194 virtual void toXml(QTextStream &out, |
193 QString indent = "", | 195 QString indent = "", |
194 QString extraAttributes = "") const; | 196 QString extraAttributes = "") const; |
195 | 197 |
196 protected: | 198 protected: |
197 typedef QVector<Column> ValueMatrix; | 199 typedef std::vector<Column> ValueMatrix; |
198 ValueMatrix m_data; | 200 ValueMatrix m_data; |
199 | 201 |
200 // m_trunc is used for simple compression. If at least the top N | 202 // m_trunc is used for simple compression. If at least the top N |
201 // elements of column x (for N = some proportion of the column | 203 // elements of column x (for N = some proportion of the column |
202 // height) are equal to those of an earlier column x', then | 204 // height) are equal to those of an earlier column x', then |
206 // value). If m_trunc[x] is 0 then the whole of column x is | 208 // value). If m_trunc[x] is 0 then the whole of column x is |
207 // stored. | 209 // stored. |
208 std::vector<signed char> m_trunc; | 210 std::vector<signed char> m_trunc; |
209 void truncateAndStore(int index, const Column & values); | 211 void truncateAndStore(int index, const Column & values); |
210 Column expandAndRetrieve(int index) const; | 212 Column expandAndRetrieve(int index) const; |
213 Column rightHeight(const Column &c) const; | |
211 | 214 |
212 std::vector<QString> m_binNames; | 215 std::vector<QString> m_binNames; |
213 std::vector<float> m_binValues; | 216 std::vector<float> m_binValues; |
214 QString m_binValueUnit; | 217 QString m_binValueUnit; |
215 | 218 |