Property type DistanceMatrix TECDistanceMatrix gives you
the distance and travel time for each pair of addresses
start / finish.
Not available on CloudMade
27
Fig. 57 DemoMatrix demonstrate
the use of DistanceMatrix
The demonstration program DemoMatrix is an adaptation
in Delphi of the
example of google javascript
The example of Google not working in IE because
there is a comma at the end arrays
origins and
destinations that crashes the IE
javascript engine
28
TECDistanceMatrix
Provides access to properties and methods
function
Count:integer;
Returns the number of couples Departure / Arrival
procedure
Update;
Start the calculation of distance and time for each
couple.
OnDistanceMatrix event is triggered when the
calculation is finished
Property
Origins:TStringList;
List of starting points
Property
Destinations:TStringList;
List of points of arrival
property
TravelMode :
TDirectionsTravelMode;
Choosing the type of road tmDriving or
tmWalking
property
UnitSystem :
TUnitSystem;
Choice of unit system, usMetric (km)
or usImperial (miles)
property
AvoidHighWays :
boolean;
Avoid highways or not
property
AvoidTolls :
boolean;
Avoid tolls or not
property
Cells[indexOrigine,indexDestination:integer]:
TECDistanceMatrixItem;
default;
Table for data access is the default property so you
can access it directly by
map.DistanceMatrix[indexOrigine,indexDestination]
instead of
map.DistanceMatrix.cells[indexOrigine,indexDestination]
indexDestination is the index of
the arrival point from the list
Destinations
indexOrigine is the index of the
starting point in the list
Origins
Returns nil if the indices are out of
bounds
20
property
Item[index:integer]:TECDistanceMatrixItem;
Item allows you to get your data sequentially, use
Count to know the total number of pairs.
They are arranged in the following order
(Start1-Finish1),
(Start1-Finish2),...,(Start2-Finish1),(Start2-Finish2),...
Returns nil if the index is out of
bounds
21
TECDistanceMatrixItem
This class represents a couple Departure / Arrival, it
gives you access to properties
property
Origin : string
Starting Address
property
Destination :
string
End Address
property
Distance :
integer
Distances in meters
property
Duration :
integer
Duration in seconds
property
DistanceText :
string
Distance in the form of a text that reflects the
unity tendering system chosen (
tmMetric or
tmImperial)
property
DurationText :
string
Duration in text
property
Status : string
Indicates a possible error, OK if no
error and if a match was found
OnDistanceMatrix
Event triggered after the call to
DistanceMatrix.Update when results are
available