Testing the application
With all of this code implemented, it's time to test out our application. Run the appropriate startup script, and zoom in slightly on the map. Then click on the Edit action, followed by the Add Track action. All going well, you should be able to click on the map to define the vertices of a new track. When you're done, press the Return key to create the new track. The result should look something like the following screenshot:
If you then click on the Edit Tracks icon again, you'll be asked if you want to save your changes. Go ahead, and your new track should be made permanent.
Now go back to the track editing mode and try creating a second track that connects with the first. For example:
If you then zoom in, you'll quickly discover a major flaw in the design of our application, as shown in the next screenshot:
The tracks aren't connected together. Since the user can click anywhere on the map, there's no way of ensuring that the tracks are connected—and if the tracks aren...