コード例 #1
0
        // curmats may be null
        Point CreateMaterialNodes(List <ExtPictureBox.ImageElement> pc, JournalScan sn, MaterialCommoditiesList curmats, HistoryList hl, Point matpos, Size matsize)
        {
            Point startpos  = matpos;
            Point maximum   = matpos;
            int   noperline = 0;

            bool noncommon = ShowMaterialsRare;

            string matclicktext = sn.DisplayMaterials(2, curmats, hl.GetLast?.MaterialCommodity);

            foreach (KeyValuePair <string, double> sd in sn.Materials)
            {
                string tooltip = sn.DisplayMaterial(sd.Key, sd.Value, curmats, hl.GetLast?.MaterialCommodity);

                Color  fillc = Color.Yellow;
                string abv   = sd.Key.Substring(0, 1);

                MaterialCommodityData mc = MaterialCommodityData.GetByFDName(sd.Key);

                if (mc != null)
                {
                    abv   = mc.Shortname;
                    fillc = mc.Colour;

                    if (HideFullMaterials)                 // check full
                    {
                        int?limit = mc.MaterialLimit();
                        MaterialCommodities matnow = curmats?.Find(mc);  // allow curmats = null

                        // debug if (matnow != null && mc.shortname == "Fe")  matnow.count = 10000;

                        if (matnow != null && limit != null && matnow.Count >= limit)        // and limit
                        {
                            continue;
                        }
                    }

                    if (noncommon && mc.IsCommonMaterial)
                    {
                        continue;
                    }
                }

                CreateMaterialImage(pc, matpos, matsize, abv, tooltip + "\n\n" + "All " + matclicktext, tooltip, fillc, Color.Black);

                maximum = new Point(Math.Max(maximum.X, matpos.X + matsize.Width), Math.Max(maximum.Y, matpos.Y + matsize.Height));

                if (++noperline == 4)
                {
                    matpos    = new Point(startpos.X, matpos.Y + matsize.Height + materiallinespacerxy);
                    noperline = 0;
                }
                else
                {
                    matpos.X += matsize.Width + materiallinespacerxy;
                }
            }

            return(maximum);
        }
コード例 #2
0
ファイル: JournalScan.cs プロジェクト: wmeacham/EDDiscovery
        public string DisplayMaterial(string fdname, double percent, MaterialCommoditiesList historicmatlist = null, MaterialCommoditiesList currentmatlist = null)
        {
            StringBuilder scanText = new StringBuilder();

            MaterialCommodityData mc = MaterialCommodityData.GetByFDName(fdname);

            if (mc != null && (historicmatlist != null || currentmatlist != null))
            {
                MaterialCommodities historic = historicmatlist?.Find(mc);
                MaterialCommodities current  = ReferenceEquals(historicmatlist, currentmatlist) ? null : currentmatlist?.Find(mc);
                int?limit = mc.MaterialLimit();

                string matinfo = historic?.Count.ToString() ?? "0";
                if (limit != null)
                {
                    matinfo += "/" + limit.Value.ToString();
                }

                if (current != null && (historic == null || historic.Count != current.Count))
                {
                    matinfo += " Cur " + current.Count.ToString();
                }

                scanText.AppendFormat("{0} ({1}) {2} {3}% {4}\n", mc.Name, mc.Shortname, mc.TranslatedType, percent.ToString("N1"), matinfo);
            }
            else
            {
                scanText.AppendFormat("{0} {1}%\n", System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(fdname.ToLowerInvariant()),
                                      percent.ToString("N1"));
            }

            return(scanText.ToNullSafeString());
        }
コード例 #3
0
        public override void FillInformation(out string info, out string detailed)
        {
            MaterialCommodityData mcd = MaterialCommodityData.GetByFDName(Type);

            if (mcd != null)
            {
                info = BaseUtils.FieldBuilder.Build("", Type_Localised, "< (", mcd.TranslatedCategory, ";)", mcd.TranslatedType, "Total:".T(EDTx.JournalEntry_Total), Total);
            }
            else
            {
                info = Type_Localised;
            }
            detailed = "";
        }
コード例 #4
0
 public bool FromString(string s)                    // serialise from string
 {
     string[] parts = s.Split(',');
     if (parts.Length == 4)
     {
         fromelement = MaterialCommodityData.GetByFDName(parts[0]);
         element     = MaterialCommodityData.GetByFDName(parts[1]);
         return(fromelement != null && element != null && parts[2].InvariantParse(out offer) && parts[3].InvariantParse(out receive));
     }
     else
     {
         return(false);
     }
 }
コード例 #5
0
        public override void FillInformation(out string info, out string detailed)
        {
            MaterialCommodityData mcd = MaterialCommodityData.GetByFDName(Name);

            if (mcd != null)
            {
                info = BaseUtils.FieldBuilder.Build("", FriendlyName, "< (", mcd.TranslatedCategory, ";)", mcd.TranslatedType, "; items".T(EDTx.JournalEntry_MatC), Count, "Total: ".T(EDTx.JournalEntry_Total), Total);
            }
            else
            {
                info = BaseUtils.FieldBuilder.Build("", FriendlyName, "< ; items".T(EDTx.JournalEntry_MatC), Count);
            }

            detailed = "";
        }
コード例 #6
0
            public int[] content;                  // number in each cat, high/med/low

            public static MaterialsFound Find(string fdname, List <MaterialsFound> list)
            {
                MaterialsFound mat = list.Find(x => x.matnamefd2.Equals(fdname, StringComparison.InvariantCultureIgnoreCase));

                if (mat == null)
                {
                    mat                   = new MaterialsFound();
                    mat.matnamefd2        = fdname;
                    mat.friendlyname      = MaterialCommodityData.GetByFDName(fdname)?.Name ?? fdname;
                    mat.prospectedamounts = new List <double>();
                    mat.content           = new int[3];
                    list.Add(mat);
                }

                return(mat);
            }
コード例 #7
0
        public override void FillInformation(out string info, out string detailed)
        {
            info = BaseUtils.FieldBuilder.Build("", FriendlyName);
            MaterialCommodityData mcd = MaterialCommodityData.GetByFDName(Name);

            if (mcd != null)
            {
                info += BaseUtils.FieldBuilder.Build(" (", mcd.TranslatedCategory, ";)", mcd.TranslatedType);
            }

            if (DiscoveryNumber > 0)
            {
                info += string.Format(", Discovery {0}".T(EDTx.JournalMaterialDiscovered_DN), DiscoveryNumber);
            }
            detailed = "";
        }
