/////////////////////////////////////////////////////////////////////////////// // Construction and Initializing methods // /////////////////////////////////////////////////////////////////////////////// #region CONSTRUCTION /// <summary> /// Initializes a new instance of the MouseVariable 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 MouseVariable( MouseParams 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 mouse 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 CreateCustomMouseParam(bool isAOIGroup) { this.mouseParams |= MouseParams.Custom; var newMouseVariable = new CustomVariable(); newMouseVariable.AOIName = isAOIGroup ? this.cbbMouseAOIGroup.Text : this.cbbMouseAOISingle.Text; newMouseVariable.ColumnName = "MFIX_C" + this.mouseCustomParams.Count.ToString(); newMouseVariable.Number = (int)this.nudMouseNumberOf.Value; newMouseVariable.IsAOIGroup = isAOIGroup; newMouseVariable.MouseButton = this.cbbMouseClickButton.Text == string.Empty ? MouseButtons.None : (MouseButtons)Enum.Parse(typeof(MouseButtons), this.cbbMouseClickButton.Text); if (this.rdbMouseCompleteFixationTime.Checked) { newMouseVariable.ParamType = ParamTypes.CompleteTime; } else if (this.rdbMouseTimeUntil.Checked) { newMouseVariable.ParamType = ParamTypes.TimeUntil; } else if (this.rdbMouseNumberOfFixations.Checked) { newMouseVariable.ParamType = ParamTypes.NumberOf; } else if (this.rdbMouseFixationDurationMean.Checked) { newMouseVariable.ParamType = ParamTypes.FixationDurationMean; } else if (this.rdbMouseFixationDurationMedian.Checked) { newMouseVariable.ParamType = ParamTypes.FixationDurationMedian; } else if (this.rdbMouseClickAOI.Checked) { newMouseVariable.ParamType = ParamTypes.Clicks; } else if (this.rdbMouseSaccadeDuration.Checked) { newMouseVariable.ParamType = ParamTypes.SaccadeDuration; } else if (this.rdbMouseSaccadeLength.Checked) { newMouseVariable.ParamType = ParamTypes.SaccadeLength; } else if (this.rdbMouseSaccadeVelocity.Checked) { newMouseVariable.ParamType = ParamTypes.SaccadeVelocity; } var var = new MouseVariable( MouseParams.Custom, newMouseVariable.ColumnName, "Mouse: " + newMouseVariable.ToString(), Type.GetType("System.Int32"), "N0", null, newMouseVariable.ReturnValues()); this.InsertOrRemoveColumn(true, var); this.mouseCustomParams.Add(newMouseVariable); }
/// <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 "Mouse 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 chbMouseDefault_CheckedChanged(object sender, EventArgs e) { var chbSender = (CheckBox)sender; var var = (MouseVariable)this.defaultVariables[chbSender.Name]; this.InsertOrRemoveColumn(chbSender.Checked, var); if (chbSender.Checked) { this.mouseParams |= var.Flag; } else { this.mouseParams &= ~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; }