diff --git a/components/lazmapviewer/examples/fulldemo/gpslistform.pas b/components/lazmapviewer/examples/fulldemo/gpslistform.pas index 4af0bf00e..47a4a4292 100644 --- a/components/lazmapviewer/examples/fulldemo/gpslistform.pas +++ b/components/lazmapviewer/examples/fulldemo/gpslistform.pas @@ -2,6 +2,8 @@ unit gpslistform; {$mode objfpc}{$H+} +{$WARN 6058 off : Call to subroutine "$1" marked as inline is not inlined} + interface uses @@ -232,15 +234,18 @@ begin if OpenDialog.FileName <> '' then OpenDialog.InitialDir := ExtractFileDir(OpenDialog.FileName); if not OpenDialog.Execute then exit; - + + // Create a gpsTrack, read the track points, and add the track to the viewer. gpsTrack := TGpsTrack.Create; L := TStringList.Create; try L.LoadFromFile(OpenDialog.FileName); - for i := 1 to L.Count - 1 do begin // i=1 --> skip header line + for i := 1 to L.Count - 1 do // i=1 --> skip header line + begin if L[i] = '' then Continue; sa := L[i].Split(#9); - if TryStrToGps(sa[2], lon) and TryStrToGps(sa[3], lat) then begin + if TryStrToGps(sa[2], lon) and TryStrToGps(sa[3], lat) then + begin gpsPt := TGpsPoint.Create(lon, lat); gpsPt.Name := sa[1]; gpsTrack.Points.Add(gpsPt); @@ -251,11 +256,22 @@ begin finally L.Free; end; - + + // The track points are needed internally in the FList --> copy the track points + FList.Free; + FList := TGPSObjList.Create(false); + for i := 0 to gpsTrack.Points.Count - 1do + begin + gpsPt := gpsTrack.Points[i]; + FList.Add(gpsPt); + end; + + // Display the track points in the ListView ListView.Items.BeginUpdate; try ListView.Items.Clear; - for i:=0 to gpsTrack.Points.Count - 1 do begin + for i:=0 to gpsTrack.Points.Count - 1 do + begin gpsPt := gpsTrack.Points[i]; item := ListView.Items.Add; item.SubItems.Add(gpsPt.Name); @@ -265,6 +281,7 @@ begin finally ListView.Items.EndUpdate; end; + end; procedure TGPSListViewer.SetViewer(AValue: TMapView);