I did not try. I will explain better, I have a form that I pass the latitudes and longitudes to be created a route as below:
TMSFMXWebGMapsMain-> GetDirections (FormMain-> Lat, FormMain-> Lng, FormMain-> LatDst, FormMain-> LngDst,
false, TTravelMode :: tmDriving, TUnits :: usMetric,
TLanguageName :: lnPortuguese);
This is running on a Thread, after it executes this function the thread synchronizes to show the route:
TRoute * Route;
TMarker * MarkerBegin, * MarkerEnd;
Tmswebgmapspolygons :: TMapPolygon * CircleBegin, * CircleEnd;
TPolygonItem * PolygonItem;
Route = TMSFMXWebGMapsMain-> Directions-> operator [] (0);
TMSFMXWebGMapsMain-> MapZoomTo (Route-> Bounds);
TMSFMXWebGMapsMain-> CreateMapPolyline (Route-> Polyline);
MarkerBegin = TMSFMXWebGMapsMain-> Markers-> Add ();
MarkerGenin-> Draggable = false;
MarkerBegin-> Latitude = Route-> Legs-> operator [] (0) -> StartLocation-> Latitude;
MarkerBegin-> Longitude = Route-> Legs-> operator [] (0) -> StartLocation-> Longitude;
Marker Home-> Title = L "Iam";
Marker-> Icon = FormMain-> figPointer;
Marker Start-> InitialDropAnimation = true;
MarkerEnd = TMSFMXWebGMapsMain-> Markers-> Add ();
MarkerEnd-> Draggable = false;
MarkerEnd-> Latitude = Route-> Legs-> operator [] (0) -> EndLocation-> Latitude;
MarkerEnd-> Longitude = Route-> Legs-> operator [] (0) -> EndLocation-> Longitude;
MarkerEnd-> InitialDropAnimation = true;
PolygonItem = TMSFMXWebGMapsMain-> Polygons-> Add ();
CircleInicio = PolygonItem-> Polygon;
Circle Start-> PolygonType = ptCircle;
Circle Start-> BackgroundOpacity = 50;
Circle Start-> BorderWidth = 2;
Circle Start-> Radius = Integer (Route-> Legs-> operator [] (0) -> Distance / 30);
if (FormMain-> MyLocalManual) {
Circle Start-> Center-> Latitude = FormMain-> LatitudeManual;
Circle Start-> Center-> Longitude = FormMain-> LongitudeManual;
} else {
Circle Start-> Center-> Latitude = Route-> Legs-> operator [] (0) -> StartLocation-> Latitude;
Circle Start-> Center-> Longitude = Route-> Legs-> operator [] (0) -> StartLocation-> Longitude;
}
PolygonItem = TMSFMXWebGMapsMain-> Polygons-> Add ();
CirculoFim = PolygonItem-> Polygon;
CirculoFim-> PolygonType = ptCircle;
CirculoFim-> BackgroundOpacity = 50;
CircleFim-> BorderWidth = 2;
Circle End-> Radius = Integer (Route-> Legs-> operator [] (0) -> Distance / 30);
Circle-> Center-> Latitude = Route-> Legs-> operator [] (0) -> EndLocation-> Latitude;
Circle-> Center-> Longitude = Route-> Legs-> operator [] (0) -> EndLocation-> Longitude;
TMSFMXWebGMapsMain-> CreateMapPolygon (CircleStart);
TMSFMXWebGMapsMain-> CreateMapPolygon (CircleFim);
TMSFMXWebGMapsMain-> CreateMapMarker (MarkerEnd);
TMSFMXWebGMapsMain-> CreateMapMarker (MarkerStart);
Best Regards!
One note is that I only do this after the OnDownloadfinish tells me that the map is fully loaded, so I created a variable that tells me when this happens, only after that I execute the Thread at the beginning of the post.
As I said it usually works most of the time, but sometimes the map does not appear, it looks like it's hidden. When I observed this, I verified in the creation of the form if the masta is visible, if it is not visible I do the following method:
:: FormCreate ...
if (! TMSFMXWebGMapsMain-> Visible) {
TMSFMXWebGMapsMain-> Visible = true;
}
But sometimes it crashes, remembering that I created the method that tells me when the map is fully loaded, except in this case it does not load and my application waits for loading that never happens.
I would like in that case, that when that happens I could empty it of memory and try again.
Another detail I noticed is that this occurs when the Internet is slow.
Best Regards!