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));
                }
            }
        }
Exemple #2
0
        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 + ")");
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        /// <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);
        }
Exemple #5
0
        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);
        }
Exemple #7
0
 public string GetLengthAbbreviation()
 {
     return(UnitHelper.LengthAbbreviation(lengthUnit));
 }