void displayLastFSDOrScoop(HistoryEntry he) { pictureBox.ClearImageList(); lastHE = he; if (he != null) { Color textcolour = IsTransparent ? discoveryform.theme.SPanelColor : discoveryform.theme.LabelColor; Color backcolour = IsTransparent ? Color.Black : this.BackColor; ExtendedControls.PictureBoxHotspot.ImageElement edsm = pictureBox.AddTextFixedSizeC(new Point(5, 5), new Size(80, 20), "EDSM", displayfont, backcolour, textcolour, 0.5F, true, he, "View system on EDSM"); edsm.SetAlternateImage(BaseUtils.BitMapHelpers.DrawTextIntoFixedSizeBitmapC("EDSM", edsm.img.Size, displayfont, backcolour, textcolour.Multiply(1.2F), 0.5F, true), edsm.pos, true); ExtendedControls.PictureBoxHotspot.ImageElement start = pictureBox.AddTextFixedSizeC(new Point(5, 35), new Size(80, 20), "Start", displayfont, backcolour, textcolour, 0.5F, true, "Start", "Set a journey start point"); start.SetAlternateImage(BaseUtils.BitMapHelpers.DrawTextIntoFixedSizeBitmapC("Start", edsm.img.Size, displayfont, backcolour, textcolour.Multiply(1.2F), 0.5F, true), start.pos, true); backcolour = IsTransparent ? Color.Transparent : this.BackColor; EliteDangerousCalculations.FSDSpec.JumpInfo ji = he.GetJumpInfo(); // may be null String line = " Target Not Set"; if (TargetClass.GetTargetPosition(out string name, out Point3D tpos)) { double dist = he.System.Distance(tpos.X, tpos.Y, tpos.Z); string mesg = "Left"; if (ji != null) { int jumps = (int)Math.Ceiling(dist / ji.avgsinglejump); if (jumps > 0) { mesg = "@ " + jumps.ToString() + ((jumps == 1) ? " jump" : " jumps"); } } line = String.Format("{0} | {1:N2}ly {2}", name, dist, mesg); } line = String.Format("{0} [{1}] | {2}", he.System.Name, discoveryform.history.GetVisitsCount(he.System.Name), line); pictureBox.AddTextAutoSize(new Point(100, 5), new Size(1000, 40), line, displayfont, textcolour, backcolour, 1.0F); line = String.Format("{0:n}{1} @ {2} | {3} | ", he.TravelledDistance, ((he.TravelledMissingjump > 0) ? "ly (*)" : "ly"), he.Travelledjumps, he.TravelledSeconds); ExtendedControls.PictureBoxHotspot.ImageElement botlineleft = pictureBox.AddTextAutoSize(new Point(100, 35), new Size(1000, 40), line, displayfont, textcolour, backcolour, 1.0F); ShipInformation si = he.ShipInformation; if (si != null) { double fuel = si.FuelLevel; double tanksize = si.FuelCapacity; double warninglevelpercent = si.FuelWarningPercent; line = String.Format("{0}/{1}t", fuel.ToString("N1"), tanksize.ToString("N1")); if (warninglevelpercent > 0 && fuel < tanksize * warninglevelpercent / 100.0) { textcolour = discoveryform.theme.TextBlockHighlightColor; line += String.Format(" < {0}%", warninglevelpercent.ToString("N1")); } if (ji != null) { HistoryEntry lastJet = discoveryform.history.GetLastHistoryEntry(x => x.journalEntry.EventTypeID == JournalTypeEnum.JetConeBoost); if (lastJet != null && lastJet.EventTimeLocal > lastHE.EventTimeLocal) { double jumpdistance = ji.avgsinglejump * (lastJet.journalEntry as EliteDangerousCore.JournalEvents.JournalJetConeBoost).BoostValue; line += String.Format(" [{0:N1}ly @ BOOST]", jumpdistance); } else { line += String.Format(" [{0:N1}ly, {1:N1}ly / {2:N0}]", ji.avgsinglejump, ji.maxjumprange, ji.maxjumps); } } pictureBox.AddTextAutoSize(new Point(botlineleft.pos.Right, 35), new Size(1000, 40), line, displayfont, textcolour, backcolour, 1.0F); } pictureBox.Render(); } }
void DisplayState(HistoryEntry he, HistoryEntry lastfsd) { pictureBox.ClearImageList(); lastHE = he; lastFSD = lastfsd; if (he != null) { Color textcolour = IsTransparent ? discoveryform.theme.SPanelColor : discoveryform.theme.LabelColor; Color backcolour = IsTransparent ? Color.Black : this.BackColor; int leftstart = 5; int topstart = 5; int coltext = leftstart; ExtendedControls.ExtPictureBox.ImageElement iedsm = null; if (showEDSMStartButtonsToolStripMenuItem.Checked) { iedsm = pictureBox.AddTextAutoSize(new Point(leftstart, topstart), new Size(1000, 1000), "EDSM", displayfont, backcolour, textcolour, 0.5F, he, "View system on EDSM"); iedsm.SetAlternateImage(BaseUtils.BitMapHelpers.DrawTextIntoAutoSizedBitmap("EDSM", iedsm.img.Size, displayfont, backcolour, textcolour.Multiply(1.2F), 0.5F), iedsm.pos, true); coltext = iedsm.pos.Right + displayfont.ScalePixels(8); } backcolour = IsTransparent ? Color.Transparent : this.BackColor; EliteDangerousCalculations.FSDSpec.JumpInfo ji = he.GetJumpInfo(); // may be null string line = String.Format("{0} [{1}]", he.System.Name, discoveryform.history.GetVisitsCount(he.System.Name)); if (showTargetToolStripMenuItem.Checked) { if (TargetClass.GetTargetPosition(out string name, out Point3D tpos)) { double dist = he.System.Distance(tpos.X, tpos.Y, tpos.Z); string mesg = "Left".T(EDTx.UserControlTrippanel_Left); if (ji != null) { int jumps = (int)Math.Ceiling(dist / ji.avgsinglejump); if (jumps > 0) { mesg = jumps.ToString() + " " + ((jumps == 1) ? "jump".T(EDTx.UserControlTrippanel_jump) : "jumps".T(EDTx.UserControlTrippanel_jumps)); } } line += String.Format("-> {0} {1:N1}ly {2}", name, dist, mesg); } else { line += " -> Target not set".T(EDTx.UserControlTrippanel_NoT); } } bool firstdiscovery = (lastfsd != null && (lastfsd.journalEntry as EliteDangerousCore.JournalEvents.JournalFSDJump).EDSMFirstDiscover); int line1hpos = coltext; if (firstdiscovery) { var i1 = pictureBox.AddImage(new Rectangle(line1hpos, 5, 24, 24), Icons.Controls.firstdiscover, null, "Shows if EDSM indicates your it's first discoverer".T(EDTx.UserControlTrippanel_FDEDSM), false); line1hpos = i1.pos.Right + Font.ScalePixels(8); } var eline1 = pictureBox.AddTextAutoSize(new Point(line1hpos, topstart), new Size(1000, 1000), line, displayfont, textcolour, backcolour, 1.0F); int line2vpos = eline1.pos.Bottom + displayfont.ScalePixels(8); line = ""; if (showTravelledDistanceToolStripMenuItem.Checked) { line = String.Format("{0:N1}{1},{2} " + "jumps".T(EDTx.UserControlTrippanel_jumps) + ", {3}", he.TravelledDistance, ((he.TravelledMissingjump > 0) ? "ly*" : "ly"), he.Travelledjumps, he.TravelledSeconds); } ShipInformation si = he.ShipInformation; if (si != null) { string addtext = ""; if (showFuelLevelToolStripMenuItem.Checked) { double fuel = si.FuelLevel; double tanksize = si.FuelCapacity; double warninglevelpercent = si.FuelWarningPercent; addtext = String.Format("{0}/{1}t", fuel.ToString("N1"), tanksize.ToString("N1")); if (warninglevelpercent > 0 && fuel < tanksize * warninglevelpercent / 100.0) { textcolour = discoveryform.theme.TextBlockHighlightColor; addtext += String.Format(" < {0}%", warninglevelpercent.ToString("N1")); } } if (ji != null) { HistoryEntry lastJet = discoveryform.history.GetLastHistoryEntry(x => x.journalEntry.EventTypeID == JournalTypeEnum.JetConeBoost); double boostval = 1; if (lastJet != null && lastfsd != null && lastJet.EventTimeLocal > lastfsd.EventTimeLocal) { boostval = (lastJet.journalEntry as EliteDangerousCore.JournalEvents.JournalJetConeBoost).BoostValue; } string range = ""; if (showCurrentFSDRangeToolStripMenuItem.Checked) { range += String.Format("cur {0:N1}ly{1}", ji.cursinglejump * boostval, boostval > 1 ? " Boost" : ""); } if (showAvgFSDRangeToolStripMenuItem.Checked) { range = range.AppendPrePad(String.Format("avg {0:N1}ly{1}", ji.avgsinglejump * boostval, boostval > 1 ? " Boost" : ""), ", "); } if (showMaxFSDRangeToolStripMenuItem.Checked) { range = range.AppendPrePad(String.Format("max {0:N1}ly{1}", ji.curfumessinglejump * boostval, boostval > 1 ? " Boost" : ""), ", "); } if (showFSDRangeToolStripMenuItem.Checked) { range = range.AppendPrePad(String.Format("{0:N1}ly/{1:N0}", ji.maxjumprange, ji.maxjumps), ", "); } if (range.HasChars()) { addtext = addtext.AppendPrePad(range, " | "); } } if (addtext.HasChars()) { line = line.AppendPrePad(addtext, " | "); } } if (showEDSMStartButtonsToolStripMenuItem.Checked) { ExtendedControls.ExtPictureBox.ImageElement start = pictureBox.AddTextFixedSizeC(new Point(leftstart, line2vpos), iedsm.img.Size, "Start", displayfont, backcolour, textcolour, 0.5F, true, "Start", "Set a journey start point"); start.SetAlternateImage(BaseUtils.BitMapHelpers.DrawTextIntoFixedSizeBitmapC("Start", start.img.Size, displayfont, backcolour, textcolour.Multiply(1.2F), 0.5F, true), start.pos, true); } if (line.HasChars()) { pictureBox.AddTextAutoSize(new Point(coltext, line2vpos), new Size(1000, 40), line, displayfont, textcolour, backcolour, 1.0F); } pictureBox.Render(); } }
// double percent = -10; Timer t = new Timer();// play thru harness private void Display(ISystem cursys) { if (currentRoute == null) { DisplayText("Please set a route, by right clicking".T(EDTx.UserControlRouteTracker_NoRoute), "", ""); return; } if (currentRoute.Systems.Count == 0) { DisplayText(currentRoute.Name, "Route contains no waypoints".T(EDTx.UserControlRouteTracker_NoWay), ""); return; } string topline = "", bottomline = "", note = ""; if (!cursys.HasCoordinate) { topline = String.Format("Unknown location".T(EDTx.UserControlRouteTracker_Unk)); bottomline = ""; } else { SavedRouteClass.ClosestInfo closest = currentRoute.ClosestTo(cursys); if (closest == null) // if null, no systems found.. uh oh { topline = String.Format("No systems in route have known co-ords".T(EDTx.UserControlRouteTracker_NoCo)); bottomline = ""; } else { double routedistance = currentRoute.CumulativeDistance(); double distleft = closest.disttowaypoint + (closest.deviation < 0 ? 0 : closest.cumulativewpdist); topline = String.Format("{0} {1} WPs, {2:N1}ly", currentRoute.Name, currentRoute.Systems.Count, routedistance); EliteDangerousCalculations.FSDSpec.JumpInfo ji = currentHE.GetJumpInfo(); string jumpmsg = ""; if (showJumpsToolStripMenuItem.Checked && ji != null) { int jumps = (int)Math.Ceiling(routedistance / ji.avgsinglejump); if (jumps > 0) { topline += ", " + jumps.ToString() + " " + ((jumps == 1) ? "jump".T(EDTx.UserControlRouteTracker_J1) : "jumps".T(EDTx.UserControlRouteTracker_JS)); } jumps = (int)Math.Ceiling(closest.disttowaypoint / ji.avgsinglejump); if (jumps > 0) { jumpmsg = ", " + jumps.ToString() + " " + ((jumps == 1) ? "jump".T(EDTx.UserControlRouteTracker_J1) : "jumps".T(EDTx.UserControlRouteTracker_JS)); } else { jumpmsg = " No Ship FSD Information".T(EDTx.UserControlRouteTracker_NoFSD); } } string wpposmsg = closest.system.Name; if (showWaypointCoordinatesToolStripMenuItem.Checked) { wpposmsg += String.Format(" @{0:N1},{1:N1},{2:N1}", closest.system.X, closest.system.Y, closest.system.Z); } wpposmsg += String.Format(" {0:N1}ly", closest.disttowaypoint); if (closest.deviation < 0) // if not on path { bottomline += closest.cumulativewpdist == 0 ? "From Last WP ".T(EDTx.UserControlRouteTracker_FL) : "To First WP ".T(EDTx.UserControlRouteTracker_TF); bottomline += wpposmsg + jumpmsg; } else { topline += String.Format(", Left {0:N1}ly".T(EDTx.UserControlRouteTracker_LF), distleft); bottomline += String.Format("To WP {0} ".T(EDTx.UserControlRouteTracker_ToWP), closest.waypoint + 1); bottomline += wpposmsg + jumpmsg; if (showDeviationFromRouteToolStripMenuItem.Checked) { bottomline += String.Format(", Dev {0:N1}ly".T(EDTx.UserControlRouteTracker_Dev), closest.deviation); } } if (showBookmarkNotesToolStripMenuItem.Checked) { BookmarkClass bookmark = GlobalBookMarkList.Instance.FindBookmarkOnSystem(cursys.Name); if (bookmark != null) { note = String.Format("Note: {0}".T(EDTx.UserControlRouteTracker_Note), bookmark.Note); } } //System.Diagnostics.Debug.WriteLine("T:" + topline + Environment.NewLine + "B:" + bottomline); string name = closest.system.Name; if (lastsystem == null || name.CompareTo(lastsystem) != 0) { if (autoCopyWPToolStripMenuItem.Checked) { SetClipboardText(name); } if (autoSetTargetToolStripMenuItem.Checked) { string targetName; double x, y, z; TargetClass.GetTargetPosition(out targetName, out x, out y, out z); if (name.CompareTo(targetName) != 0) { TargetHelpers.SetTargetSystem(this, discoveryform, name, false); } } lastsystem = name; } } } DisplayText(topline, bottomline, note); }
//double percent = -10; Timer t = new Timer();// play thru harness private void Display(ISystem cursys) { if (currentRoute == null) { DisplayText("Please set a route, by right clicking", ""); return; } if (currentRoute.Systems.Count == 0) { DisplayText(currentRoute.Name, "Route contains no waypoints"); return; } string topline = "", bottomline = ""; if (!cursys.HasCoordinate) { topline = String.Format("Unknown location"); bottomline = ""; } else { SavedRouteClass.ClosestInfo closest = currentRoute.ClosestTo(cursys); if (closest == null) // if null, no systems found.. uh oh { topline = String.Format("No systems in route have known co-ords"); bottomline = ""; } else { topline = String.Format("{0} {1} WPs, {2:N1}ly", currentRoute.Name, currentRoute.Systems.Count, currentRoute.CumulativeDistance()); double distleft = closest.disttowaypoint + (closest.deviation < 0 ? 0: closest.cumulativewpdist); string jumpmsg = ""; if (showJumpsToolStripMenuItem.Checked) { EliteDangerousCalculations.FSDSpec.JumpInfo ji = currentHE.GetJumpInfo(); if (ji != null) { int jumps = (int)Math.Ceiling(distleft / ji.avgsinglejump); if (jumps > 0) { jumpmsg = " @ " + jumps.ToString() + ((jumps == 1) ? " jump" : " jumps"); } } else { jumpmsg = " No Ship FSD Information"; } } string wpposmsg = String.Format("{0} @ {1:N1},{2:N1},{3:N1} {4:N1}ly", closest.system.Name, closest.system.X, closest.system.Y, closest.system.Z, closest.disttowaypoint); if (closest.deviation < 0) // if not on path { bottomline += closest.cumulativewpdist == 0 ? "From Last WP " : "To First WP "; bottomline += wpposmsg + jumpmsg; } else { topline += String.Format(", Left {0:N1}ly", distleft); bottomline += String.Format("To WP {0} ", closest.waypoint + 1); bottomline += wpposmsg + jumpmsg; bottomline += String.Format(", Dev {0:N1}ly", closest.deviation); } //System.Diagnostics.Debug.WriteLine("T:" + topline + Environment.NewLine + "B:" + bottomline); string name = closest.system.Name; if (lastsystem == null || name.CompareTo(lastsystem) != 0) { if (autoCopyWPToolStripMenuItem.Checked) { Clipboard.SetText(name); } if (autoSetTargetToolStripMenuItem.Checked) { string targetName; double x, y, z; TargetClass.GetTargetPosition(out targetName, out x, out y, out z); if (name.CompareTo(targetName) != 0) { TargetHelpers.setTargetSystem(this, discoveryform, name, false); } } lastsystem = name; } } } DisplayText(topline, bottomline); }