コード例 #8
0
        private void buttonExtExcel_Click(object sender, EventArgs e)
        {
            Forms.ExportForm frm = new Forms.ExportForm();
            frm.Init(new string[] { "All" }, disablestartendtime: true);

            if (frm.ShowDialog(FindForm()) == DialogResult.OK)
            {
                BaseUtils.CSVWriteGrid grd = new BaseUtils.CSVWriteGrid();
                grd.SetCSVDelimiter(frm.Comma);

                var found = ReadHistory(out int prospectorsused, out int collectorsused, out int asteroidscracked, out int prospected, out int[] content);

                grd.GetPreHeader += delegate(int r)
                {
                    if (r == 0)
                    {
                        return new Object[] { "Limpets left ", limpetsleftdisplay, "Prospectors Fired", prospectorsused, "Collectors Deployed", collectorsused }
                    }
                    ;
                    else if (r == 1)
                    {
                        return(new object[0]);
                    }
                    else
                    {
                        return(null);
                    }
                };

                grd.GetSetsPad = delegate(int s, int r)
                {
                    return(r < 2 ? new object[0] : null);
                };

                {
                    grd.GetSetsHeader.Add(delegate(int s, int r)
                    {
                        if (r == 0)
                        {
                            return new object[] { "", "Ref.", "Coll.", "Pros", "Ratio%", "Avg%", "Min%", "Max%", "M.Load", "High Ct", "Med Ct", "Low Ct", "Discv" }
                        }
                        ;
                        else
                        {
                            return(null);
                        }
                    });

                    grd.GetSetsData.Add(delegate(int s, int r)
                    {
                        if (r == 0)
                        {
                            return(new object[] { "", "", "", prospected.ToString("N0"), "", "", "", "", "",
                                                  content[0].ToString("N0"),
                                                  content[1].ToString("N0"),
                                                  content[2].ToString("N0") });
                        }
                        else if (r <= found.Count)
                        {
                            MaterialsFound f = found[r - 1];
                            return(new object[] { f.friendlyname, f.amountrefined, f.amountcollected - f.amountdiscarded,
                                                  f.prospectednoasteroids > 0 ? f.prospectednoasteroids.ToString("N0") : "",
                                                  f.prospectednoasteroids > 0 ? (100.0 * (double)f.prospectednoasteroids / prospected).ToString("N1") : "",
                                                  f.prospectednoasteroids > 0 ? f.prospectedamounts.Average().ToString("N1") : "",
                                                  f.prospectednoasteroids > 0 ? f.prospectedamounts.Min().ToString("N1") : "",
                                                  f.prospectednoasteroids > 0 ? f.prospectedamounts.Max().ToString("N1") : "",
                                                  f.motherloadasteroids > 0 ? f.motherloadasteroids.ToString("N0") : "",
                                                  f.prospectednoasteroids > 0 ? f.content[0].ToString("N0") :"",
                                                  f.prospectednoasteroids > 0 ? f.content[1].ToString("N0") : "",
                                                  f.prospectednoasteroids > 0 ? f.content[2].ToString("N0") : "",
                                                  f.discovered ? "*" : "" });
                        }
                        else
                        {
                            return(null);
                        }
                    });
                }

                var prosmat = found.Where(x => x.prospectednoasteroids > 0).ToList();

                {
                    grd.GetSetsHeader.Add(delegate(int s, int r)
                    {
                        if (r == 0)
                        {
                            Object[] ret = new object[prosmat.Count + 1];
                            ret[0]       = "CDFb";

                            for (int i = 0; i < prosmat.Count; i++)
                            {
                                ret[i + 1] = prosmat[i].friendlyname;
                            }

                            return(ret);
                        }
                        else
                        {
                            return(null);
                        }
                    });

                    grd.GetSetsData.Add(delegate(int s, int r)
                    {
                        if (r < CFDbMax)
                        {
                            Object[] ret = new object[prosmat.Count + 1];
                            int percent  = r;
                            ret[0]       = percent.ToString("N0") + "%";
                            for (int m = 0; m < prosmat.Count; m++)
                            {
                                if (prosmat[m].prospectednoasteroids > 0)
                                {
                                    ret[m + 1] = ((double)prosmat[m].prospectedamounts.Count(x => x >= percent) / prosmat[m].prospectednoasteroids * 100.0).ToString("N1");
                                }
                                else
                                {
                                    ret[m + 1] = "";
                                }
                            }

                            return(ret);
                        }
                        else
                        {
                            return(null);
                        }
                    });
                }

                {
                    const int precol = 4;

                    grd.GetSetsHeader.Add(delegate(int s, int r)
                    {
                        if (r == 0)
                        {
                            Object[] ret = new object[found.Count + precol];
                            ret[0]       = "Event";
                            ret[1]       = "Time";
                            ret[2]       = "Content";
                            ret[3]       = "Motherload";

                            for (int i = 0; i < prosmat.Count; i++)
                            {
                                ret[i + precol] = prosmat[i].friendlyname;
                            }

                            return(ret);
                        }
                        else
                        {
                            return(null);
                        }
                    });

                    var proslist = curlist.Where(x => x.EntryType == JournalTypeEnum.ProspectedAsteroid).ToList();

                    grd.GetSetsData.Add(delegate(int s, int r)
                    {
                        if (r < proslist.Count)
                        {
                            var jp = proslist[r].journalEntry as JournalProspectedAsteroid;

                            Object[] ret = new object[prosmat.Count + precol];
                            ret[0]       = (r + 1).ToString("N0");
                            ret[1]       = jp.EventTimeUTC.ToStringZulu();
                            ret[2]       = jp.Content.ToString();
                            ret[3]       = MaterialCommodityData.GetByFDName(jp.MotherlodeMaterial)?.Name ?? jp.MotherlodeMaterial;

                            for (int m = 0; m < prosmat.Count; m++)
                            {
                                int mi = Array.FindIndex(jp.Materials, x => x.Name == prosmat[m].matnamefd2);
                                if (mi >= 0)
                                {
                                    ret[m + precol] = jp.Materials[mi].Proportion.ToString("N2");
                                }
                                else
                                {
                                    ret[m + precol] = "";
                                }
                            }
                            return(ret);
                        }
                        else
                        {
                            return(null);
                        }
                    });
                }

                grd.WriteGrid(frm.Path, frm.AutoOpen, FindForm());
            }
        }
