Mercurial > hg > svgui
comparison layer/Colour3DPlotLayer.cpp @ 706:97ea68f62c1f imaf_enc
Merge from default branch
| author | Chris Cannam |
|---|---|
| date | Thu, 05 Dec 2013 09:47:02 +0000 |
| parents | 1a0dfcbffaf1 |
| children | 67e6d518ac27 |
comparison
equal
deleted
inserted
replaced
| 678:26c5f7fd4807 | 706:97ea68f62c1f |
|---|---|
| 687 | 687 |
| 688 if (m_invertVertical) sy = m_model->getHeight() - sy - 1; | 688 if (m_invertVertical) sy = m_model->getHeight() - sy - 1; |
| 689 | 689 |
| 690 float value = m_model->getValueAt(sx0, sy); | 690 float value = m_model->getValueAt(sx0, sy); |
| 691 | 691 |
| 692 // std::cerr << "bin value (" << sx0 << "," << sy << ") is " << value << std::endl; | 692 // cerr << "bin value (" << sx0 << "," << sy << ") is " << value << endl; |
| 693 | 693 |
| 694 QString binName = m_model->getBinName(sy); | 694 QString binName = m_model->getBinName(sy); |
| 695 if (binName == "") binName = QString("[%1]").arg(sy + 1); | 695 if (binName == "") binName = QString("[%1]").arg(sy + 1); |
| 696 else binName = QString("%1 [%2]").arg(binName).arg(sy + 1); | 696 else binName = QString("%1 [%2]").arg(binName).arg(sy + 1); |
| 697 | 697 |
| 784 if (pixel >= 0 && pixel < 256) { | 784 if (pixel >= 0 && pixel < 256) { |
| 785 QRgb c = m_cache->color(pixel); | 785 QRgb c = m_cache->color(pixel); |
| 786 paint.setPen(QColor(qRed(c), qGreen(c), qBlue(c))); | 786 paint.setPen(QColor(qRed(c), qGreen(c), qBlue(c))); |
| 787 paint.drawLine(5, 11 + y, cw - 5, 11 + y); | 787 paint.drawLine(5, 11 + y, cw - 5, 11 + y); |
| 788 } else { | 788 } else { |
| 789 std::cerr << "WARNING: Colour3DPlotLayer::paintVerticalScale: value " << value << ", mmin " << mmin << ", mmax " << mmax << " leads to invalid pixel " << pixel << std::endl; | 789 cerr << "WARNING: Colour3DPlotLayer::paintVerticalScale: value " << value << ", mmin " << mmin << ", mmax " << mmax << " leads to invalid pixel " << pixel << endl; |
| 790 } | 790 } |
| 791 } | 791 } |
| 792 | 792 |
| 793 QString minstr = QString("%1").arg(min); | 793 QString minstr = QString("%1").arg(min); |
| 794 QString maxstr = QString("%1").arg(max); | 794 QString maxstr = QString("%1").arg(max); |
| 968 m_cacheValidEnd = 0; | 968 m_cacheValidEnd = 0; |
| 969 } | 969 } |
| 970 | 970 |
| 971 if (m_cacheValidStart <= firstBin && m_cacheValidEnd >= lastBin) { | 971 if (m_cacheValidStart <= firstBin && m_cacheValidEnd >= lastBin) { |
| 972 #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT | 972 #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT |
| 973 std::cerr << "Cache is valid in this region already" << std::endl; | 973 cerr << "Cache is valid in this region already" << endl; |
| 974 #endif | 974 #endif |
| 975 return; | 975 return; |
| 976 } | 976 } |
| 977 | 977 |
| 978 size_t fillStart = firstBin; | 978 size_t fillStart = firstBin; |
| 1004 m_cacheValidStart = fillStart; | 1004 m_cacheValidStart = fillStart; |
| 1005 m_cacheValidEnd = fillEnd; | 1005 m_cacheValidEnd = fillEnd; |
| 1006 } | 1006 } |
| 1007 | 1007 |
| 1008 #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT | 1008 #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT |
| 1009 std::cerr << "Cache size " << cacheWidth << "x" << cacheHeight << " will be valid from " << m_cacheValidStart << " to " << m_cacheValidEnd << std::endl; | 1009 cerr << "Cache size " << cacheWidth << "x" << cacheHeight << " will be valid from " << m_cacheValidStart << " to " << m_cacheValidEnd << endl; |
| 1010 #endif | 1010 #endif |
| 1011 | 1011 |
| 1012 DenseThreeDimensionalModel::Column values; | 1012 DenseThreeDimensionalModel::Column values; |
| 1013 | 1013 |
| 1014 float min = m_model->getMinimumLevel(); | 1014 float min = m_model->getMinimumLevel(); |
| 1227 return; | 1227 return; |
| 1228 } | 1228 } |
| 1229 | 1229 |
| 1230 #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT | 1230 #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT |
| 1231 SVDEBUG << "Colour3DPlotLayer::paint: w " << x1-x0 << ", h " << h << ", sx0 " << sx0 << ", sx1 " << sx1 << ", sw " << sx1-sx0 << ", sh " << sh << endl; | 1231 SVDEBUG << "Colour3DPlotLayer::paint: w " << x1-x0 << ", h " << h << ", sx0 " << sx0 << ", sx1 " << sx1 << ", sw " << sx1-sx0 << ", sh " << sh << endl; |
| 1232 std::cerr << "Colour3DPlotLayer: sample rate is " << m_model->getSampleRate() << ", resolution " << m_model->getResolution() << std::endl; | 1232 cerr << "Colour3DPlotLayer: sample rate is " << m_model->getSampleRate() << ", resolution " << m_model->getResolution() << endl; |
| 1233 #endif | 1233 #endif |
| 1234 | 1234 |
| 1235 QPoint illuminatePos; | 1235 QPoint illuminatePos; |
| 1236 bool illuminate = v->shouldIlluminateLocalFeatures(this, illuminatePos); | 1236 bool illuminate = v->shouldIlluminateLocalFeatures(this, illuminatePos); |
| 1237 char labelbuf[10]; | 1237 char labelbuf[10]; |
| 1287 paint.setPen(v->getForeground()); | 1287 paint.setPen(v->getForeground()); |
| 1288 } | 1288 } |
| 1289 } | 1289 } |
| 1290 | 1290 |
| 1291 #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT | 1291 #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT |
| 1292 // std::cerr << "rect " << r.x() << "," << r.y() << " " | 1292 // cerr << "rect " << r.x() << "," << r.y() << " " |
| 1293 // << r.width() << "x" << r.height() << std::endl; | 1293 // << r.width() << "x" << r.height() << endl; |
| 1294 #endif | 1294 #endif |
| 1295 | 1295 |
| 1296 paint.drawRect(r); | 1296 paint.drawRect(r); |
| 1297 | 1297 |
| 1298 if (showLabel) { | 1298 if (showLabel) { |
| 1348 | 1348 |
| 1349 int zoomLevel = v->getZoomLevel(); | 1349 int zoomLevel = v->getZoomLevel(); |
| 1350 | 1350 |
| 1351 QImage *source = m_cache; | 1351 QImage *source = m_cache; |
| 1352 | 1352 |
| 1353 std::cerr << "modelResolution " << modelResolution << ", srRatio " | 1353 SVDEBUG << "modelResolution " << modelResolution << ", srRatio " |
| 1354 << srRatio << ", m_peakResolution " << m_peakResolution | 1354 << srRatio << ", m_peakResolution " << m_peakResolution |
| 1355 << ", zoomLevel " << zoomLevel << ", result " | 1355 << ", zoomLevel " << zoomLevel << ", result " |
| 1356 << ((modelResolution * srRatio * m_peakResolution) / zoomLevel) | 1356 << ((modelResolution * srRatio * m_peakResolution) / zoomLevel) |
| 1357 << std::endl; | 1357 << endl; |
| 1358 | 1358 |
| 1359 if (m_peaksCache) { | 1359 if (m_peaksCache) { |
| 1360 if (((modelResolution * srRatio * m_peakResolution) / zoomLevel) < 1) { | 1360 if (((modelResolution * srRatio * m_peakResolution) / zoomLevel) < 1) { |
| 1361 SVDEBUG << "using peaks cache" << endl; | 1361 SVDEBUG << "using peaks cache" << endl; |
| 1362 source = m_peaksCache; | 1362 source = m_peaksCache; |
| 1363 modelResolution *= m_peakResolution; | 1363 modelResolution *= m_peakResolution; |
| 1364 } else { | 1364 } else { |
| 1365 std::cerr << "not using peaks cache" << std::endl; | 1365 SVDEBUG << "not using peaks cache" << endl; |
| 1366 } | 1366 } |
| 1367 } else { | 1367 } else { |
| 1368 std::cerr << "have no peaks cache" << std::endl; | 1368 SVDEBUG << "have no peaks cache" << endl; |
| 1369 } | 1369 } |
| 1370 | 1370 |
| 1371 int psy1i = -1; | 1371 int psy1i = -1; |
| 1372 int sw = source->width(); | 1372 int sw = source->width(); |
| 1373 | 1373 |
