Plugins

# Class: ServerRouting Source Location: /plugins/routing/server/ServerRouting.php
### Class Overview
    PluginBase
       |
       --ServerPlugin
          |
          --ClientResponderAdapter
             |
             --ServerRouting
Server routing plugin. This class must be subclassed by plugins wishing to perform routing | ### Variables $graph $log | ### Methods __construct addRoutingResultAttributes computePath computeRoutingResult convertNodeId drawGraph handlePreDrawing initializeGraph initializeRequest mergeGraph mergeRoutingResultGraph serializeGraph unserializeGraph
### Child classes: ServerGeotoolsRouting ServerRouting implementation, which uses the GeoTools module for shortest ServerPostgresRouting ServerRouting implementation, which uses Postgres dijsktra module for shortest ServerTestMainRouting ServerProjectRouting | ### Inherited Variables #### Class: ServerPlugin ServerPlugin::$config ServerPlugin::$serverContext #### Class: PluginBase PluginBase::$basePath PluginBase::$name PluginBase::$overriddenRequest | ### Inherited Methods #### Class: ClientResponderAdapter ClientResponderAdapter::handleDrawing() ClientResponderAdapter::handlePostDrawing() ClientResponderAdapter::handlePreDrawing() ClientResponderAdapter::initializeRequest() #### Class: ServerPlugin ServerPlugin::__construct() Constructor ServerPlugin::getConfig() ServerPlugin::getServerContext() ServerPlugin::initializeConfig() Initializes plugin configuration ServerPlugin::useExtendedInit() ServerPlugin::useExtendedRequest() ServerPlugin::useExtendedResult() #### Class: PluginBase PluginBase::__construct() Constructor PluginBase::account() Records an accounting message for plugins PluginBase::getBasePath() PluginBase::getExtendedName() PluginBase::getName() PluginBase::getRequest() Get plugin's request or result out of MapRequest or MapResult PluginBase::initialize() Plugin initialization (can be extended in custom plugins) PluginBase::initializeConfig() Initializes plugin PluginBase::preInitialize() Plugin pre initialization. In most cases, plugins should use PluginBase::replacePlugin() Returns name of parent plugin in case of plugin extension PluginBase::setBasePath() PluginBase::setExtendedName() PluginBase::setName()
### Class Details [line 30] Server routing plugin. This class must be subclassed by plugins wishing to perform routing [ Top ] ### Class Variables #### $graph = [line 41] The current graph object to be rendered #### Tags:
access: | protected
Type: | Object
[ Top ] #### $log = [line 35] #### Tags:
access: | private
Type: | Logger
Overrides: | Array
[ Top ] ### Class Methods ### constructor __construct [line 46]
`ServerRouting __construct( )`
Constructor #### Tags:
access: | public
Overridden in child classes as: ServerTestMainGeotoolsRouting::__construct() Constructor ServerProjectGeotoolsRouting::__construct() Constructor ServerPostgresRouting::__construct() Constructor Overrides ServerPlugin::__construct() (Constructor) [ Top ] ### method addRoutingResultAttributes [line 104]
`RoutingResult addRoutingResultAttributes( RoutingResult $routingResult)`
Implementors may override this method to add routing attributes to the routing result once computated by ServerRouting::computePath() #### Tags:
access: | protected
#### Parameters:
RoutingResult | $routingResult |
[ Top ] ### method computePath [line 93]
`RoutingResult computePath( string $node1, string $node2, array $parameters)`
Computes the shortest path between to nodes #### Tags:
return: | a partial routing result object, containing the unserialized graph model object, and the list of steps.
access: | protected
Overridden in child classes as: ServerGeotoolsRouting::computePath() ServerPostgresRouting::computePath() #### Parameters:
string | $node1 | The source node identifier
string | $node2 | The target node identifier
array | $parameters | array of key-value parameters
[ Top ] ### method computeRoutingResult [line 139]
`void computeRoutingResult( mixed $stops, mixed $parameters)`
Compute a RoutingResult for a path described as an array of stops. This will call ServerRouting::computePath() repeatedly for each (source node, target node) pairs of the path, and merge the resulting RoutingResults togeter. #### Tags:
access: | protected
[ Top ] ### method convertNodeId [line 59]
`object Internal convertNodeId( string $nodeId)`
Plugins may extent this method to convert stop identifiers sent by client to nodes identifiers usable by the computePath method #### Tags:
return: | node identifier (used by computePath()) or null if the nodeId can't be converted (path will not be computated)
access: | protected
Overridden in child classes as: ServerTestMainGeotoolsRouting::convertNodeId() ServerProjectGeotoolsRouting::convertNodeId() ServerPostgresRouting::convertNodeId() The default implementation will use the table format of the Pgdijkstra #### Parameters:
string | $nodeId | Client node identifier
[ Top ] ### method drawGraph [line 213]
`void drawGraph( graph $graph)`
Plugins should override this method to draw the computated graph object on the map. #### Tags:
access: | protected
Overridden in child classes as: ServerTestMainGeotoolsRouting::drawGraph() ServerProjectGeotoolsRouting::drawGraph() ServerPostgresRouting::drawGraph() #### Parameters:
graph | $graph | model object
[ Top ] ### method handlePreDrawing [line 222]
`void handlePreDrawing( mixed $requ)`
Result is set in initializeRequest but Outline must be called in handlePreDrawing #### Tags:
access: | public
see: | ClientResponder::handlePreDrawing()
Overrides ClientResponderAdapter::handlePreDrawing() (parent method not documented) [ Top ] ### method initializeGraph [line 204]
`void initializeGraph( object graph $graph)`
Plugins may override this method to do special treatment the very first time a routing computation is done. This will only called the first time the graph is drawn. #### Tags:
access: | protected
Overridden in child classes as: ServerPostgresRouting::initializeGraph() ServerTestMainPostgresRouting::initializeGraph() ServerProjectPostgresRouting::initializeGraph() #### Parameters:
object graph | $graph | model object
[ Top ] ### method initializeRequest [line 172]
`void initializeRequest( mixed $requ)`
#### Tags:
access: | public
see: | ClientResponder::initializeRequest()
Overrides ClientResponderAdapter::initializeRequest() (parent method not documented) [ Top ] ### method mergeGraph [line 117]
`object The mergeGraph( object The $oldGraph, object The $newGraph)`
When computing a path made of several stops, one graph is generated for each (startNode, endNode) pairs of the path. This method should merge two graphs into another one. #### Tags:
return: | merged graph object
access: | protected
Overridden in child classes as: ServerPostgresRouting::mergeGraph() #### Parameters:
object The | $oldGraph | first graph to merge
object The | $newGraph | second graph to merge
[ Top ] ### method mergeRoutingResultGraph [line 125]
`void mergeRoutingResultGraph( RoutingResult $routingResult, RoutingResult $newRoutingResult)`
Internal merging of the routing results #### Tags:
access: | protected
[ Top ] ### method serializeGraph [line 70]
`string serializeGraph( object graph $graph)`
Plugins should override this method to serialize the graph model object into a string, sent back to the client. The default implementation returns the object directly. #### Tags:
return: | The string representation of the object
access: | protected
Overridden in child classes as: ServerPostgresRouting::serializeGraph() #### Parameters:
object graph | $graph | model object
[ Top ] ### method unserializeGraph [line 80]
`object The unserializeGraph( string $serializedGraph)`
Plugins should override this method to unserialize the graph as a string sent by the client to the graph model object. #### Tags:
return: | unserialized graph
access: | protected
Overridden in child classes as: ServerPostgresRouting::unserializeGraph() #### Parameters:
string | $serializedGraph | the graph in string representation
[ Top ] Documentation generated on Fri, 21 Sep 2007 13:31:06 +0200 by phpDocumentor 1.3.0RC3