Posts Creating NavEditor
Post
Cancel

Creating NavEditor

NavEditor is a little application I’ve written to help Infinite Flight Navigation Editors edit ILS Approaches. When done manually, the process for this is rather lengthy. The Navigation files are stored as JSON - a lot of it. So much in fact that most editors struggle to open the massive files. Not only that, but data on runway location, bearing, and airport elevation must be manually retrieved from World Editor. This entire process was tedious, and given the very parse-able nature of the airport files, I set to work to make a UI for this.

I decided to do this in Windows Forms. It was a technology I hadn’t really worked with before, but with a somewhat reasonable (good enough) knowledge of C# I decided to give it a go. The first step was figuring out what data I could pull from elsewhere and what data the user would have to manually import. The JSON files need the following.

  • Airport ICAO
  • Approach Identifier
  • Runway Number
  • ILS/LOC Frequency
  • Airport Elevation
  • Runway Latitude/Longitude
  • Runway Bearing
  • Glidepath (ILS only)

…among other things. These were the main ones though, and the ones that are most frequently updated. A lot of this data is airport related, so I can pull Elevation, Bearing and Runway Lat/Lon directly from the airport files. Then I could make a dropdown box for the Runway Number based on the airport runways. Cool.

Next, I needed a way to search and find the approach the user wants to update. For this, I made a text box where the user can enter the airport ICAO, then a dropdown box that auto-populates based on the airport text box every time it’s changed. With that done, I now had just 4 things that a user needs to enter (after finding the approach).

  • ILS/LOC Frequency
  • Approach Identifier
  • Runway Number (dropdown)
  • Glidepath (ILS only)

At this point, with my plan laid out and in the interest of getting a working prototype done I made a very simple UI. Hard coded locations for the Airports and Navigation repositories, and just the 6 input fields. After half a day of work, it was somewhat functional. There were a few main issues at this point.

  1. All the locations were hard coded. The only way someone could practically use this was by downloading the source, hard coding their own directories, then compiling it.
  2. The airports repository had to load on boot… every time. This was extremely slow, and at that point I was yet to implement asynchronous methods. The lack of a proper UI meant that a loading screen was also out of the question.
  3. The indentation in the Navigation files is strange and by writing directly to the JSON Files I was changing the indents for the whole file… not at all practical.

In the end I solved them in the opposite order to the one I listed there. The fix for the idents issue was not ideal, but it was using RegEx to find the right object in the array then replacing it with the updated and correctly indented object.

At the helpful suggestion of Cameron, to fix the slow loading issue I had NavEditor generate a JSON file with all the apt.dat file locations on the boot, if it didn’t already exist. This worked after the first boot, but on the first boot is was still slow. At this point, I decided it was time to get some asynchronous methods up and running. With some async methods and a Task.Run, it is now running much smoother on first boot.

Around this time, I took the opportunity to implement some more UI controls, mainly things to reload the airports cache and such. Around this time I also added some buttons to choose repository locations.

NavEditor WIP

However at this stage I realized there were too many MesssageBoxes and implemented a little message box. I present, the finished product. I also saved the location of the Airports and Navigation repos into a configuration file in AppData\Local (along with the index of airports). Now, once configured, NavEditor can simply be opened and used straight away.

NavEditor Finished Product

Limitations

There are a few limitations with how this is designed. First of all, if the user wishes to reconfigure the location of their Airports or Navigation repository, they have to edit the configuration file. Furthermore, NavEditor does not support creating or removing an approach as yet.

This post is licensed under CC BY 4.0 by the author.