comparison data/model/DenseThreeDimensionalModel.h @ 1206:659372323b45 tony-2.0-integration

Merge latest SV 3.0 branch code
author Chris Cannam
date Fri, 19 Aug 2016 15:58:57 +0100
parents fd40a5335968
children 51d6551d5244
comparison
equal deleted inserted replaced
1136:e94719f941ba 1206:659372323b45
16 #ifndef _DENSE_THREE_DIMENSIONAL_MODEL_H_ 16 #ifndef _DENSE_THREE_DIMENSIONAL_MODEL_H_
17 #define _DENSE_THREE_DIMENSIONAL_MODEL_H_ 17 #define _DENSE_THREE_DIMENSIONAL_MODEL_H_
18 18
19 #include "Model.h" 19 #include "Model.h"
20 #include "TabularModel.h" 20 #include "TabularModel.h"
21 #include "base/ColumnOp.h"
21 #include "base/ZoomConstraint.h" 22 #include "base/ZoomConstraint.h"
22 #include "base/RealTime.h" 23 #include "base/RealTime.h"
23 24
24 #include <QMutex> 25 #include <QMutex>
25 #include <QVector> 26 #include <QVector>
53 /** 54 /**
54 * Return the maximum permissible value in each bin. 55 * Return the maximum permissible value in each bin.
55 */ 56 */
56 virtual float getMaximumLevel() const = 0; 57 virtual float getMaximumLevel() const = 0;
57 58
58 /** 59 typedef ColumnOp::Column Column;
59 * Return true if there are data available for the given column.
60 * This should return true only if getColumn(column) would not
61 * have to do any substantial work to calculate its return values.
62 * If this function returns false, it may still be possible to
63 * retrieve the column, but its values may have to be calculated.
64 */
65 virtual bool isColumnAvailable(int column) const = 0;
66
67 typedef QVector<float> Column;
68 60
69 /** 61 /**
70 * Get data from the given column of bin values. 62 * Get data from the given column of bin values.
71 */ 63 */
72 virtual Column getColumn(int column) const = 0; 64 virtual Column getColumn(int column) const = 0;
151 143
152 virtual QVariant getData(int row, int column, int) const 144 virtual QVariant getData(int row, int column, int) const
153 { 145 {
154 switch (column) { 146 switch (column) {
155 case 0: { 147 case 0: {
156 RealTime rt = RealTime::frame2RealTime(row * getResolution(), 148 RealTime rt = RealTime::frame2RealTime
157 getSampleRate()); 149 (row * getResolution() + getStartFrame(), getSampleRate());
158 return rt.toText().c_str(); 150 return rt.toText().c_str();
159 } 151 }
160 case 1: 152 case 1:
161 return int(row * getResolution()); 153 return int(row * getResolution() + getStartFrame());
162 default: 154 default:
163 return getValueAt(row, column - 2); 155 return getValueAt(row, column - 2);
164 } 156 }
165 } 157 }
166 158
170 virtual SortType getSortType(int) const { 162 virtual SortType getSortType(int) const {
171 return SortNumeric; 163 return SortNumeric;
172 } 164 }
173 165
174 virtual sv_frame_t getFrameForRow(int row) const { 166 virtual sv_frame_t getFrameForRow(int row) const {
175 return sv_frame_t(row) * getResolution(); 167 return sv_frame_t(row) * getResolution() + getStartFrame();
176 } 168 }
177 virtual int getRowForFrame(sv_frame_t frame) const { 169 virtual int getRowForFrame(sv_frame_t frame) const {
178 return int(frame / getResolution()); 170 return int((frame - getStartFrame()) / getResolution());
179 } 171 }
180 172
181 protected: 173 protected:
182 DenseThreeDimensionalModel() { } 174 DenseThreeDimensionalModel() { }
183 }; 175 };