private void LocalizeForm() { this.Text = " " + ScreenManagerLang.dlgCalibratePlane_Title; btnCancel.Text = ScreenManagerLang.Generic_Cancel; btnOK.Text = ScreenManagerLang.Generic_Apply; grpConfig.Text = ScreenManagerLang.Generic_Calibration; // Combo Units (MUST be filled in the order of the enum) cbUnit.Items.Add(ScreenManagerLang.LengthUnit_Millimeters + " (" + UnitHelper.LengthAbbreviation(LengthUnit.Millimeters) + ")"); cbUnit.Items.Add(ScreenManagerLang.LengthUnit_Centimeters + " (" + UnitHelper.LengthAbbreviation(LengthUnit.Centimeters) + ")"); cbUnit.Items.Add(ScreenManagerLang.LengthUnit_Meters + " (" + UnitHelper.LengthAbbreviation(LengthUnit.Meters) + ")"); cbUnit.Items.Add(ScreenManagerLang.LengthUnit_Inches + " (" + UnitHelper.LengthAbbreviation(LengthUnit.Inches) + ")"); cbUnit.Items.Add(ScreenManagerLang.LengthUnit_Feet + " (" + UnitHelper.LengthAbbreviation(LengthUnit.Feet) + ")"); cbUnit.Items.Add(ScreenManagerLang.LengthUnit_Yards + " (" + UnitHelper.LengthAbbreviation(LengthUnit.Yards) + ")"); string customLengthUnit = PreferencesManager.PlayerPreferences.CustomLengthUnit; string customLengthAbbreviation = PreferencesManager.PlayerPreferences.CustomLengthAbbreviation; if (string.IsNullOrEmpty(customLengthUnit)) { customLengthUnit = ScreenManagerLang.LengthUnit_Percentage; customLengthAbbreviation = "%"; } cbUnit.Items.Add(customLengthUnit + " (" + customLengthAbbreviation + ")"); }
public float ConvertAccelerationFromVelocity(float a) { // Passed acceleration is expressed in units configured for velocity. float magnitude = UnitHelper.ConvertForLengthUnit(a, speedUnit, lengthUnit); return(UnitHelper.ConvertAcceleration(magnitude, lengthUnit, accelerationUnit)); }
private void btnExportData_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Title = ScreenManagerLang.DataAnalysis_ExportData; saveFileDialog.Filter = FilesystemHelper.SaveCSVFilter(); saveFileDialog.FilterIndex = 1; saveFileDialog.RestoreDirectory = true; if (saveFileDialog.ShowDialog() != DialogResult.OK || string.IsNullOrEmpty(saveFileDialog.FileName)) { return; } string separator = CultureInfo.CurrentCulture.TextInfo.ListSeparator; using (StreamWriter w = File.CreateText(saveFileDialog.FileName)) { string unit = UnitHelper.LengthAbbreviation(metadata.CalibrationHelper.LengthUnit); w.WriteLine(string.Format("t (ms){0}x ({1}){0}y ({1})", separator, unit)); foreach (TimedPoint point in points) { string time = metadata.TimeCodeBuilder(point.T, TimeType.UserOrigin, TimecodeFormat.Milliseconds, false); PointF p = metadata.CalibrationHelper.GetPointAtTime(point.Point, point.T); w.WriteLine(string.Format("{0}{3}{1}{3}{2}", time, p.X, p.Y, separator)); } } }
private void LocalizeForm() { this.Text = " " + ScreenManagerLang.dlgCalibrateLine_Title; btnCancel.Text = ScreenManagerLang.Generic_Cancel; btnOK.Text = ScreenManagerLang.Generic_Apply; grpConfig.Text = ScreenManagerLang.Generic_Calibration; lblRealSize.Text = ScreenManagerLang.dlgConfigureMeasure_lblRealSize.Replace("\\n", "\n"); // Combo Units (MUST be filled in the order of the enum) cbUnit.Items.Add(ScreenManagerLang.LengthUnit_Millimeters + " (" + UnitHelper.LengthAbbreviation(LengthUnit.Millimeters) + ")"); cbUnit.Items.Add(ScreenManagerLang.LengthUnit_Centimeters + " (" + UnitHelper.LengthAbbreviation(LengthUnit.Centimeters) + ")"); cbUnit.Items.Add(ScreenManagerLang.LengthUnit_Meters + " (" + UnitHelper.LengthAbbreviation(LengthUnit.Meters) + ")"); cbUnit.Items.Add(ScreenManagerLang.LengthUnit_Inches + " (" + UnitHelper.LengthAbbreviation(LengthUnit.Inches) + ")"); cbUnit.Items.Add(ScreenManagerLang.LengthUnit_Feet + " (" + UnitHelper.LengthAbbreviation(LengthUnit.Feet) + ")"); cbUnit.Items.Add(ScreenManagerLang.LengthUnit_Yards + " (" + UnitHelper.LengthAbbreviation(LengthUnit.Yards) + ")"); string customLengthUnit = PreferencesManager.PlayerPreferences.CustomLengthUnit; string customLengthAbbreviation = PreferencesManager.PlayerPreferences.CustomLengthAbbreviation; if (string.IsNullOrEmpty(customLengthUnit)) { customLengthUnit = ScreenManagerLang.LengthUnit_Percentage; customLengthAbbreviation = "%"; } cbUnit.Items.Add(customLengthUnit + " (" + customLengthAbbreviation + ")"); lblAxis.Text = ScreenManagerLang.dlgCalibrateLine_CoordinateSystemAlignment; // Combo axis. cbAxis.Items.Add(ScreenManagerLang.dlgCalibrateLine_AxisHorizontal); cbAxis.Items.Add(ScreenManagerLang.dlgCalibrateLine_AxisVertical); cbAxis.Items.Add(ScreenManagerLang.dlgCalibrateLine_AxesImage); }
/// <summary> /// Takes two points in image coordinates and return the length of the segment in real world units. /// </summary> public string GetLengthText(PointF p1, PointF p2, bool precise, bool abbreviation) { float length = GeometryHelper.GetDistance(GetPoint(p1), GetPoint(p2)); string valueTemplate = precise ? "{0:0.00}" : "{0:0}"; string text = String.Format(valueTemplate, length); if (abbreviation) { text = text + " " + String.Format("{0}", UnitHelper.LengthAbbreviation(lengthUnit)); } return(text); }
public string GetPointText(PointF p, bool precise, bool abbreviation, long time) { PointF a = GetPointAtTime(p, time); string valueTemplate = precise ? "{{{0:0.00};{1:0.00}}}" : "{{{0:0};{1:0}}}"; string text = String.Format(valueTemplate, a.X, a.Y); if (abbreviation) { text = text + " " + String.Format("{0}", UnitHelper.LengthAbbreviation(lengthUnit)); } return(text); }
private void btnDataCopy_Click(object sender, EventArgs e) { StringBuilder b = new StringBuilder(); string unit = UnitHelper.LengthAbbreviation(metadata.CalibrationHelper.LengthUnit); string separator = CultureInfo.CurrentCulture.TextInfo.ListSeparator; b.AppendLine(string.Format("t (ms){0}x ({1}){0}y ({1})", separator, unit)); foreach (TimedPoint point in points) { string time = metadata.TimeCodeBuilder(point.T, TimeType.UserOrigin, TimecodeFormat.Milliseconds, false); PointF p = metadata.CalibrationHelper.GetPointAtTime(point.Point, point.T); b.AppendLine(string.Format("{0}{3}{1}{3}{2}", time, p.X, p.Y, separator)); } string text = b.ToString(); Clipboard.SetText(text); }
public string GetLengthAbbreviation() { return(UnitHelper.LengthAbbreviation(lengthUnit)); }
public float ConvertAngularVelocity(float radiansPerSecond) { return((float)UnitHelper.ConvertAngularVelocity(radiansPerSecond, angularVelocityUnit)); }
public float ConvertAcceleration(float a) { return(UnitHelper.ConvertAcceleration(a, lengthUnit, accelerationUnit)); }
public string GetAngularVelocityAbbreviation() { return(UnitHelper.AngularVelocityAbbreviation(angularVelocityUnit)); }
public string GetAngularAccelerationAbbreviation() { return(UnitHelper.AngularAccelerationAbbreviation(angularAccelerationUnit)); }
public string GetAngleAbbreviation() { return(UnitHelper.AngleAbbreviation(angleUnit)); }
public string GetAccelerationAbbreviation() { AccelerationUnit unit = IsCalibrated ? accelerationUnit : AccelerationUnit.PixelsPerSecondSquared; return(UnitHelper.AccelerationAbbreviation(unit)); }
public string GetSpeedAbbreviation() { SpeedUnit unit = IsCalibrated ? speedUnit : SpeedUnit.PixelsPerSecond; return(UnitHelper.SpeedAbbreviation(unit)); }
/// <summary> /// Takes a speed in calibration units/seconds and returns it in the current speed unit. /// </summary> public float ConvertSpeed(float v) { return(UnitHelper.ConvertVelocity(v, lengthUnit, speedUnit)); }
public float ConvertAngularAcceleration(float radiansPerSecondSquared) { return(UnitHelper.ConvertAngularAcceleration(radiansPerSecondSquared, angularAccelerationUnit)); }