LazMapViewer: Zoom to bounds of points in loaded gpx file.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6921 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2019-05-17 20:28:46 +00:00
parent e3105224c0
commit 1aaebb2780
2 changed files with 3 additions and 7 deletions

View File

@ -195,9 +195,7 @@ end;
procedure TMainForm.BtnLoadGPXFileClick(Sender: TObject);
var
reader: TGpxReader;
item: TGpsObj;
b: TRealArea;
pt: TRealPoint;
begin
if OpenDialog.FileName <> '' then
OpenDialog.InitialDir := ExtractFileDir(OpenDialog.Filename);
@ -205,10 +203,8 @@ begin
reader := TGpxReader.Create;
try
reader.LoadFromFile(OpenDialog.FileName, MapView.GPSItems, b);
item := MapView.GPSItems.Items[MapView.GPSItems.Count-1];
pt.Lon := (b.TopLeft.Lon + b.BottomRight.Lon) * 0.5;
pt.Lat := (b.TopLeft.Lat + b.BottomRight.Lat) * 0.5;
MapView.Center := pt;
MapView.Engine.ZoomOnArea(b);
MapViewZoomChange(nil);
finally
reader.Free;
end;