Controlling Marker Icons and Polyline RouteCalculator Not Active

When our program first launches, on FormCreate the RouteCalculator.Active is set False. Immediately on the FormShow we calculate a route:

TMSFNCRouteCalculator1.CalculateRoute(Origin, Destination, MyOnCalculateRouteCallback, WayPoints, 'FullRoute', nil);

Now that the program is fully open, the user has a toggle to turn on "Route Editing". (After the user drags the route), all of the icons that we set in TMSFNCRouteCalculator1.Options.Polyline are visible.

How can we set these icons so that they are the default on program launch? So that the user does not have to modify the route to see our icons?

One option we found was to set RouteCalculator.Active to True on FormCreate. Not all of our users may want that switched on by default. It may be a toggle that is remembered per user. So I thought I'd ask the experts.

Thanks all

Hi,

When calculating a route, the marker collection is filled with values. You can simply loop through the marker collection and change the default marker icon:

TMSFNCMaps1.Markers[0].IconURL := 'MyURL'

if AMarker.DataString = ROUTECALCULATORSTARTMARKER then
//Start marker

if AMarker.DataString := ROUTECALCULATORENDMARKER then
//End marker

if AMarker.DataString = ROUTECALCULATORMARKER then
//Waypoint marker

Excellent, thank you.

1 Like