comparison layer/SliceLayer.h @ 1238:4d0ca1ab4cd0

Some work to make spectrum layers (and slice layers generally) zoomable in the frequency axis. Also fixes a number of view id mixups in SliceLayer which broke offset calculations for the x axis scale.
author Chris Cannam
date Tue, 07 Feb 2017 14:55:19 +0000
parents 4fe7a09be0fe
children a34a2a25907c
comparison
equal deleted inserted replaced
1237:2cc9e0e5df51 1238:4d0ca1ab4cd0
63 virtual void setProperties(const QXmlAttributes &); 63 virtual void setProperties(const QXmlAttributes &);
64 64
65 virtual bool getValueExtents(double &min, double &max, 65 virtual bool getValueExtents(double &min, double &max,
66 bool &logarithmic, QString &unit) const; 66 bool &logarithmic, QString &unit) const;
67 67
68 virtual bool getDisplayExtents(double &min, double &max) const;
69 virtual bool setDisplayExtents(double min, double max);
70
71 virtual int getVerticalZoomSteps(int &defaultStep) const;
72 virtual int getCurrentVerticalZoomStep() const;
73 virtual void setVerticalZoomStep(int);
74 virtual RangeMapper *getNewVerticalZoomRangeMapper() const;
75
68 virtual bool hasTimeXAxis() const { return false; } 76 virtual bool hasTimeXAxis() const { return false; }
69 77
70 virtual bool isLayerScrollable(const LayerGeometryProvider *) const { return false; } 78 virtual bool isLayerScrollable(const LayerGeometryProvider *) const { return false; }
71 79
72 enum EnergyScale { LinearScale, MeterScale, dBScale, AbsoluteScale }; 80 enum EnergyScale { LinearScale, MeterScale, dBScale, AbsoluteScale };
107 public slots: 115 public slots:
108 void sliceableModelReplaced(const Model *, const Model *); 116 void sliceableModelReplaced(const Model *, const Model *);
109 void modelAboutToBeDeleted(Model *); 117 void modelAboutToBeDeleted(Model *);
110 118
111 protected: 119 protected:
112 virtual double getXForBin(int bin, int totalBins, double w) const; 120 virtual double getXForBin(const LayerGeometryProvider *, double bin) const;
113 virtual int getBinForX(double x, int totalBins, double w) const; 121 virtual double getBinForX(const LayerGeometryProvider *, double x) const;
114 122
115 virtual double getYForValue(double value, const LayerGeometryProvider *v, double &norm) const; 123 virtual double getYForValue(const LayerGeometryProvider *v, double value, double &norm) const;
116 virtual double getValueForY(double y, const LayerGeometryProvider *v) const; 124 virtual double getValueForY(const LayerGeometryProvider *v, double y) const;
117 125
118 virtual QString getFeatureDescriptionAux(LayerGeometryProvider *v, QPoint &, 126 virtual QString getFeatureDescriptionAux(LayerGeometryProvider *v, QPoint &,
119 bool includeBinDescription, 127 bool includeBinDescription,
120 int &minbin, int &maxbin, 128 int &minbin, int &maxbin,
121 int &range) const; 129 int &range) const;
138 BinScale m_binScale; 146 BinScale m_binScale;
139 bool m_normalize; 147 bool m_normalize;
140 float m_threshold; 148 float m_threshold;
141 float m_initialThreshold; 149 float m_initialThreshold;
142 float m_gain; 150 float m_gain;
151 int m_minbin;
152 int m_maxbin;
143 mutable std::vector<int> m_scalePoints; 153 mutable std::vector<int> m_scalePoints;
144 mutable std::map<const LayerGeometryProvider *, int> m_xorigins; 154 mutable std::map<int, int> m_xorigins; // LayerGeometryProvider id -> x
145 mutable std::map<const LayerGeometryProvider *, int> m_yorigins; 155 mutable std::map<int, int> m_yorigins; // LayerGeometryProvider id -> y
146 mutable std::map<const LayerGeometryProvider *, int> m_heights; 156 mutable std::map<int, int> m_heights; // LayerGeometryProvider id -> h
147 mutable sv_frame_t m_currentf0; 157 mutable sv_frame_t m_currentf0;
148 mutable sv_frame_t m_currentf1; 158 mutable sv_frame_t m_currentf1;
149 mutable std::vector<float> m_values; 159 mutable std::vector<float> m_values;
150 }; 160 };
151 161