Mercurial > hg > svcore
comparison data/model/DenseThreeDimensionalModel.h @ 500:83eae5239db6
* Permit viewing (though not editing) colour 3d plot layer data in
the spreadsheet data viewer dialog
* Add somewhat simplistic RDF export for layers
* Fix display of peak frequencies in spectrum layer
* Fix (I hope) sizing of plugin parameter dialog
author | Chris Cannam |
---|---|
date | Tue, 02 Dec 2008 17:17:25 +0000 |
parents | 1405f4a2caf3 |
children | 55ad231c9db7 |
comparison
equal
deleted
inserted
replaced
499:b71116d3c180 | 500:83eae5239db6 |
---|---|
15 | 15 |
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 "base/ZoomConstraint.h" | 21 #include "base/ZoomConstraint.h" |
22 #include "base/RealTime.h" | |
21 | 23 |
22 #include <QMutex> | 24 #include <QMutex> |
23 #include <vector> | 25 #include <vector> |
24 | 26 |
25 class DenseThreeDimensionalModel : public Model | 27 class DenseThreeDimensionalModel : public Model, |
28 public TabularModel | |
26 { | 29 { |
27 Q_OBJECT | 30 Q_OBJECT |
28 | 31 |
29 public: | 32 public: |
30 /** | 33 /** |
106 | 109 |
107 QString getTypeName() const { return tr("Dense 3-D"); } | 110 QString getTypeName() const { return tr("Dense 3-D"); } |
108 | 111 |
109 virtual int getCompletion() const = 0; | 112 virtual int getCompletion() const = 0; |
110 | 113 |
114 /* | |
115 TabularModel methods. | |
116 This class is non-editable -- subclasses may be editable. | |
117 Row and column are transposed for the tabular view (which is | |
118 "on its side"). | |
119 */ | |
120 | |
121 virtual int getRowCount() const { return getWidth(); } | |
122 virtual int getColumnCount() const { return getHeight() + 2; } | |
123 | |
124 virtual QString getHeading(int column) const | |
125 { | |
126 switch (column) { | |
127 case 0: return tr("Time"); | |
128 case 1: return tr("Frame"); | |
129 default: return getBinName(column - 2); | |
130 } | |
131 } | |
132 | |
133 virtual QVariant getData(int row, int column, int role) const | |
134 { | |
135 switch (column) { | |
136 case 0: { | |
137 RealTime rt = RealTime::frame2RealTime(row * getResolution(), | |
138 getSampleRate()); | |
139 return rt.toText().c_str(); | |
140 } | |
141 case 1: | |
142 return int(row * getResolution()); | |
143 default: | |
144 return getValueAt(row, column - 2); | |
145 } | |
146 } | |
147 | |
148 virtual bool isColumnTimeValue(int col) const { | |
149 return col < 2; | |
150 } | |
151 virtual SortType getSortType(int col) const { | |
152 return SortNumeric; | |
153 } | |
154 | |
155 virtual long getFrameForRow(int row) const { | |
156 return row * getSampleRate(); | |
157 } | |
158 virtual int getRowForFrame(long frame) const { | |
159 return frame / getSampleRate(); | |
160 } | |
161 | |
111 protected: | 162 protected: |
112 DenseThreeDimensionalModel() { } | 163 DenseThreeDimensionalModel() { } |
113 }; | 164 }; |
114 | 165 |
115 #endif | 166 #endif |