Friday, July 11, 2008

Consolidating of Source Code Base: version 0.1

For future development and expandability it was important to reduce the existing code (HTML, JavaScript, PHP) into smaller chunks and make it more managable.

This has now been achieved: the three main display pages (ShowMapHeadingley.php, ShowMapTracks.php, and ShowMapPlaces.php) are using the same functions now, which are consolidated in GoogleMaps.js. This file has the specific functions relating to Google Maps. It also has a basic framework for initialising and showing map content, with the option of having external functions which are executed in the Main files. The automatic callback functions which are executed as <body> event handlers, are common to all three of the main files; this means now that new additional functionality can easily be implemented. It also enables a common interface (through GET with parameters in the URL) so that these files react in the same way.

Here is the current implementation of this common interface (version 0.1):

wmap width in pixels; if not given, then the full browser width or the widht of the encapsulating element (table cell, iframe, ...) is taken as the width of the map.
hmap height in pixels; if not given, then the height of the screen is taken as the map height; this will result in a map that can be scrolled down to see the full extend.
ppoint of interest; parameter consists of several parts, separatated by comma: latitude, longitude, text heading, URL for link under the text heading.
trGPS track; parameter consists of several parts, separatated by comma: filename, color of track, longitude, text heading for track.

These parameters work fine for ShowMapTracks.php and ShowMapPlaces.php; ShowMapHeadingley.php has currently problems with the full support of these parameters (p, tr) and will eventually be depreciated. A better way will be found to combine live user tracking and static information display. However, all future work will be based on the now consolidated Javascript functions in GoogleMap.js.

No comments: