MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / measure

Method measure

DSView/pv/view/logicsignal.cpp:291–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289}
290
291bool LogicSignal::measure(const QPointF &p, uint64_t &index0, uint64_t &index1, uint64_t &index2)
292{
293 const float gap = abs(p.y() - get_y());
294 if (gap < get_totalHeight() * 0.5) {
295
296 if (_data->empty() || !_data->has_data(_probe->index))
297 return false;
298
299 const uint64_t end = _data->get_ring_sample_count() - 1;
300 uint64_t index = _data->samplerate() * _view->scale() * (_view->offset() + p.x());
301
302 if (index > end){
303 return false;
304 }
305
306 bool sample = _data->get_sample(index, get_index());
307 if (index == 0){
308 index0 = index;
309 }
310 else {
311 index--;
312 if (_data->get_pre_edge(index, sample, 1, get_index()))
313 index0 = index;
314 else
315 index0 = 0;
316 }
317
318 sample = _data->get_sample(index, get_index());
319 index++;
320 if (_data->get_nxt_edge(index, sample, end, 1, get_index())){
321 index1 = index;
322 }
323 else {
324 if (index0 == 0)
325 return false;
326 index1 = end + 1;
327 index2 = 0;
328 return true;
329 }
330
331 sample = _data->get_sample(index, get_index());
332 index++;
333 if (_data->get_nxt_edge(index, sample, end, 1, get_index()))
334 index2 = index;
335 else
336 index2 = end + 1;
337
338 return true;
339 }
340 return false;
341}
342
343bool LogicSignal::is_by_edge(const QPointF &p, uint64_t &index, int radius)
344{

Callers

nothing calls this directly

Calls 9

emptyMethod · 0.80
scaleMethod · 0.80
offsetMethod · 0.80
get_sampleMethod · 0.80
get_pre_edgeMethod · 0.80
get_nxt_edgeMethod · 0.80
has_dataMethod · 0.45
get_ring_sample_countMethod · 0.45
samplerateMethod · 0.45

Tested by

no test coverage detected