예제 #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 Azimuth/Elevation graph with the calculated data
        /// </summary>
        private void updateAzElGraph()
        {
            // Plotting the Azimuth / Elevation data is a little trickier than plotting the DOP data
            // We have to check if we're plotting the data's X-Axis as Azimuth or time.
            GraphPane myPane = AzElGraph.GraphPane;

            // We'll create a sorted list of PRNs and add each PRN in turn. This will ensure the legend is sorted.
            int[] sortedPRNArray = new int[AzElData_TimeBased.Keys.Count];
            AzElData_TimeBased.Keys.CopyTo(sortedPRNArray, 0);
            Array.Sort(sortedPRNArray);

            // We'll now iterate over each satellite (PRN) and add either the time-based or Azimuth-based data to the graph
            foreach (int PRN in sortedPRNArray)
            {
                LineItem myCurve;
                if (plotXAxisAsTime)
                {
                    // we're using the appropriate line color and symbol here.
                    myCurve = myPane.AddCurve(String.Format("PRN {0}", PRN), AzElData_TimeBased[PRN], prnStyles[PRN].color, prnStyles[PRN].symbol);
                }
                else
                {
                    myCurve = myPane.AddCurve(String.Format("PRN {0}", PRN), AzElData_AzimuthBased[PRN], prnStyles[PRN].color, prnStyles[PRN].symbol);
                }
                myCurve.Symbol.Fill    = new Fill(prnStyles[PRN].color);
                myCurve.Line.IsVisible = false;
            }

            // Now set the X-Axis characteristics based on the user preference
            if (plotXAxisAsTime)
            {
                AzElGraph.GraphPane.XAxis.Scale.Min = (double)new XDate(startjd.ToDateTime());
                AzElGraph.GraphPane.XAxis.Scale.Max = (double)new XDate(stopjd.ToDateTime());

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

                myPane.XAxis.Scale.Format = "dd-MMM\nhh:mm";
                //myPane.XAxis.Scale.FontSpec.Angle = 40;

                if (GPSTimeRadio.Checked)
                {
                    myPane.XAxis.Title.Text = Localization.TimeGPST;
                }
                else
                {
                    myPane.XAxis.Title.Text = Localization.TimeUTC;
                }
            }
            else
            {
                AzElGraph.GraphPane.XAxis.Scale.Min = 0.0;
                AzElGraph.GraphPane.XAxis.Scale.Max = 360.0;
                // make x-axis a date type
                myPane.XAxis.Type = AxisType.Linear;

                myPane.XAxis.Scale.FormatAuto = true;

                myPane.XAxis.Title.Text = Localization.AzimuthDegrees;
            }

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

            // 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
            AzElGraph.IsShowHScrollBar  = true;
            AzElGraph.IsShowVScrollBar  = true;
            AzElGraph.IsAutoScrollRange = true;
            AzElGraph.IsScrollY2        = true;

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