public Packet(int packId, double?flyTime = null, double?temp = null, double?press = null, double?h = null, double?sp = null, double?hum = null, double?volt = null, GPSCoordinates gPS = null, Gases g = null, String utcTime = null) { id = packId; this.flyTime = flyTime; gps = gPS; temperature = temp; pressure = press; height = h; speed = sp; voltage = volt; gases = g; this.hum = hum; this.UtcTime = utcTime; }
public Packet(int packId, double recTime, double?flyTime = null, double?temp = null, double?press = null, double?h = null, double?sp = null, double?hum = null, double?volt = null, double?charge = null, GPSCoordinates gPS = null, Gases g = null) { id = packId; this.recTime = recTime; this.flyTime = flyTime; gps = gPS; temperature = temp; pressure = press; height = h; speed = sp; voltage = volt; batch = charge; gases = g; this.hum = hum; }
private void UpdateGraphs(List <Packet> packets) { Packet[] pacs = packets.AsParallel() .OrderBy(x => x.FlyingTime) .GroupBy(x => x.FlyingTime) .SelectMany(x => x) .ToArray(); plotTemp.AddPointsXY( pacs.Where(p => { return(p.Temperature != null); }) .ToDictionary(p => { return((double)p.FlyingTime); }, p => { return((double)p.Temperature); }) ); plotPress.AddPointsXY( pacs.Where(p => { return(p.Pressure != null); }) .ToDictionary(p => { return((double)p.FlyingTime); }, p => { return((double)p.Pressure); }) ); plotHeight.AddPointsXY( pacs.Where(p => { return(p.Height != null); }) .ToDictionary(p => { return((double)p.FlyingTime); }, p => { return((double)p.Height); }) ); plotSpeed.AddPointsXY( pacs.Where(p => { return(p.Speed != null); }) .ToDictionary(p => { return((double)p.FlyingTime); }, p => { return((double)p.Speed); }) ); plotHum.AddPointsXY( pacs.Where(p => { return(p.Humidity != null); }) .ToDictionary(p => { return((double)p.FlyingTime); }, p => { return((double)p.Humidity); }) ); plotVolt.AddPointsXY( pacs.Where(p => { return(p.Voltage != null); }) .ToDictionary(p => { return((double)p.FlyingTime); }, p => { return((double)p.Voltage); }) ); plotCO.AddPointsXY( pacs.Where(p => { return(p.Gases.CO2 != null); }) .ToDictionary(p => { return((double)p.FlyingTime); }, p => { return((double)p.Gases.CO2); }) ); plotNH.AddPointsXY( pacs.Where(p => { return(p.Gases.NH3 != null); }) .ToDictionary(p => { return((double)p.FlyingTime); }, p => { return((double)p.Gases.NH3); }) ); plotNO.AddPointsXY( pacs.Where(p => { return(p.Gases.NO2 != null); }) .ToDictionary(p => { return((double)p.FlyingTime); }, p => { return((double)p.Gases.NO2); }) ); tbUTCTime.Text = pacs.OrderByDescending(p => p.FlyingTime).First().UtcTime; var positions = pacs.Where(p => { return(p.GpsX != null && p.GpsY != null && p.GpsZ != null); }); flyTime = pacs.Count() != 0 ? pacs.Where(p => { return(p.FlyingTime != null); }).Max(p => { return((double)p.FlyingTime); }) : flyTime; DateTime d = new DateTime((long)flyTime * 10000000, DateTimeKind.Unspecified); analogClock1.Date = d; if (positions.Count() != 0) { GPSCoordinates pos = positions.Last().GPS; if (positions.Count() != 0) { tbGPSX.Text = pos.CoordinateX.ToString(); tbGPSY.Text = pos.CoordinateY.ToString(); tbGPSZ.Text = pos.CoordinateZ.ToString(); if (mapWindow != null && !mapWindow.IsDisposed) { mapWindow.SatellitePosition.X = (double)pos.CoordinateX; mapWindow.SatellitePosition.Y = (double)pos.CoordinateY; } lastPosition = pos; } } }