Mercurial > hg > svgui
comparison layer/SliceLayer.h @ 1324:13d9b422f7fe zoom
Merge from default branch
author | Chris Cannam |
---|---|
date | Mon, 17 Sep 2018 13:51:31 +0100 |
parents | 51e6125627fa |
children | d79e21855aef |
comparison
equal
deleted
inserted
replaced
1183:57d192e26331 | 1324:13d9b422f7fe |
---|---|
11 published by the Free Software Foundation; either version 2 of the | 11 published by the Free Software Foundation; either version 2 of the |
12 License, or (at your option) any later version. See the file | 12 License, or (at your option) any later version. See the file |
13 COPYING included with this distribution for more information. | 13 COPYING included with this distribution for more information. |
14 */ | 14 */ |
15 | 15 |
16 #ifndef _SLICE_LAYER_H_ | 16 #ifndef SV_SLICE_LAYER_H |
17 #define _SLICE_LAYER_H_ | 17 #define SV_SLICE_LAYER_H |
18 | 18 |
19 #include "SingleColourLayer.h" | 19 #include "SingleColourLayer.h" |
20 | 20 |
21 #include "base/Window.h" | 21 #include "base/Window.h" |
22 | 22 |
30 | 30 |
31 public: | 31 public: |
32 SliceLayer(); | 32 SliceLayer(); |
33 ~SliceLayer(); | 33 ~SliceLayer(); |
34 | 34 |
35 // virtual void setModel(const Model *model); | |
36 // virtual const Model *getModel() const { return m_model; } | |
37 virtual const Model *getModel() const { return 0; } | 35 virtual const Model *getModel() const { return 0; } |
38 | 36 |
39 void setSliceableModel(const Model *model); | 37 void setSliceableModel(const Model *model); |
40 | 38 |
41 virtual void paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const; | 39 virtual void paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const; |
47 | 45 |
48 virtual ColourSignificance getLayerColourSignificance() const { | 46 virtual ColourSignificance getLayerColourSignificance() const { |
49 return ColourAndBackgroundSignificant; | 47 return ColourAndBackgroundSignificant; |
50 } | 48 } |
51 | 49 |
50 virtual bool hasLightBackground() const; | |
51 | |
52 virtual PropertyList getProperties() const; | 52 virtual PropertyList getProperties() const; |
53 virtual QString getPropertyLabel(const PropertyName &) const; | 53 virtual QString getPropertyLabel(const PropertyName &) const; |
54 virtual QString getPropertyIconName(const PropertyName &) const; | 54 virtual QString getPropertyIconName(const PropertyName &) const; |
55 virtual PropertyType getPropertyType(const PropertyName &) const; | 55 virtual PropertyType getPropertyType(const PropertyName &) const; |
56 virtual QString getPropertyGroupName(const PropertyName &) const; | 56 virtual QString getPropertyGroupName(const PropertyName &) const; |
57 virtual int getPropertyRangeAndValue(const PropertyName &, | 57 virtual int getPropertyRangeAndValue(const PropertyName &, |
58 int *min, int *max, int *deflt) const; | 58 int *min, int *max, int *deflt) const; |
59 virtual QString getPropertyValueLabel(const PropertyName &, | 59 virtual QString getPropertyValueLabel(const PropertyName &, |
60 int value) const; | 60 int value) const; |
61 virtual RangeMapper *getNewPropertyRangeMapper(const PropertyName &) const; | 61 virtual RangeMapper *getNewPropertyRangeMapper(const PropertyName &) const; |
62 virtual void setProperty(const PropertyName &, int value); | 62 virtual void setProperty(const PropertyName &, int value); |
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 | |
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; | |
67 | 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 |
75 | 83 |
76 enum PlotStyle { PlotLines, PlotSteps, PlotBlocks, PlotFilledBlocks }; | 84 enum PlotStyle { PlotLines, PlotSteps, PlotBlocks, PlotFilledBlocks }; |
77 | 85 |
78 enum BinScale { LinearBins, LogBins, InvertedLogBins }; | 86 enum BinScale { LinearBins, LogBins, InvertedLogBins }; |
79 | 87 |
88 bool usesSolidColour() const { return m_plotStyle == PlotFilledBlocks; } | |
89 | |
80 void setFillColourMap(int); | 90 void setFillColourMap(int); |
81 int getFillColourMap() const { return m_colourMap; } | 91 int getFillColourMap() const { return m_colourMap; } |
82 | 92 |
83 void setEnergyScale(EnergyScale); | 93 void setEnergyScale(EnergyScale); |
84 EnergyScale getEnergyScale() const { return m_energyScale; } | 94 EnergyScale getEnergyScale() const { return m_energyScale; } |
107 public slots: | 117 public slots: |
108 void sliceableModelReplaced(const Model *, const Model *); | 118 void sliceableModelReplaced(const Model *, const Model *); |
109 void modelAboutToBeDeleted(Model *); | 119 void modelAboutToBeDeleted(Model *); |
110 | 120 |
111 protected: | 121 protected: |
112 virtual double getXForBin(int bin, int totalBins, double w) const; | 122 virtual double getXForBin(const LayerGeometryProvider *, double bin) const; |
113 virtual int getBinForX(double x, int totalBins, double w) const; | 123 virtual double getBinForX(const LayerGeometryProvider *, double x) const; |
114 | 124 |
115 virtual double getYForValue(double value, const LayerGeometryProvider *v, double &norm) const; | 125 virtual double getYForValue(const LayerGeometryProvider *v, double value, double &norm) const; |
116 virtual double getValueForY(double y, const LayerGeometryProvider *v) const; | 126 virtual double getValueForY(const LayerGeometryProvider *v, double y) const; |
117 | 127 |
118 virtual QString getFeatureDescriptionAux(LayerGeometryProvider *v, QPoint &, | 128 virtual QString getFeatureDescriptionAux(LayerGeometryProvider *v, QPoint &, |
119 bool includeBinDescription, | 129 bool includeBinDescription, |
120 int &minbin, int &maxbin, | 130 int &minbin, int &maxbin, |
121 int &range) const; | 131 int &range) const; |
138 BinScale m_binScale; | 148 BinScale m_binScale; |
139 bool m_normalize; | 149 bool m_normalize; |
140 float m_threshold; | 150 float m_threshold; |
141 float m_initialThreshold; | 151 float m_initialThreshold; |
142 float m_gain; | 152 float m_gain; |
153 int m_minbin; | |
154 int m_maxbin; | |
143 mutable std::vector<int> m_scalePoints; | 155 mutable std::vector<int> m_scalePoints; |
144 mutable std::map<const LayerGeometryProvider *, int> m_xorigins; | 156 mutable int m_scalePaintHeight; |
145 mutable std::map<const LayerGeometryProvider *, int> m_yorigins; | 157 mutable std::map<int, int> m_xorigins; // LayerGeometryProvider id -> x |
146 mutable std::map<const LayerGeometryProvider *, int> m_heights; | 158 mutable std::map<int, int> m_yorigins; // LayerGeometryProvider id -> y |
159 mutable std::map<int, int> m_heights; // LayerGeometryProvider id -> h | |
147 mutable sv_frame_t m_currentf0; | 160 mutable sv_frame_t m_currentf0; |
148 mutable sv_frame_t m_currentf1; | 161 mutable sv_frame_t m_currentf1; |
149 mutable std::vector<float> m_values; | 162 mutable std::vector<float> m_values; |
150 }; | 163 }; |
151 | 164 |