AsterixDisplayAnalyser.LoadRunwayBoundaries.Load C# (CSharp) Метод

Load() публичный статический Метод

public static Load ( ) : void
Результат void
        public static void Load()
        {
            string ConfigurationData;
            string FileName;
            char[] delimiterChars = { ',', '\t' };
            StreamReader MyStreamReader;

            string CurrentItem;
            string RunwayName = "NONE";
            double Lat;
            double Lon;

            System.Collections.Generic.List<GeoCordSystemDegMinSecUtilities.LatLongClass> Sector_Points = new List<GeoCordSystemDegMinSecUtilities.LatLongClass>();

            FileName = @"C:\ASTERIX\ADAPTATION\Runways.txt";
            Exception Bad_Runways = new Exception("Bad Runways.txt file");

            if (System.IO.File.Exists(FileName))
            {
                MyStreamReader = System.IO.File.OpenText(FileName);
                while (MyStreamReader.Peek() >= 0)
                {
                    ConfigurationData = MyStreamReader.ReadLine();
                    string[] words = ConfigurationData.Split(delimiterChars);
                    if (words[0][0] != '#')
                    {
                        // Get Item
                        CurrentItem = words[0];

                        // If the is a name, then it is a new sector
                        if (words[0] == "RUNWAY_NAME")
                        {
                            // If we have reached a new name it means that we have parsed
                            // the data for previous sector
                            if (RunwayName != "NONE")
                            {
                                // Now add the new sector to the data set
                                SystemAdaptationDataSet.RunwayBorderDataSet.Add(new SystemAdaptationDataSet.RunwayBorder(RunwayName, Sector_Points));

                                // Save off the new name
                                RunwayName = words[1];

                                // Empty the list so it is ready for the next sector
                                Sector_Points = new List<GeoCordSystemDegMinSecUtilities.LatLongClass>();
                            }
                            // This is first sector so just save off the name
                            else
                            {
                                RunwayName = words[1];
                            }
                        }
                        // This a new point, so extract it an save it into a local list
                        else
                        {

                            // Get Longitude
                            if (double.TryParse(words[0], out Lon) == false)
                                throw Bad_Runways;
                            // Get Latitude
                            if (double.TryParse(words[1], out Lat) == false)
                                throw Bad_Runways;

                            Sector_Points.Add((new GeoCordSystemDegMinSecUtilities.LatLongClass(Lat, Lon)));
                        }
                    }
                }

                // Now add the last processed sector
                SystemAdaptationDataSet.RunwayBorderDataSet.Add(new SystemAdaptationDataSet.RunwayBorder(RunwayName, Sector_Points));
            }
        }

Usage Example

Пример #1
0
        // This method reads in system adaptation data set from configuration files at system power up and adjust the system in accordance to the system defined settings.
        // It expects configuration files in a specified directory. In the case they are not found the system will default to the default development data set.
        public static void Load()
        {
            /////////////////////////////////////////////////////////////////////////
            // First set the system origin
            /////////////////////////////////////////////////////////////////////////
            LoadCoreSettings.Load();

            /////////////////////////////////////////////////////////////////////////
            // Load radars
            /////////////////////////////////////////////////////////////////////////
            LoadRadars.Load();

            /////////////////////////////////////////////////////////////////////////
            // Load waypoints
            /////////////////////////////////////////////////////////////////////////
            LoadWaypoints.Load();

            /////////////////////////////////////////////////////////////////////////
            // Load state boundaries
            /////////////////////////////////////////////////////////////////////////
            LoadStateBoundaries.Load();

            /////////////////////////////////////////////////////////////////////////
            // Load sector boundaries
            /////////////////////////////////////////////////////////////////////////
            LoadSectorBoundaries.Load();

            /////////////////////////////////////////////////////////////////////////
            // Load runway boundaries
            /////////////////////////////////////////////////////////////////////////
            LoadRunwayBoundaries.Load();

            /////////////////////////////////////////////////////////////////////////
            // Load label attributes
            /////////////////////////////////////////////////////////////////////////
            LabelAttributes.Load();

            /////////////////////////////////////////////////////////////////////////
            // Now handle display preferences
            /////////////////////////////////////////////////////////////////////////
            Display_Attributes_IO.Load();
        }
LoadRunwayBoundaries