Beispiel #1
0
        public void GetAllTurnData(out TurnData noFlapsData, out TurnData fullFlapsData)
        {
            noFlapsData   = null;
            fullFlapsData = null;

            foreach (NewDataSet.turnDataRow turnRow in _aircraft.turnData)
            {
                try
                {
                    TurnData data = new TurnData(turnRow);

                    if (data.FlapPosition == TurnData.FlapPositionType.None)
                    {
                        noFlapsData = data;
                    }
                    else if (data.FlapPosition == TurnData.FlapPositionType.Full)
                    {
                        fullFlapsData = data;
                    }
                    else
                    {
                        throw new ApplicationException("Unknown Flap setting!");
                    }
                }
                catch (System.Data.StrongTypingException)
                {
                    // far from ideal as it is marked as optional in the XSD , however,
                    // these strongly typed datasets throw an exception if it isnt
                    // present *sigh*
                }
            }
        }
        public void GetAllTurnData(out TurnData noFlapsData, out TurnData fullFlapsData)
        {
            noFlapsData = null;
            fullFlapsData = null;

            foreach (NewDataSet.turnDataRow turnRow in _aircraft.turnData)
            {
                try
                {
                    TurnData data = new TurnData(turnRow);

                    if (data.FlapPosition == TurnData.FlapPositionType.None)
                    {
                        noFlapsData = data;
                    }
                    else if (data.FlapPosition == TurnData.FlapPositionType.Full)
                    {
                        fullFlapsData = data;
                    }
                    else
                        throw new ApplicationException("Unknown Flap setting!");
                }
                catch (System.Data.StrongTypingException)
                {
                    // far from ideal as it is marked as optional in the XSD , however,
                    // these strongly typed datasets throw an exception if it isnt
                    // present *sigh*
                }
            }
        }
        private void BuildTurnPerformancePlot(string aircraftName, bool sustained, TurnData noFlapsData, TurnData fullFlapsData)
        {
            if (chkboxClean.Checked)
            {
                TurnPerformancePlot cleanPlot = new TurnPerformancePlot();
                AddTurnPlot(cleanPlot, noFlapsData, sustained, aircraftName, TurnPerformancePlot.FlapPosition.None);
            }

            if (chkboxFullFlaps.Checked)
            {
                TurnPerformancePlot fullFlapsPlot = new TurnPerformancePlot();
                AddTurnPlot(fullFlapsPlot, fullFlapsData, sustained, aircraftName, TurnPerformancePlot.FlapPosition.Full);
            }
        }
        private void BuildNewCustomTurnPerformanceGraph(string aircraftName, TurnData noFlapsData, TurnData fullFlapsData)
        {
            if (chkboxSustainedTurn.Checked)
            {
                BuildTurnPerformancePlot(aircraftName, true, noFlapsData, fullFlapsData);
            }

            if (chkboxInstantTurn.Checked)
            {
                BuildTurnPerformancePlot(aircraftName, false, noFlapsData, fullFlapsData);
            }

            turnPerformanceUserControl.Refresh();
        }
        private void AddTurnPlot(TurnPerformancePlot plot, TurnData turnData, bool sustained, string aircraftName, TurnPerformancePlot.FlapPosition flapPosition)
        {
            plot.StallSpeed = turnData.StallSpeed;
            plot.FlapSetting = flapPosition;
            Pen plotPen = new Pen(Registry.Instance.AircraftColours.GetAircraftColour(aircraftName));
            plotPen.Width = 1F;
            plot.PlotPen = plotPen;
            if (sustained)
            {
                plot.PlotTitle = string.Format("{0} (Sust/{1})", aircraftName, flapPosition == TurnPerformancePlot.FlapPosition.Full ? "Full Flaps" : "Clean");
                plot.TurnRaduis = turnData.SustainedTurnRadius;
                plot.TurnRateInDegPerSecond = turnData.SustainedTurnRate;
            }
            else
            {
                plot.PlotTitle = string.Format("{0} (Inst/{1})", aircraftName, flapPosition == TurnPerformancePlot.FlapPosition.Full ? "Full Flaps" : "Clean");
                plotPen.DashPattern = new float[] { 2, 2 };
                plot.TurnRaduis = turnData.TurnRadiusAtCorner;
                plot.TurnRateInDegPerSecond = turnData.TurnRateAtCorner;
            }

            turnPerformanceUserControl.AddPlot(plot);
        }
        private void AddTurnPlot(TurnPerformancePlot plot, TurnData turnData, bool sustained, string aircraftName, TurnPerformancePlot.FlapPosition flapPosition)
        {
            plot.StallSpeed  = turnData.StallSpeed;
            plot.FlapSetting = flapPosition;
            Pen plotPen = new Pen(Registry.Instance.AircraftColours.GetAircraftColour(aircraftName));

            plotPen.Width = 1F;
            plot.PlotPen  = plotPen;
            if (sustained)
            {
                plot.PlotTitle              = string.Format("{0} (Sust/{1})", aircraftName, flapPosition == TurnPerformancePlot.FlapPosition.Full ? "Full Flaps" : "Clean");
                plot.TurnRaduis             = turnData.SustainedTurnRadius;
                plot.TurnRateInDegPerSecond = turnData.SustainedTurnRate;
            }
            else
            {
                plot.PlotTitle              = string.Format("{0} (Inst/{1})", aircraftName, flapPosition == TurnPerformancePlot.FlapPosition.Full ? "Full Flaps" : "Clean");
                plotPen.DashPattern         = new float[] { 2, 2 };
                plot.TurnRaduis             = turnData.TurnRadiusAtCorner;
                plot.TurnRateInDegPerSecond = turnData.TurnRateAtCorner;
            }

            turnPerformanceUserControl.AddPlot(plot);
        }
        private void BuildTurnPerformancePlot(string aircraftName, bool sustained, TurnData noFlapsData, TurnData fullFlapsData)
        {
            if (chkboxClean.Checked)
            {
                TurnPerformancePlot cleanPlot = new TurnPerformancePlot();
                AddTurnPlot(cleanPlot, noFlapsData, sustained, aircraftName, TurnPerformancePlot.FlapPosition.None);
            }

            if(chkboxFullFlaps.Checked)
            {
                TurnPerformancePlot fullFlapsPlot = new TurnPerformancePlot();
                AddTurnPlot(fullFlapsPlot, fullFlapsData, sustained, aircraftName, TurnPerformancePlot.FlapPosition.Full);
            }
        }
        private void BuildNewCustomTurnPerformanceGraph(string aircraftName, TurnData noFlapsData, TurnData fullFlapsData)
        {
            if (chkboxSustainedTurn.Checked)
            {
                BuildTurnPerformancePlot(aircraftName, true, noFlapsData, fullFlapsData);
            }

            if (chkboxInstantTurn.Checked)
            {
                BuildTurnPerformancePlot(aircraftName, false, noFlapsData, fullFlapsData);
            }

            turnPerformanceUserControl.Refresh();
        }