You've already forked lazarus-ccr
MavViewer: Easier usage of GpsPoint and GpsTracks. Less hints and warnings. GpxReader LoadFromFile/Stream returns the ID of the items loaded.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8078 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -33,8 +33,8 @@ type
|
||||
procedure ReadTrackSegment(ANode: TDOMNode; ATrack: TGpsTrack);
|
||||
procedure ReadWayPoints(ANode: TDOMNode; AList: TGpsObjectList);
|
||||
public
|
||||
procedure LoadFromFile(AFileName: String; AList: TGpsObjectList; out ABounds: TRealArea);
|
||||
procedure LoadFromStream(AStream: TStream; AList: TGpsObjectList; out ABounds: TRealArea);
|
||||
function LoadFromFile(AFileName: String; AList: TGpsObjectList; out ABounds: TRealArea): Integer;
|
||||
function LoadFromStream(AStream: TStream; AList: TGpsObjectList; out ABounds: TRealArea): Integer;
|
||||
end;
|
||||
|
||||
|
||||
@@ -150,21 +150,25 @@ end;
|
||||
|
||||
{ TGpxReader }
|
||||
|
||||
procedure TGpxReader.LoadFromFile(AFileName: String; AList: TGpsObjectList;
|
||||
out ABounds: TRealArea);
|
||||
{ Loads the specified gpx file and stores the tracks, points etc. in the provided
|
||||
list. All items share the same mapviewer ID which is selected randomly and
|
||||
return as function result. ABounds is the geo rectangle enclosing the items. }
|
||||
function TGpxReader.LoadFromFile(AFileName: String; AList: TGpsObjectList;
|
||||
out ABounds: TRealArea): Integer;
|
||||
var
|
||||
stream: TStream;
|
||||
begin
|
||||
stream := TFileStream.Create(AFileName, fmOpenRead + fmShareDenyNone);
|
||||
try
|
||||
LoadFromStream(stream, AList, ABounds);
|
||||
Result := LoadFromStream(stream, AList, ABounds);
|
||||
finally
|
||||
stream.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGpxReader.LoadFromStream(AStream: TStream; AList: TGpsObjectList;
|
||||
out ABounds: TRealArea);
|
||||
{ See LoadFromFile. }
|
||||
function TGpxReader.LoadFromStream(AStream: TStream; AList: TGpsObjectList;
|
||||
out ABounds: TRealArea): Integer;
|
||||
var
|
||||
doc: TXMLDocument = nil;
|
||||
begin
|
||||
@@ -180,6 +184,7 @@ begin
|
||||
ABounds.TopLeft.Lat := FMaxLat;
|
||||
ABounds.BottomRight.Lon := FMaxLon;
|
||||
ABounds.BottomRight.Lat := FMinLat;
|
||||
Result := ID;
|
||||
finally
|
||||
doc.Free;
|
||||
end;
|
||||
|
||||
Reference in New Issue
Block a user