예제 #1
0
 public DataSeriesToPlot(PicesSipperDeployment _deployment,
                         PicesGPSDataPointList _data
                         )
 {
     deployment = _deployment;
     data       = _data;
 }
예제 #2
0
파일: ChartGPS.cs 프로젝트: PalakDave/Pices
 public DataSeriesToPlot(PicesSipperCruise _cruise,
                         PicesGPSDataPointList _data
                         )
 {
     cruise = _cruise;
     data   = _data;
 }
예제 #3
0
파일: ChartGPS.cs 프로젝트: PalakDave/Pices
        private void  AddDeploymentToSeries(PicesSipperDeployment deployment,
                                            Color color
                                            )
        {
            PicesGPSDataPointList gpsData = threadConn.InstrumentDataRetrieveGPSInfo(deployment.CruiseName, deployment.StationName, deployment.DeploymentNum, (int)TimeInterval.Value);

            if ((gpsData == null) || cancelRequested)
            {
                return;
            }

            PicesGPSDataPointList fliteredGPSData = gpsData.FilterOutNoise();

            if (fliteredGPSData == null)
            {
                return;
            }

            if (fliteredGPSData.Count > 1)
            {
                DataSeriesToPlot seriesToPlot = new DataSeriesToPlot(deployment, fliteredGPSData);
                seriesToPlot.LocateGPSBounds();
                goalie.StartBlock();
                series.Add(seriesToPlot);
                goalie.EndBlock();
            }
        } /* AddDeploymentToSeries */
예제 #4
0
        private void  WriteTabDelToStream(TextWriter tw)
        {
            DateTime curTime = DateTime.Now;

            tw.WriteLine("ChartGPSByStation");
            tw.WriteLine("DateTime" + "\t" + curTime.ToString("yyyy/MM/dd HH:mm:ss"));
            tw.WriteLine();
            foreach (DataSeriesToPlot dstp in series)
            {
                PicesGPSDataPointList gpsData    = dstp.data;
                PicesSipperDeployment deployment = dstp.deployment;

                tw.WriteLine();
                tw.WriteLine("Cruise" + "\t" + deployment.CruiseName);
                tw.WriteLine("Station" + "\t" + deployment.StationName);
                tw.WriteLine("DeploymentNum" + "\t" + deployment.DeploymentNum);
                tw.WriteLine("SyncTimeStampActual" + "\t" + deployment.SyncTimeStampActual.ToString("yyyy-MM-dd HH:mm:ss"));
                tw.WriteLine("SyncTimeStampCTD" + "\t" + deployment.SyncTimeStampCTD.ToString("yyyy-MM-dd HH:mm:ss"));
                tw.WriteLine("SyncTimeStampGPS" + "\t" + deployment.SyncTimeStampGPS.ToString("yyyy-MM-dd HH:mm:ss"));

                tw.WriteLine("GpsUtcTime" + "\t" + "Latitude" + "\t" + "Longitude" + "\t" + "Latitude(hh:mm)" + "\t" + "Longitude(HH:MM)" + "\t" + "COG" + "\t" + "SOG(kts)");
                foreach (PicesGPSDataPoint dp in gpsData)
                {
                    tw.WriteLine(dp.GpsUtcTime.ToString("yyyy/MM/dd HH:mm:ss") + "\t" +
                                 dp.Latitude.ToString("##0.00000000") + "\t" +
                                 dp.Longitude.ToString("##0.00000000") + "\t" +
                                 PicesMethods.LongitudeToString(dp.Longitude, 3) + "\t" +
                                 PicesMethods.LatitudeToString(dp.Latitude, 3) + "\t" +
                                 dp.CourseOverGround.ToString("##0.0") + "\t" +
                                 dp.SpeedOverGround.ToString("##0.0")
                                 );
                }
                tw.WriteLine("----EndOfDeoploymemt----");
                tw.WriteLine();
            }

            tw.WriteLine("End of ChartGPSByStation");
        }
