< Summary - ReFlex - Library

Information
Class: ReFlex.Core.Interactivity.Components.RemoteInteractionProcessor
Assembly: ReFlex.Core.Interactivity
File(s): D:\a\reflex\reflex\library\src\Core\Interactivity\Components\RemoteInteractionProcessor.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 59
Coverable lines: 59
Total lines: 92
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 20
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
get_Type()100%210%
get_PointCloud()100%210%
get_VectorField()100%210%
Update()0%420200%

File(s)

D:\a\reflex\reflex\library\src\Core\Interactivity\Components\RemoteInteractionProcessor.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Diagnostics;
 4using System.Linq;
 5using System.Threading.Tasks;
 6using ReFlex.Core.Common.Components;
 7using ReFlex.Core.Common.Util;
 8using ReFlex.Core.Interactivity.Interfaces;
 9
 10namespace ReFlex.Core.Interactivity.Components;
 11
 12public class RemoteInteractionProcessor: InteractionObserverBase
 13{
 14    private readonly IRemoteInteractionProcessorService _service;
 015    private readonly Stopwatch _stopWatch = new();
 16
 017    public RemoteInteractionProcessor(IRemoteInteractionProcessorService service)
 018    {
 019        _service = service;
 020    }
 21
 022    public override ObserverType Type { get; } = ObserverType.Remote;
 023    public override PointCloud3 PointCloud { get; set; }
 024    public override VectorField2 VectorField { get; set; }
 25
 26    public override event EventHandler<IList<Interaction>> NewInteractions;
 27
 28    public override async Task<ProcessingResult> Update()
 029    {
 030        if (!_service.IsConnected)
 031        {
 032            var success = await _service.Connect();
 033            if (!success)
 034            {
 035                return new ProcessingResult(ProcessServiceStatus.Error);
 36            }
 037        }
 38
 039        if (_service.IsBusy)
 040            return new ProcessingResult();
 41
 042        var result = new ProcessingResult(ProcessServiceStatus.Available);
 43
 044        var processed = await _service.Update(PointCloud, result.PerformanceMeasurement, MeasurePerformance);
 45
 046        var candidates = processed.Item1;
 047        var perfItem = new ProcessPerformance { Preparation = processed.Item2.Preparation, Update = processed.Item2.Upda
 048        if (MeasurePerformance)
 049        {
 050            _stopWatch.Start();
 051        }
 52
 053        var interactions = ConvertDepthValue(candidates.ToList());
 54
 055        if (MeasurePerformance)
 056        {
 057            _stopWatch.Stop();
 058            perfItem.ConvertDepthValue = _stopWatch.Elapsed;
 059            _stopWatch.Reset();
 060        }
 61
 062        if (MeasurePerformance)
 063        {
 064            _stopWatch.Start();
 065        }
 066        var frame = ComputeSmoothingValue(interactions);
 067        if (MeasurePerformance)
 068        {
 069            _stopWatch.Stop();
 070            perfItem.Smoothing = _stopWatch.Elapsed;
 071            _stopWatch.Reset();
 072        }
 73
 074        if (MeasurePerformance)
 075        {
 076            _stopWatch.Start();
 077        }
 078        var processedInteractions = ComputeExtremumType(frame.Interactions, PointCloud.AsJaggedArray());
 079        if (MeasurePerformance)
 080        {
 081            _stopWatch.Stop();
 082            perfItem.ComputeExtremumType = _stopWatch.Elapsed;
 083            _stopWatch.Reset();
 084        }
 85
 086        UpdatePerformanceMetrics(perfItem);
 87
 088        NewInteractions?.Invoke(this, processedInteractions);
 89
 090        return result;
 091    }
 92}