/// <summary> /// This method removes all given samples drawing elements from /// the canvas. /// </summary> /// <param name="drawingMode"> /// The <see cref="ReplayDrawingModes"/> to use. /// </param> /// <param name="sampleType"> /// The <see cref="SampleType"/> to use /// </param> /// <param name="firstValidSample"> /// A <see cref="TimedPoint"/> with the first valid sample /// to be removed. /// </param> /// <param name="validFixationSamples"> /// A <see cref="List{TimedPoint}"/> with /// valid fixation samples. /// </param> /// <param name="validPathSamples"> /// A <see cref="List{PointF}"/> with /// valid path samples. /// </param> private void RemoveValidSampleRange( ReplayDrawingModes drawingMode, SampleType sampleType, TimedPoint firstValidSample, List<TimedPoint> validFixationSamples, List<PointF> validPathSamples) { if (((drawingMode & ReplayDrawingModes.Fixations) == ReplayDrawingModes.Fixations) || ((drawingMode & ReplayDrawingModes.FixationConnections) == ReplayDrawingModes.FixationConnections)) { this.RemoveFixations(firstValidSample); } if ((drawingMode & ReplayDrawingModes.Path) == ReplayDrawingModes.Path) { this.RemovePathPoints(validPathSamples, sampleType); } if ((drawingMode & ReplayDrawingModes.Clicks) == ReplayDrawingModes.Clicks) { this.RemoveMouseClicks(); } if (!this.currentLoopState.IsBlink) { if ((drawingMode & ReplayDrawingModes.Cursor) == ReplayDrawingModes.Cursor) { this.DrawCursor(firstValidSample, sampleType); } if ((drawingMode & ReplayDrawingModes.Spotlight) == ReplayDrawingModes.Spotlight) { this.DrawSpotlight(firstValidSample, sampleType); } } }
/// <summary> /// This method draws the given range of samples with the given drawing modes. /// </summary> /// <param name="drawingMode"> /// The <see cref="ReplayDrawingModes"/> to use. /// </param> /// <param name="sampleType"> /// The <see cref="SampleType"/> to use /// </param> /// <param name="lastValidSample"> /// A <see cref="TimedPoint"/> with the last valid sample. /// </param> /// <param name="validFixationSamples"> /// A <see cref="List{TimedPoint}"/> with /// valid fixation samples. /// </param> /// <param name="validPathSamples"> /// A <see cref="List{PointF}"/> with /// valid path samples. /// </param> /// <param name="validMouseClicks"> /// A <see cref="List{MouseStopCondition}"/> with /// valid mouse clicks. /// </param> private void DrawValidSampleRange( ReplayDrawingModes drawingMode, SampleType sampleType, TimedPoint lastValidSample, List<TimedPoint> validFixationSamples, List<PointF> validPathSamples, List<MouseStopCondition> validMouseClicks) { if (((drawingMode & ReplayDrawingModes.Fixations) == ReplayDrawingModes.Fixations) || ((drawingMode & ReplayDrawingModes.FixationConnections) == ReplayDrawingModes.FixationConnections)) { foreach (var point in validFixationSamples) { this.DrawFixations(point.Time, point.Position, sampleType, false); } if (validFixationSamples.Count > 0) { var lastvalidFixationSample = validFixationSamples[validFixationSamples.Count - 1]; this.DrawFixations(lastvalidFixationSample.Time, lastvalidFixationSample.Position, sampleType, true); } } if ((drawingMode & ReplayDrawingModes.Clicks) == ReplayDrawingModes.Clicks) { if (validMouseClicks == null) { throw new ArgumentNullException("Mouse click list is null, but drawing is activated."); } this.DrawMouseClicks(validMouseClicks); } if ((drawingMode & ReplayDrawingModes.Path) == ReplayDrawingModes.Path) { this.DrawPaths(validPathSamples, sampleType, lastValidSample.Time); } if (!this.currentLoopState.IsBlink) { if ((drawingMode & ReplayDrawingModes.Cursor) == ReplayDrawingModes.Cursor) { this.DrawCursor(lastValidSample, sampleType); } if ((drawingMode & ReplayDrawingModes.Spotlight) == ReplayDrawingModes.Spotlight) { this.DrawSpotlight(lastValidSample, sampleType); } } }
/////////////////////////////////////////////////////////////////////////////// // Methods for doing main class job // /////////////////////////////////////////////////////////////////////////////// #region METHODS /// <summary> /// Initializes fields if applicable; /// </summary> private void InitializeFields() { // For Designer support check for empty Application settings if (Properties.Settings.Default != null) { this.currentLoopState = new LoopState(); this.currentLoopState.ProcessBeginningTime = DateTime.Now; this.showBlinks = Properties.Settings.Default.GazeModeBlinks; this.isGazeDiscreteLength = Properties.Settings.Default.GazeModeCutPath; this.isMouseDiscreteLength = Properties.Settings.Default.MouseModeCutPath; var speedValue = Properties.Settings.Default.ReplaySpeed; switch (speedValue) { case "10x": this.speed = 10f; break; case "5x": this.speed = 5f; break; case "3x": this.speed = 3f; break; case "2x": this.speed = 2f; break; case "1x": this.speed = 1f; break; case "0.5x": this.speed = 0.5f; break; case "0.3x": this.speed = 0.33f; break; case "0.2x": this.speed = 0.2f; break; case "0.1x": this.speed = 0.1f; break; default: this.speed = 1f; break; } this.objFixGazeDetection = new FixationDetection(); this.objFixMouseDetection = new FixationDetection(); this.gazeFixations = new VGElementCollection(); this.mouseFixations = new VGElementCollection(); if (Properties.Settings.Default.GazeModeCursor) { this.gazeDrawingMode |= ReplayDrawingModes.Cursor; } if (Properties.Settings.Default.GazeModePath) { this.gazeDrawingMode |= ReplayDrawingModes.Path; } if (Properties.Settings.Default.GazeModeFixations) { this.gazeDrawingMode |= ReplayDrawingModes.Fixations; } if (Properties.Settings.Default.GazeModeFixCon) { this.gazeDrawingMode |= ReplayDrawingModes.FixationConnections; } if (Properties.Settings.Default.GazeModeSpotlight) { this.gazeDrawingMode |= ReplayDrawingModes.Spotlight; } if (Properties.Settings.Default.MouseModeCursor) { this.mouseDrawingMode |= ReplayDrawingModes.Cursor; } if (Properties.Settings.Default.MouseModePath) { this.mouseDrawingMode |= ReplayDrawingModes.Path; } if (Properties.Settings.Default.MouseModeFixations) { this.mouseDrawingMode |= ReplayDrawingModes.Fixations; } if (Properties.Settings.Default.MouseModeFixCon) { this.mouseDrawingMode |= ReplayDrawingModes.FixationConnections; } if (Properties.Settings.Default.MouseModeSpotlight) { this.mouseDrawingMode |= ReplayDrawingModes.Spotlight; } this.maxLengthPath = (int)Properties.Settings.Default.MaxPointsPolyline; this.numFixToShow = (int)Properties.Settings.Default.MaxNumberFixations; // Initialize and load sounds for the replay of mouse clicks. this.sndLeftClick = new SoundPlayer(); this.sndLeftClick.Stream = Properties.Resources.clickLeft; this.sndLeftClick.LoadAsync(); this.sndRightClick = new SoundPlayer(); this.sndRightClick.Stream = Properties.Resources.clickRight; this.sndRightClick.LoadAsync(); } }