< Summary - ReFlex - Library

Information
Class: ReFlex.Core.Tuio.Util.TuioParameters
Assembly: ReFlex.Core.Tuio
File(s): D:\a\reflex\reflex\library\src\Core\Tuio\Util\TuioParameters.cs
Line coverage
100%
Covered lines: 25
Uncovered lines: 0
Coverable lines: 25
Total lines: 75
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Dimension()100%11100%
get_Source()100%11100%
get_SessionId()100%11100%
get_FrameId()100%11100%
get_Time()100%11100%
get_Positions()100%11100%
.ctor(...)100%22100%

File(s)

D:\a\reflex\reflex\library\src\Core\Tuio\Util\TuioParameters.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using CoreOSC;
 4using ReFlex.Core.Common.Components;
 5
 6namespace ReFlex.Core.Tuio.Util
 7{
 8    /// <summary>
 9    /// Data Storage to build <see cref="OscBundle"/> for TUIO Communication
 10    /// </summary>
 11    public class TuioParameters
 12    {
 13        /// <summary>
 14        /// Dimension (in /tuio2/frm)
 15        /// </summary>
 816        public int Dimension { get; }
 17        /// <summary>
 18        /// Source (in /tuio2/frm and "source" property in TUIO 1.1)
 19        /// </summary>
 1620        public string Source { get; }
 21        /// <summary>
 22        /// Session Id for alive messages
 23        /// </summary>
 4024        public int SessionId { get;  }
 25
 26        /// <summary>
 27        /// FrameId (in /tuio2/frm and "fseq" property in TUIO 1.1)
 28        /// </summary>
 1329        public int FrameId { get; }
 30
 31
 32        /// <summary>
 33        /// Time for Bundle and in /tuio2/frm
 34        /// </summary>
 1435        public Timetag Time { get; }
 36
 37        /// <summary>
 38        /// Contains List of Interaction with Position and TouchId in the Foomat: [Item1, Item2, Item3, Item4] = [TouchI
 39        /// </summary>
 11240        public List<Tuple<int, float, float, float>> Positions { get; } = new List<Tuple<int, float, float, float>>();
 41
 42        ///  <summary>
 43        ///  Constructs Parameters.
 44        ///  <see cref="Time"/> is derived from <see><cref>DateTime.Now.Ticks</cref></see>
 45        ///  <see cref="Dimension"/> is computed from <see cref="TuioConfiguration.SensorWidth"/> * <see cref="TuioConfi
 46        /// <see cref="Source"/> is $"ReFlex@{clientAddress} [{config.SensorDescription}]"
 47        ///  For each interaction, the Coordinates are transformed, if the provided <see cref="TuioInterpretation"/> is 
 48        ///  Position.Z = (Position.Z + 1) / 2 (to fit from [-1 | 1] ]in the range [0.0. | 1.0 ] with 0.0 -> 0.5
 49        ///  </summary>
 50        ///  <param name="clientAddress">IP Address for specifying the Source</param>
 51        ///  <param name="config">for computing dimension and transformation of coordinates</param>
 52        ///  <param name="interactions">interactions from Reflex server, transformed and stored in <see cref="Positions"
 53        ///  <param name="frameId">frame Id for TUIO message bundle. used to maintain correct order of messages</param>
 1654        public TuioParameters(string clientAddress, TuioConfiguration config, List<Interaction> interactions, int frameI
 1655        {
 1656            Time = new Timetag((ulong)DateTime.Now.Ticks);
 1657            Dimension = config.SensorWidth * config.SensorHeight;
 1658            Source = $"ReFlex@{clientAddress} [{config.SensorDescription}]";
 1659            SessionId = config.SessionId;
 1660            FrameId = frameId;
 61
 1662            interactions.ForEach(interaction =>
 8663            {
 8664                var xPos = interaction.Position.X;
 8665                var yPos = interaction.Position.Y;
 8666                var zPos = interaction.Position.Z;
 1667
 8668                if (config.Interpretation == TuioInterpretation.Point3D)
 3469                    zPos = (zPos + 1.0f) * 0.5f; // decode range [-1.0 | 1.0] into [0.0. | 1.0 ] with 0.0 -> 0.5
 1670
 8671                Positions.Add(new Tuple<int, float, float, float>(interaction.TouchId, xPos, yPos, zPos));
 10272            });
 1673        }
 74    }
 75}