From 02bded8d0b5f8d58a83030a23889ec3d7a58cf85 Mon Sep 17 00:00:00 2001 From: Donat Marko Date: Tue, 14 Jan 2020 17:14:45 +0100 Subject: [PATCH] :sparkles: Adds line segment feature for Aurora export --- AIPcoord/frmMain.Designer.cs | 15 ++++++++++++++- AIPcoord/frmMain.cs | 22 ++++++++++++++-------- README.md | 2 +- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/AIPcoord/frmMain.Designer.cs b/AIPcoord/frmMain.Designer.cs index ac19267..bd5c9b4 100644 --- a/AIPcoord/frmMain.Designer.cs +++ b/AIPcoord/frmMain.Designer.cs @@ -56,6 +56,7 @@ private void InitializeComponent() this.rad_dms_11 = new System.Windows.Forms.RadioButton(); this.rad_dms_14 = new System.Windows.Forms.RadioButton(); this.btn_aurora = new System.Windows.Forms.Button(); + this.chk_linesegments = new System.Windows.Forms.CheckBox(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.num_tabs)).BeginInit(); this.groupBox2.SuspendLayout(); @@ -299,6 +300,7 @@ private void InitializeComponent() // // groupBox4 // + this.groupBox4.Controls.Add(this.chk_linesegments); this.groupBox4.Controls.Add(this.txt_aurora); this.groupBox4.Controls.Add(this.label3); this.groupBox4.Controls.Add(this.rad_decimal); @@ -309,7 +311,7 @@ private void InitializeComponent() this.groupBox4.Size = new System.Drawing.Size(446, 158); this.groupBox4.TabIndex = 29; this.groupBox4.TabStop = false; - this.groupBox4.Text = "Aurora ATC Client point list"; + this.groupBox4.Text = "Aurora ATC Client point list / line segments"; // // txt_aurora // @@ -375,6 +377,16 @@ private void InitializeComponent() this.btn_aurora.UseVisualStyleBackColor = true; this.btn_aurora.Click += new System.EventHandler(this.btn_ivac3_Click); // + // chk_linesegments + // + this.chk_linesegments.AutoSize = true; + this.chk_linesegments.Location = new System.Drawing.Point(343, 19); + this.chk_linesegments.Name = "chk_linesegments"; + this.chk_linesegments.Size = new System.Drawing.Size(94, 17); + this.chk_linesegments.TabIndex = 24; + this.chk_linesegments.Text = "Line segments"; + this.chk_linesegments.UseVisualStyleBackColor = true; + // // frmMain // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -440,6 +452,7 @@ private void InitializeComponent() private System.Windows.Forms.RadioButton rad_dms_11; private System.Windows.Forms.RadioButton rad_dms_14; private System.Windows.Forms.Button btn_aurora; + private System.Windows.Forms.CheckBox chk_linesegments; } } diff --git a/AIPcoord/frmMain.cs b/AIPcoord/frmMain.cs index 0805cbe..18d9fdd 100644 --- a/AIPcoord/frmMain.cs +++ b/AIPcoord/frmMain.cs @@ -272,18 +272,24 @@ void CoordinateProcess(OutputType typ) } else if (typ == OutputType.Aurora) { - if (rad_dms_14.Checked) - { - txt_aurora.AppendText(clist[i].ToString("AURORA_DMS14") + Environment.NewLine); - } - else if (rad_dms_11.Checked) + string format = "AURORA_DMS14"; + if (rad_dms_11.Checked) + format = "AURORA_DMS11"; + else if (rad_decimal.Checked) + format = "AURORA_DEC"; + + string s = string.Empty; + if (!chk_linesegments.Checked || clist.Count == 1) { - txt_aurora.AppendText(clist[i].ToString("AURORA_DMS11") + Environment.NewLine); + // single point given or user wants point list + s = s + clist[i].ToString(format); } - else if (rad_decimal.Checked) + else if (clist.Count > i + 1) { - txt_aurora.AppendText(clist[i].ToString("AURORA_DEC") + Environment.NewLine); + // user wants line segment list + s = s + string.Format("{0}{1}", clist[i].ToString(format), clist[i + 1].ToString(format)); } + txt_aurora.AppendText(s + Environment.NewLine); } } diff --git a/README.md b/README.md index aa743a7..79e3788 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ However the source coordinate format has to be eAIP-style WGS84 format, it **mig Since 08/08/2018 the tool has been accepting IvAc 1 batch line segments as input too. ## Usage -Insert the source data and press one of the four buttons depending on the format you would like to get. Leading tabs can be adjusted for IVAC2, leading spaces and color attribute for IvAc1 format. For the Aurora, you can choose the 11- or 14-character-long DMS format or even the decimal format (similar to the WebEye one). The output will be moved to the clipboard, so you don't have to Ctrl-C the result manually. Basically that's all. :-) +Insert the source data and press one of the four buttons depending on the format you would like to get. Leading tabs can be adjusted for IVAC2, leading spaces and color attribute for IvAc1 format. For the Aurora, exporting the data into line segments and point list are both available, and in both cases you can choose between the 11- or 14-character-long DMS format or even the decimal format (similar to the WebEye one). The output will be moved to the clipboard, so you don't have to Ctrl-C the result manually. Basically that's all. :-) Example input data which will surely work (eAIP format): `474643N 0190652E - 473720N 0185425E - 473500N 0185300E - 473220N 0185858E - 473055N 0190118E - 473054N 0190159E - 473612N 0190412E - 474615N 0191631E - 474643N 0190652E`