comparison base/Layer.h @ 23:6ace4286ba06

* Rationalise the local feature identification API in Layer subclasses * Add segmentation mode to TimeInstantLayer
author Chris Cannam
date Mon, 06 Feb 2006 17:24:52 +0000
parents 742e6882e187
children bb9291d84810
comparison
equal deleted inserted replaced
22:a1a6acb7cd37 23:6ace4286ba06
70 //!!! We also need a method (like the vertical scale method) for 70 //!!! We also need a method (like the vertical scale method) for
71 //drawing additional scales like a colour scale. That is, unless 71 //drawing additional scales like a colour scale. That is, unless
72 //all applicable layers can actually do this from 72 //all applicable layers can actually do this from
73 //paintVerticalScale as well? 73 //paintVerticalScale as well?
74 74
75 // Select mode: 75 enum SnapType {
76 // 76 SnapLeft,
77 //!!! Next, a method that gets the frame of the nearest feature in 77 SnapRight,
78 //a particular snap direction. This would be used for selection 78 SnapNearest,
79 //mode, where we're selecting from the waveform based on feature 79 SnapNeighbouring
80 //location. Do we need multi-select on features as well? This is 80 };
81 //an issue; if you select a feature are you selecting that feature 81
82 //(in which case what do you do with it?) or a section of the 82 /**
83 //underlying waveform? 83 * Adjust the given frame to snap to the nearest feature, if
84 84 * possible.
85 virtual int getNearestFeatureFrame(int frame, 85 *
86 size_t &resolution, 86 * If snap is SnapLeft or SnapRight, adjust the frame to match
87 bool snapRight = true) const { 87 * that of the nearest feature in the given direction regardless
88 * of how far away it is. If snap is SnapNearest, adjust the
89 * frame to that of the nearest feature in either direction. If
90 * snap is SnapNeighbouring, adjust the frame to that of the
91 * nearest feature if it is close, and leave it alone (returning
92 * false) otherwise. SnapNeighbouring should always choose the
93 * same feature that would be used in an editing operation through
94 * calls to editStart etc.
95 *
96 * Return true if a suitable feature was found and frame adjusted
97 * accordingly. Return false if no suitable feature was
98 * available. Also return the resolution of the model in this
99 * layer in sample frames.
100 */
101 virtual bool snapToFeatureFrame(int &frame,
102 size_t &resolution,
103 SnapType snap) const {
88 resolution = 1; 104 resolution = 1;
89 return frame; 105 return false;
90 } 106 }
91 107
92 // Draw and edit modes: 108 // Draw and edit modes:
93 // 109 //
94 // Layer needs to get actual mouse events, I guess. Draw mode is 110 // Layer needs to get actual mouse events, I guess. Draw mode is