コード例 #9
0
        private void Display()
        {
            //Stopwatch swp = new Stopwatch(); swp.Start();

            System.Diagnostics.Trace.WriteLine(BaseUtils.AppTicks.TickCountLap(this, true) + " MK " + displaynumber + " Begin Display");

            DataGridViewColumn sortcol   = dataGridViewMarketData.SortedColumn != null ? dataGridViewMarketData.SortedColumn : dataGridViewMarketData.Columns[0];
            SortOrder          sortorder = dataGridViewMarketData.SortOrder;

            int    firstdisplayed = dataGridViewMarketData.FirstDisplayedScrollingRowIndex;
            string commodity      = (dataGridViewMarketData.CurrentRow != null) ? (string)dataGridViewMarketData.CurrentRow.Cells[1].Value : null;
            int    currentoffset  = (dataGridViewMarketData.CurrentRow != null) ? Math.Max(0, dataGridViewMarketData.CurrentRow.Index - firstdisplayed) : 0;

            dataGridViewMarketData.Rows.Clear();
            labelLocation.Text = "No Data".Tx();
            toolTip.SetToolTip(labelLocation, null);

            HistoryEntry left  = (eddmd_left != null) ? eddmd_left : last_eddmd; // if we have a selected left, use it, else use the last eddmd
            HistoryEntry cargo = (eddmd_left != null) ? eddmd_left : last_he;    // if we have a selected left, use it, else use the last he

            if (left != null)                                                    // we know it has a journal entry of EDD commodity..
            {
                //System.Diagnostics.Debug.WriteLine(Environment.NewLine + "From " + current_displayed?.WhereAmI + " to " + left.WhereAmI);

                JournalCommodityPricesBase ecp  = left.journalEntry as JournalCommodityPricesBase;
                List <CCommodities>        list = ecp.Commodities;

                //System.Diagnostics.Debug.WriteLine("Test Right " + eddmd_right?.WhereAmI + " vs " + left.WhereAmI);
                if (eddmd_right != null && !Object.ReferenceEquals(eddmd_right, left))   // if got a comparision, and not the same data..
                {
                    if (checkBoxAutoSwap.Checked &&
                        left.System.Name.Equals(eddmd_right.System.Name) &&     // if left system being displayed is same as right system
                        left.WhereAmI.Equals(eddmd_right.WhereAmI))             // that means we can autoswap comparisions around
                    {
                        //System.Diagnostics.Debug.WriteLine("Arrived at last left station, repick " + current_displayed.WhereAmI + " as comparision");

                        int index = comboboxentries.FindIndex(x => x.System.Name.Equals(current_displayed.System.Name) && x.WhereAmI.Equals(current_displayed.WhereAmI));
                        if (index >= 0)         // if found it, swap to last instance of system
                        {
                            comboBoxCustomTo.Enabled       = false;
                            comboBoxCustomTo.SelectedIndex = index + 1;
                            comboBoxCustomTo.Enabled       = true;
                            eddmd_right = comboboxentries[index];
                            //System.Diagnostics.Debug.WriteLine("Right is now " + eddmd_right.WhereAmI);
                        }
                    }

                    //System.Diagnostics.Debug.WriteLine("Right " + eddmd_right.System.Name + " " + eddmd_right.WhereAmI);
                    list = CCommodities.Merge(list, ((JournalCommodityPricesBase)eddmd_right.journalEntry).Commodities, eddmd_right.WhereAmI);
                }

                List <MaterialCommodities> mclist   = cargo.MaterialCommodity.Sort(true);   // stuff we have..  commodities only
                List <MaterialCommodities> notfound = new List <MaterialCommodities>();
                foreach (MaterialCommodities m in mclist)
                {
                    int index = list.FindIndex(x => x.fdname.EqualsAlphaNumOnlyNoCase(m.Details.Name));   // try and match, remove any spaces/_ and lower case it for matching
                    if (index >= 0)
                    {
                        list[index].CargoCarried = m.Count; // found it, set cargo count..
                    }
                    else
                    {
                        notfound.Add(m);        // not found, add to list for bottom
                    }
                }

                FontFamily ff      = new FontFamily(this.Font.Name);
                bool       buyonly = checkBoxBuyOnly.Checked;

                foreach (CCommodities c in list)
                {
                    if (!buyonly || (c.buyPrice > 0 || c.ComparisionBuy))
                    {
                        MaterialCommodityData mc = MaterialCommodityData.GetByFDName(c.fdname);

                        object[] rowobj = { mc?.TranslatedType ?? c.loccategory.Alt(c.category),
                                            mc?.Name ?? c.locName,
                                            c.sellPrice > 0 ? c.sellPrice.ToString() : "",
                                            c.buyPrice > 0 ? c.buyPrice.ToString() : "",
                                            c.CargoCarried,
                                            c.demand > 1 ? c.demand.ToString() : "",
                                            c.stock > 0 ? c.stock.ToString() : "",
                                            c.meanPrice > 0 ? c.meanPrice.ToString() : "",
                                            c.ComparisionLR,
                                            c.ComparisionRL };

                        int rowno = dataGridViewMarketData.Rows.Add(rowobj);

                        if (c.ComparisionRightOnly && ff != null && ff.IsStyleAvailable(FontStyle.Italic))
                        {
                            for (int i = 1; i < dataGridViewMarketData.Columns.Count; i++)
                            {
                                dataGridViewMarketData.Rows[rowno].Cells[i].Style.Font = new Font(this.Font, FontStyle.Italic);
                            }
                        }

                        dataGridViewMarketData.Rows[rowno].Cells[0].ToolTipText     =
                            dataGridViewMarketData.Rows[rowno].Cells[1].ToolTipText = c.ToString();
                    }
                }

                foreach (MaterialCommodities m in notfound)
                {
                    if (m.Count > 0)
                    {
                        object[] rowobj = { m.Details.TranslatedType,
                                            m.Details.Name,
                                            "",
                                            "",
                                            m.Count,
                                            "",
                                            "",
                                            "",
                                            "",
                                            "" };

                        int rowno = dataGridViewMarketData.Rows.Add(rowobj);
                        dataGridViewMarketData.Rows[rowno].Cells[0].ToolTipText     =
                            dataGridViewMarketData.Rows[rowno].Cells[1].ToolTipText = "Cargo only, no market data on this item".Tx(this, "Conly");
                    }
                }

                current_displayed  = left;
                labelLocation.Text = left.System.Name + ":" + left.WhereAmI;
                string r = "Recorded at " + ((EDDiscoveryForm.EDDConfig.DisplayUTC) ? left.EventTimeUTC.ToString() : left.EventTimeLocal.ToString());
                toolTip.SetToolTip(labelLocation, r);

                System.Diagnostics.Trace.WriteLine(BaseUtils.AppTicks.TickCountLap(this) + " MK " + displaynumber + " Load Finished");
            }

            dataGridViewMarketData.Sort(sortcol, (sortorder == SortOrder.Descending) ? ListSortDirection.Descending : ListSortDirection.Ascending);
            dataGridViewMarketData.Columns[sortcol.Index].HeaderCell.SortGlyphDirection = sortorder;

            if (commodity != null)
            {
                foreach (DataGridViewRow rw in dataGridViewMarketData.Rows)
                {
                    string v = (string)rw.Cells[1].Value;
                    if (v.Equals(commodity))            // Find the commodity, and set it to the same relative position as before.
                    {
                        dataGridViewMarketData.CurrentCell = dataGridViewMarketData.Rows[rw.Index].Cells[1];
                        dataGridViewMarketData.FirstDisplayedScrollingRowIndex = Math.Max(rw.Index - currentoffset, 0);
                        break;
                    }
                }
            }

            //System.Diagnostics.Debug.WriteLine("Stop watch" + swp.ElapsedMilliseconds);
        }
コード例 #10
0
        // curmats may be null
        Point CreateMaterialNodes(List <ExtPictureBox.ImageElement> pc, JournalScan sn, MaterialCommoditiesList curmats, HistoryList hl, Point matpos, Size matsize)
        {
            Point startpos  = matpos;
            Point maximum   = matpos;
            int   noperline = 0;

            string matclicktext = sn.DisplayMaterials(2, curmats, hl.GetLast?.MaterialCommodity);

            foreach (KeyValuePair <string, double> sd in sn.Materials)
            {
                string tooltip = sn.DisplayMaterial(sd.Key, sd.Value, curmats, hl.GetLast?.MaterialCommodity);

                Color  fillc = Color.Yellow;
                string abv   = sd.Key.Substring(0, 1);

                MaterialCommodityData mc = MaterialCommodityData.GetByFDName(sd.Key);

                if (mc != null)
                {
                    abv   = mc.Shortname;
                    fillc = mc.Colour;

                    if (HideFullMaterials)                 // check full
                    {
                        int?limit = mc.MaterialLimit();
                        MaterialCommodities matnow = curmats?.Find(mc);  // allow curmats = null

                        // debug if (matnow != null && mc.shortname == "Fe")  matnow.count = 10000;

                        if (matnow != null && limit != null && matnow.Count >= limit)        // and limit
                        {
                            continue;
                        }
                    }

                    if (ShowOnlyMaterialsRare && mc.IsCommonMaterial)
                    {
                        continue;
                    }
                }

                System.Drawing.Imaging.ColorMap colormap = new System.Drawing.Imaging.ColorMap();
                colormap.OldColor = Color.White;    // this is the marker colour to replace
                colormap.NewColor = fillc;

                Bitmap mat = BaseUtils.BitMapHelpers.ReplaceColourInBitmap((Bitmap)Icons.Controls.Scan_Bodies_Material, new System.Drawing.Imaging.ColorMap[] { colormap });

                BaseUtils.BitMapHelpers.DrawTextCentreIntoBitmap(ref mat, abv, stdfont, Color.Black);

                ExtPictureBox.ImageElement ie = new ExtPictureBox.ImageElement(
                    new Rectangle(matpos.X, matpos.Y, matsize.Width, matsize.Height), mat, tooltip + "\n\n" + "All " + matclicktext, tooltip);

                pc.Add(ie);

                maximum = new Point(Math.Max(maximum.X, matpos.X + matsize.Width), Math.Max(maximum.Y, matpos.Y + matsize.Height));

                if (++noperline == 4)
                {
                    matpos    = new Point(startpos.X, matpos.Y + matsize.Height + materiallinespacerxy);
                    noperline = 0;
                }
                else
                {
                    matpos.X += matsize.Width + materiallinespacerxy;
                }
            }

            return(maximum);
        }
