comparison view/ViewProxy.h @ 1146:74f2706995b7 3.0-integration

Merge work on unified spectrogram and colour 3d plot caching renderer
author Chris Cannam
date Fri, 05 Aug 2016 15:05:02 +0100
parents 179ea8a2f650
children a34a2a25907c
comparison
equal deleted inserted replaced
1056:b4fd6c67fce5 1146:74f2706995b7
13 */ 13 */
14 14
15 #ifndef VIEW_PROXY_H 15 #ifndef VIEW_PROXY_H
16 #define VIEW_PROXY_H 16 #define VIEW_PROXY_H
17 17
18 #include "LayerGeometryProvider.h" 18 #include "layer/LayerGeometryProvider.h"
19 19
20 class ViewProxy : public LayerGeometryProvider 20 class ViewProxy : public LayerGeometryProvider
21 { 21 {
22 public: 22 public:
23 ViewProxy(View *view, int scaleFactor) : 23 ViewProxy(View *view, int scaleFactor) :
61 double minFreq, double maxFreq, 61 double minFreq, double maxFreq,
62 bool logarithmic) const { 62 bool logarithmic) const {
63 return m_scaleFactor * 63 return m_scaleFactor *
64 m_view->getYForFrequency(frequency, minFreq, maxFreq, logarithmic); 64 m_view->getYForFrequency(frequency, minFreq, maxFreq, logarithmic);
65 } 65 }
66 virtual double getFrequencyForY(int y, double minFreq, double maxFreq, 66 virtual double getFrequencyForY(double y, double minFreq, double maxFreq,
67 bool logarithmic) const { 67 bool logarithmic) const {
68 double f0 = m_view->getFrequencyForY 68 return m_view->getFrequencyForY
69 (y / m_scaleFactor, minFreq, maxFreq, logarithmic); 69 (y / m_scaleFactor, minFreq, maxFreq, logarithmic);
70 if (m_scaleFactor == 1) return f0;
71 double f1 = m_view->getFrequencyForY
72 ((y / m_scaleFactor) + 1, minFreq, maxFreq, logarithmic);
73 return f0 + ((f1 - f0) * (y % m_scaleFactor)) / m_scaleFactor;
74 } 70 }
75 virtual int getTextLabelHeight(const Layer *layer, QPainter &paint) const { 71 virtual int getTextLabelHeight(const Layer *layer, QPainter &paint) const {
76 return m_scaleFactor * m_view->getTextLabelHeight(layer, paint); 72 return m_scaleFactor * m_view->getTextLabelHeight(layer, paint);
77 } 73 }
78 virtual bool getValueExtents(QString unit, double &min, double &max, 74 virtual bool getValueExtents(QString unit, double &min, double &max,
126 122
127 virtual bool shouldShowFeatureLabels() const { 123 virtual bool shouldShowFeatureLabels() const {
128 return m_view->shouldShowFeatureLabels(); 124 return m_view->shouldShowFeatureLabels();
129 } 125 }
130 126
131 virtual void drawVisibleText(QPainter &p, int x, int y,
132 QString text, TextStyle style) const {
133 m_view->drawVisibleText(p, x, y, text, style);
134 }
135
136 virtual void drawMeasurementRect(QPainter &p, const Layer *layer, 127 virtual void drawMeasurementRect(QPainter &p, const Layer *layer,
137 QRect rect, bool focus) const { 128 QRect rect, bool focus) const {
138 m_view->drawMeasurementRect(p, layer, rect, focus); 129 m_view->drawMeasurementRect(p, layer, rect, focus);
139 } 130 }
140 131