Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 1 to 1 of 1, page 1 of 1
<< previous next >>
TMS FMX WebGMaps
How to redraw all the markers
How to redraw all the markers
There are two possible techniques:
- Clear all markers from the Markers collection and add the markers again so they also show on the map.
- Iterate the Markers collection and call CreateMapMarker for each Marker to show it on the map.
Example 1:
procedure TForm2.Button1Click(Sender: TObject); begin TMSFMXWebGMaps1.Visible := not TMSFMXWebGMaps1.Visible; if TMSFMXWebGMaps1.Visible then MapIsVisible := true; end; procedure TForm2.FormCreate(Sender: TObject); begin InitMarkers; end; procedure TForm2.InitMarkers; begin TMSFMXWebGMaps1.Markers.Clear; TMSFMXWebGMaps1.Markers.Add(48.8, 2); TMSFMXWebGMaps1.Markers.Add(48.7, 2); end; procedure TForm2.TMSFMXWebGMaps1MapTilesLoad(Sender: TObject); var I: Integer; begin if MapIsVisible then begin MapIsVisible := false; InitMarkers; end; end;
procedure TForm2.Button1Click(Sender: TObject); begin TMSFMXWebGMaps1.Visible := not TMSFMXWebGMaps1.Visible; if TMSFMXWebGMaps1.Visible then MapIsVisible := true; end; procedure TForm2.FormCreate(Sender: TObject); begin InitMarkers; end; procedure TForm2.InitMarkers; begin TMSFMXWebGMaps1.Markers.Clear; TMSFMXWebGMaps1.Markers.Add(48.8, 2); TMSFMXWebGMaps1.Markers.Add(48.7, 2); end; procedure TForm2.TMSFMXWebGMaps1MapTilesLoad(Sender: TObject); var I: Integer; begin if MapIsVisible then begin MapIsVisible := false; for I := 0 to TMSFMXWebGMaps1.Markers.Count - 1 do TMSFMXWebGMaps1.CreateMapMarker(TMSFMXWebGMaps1.Markers[I]); end; end;