private string DrawFix_Symbol() { string result = string.Empty; string curFix = HoldFixTextBox.Text; object[] NavData; if (DrawFixSymbol) { NavData = SCTcommon.GetNavData(curFix); result += Hershey.DrawSymbol(NavData); } return(result); }
private void DrawButton_Click(object sender, EventArgs e) { string result = string.Empty; object[] NavData; string curFix; double Lat1 = Conversions.DMS2Degrees(LatTextBox.Text, "."); double Lon1 = Conversions.DMS2Degrees(LonTextBox.Text, "."); int Brg = Convert.ToInt32(BearingTextBox.Text) - 90; // Rotation in addition to MagVar float Scale = Convert.ToSingle(ScaleTextBox.Text); // Scaling beyond internal 1/3600 if (IncludeSymbolCheckBox.Checked && (FixListDataGridView.CurrentRow != null)) { curFix = FixListDataGridView.CurrentRow.Cells[0].Value.ToString(); NavData = SCTcommon.GetNavData(curFix); result += Hershey.DrawSymbol(NavData); } result += Hershey.WriteHF(LabelTextBox.Text, Lat1, Lon1, Brg, Scale); OutputTextBox.Text = result; }
private static string DrawFixInfo(List <string> FixNames, int Angle = 0, float Scale = 1f) { // Calling function for fixes in diagrams // Because labels and/or symbols might be drawn // Will need to add the DrawFixNames for ALT and SPEED here string result = string.Empty; float Latitude; float Longitude; float[] AdjustedCoords = null; foreach (string Fix in FixNames) { // FixInfo returns: 0-Fix (calling ID), 1-Freq, 2-Lat, 3-Lon, 4-Name or Use, 5-Type object[] FixData = SCTcommon.GetNavData(Fix); if ((FixData[5].ToString() != "NA") && (FixData[0].ToString().Length != 0)) { Latitude = Convert.ToSingle(FixData[3]); Longitude = Convert.ToSingle(FixData[4]); if ((Latitude != 0) && (Longitude != 0)) { if (InfoSection.DrawFixSymbolsOnDiagrams) { result += Hershey.DrawSymbol(FixData); AdjustedCoords = Hershey.Adjust(Latitude, Longitude, 15, -30); } if (InfoSection.DrawFixLabelsOnDiagrams) { if (!InfoSection.DrawFixSymbolsOnDiagrams) { AdjustedCoords = Hershey.Adjust(Latitude, Longitude, 5, 0); } result += Hershey.WriteHF(Fix, AdjustedCoords[0], AdjustedCoords[1], Angle, Scale); } } } } return(result); }
private static void BuildSSD(DataView dvSSD) { // Builds ONE SID or STAR from ONE SSD dataview (preselected) // RETURNS a string for the diagram // Everything goes in List<string>s first object[] NavData; // Various and sundry variables for the loop double Lat1 = -1; double Lon1 = -1; string space = new string(' ', 27); double Lat0 = -1; double Lon0 = -1; string lastFix = string.Empty; string curFix; string FixType0; string FixType1; string SSDname; string TransitionName; string SSDcode; string TransitionCode; int FixCount0; int FixCount1; // Get the name and code for this SSD SSDname = dvSSD[0]["SSDName"].ToString(); SSDcode = dvSSD[0]["SSDcode"].ToString(); SSDlines.Add(cr); SSDlines.Add(SSDHeader(SSDcode, "(" + SSDname + ")", 1, '-')); // Now loop the entire SSD to get the lines, etc. foreach (DataRowView SSDrow in dvSSD) { // Get the basics - usual process: Lat1, shift to Lat0 or not, print... // Regardless, do a shift at the end (Making values empty indicates pen up) curFix = SSDrow["NavAid"].ToString(); // The FixType tells us what to do next FixType1 = SSDrow["FixType"].ToString(); // If it's an airport, record the APT ICOA and move to next row if (FixType1 == "AA" || FixType1 == "NA") { // Save the APTs for later... Add2ListIfNew(APTsUsed, curFix); curFix = string.Empty; // Pen up next 2 loops } else { // Save the FIX for later if new... FixCount0 = FixesUsed.Count; Add2ListIfNew(FixesUsed, curFix); FixCount1 = FixesUsed.Count; // NavData: ID(opt), FacilityID, Frequency(opt), Latitude, Longitude, NameOrFixUse, FixType NavData = SCTcommon.GetNavData(curFix); if (FixCount1 > FixCount0) { if (NavData[6].ToString().IndexOf("FIX") != -1) { FixData.Add(NavData); } if (NavData[6].ToString().IndexOf("VOR") != -1) { VORData.Add(NavData); } if (NavData[6].ToString().IndexOf("NDB") != -1) { NDBData.Add(NavData); } } Lat1 = Convert.ToDouble(NavData[3]); Lon1 = Convert.ToDouble(NavData[4]); } // If there's a Transition Name, it starts a new line set. // Keep these coordinates to start the line TransitionName = SSDrow["TransitionName"].ToString(); TransitionCode = SSDrow["TransitionCode"].ToString(); if (TransitionName.Length != 0) { SSDlines.Add(space + "; " + TransitionName); } else { // Finally get the line between waypoints if ((lastFix.Length != 0) && (curFix.Length != 0) && (lastFix != curFix)) { SSDlines.Add(SCTstrings.SSDout(Lat0, Lon0, Lat1, Lon1, lastFix, curFix, InfoSection.UseFixesAsCoords)); // Draw the fix names. Angle and Scale not used for SSDs } } // Shift the values for the next item Lat0 = Lat1; Lon0 = Lon1; lastFix = curFix; FixType0 = FixType1; TransitionCode = TransitionName = string.Empty; } // Lastly insert the symbols and labels if (InfoSection.DrawFixSymbolsOnDiagrams || InfoSection.DrawFixLabelsOnDiagrams) { SSDlines.Add(DrawFixInfo(FixesUsed)); } // Need to add the ALT and Speed items here }