NetTopologySuite
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
NetTopologySuite.Samples.Tests.Various.PathFinder Class Reference

A class that manages shortest path computation. More...

Public Member Functions

delegate double ComputeWeightDelegate (ILineString line)
 A delegate that defines how to calculate the weight of a line. More...
 
 PathFinder (bool bidirectional)
 Initializes a new instance of the GraphBuilder2 class. More...
 
 PathFinder ()
 Initializes a new instance of the GraphBuilder2 class, using a directed graph. More...
 
bool Add (params ILineString[] lines)
 Adds each line to the graph structure. More...
 
void Initialize ()
 Initialize the algorithm using the default weight computer, that uses string length as weight value. More...
 
void Initialize (ComputeWeightDelegate computer)
 Initialize the algorithm using the specified computer weight computer More...
 
IGeometry Find (IGeometry source, IGeometry destination)
 Carries out the shortest path anlayis between the two nodes passed as variables and returns an ILineString giveing the shortest path. More...
 
IGeometry Find (Coordinate source, Coordinate destination)
 Carries out the shortest path between the two nodes ids passed as variables and returns an ILineString giveing the shortest path. More...
 

Detailed Description

A class that manages shortest path computation.

Constructor & Destructor Documentation

NetTopologySuite.Samples.Tests.Various.PathFinder.PathFinder ( bool  bidirectional)

Initializes a new instance of the GraphBuilder2 class.

Parameters
bidirectionalSpecify if the graph must be build using both edges directions.
NetTopologySuite.Samples.Tests.Various.PathFinder.PathFinder ( )

Initializes a new instance of the GraphBuilder2 class, using a directed graph.

Member Function Documentation

bool NetTopologySuite.Samples.Tests.Various.PathFinder.Add ( params ILineString[]  lines)

Adds each line to the graph structure.

Parameters
lines
Returns
true if all lines lines are added, false otherwise.
Exceptions
TopologyExceptionIf geometries don't have the same factory.
delegate double NetTopologySuite.Samples.Tests.Various.PathFinder.ComputeWeightDelegate ( ILineString  line)

A delegate that defines how to calculate the weight of a line.

Parameters
lineA line.
Returns
The weight of the line.
IGeometry NetTopologySuite.Samples.Tests.Various.PathFinder.Find ( IGeometry  source,
IGeometry  destination 
)

Carries out the shortest path anlayis between the two nodes passed as variables and returns an ILineString giveing the shortest path.

Parameters
sourceThe source geom
destinationThe destination geom

A ILineString or a IMultiLineString with all the elements of the graph that composes the shortest path, sequenced using a LineSequencer.

IGeometry NetTopologySuite.Samples.Tests.Various.PathFinder.Find ( Coordinate  source,
Coordinate  destination 
)

Carries out the shortest path between the two nodes ids passed as variables and returns an ILineString giveing the shortest path.

Parameters
sourceThe source node
destinationThe destination node

A ILineString or a IMultiLineString with all the elements of the graph that composes the shortest path, sequenced using a LineSequencer.

void NetTopologySuite.Samples.Tests.Various.PathFinder.Initialize ( )

Initialize the algorithm using the default weight computer, that uses string length as weight value.

Exceptions
TopologyExceptionIf you've don't added two or more geometries to the builder.
ApplicationExceptionIf builder is already initialized.
void NetTopologySuite.Samples.Tests.Various.PathFinder.Initialize ( ComputeWeightDelegate  computer)

Initialize the algorithm using the specified computer weight computer

Parameters
computerA function that computes the weight of any edge of the graph.
Exceptions
TopologyExceptionIf you've don't added two or more geometries to the builder.
ApplicationExceptionIf builder is already initialized.

The documentation for this class was generated from the following file: