public void Refresh(Statistics_st data) { this.satelliteID = data.scid; this.virtualChannelID = data.vcid; this.packetNumber = data.packetNumber; this.totalBits = data.frameBits; this.viterbiErrors = data.vitErrors; this.signalQuality = data.signalQuality; this.syncCorrelation = data.syncCorrelation; if (data.syncWord != null) { this.syncWord = string.Format("{0:X02}{1:X02}{2:X02}{3:X02}", data.syncWord[0], data.syncWord[1], data.syncWord[2], data.syncWord[3]); } else { this.syncWord = "00000000"; } this.reedSolomon = data.rsErrors; this.frameLock = data.frameLock > 0; this.startTime = LLTools.UnixTimeStampToDateTime(data.startTime); this.runningTime = DateTime.Now.Subtract(startTime); }
private static string GenFilename(string satelliteName, string regionName, string imageName, int timestamp, string origName = null) { if (UseNOAAFileFormat) { //gos15chnIR04rgnFDseg001res04dat130 18 06 19 190.lrit origName = origName != null?Path.GetFileName(origName) : ""; var dt = LLTools.UnixTimeStampToDateTime(timestamp); var year = dt.Year.ToString("0000"); var month = dt.Month.ToString("00"); var day = dt.Day.ToString("00"); var doy = dt.DayOfYear.ToString("000"); var hour = dt.Hour.ToString("00"); var minute = dt.Minute.ToString("00"); var second = dt.Second.ToString("00"); if (origName.Length == 48) { return($"{origName.Substring(0, 31)}{doy}{hour}{minute}{second}000.png"); } else if (origName.StartsWith("IMG_DK")) { // Himawari // IMG_DK01IR3_201705190350_002 return($"{origName.Substring(0, 12)}{year}{month}{day}{hour}{minute}_000.png"); } else { // Return default return($"{satelliteName}-{regionName}-{imageName}-{timestamp}.png"); } } else { return($"{satelliteName}-{regionName}-{imageName}-{timestamp}.png"); } }
public static void ImageLabel(ref Bitmap inbmp, GroupData gd, OrganizerData od, GeoConverter gc, bool genLatLonLabel) { var usedFontSize = FONT_SIZES [0]; if (inbmp.Width >= 4000) { usedFontSize = FONT_SIZES [3]; } else if (inbmp.Width >= 2000) { usedFontSize = FONT_SIZES [2]; } else if (inbmp.Width >= 1000) { usedFontSize = FONT_SIZES [1]; } var bgBrush = new SolidBrush(Color.Black); var font = new Font("Arial", usedFontSize); var fontBrush = new SolidBrush(Color.White); var upperText = $"{gd.SatelliteName} ({gd.SatelliteLongitude}) - {gd.RegionName}"; var usedLabelSize = PADDING * 2; using (var g = Graphics.FromImage(inbmp)) { usedLabelSize += (int)Math.Round(g.MeasureString(upperText, font).Height); } var bmp = new Bitmap(inbmp.Width, inbmp.Height + ((genLatLonLabel && gc != null) ? usedLabelSize * 3 : usedLabelSize * 2), inbmp.PixelFormat); var sf = new StringFormat { LineAlignment = StringAlignment.Center, Alignment = StringAlignment.Center }; if (od.FileHeader != null && od.FileHeader.SubProduct.Name != "None") { upperText = upperText + " - " + od.FileHeader.SubProduct.Name; } var dt = LLTools.UnixTimeStampToDateTime(od.Timestamp); var lowerText = $"{dt.ToShortDateString ()} {dt.ToLongTimeString()} UTC - {OSPLABEL}"; using (var g = Graphics.FromImage(bmp)) { g.CompositingQuality = CompositingQuality.HighQuality; g.FillRectangle(bgBrush, 0, 0, bmp.Width, bmp.Height); g.DrawImage(inbmp, 0, usedLabelSize, inbmp.Width, inbmp.Height); // Upper Label // var textSize = g.MeasureString (upperText, font); var rect = new RectangleF(PADDING, 0, bmp.Width - PADDING * 2, usedLabelSize); g.DrawString(upperText, font, fontBrush, rect, sf); // Lower Label with Lat/Lon if (genLatLonLabel && gc != null) { var latlon = gc.xy2latlon(inbmp.Width / 2, inbmp.Height / 2); var lat = latlon.Item1.ToString("##.000000", CultureInfo.InvariantCulture); var lon = latlon.Item2.ToString("##.000000", CultureInfo.InvariantCulture); var latLonText = $"Center Coord: ({lat}; {lon})"; lowerText += $"\r\n{latLonText}"; // textSize = g.MeasureString (lowerText, font); rect = new RectangleF(PADDING, usedLabelSize + inbmp.Height, bmp.Width - PADDING * 2, usedLabelSize * 2); g.DrawString(lowerText, font, fontBrush, rect, sf); } else // Lower Label without Lat/Lon // textSize = g.MeasureString (lowerText, font); { rect = new RectangleF(PADDING, usedLabelSize + inbmp.Height, bmp.Width - PADDING * 2, usedLabelSize); g.DrawString(lowerText, font, fontBrush, rect, sf); } } inbmp.Dispose(); inbmp = bmp; }