London Underground Map Data - Program Source

London Underground Map Data - Program Source

Th page is primarily a set of links to the source files.

Note that there is only one actual implementation file, the one with main() in it - I've taken a Java-esque route in that all the data structures have inline definitions of their methods.

FileComments
mapdata.cpp The control program that does all the work. Takes a single argument which is the input data file, writing the SQL insert statements to a file with the same name but a .SQL extension. If a second argument is supplied (it can be anything, since the program just looks for the presence of the third argument) then the output file is a dump of the routes for different lines and is written to a .RTS file.
context.h An instance of this class is the root for the data structures, storing everything by ID and name for quick access.
What can I say - I use hash tables a lot.
exceptions.h Defines exceptions thrown. Well, the one anyway.
idman.h Identifier manager. Used to generate unique IDs for the data elements as they're created.
line.h Simplest structure, since eveything is a string.
linesegment.h Abuses the Quadrant constant values defined in stationnode.h for segment direction.
mcthing.h Base class for all data elements. Defines common ID and name accessors as well as standard SQL element functions. Finally, there is some stuff in here for future support of deletion of records, but these are not overridden anywhere.
numstring.h Utility class for converting numbers to strings.
station.h Defines Zone and Alignment constants. These, as indeed are the Quadrant constants defined below, are bit fields. For Zones this is so that border cases can be captured adequately, for Alignments it's to do with their being a set ie no more than one example of each.
Note that the Zone information is converted on output so that a border station gets a negative Zone number: 1b2 would be -1, for instance. The Alignment is derived from the line segment directions as the data is read in and is converted to a Scalar Alignemt once everything is known.
stationnode.h Defines Quadrant constants.
stdafx.h ... or kitchensink.h as it's probably more accurately known. The file that includes all the common MFC headers and stuff so the precompiled headers work more efficiently. It is traditional to have at least one unused header here.