Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

MapApp PHP Package

1.0

The MapApp package provides a working base for quickly developing interactive online mapping applications with PHP.

Description

MapApp combines the MapServer functionality provided by the MapManager package with the HTML form control widgets of the FormControls package. FormControls' ControlElement widgets deal with a user's interactions with a map. The MapApp class assigns actions to events triggered by these interactions which manipulate a MapManager.

This abstraction of responsibilities and the decoupling of key tasks that results allows for painless integration with a Smarty template system. The result is the ability to easily produce applications that are very extensible and flexible from the points of view of both visual and programming design.

Usage

The following example demonstrates typical usage of the package:
<form method="post">
<?php

require_once('webapp/mapapp.php');

// MapApps are designed to run under a session
session_start();

if (!isset($_SESSION['mapapp'])) { // we must set up the map

    // create a map to use
    $map_manager = new MapManager('mapfile.map');

    // initialise the primary package object
    $_SESSION['mapapp'] = new MapApp($map_manager);

    // initialise the map
    $_SESSION['mapapp']->init();

} else {
    // we need to update the map with any new user actions
    $_SESSION['mapapp']->update();
}

// output the updated map to the screen
print $_SESSION['mapapp']->toString();

?>
</form>

Assuming a correctly configured mapfile, this example provides all the code needed to run an online mapping application. Customisations to the visual design are performed by altering the Smarty template and customisations to the code are accomplished by extending the MapApp class. The MapApp class documentation illustrates how to do this.


Generated on Mon Feb 14 10:55:54 2005 for MapApp by doxygen 1.3.5