Mercurial > hg > svgui
comparison layer/Colour3DPlotRenderer.cpp @ 1161:436df5f24bda 3.0-integration
Fix forehead-slapping failure to use the right model when rendering 3d plot in peaks cache mode (i.e. when zoomed quite far out)
author | Chris Cannam |
---|---|
date | Fri, 04 Nov 2016 16:32:41 +0000 |
parents | c53ed1a6fcbd |
children | 081c7ebf1fea |
comparison
equal
deleted
inserted
replaced
1160:a429b2acb45d | 1161:436df5f24bda |
---|---|
284 return DrawBufferPixelResolution; | 284 return DrawBufferPixelResolution; |
285 } | 285 } |
286 } | 286 } |
287 | 287 |
288 ColumnOp::Column | 288 ColumnOp::Column |
289 Colour3DPlotRenderer::getColumn(int sx, int minbin, int nbins) const | 289 Colour3DPlotRenderer::getColumn(int sx, int minbin, int nbins, |
290 bool usePeaksCache) const | |
290 { | 291 { |
291 // order: | 292 // order: |
292 // get column -> scale -> normalise -> record extents -> | 293 // get column -> scale -> normalise -> record extents -> |
293 // peak pick -> distribute/interpolate -> apply display gain | 294 // peak pick -> distribute/interpolate -> apply display gain |
294 | 295 |
305 column = vector<float>(fullColumn.data() + minbin, | 306 column = vector<float>(fullColumn.data() + minbin, |
306 fullColumn.data() + minbin + nbins); | 307 fullColumn.data() + minbin + nbins); |
307 | 308 |
308 } else { | 309 } else { |
309 | 310 |
310 ColumnOp::Column fullColumn = m_sources.source->getColumn(sx); | 311 ColumnOp::Column fullColumn = |
312 (usePeaksCache ? m_sources.peaks : m_sources.source)-> | |
313 getColumn(sx); | |
311 | 314 |
312 column = vector<float>(fullColumn.data() + minbin, | 315 column = vector<float>(fullColumn.data() + minbin, |
313 fullColumn.data() + minbin + nbins); | 316 fullColumn.data() + minbin + nbins); |
314 | 317 |
315 column = ColumnOp::applyGain(column, m_params.scaleFactor); | 318 column = ColumnOp::applyGain(column, m_params.scaleFactor); |
382 // order: | 385 // order: |
383 // get column -> scale -> normalise -> record extents -> | 386 // get column -> scale -> normalise -> record extents -> |
384 // peak pick -> distribute/interpolate -> apply display gain | 387 // peak pick -> distribute/interpolate -> apply display gain |
385 | 388 |
386 // this does the first three: | 389 // this does the first three: |
387 preparedColumn = getColumn(sx, minbin, nbins); | 390 preparedColumn = getColumn(sx, minbin, nbins, false); |
388 | 391 |
389 magRange.sample(preparedColumn); | 392 magRange.sample(preparedColumn); |
390 | 393 |
391 if (m_params.binDisplay == BinDisplay::PeakBins) { | 394 if (m_params.binDisplay == BinDisplay::PeakBins) { |
392 preparedColumn = ColumnOp::peakPick(preparedColumn); | 395 preparedColumn = ColumnOp::peakPick(preparedColumn); |
782 | 785 |
783 // x is the on-canvas pixel coord; sx (later) will be the | 786 // x is the on-canvas pixel coord; sx (later) will be the |
784 // source column index | 787 // source column index |
785 | 788 |
786 ++columnCount; | 789 ++columnCount; |
787 | |
788 #ifdef DEBUG_COLOUR_PLOT_REPAINT | |
789 cerr << "x = " << x << ", binforx[x] = " << binforx[x] << endl; | |
790 #endif | |
791 | 790 |
792 if (binforx[x] < 0) continue; | 791 if (binforx[x] < 0) continue; |
793 | 792 |
794 int sx0 = binforx[x] / divisor; | 793 int sx0 = binforx[x] / divisor; |
795 int sx1 = sx0; | 794 int sx1 = sx0; |
796 if (x+1 < w) sx1 = binforx[x+1] / divisor; | 795 if (x+1 < w) sx1 = binforx[x+1] / divisor; |
797 if (sx0 < 0) sx0 = sx1 - 1; | 796 if (sx0 < 0) sx0 = sx1 - 1; |
798 if (sx0 < 0) continue; | 797 if (sx0 < 0) continue; |
799 if (sx1 <= sx0) sx1 = sx0 + 1; | 798 if (sx1 <= sx0) sx1 = sx0 + 1; |
800 | 799 |
800 #ifdef DEBUG_COLOUR_PLOT_REPAINT | |
801 cerr << "x = " << x << ", binforx[x] = " << binforx[x] << ", sx range " << sx0 << " -> " << sx1 << endl; | |
802 #endif | |
803 | |
801 vector<float> pixelPeakColumn; | 804 vector<float> pixelPeakColumn; |
802 MagnitudeRange magRange; | 805 MagnitudeRange magRange; |
803 | 806 |
804 for (int sx = sx0; sx < sx1; ++sx) { | 807 for (int sx = sx0; sx < sx1; ++sx) { |
805 | |
806 #ifdef DEBUG_COLOUR_PLOT_REPAINT | |
807 cerr << "sx = " << sx << endl; | |
808 #endif | |
809 | 808 |
810 if (sx < 0 || sx >= modelWidth) { | 809 if (sx < 0 || sx >= modelWidth) { |
811 continue; | 810 continue; |
812 } | 811 } |
813 | 812 |
816 // order: | 815 // order: |
817 // get column -> scale -> normalise -> record extents -> | 816 // get column -> scale -> normalise -> record extents -> |
818 // peak pick -> distribute/interpolate -> apply display gain | 817 // peak pick -> distribute/interpolate -> apply display gain |
819 | 818 |
820 // this does the first three: | 819 // this does the first three: |
821 ColumnOp::Column column = getColumn(sx, minbin, nbins); | 820 ColumnOp::Column column = getColumn(sx, minbin, nbins, |
821 usePeaksCache); | |
822 | 822 |
823 magRange.sample(column); | 823 magRange.sample(column); |
824 | 824 |
825 if (m_params.binDisplay == BinDisplay::PeakBins) { | 825 if (m_params.binDisplay == BinDisplay::PeakBins) { |
826 column = ColumnOp::peakPick(column); | 826 column = ColumnOp::peakPick(column); |
958 if (sx < 0 || sx >= modelWidth) { | 958 if (sx < 0 || sx >= modelWidth) { |
959 continue; | 959 continue; |
960 } | 960 } |
961 | 961 |
962 if (sx != psx) { | 962 if (sx != psx) { |
963 preparedColumn = getColumn(sx, minbin, nbins); | 963 preparedColumn = getColumn(sx, minbin, nbins, false); |
964 magRange.sample(preparedColumn); | 964 magRange.sample(preparedColumn); |
965 psx = sx; | 965 psx = sx; |
966 } | 966 } |
967 | 967 |
968 if (sx == sx0) { | 968 if (sx == sx0) { |