com.mizar.addressing.routing
Class RoutingEngine

java.lang.Object
  extended by com.mizar.addressing.routing.RoutingEngine

public class RoutingEngine
extends java.lang.Object

The main class for managing routing requests. Essentially add stops to the request. Order matters for shortest path. After the rout is computed, get the stops. Each stop contains street stops that have driving directions.


Field Summary
static int ROUTE_TYPE_FASTEST
           
static int ROUTE_TYPE_SHORTEST
           
 
Constructor Summary
RoutingEngine()
           
RoutingEngine(java.sql.Connection conn)
          Constructs a RoutingEngine and Loads the network from the database
RoutingEngine(java.lang.String managedDataSource)
          Constructs a RoutingEngine and Loads the network from the database
 
Method Summary
 void addStops(RoutingRequest request)
          Computes start nodes for a request's stops
 void computeStartNode(RoutingStop stop)
          Finds the closest edge to a stop location, and computes a network start node from that.
 void createTemporaryNode(RoutingStop stop)
          I don't use this, but if you were going to introduce a temporary node to trace from, this would do thwe trick.
 int getRouteType()
           
 boolean isBackToStart()
          return the backToStart flag
 oracle.spatial.network.Network loadNetworks(java.sql.Connection conn)
          loads the network from the database.
 oracle.spatial.network.Network loadNetworks(java.lang.String managedDataSource, java.lang.String password)
          loads the network from the database
static void main(java.lang.String[] args)
          Sample of how to use the routing engine.
 void setBackToStart(boolean backToStart)
          Set the backToStart flag
 void setRouteType(int type)
           
 void setRoutingParams(RoutingRequest param)
          Sets route type and back to start from a given routingRequest
 void shortestPath(RoutingRequest request)
          Comutes shortest path between the stops in the request.
 void splitEdge()
           
 oracle.spatial.network.Path travellingSalesman(RoutingRequest request)
          Computes a Traveling salesman route from the request.
 void validateRequest(RoutingRequest request)
          Tests for routingRequest validity (non-null, at least 2 stops.
 boolean verify(java.lang.String managedDataSource, java.lang.String password)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROUTE_TYPE_SHORTEST

public static final int ROUTE_TYPE_SHORTEST
See Also:
Constant Field Values

ROUTE_TYPE_FASTEST

public static final int ROUTE_TYPE_FASTEST
See Also:
Constant Field Values
Constructor Detail

RoutingEngine

public RoutingEngine()

RoutingEngine

public RoutingEngine(java.sql.Connection conn)
              throws java.sql.SQLException,
                     oracle.spatial.network.NetworkDataException
Constructs a RoutingEngine and Loads the network from the database

Parameters:
conn - connection to DB recipient
Throws:
java.sql.SQLException
oracle.spatial.network.NetworkDataException

RoutingEngine

public RoutingEngine(java.lang.String managedDataSource)
              throws java.sql.SQLException,
                     javax.naming.NamingException,
                     oracle.spatial.network.NetworkDataException
Constructs a RoutingEngine and Loads the network from the database

Parameters:
managedDataSource - the name of managed data source, e.g. jdbc/navteqDS.
Throws:
java.sql.SQLException
javax.naming.NamingException
oracle.spatial.network.NetworkDataException
Method Detail

verify

public boolean verify(java.lang.String managedDataSource,
                      java.lang.String password)
               throws java.sql.SQLException,
                      javax.naming.NamingException,
                      oracle.spatial.network.NetworkDataException
Parameters:
managedDataSource -
Returns:
true if there is a current network already loaded or if one could be loaded from the managedDataSource
Throws:
java.sql.SQLException
javax.naming.NamingException
oracle.spatial.network.NetworkDataException

loadNetworks

public oracle.spatial.network.Network loadNetworks(java.lang.String managedDataSource,
                                                   java.lang.String password)
                                            throws java.sql.SQLException,
                                                   javax.naming.NamingException,
                                                   oracle.spatial.network.NetworkDataException
loads the network from the database

Parameters:
managedDataSource - the name of managed data source, e.g. jdbc/navteqDS
Throws:
java.sql.SQLException
javax.naming.NamingException
oracle.spatial.network.NetworkDataException

loadNetworks

public oracle.spatial.network.Network loadNetworks(java.sql.Connection conn)
                                            throws java.sql.SQLException,
                                                   oracle.spatial.network.NetworkDataException
loads the network from the database.
Note:
The caller is responsible for closing the connection.

Parameters:
conn - connection to DB recipient
Throws:
java.sql.SQLException
oracle.spatial.network.NetworkDataException

setRouteType

public void setRouteType(int type)

getRouteType

public int getRouteType()

setRoutingParams

public void setRoutingParams(RoutingRequest param)
Sets route type and back to start from a given routingRequest

Parameters:
param - request to set from

validateRequest

public void validateRequest(RoutingRequest request)
                     throws oracle.spatial.network.NetworkDataException
Tests for routingRequest validity (non-null, at least 2 stops.

Parameters:
request -
Throws:
oracle.spatial.network.NetworkDataException

travellingSalesman

public oracle.spatial.network.Path travellingSalesman(RoutingRequest request)
                                               throws oracle.spatial.network.NetworkDataException
Computes a Traveling salesman route from the request.

Parameters:
request -
Returns:
Throws:
oracle.spatial.network.NetworkDataException

shortestPath

public void shortestPath(RoutingRequest request)
                  throws oracle.spatial.network.NetworkDataException
Comutes shortest path between the stops in the request. Stop order is preserved.

Parameters:
request - The request to compute the path for
Throws:
oracle.spatial.network.NetworkDataException

addStops

public void addStops(RoutingRequest request)
              throws oracle.spatial.network.NetworkDataException
Computes start nodes for a request's stops

Parameters:
request -
Throws:
oracle.spatial.network.NetworkDataException

computeStartNode

public void computeStartNode(RoutingStop stop)
                      throws oracle.spatial.network.NetworkDataException
Finds the closest edge to a stop location, and computes a network start node from that.

Parameters:
stop -
Throws:
oracle.spatial.network.NetworkDataException

createTemporaryNode

public void createTemporaryNode(RoutingStop stop)
                         throws oracle.spatial.network.NetworkDataException
I don't use this, but if you were going to introduce a temporary node to trace from, this would do thwe trick.

Parameters:
stop -
Throws:
oracle.spatial.network.NetworkDataException

setBackToStart

public void setBackToStart(boolean backToStart)
Set the backToStart flag

Parameters:
backToStart -

isBackToStart

public boolean isBackToStart()
return the backToStart flag

Returns:

splitEdge

public void splitEdge()

main

public static void main(java.lang.String[] args)
Sample of how to use the routing engine. Build a request by adding stops, pass it to travelling salesman or shorest path, and retrieve the steps from the request.

Parameters:
args - Empty