Пример #1
0
        /// <summary>
        /// Removes the receiver definition and clears the graphs
        /// </summary>
        private void OnDeleteReceiverClick(object sender, EventArgs e)
        {
            // when a receiver is deleted, we need to clear the graphs and delete the information in the tree
            // to delete info from a graph, just clear the graphs's curvelist
            DOPGraph.GraphPane.CurveList.Clear();
            AzElGraph.GraphPane.CurveList.Clear();
            NavAccGraph.GraphPane.CurveList.Clear();

            // also, we need to clear all the data from the DOPData structure
            foreach (PointPairList ppl in DOPData)
            {
                ppl.Clear();
            }

            // clear all the Azimuth / elevation data from their respective structures.
            AzElData_TimeBased.Clear();
            AzElData_AzimuthBased.Clear();

            // Clear all the Nav Accuracy Data from the zedGraph data structure that contain them.
            AsAccData.Clear();
            PredAccData.Clear();

            // always do these two steps, these make the graphs update themselves
            DOPGraph.AxisChange();
            DOPGraph.Invalidate();

            AzElGraph.AxisChange();
            AzElGraph.Invalidate();

            NavAccGraph.AxisChange();
            NavAccGraph.Invalidate();

            // Now clear the tree of the receiver, PSF and PAF  information
            // Except for the first node (Almanac), remove all other nodes.
            string firstNodeName = rootNode.FirstNode.Text;

            rootNode.Nodes.Clear();
            TreeNode newNode = new TreeNode(firstNodeName);

            rootNode.Nodes.Add(newNode);
            rootNode.Expand();

            //Clear the textboxes that contain the PAF and PSF names.
            PAFName.Clear();
            PSFName.Clear();

            //enable and disable the appropriate buttons
            SetControlStates(false);
        }
        /// <summary>
        /// Updates the DOP graph with the calculated data
        /// </summary>
        private void UpdateDopGraph()
        {
            // Now that the DOPData PointPairList array is filled in, we can update the DOP graph
            GraphPane myPane = DOPGraph.GraphPane;

            // if the checkbox is selected for this DOP type....
            if (DisplayEDOP.Checked)
            {
                // use the AddCurve method to add a new series of data to an existing graph
                // The text supplied in the first parameter will be used in the legend.
                LineItem myCurve = myPane.AddCurve(Localization.EDOP, DOPData[0], Color.Red, SymbolType.Circle);
                // Fill the symbols with the same color as the lines
                myCurve.Symbol.Fill = new Fill(Color.Red);
            }

            // continue for all DOP types supported
            if (DisplayNDOP.Checked)
            {
                LineItem myCurve = myPane.AddCurve(Localization.NDOP, DOPData[1], Color.Green, SymbolType.Circle);
                myCurve.Symbol.Fill = new Fill(Color.Green);
            }

            if (DisplayVDOP.Checked)
            {
                LineItem myCurve = myPane.AddCurve(Localization.VDOP, DOPData[2], Color.Gold, SymbolType.Circle);
                myCurve.Symbol.Fill = new Fill(Color.Gold);
            }

            if (DisplayHDOP.Checked)
            {
                LineItem myCurve = myPane.AddCurve(Localization.HDOP, DOPData[3], Color.Blue, SymbolType.Circle);
                myCurve.Symbol.Fill = new Fill(Color.Blue);
            }

            if (DisplayPDOP.Checked)
            {
                LineItem myCurve = myPane.AddCurve(Localization.PDOP, DOPData[4], Color.Magenta, SymbolType.Circle);
                myCurve.Symbol.Fill = new Fill(Color.Magenta);
            }

            if (DisplayTDOP.Checked)
            {
                LineItem myCurve = myPane.AddCurve(Localization.TDOP, DOPData[5], Color.Black, SymbolType.Circle);
                myCurve.Symbol.Fill = new Fill(Color.Black);
            }

            if (DisplayGDOP.Checked)
            {
                LineItem myCurve = myPane.AddCurve(Localization.GDOP, DOPData[6], Color.Cyan, SymbolType.Circle);
                myCurve.Symbol.Fill = new Fill(Color.Cyan);
            }

            // update the X-Axis Min and Max values. XDate is a ZedGraph type that takes a .Net DateTime structure.
            // Use the JulianDate method ToDateTime to retrieve this structure from a JulianDate
            DOPGraph.GraphPane.XAxis.Scale.Min = (double)new XDate(startjd.ToDateTime());
            DOPGraph.GraphPane.XAxis.Scale.Max = (double)new XDate(stopjd.ToDateTime());

            // Show the x axis grid
            myPane.XAxis.MajorGrid.IsVisible = true;

            // make x-axis a date type
            myPane.XAxis.Type = AxisType.Date;

            // Custom Axis string for display
            myPane.XAxis.Scale.Format = "dd-MMM\nhh:mm";

            // change the angle of the string if desired
            //myPane.XAxis.Scale.FontSpec.Angle = 40;

            // set the X-Axis Title
            if (GPSTimeRadio.Checked)
            {
                myPane.XAxis.Title.Text = Localization.TimeGPST;
            }
            else
            {
                myPane.XAxis.Title.Text = Localization.TimeUTC;
            }

            // Align the Y axis labels so they are flush to the axis
            myPane.YAxis.Scale.Align = AlignP.Inside;

            // Fill the axis background with a gradient
            myPane.Chart.Fill = new Fill(Color.White, Color.LightGray, 45.0f);

            // Enable scrollbars if needed
            DOPGraph.IsShowHScrollBar  = true;
            DOPGraph.IsShowVScrollBar  = true;
            DOPGraph.IsAutoScrollRange = true;
            DOPGraph.IsScrollY2        = true;

            // Make sure the Graph gets redrawn
            DOPGraph.AxisChange();
            DOPGraph.Invalidate();
        }