comparison layer/VerticalBinLayer.h @ 1085:179ea8a2f650 spectrogram-minor-refactor

Add VerticalBinLayer to SpectrogramLayer
author Chris Cannam
date Fri, 01 Jul 2016 17:54:31 +0100
parents 7122aae95a88
children 67dd16e33a3d
comparison
equal deleted inserted replaced
1084:db976e9f385a 1085:179ea8a2f650
34 virtual double getYForBin(LayerGeometryProvider *, double bin) const = 0; 34 virtual double getYForBin(LayerGeometryProvider *, double bin) const = 0;
35 35
36 /** 36 /**
37 * As getYForBin, but rounding to integer values. 37 * As getYForBin, but rounding to integer values.
38 */ 38 */
39 virtual int getIYForBin(LayerGeometryProvider *, int bin) const = 0; 39 virtual int getIYForBin(LayerGeometryProvider *v, int bin) const {
40 return int(round(getYForBin(v, bin)));
41 }
40 42
41 /** 43 /**
42 * Return the bin number, possibly fractional, at the given y 44 * Return the bin number, possibly fractional, at the given y
43 * coordinate. Note that the whole numbers occur at the positions 45 * coordinate. Note that the whole numbers occur at the positions
44 * at which the bins "start" (i.e. the bottom of the visible bin, 46 * at which the bins "start" (i.e. the bottom of the visible bin,
47 virtual double getBinForY(LayerGeometryProvider *, double y) const = 0; 49 virtual double getBinForY(LayerGeometryProvider *, double y) const = 0;
48 50
49 /** 51 /**
50 * As getBinForY, but rounding to integer values. 52 * As getBinForY, but rounding to integer values.
51 */ 53 */
52 virtual int getIBinForY(LayerGeometryProvider *, int y) const = 0; 54 virtual int getIBinForY(LayerGeometryProvider *v, int y) const {
55 return int(floor(getBinForY(v, y)));
56 }
53 }; 57 };
54 58
55 #endif 59 #endif
56 60