MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / measure

Method measure

DSView/pv/view/analogsignal.cpp:146–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146bool AnalogSignal::measure(const QPointF &p)
147{
148 _hover_en = false;
149 if (!enabled())
150 return false;
151
152 if (_view->session().is_stopped_status() == false)
153 return false;
154
155 const QRectF window = get_view_rect();
156 if (!window.contains(p))
157 return false;
158
159 if (_data->have_data() == false)
160 return false;
161
162 const double scale = _view->scale();
163 assert(scale > 0);
164 const int64_t pixels_offset = _view->offset();
165 const double samplerate = _view->session().cur_snap_samplerate();
166 const double samples_per_pixel = samplerate * scale;
167
168 _hover_index = floor((p.x() + pixels_offset) * samples_per_pixel+0.5);
169 if (_hover_index >= _data->get_sample_count())
170 return false;
171
172 _hover_point = get_point(_hover_index, _hover_value);
173 _hover_en = true;
174 return true;
175}
176
177bool AnalogSignal::get_hover(uint64_t &index, QPointF &p, double &value)
178{

Callers

nothing calls this directly

Calls 7

is_stopped_statusMethod · 0.80
sessionMethod · 0.80
have_dataMethod · 0.80
scaleMethod · 0.80
offsetMethod · 0.80
cur_snap_samplerateMethod · 0.80
get_sample_countMethod · 0.80

Tested by

no test coverage detected