Mercurial > hg > svgui
comparison layer/RegionLayer.h @ 701:084f65094203
Extend numerical and colour scales (and piano where applicable) to note and region layers
author | Chris Cannam |
---|---|
date | Wed, 04 Dec 2013 13:39:41 +0000 |
parents | 5b72899d692b |
children | 1d526ba11a24 |
comparison
equal
deleted
inserted
replaced
700:7846175403f1 | 701:084f65094203 |
---|---|
15 | 15 |
16 #ifndef _REGION_LAYER_H_ | 16 #ifndef _REGION_LAYER_H_ |
17 #define _REGION_LAYER_H_ | 17 #define _REGION_LAYER_H_ |
18 | 18 |
19 #include "SingleColourLayer.h" | 19 #include "SingleColourLayer.h" |
20 #include "VerticalScaleLayer.h" | |
21 #include "ColourScaleLayer.h" | |
22 | |
20 #include "data/model/RegionModel.h" | 23 #include "data/model/RegionModel.h" |
21 | 24 |
22 #include <QObject> | 25 #include <QObject> |
23 #include <QColor> | 26 #include <QColor> |
24 | 27 |
25 #include <map> | 28 #include <map> |
26 | 29 |
27 class View; | 30 class View; |
28 class QPainter; | 31 class QPainter; |
29 | 32 |
30 class RegionLayer : public SingleColourLayer | 33 class RegionLayer : public SingleColourLayer, |
34 public VerticalScaleLayer, | |
35 public ColourScaleLayer | |
31 { | 36 { |
32 Q_OBJECT | 37 Q_OBJECT |
33 | 38 |
34 public: | 39 public: |
35 RegionLayer(); | 40 RegionLayer(); |
36 | 41 |
37 virtual void paint(View *v, QPainter &paint, QRect rect) const; | 42 virtual void paint(View *v, QPainter &paint, QRect rect) const; |
43 | |
44 virtual int getVerticalScaleWidth(View *v, bool, QPainter &) const; | |
45 virtual void paintVerticalScale(View *v, bool, QPainter &paint, QRect rect) const; | |
38 | 46 |
39 virtual QString getFeatureDescription(View *v, QPoint &) const; | 47 virtual QString getFeatureDescription(View *v, QPoint &) const; |
40 virtual QString getLabelPreceding(size_t) const; | 48 virtual QString getLabelPreceding(size_t) const; |
41 | 49 |
42 virtual bool snapToFeatureFrame(View *v, int &frame, | 50 virtual bool snapToFeatureFrame(View *v, int &frame, |
114 virtual bool getDisplayExtents(float &min, float &max) const; | 122 virtual bool getDisplayExtents(float &min, float &max) const; |
115 | 123 |
116 virtual void toXml(QTextStream &stream, QString indent = "", | 124 virtual void toXml(QTextStream &stream, QString indent = "", |
117 QString extraAttributes = "") const; | 125 QString extraAttributes = "") const; |
118 | 126 |
119 virtual int getVerticalScaleWidth(View *, bool, QPainter &) const { return 0; } | 127 void setProperties(const QXmlAttributes &attributes); |
120 | 128 |
121 void setProperties(const QXmlAttributes &attributes); | 129 /// VerticalScaleLayer and ColourScaleLayer methods |
130 int getYForValue(View *v, float value) const; | |
131 float getValueForY(View *v, int y) const; | |
132 virtual QString getScaleUnits() const; | |
133 QColor getColourForValue(View *v, float value) const; | |
122 | 134 |
123 protected slots: | 135 protected slots: |
124 void recalcSpacing(); | 136 void recalcSpacing(); |
125 | 137 |
126 protected: | 138 protected: |
139 float getValueForY(View *v, int y, int avoid) const; | |
127 void getScaleExtents(View *, float &min, float &max, bool &log) const; | 140 void getScaleExtents(View *, float &min, float &max, bool &log) const; |
128 int getYForValue(View *v, float value) const; | |
129 float getValueForY(View *v, int y, int avoid = -1) const; | |
130 QColor getColourForValue(View *v, float value) const; | |
131 | 141 |
132 virtual int getDefaultColourHint(bool dark, bool &impose); | 142 virtual int getDefaultColourHint(bool dark, bool &impose); |
133 | 143 |
134 RegionModel::PointList getLocalPoints(View *v, int x) const; | 144 RegionModel::PointList getLocalPoints(View *v, int x) const; |
135 | 145 |