Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TMS VCL WebGMaps
How to save and restore a map position

Initialization:
  public
    MapBounds: TBounds;
    MapZoom: Integer;

procedure TForm2.FormCreate(Sender: TObject);
begin
  MapBounds := TBounds.Create;
end;
Get the current map position:
  WebGMaps1.GetMapBounds;
Save the current map position:
procedure TForm1.WebGMaps1BoundsRetrieved(Sender: TObject; Bounds: TBounds);
begin
  MapBounds.NorthEast.Latitude := Bounds.NorthEast.Latitude;
  MapBounds.NorthEast.Longitude := Bounds.NorthEast.Longitude;
  MapBounds.SouthWest.Latitude := Bounds.SouthWest.Latitude;
  MapBounds.SouthWest.Longitude := Bounds.SouthWest.Longitude;

  MapZoom := WebGMaps1.MapOptions.ZoomMap;
end;
Load a saved map position:
  WebGMaps1.MapZoomTo(MapBounds);
  WebGMaps1.MapOptions.ZoomMap := MapZoom;