MultiThreadMatrix Class |
Namespace: Telogis.GeoBase.Routing
The MultiThreadMatrix type exposes the following members.
Name | Description | |
---|---|---|
MultiThreadMatrix(RouteStop) |
Create a MultiThreadMatrix using an array of RouteStops.
The default RoutingStrategy is RoutingStrategyFastest.
The default number of threads is equal to the number of CPU cores available on the local machine.
| |
MultiThreadMatrix(RouteStop, LinkCost) |
Create a MultiThreadMatrix using an array of RouteStops.
The RoutingStrategy defaults to RoutingStrategyFastest.
The default number of threads is equal to the number of CPU cores available on the local machine.
| |
MultiThreadMatrix(RouteStop, RoutingStrategy) |
Create a MultiThreadMatrix using an array of RouteStops, and a
RoutingStrategy. The default number of threads is equal to the
number of CPU cores available on the local machine.
| |
MultiThreadMatrix(RouteStop, RoutingStrategy, LatLon) |
Create a MultiThreadMatrix using an array of RouteStops, and a
RoutingStrategy. The default number of threads is equal to the
number of CPU cores available on the local machine.
| |
MultiThreadMatrix(RouteStop, RoutingStrategy, Int32, Boolean) |
Create a MultiThreadMatrix using an array of RouteStops, and a RoutingStrategy. Define the number of threads to use (NumThreads), and specify if the calculated data should be saved to disk (persist = true) for quicker, subsequent data reading.
| |
MultiThreadMatrix(RouteStop, RoutingStrategy, Int32, Boolean, LinkCost) |
Create a MultiThreadMatrix using an array of RouteStops, and a RoutingStrategy. Define the number of threads to use (NumThreads), and specify if the calculated data should be saved to disk (persist = true) for quicker, subsequent data reading.
| |
MultiThreadMatrix(RouteStop, RoutingStrategy, LatLon, Int32, Boolean, LinkCost) |
Create a MultiThreadMatrix using an array of RouteStops, and a RoutingStrategy. Define the number of threads to use (NumThreads), and specify if the calculated data should be saved to disk (persist = true) for quicker, subsequent data reading.
|
Name | Description | |
---|---|---|
CustomRoutingAccessKeys | Obsolete. |
Name | Description | |
---|---|---|
Distances |
Returns an array of distances (in meters) from the specified stop (LatLon) to all other stops.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
GetDistance |
Get the distance (in meters) between two points.
| |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetSlot |
Returns the slot value (row index) for the specified LatLon | |
GetTime |
Get the time (in seconds) from point to point.
| |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
Times |
Returns an array of times (in seconds) from the specified stop (LatLon) to all other stops.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
When the MultiThreadMatrix is 'persistent' the calculation results are automatically saved and loaded from disk, as and when required.
Related articles: Using a RouteMatrix.
{ //Create stops RouteStop start = new RouteStop(33.84105, -117.91133); RouteStop stop1 = new RouteStop(33.84123, -117.92153); RouteStop stop2 = new RouteStop(33.83373, -117.91278); RouteStop stop3 = new RouteStop(33.83818, -117.90488); RouteStop stop4 = new RouteStop(33.82960, -117.90041); //Create new MultiThreadMatrix // * RouteStop array // * strategy -> RoutingStrategyFastest // * number of threads -> 4 // * persist -> true MultiThreadMatrix myMTM = new MultiThreadMatrix(new RouteStop[] { start, stop1, stop2, stop3, stop4 }, new RoutingStrategyFastest(), 4, true); //Get time and distances double[] myMTMTimes = myMTM.Times(0); // seconds double[] myMTMDistances = myMTM.Distances(0); // meters //Output time and distance calculations to console for (int i = 1; i < myMTMTimes.Length; i++) { //Get distance (meters) string distance = MathUtil.ConvertUnits(myMTMDistances[i], DistanceUnit.METERS, DistanceUnit.KILOMETERS).ToString(".##"); //Get time (seconds) TimeSpan time = TimeSpan.FromSeconds(myMTMTimes[i]); //Output to console Console.WriteLine("Distance to stop " + i + " is " + distance + "km, " + time + " minutes away" + Environment.NewLine); } }