Mercurial > hg > svgui
comparison layer/Colour3DPlotRenderer.cpp @ 1170:958e352919a5 3.0-integration
Avoid rounding error giving too few bins in column request
author | Chris Cannam |
---|---|
date | Wed, 23 Nov 2016 10:39:32 +0000 |
parents | 236ecb2c0758 |
children | 84042e8c3c03 |
comparison
equal
deleted
inserted
replaced
1169:b5c88c448ca2 | 1170:958e352919a5 |
---|---|
29 | 29 |
30 #include "view/ViewManager.h" // for main model sample rate. Pity | 30 #include "view/ViewManager.h" // for main model sample rate. Pity |
31 | 31 |
32 #include <vector> | 32 #include <vector> |
33 | 33 |
34 #define DEBUG_COLOUR_PLOT_REPAINT 1 | 34 //#define DEBUG_COLOUR_PLOT_REPAINT 1 |
35 | 35 |
36 using namespace std; | 36 using namespace std; |
37 | 37 |
38 Colour3DPlotRenderer::RenderResult | 38 Colour3DPlotRenderer::RenderResult |
39 Colour3DPlotRenderer::render(const LayerGeometryProvider *v, QPainter &paint, QRect rect) | 39 Colour3DPlotRenderer::render(const LayerGeometryProvider *v, QPainter &paint, QRect rect) |
811 | 811 |
812 int minbin = int(binfory[0] + 0.0001); | 812 int minbin = int(binfory[0] + 0.0001); |
813 if (minbin >= sh) minbin = sh - 1; | 813 if (minbin >= sh) minbin = sh - 1; |
814 if (minbin < 0) minbin = 0; | 814 if (minbin < 0) minbin = 0; |
815 | 815 |
816 int nbins = int(binfory[h-1]) - minbin + 1; | 816 int nbins = int(binfory[h-1] + 0.0001) - minbin + 1; |
817 if (minbin + nbins > sh) nbins = sh - minbin; | 817 if (minbin + nbins > sh) nbins = sh - minbin; |
818 | 818 |
819 #ifdef DEBUG_COLOUR_PLOT_REPAINT | 819 #ifdef DEBUG_COLOUR_PLOT_REPAINT |
820 cerr << "minbin = " << minbin << ", nbins = " << nbins << ", last binfory = " | 820 cerr << "minbin = " << minbin << ", nbins = " << nbins << ", last binfory = " |
821 << binfory[h-1] << " (model height " << sh << ")" << endl; | 821 << binfory[h-1] << " (rounds to " << int(binfory[h-1]) << ") (model height " << sh << ")" << endl; |
822 #endif | 822 #endif |
823 | 823 |
824 int psx = -1; | 824 int psx = -1; |
825 | 825 |
826 int start = 0; | 826 int start = 0; |