Getting started with TMS FNC Directions
Prerequisites
- TMS FNC Core installed and the runtime package added to the project.
- TMS FNC Maps installed and the runtime package added to the project.
- An API key for the directions service backend you intend to use.
Add the component
- Drop
TTMSFNCDirections from the TMS FNC Maps palette page onto a form.
- Set the
APIKey property.
- Set the
Service property to the desired routing backend.
Request directions
Request directionsPascalC++{ Inside a button click handler: }
var
Origin, Destination: TTMSFNCMapsCoordinateRec;
begin
Origin.Latitude := 51.5074;
Origin.Longitude := -0.1278;
Destination.Latitude := 48.8566;
Destination.Longitude := 2.3522;
TMSFNCDirections1.GetDirections(Origin, Destination);
end;
// Inside a button click handler:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TTMSFNCMapsCoordinateRec Origin, Destination;
Origin.Latitude = 51.5074;
Origin.Longitude = -0.1278;
Destination.Latitude = 48.8566;
Destination.Longitude = 2.3522;
TMSFNCDirections1->GetDirections(Origin, Destination);
}
Handle the result
Handle the resultPascalC++procedure TForm1.TMSFNCDirections1GetDirections(
Sender: TObject; ARequestIndex: Integer;
ARequest: TTMSFNCDirectionsRequest;
ADirections: TTMSFNCDirectionsItems);
begin
{ ADirections contains route items with legs and steps }
end;
// Pascal sample declares ARequestIndex/ADirections parameters; the real OnGetDirections event is used here.
void __fastcall TForm1::TMSFNCDirections1GetDirections(TObject *Sender,
TTMSFNCDirectionsRequest * const ARequest,
TTMSFNCCloudBaseRequestResult * const ARequestResult)
{
// ARequest->Items contains route items with legs and steps
}
Next steps
- Guides — multi-stop routes, travel mode, and result handling.
- API reference — full class reference.