예제 #5
0
파일: ChartGPS.cs 프로젝트: PalakDave/Pices
        } /* AddDeploymentToSeries */

        /// <summary>
        /// Load GPS data that covers the time span of all the deployments that are being plotted.
        /// </summary>
        private void  AddCruiseToSeries()
        {
            DateTime gpsDateTimeStart = DateTime.MaxValue;
            DateTime gpsDateTimeEnd   = DateTime.MinValue;

            foreach (DataSeriesToPlot dsp in series)
            {
                if (dsp.gpsDateTimeStart < gpsDateTimeStart)
                {
                    gpsDateTimeStart = dsp.gpsDateTimeStart;
                }

                if (dsp.gpsDateTimeEnd > gpsDateTimeEnd)
                {
                    gpsDateTimeEnd = dsp.gpsDateTimeEnd;
                }
            }

            int totalSecs        = (int)(gpsDateTimeEnd - gpsDateTimeStart).TotalSeconds;
            int proposedInterval = totalSecs / 1500;

            if (proposedInterval < timeInterval)
            {
                proposedInterval = timeInterval;
            }

            PicesGPSDataPointList gpsData = threadConn.GpsDataQueryByIntervals(cruiseName, gpsDateTimeStart, gpsDateTimeEnd, proposedInterval);

            if (gpsData != null)
            {
                DataSeriesToPlot seriesToPlot = new DataSeriesToPlot(cruise, gpsData);
                seriesToPlot.LocateGPSBounds();
                goalie.StartBlock();
                series.Add(seriesToPlot);
                goalie.EndBlock();
            }
        } /* AddCruiseToSeries */
예제 #6
0
        private void  AddSeriesToChart(DataSeriesToPlot dataSeries,
                                       ref double minX,
                                       ref double maxX,
                                       ref double minY,
                                       ref double maxY,
                                       ref DateTime minGpsDateTime,
                                       ref DateTime maxGpsDateTime
                                       )
        {
            PicesGPSDataPointList gpsData    = dataSeries.data;
            PicesSipperDeployment deployment = dataSeries.deployment;

            if (gpsData.Count < 2)
            {
                return;
            }

            TimeSpan adjGpsToActTime = deployment.SyncTimeStampActual - deployment.SyncTimeStampGPS;
            TimeSpan adjGpsToCTDTime = deployment.SyncTimeStampCTD - deployment.SyncTimeStampGPS;

            DateTime startTimeGps = new DateTime(1, 1, 1, 1, 1, 1);
            DateTime endTimeGps   = new DateTime(1, 1, 1, 1, 1, 1);

            if (gpsData.Count > 0)
            {
                startTimeGps = gpsData[0].GpsUtcTime;
                if (startTimeGps.CompareTo(minGpsDateTime) < 0)
                {
                    minGpsDateTime = startTimeGps;
                }
            }

            if (gpsData.Count > 1)
            {
                endTimeGps = gpsData[gpsData.Count - 1].GpsUtcTime;
                if (endTimeGps.CompareTo(maxGpsDateTime) > 0)
                {
                    maxGpsDateTime = endTimeGps;
                }
            }

            DateTime startTimeAct = startTimeGps.Add(adjGpsToActTime);
            DateTime endTimeAct   = endTimeGps.Add(adjGpsToActTime);

            String startTimeStr = startTimeAct.Hour.ToString("00") + ":" + startTimeAct.Minute.ToString("00");
            String endTimeStr   = endTimeAct.Hour.ToString("00") + ":" + endTimeAct.Minute.ToString("00");

            String legend = "";
            Series s      = null;

            legend = deployment.CruiseName + "-" + deployment.StationName;
            if (!String.IsNullOrEmpty(deployment.DeploymentNum))
            {
                legend += "-" + deployment.DeploymentNum;
            }
            legend       += " (" + startTimeAct.ToString("MMM/dd HH:mm") + ")";
            s             = new Series(legend);
            s.BorderWidth = 2;

            s.ChartType   = SeriesChartType.Point;
            s.ChartArea   = "ChartArea1";
            s.Name        = legend;
            s.XAxisType   = AxisType.Primary;
            s.MarkerStyle = MarkerStyle.Circle;

            s.Points.Clear();

            if (dataSeries.latitudeMin < minY)
            {
                minY = dataSeries.latitudeMin;
            }
            if (dataSeries.latitudeMax > maxY)
            {
                maxY = dataSeries.latitudeMax;
            }
            if (dataSeries.longitudeMin < minX)
            {
                minX = dataSeries.longitudeMin;
            }
            if (dataSeries.longitudeMax > maxX)
            {
                maxX = dataSeries.longitudeMax;
            }

            foreach (PicesGPSDataPoint dp in gpsData)
            {
                DataPoint dataPoint = new DataPoint(dp.Longitude, dp.Latitude);
                s.Points.Add(dataPoint);
            }

            if (s.Points.Count > 0)
            {
                s.Points[0].Label = startTimeStr;
            }

            int count = s.Points.Count;

            if (count > 10)
            {
                s.Points[count - 1].Label = endTimeStr;
                int    middle      = count / 2;
                String middleLable = deployment.CruiseName + "(" + startTimeAct.ToString("yyyy-MM-dd") + ")";
                s.Points[middle].Label = middleLable;
                s.Points[middle].Font  = new Font(FontFamily.GenericSerif, 9.0f);
            }

            dataSeries.chartSeriesIndex = ProfileChart.Series.Count;
            ProfileChart.Series.Add(s);
        } /* AddSeriesToChart */