コード例 #11
0
        private async void DrawSystem(HistoryEntry he, bool force)
        {
            StarScan.SystemNode scannode = null;

            var samesys = last_he?.System != null && he?.System != null && he.System.Name == last_he.System.Name;

            //System.Diagnostics.Debug.WriteLine("Scan grid " + samesys + " F:" + force);

            if (he == null)     //  no he, no display
            {
                last_he = he;
                dataGridViewScangrid.Rows.Clear();
                SetControlText("No Scan".T(EDTx.NoScan));
                return;
            }
            else
            {
                scannode = await discoveryform.history.starscan.FindSystemAsync(he.System, true); // get data with EDSM

                if (scannode == null)                                                             // no data, clear display, clear any last_he so samesys is false next time
                {
                    last_he = null;
                    dataGridViewScangrid.Rows.Clear();
                    SetControlText("No Scan".T(EDTx.NoScan));
                    return;
                }

                if (samesys && !force)      // same system, no force, no redisplay
                {
                    return;
                }
            }

            last_he = he;

            // only record first row if same system
            var firstdisplayedrow = (dataGridViewScangrid.RowCount > 0 && samesys) ? dataGridViewScangrid.FirstDisplayedScrollingRowIndex : -1;

            dataGridViewScangrid.RowTemplate.MinimumHeight = Font.ScalePixels(64);        // based on icon size
            bodysize = dataGridViewScangrid.RowTemplate.MinimumHeight;
            iconsize = bodysize / 4;


            dataGridViewScangrid.Rows.Clear();

            var all_nodes = scannode.Bodies.ToList(); // flatten tree of scan nodes to prepare for listing

            var stars       = 0;
            var planets     = 0;
            var terrestrial = 0;
            var gasgiants   = 0;
            var moons       = 0;

            foreach (StarScan.ScanNode sn in all_nodes)
            {
                // define strings to be populated
                var bdClass   = new StringBuilder();
                var bdDist    = new StringBuilder();
                var bdDetails = new StringBuilder();

                if (sn.type == StarScan.ScanNodeType.ring)
                {
                    // do nothing, by now
                }
                else if (sn.type == StarScan.ScanNodeType.beltcluster)
                {
                    if (showStructures && sn.ScanData?.BodyName != null)
                    {
                        if (showBelts)
                        {
                            bdClass.Clear();
                            bdClass.Append("Belt Cluster");

                            if (sn.ScanData.ScanType == "Detailed")
                            {
                                bdDetails.Append("Scanned");
                            }
                            else
                            {
                                bdDetails.Append("No scan data available");
                            }

                            if (Math.Abs(sn.ScanData.DistanceFromArrivalLS) > 0)
                            {
                                bdDist.AppendFormat("{0:0.00}AU ({1:0.0}ls)", sn.ScanData.DistanceFromArrivalLS / JournalScan.oneAU_LS, sn.ScanData.DistanceFromArrivalLS);
                            }

                            var img = global::EDDiscovery.Icons.Controls.ScanGrid_Belt;

                            dataGridViewScangrid.Rows.Add(new object[] { null, sn.ScanData.BodyName, bdClass, bdDist, bdDetails });

                            var cur = dataGridViewScangrid.Rows[dataGridViewScangrid.Rows.Count - 1];

                            cur.Tag          = img;
                            cur.Cells[0].Tag = null;
                            cur.Cells[4].Tag = cur.Cells[0].ToolTipText = cur.Cells[1].ToolTipText = cur.Cells[2].ToolTipText = cur.Cells[3].ToolTipText = cur.Cells[4].ToolTipText =
                                sn.ScanData.DisplayString(historicmatlist: last_he.MaterialCommodity, currentmatlist: discoveryform.history.GetLast?.MaterialCommodity);
                        }
                    }
                }
                else
                {
                    var overlays = new Overlays();
                    // check for null data

                    if (sn.ScanData?.BodyName != null)
                    {
                        // check for body class
                        if (sn.ScanData.IsStar)
                        {
                            // is a star, so populate its information field with relevant data
                            stars++;

                            // star class
                            if (sn.ScanData.StarTypeText != null)
                            {
                                bdClass.Append(sn.ScanData.StarTypeText);
                            }

                            // is the main star?
                            if (sn.ScanData.BodyName.EndsWith(" A", StringComparison.Ordinal))
                            {
                                bdDist.AppendFormat("Main Star".T(EDTx.UserControlScanGrid_MainStar));
                            }
                            // if not, then tell us its hierarchy leveland distance from main star
                            else if (sn.ScanData.nSemiMajorAxis.HasValue)
                            {
                                if (sn.ScanData.IsStar || sn.ScanData.nSemiMajorAxis.Value > JournalScan.oneAU_m / 10)
                                {
                                    bdDist.AppendFormat("{0:0.00}AU ({1:0.00}ls)", (sn.ScanData.nSemiMajorAxis.Value / JournalScan.oneAU_m), sn.ScanData.nSemiMajorAxis.Value / JournalScan.oneLS_m);
                                }
                                else
                                {
                                    bdDist.AppendFormat("{0}km", (sn.ScanData.nSemiMajorAxis.Value / 1000).ToString("N1"));
                                }
                            }

                            // display stellar bodies mass, in sols
                            if (sn.ScanData.nStellarMass.HasValue)
                            {
                                bdDetails.Append("Mass".T(EDTx.UserControlScanGrid_Mass)).Append(": ").Append(sn.ScanData.nStellarMass.Value.ToString("N2")).Append(", ");
                            }

                            // display stellar bodies radius in sols
                            if (sn.ScanData.nRadius.HasValue)
                            {
                                bdDetails.Append("Radius".T(EDTx.UserControlScanGrid_Radius)).Append(": ").Append((sn.ScanData.nRadius.Value / JournalScan.oneSolRadius_m).ToString("N2")).Append(", ");
                            }

                            // show the temperature
                            if (sn.ScanData.nSurfaceTemperature.HasValue)
                            {
                                bdDetails.Append("Temperature".T(EDTx.UserControlScanGrid_Temperature)).Append(": ").Append((sn.ScanData.nSurfaceTemperature.Value)).Append("K.");
                            }

                            // habitable zone for stars - do not display for black holes.
                            if (showStellarZones)
                            {
                                if (showHabitable && sn.ScanData.HabitableZoneInner != null && sn.ScanData.HabitableZoneOuter != null && sn.ScanData.StarTypeID != EDStar.H)
                                {
                                    bdDetails.AppendFormat(Environment.NewLine + "Habitable Zone".T(EDTx.UserControlScanGrid_HabitableZone) + ": {0}-{1}AU ({2}). ", (sn.ScanData.HabitableZoneInner.Value / JournalScan.oneAU_LS).ToString("N2"), (sn.ScanData.HabitableZoneOuter.Value / JournalScan.oneAU_LS).ToString("N2"), sn.ScanData.GetHabZoneStringLs());
                                }
                                if (showMetalRich && sn.ScanData.MetalRichZoneInner != null && sn.ScanData.MetalRichZoneOuter != null && sn.ScanData.StarTypeID != EDStar.H)
                                {
                                    bdDetails.AppendFormat(Environment.NewLine + "Metal Rich bodies".T(EDTx.UserControlScanGrid_MetalRichbodies) + ": {0}-{1}AU ({2}). ", (sn.ScanData.MetalRichZoneInner.Value / JournalScan.oneAU_LS).ToString("N2"), (sn.ScanData.MetalRichZoneOuter.Value / JournalScan.oneAU_LS).ToString("N2"), sn.ScanData.GetMetalRichZoneStringLs());
                                }
                                if (showWaterWorlds && sn.ScanData.WaterWrldZoneInner != null && sn.ScanData.WaterWrldZoneOuter != null && sn.ScanData.StarTypeID != EDStar.H)
                                {
                                    bdDetails.AppendFormat(Environment.NewLine + "Water worlds".T(EDTx.UserControlScanGrid_Waterworlds) + ": {0}-{1}AU ({2}). ", (sn.ScanData.WaterWrldZoneInner.Value / JournalScan.oneAU_LS).ToString("N2"), (sn.ScanData.WaterWrldZoneOuter.Value / JournalScan.oneAU_LS).ToString("N2"), sn.ScanData.GetWaterWorldZoneStringLs());
                                }
                                if (showEarthLike && sn.ScanData.EarthLikeZoneInner != null && sn.ScanData.EarthLikeZoneOuter != null && sn.ScanData.StarTypeID != EDStar.H)
                                {
                                    bdDetails.AppendFormat(Environment.NewLine + "Earth likes planets".T(EDTx.UserControlScanGrid_Earthlikesplanets) + ": {0}-{1}AU ({2}). ", (sn.ScanData.EarthLikeZoneInner.Value / JournalScan.oneAU_LS).ToString("N2"), (sn.ScanData.EarthLikeZoneOuter.Value / JournalScan.oneAU_LS).ToString("N2"), sn.ScanData.GetEarthLikeZoneStringLs());
                                }
                                if (showAmmonia && sn.ScanData.AmmonWrldZoneInner != null && sn.ScanData.AmmonWrldZoneOuter != null && sn.ScanData.StarTypeID != EDStar.H)
                                {
                                    bdDetails.AppendFormat(Environment.NewLine + "Ammonia worlds".T(EDTx.UserControlScanGrid_Ammoniaworlds) + ": {0}-{1}AU ({2}). ", (sn.ScanData.AmmonWrldZoneInner.Value / JournalScan.oneAU_LS).ToString("N2"), (sn.ScanData.AmmonWrldZoneOuter.Value / JournalScan.oneAU_LS).ToString("N2"), sn.ScanData.GetAmmoniaWorldZoneStringLs());
                                }
                                if (showIcyBodies && sn.ScanData.IcyPlanetZoneInner != null && sn.ScanData.IcyPlanetZoneOuter != null && sn.ScanData.StarTypeID != EDStar.H)
                                {
                                    bdDetails.AppendFormat(Environment.NewLine + "Habitable Zone".T(EDTx.UserControlScanGrid_HabitableZone) + ": {0}AU-{1} ({2}). ", (sn.ScanData.IcyPlanetZoneInner.Value / JournalScan.oneAU_LS).ToString("N2"), (sn.ScanData.IcyPlanetZoneOuter), sn.ScanData.GetIcyPlanetsZoneStringLs());
                                }
                            }
                        }
                        else
                        {
                            // is a non-stellar body

                            // is terraformable? If so, prepend it to the body class
                            if (sn.ScanData.Terraformable)
                            {
                                bdClass.Append("Terraformable".T(EDTx.UserControlScanGrid_Terraformable)).Append(", ");
                            }

                            // is a planet?...
                            if (sn.ScanData.PlanetClass != null)
                            {
                                bdClass.Append(sn.ScanData.PlanetClass);
                            }

                            planets++;

                            // tell us the distance from the arrivals in both AU and LS
                            if (sn.level <= 1 && sn.type == StarScan.ScanNodeType.body)
                            {
                                bdDist.AppendFormat("{0:0.00}AU ({1:0.0}ls)", sn.ScanData.DistanceFromArrivalLS / JournalScan.oneAU_LS, sn.ScanData.DistanceFromArrivalLS);
                            }

                            // ...or a moon?
                            if (sn.level >= 2 && sn.type == StarScan.ScanNodeType.body)
                            {
                                if (sn.ScanData.PlanetClass != null)
                                {
                                    moons++;
                                }

                                bdClass.Append(" ").Append("Moon".T(EDTx.UserControlScanGrid_Moon));

                                // moon distances from center body are measured from in SemiMajorAxis
                                if (sn.ScanData.nSemiMajorAxis.HasValue)
                                {
                                    bdDist.AppendFormat("{0:0.0}ls ({1:0}km)", sn.ScanData.nSemiMajorAxis.Value / JournalScan.oneLS_m, sn.ScanData.nSemiMajorAxis.Value / 1000);
                                }
                            }

                            if (sn.ScanData.PlanetClass != null && sn.ScanData.PlanetClass.Contains("Giant"))
                            {
                                gasgiants++;
                            }
                            else
                            {
                                terrestrial++;
                            }

                            // Details

                            // display non-stellar bodies radius in earth radiuses
                            if (sn.ScanData.nRadius.HasValue)
                            {
                                bdDetails.Append("Radius".T(EDTx.UserControlScanGrid_Radius)).Append(": ").Append((sn.ScanData.nRadius.Value / JournalScan.oneEarthRadius_m).ToString("N2")).Append(", ");
                            }

                            // show the temperature, both in K and C degrees
                            if (sn.ScanData.nSurfaceTemperature.HasValue)
                            {
                                bdDetails.Append("Temperature".T(EDTx.UserControlScanGrid_Temperature)).Append(": ").Append((sn.ScanData.nSurfaceTemperature.Value).ToString("N2")).Append("K, (").Append((sn.ScanData.nSurfaceTemperature.Value - 273).ToString("N2")).Append("C).");
                            }

                            // print the main atmospheric composition and pressure, if presents
                            if (!String.IsNullOrEmpty(sn.ScanData.Atmosphere) && sn.ScanData.Atmosphere != "None")
                            {
                                bdDetails.Append(Environment.NewLine).Append(sn.ScanData.Atmosphere);
                                if (sn.ScanData.nSurfacePressure.HasValue)
                                {
                                    bdDetails.Append(", ").Append((sn.ScanData.nSurfacePressure.Value / JournalScan.oneAtmosphere_Pa).ToString("N3")).Append("Pa.");
                                }
                            }

                            // tell us that a bodie is landable, and shows its gravity
                            if (sn.ScanData.IsLandable)
                            {
                                var Gg = "";

                                if (sn.ScanData.nSurfaceGravity.HasValue)
                                {
                                    var g = sn.ScanData.nSurfaceGravity / JournalScan.oneGee_m_s2;
                                    Gg = " (G: " + g.Value.ToString("N1") + ")";
                                }

                                bdDetails.Append(Environment.NewLine).Append("Landable".T(EDTx.UserControlScanGrid_Landable)).Append(Gg).Append(". ");
                                overlays.landable = true;
                            }

                            // tell us that there is some volcanic activity
                            if (sn.ScanData.Volcanism != null)
                            {
                                bdDetails.Append(Environment.NewLine).Append("Geological activity".T(EDTx.UserControlScanGrid_Geologicalactivity)).Append(": ").Append(sn.ScanData.Volcanism).Append(". ");
                                overlays.volcanism = true;
                            }

                            if (sn.ScanData.Mapped)
                            {
                                bdDetails.Append(Environment.NewLine).Append("Surface mapped".T(EDTx.UserControlScanGrid_Surfacemapped)).Append(". ");
                                overlays.mapped = true;
                            }

                            // materials
                            if (sn.ScanData.HasMaterials)
                            {
                                toolStripProgressBar.Visible = true;

                                var ret = "";
                                foreach (KeyValuePair <string, double> mat in sn.ScanData.Materials)
                                {
                                    var mc = MaterialCommodityData.GetByFDName(mat.Key);
                                    if (mc?.IsJumponium == true)
                                    {
                                        ret = ret.AppendPrePad(mc.Name, ", ");
                                        overlays.materials = true;
                                    }
                                }

                                if (ret.Length > 0 && showMaterials)
                                {
                                    bdDetails.Append(Environment.NewLine).Append("This body contains: ".T(EDTx.UserControlScanGrid_BC)).Append(ret);
                                }

                                ReportJumponium(ret);
                            }
                        }

                        // have some belt, ring or other special structure?
                        if (showStructures)
                        {
                            if (sn.ScanData.HasRings)
                            {
                                for (int r = 0; r < sn.ScanData.Rings.Length; r++)
                                {
                                    if (sn.ScanData.Rings[r].Name.EndsWith("Belt", StringComparison.Ordinal))
                                    {
                                        if (showBelts)
                                        {
                                            // is a belt
                                            bdDetails.Append(Environment.NewLine).Append("Belt: ".T(EDTx.UserControlScanGrid_Belt));
                                            var RingName = sn.ScanData.Rings[r].Name;
                                            bdDetails.Append(JournalScan.StarPlanetRing.DisplayStringFromRingClass(sn.ScanData.Rings[r].RingClass)).Append(" ");
                                            bdDetails.Append((sn.ScanData.Rings[r].InnerRad / JournalScan.oneLS_m).ToString("N2")).Append("ls to ").Append((sn.ScanData.Rings[r].OuterRad / JournalScan.oneLS_m).ToString("N2")).Append("ls. ");
                                        }
                                    }
                                    else
                                    {
                                        if (showRings)
                                        {
                                            // is a ring
                                            bdDetails.Append(Environment.NewLine).Append("Ring: ".T(EDTx.UserControlScanGrid_Ring));
                                            var RingName = sn.ScanData.Rings[r].Name;
                                            bdDetails.Append(JournalScan.StarPlanetRing.DisplayStringFromRingClass(sn.ScanData.Rings[r].RingClass)).Append(" ");
                                            bdDetails.Append((sn.ScanData.Rings[r].InnerRad / JournalScan.oneLS_m).ToString("N2")).Append("ls to ").Append((sn.ScanData.Rings[r].OuterRad / JournalScan.oneLS_m).ToString("N2")).Append("ls. ");
                                        }
                                    }
                                }
                            }
                        }

                        //! for all relevant bodies:

                        // give estimated value
                        if (showValues)
                        {
                            var value = sn.ScanData.EstimatedValue;
                            bdDetails.Append(Environment.NewLine).Append("Value".T(EDTx.UserControlScanGrid_Value)).Append(" ").Append(value.ToString("N0"));
                        }

                        // pick an image
                        var img = sn.ScanData.IsStar ? sn.ScanData.GetStarTypeImage() : sn.ScanData.GetPlanetClassImage();

                        dataGridViewScangrid.Rows.Add(new object[] { null, sn.ScanData.BodyName, bdClass, bdDist, bdDetails });

                        var cur = dataGridViewScangrid.Rows[dataGridViewScangrid.Rows.Count - 1];

                        cur.Tag = img;

                        cur.Cells[0].Tag = overlays;
                        cur.Cells[4].Tag = cur.Cells[0].ToolTipText = cur.Cells[1].ToolTipText = cur.Cells[2].ToolTipText = cur.Cells[3].ToolTipText = cur.Cells[4].ToolTipText =
                            sn.ScanData.DisplayString(historicmatlist: last_he.MaterialCommodity, currentmatlist: discoveryform.history.GetLast?.MaterialCommodity);
                    }
                }

                // check if it's a green system
                isGreenSystem |= (hasArsenic && hasCadmium && hasCarbon && hasGermanium && hasNiobium && hasPopolonium && hasVanadium && hasYttrium);

                if (isGreenSystem)
                {
                    toolStripProgressBar.ToolTipText = "This is a green system, as it has all existing jumponium materials available!".T(EDTx.UserControlScanGrid_GS);
                    toolStripStatusGreen.Visible     = true;
                }
                else if (!isGreenSystem)
                {
                    toolStripProgressBar.ToolTipText = toolStripProgressBar.Value + " jumponium materials found in system.".T(EDTx.UserControlScanGrid_JS);
                }

                // set a meaningful title for the controller
                SetControlText(string.Format("Scan Summary for {0}: {1} stars; {2} planets ({3} terrestrial, {4} gas giants), {5} moons".T(EDTx.UserControlScanGrid_ScanSummaryfor), scannode.system.Name, stars, planets, terrestrial, gasgiants, moons));
                if (firstdisplayedrow >= 0 && firstdisplayedrow < dataGridViewScangrid.RowCount)
                {
                    dataGridViewScangrid.SafeFirstDisplayedScrollingRowIndex(firstdisplayedrow);
                }

                toolStripStatusTotalValue.Text = "~" + scannode.ScanValue(true).ToString() + " cr";
            }
        }
