Plugins

# Class: ServerPostgresRouting Source Location: /plugins/routing/server/ServerRouting.php
### Class Overview
    PluginBase
       |
       --ServerPlugin
          |
          --ClientResponderAdapter
             |
             --ServerRouting
                |
                --ServerPostgresRouting
ServerRouting implementation, which uses Postgres dijsktra module for shortest | ### Variables $db $log | ### Methods __construct computePath convertNodeId deleteOldResults drawGraph getDb getNodes getRoutingResultsTable getRoutingTable initializeGraph mergeGraph recenter serializeGraph shortestPathQuery unserializeGraph
### Child classes: ServerTestMainPostgresRouting Example server routing plugin which uses Postgres ServerProjectPostgresRouting Example server routing plugin which uses Postgres ServerDemoRouting Example server routing plugin which uses Postgres | ### Inherited Variables #### Class: ServerRouting ServerRouting::$graph #### Class: ServerPlugin ServerPlugin::$config ServerPlugin::$serverContext #### Class: PluginBase PluginBase::$basePath PluginBase::$name PluginBase::$overriddenRequest | ### Inherited Methods #### Class: ServerRouting ServerRouting::__construct() Constructor ServerRouting::addRoutingResultAttributes() Implementors may override this method to add routing attributes to the ServerRouting::computePath() Computes the shortest path between to nodes ServerRouting::computeRoutingResult() 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. ServerRouting::convertNodeId() Plugins may extent this method to convert stop identifiers sent by ServerRouting::drawGraph() Plugins should override this method to draw the computated graph object on the map. ServerRouting::handlePreDrawing() Result is set in initializeRequest but Outline must be called ServerRouting::initializeGraph() 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. ServerRouting::initializeRequest() ServerRouting::mergeGraph() 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. ServerRouting::mergeRoutingResultGraph() Internal merging of the routing results ServerRouting::serializeGraph() 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. ServerRouting::unserializeGraph() Plugins should override this method to unserialize the graph as a string sent by the client to the graph model object. #### 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 355] ServerRouting implementation, which uses Postgres dijsktra module for shortest path computation [ Top ] ### Class Variables #### $db = [line 366] Database object #### Tags:
access: | protected
Type: | DB
[ Top ] #### $log = [line 360] #### Tags:
access: | private
Type: | Logger
Overrides: | Array
[ Top ] ### Class Methods ### constructor __construct [line 371]
`ServerPostgresRouting __construct( )`
Constructor #### Tags:
access: | public
Overrides ServerRouting::__construct() (Constructor) [ Top ] ### method computePath [line 536]
`void computePath( mixed $node1, mixed $node2, mixed $parameters)`
#### Tags:
access: | protected
see: | RoutingModuleInterface::computePath()
Overrides ServerRouting::computePath() (Computes the shortest path between to nodes) [ Top ] ### method convertNodeId [line 401]
`void convertNodeId( mixed $nodeId)`
The default implementation will use the table format of the Pgdijkstra package, for converting node identifiers to internal ones. Plugins should override this method if not using the default Pgdijkstra format #### Tags:
access: | protected
see: | ServerRouting::convertNodeId()
Overrides ServerRouting::convertNodeId() (Plugins may extent this method to convert stop identifiers sent by) [ Top ] ### method deleteOldResults [line 447]
`void deleteOldResults( )`
Deletes the geometries on the results table which are too old #### Tags:
access: | protected
[ Top ] ### method drawGraph [line 662]
`void drawGraph( mixed $graph)`
#### Tags:
access: | protected
see: | ServerRouting::drawGraph()
Overrides ServerRouting::drawGraph() (Plugins should override this method to draw the computated graph object on the map.) [ Top ] ### method getDb [line 382]
`DB getDb( )`
Returns the Pear::DB database connection. #### Tags:
access: | protected
[ Top ] ### method getNodes [line 497]
`array getNodes( DB_result $result, DB_result $resultsId, int $timestamp, int 3)`
This method iterates over the results returned by ServerPostgresRouting::shortestPathQuery() and fills the table containing the path geometries. #### Tags:
return: | An array of Nodes
access: | protected
Overridden in child classes as: ServerDemoRouting::getNodes() #### Parameters:
int | 3 | The timestamp to store in the table
string | $result | the table containing the geomeetries
DB_result | $resultsId | the database results returned by shortestPathQuery()
int | $timestamp | The identifier to use when storing the path geometries in the results table
[ Top ] ### method getRoutingResultsTable [line 426]
`string getRoutingResultsTable( )`
#### Tags:
return: | The name of the table containing the path geometries
access: | protected
[ Top ] ### method getRoutingTable [line 436]
`string getRoutingTable( )`
#### Tags:
return: | The name of the main table for pgdijkstra module
access: | protected
[ Top ] ### method initializeGraph [line 654]
`void initializeGraph( mixed $graph)`
#### Tags:
access: | protected
see: | ServerRouting::initializeGraph()
Overridden in child classes as: ServerTestMainPostgresRouting::initializeGraph() ServerProjectPostgresRouting::initializeGraph() Overrides ServerRouting::initializeGraph() (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.) [ Top ] ### method mergeGraph [line 415]
`void mergeGraph( mixed $oldGraph, mixed $newGraph)`
#### Tags:
access: | protected
see: | RoutingModule::mergeGraph()
Overrides ServerRouting::mergeGraph() (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.) [ Top ] ### method recenter [line 604]
`void recenter( array $resultsIds)`
Recenter the map on the path identified by the given results id. This method can be called by plugins for recentering. WARNING: It must be used from the ServerRouting::initializeGraph() if wanted, otherwise the recentering will not be done. #### Tags:
access: | protected
#### Parameters:
array | $resultsIds | An array of integer identifiers of the results to be used for recentering
[ Top ] ### method serializeGraph [line 569]
`void serializeGraph( mixed $graph)`
#### Tags:
access: | protected
see: | ServerRouting::serializeGraph()
Overrides ServerRouting::serializeGraph() (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.) [ Top ] ### method shortestPathQuery [line 474]
`DB_result shortestPathQuery( string $node1, string $node2, array $parameters)`
This methods performs a database query which will return the shortest path (see Pgdijkstra documentation for the API). Plugins may override this method to perform specific queries. #### Tags:
return: | A Pear::DB result object, which is the result of the shortest_path function. It may contain additional columns, which will be used in the getNodes() function.
access: | protected
Overridden in child classes as: ServerDemoRouting::shortestPathQuery() #### Parameters:
string | $node1 | The source node identifier
string | $node2 | The target node identifier
array | $parameters | array of key-value parameters
[ Top ] ### method unserializeGraph [line 576]
`void unserializeGraph( mixed $serializedGraph)`
#### Tags:
access: | protected
see: | ServerRouting::unserializeGraph()
Overrides ServerRouting::unserializeGraph() (Plugins should override this method to unserialize the graph as a string sent by the client to the graph model object.) [ Top ] Documentation generated on Fri, 21 Sep 2007 13:31:06 +0200 by phpDocumentor 1.3.0RC3