コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: LineGenerator.cs プロジェクト: drchuck59/SCTBuilder
        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];
                }
            }
        }
コード例 #3
0
        public static void WriteAWY(string path, bool IsLow)
        {
            DataTable AWY = Form1.AWY;
            string    Awy0 = string.Empty; string Awy1;
            string    NavAid0 = string.Empty; string NavAid1;
            double    Lat0 = -1; double Lat1 = -1;
            double    Lon0 = -1; double Lon1 = -1;
            bool      IsBreak;
            string    filter = "[Selected]";

            if (IsLow)
            {
                filter += " AND [IsLow]";
            }
            else
            {
                filter += " AND NOT [IsLow]";
            }
            DataView dvAWY = new DataView(AWY)
            {
                RowFilter = filter,
                Sort      = "AWYID, Sequence",
            };

            // Rotate output as in other output loops
            using (StreamWriter sw = new StreamWriter(path))
            {
                sw.WriteLine(CycleHeader);
                if (IsLow)
                {
                    sw.WriteLine("[LOW AIRWAY]");
                }
                else
                {
                    sw.WriteLine("[HIGH AIRWAY]");
                }
                foreach (DataRowView rowAWY in dvAWY)
                {
                    Awy1    = rowAWY["AWYID"].ToString();
                    NavAid1 = rowAWY["NAVAID"].ToString();
                    IsBreak = (bool)rowAWY["IsBreak"];
                    Lat1    = Convert.ToSingle(rowAWY["Latitude"]);
                    Lon1    = Convert.ToSingle(rowAWY["Longitude"]);
                    if (IsBreak)
                    {
                        Lat1 = -1f;            // Break in awy; restart sequence with next
                    }
                    if (Awy1 != Awy0)
                    {
                        Lat0 = -1f;                     // New air, last segment was written (but save this coord)
                    }
                    {
                        if ((Lat0 != -1) && (Lat1 != -1))
                        {
                            sw.WriteLine(SCTstrings.AWYout(Awy1,
                                                           Conversions.DecDeg2SCT(Convert.ToSingle(Lat0), true),
                                                           Conversions.DecDeg2SCT(Convert.ToSingle(Lon0), false),
                                                           Conversions.DecDeg2SCT(Convert.ToSingle(Lat1), true),
                                                           Conversions.DecDeg2SCT(Convert.ToSingle(Lon1), false),
                                                           NavAid0, NavAid1));
                        }
                    }
                    // Shift all items
                    Awy0 = Awy1; NavAid0 = NavAid1;
                    Lat0 = Lat1; Lon0 = Lon1;
                }
            }
            dvAWY.Dispose();
        }