private string OutputText(string Lat0, string Lon0, string Lat1, string Lon1) { string result = string.Empty; if ((Lat0.Length > 0) && (Lon0.Length > 0) && (Lat1.Length > 0) && (Lon1.Length > 0)) { switch (SectionComboBox.SelectedIndex) { case 0: // SIDSTAR result = SCTstrings.SSDout(Lat0, Lon0, Lat1, Lon1) + cr; break; case 1: // ARTCC result = SCTstrings.BoundaryOut(PrefixTextBox.Text, Lat0, Lon0, Lat1, Lon1) + cr; break; case 2: // Airway (prefix textbox req'd) result = SCTstrings.AWYout(PrefixTextBox.Text, Lat0, Lon0, Lat1, Lon1, "", "") + cr; break; case 3: // GEO format result = SCTstrings.GeoOut(Lat0, Lon0, Lat1, Lon1, ColorValueTextBox.Text) + cr; break; } } return(result); }
private void AddLine() { // Purpose - to Output a series of lines based upon user options // RETURNS - Nothing; writes a string to the Output Textbox string cr = Environment.NewLine; string Msg; // Create the list of points for the line (if not dashed, returns original points) string[] strOut = new string[4]; strOut[0] = strOut[1] = strOut[2] = strOut[3] = string.Empty; double[][] Lines = DashedLine(DashedLineRadioButton.Checked); if (SSDRadioButton.Checked) { foreach (double[] Line in Lines) { if (Line[0] == -1) { strOut[2] = string.Empty; strOut[3] = string.Empty; } else { strOut[2] = Conversions.Degrees2SCT(Line[0], true); strOut[3] = Conversions.Degrees2SCT(Line[1], false); } if ((strOut[0].Length != 0) && (strOut[2].Length != 0)) { switch (OutputType) { case "SSD": OutputTextBox.Text += SCTstrings.SSDout(strOut[0], strOut[1], strOut[2], strOut[3]) + cr; break; case "AWY": if (PrefixTextBox.TextLength != 0) { OutputTextBox.Text += SCTstrings.AWYout(PrefixTextBox.Text, strOut[0], strOut[1], strOut[2], strOut[3], StartFixTextBox.Text, EndFixTextBox.Text) + cr; } else { Msg = "The Airway identifier is required for this format." + cr + "(Place in the prefix text box.)"; SCTcommon.SendMessage(Msg); PrefixTextBox.Focus(); } break; case "ARTCC": if (PrefixTextBox.TextLength != 0) { OutputTextBox.Text += SCTstrings.BoundaryOut(PrefixTextBox.Text, strOut[0], strOut[1], strOut[2], strOut[3]); if (SuffixTextBox.TextLength != 0) { OutputTextBox.Text += SuffixTextBox.Text; } OutputTextBox.Text += cr; } else { Msg = "The ARTCC identifier is required for this format." + cr + "(Place in the prefix text box.)"; SCTcommon.SendMessage(Msg); PrefixTextBox.Focus(); } break; case "GEO": OutputTextBox.Text += SCTstrings.GeoOut(strOut[0], strOut[1], strOut[2], strOut[3], SuffixTextBox.Text) + cr; break; } } strOut[0] = strOut[2]; strOut[1] = strOut[3]; } } }
public static void WriteARB(string path, bool High) { // This doesn't work as designed. Need to search for affected ARTCCs, // then draw all the ARTCCs (filter ARTCC =) with ANY borders in the area. // MAY want to do that in the "SELECTED" phase (dgvARB), then sort by ARTCC. DataTable ARB = Form1.ARB; string FacID0 = string.Empty; string FacID1; string ARBname; string HL; string filter; string Sector; string Lat1; string Long1; string Descr1; string Descr0 = string.Empty; string Lat0 = string.Empty; string Long0 = string.Empty; string LatFirst = string.Empty; string LongFirst = string.Empty; string Output = Environment.NewLine; if (High) { filter = "[Selected] AND (" + " ([DECODE] = 'UTA') OR " + " ([DECODE] = 'FIR ONLY') OR " + " ([DECODE] = 'BDRY') OR " + " ([DECODE] = 'HIGH') )"; HL = "_H_CTR"; Sector = "HIGH"; } else { filter = "([DECODE] = 'LOW') AND [Selected]"; // HL = "_L_CTR"; Sector = "LOW"; } // First, find all the ARBs in the group (may be more than one) DataView ARBview = new DataView(ARB) { RowFilter = filter, Sort = "Sequence", }; Console.WriteLine("ARB lines found: " + ARBview.Count); using (StreamWriter sw = new StreamWriter(path)) { Output += "[ARTCC " + Sector + "]" + cr; if (ARBview.Count != 0) { // Build a list of the boundaries. The last one always has "To Point of Beginning" // OR... It's a different ARTCC var ARBlist = new List <string>(); foreach (DataRowView ARBdataRowView in ARBview) { if (Lat0.Length == 0) // First point of line { Lat1 = Conversions.DecDeg2SCT(Convert.ToSingle(ARBdataRowView["Latitude"]), true); Long1 = Conversions.DecDeg2SCT(Convert.ToSingle(ARBdataRowView["Longitude"]), false); LatFirst = Lat1; LongFirst = Long1; // Save the first point Descr1 = ARBdataRowView["Description"].ToString(); ARBname = ARBdataRowView["Name"].ToString(); // Initialize AARTC name FacID1 = ARBdataRowView["ARTCC"].ToString(); // Initialize FacID Output += "; " + ARBname + cr; } else { FacID1 = ARBdataRowView["ARTCC"].ToString(); Descr1 = ARBdataRowView["Description"].ToString(); Lat1 = Conversions.DecDeg2SCT(Convert.ToSingle(ARBdataRowView["Latitude"]), true); Long1 = Conversions.DecDeg2SCT(Convert.ToSingle(ARBdataRowView["Longitude"]), false); if ((FacID0.Length != 0) && (FacID0 == FacID1)) { Output += SCTstrings.BoundaryOut(FacID1 + HL, Lat0, Long0, Lat1, Long1, Descr0) + cr; } } if (Descr1.IndexOf("POINT OF BEGINNING") != -1) // Last line in this group { Output += SCTstrings.BoundaryOut(FacID1 + HL, Lat0, Long0, Lat1, Long1, Descr0) + cr; Output += SCTstrings.BoundaryOut(FacID1 + HL, Lat1, Long1, LatFirst, LongFirst) + cr; sw.WriteLine(Output); Lat1 = Long1 = FacID1 = Descr1 = Output = string.Empty; } if ((FacID0.Length != 0) && (FacID0 != FacID1)) // Changed ARTCC { // Do NOT add a line to close boundary // Check for dual condition; end of group AND new ARTCC... if (Output.Length != 0) { sw.WriteLine(Output); } Output = string.Empty; } Lat0 = Lat1; Long0 = Long1; FacID0 = FacID1; Descr0 = Descr1; } } } ARBview.Dispose(); }