Mercurial > hg > svgui
comparison layer/RegionLayer.h @ 433:ac349afdb23f
* somewhat clearer layout in region layer
author | Chris Cannam |
---|---|
date | Thu, 16 Oct 2008 13:38:33 +0000 |
parents | 1304dbe4542e |
children | 5930f2b0b1d2 |
comparison
equal
deleted
inserted
replaced
432:8b2b497d302c | 433:ac349afdb23f |
---|---|
19 #include "SingleColourLayer.h" | 19 #include "SingleColourLayer.h" |
20 #include "data/model/RegionModel.h" | 20 #include "data/model/RegionModel.h" |
21 | 21 |
22 #include <QObject> | 22 #include <QObject> |
23 #include <QColor> | 23 #include <QColor> |
24 | |
25 #include <map> | |
24 | 26 |
25 class View; | 27 class View; |
26 class QPainter; | 28 class QPainter; |
27 | 29 |
28 class RegionLayer : public SingleColourLayer | 30 class RegionLayer : public SingleColourLayer |
78 void setFillColourMap(int); | 80 void setFillColourMap(int); |
79 int getFillColourMap() const { return m_colourMap; } | 81 int getFillColourMap() const { return m_colourMap; } |
80 | 82 |
81 enum VerticalScale { | 83 enum VerticalScale { |
82 AutoAlignScale, | 84 AutoAlignScale, |
85 EqualSpaced, | |
83 LinearScale, | 86 LinearScale, |
84 LogScale, | 87 LogScale, |
85 }; | 88 }; |
86 | 89 |
87 void setVerticalScale(VerticalScale scale); | 90 void setVerticalScale(VerticalScale scale); |
109 virtual void toXml(QTextStream &stream, QString indent = "", | 112 virtual void toXml(QTextStream &stream, QString indent = "", |
110 QString extraAttributes = "") const; | 113 QString extraAttributes = "") const; |
111 | 114 |
112 void setProperties(const QXmlAttributes &attributes); | 115 void setProperties(const QXmlAttributes &attributes); |
113 | 116 |
117 protected slots: | |
118 void recalcSpacing(); | |
119 | |
114 protected: | 120 protected: |
115 void getScaleExtents(View *, float &min, float &max, bool &log) const; | 121 void getScaleExtents(View *, float &min, float &max, bool &log) const; |
116 int getYForValue(View *v, float value) const; | 122 int getYForValue(View *v, float value) const; |
117 float getValueForY(View *v, int y) const; | 123 float getValueForY(View *v, int y) const; |
118 QColor getColourForValue(View *v, float value) const; | 124 QColor getColourForValue(View *v, float value) const; |
128 RegionModel::EditCommand *m_editingCommand; | 134 RegionModel::EditCommand *m_editingCommand; |
129 VerticalScale m_verticalScale; | 135 VerticalScale m_verticalScale; |
130 int m_colourMap; | 136 int m_colourMap; |
131 PlotStyle m_plotStyle; | 137 PlotStyle m_plotStyle; |
132 | 138 |
139 typedef std::map<float, int> SpacingMap; | |
140 SpacingMap m_spacingMap; | |
141 | |
133 void finish(RegionModel::EditCommand *command) { | 142 void finish(RegionModel::EditCommand *command) { |
134 Command *c = command->finish(); | 143 Command *c = command->finish(); |
135 if (c) CommandHistory::getInstance()->addCommand(c, false); | 144 if (c) CommandHistory::getInstance()->addCommand(c, false); |
136 } | 145 } |
137 }; | 146 }; |