Exemplo n.º 1
0
 public DataSeriesToPlot(PicesSipperCruise _cruise,
                         PicesGPSDataPointList _data
                         )
 {
     cruise = _cruise;
     data   = _data;
 }
Exemplo n.º 2
0
        private void  ChartGPS_Load(object sender, EventArgs e)
        {
            heightLast = Height;
            widthLast  = Width;

            DeploymentsToPlot.Items.Clear();

            Cruise.Text     = cruiseName;
            Station.Text    = stationName;
            Deployment.Text = deploymentNum;

            cruise  = mainWinConn.SipperCruiseLoad(cruiseName);
            station = mainWinConn.SipperStationLoad(cruiseName, stationName);

            ContextMenuStrip cms = new ContextMenuStrip();

            cms.Items.Add("Copy Chart to clipboard", null, CopyChartToClipboard);
            cms.Items.Add("Save Chart to Disk", null, SaveChartToDisk);
            cms.Items.Add("Copy Data Tab-Delimited to Clipboard", null, SaveTabDelToClipBoard);
            cms.Items.Add("Save Data Tab-Delimited to Disk", null, SaveTabDelToDisk);

            ProfileChart.ContextMenuStrip = cms;

            LoadConfigurationFile();

            PopulatDeploymentsToPlot();

            PlotCruiseField.Checked = plotCruise;

            PlotButton_Click(this, null);
        }
Exemplo n.º 3
0
        private void  DeleteCruise(Object sender, EventArgs e)
        {
            if (!PicesSipperVariables.AllowUpdates())
            {
                return;
            }

            if (cruise == null)
            {
                return;
            }
            CruiseDialog sd = new CruiseDialog(cruise, dbConn, runLog, false, true);

            sd.ShowDialog();
            this.Text = this.ToString();
            if (sd.CruiseDeleted)
            {
                if (this.Parent != null)
                {
                    this.Parent.Nodes.Remove(this);
                    return;
                }

                this.Text             = "Cruise[" + cruise.CruiseName + "]   ***Deleted***";
                this.ContextMenuStrip = null;
                this.cruise           = null;
            }
        } /* DeleteCruise */
Exemplo n.º 4
0
        public TreeNodeCruise(PicesDataBase _dbConn,
                              PicesRunLog _runLog,
                              PicesSipperCruise _cruise
                              )
        {
            dbConn = _dbConn;
            runLog = _runLog;
            cruise = _cruise;
            LoadStationDetails();

            Text = ToString();

            if (PicesSipperVariables.AllowUpdates())
            {
                ContextMenuStrip cms = new ContextMenuStrip();
                cms.Items.Add("Edit Cruise Parameters", null, EditCruiseParameters);

                if (Nodes.Count < 1)
                {
                    cms.Items.Add("Delete Cruise", null, DeleteCruise);
                }

                cms.Items.Add("Add a new Station", null, AddANewStation);
                this.ContextMenuStrip = cms;
            }
        }
Exemplo n.º 5
0
        private void  ValidateCruiseName()
        {
            errorProvider1.SetError(CruiseName, null);
            if (CruiseName.Text == null)
            {
                CruiseName.Text = "";
            }
            CruiseName.Text = CruiseName.Text.Trim();
            String cruiseNameErrorDesc = PicesSipperCruise.ValidateCruiseName(CruiseName.Text);

            if (cruiseNameErrorDesc != null)
            {
                errorProvider1.SetError(CruiseName, cruiseNameErrorDesc);
                validationErrorsFound = true;
                return;
            }

            if (CruiseName.Text.CompareTo(cruise.CruiseName) != 0)
            {
                PicesSipperCruise existingCruise = DbConn().SipperCruiseLoad(CruiseName.Text);
                if (existingCruise != null)
                {
                    errorProvider1.SetError(CruiseName, "Cruise Name[" + CruiseName.Text + "] is already in use.");
                    validationErrorsFound = true;
                    return;
                }
            }

            return;
        } /* ValidateCruiseName */