コード例 #12
0
        void DrawSystem(HistoryEntry he, bool force)
        {
            StarScan.SystemNode scannode = null;

            bool samesys = last_he != null && he != null && he.System.Name == last_he.System.Name;

            //System.Diagnostics.Debug.WriteLine("Scan grid " + samesys + " F:" + force);

            if (he == null)     //  no he, no display
            {
                last_he = null;
                dataGridViewScangrid.Rows.Clear();
                SetControlText("No Scan".Tx());
                return;
            }
            else
            {
                scannode = discoveryform.history.starscan.FindSystem(he.System, true); // get data with EDSM

                if (scannode == null)                                                  // no data, clear display, clear any last_he so samesys is false next time
                {
                    last_he = null;
                    dataGridViewScangrid.Rows.Clear();
                    SetControlText("No Scan".Tx());
                    return;
                }

                if (samesys && !force)      // same system, no force, no redisplay
                {
                    return;
                }
            }

            last_he = he;

            // only record first row if same system
            int firstdisplayedrow = (dataGridViewScangrid.RowCount > 0 && samesys) ? dataGridViewScangrid.FirstDisplayedScrollingRowIndex : -1;

            dataGridViewScangrid.Rows.Clear();

            List <StarScan.ScanNode> all_nodes = scannode.Bodies.ToList();// flatten tree of scan nodes to prepare for listing

            foreach (StarScan.ScanNode sn in all_nodes)
            {
                if (sn.ScanData != null && sn.ScanData.BodyName != null)
                {
                    StringBuilder bdClass   = new StringBuilder();
                    StringBuilder bdDist    = new StringBuilder();
                    StringBuilder bdDetails = new StringBuilder();

                    if (sn.ScanData.PlanetClass != null)
                    {
                        bdClass.Append(sn.ScanData.PlanetClass);
                    }
                    if (sn.ScanData.StarTypeText != null)
                    {
                        bdClass.Append(sn.ScanData.StarTypeText);
                    }

                    if (sn.level >= 2 && sn.type == StarScan.ScanNodeType.body)
                    {
                        bdClass.Append(" " + "Moon".Tx(this));
                    }

                    if (sn.ScanData.IsStar && sn.ScanData.BodyName.EndsWith(" A"))
                    {
                        bdDist.AppendFormat("Main Star".Tx(this));
                    }
                    else if (sn.ScanData.nSemiMajorAxis.HasValue)
                    {
                        if (sn.ScanData.IsStar || sn.ScanData.nSemiMajorAxis.Value > JournalScan.oneAU_m / 10)
                        {
                            bdDist.AppendFormat("{0:0.00}AU ({1:0.00}ls)", (sn.ScanData.nSemiMajorAxis.Value / JournalScan.oneAU_m), sn.ScanData.nSemiMajorAxis.Value / JournalScan.oneLS_m);
                        }
                        else
                        {
                            bdDist.AppendFormat("{0}km", (sn.ScanData.nSemiMajorAxis.Value / 1000).ToString("N1"));
                        }
                    }

                    // display stars and stellar bodies mass
                    if (sn.ScanData.IsStar && sn.ScanData.nStellarMass.HasValue)
                    {
                        bdDetails.Append("Mass".Tx(this) + ": " + sn.ScanData.nStellarMass.Value.ToString("N2") + ", ");
                    }

                    // habitable zone for stars - do not display for black holes.
                    if (sn.ScanData.HabitableZoneInner != null && sn.ScanData.HabitableZoneOuter != null && sn.ScanData.StarTypeID != EDStar.H)
                    {
                        bdDetails.AppendFormat("Habitable Zone".Tx(this) + ": {0}-{1}AU ({2}). ", (sn.ScanData.HabitableZoneInner.Value / JournalScan.oneAU_LS).ToString("N2"), (sn.ScanData.HabitableZoneOuter.Value / JournalScan.oneAU_LS).ToString("N2"), sn.ScanData.GetHabZoneStringLs());
                    }

                    // tell us that a bodie is landable, and shows its gravity
                    if (sn.ScanData.IsLandable == true)
                    {
                        string Gg = "";

                        if (sn.ScanData.nSurfaceGravity.HasValue)
                        {
                            double?g = sn.ScanData.nSurfaceGravity / JournalScan.oneGee_m_s2;
                            Gg = " (G: " + g.Value.ToString("N1") + ")";
                        }

                        bdDetails.Append("Landable".Tx(this) + Gg + ". ");
                    }

                    // append the terraformable state to the planet class
                    if (sn.ScanData.Terraformable == true)
                    {
                        bdDetails.Append("Terraformable".Tx(this) + ". ");
                    }

                    // tell us that there is some volcanic activity
                    if (sn.ScanData.Volcanism != null)
                    {
                        bdDetails.Append("Volcanism".Tx(this) + ". ");
                    }

                    // have some ring?
                    if (sn.ScanData.HasRings && sn.ScanData.IsStar == false)
                    {
                        if (sn.ScanData.Rings.Count() > 1)
                        {
                            bdDetails.Append(string.Format("Has {0} rings: ".Tx(this, "Rings"), sn.ScanData.Rings.Count()));
                        }
                        else
                        {
                            bdDetails.Append("Has 1 ring: ".Tx(this, "Ring"));
                        }

                        for (int i = 0; i < sn.ScanData.Rings.Length; i++)
                        {
                            string RingName = sn.ScanData.Rings[i].Name;
                            bdDetails.Append(JournalScan.StarPlanetRing.DisplayStringFromRingClass(sn.ScanData.Rings[i].RingClass) + " ");
                            bdDetails.Append((sn.ScanData.Rings[i].InnerRad / JournalScan.oneLS_m).ToString("N2") + "ls to " + (sn.ScanData.Rings[i].OuterRad / JournalScan.oneLS_m).ToString("N2") + "ls. ");
                        }
                    }

                    // print the main atmospheric composition
                    if (sn.ScanData.Atmosphere != null && sn.ScanData.Atmosphere != "None")
                    {
                        bdDetails.Append(sn.ScanData.Atmosphere + ". ");
                    }

                    // materials
                    if (sn.ScanData.HasMaterials)
                    {
                        string ret = "";
                        foreach (KeyValuePair <string, double> mat in sn.ScanData.Materials)
                        {
                            MaterialCommodityData mc = MaterialCommodityData.GetByFDName(mat.Key);
                            if (mc != null && mc.IsJumponium)
                            {
                                ret = ret.AppendPrePad(mc.Name, ", ");
                            }
                        }

                        if (ret.Length > 0)
                        {
                            bdDetails.Append("\n" + "This body contains: ".Tx(this, "BC") + ret);
                        }
                    }

                    int value = sn.ScanData.EstimatedValue;
                    bdDetails.Append(Environment.NewLine + "Value".Tx(this) + " " + value.ToString("N0"));

                    //if ( sn.ScanData.EDSMDiscoveryCommander != null)      // not doing this, could be an option..
                    //    bdDetails.Append("\n" + "Discovered by: " + sn.ScanData.EDSMDiscoveryCommander + " on " + sn.ScanData.EDSMDiscoveryUTC.ToStringYearFirst());

                    Image img = null;

                    if (sn.ScanData.IsStar == true)
                    {
                        img = sn.ScanData.GetStarTypeImage(); // if is a star, use the Star image
                    }
                    else
                    {
                        img = sn.ScanData.GetPlanetClassImage(); // use the correct image in case of planets and moons
                    }

                    dataGridViewScangrid.Rows.Add(new object[] { null, sn.ScanData.BodyName, bdClass, bdDist, bdDetails });

                    DataGridViewRow cur = dataGridViewScangrid.Rows[dataGridViewScangrid.Rows.Count - 1];

                    cur.Tag          = img;
                    cur.Cells[4].Tag = cur.Cells[0].ToolTipText = cur.Cells[1].ToolTipText = cur.Cells[2].ToolTipText = cur.Cells[3].ToolTipText = cur.Cells[4].ToolTipText =
                        sn.ScanData.DisplayString(historicmatlist: last_he.MaterialCommodity, currentmatlist: discoveryform.history.GetLast?.MaterialCommodity);
                }
            }

            // display total scan values
            SetControlText(string.Format("Scan Summary for {0}. {1}".Tx(this, "SS"), scannode.system.Name, BuildScanValue(scannode)));

            if (firstdisplayedrow >= 0 && firstdisplayedrow < dataGridViewScangrid.RowCount)
            {
                dataGridViewScangrid.FirstDisplayedScrollingRowIndex = firstdisplayedrow;
            }
        }