summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-09-24 22:27:32 +0200
committerErich Eckner <git@eckner.net>2017-09-24 22:27:32 +0200
commit2f1cb6deba5dc5a1dbc828f9304d0a5465f6cbf2 (patch)
tree723e04e2dd93c3ea1261554a93f82fabb9f757cf
downloadGPS-Schneidetisch-2f1cb6deba5dc5a1dbc828f9304d0a5465f6cbf2.tar.xz
Initial commit
-rw-r--r--.gitignore11
-rw-r--r--gps_schneidetisch.icobin0 -> 137040 bytes
-rw-r--r--gps_schneidetisch.lpi79
-rw-r--r--gps_schneidetisch.lpr21
-rw-r--r--gps_schneidetisch.lps160
-rw-r--r--gps_schneidetisch.resbin0 -> 138936 bytes
-rw-r--r--unit1.lfm94
-rw-r--r--unit1.pas366
8 files changed, 731 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fdced0f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,11 @@
+*.bmp
+*.png
+*.bak
+*.ppu
+*.o
+*.zip
+*.tar.gz
+lib
+gps_schneidetisch
+*~
+Log*
diff --git a/gps_schneidetisch.ico b/gps_schneidetisch.ico
new file mode 100644
index 0000000..0341321
--- /dev/null
+++ b/gps_schneidetisch.ico
Binary files differ
diff --git a/gps_schneidetisch.lpi b/gps_schneidetisch.lpi
new file mode 100644
index 0000000..a4de879
--- /dev/null
+++ b/gps_schneidetisch.lpi
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CONFIG>
+ <ProjectOptions>
+ <Version Value="10"/>
+ <General>
+ <SessionStorage Value="InProjectDir"/>
+ <MainUnit Value="0"/>
+ <Title Value="gps_schneidetisch"/>
+ <ResourceType Value="res"/>
+ <UseXPManifest Value="True"/>
+ <Icon Value="0"/>
+ </General>
+ <i18n>
+ <EnableI18N LFM="False"/>
+ </i18n>
+ <VersionInfo>
+ <StringTable ProductVersion=""/>
+ </VersionInfo>
+ <BuildModes Count="1">
+ <Item1 Name="Default" Default="True"/>
+ </BuildModes>
+ <PublishOptions>
+ <Version Value="2"/>
+ </PublishOptions>
+ <RunParams>
+ <local>
+ <FormatVersion Value="1"/>
+ </local>
+ </RunParams>
+ <RequiredPackages Count="1">
+ <Item1>
+ <PackageName Value="LCL"/>
+ </Item1>
+ </RequiredPackages>
+ <Units Count="2">
+ <Unit0>
+ <Filename Value="gps_schneidetisch.lpr"/>
+ <IsPartOfProject Value="True"/>
+ </Unit0>
+ <Unit1>
+ <Filename Value="unit1.pas"/>
+ <IsPartOfProject Value="True"/>
+ <ComponentName Value="Form1"/>
+ <ResourceBaseClass Value="Form"/>
+ <UnitName Value="Unit1"/>
+ </Unit1>
+ </Units>
+ </ProjectOptions>
+ <CompilerOptions>
+ <Version Value="11"/>
+ <Target>
+ <Filename Value="gps_schneidetisch"/>
+ </Target>
+ <SearchPaths>
+ <IncludeFiles Value="$(ProjOutDir)"/>
+ <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
+ </SearchPaths>
+ <Linking>
+ <Options>
+ <Win32>
+ <GraphicApplication Value="True"/>
+ </Win32>
+ </Options>
+ </Linking>
+ </CompilerOptions>
+ <Debugging>
+ <Exceptions Count="3">
+ <Item1>
+ <Name Value="EAbort"/>
+ </Item1>
+ <Item2>
+ <Name Value="ECodetoolError"/>
+ </Item2>
+ <Item3>
+ <Name Value="EFOpenError"/>
+ </Item3>
+ </Exceptions>
+ </Debugging>
+</CONFIG>
diff --git a/gps_schneidetisch.lpr b/gps_schneidetisch.lpr
new file mode 100644
index 0000000..2c9e591
--- /dev/null
+++ b/gps_schneidetisch.lpr
@@ -0,0 +1,21 @@
+program gps_schneidetisch;
+
+{$mode objfpc}{$H+}
+
+uses
+ {$IFDEF UNIX}{$IFDEF UseCThreads}
+ cthreads,
+ {$ENDIF}{$ENDIF}
+ Interfaces, // this includes the LCL widgetset
+ Forms, Unit1
+ { you can add units after this };
+
+{$R *.res}
+
+begin
+ RequireDerivedFormResource:=True;
+ Application.Initialize;
+ Application.CreateForm(TForm1, Form1);
+ Application.Run;
+end.
+
diff --git a/gps_schneidetisch.lps b/gps_schneidetisch.lps
new file mode 100644
index 0000000..943e1b5
--- /dev/null
+++ b/gps_schneidetisch.lps
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CONFIG>
+ <ProjectSession>
+ <Version Value="10"/>
+ <BuildModes Active="Default"/>
+ <Units Count="3">
+ <Unit0>
+ <Filename Value="gps_schneidetisch.lpr"/>
+ <IsPartOfProject Value="True"/>
+ <EditorIndex Value="-1"/>
+ <WindowIndex Value="-1"/>
+ <TopLine Value="-1"/>
+ <CursorPos X="-1" Y="-1"/>
+ <UsageCount Value="20"/>
+ </Unit0>
+ <Unit1>
+ <Filename Value="unit1.pas"/>
+ <IsPartOfProject Value="True"/>
+ <ComponentName Value="Form1"/>
+ <ResourceBaseClass Value="Form"/>
+ <UnitName Value="Unit1"/>
+ <IsVisibleTab Value="True"/>
+ <TopLine Value="246"/>
+ <CursorPos Y="253"/>
+ <UsageCount Value="20"/>
+ <Loaded Value="True"/>
+ <LoadedDesigner Value="True"/>
+ </Unit1>
+ <Unit2>
+ <Filename Value="/usr/share/lazarus/lcl/include/control.inc"/>
+ <EditorIndex Value="-1"/>
+ <TopLine Value="2716"/>
+ <CursorPos Y="2738"/>
+ <UsageCount Value="10"/>
+ </Unit2>
+ </Units>
+ <JumpHistory Count="30" HistoryIndex="29">
+ <Position1>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="206" Column="10" TopLine="163"/>
+ </Position1>
+ <Position2>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="213" Column="7" TopLine="185"/>
+ </Position2>
+ <Position3>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="220" Column="7" TopLine="187"/>
+ </Position3>
+ <Position4>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="194" Column="17" TopLine="192"/>
+ </Position4>
+ <Position5>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="196" Column="17" TopLine="194"/>
+ </Position5>
+ <Position6>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="202" Column="11" TopLine="200"/>
+ </Position6>
+ <Position7>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="305" TopLine="238"/>
+ </Position7>
+ <Position8>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="307" TopLine="243"/>
+ </Position8>
+ <Position9>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="314" TopLine="272"/>
+ </Position9>
+ <Position10>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="215" TopLine="194"/>
+ </Position10>
+ <Position11>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="217" TopLine="196"/>
+ </Position11>
+ <Position12>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="225" Column="37" TopLine="219"/>
+ </Position12>
+ <Position13>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="90" Column="6" TopLine="68"/>
+ </Position13>
+ <Position14>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="89" Column="6" TopLine="67"/>
+ </Position14>
+ <Position15>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="90" Column="6" TopLine="68"/>
+ </Position15>
+ <Position16>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="65" TopLine="47"/>
+ </Position16>
+ <Position17>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="89" Column="36" TopLine="61"/>
+ </Position17>
+ <Position18>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="266" TopLine="245"/>
+ </Position18>
+ <Position19>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="49" TopLine="72"/>
+ </Position19>
+ <Position20>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="168" Column="11" TopLine="141"/>
+ </Position20>
+ <Position21>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="54" Column="26" TopLine="33"/>
+ </Position21>
+ <Position22>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="168" Column="14" TopLine="133"/>
+ </Position22>
+ <Position23>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="273" Column="9" TopLine="251"/>
+ </Position23>
+ <Position24>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="253" TopLine="245"/>
+ </Position24>
+ <Position25>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="280" TopLine="245"/>
+ </Position25>
+ <Position26>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="281" TopLine="245"/>
+ </Position26>
+ <Position27>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="282" TopLine="246"/>
+ </Position27>
+ <Position28>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="284" TopLine="248"/>
+ </Position28>
+ <Position29>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="285" TopLine="249"/>
+ </Position29>
+ <Position30>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="253" TopLine="246"/>
+ </Position30>
+ </JumpHistory>
+ </ProjectSession>
+</CONFIG>
diff --git a/gps_schneidetisch.res b/gps_schneidetisch.res
new file mode 100644
index 0000000..4ff746d
--- /dev/null
+++ b/gps_schneidetisch.res
Binary files differ
diff --git a/unit1.lfm b/unit1.lfm
new file mode 100644
index 0000000..9f8193f
--- /dev/null
+++ b/unit1.lfm
@@ -0,0 +1,94 @@
+object Form1: TForm1
+ Left = 1690
+ Height = 597
+ Top = 180
+ Width = 854
+ Caption = 'Form1'
+ ClientHeight = 597
+ ClientWidth = 854
+ OnResize = FormResize
+ LCLVersion = '1.6.4.0'
+ object Button1: TButton
+ Left = 8
+ Height = 25
+ Top = 8
+ Width = 75
+ Caption = 'Laden'
+ OnClick = Button1Click
+ TabOrder = 0
+ end
+ object Button2: TButton
+ Left = 88
+ Height = 25
+ Top = 8
+ Width = 75
+ Caption = 'Speichern'
+ OnClick = Button2Click
+ TabOrder = 1
+ end
+ object ListBox1: TListBox
+ Left = 0
+ Height = 152
+ Top = 40
+ Width = 344
+ ItemHeight = 0
+ OnClick = ListBox1Click
+ ScrollWidth = 340
+ TabOrder = 2
+ TopIndex = -1
+ end
+ object ListBox2: TListBox
+ Left = 0
+ Height = 144
+ Top = 192
+ Width = 344
+ ItemHeight = 0
+ OnClick = ListBox2Click
+ ScrollWidth = 340
+ TabOrder = 3
+ TopIndex = -1
+ end
+ object ListBox3: TListBox
+ Left = 0
+ Height = 256
+ Top = 336
+ Width = 344
+ ItemHeight = 0
+ OnClick = ListBox3Click
+ ScrollWidth = 340
+ TabOrder = 4
+ TopIndex = -1
+ end
+ object Image1: TImage
+ Left = 344
+ Height = 90
+ Top = 0
+ Width = 90
+ end
+ object Button3: TButton
+ Left = 168
+ Height = 25
+ Top = 8
+ Width = 75
+ Caption = 'Teilen'
+ OnClick = Button3Click
+ TabOrder = 5
+ end
+ object Button4: TButton
+ Left = 248
+ Height = 25
+ Top = 8
+ Width = 75
+ Caption = 'Löschen'
+ OnClick = Button4Click
+ TabOrder = 6
+ end
+ object SaveDialog1: TSaveDialog
+ left = 48
+ top = 40
+ end
+ object OpenDialog1: TOpenDialog
+ left = 16
+ top = 40
+ end
+end
diff --git a/unit1.pas b/unit1.pas
new file mode 100644
index 0000000..38497a6
--- /dev/null
+++ b/unit1.pas
@@ -0,0 +1,366 @@
+unit Unit1;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
+ ExtCtrls;
+
+type
+ tTrkPt = record
+ lat,lon,ele,time: string;
+ end;
+ tTrack = record
+ name: string;
+ trkPts: array of tTrkPt;
+ end;
+ tGpxInhalt = record
+ kopf: String;
+ trks: array of tTrack;
+ end;
+ tGpxFile = record
+ prefix: array of string;
+ gpx: array of tGPXInhalt;
+ end;
+
+ { tForm1 }
+
+ tForm1 = class(tForm)
+ Button1: TButton;
+ Button2: TButton;
+ Button3: TButton;
+ Button4: TButton;
+ Image1: TImage;
+ ListBox1: TListBox;
+ ListBox2: TListBox;
+ ListBox3: TListBox;
+ OpenDialog1: TOpenDialog;
+ SaveDialog1: TSaveDialog;
+ procedure Button1Click(Sender: TObject);
+ procedure Button2Click(Sender: TObject);
+ procedure Button3Click(Sender: TObject);
+ procedure Button4Click(Sender: TObject);
+ procedure FormResize(Sender: TObject);
+ procedure ListBox1Click(Sender: TObject);
+ procedure ListBox2Click(Sender: TObject);
+ procedure ListBox3Click(Sender: TObject);
+ private
+ { private declarations }
+ public
+ { public declarations }
+ d: tGpxFile;
+ procedure zeichneGpxs;
+ procedure zeichneTrks;
+ procedure zeichneTrkPts;
+ procedure zeichne;
+ end;
+
+var
+ form1: tForm1;
+
+function gibFarbe(i: integer): tColor;
+function mystrtofloat(S: String): extended;
+
+implementation
+
+uses
+ math;
+
+{$R *.lfm}
+
+var
+ farben: array of tColor;
+
+function gibFarbe(i: integer): tColor;
+begin
+ randomize;
+ while i>=length(farben) do begin
+ setLength(farben,length(farben)+1);
+ farben[length(farben)-1]:=random($1000000);
+ end;
+ result:=farben[i];
+end;
+
+function mystrtofloat(S: String): extended;
+begin
+ while pos('.',S)>0 do
+ S[pos('.',S)]:=',';
+ result:=strtofloat(S);
+end;
+
+{ tForm1 }
+
+procedure tForm1.Button1Click(Sender: TObject);
+var
+ f: text;
+ s: string;
+ m,cnt: integer;
+begin
+ if opendialog1.execute then begin
+ setLength(D.Prefix,0);
+ setLength(D.GPX,0);
+ Assignfile(F,openDialog1.fileName);
+ Reset(F);
+ M:=0;
+ cnt:=0;
+ s:='';
+ while (s<>'') or not eof(F) do begin inc(cnt);
+ if s='' then Readln(F,S);
+ case M of
+ 0:
+ if pos('<gpx ',S)>0 then begin
+ setLength(D.GPX,length(D.GPX)+1);
+ setLength(D.GPX[length(D.GPX)-1].Trks,0);
+ delete(S,1,pos('<gpx ',S)+3);
+ delete(S,pos('>',S),length(S));
+ D.GPX[length(D.GPX)-1].Kopf:=S;
+ inc(M);
+ end
+ else begin
+ setLength(D.Prefix,length(D.Prefix)+1);
+ D.Prefix[length(D.Prefix)-1]:=S;
+ s:='';
+ end;
+ 1:
+ if pos('<trk>',S)>0 then begin inc(cnt);
+ setLength(D.GPX[length(D.GPX)-1].Trks,length(D.GPX[length(D.GPX)-1].Trks)+1);
+ D.GPX[length(D.GPX)-1].Trks[length(D.GPX[length(D.GPX)-1].Trks)-1].Name:='';
+ setLength(D.GPX[length(D.GPX)-1].Trks[length(D.GPX[length(D.GPX)-1].Trks)-1].TrkPts,0);
+ inc(M);
+ end
+ else
+ dec(M);
+ 2:
+ if pos('<name>',S)>0 then begin
+ delete(S,1,pos('<name>',S)+5);
+ delete(S,pos('</name>',S),length(S));
+ D.GPX[length(D.GPX)-1].Trks[length(D.GPX[length(D.GPX)-1].Trks)-1].Name:=S;
+ end
+ else if pos('<trkseg>',S)>0 then
+ inc(M)
+ else
+ dec(M);
+ 3:
+ if pos('<trkpt ',S)>0 then begin
+ setLength(D.GPX[length(D.GPX)-1].Trks[length(D.GPX[length(D.GPX)-1].Trks)-1].TrkPts,
+ length(D.GPX[length(D.GPX)-1].Trks[length(D.GPX[length(D.GPX)-1].Trks)-1].TrkPts)+1);
+ with D.GPX[length(D.GPX)-1].Trks[length(D.GPX[length(D.GPX)-1].Trks)-1].TrkPts[
+ length(D.GPX[length(D.GPX)-1].Trks[length(D.GPX[length(D.GPX)-1].Trks)-1].TrkPts)-1] do begin
+ delete(S,1,pos('lat="',S)+4);
+ lat:=copy(S,1,pos('"',S)-1);
+ delete(S,1,pos('lon="',S)+4);
+ lon:=copy(S,1,pos('"',S)-1);
+ if eof(F) then exit;
+ readln(F,S);
+ delete(S,1,pos('<ele>',S)+4);
+ ele:=copy(S,1,pos('</ele>',S)-1);
+ if eof(F) then exit;
+ readln(F,S);
+ delete(S,1,pos('<time>',S)+5);
+ time:=copy(S,1,pos('</time>',S)-1);
+ end;
+ end
+ else if pos('</trkseg>',S)>0 then
+ dec(M);
+ end{of Case};
+ end;
+ Closefile(F);
+ end;
+ ZeichneGPXs;
+ messagedlg('ok ('+inttostr(cnt)+')',mtinformation,[mbOk],0);
+end;
+
+procedure tForm1.Button2Click(Sender: TObject);
+var
+ F: text;
+ I,J,K: Integer;
+begin
+ if Savedialog1.Execute then begin
+ Assignfile(F,Savedialog1.FileName);
+ Rewrite(F);
+ for I:=0 to length(D.Prefix)-1 do
+ Writeln(F,D.Prefix[I]);
+ for I:=0 to length(D.GPX)-1 do begin
+ writeln(F,'<gpx'+D.GPX[I].Kopf+'>');
+ for J:=0 to length(D.GPX[I].Trks)-1 do begin
+ writeln(F,' <trk>');
+ while pos('<',D.GPX[I].Trks[J].Name)>0 do
+ D.GPX[I].Trks[J].Name[pos('<',D.GPX[I].Trks[J].Name)]:='-';
+ while pos('>',D.GPX[I].Trks[J].Name)>0 do
+ D.GPX[I].Trks[J].Name[pos('>',D.GPX[I].Trks[J].Name)]:='+';
+ writeln(F,' <name>'+D.GPX[I].Trks[J].Name+'</name>');
+ writeln(F,' <trkseg>');
+ for K:=0 to length(D.GPX[I].Trks[J].TrkPts)-1 do begin
+ writeln(F,' <trkpt lat="'+D.GPX[I].Trks[J].TrkPts[K].lat+
+ '" lon="'+D.GPX[I].Trks[J].TrkPts[K].lon+'">');
+ writeln(F,' <ele>'+D.GPX[I].Trks[J].TrkPts[K].ele+'</ele>');
+ writeln(F,' <time>'+D.GPX[I].Trks[J].TrkPts[K].time+'</time>');
+ writeln(F,' </trkpt>');
+ end;
+ writeln(F,' </trkseg>');
+ writeln(F,' </trk>');
+ end;
+ writeln(F,'</gpx>');
+ end;
+ Closefile(F);
+ end;
+end;
+
+procedure tForm1.Button3Click(Sender: TObject);
+var
+ I: Integer;
+begin
+ if Listbox1.ItemIndex<0 then exit;
+ if Listbox2.ItemIndex<0 then exit;
+ if Listbox3.ItemIndex<0 then exit;
+ with D.GPX[Listbox1.Itemindex] do begin
+ setlength(Trks,length(Trks)+1);
+ for I:=length(Trks)-1 downto Listbox2.ItemIndex+1 do
+ Trks[I]:=Trks[I-1];
+ setlength(Trks[Listbox2.Itemindex].TrkPts,Listbox3.ItemIndex+1);
+ Trks[Listbox2.Itemindex].Name:=Trks[Listbox2.Itemindex].Name+'<';
+ with Trks[Listbox2.Itemindex+1] do begin
+ for I:=Listbox3.ItemIndex to length(TrkPts)-1 do
+ TrkPts[I-Listbox3.ItemIndex]:=TrkPts[I];
+ setlength(TrkPts,length(TrkPts)-Listbox3.ItemIndex);
+ Name:=Name+'>';
+ end;
+ end;
+ ZeichneTRKs;
+end;
+
+procedure tForm1.Button4Click(Sender: TObject);
+var
+ i: integer;
+begin
+ if Listbox1.ItemIndex<0 then exit;
+ if Listbox2.ItemIndex<0 then exit;
+ with D.GPX[Listbox1.ItemIndex] do begin
+ for I:=Listbox2.ItemIndex+1 to length(Trks)-1 do
+ Trks[I-1]:=Trks[I];
+ setlength(Trks,length(Trks)-1);
+ ZeichneTRKs;
+ end;
+end;
+
+procedure tForm1.FormResize(Sender: TObject);
+begin
+ Listbox3.Height:=Form1.ClientHeight-Listbox3.Top;
+ Zeichne;
+end;
+
+procedure tForm1.ListBox1Click(Sender: TObject);
+begin
+ ZeichneTRKs;
+end;
+
+procedure tForm1.ListBox2Click(Sender: TObject);
+begin
+ ZeichneTRKPTs;
+end;
+
+procedure tForm1.ListBox3Click(Sender: TObject);
+begin
+ Zeichne;
+end;
+
+procedure tForm1.zeichneGpxs;
+var
+ i: integer;
+begin
+ Listbox1.Items.Clear;
+ for I:=0 to length(D.GPX)-1 do
+ Listbox1.Items.Add(D.GPX[I].Kopf);
+ ZeichneTRKs;
+end;
+
+procedure tForm1.zeichneTrks;
+var
+ i: integer;
+begin
+ Listbox2.Items.Clear;
+ if Listbox1.ItemIndex>=0 then
+ for i:=0 to length(D.GPX[Listbox1.ItemIndex].Trks)-1 do
+ Listbox2.Items.Add(D.GPX[Listbox1.ItemIndex].Trks[I].Name);
+ ZeichneTRKPTs;
+end;
+
+procedure tForm1.zeichneTrkPts;
+var
+ i: integer;
+begin
+ Listbox3.Items.Clear;
+ if (Listbox1.ItemIndex>=0) and (Listbox2.ItemIndex>=0) then
+ For I:=0 to length(D.GPX[Listbox1.ItemIndex].Trks[Listbox2.ItemIndex].TrkPts)-1 do
+ Listbox3.Items.Add(D.GPX[Listbox1.ItemIndex].Trks[Listbox2.ItemIndex].TrkPts[I].lat+' '+
+ D.GPX[Listbox1.ItemIndex].Trks[Listbox2.ItemIndex].TrkPts[I].lon+' '+
+ D.GPX[Listbox1.ItemIndex].Trks[Listbox2.ItemIndex].TrkPts[I].time+' '+
+ D.GPX[Listbox1.ItemIndex].Trks[Listbox2.ItemIndex].TrkPts[I].ele);
+ Zeichne;
+end;
+
+procedure tForm1.zeichne;
+var
+ I,TI: Integer;
+ Xmi,Xma,
+ Ymi,Yma,
+ tx,ty: extended;
+begin
+ Image1.Free;
+ Image1:=TImage.Create(Form1);
+ Image1.Parent:=Form1;
+ Image1.Left:=344;
+ Image1.Top:=0;
+ Image1.Width:=Form1.ClientWidth-Image1.Left;
+ Image1.Height:=Form1.ClientHeight-Image1.Top;
+ Image1.Canvas.Rectangle(-10,-10,Image1.Width+10,Image1.Height+10);
+ if Listbox1.ItemIndex<0 then exit;
+ XMi:=0;
+ XMa:=0;
+ YMi:=0;
+ YMa:=0;
+ for TI:=0 to Listbox2.Items.Count-1 do
+ for I:=0 to length(D.GPX[Listbox1.Itemindex].Trks[TI].TrkPts)-1 do
+ with D.GPX[Listbox1.Itemindex].Trks[TI].TrkPts[I] do
+ begin
+ tx:=mystrtofloat(lon);
+ ty:=mystrtofloat(lat);
+ if ((TI=0) and (I=0)) or (tx<xMi) then xMi:=tx;
+ if ((TI=0) and (I=0)) or (tx>xMa) then xMa:=tx;
+ if ((TI=0) and (I=0)) or (ty<yMi) then yMi:=ty;
+ if ((TI=0) and (I=0)) or (ty>yMa) then yMa:=ty;
+ end;
+ xMa:=(Image1.Width-4)/max(1e-10,xMa-xMi);
+ yMi:=(Image1.Height-4)/max(1e-10,yMa-yMi);
+ for TI:=0 to Listbox2.Items.Count-1 do
+ begin
+ Image1.Canvas.Pen.Width:=1+2*Byte(TI=Listbox2.ItemIndex);
+ Image1.Canvas.Pen.Color:=gibFarbe(TI);
+ for I:=0 to length(D.GPX[Listbox1.Itemindex].Trks[TI].TrkPts)-1 do
+ with D.GPX[Listbox1.Itemindex].Trks[TI].TrkPts[I] do
+ begin
+ tx:=2+(mystrtofloat(lon)-xMi)*xMa;
+ ty:=2+(yMa-mystrtofloat(lat))*yMi;
+ if I=0 then Image1.Canvas.MoveTo(round(tx),round(ty))
+ else Image1.Canvas.LineTo(round(tx),round(ty));
+ end;
+ Image1.Canvas.Pen.Width:=1;
+ Image1.Canvas.Pen.Color:=$000000;
+ end;
+ if Listbox2.ItemIndex<0 then exit;
+ if Listbox3.ItemIndex<0 then exit;
+ with D.GPX[Listbox1.Itemindex].Trks[Listbox2.ItemIndex].TrkPts[Listbox3.ItemIndex] do
+ begin
+ tx:=2+(mystrtofloat(lon)-xMi)*xMa;
+ ty:=2+(yMa-mystrtofloat(lat))*yMi;
+ end;
+ Image1.Canvas.MoveTo(round(tx),round(ty)-4);
+ Image1.Canvas.LineTo(round(tx),round(ty)+5);
+ Image1.Canvas.MoveTo(round(tx)-4,round(ty));
+ Image1.Canvas.LineTo(round(tx)+5,round(ty));
+end;
+
+end.
+