I wrote this program as a way of both supplementing my flight sim time with
a useful program to hold the airport information, as well as a way to
bring a Java program of mine to local classrooms.
The first version of this program was created using the NetBeans IDE, which
at the time was version 6.x?x.x?x. Version 6 of NetBeans included the Java
Swing/GUI builder. This was a good way to get started - but as most people
find out, it can be easier if you are interested in coding to learn to write
the code yourself. As pieces of the project grew, certain smaller interfaces
were written strictly from code without the GUI builder. Eventually I learned
more and more about the Swing classes and came to build the version two of this
program. Version two was created strictly from code, and also included the full
ability to pull the airport information from a MySQL database. More on the
database in a bit.
First... a little about the program.
I'm a huge fan of aviation, and part of my downtime is spent flying my desk with
Microsoft Flight Simulator 2004. Yes, I run an old computer, so FS2004 is what
I currently use.
Several years ago, I began getting more into learning about the realism of being
a pilot, and really taking time to learn the aircraft and the instruments. Part
of this learning included being able to fly with direction from air traffic control
and more specifically understand the
airfield traffic patterns
as well as being able to understand, setup for and complete an instrument landing.
To do this, pilots use various charts to understand how many runways are available
at different airports, their compass headings, height above sea level, and any instrument
landing radio information needed for the approach. When I started doing these procedures
in flight simulator, I began creating note cards with the airports I was commonly flying
to and from. This evolved into a excel sheet that I created which held a screen shot
of the airport from FS2004, and runway number, runway ILS heading, runway ILS frequency and
runway length. After creating a few dozen of these cards over time, I decided it was time
for a more robust way of doing this. So came AirportView, now at version 2.3.
AirportView was created to do all of these things and more. Under the select drop down,
the user can specify the airport by ID. I use the airport ICAO ID, however this can be
any short ID. The small text field to the right, indicated as an ID filter, is just that -
a filter to allow the user to trim the number of airports in the select drop down. At this
time, I have roughly 280 airports in my database table, so it is nice at times to be able to
trim the list a bit. The three buttons allow the user to add a new airport to the table, edit
an existing airport, and refresh the airport list when a new one has been added.
Below that, information on the currently selected airport is available. When setting up
for a flight to a particular airport, this is the information used when on approach. The main
panel to the right of the Airport Information section has a custom JPanel (Java Object) which was
created to draw the airport runway layout. This panel does not currently draw any other features
of the airport like taxiways or nearby land features like water - it is simply available for the
user to understand the airport layout.
One of the main features of this program is that this layout can be rotated by using the View Direction
spinner above that panel. This rotation allows the user to see how the airport will look when
making an approach from a direction other than 0 degrees, or compass north. This becomes more and more
useful the more complicated the airport you are approaching is, and whether or not you are using
visual flight rules, or instrument flight rules.
The two buttons 'Airport List View' and 'View Compass Calculator' will be discussed below.
A simple temperature conversion table is also available.
The above screen shot shows the main AirportView panel with our local nearby Burlington, VT airport selected.
Note that this screenshot was taken with the airport at the default 000 compass direction view, or
from the south. The next screenshot shows a bit more of a complicated airport, Los Angeles International
airport (KLAX) in California. I have also rotated the view, to demonstrate this feature, and show
what this particular airport would look like when headed 69 degrees, or just North of East. The airport information
is also available, and in the runway table, I have selected a row, which is useful when flying by ATC so that
the user can remember what the designated landing or departing runway is.
... and a little about the code.
This program has helped to grow some of the skills I have in Java, in particular the swing components, and tied several
other skills together.
Other than putting the pieces together, this program is relatively straight forward. It has pretty standard components,
ranging from JLabels, JTextFields, a JComboBox, JSpinner, etc. The component that really has some custom code to it is
the custom JPanel, AirportPanel2, which extends JPanel. This is a JPanel custom created to do the drawing of the runways.
In its current form, it isn't perfect. There is still some tweaking that needs to be done in order to resize based on the
panel size, versus drawing long and short runways. I did a lot of re-learning trigonometry when writing this code, as it
requires some calculations to rotate points about an axis when doing the rotation of the runways. The documentation for
the AirportPanel2 (original was AirportPanel) can be found at
Airport Resources .
The other learning experience was starting version two of this program and having it be compatible with a MySQL database.
Version one of the program kept all of the information in an XML document, which worked fine. But the document started
becoming visually unwieldy when edits to airports that were already in the list needed to happen. The database system
makes this cleaner, but can be a more difficult interface to start with. Using the MySQL JDBC, version two began using
a connector to a localhost database. Further minor revisions to libraries and this program allow it now to load a config
file with a location, localhost or external, along with other information to connect to a MySQL database. I now run a
RaspberryPi with Oracle MySQL and have setup the Pi to be locally visible on my home network. Now any computer on my
home network running the AirportView program can access the database table needed and see the information.
... and a little about the database.
The above screen shot shows the interface that pops up from the file menu when a new config file is needed. Filling out this
information with where the user has or would like to start a database table for airport information will get the program started.
It goes without saying that permissions need to be previously setup within MySQL for this to happen correctly.
The next screenshot shows the tables that I currently have in my database, and then it shows the columns from the table that gets
created in order to save the information needed.
The Airport Query Popup
When it is necessary to find a location within a database of 280+ airports, it is nice to have a table to peruse.
Hence, the Airport Query Popup was created. This can be started by selecting the 'Airport List View' button in
the main GUI.
The popup has the ability to filter search results by ID (which will yield a result of 1), State (United States State,
Canadian Province, or Mexican State), and/or Country. At this time, when a drop down list selection is made, an
ActionEvent will pick up on this and start the search. At some point, I'll either come up with a reason for the
'Search' button, or I will remove it. The 'Reset' button clears the filters and lists all airports.
An example of using the filters can be seen in the next screenshot.
The compass calculator view.
The compass calculator view was created to help visualize the 45 degree, and 90 degree turn compass headings
needed when flying. When flying visually, the previously mentioned
airfield traffic patterns
are at right angles. When setting up for a runway that is not north/south or east/west, I found it easier to
use a program like this. I guess this is what the calculator dependant generation creates!
A future revision of this program may also include the 30 and 60 degree increments for this compass. The 30 degree
marks can be useful when lining up for a instrument landing. Flying IFR with ATC, you will be given the headings, but
flying visually and/or by advisory, you will be on your own.
The compass calculator view can be started by clicking the button in the main GUI.