Mercurial > hg > svcore
comparison data/model/EditableDenseThreeDimensionalModel.cpp @ 181:9c652f2c39b1
* Various improvements to colour 3d plot layer, particularly for large and/or
dense plots. Still a work in progress
author | Chris Cannam |
---|---|
date | Fri, 06 Oct 2006 16:53:25 +0000 |
parents | 21792a550ec9 |
children | f75f8a1cd7b1 |
comparison
equal
deleted
inserted
replaced
180:bd1260261412 | 181:9c652f2c39b1 |
---|---|
14 */ | 14 */ |
15 | 15 |
16 #include "EditableDenseThreeDimensionalModel.h" | 16 #include "EditableDenseThreeDimensionalModel.h" |
17 | 17 |
18 #include <QTextStream> | 18 #include <QTextStream> |
19 | |
20 #include <iostream> | |
19 | 21 |
20 EditableDenseThreeDimensionalModel::EditableDenseThreeDimensionalModel(size_t sampleRate, | 22 EditableDenseThreeDimensionalModel::EditableDenseThreeDimensionalModel(size_t sampleRate, |
21 size_t resolution, | 23 size_t resolution, |
22 size_t yBinCount, | 24 size_t yBinCount, |
23 bool notifyOnAdd) : | 25 bool notifyOnAdd) : |
122 m_maximum = level; | 124 m_maximum = level; |
123 } | 125 } |
124 | 126 |
125 void | 127 void |
126 EditableDenseThreeDimensionalModel::getBinValues(long windowStart, | 128 EditableDenseThreeDimensionalModel::getBinValues(long windowStart, |
127 BinValueSet &result) const | 129 BinValueSet &result) const |
128 { | 130 { |
129 QMutexLocker locker(&m_mutex); | 131 QMutexLocker locker(&m_mutex); |
130 | 132 |
131 long index = windowStart / m_resolution; | 133 long index = windowStart / m_resolution; |
132 | 134 |
139 while (result.size() < m_yBinCount) result.push_back(m_minimum); | 141 while (result.size() < m_yBinCount) result.push_back(m_minimum); |
140 } | 142 } |
141 | 143 |
142 float | 144 float |
143 EditableDenseThreeDimensionalModel::getBinValue(long windowStart, | 145 EditableDenseThreeDimensionalModel::getBinValue(long windowStart, |
144 size_t n) const | 146 size_t n) const |
145 { | 147 { |
146 QMutexLocker locker(&m_mutex); | 148 QMutexLocker locker(&m_mutex); |
147 | 149 |
148 long index = windowStart / m_resolution; | 150 long index = windowStart / m_resolution; |
149 | 151 |
150 if (index >= 0 && index < long(m_data.size())) { | 152 if (index >= 0 && index < long(m_data.size())) { |
151 const BinValueSet &s = m_data[index]; | 153 const BinValueSet &s = m_data[index]; |
154 std::cerr << "index " << index << ", n " << n << ", res " << m_resolution << ", size " << s.size() | |
155 << std::endl; | |
152 if (n < s.size()) return s[n]; | 156 if (n < s.size()) return s[n]; |
153 } | 157 } |
154 | 158 |
155 return m_minimum; | 159 return m_minimum; |
156 } | 160 } |