/////////////////////////////////////////////////////////////////////////////// // Construction and Initializing methods // /////////////////////////////////////////////////////////////////////////////// #region CONSTRUCTION /// <summary> /// Initializes a new instance of the GazeVariable class. /// </summary> /// <param name="newFlag">A flag that unique identifies this variable.</param> /// <param name="newColumnName">The short name (8 characters) of the column in which the value should be written.</param> /// <param name="newColumnDescription">The long description of the column that describes the variable.</param> /// <param name="newColumnType">The <see cref="Type"/> of the column contents.</param> /// <param name="newColumnFormat">A <see cref="string"/> with the column formatting. (e.g. "N2")</param> /// <param name="newCheckBox">The <see cref="CheckBox"/> that enables or disables this variable.</param> /// <param name="newReturnValues">A <see cref="string"/> describing the return values of this /// variable.</param> public GazeVariable( GazeParams newFlag, string newColumnName, string newColumnDescription, Type newColumnType, string newColumnFormat, CheckBox newCheckBox, string newReturnValues) : base( newColumnName, newColumnDescription, newColumnType, newColumnFormat, newCheckBox, newReturnValues) { this.paramFlag = newFlag; }
/// <summary> /// This method creates a custom gaze variable /// for regressions from the current user interface settings. /// </summary> /// <param name="isUsingAOI"> /// True, if regressions should only be detected in an AOI /// otherwise (for using all fixation data) false. /// </param> /// <param name="isAOIGroup"> /// True, if it is a AOI Group that the parameter belongs to, /// otherwise (for a single AOI) false. /// </param> private void CreateCustomGazeRegressionParam(bool isUsingAOI, bool isAOIGroup) { this.gazeParams |= GazeParams.Custom; var newGazeVariable = new CustomVariable(); if (isUsingAOI) { newGazeVariable.AOIName = isAOIGroup ? this.cbbGazeRegressionAOIGroups.Text : this.cbbGazeRegressionAOISingle.Text; } else { newGazeVariable.AOIName = string.Empty; } newGazeVariable.Number = (int)this.nudGazeRegressionLineHeight.Value; newGazeVariable.ColumnName = "GFIX_C" + this.gazeCustomParams.Count.ToString(); newGazeVariable.IsAOIGroup = isAOIGroup; newGazeVariable.ParamType = ParamTypes.Regressions; var var = new GazeVariable( GazeParams.Custom, newGazeVariable.ColumnName, "Gaze: " + newGazeVariable.ToString(), Type.GetType("System.Int32"), "N0", null, newGazeVariable.ReturnValues()); this.InsertOrRemoveColumn(true, var); this.gazeCustomParams.Add(newGazeVariable); }
/// <summary> /// This method creates a custom gaze variable from the current user interface settings. /// </summary> /// <param name="isAOIGroup"> /// True, if it is a AOI Group that the parameter belongs to, /// otherwise (for a single AOI) false. /// </param> private void CreateCustomGazeParam(bool isAOIGroup) { this.gazeParams |= GazeParams.Custom; var newGazeVariable = new CustomVariable(); newGazeVariable.AOIName = isAOIGroup ? this.cbbGazeAOIGroups.Text : this.cbbGazeAOISingle.Text; newGazeVariable.ColumnName = "GFIX_C" + this.gazeCustomParams.Count.ToString(); newGazeVariable.Number = (int)this.nudGazeTimeUntilNumberOf.Value; newGazeVariable.IsAOIGroup = isAOIGroup; if (this.rdbGazeCompleteFixationTime.Checked) { newGazeVariable.ParamType = ParamTypes.CompleteTime; } else if (this.rdbGazeTimeUntil.Checked) { newGazeVariable.ParamType = ParamTypes.TimeUntil; } else if (this.rdbGazeNumberOfFixations.Checked) { newGazeVariable.ParamType = ParamTypes.NumberOf; } else if (this.rdbGazeFixationDurationMean.Checked) { newGazeVariable.ParamType = ParamTypes.FixationDurationMean; } else if (this.rdbGazeFixationDurationMedian.Checked) { newGazeVariable.ParamType = ParamTypes.FixationDurationMedian; } else if (this.rdbGazeSaccadeDuration.Checked) { newGazeVariable.ParamType = ParamTypes.SaccadeDuration; } else if (this.rdbGazeSaccadeLength.Checked) { newGazeVariable.ParamType = ParamTypes.SaccadeLength; } else if (this.rdbGazeSaccadeVelocity.Checked) { newGazeVariable.ParamType = ParamTypes.SaccadeVelocity; } var var = new GazeVariable( GazeParams.Custom, newGazeVariable.ColumnName, "Gaze: " + newGazeVariable.ToString(), Type.GetType("System.Int32"), "N0", null, newGazeVariable.ReturnValues()); this.InsertOrRemoveColumn(true, var); this.gazeCustomParams.Add(newGazeVariable); }
/// <summary> /// The <see cref="Control.Click"/> event handler for the /// <see cref="ToolStripMenuItem"/> <see cref="cmuRemoveColumn"/>. /// Context menu delete column clicked. /// </summary> /// <param name="sender"> /// Source of the event /// </param> /// <param name="e"> /// An empty <see cref="EventArgs"/> /// </param> private void cmuRemoveColumn_Click(object sender, EventArgs e) { int index = this.dGVExportTable.HitTest(this.mouseClickLocation.X, this.mouseClickLocation.Y).ColumnIndex; if (index <= this.dGVExportTable.Columns.Count && index >= 0) { string currentColumnName = this.dGVExportTable.Columns[index].Name; if (this.dGVExportTable.Columns[currentColumnName] != null) { this.dGVExportTable.Columns.Remove(currentColumnName); foreach (DefaultVariable var in this.defaultVariables.Values) { if (var.ColumnName == currentColumnName) { var.CheckBox.Checked = false; if (var is SubjectVariable) { this.subjectParams &= ~((SubjectVariable)var).Flag; } else if (var is TrialVariable) { this.trialParams &= ~((TrialVariable)var).Flag; } else if (var is GazeVariable) { this.gazeParams &= ~((GazeVariable)var).Flag; } else if (var is MouseVariable) { this.mouseParams &= ~((MouseVariable)var).Flag; } break; } } foreach (CustomVariable var in this.gazeCustomParams) { if (var.ColumnName == currentColumnName) { this.gazeCustomParams.Remove(var); break; } } foreach (CustomVariable var in this.mouseCustomParams) { if (var.ColumnName == currentColumnName) { this.mouseCustomParams.Remove(var); break; } } } } }
/// <summary> /// User switched default check box in Tab "Gaze parameters". /// Add referring column to datagridview table and set analysis flag. /// </summary> /// <param name="sender"> /// Source of the event. /// </param> /// <param name="e"> /// An empty <see cref="EventArgs"/> /// </param> private void chbGazeDefault_CheckedChanged(object sender, EventArgs e) { var chbSender = (CheckBox)sender; var var = (GazeVariable)this.defaultVariables[chbSender.Name]; this.InsertOrRemoveColumn(chbSender.Checked, var); if (chbSender.Checked) { this.gazeParams |= var.Flag; } else { this.gazeParams &= ~var.Flag; } }
/////////////////////////////////////////////////////////////////////////////// // Construction and Initializing methods // /////////////////////////////////////////////////////////////////////////////// #region CONSTRUCTION /// <summary> /// Initializes a new instance of the Statistic class. /// Initializes variables to calculate by setting the flag members /// of this Statistics object. /// </summary> /// <param name="newSubjectParams">A <see cref="SubjectParams"/> with the flags set to the /// subject variables that should be calculated.</param> /// <param name="newTrialParams">A <see cref="TrialParams"/> with the flags set to the /// trial variables that should be calculated.</param> /// <param name="newGazeParams">A <see cref="GazeParams"/> with the flags set to the /// gaze variables that should be calculated.</param> /// <param name="newGazeCustomParams">A <see cref="List{CustomVariable}"/> with /// custom defined gaze variables. Will only be used, when <see cref="GazeParams.Custom"/> /// is set.</param> /// <param name="newMouseParams">A <see cref="MouseParams"/> with the flags set to the /// mouse variables that should be calculated.</param> /// <param name="newMouseCustomParams">A <see cref="List{CustomVariable}"/> with /// custom defined mouse variables. Will only be used, when <see cref="MouseParams.Custom"/> /// is set.</param> /// <param name="newTolerance">A <see cref="int"/> tolerance value for /// widening areas of interest to get a better hit rate in pixel.</param> public Statistic( SubjectParams newSubjectParams, TrialParams newTrialParams, GazeParams newGazeParams, List<CustomVariable> newGazeCustomParams, MouseParams newMouseParams, List<CustomVariable> newMouseCustomParams, int newTolerance) { this.subjectParams = newSubjectParams; this.trialParams = newTrialParams; this.gazeParams = newGazeParams; this.gazeCustomParams = newGazeCustomParams != null ? newGazeCustomParams : new List<CustomVariable>(); this.mouseParams = newMouseParams; this.mouseCustomParams = newMouseCustomParams != null ? newMouseCustomParams : new List<CustomVariable>(); tolerance = newTolerance; }