comparison layer/RegionLayer.h @ 905:b66fb15de477 cxx11

Working through the float/double and int/sv_frame_t fixes
author Chris Cannam
date Mon, 09 Mar 2015 14:35:21 +0000
parents 1d526ba11a24
children 251dd0abc7b7
comparison
equal deleted inserted replaced
904:e0f08e108064 905:b66fb15de477
45 virtual void paintVerticalScale(View *v, bool, QPainter &paint, QRect rect) const; 45 virtual void paintVerticalScale(View *v, bool, QPainter &paint, QRect rect) const;
46 46
47 virtual QString getFeatureDescription(View *v, QPoint &) const; 47 virtual QString getFeatureDescription(View *v, QPoint &) const;
48 virtual QString getLabelPreceding(int) const; 48 virtual QString getLabelPreceding(int) const;
49 49
50 virtual bool snapToFeatureFrame(View *v, int &frame, 50 virtual bool snapToFeatureFrame(View *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, int &frame, 53 virtual bool snapToSimilarFeature(View *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(View *v, QMouseEvent *);
58 virtual void drawDrag(View *v, QMouseEvent *); 58 virtual void drawDrag(View *v, QMouseEvent *);
66 virtual void editDrag(View *v, QMouseEvent *); 66 virtual void editDrag(View *v, QMouseEvent *);
67 virtual void editEnd(View *v, QMouseEvent *); 67 virtual void editEnd(View *v, QMouseEvent *);
68 68
69 virtual bool editOpen(View *v, QMouseEvent *); 69 virtual bool editOpen(View *v, QMouseEvent *);
70 70
71 virtual void moveSelection(Selection s, int 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(View *v, Selection s, Clipboard &to);
76 virtual bool paste(View *v, const Clipboard &from, int frameOffset, 76 virtual bool paste(View *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
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(View *) const { return m_model->getCompletion(); }
118 118
119 virtual bool getValueExtents(float &min, float &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(float &min, float &max) const; 122 virtual bool getDisplayExtents(double &min, double &max) const;
123 123
124 virtual void toXml(QTextStream &stream, QString indent = "", 124 virtual void toXml(QTextStream &stream, QString indent = "",
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, float value) const; 130 int getYForValue(View *v, double value) const;
131 float getValueForY(View *v, int y) const; 131 double getValueForY(View *v, int y) const;
132 virtual QString getScaleUnits() const; 132 virtual QString getScaleUnits() const;
133 QColor getColourForValue(View *v, float value) const; 133 QColor getColourForValue(View *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 float getValueForY(View *v, int y, int avoid) const; 139 double getValueForY(View *v, int y, int avoid) const;
140 void getScaleExtents(View *, float &min, float &max, bool &log) const; 140 void getScaleExtents(View *, 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(View *v, int x) const;
145 145
156 RegionModel::EditCommand *m_editingCommand; 156 RegionModel::EditCommand *m_editingCommand;
157 VerticalScale m_verticalScale; 157 VerticalScale m_verticalScale;
158 int m_colourMap; 158 int m_colourMap;
159 PlotStyle m_plotStyle; 159 PlotStyle m_plotStyle;
160 160
161 typedef std::map<float, int> SpacingMap; 161 typedef std::map<double, int> SpacingMap;
162 162
163 // region value -> ordering 163 // region value -> ordering
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(View *v, int i) const;
170 float yToSpacingIndex(View *v, int y) const; 170 double yToSpacingIndex(View *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 }