Exemplo n.º 6
0
        private void CruiseField_Format(object sender, ListControlConvertEventArgs e)
        {
            if (e.ListItem == null)
            {
                return;
            }
            PicesSipperCruise c = (PicesSipperCruise)e.ListItem;
            String            m = c.CruiseName + " - " + c.DateStart.ToString("yyyy-MM-dd");

            e.Value = m;
        }
Exemplo n.º 7
0
 public CruiseDialog(PicesSipperCruise _cruise,
                     PicesDataBase _dbConn,
                     PicesRunLog _runLog,
                     bool _addingNewCruise,
                     bool _deletingCruise
                     )
 {
     cruise          = _cruise;
     dbConn          = _dbConn;
     runLog          = _runLog;
     addingNewCruise = _addingNewCruise;
     deletingCruise  = _deletingCruise;
     InitializeComponent();
 }
Exemplo n.º 8
0
        } /* RunLogMsgQueueFlush */

        private void  ValidateCruiseName()
        {
            errorProvider1.SetError(CruiseField, "");
            if (CruiseField.SelectedItem == null)
            {
                errorProvider1.SetError(CruiseField, "No cruise is selected.");
                StationField.Items.Clear();
                validationErrorFound = true;
            }
            else
            {
                cruise     = (PicesSipperCruise)CruiseField.SelectedItem;
                cruiseName = cruise.CruiseName;
            }
        }
Exemplo n.º 9
0
        private void AddNewCruiseButton_Click(object sender, EventArgs e)
        {
            if (!PicesSipperVariables.AllowUpdates())
            {
                MessageBox.Show(this, "Updates are not allowed.", "Cruise Maintenance", MessageBoxButtons.OK);
                return;
            }

            PicesSipperCruise newCruise = new PicesSipperCruise();
            CruiseDialog      cd        = new CruiseDialog(newCruise, DbConn(), runLog, true, false);

            cd.ShowDialog(this);
            if (cd.CruiseAdded)
            {
                CruiseTreeList.Nodes.Add(new TreeNodeCruise(DbConn(), runLog, newCruise));
            }
        }
Exemplo n.º 10
0
        public CruiseDialog(String _cruiseName,
                            PicesRunLog _runLog
                            )
        {
            runLog      = _runLog;
            weOwnDbConn = true;

            cruise = DbConn().SipperCruiseLoad(_cruiseName);
            if (cruise == null)
            {
                cruise            = new PicesSipperCruise();
                cruise.CruiseName = _cruiseName;
                addingNewCruise   = true;
            }

            InitializeComponent();

            allowUpdates = PicesSipperVariables.AllowUpdates();
        }
Exemplo n.º 11
0
        } /* LoadConfigurationFile */

        private void  LoadCruises()
        {
            cruise = null;
            PicesSipperCruiseList cruises = mainWinConn.SipperCruiseLoadAllCruises();

            CruiseField.Items.Clear();
            foreach (PicesSipperCruise c in cruises)
            {
                CruiseField.Items.Add(c);
                if (c.CruiseName.Equals(cruiseName, StringComparison.InvariantCultureIgnoreCase))
                {
                    cruise = c;
                }
            }
            if (cruise == null)
            {
                cruiseName = "";
            }
            else
            {
                CruiseField.SelectedItem = cruise;
            }
        }
Exemplo n.º 12
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;
            PicesSipperCruise     cruise     = dataSeries.cruise;

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

            TimeSpan adjGpsToActTime = new TimeSpan(0, 0, 0);
            TimeSpan adjGpsToCTDTime = new TimeSpan(0, 0, 0);

            if (deployment != null)
            {
                adjGpsToActTime = deployment.SyncTimeStampActual - deployment.SyncTimeStampGPS;
                adjGpsToCTDTime = deployment.SyncTimeStampCTD - deployment.SyncTimeStampGPS;
            }
            else if (cruise != null)
            {
                adjGpsToActTime = cruiseAdjGpsToActTime;
                adjGpsToCTDTime = cruiseAdjGpsToActTime;
            }

            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;

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

            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;
            }

            if (s.Points.Count > 10)
            {
                s.Points[s.Points.Count - 1].Label = endTimeStr;
            }

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