Mercurial > hg > svgui
comparison layer/RegionLayer.h @ 997:296ccd36f626 tony-2.0-integration
Merge through to branch for Tony 2.0
author | Chris Cannam |
---|---|
date | Thu, 20 Aug 2015 14:54:21 +0100 |
parents | 4fe7a09be0fe |
children | a34a2a25907c |
comparison
equal
deleted
inserted
replaced
943:788b7623bfca | 997:296ccd36f626 |
---|---|
37 Q_OBJECT | 37 Q_OBJECT |
38 | 38 |
39 public: | 39 public: |
40 RegionLayer(); | 40 RegionLayer(); |
41 | 41 |
42 virtual void paint(View *v, QPainter &paint, QRect rect) const; | 42 virtual void paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const; |
43 | 43 |
44 virtual int getVerticalScaleWidth(View *v, bool, QPainter &) const; | 44 virtual int getVerticalScaleWidth(LayerGeometryProvider *v, bool, QPainter &) const; |
45 virtual void paintVerticalScale(View *v, bool, QPainter &paint, QRect rect) const; | 45 virtual void paintVerticalScale(LayerGeometryProvider *v, bool, QPainter &paint, QRect rect) const; |
46 | 46 |
47 virtual QString getFeatureDescription(View *v, QPoint &) const; | 47 virtual QString getFeatureDescription(LayerGeometryProvider *v, QPoint &) const; |
48 virtual QString getLabelPreceding(sv_frame_t) const; | 48 virtual QString getLabelPreceding(sv_frame_t) const; |
49 | 49 |
50 virtual bool snapToFeatureFrame(View *v, sv_frame_t &frame, | 50 virtual bool snapToFeatureFrame(LayerGeometryProvider *v, sv_frame_t &frame, |
51 int &resolution, | 51 int &resolution, |
52 SnapType snap) const; | 52 SnapType snap) const; |
53 virtual bool snapToSimilarFeature(View *v, sv_frame_t &frame, | 53 virtual bool snapToSimilarFeature(LayerGeometryProvider *v, sv_frame_t &frame, |
54 int &resolution, | 54 int &resolution, |
55 SnapType snap) const; | 55 SnapType snap) const; |
56 | 56 |
57 virtual void drawStart(View *v, QMouseEvent *); | 57 virtual void drawStart(LayerGeometryProvider *v, QMouseEvent *); |
58 virtual void drawDrag(View *v, QMouseEvent *); | 58 virtual void drawDrag(LayerGeometryProvider *v, QMouseEvent *); |
59 virtual void drawEnd(View *v, QMouseEvent *); | 59 virtual void drawEnd(LayerGeometryProvider *v, QMouseEvent *); |
60 | 60 |
61 virtual void eraseStart(View *v, QMouseEvent *); | 61 virtual void eraseStart(LayerGeometryProvider *v, QMouseEvent *); |
62 virtual void eraseDrag(View *v, QMouseEvent *); | 62 virtual void eraseDrag(LayerGeometryProvider *v, QMouseEvent *); |
63 virtual void eraseEnd(View *v, QMouseEvent *); | 63 virtual void eraseEnd(LayerGeometryProvider *v, QMouseEvent *); |
64 | 64 |
65 virtual void editStart(View *v, QMouseEvent *); | 65 virtual void editStart(LayerGeometryProvider *v, QMouseEvent *); |
66 virtual void editDrag(View *v, QMouseEvent *); | 66 virtual void editDrag(LayerGeometryProvider *v, QMouseEvent *); |
67 virtual void editEnd(View *v, QMouseEvent *); | 67 virtual void editEnd(LayerGeometryProvider *v, QMouseEvent *); |
68 | 68 |
69 virtual bool editOpen(View *v, QMouseEvent *); | 69 virtual bool editOpen(LayerGeometryProvider *v, QMouseEvent *); |
70 | 70 |
71 virtual void moveSelection(Selection s, sv_frame_t newStartFrame); | 71 virtual void moveSelection(Selection s, sv_frame_t newStartFrame); |
72 virtual void resizeSelection(Selection s, Selection newSize); | 72 virtual void resizeSelection(Selection s, Selection newSize); |
73 virtual void deleteSelection(Selection s); | 73 virtual void deleteSelection(Selection s); |
74 | 74 |
75 virtual void copy(View *v, Selection s, Clipboard &to); | 75 virtual void copy(LayerGeometryProvider *v, Selection s, Clipboard &to); |
76 virtual bool paste(View *v, const Clipboard &from, sv_frame_t frameOffset, | 76 virtual bool paste(LayerGeometryProvider *v, const Clipboard &from, sv_frame_t frameOffset, |
77 bool interactive); | 77 bool interactive); |
78 | 78 |
79 virtual const Model *getModel() const { return m_model; } | 79 virtual const Model *getModel() const { return m_model; } |
80 void setModel(RegionModel *model); | 80 void setModel(RegionModel *model); |
81 | 81 |
108 }; | 108 }; |
109 | 109 |
110 void setPlotStyle(PlotStyle style); | 110 void setPlotStyle(PlotStyle style); |
111 PlotStyle getPlotStyle() const { return m_plotStyle; } | 111 PlotStyle getPlotStyle() const { return m_plotStyle; } |
112 | 112 |
113 virtual bool isLayerScrollable(const View *v) const; | 113 virtual bool isLayerScrollable(const LayerGeometryProvider *v) const; |
114 | 114 |
115 virtual bool isLayerEditable() const { return true; } | 115 virtual bool isLayerEditable() const { return true; } |
116 | 116 |
117 virtual int getCompletion(View *) const { return m_model->getCompletion(); } | 117 virtual int getCompletion(LayerGeometryProvider *) const { return m_model->getCompletion(); } |
118 | 118 |
119 virtual bool getValueExtents(double &min, double &max, | 119 virtual bool getValueExtents(double &min, double &max, |
120 bool &log, QString &unit) const; | 120 bool &log, QString &unit) const; |
121 | 121 |
122 virtual bool getDisplayExtents(double &min, double &max) const; | 122 virtual bool getDisplayExtents(double &min, double &max) const; |
125 QString extraAttributes = "") const; | 125 QString extraAttributes = "") const; |
126 | 126 |
127 void setProperties(const QXmlAttributes &attributes); | 127 void setProperties(const QXmlAttributes &attributes); |
128 | 128 |
129 /// VerticalScaleLayer and ColourScaleLayer methods | 129 /// VerticalScaleLayer and ColourScaleLayer methods |
130 int getYForValue(View *v, double value) const; | 130 int getYForValue(LayerGeometryProvider *v, double value) const; |
131 double getValueForY(View *v, int y) const; | 131 double getValueForY(LayerGeometryProvider *v, int y) const; |
132 virtual QString getScaleUnits() const; | 132 virtual QString getScaleUnits() const; |
133 QColor getColourForValue(View *v, double value) const; | 133 QColor getColourForValue(LayerGeometryProvider *v, double value) const; |
134 | 134 |
135 protected slots: | 135 protected slots: |
136 void recalcSpacing(); | 136 void recalcSpacing(); |
137 | 137 |
138 protected: | 138 protected: |
139 double getValueForY(View *v, int y, int avoid) const; | 139 double getValueForY(LayerGeometryProvider *v, int y, int avoid) const; |
140 void getScaleExtents(View *, double &min, double &max, bool &log) const; | 140 void getScaleExtents(LayerGeometryProvider *, double &min, double &max, bool &log) const; |
141 | 141 |
142 virtual int getDefaultColourHint(bool dark, bool &impose); | 142 virtual int getDefaultColourHint(bool dark, bool &impose); |
143 | 143 |
144 RegionModel::PointList getLocalPoints(View *v, int x) const; | 144 RegionModel::PointList getLocalPoints(LayerGeometryProvider *v, int x) const; |
145 | 145 |
146 bool getPointToDrag(View *v, int x, int y, RegionModel::Point &) const; | 146 bool getPointToDrag(LayerGeometryProvider *v, int x, int y, RegionModel::Point &) const; |
147 | 147 |
148 RegionModel *m_model; | 148 RegionModel *m_model; |
149 bool m_editing; | 149 bool m_editing; |
150 int m_dragPointX; | 150 int m_dragPointX; |
151 int m_dragPointY; | 151 int m_dragPointY; |
164 SpacingMap m_spacingMap; | 164 SpacingMap m_spacingMap; |
165 | 165 |
166 // region value -> number of regions with this value | 166 // region value -> number of regions with this value |
167 SpacingMap m_distributionMap; | 167 SpacingMap m_distributionMap; |
168 | 168 |
169 int spacingIndexToY(View *v, int i) const; | 169 int spacingIndexToY(LayerGeometryProvider *v, int i) const; |
170 double yToSpacingIndex(View *v, int y) const; | 170 double yToSpacingIndex(LayerGeometryProvider *v, int y) const; |
171 | 171 |
172 void finish(RegionModel::EditCommand *command) { | 172 void finish(RegionModel::EditCommand *command) { |
173 Command *c = command->finish(); | 173 Command *c = command->finish(); |
174 if (c) CommandHistory::getInstance()->addCommand(c, false); | 174 if (c) CommandHistory::getInstance()->addCommand(c, false); |
175 } | 175 } |