comparison layer/Colour3DPlotLayer.cpp @ 1085:179ea8a2f650 spectrogram-minor-refactor

Add VerticalBinLayer to SpectrogramLayer
author Chris Cannam
date Fri, 01 Jul 2016 17:54:31 +0100
parents ee01a4062747
children 5c6271734790
comparison
equal deleted inserted replaced
1084:db976e9f385a 1085:179ea8a2f650
668 y = h - (((LogRange::map(bin + 1) - logmin) * h) / (logmax - logmin)); 668 y = h - (((LogRange::map(bin + 1) - logmin) * h) / (logmax - logmin));
669 } 669 }
670 return y; 670 return y;
671 } 671 }
672 672
673 int
674 Colour3DPlotLayer::getIYForBin(LayerGeometryProvider *v, int bin) const
675 {
676 return int(round(getYForBin(v, bin)));
677 }
678
679 double 673 double
680 Colour3DPlotLayer::getBinForY(LayerGeometryProvider *v, double y) const 674 Colour3DPlotLayer::getBinForY(LayerGeometryProvider *v, double y) const
681 { 675 {
682 double bin = y; 676 double bin = y;
683 if (!m_model) return bin; 677 if (!m_model) return bin;
690 double logmin = mn + 1, logmax = mx + 1; 684 double logmin = mn + 1, logmax = mx + 1;
691 LogRange::mapRange(logmin, logmax); 685 LogRange::mapRange(logmin, logmax);
692 bin = LogRange::unmap(logmin + ((h - y) * (logmax - logmin)) / h) - 1; 686 bin = LogRange::unmap(logmin + ((h - y) * (logmax - logmin)) / h) - 1;
693 } 687 }
694 return bin; 688 return bin;
695 }
696
697 int
698 Colour3DPlotLayer::getIBinForY(LayerGeometryProvider *v, int y) const
699 {
700 return int(floor(getBinForY(v, y)));
701 } 689 }
702 690
703 QString 691 QString
704 Colour3DPlotLayer::getFeatureDescription(LayerGeometryProvider *v, QPoint &pos) const 692 Colour3DPlotLayer::getFeatureDescription(LayerGeometryProvider *v, QPoint &pos) const
705 { 693 {