Mercurial > hg > svgui
comparison layer/Colour3DPlotLayer.cpp @ 125:999ae0f7d10c
* Change preferences dialog to ok/apply/cancel model
* Make preferences persist in a config file
* Change instance() to getInstance() for all singleton types
* Make pasting to time-value layer with no values in clipboard ask you how to
generate the values
* Fix bad behaviour caused by importing "data"-type (i.e. 3d dense) model from
annotation file without a fixed window size available
author | Chris Cannam |
---|---|
date | Thu, 27 Jul 2006 16:06:32 +0000 |
parents | 571805759a66 |
children | 33929e0c3c6b |
comparison
equal
deleted
inserted
replaced
124:bd6e85b3d88b | 125:999ae0f7d10c |
---|---|
24 | 24 |
25 #include <iostream> | 25 #include <iostream> |
26 | 26 |
27 #include <cassert> | 27 #include <cassert> |
28 | 28 |
29 //#define DEBUG_COLOUR_3D_PLOT_LAYER_PAINT 1 | |
30 | |
29 | 31 |
30 Colour3DPlotLayer::Colour3DPlotLayer() : | 32 Colour3DPlotLayer::Colour3DPlotLayer() : |
31 Layer(), | 33 Layer(), |
32 m_model(0), | 34 m_model(0), |
33 m_cache(0) | 35 m_cache(0) |
168 | 170 |
169 void | 171 void |
170 Colour3DPlotLayer::paint(View *v, QPainter &paint, QRect rect) const | 172 Colour3DPlotLayer::paint(View *v, QPainter &paint, QRect rect) const |
171 { | 173 { |
172 // Profiler profiler("Colour3DPlotLayer::paint"); | 174 // Profiler profiler("Colour3DPlotLayer::paint"); |
173 // std::cerr << "Colour3DPlotLayer::paint(): m_model is " << m_model << ", zoom level is " << v->getZoomLevel() << std::endl; | 175 #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT |
176 std::cerr << "Colour3DPlotLayer::paint(): m_model is " << m_model << ", zoom level is " << v->getZoomLevel() << std::endl; | |
177 #endif | |
174 | 178 |
175 //!!! This doesn't yet accommodate the fact that the model may | 179 //!!! This doesn't yet accommodate the fact that the model may |
176 //have a different sample rate from an underlying model. At the | 180 //have a different sample rate from an underlying model. At the |
177 //moment our paint mechanism assumes all models have the same | 181 //moment our paint mechanism assumes all models have the same |
178 //sample rate. If that isn't the case, they won't align and the | 182 //sample rate. If that isn't the case, they won't align and the |
270 int sx0 = int((v->getFrameForX(x0) - long(modelStart)) / long(modelWindow)); | 274 int sx0 = int((v->getFrameForX(x0) - long(modelStart)) / long(modelWindow)); |
271 int sx1 = int((v->getFrameForX(x1) - long(modelStart)) / long(modelWindow)); | 275 int sx1 = int((v->getFrameForX(x1) - long(modelStart)) / long(modelWindow)); |
272 int sw = sx1 - sx0; | 276 int sw = sx1 - sx0; |
273 int sh = m_model->getYBinCount(); | 277 int sh = m_model->getYBinCount(); |
274 | 278 |
275 /* | 279 #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT |
276 std::cerr << "Colour3DPlotLayer::paint: w " << w << ", h " << h << ", sx0 " << sx0 << ", sx1 " << sx1 << ", sw " << sw << ", sh " << sh << std::endl; | 280 std::cerr << "Colour3DPlotLayer::paint: w " << w << ", h " << h << ", sx0 " << sx0 << ", sx1 " << sx1 << ", sw " << sw << ", sh " << sh << std::endl; |
277 std::cerr << "Colour3DPlotLayer: sample rate is " << m_model->getSampleRate() << ", window size " << m_model->getWindowSize() << std::endl; | 281 std::cerr << "Colour3DPlotLayer: sample rate is " << m_model->getSampleRate() << ", window size " << m_model->getWindowSize() << std::endl; |
278 */ | 282 #endif |
279 | 283 |
280 QPoint illuminatePos; | 284 QPoint illuminatePos; |
281 bool illuminate = v->shouldIlluminateLocalFeatures(this, illuminatePos); | 285 bool illuminate = v->shouldIlluminateLocalFeatures(this, illuminatePos); |
282 char labelbuf[10]; | 286 char labelbuf[10]; |
283 | 287 |
319 if (r.contains(illuminatePos)) { | 323 if (r.contains(illuminatePos)) { |
320 paint.setPen(Qt::black);//!!! | 324 paint.setPen(Qt::black);//!!! |
321 } | 325 } |
322 } | 326 } |
323 | 327 |
324 // std::cout << "rect " << rx0 << "," << (ry0 - h / sh - 1) << " " | 328 #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT |
325 // << w << "x" << (h / sh + 1) << std::endl; | 329 std::cerr << "rect " << rx0 << "," << (ry0 - h / sh - 1) << " " |
330 << w << "x" << (h / sh + 1) << std::endl; | |
331 #endif | |
326 | 332 |
327 paint.drawRect(r); | 333 paint.drawRect(r); |
328 | 334 |
329 if (showLabel) { | 335 if (showLabel) { |
330 if (sx >= 0 && sx < m_cache->width() && | 336 if (sx >= 0 && sx < m_cache->width() && |