' Programm for comunication with Garmin (etrex) GPS receiver ' (c) Markus Hoffmann 2002-2005 ' Version 1.03 1/2002 ' garmin Version 1.04 1/2003 Markus Hoffmann ' ' Version 1.05 4/2004 Markus Hoffmann ' Version 1.06 2/2005 Markus Hoffmann ' ' (There was a Problem with the serial-device implementation ' of X11Basic. Fixed in version 1.10-4) ' ' please use X11Basic Version 1.12 or newer ' ' DIM almanac$(35), waypoint$(32000),track$(20000),polygon$(20000) DIM sym$(256,2) DIM tracklist$(20),trackl1(20),trackl2(20) dim screenmsg$(256) version$="V.1.05" clr anzal,anztrackl,anzpvt,anzwp,anztrack,anzpoly @init if exist("waypoint.wpt") @do_loadwp("waypoint.wpt") endif if exist("base.map") @do_loadpoly("base.map") endif @redraw '########## Hauptprogramm ########## '########## begin ########## ' initials @init_device @showrange jjj: @sendmessage(10,CHR$(49)+CHR$(0)) ! PVT aktivieren MENUDEF menue$(),m DEFMOUSE 0 get 0,0,1,1,omary$ ' @sendmessage(10,mki$(3)) DO menu pause 0.001 MENU mouse mx,my,mk if mx>bx and my>by and mxl1 and marxl3 and mary0 IF UPPER$(LEFT$(z$))="Q" @ende else IF UPPER$(LEFT$(z$))="C" @paper else IF UPPER$(LEFT$(z$))="." @sonder else IF UPPER$(LEFT$(z$))="S" @saveal ELSE IF UPPER$(LEFT$(z$))="W" clr anzwp @sendmessage(10,CHR$(7)+CHR$(0)) ELSE IF UPPER$(LEFT$(z$))="P" @sendmessage(10,CHR$(2)+CHR$(0)) ELSE IF LEFT$(z$)=CHR$(27) @sendmessage(10,CHR$(0)+CHR$(0)) ELSE IF LEFT$(z$)=CHR$(8) or LEFT$(z$)=CHR$(127) @sendmessage(10,CHR$(8)+CHR$(0)) ELSE IF UPPER$(LEFT$(z$))="A" anzal=0 @sendmessage(10,CHR$(1)+CHR$(0)) ELSE IF UPPER$(LEFT$(z$))="N" @newwp ELSE IF UPPER$(LEFT$(z$))="R" @sendmessage(10,CHR$(4)+CHR$(0)) ELSE IF UPPER$(LEFT$(z$))="I" @sendmessage(254," ") ELSE IF UPPER$(LEFT$(z$))="K" print @qthlocator$(mary,-marx) ELSE IF UPPER$(LEFT$(z$))="D" @sendmessage(10,CHR$(5)+CHR$(0)) ELSE IF UPPER$(LEFT$(z$))="T" anztrack=0 @sendmessage(10,CHR$(6)+CHR$(0)) ELSE IF UPPER$(LEFT$(z$))="L" @loadwp ELSE @status(3,"unknown key: "+STR$(ASC(LEFT$(z$, 1)))) print "unknown key: "+STR$(ASC(LEFT$(z$, 1))) ENDIF @showrange ENDIF menu IF TIMER-totzeit>5 @sendmessage(10,mki$(5)) ! get time totzeit=TIMER ENDIF IF inp?(#1) @status(2,"READ") WHILE inp?(#1) AND LEN(INKEY$)=0 @procmessage(@getmessage$()) WEND @status(2,"OK") totzeit=TIMER @showrange ENDIF LOOP @ende ' Initialize Graphic settings and window size etc. PROCEDURE init LOCAL i,j,t$,d,a DIM menue$(128) dim dist(10000) ' clr trackopen sx=0 sy=0 sw=800 sh=512 sizew ,sw,sh defmouse 2 rot=get_color(65530,0,0) rosa=get_color(65535,32000,32000) orange=get_color(65530,32000,0) gelb=get_color(65530,65535,0) landgelb=get_color(65535,65535,32000) grau=get_color(65530/2,65530/2,65530/2) grau2=get_color(65530/4,65530/4,65530/4) hellgrau=get_color(65530/1.5,65530/1.5,65530/1.5) hell=get_color(65530/1.1,65530/1.1,65530/1.1) weiss=get_color(65530,65530,65530) schwarz=get_color(0,0,0) lila=get_color(65530,0,65530) blau=get_color(10000,10000,65530) wasserblau=get_color(32000,32000,65535) hellblau=get_color(10000,65535,65530) gruen=get_color(0,65535,0) wattgruen=get_color(32000,65535,32000) lila=get_color(65530,0,65530) normfont$="-*-fixed-bold-r-normal-*-16-*-iso8859-*" mediumfont$="-*-fixed-bold-r-normal-*-13-*-iso8859-*" smallfont$="-*-fixed-medium-r-normal-*-10-*-iso8859-*" tinyfont$="-*-fixed-medium-r-normal-*-8-*-iso8859-*" helveticatinyfont$="-*-helvetica-medium-r-normal-*-8-*-iso8859-*" helveticasmallfont$="-*-helvetica-medium-r-normal-*-10-*-iso8859-*" helveticamediumfont$="-*-helvetica-bold-r-normal-*-12-*-iso8859-*" helveticanormfont$="-*-helvetica-bold-r-normal-*-14-*-iso8859-*" setfont normfont$ bx=0 by=18 bw=640 bh=400 ' Defaults: devicename$="/dev/ttyS1" masstab=30/100 xmin=6 xmax=8 ymin=50 ymax=51 d=@distance(xmin,ymin,xmax,ymin)/bw xmax=xmin+(xmax-xmin)/d*masstab d=@distance(xmin,ymin,xmax,ymin)/bw a=@distance(xmin,ymin,xmin,ymax)/bh ymax=ymin+(ymax-ymin)*d/a arrayfill screenmsg$(),"UNKNOWN" restore screenmessages read a$ while a$<>"***" read b$ screenmsg$(val("0x"+a$))=b$ read a$ wend for j=0 to 1 for i=0 to 255 sym$(i,j)=inline$("D$&$$<$'D$B$$,$$D$'$$8$%T$($$$$$$$$$$$$$$$$$") ! Flag next i next j symname$()=["Anker","Glocke","Diamand","Diamand2",""] maenneken$=inline$("$$&$$@$'D$+$$b$+\$CD%b$+\$C$$`$'T$3$$`$'$$$$") ! Man sym$(0,0)=inline$("$$$$$,$'D$.$$T$%\$`$$4$%&&*<0c$C$$($$$$$$$$$") ! (G) Marina sym$(1,0)=inline$("$$$$$,$%\$CD%b$+\$CD%b$+`$c`3\$%T$2$$4$$$$$$") ! Glocke sym$(2,0)=inline$("$$$$$$$$$$'T'TD4%&$^;04G&%$4&&$(4$.$$4$$$$$$") ! Diamand1 sym$(3,0)=inline$("$$'$%W$<&&$88B52,LDFF%.4,LDFF252))(,,'$%<,)DD:b%`$$$$$$$$$") ! (G) residence sym$(11,0)=inline$("$$$$$)$58%I4+C$A\%U$*($<\%GD*2$<$$$$$$$$$$$$") ! (G) Restaurant sym$(12,0)=inline$("T$+$$6$',$04%M$*X$[,'VTL$$$$") ! Busybee sym$(18,0)=inline$("$$$$$$$$$$$$$$$$$$'$$@$%T$($$$$$$$$$$$$$$$$$") ! Point (Waypoint) sym$(19,0)=inline$("$$$$$$$$$%$$*($8D%,$(<$,4$7\+T$$$$$$$$$$$$$$") ! (G) Shipwreck sym$(20,0)=inline$("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$") ! leer sym$(21,0)=inline$("$$$$$$$$$$'D'Z$,L$DD&6$.,$WD'T$$$$$$$$$$$$$$") ! (G) man overboard sym$(23,0)=inline$("$$&$$D$%D$2$$H$(4$8D&>$/`%`$$$$$$$$$$$$$$$$$") ! Camp sym$(28,0)=inline$("$$$$$$$$b%`,(,D5F%+L)bD;F%*,(4D4b%`$$$$$$$$$") ! Help sym$(36,0)=inline$("$$$$$$$$$$$$$$$$$$'$$@$%T$($$$$$$$$$$$$$$$$$") ! Point sym$(37,0)=inline$("$$$$$$$$$$`%'`0c][cc]ccccccKC`0c$4`$'\$$$$$$") ! Fisch sym$(38,0)=inline$("$$$$$($%4$+T%YD1:$)T$B$'4$A$'9D1`$A$$8$%$$$$") ! Dollar sym$(150,0)=inline$("$$$$$%$$P$3T$2$'\$b,3WDBV$D,$TD0b%`$$$$$$$$$") ! (G) Bootsrampe sym$(151,0)=inline$("$$$$$$$$D$,$$<$'D$3$%b$2<$UT+3Dc$$$$$$$$$$$$") ! (G) Zelt/Camping sym$(152,0)=inline$("$$$$$'$00$T$$3TBQ&ZX'/4B0'`T''$0$$$$$$$$$$$$") ! (G) Restroom sym$(153,0)=inline$("$$$$$$$'D$@$$$$$($04&V$4T%c$'\$+D$@$$$$$$$$$") ! (G) Shower sym$(154,0)=inline$("$$$$$,$'$$+$+b$C<$$,$CD%&$(,$=$$`$$$$$$$$$$$") ! (G) Drinking Water sym$(155,0)=inline$("$$$$$$$$b%`@2)T^T$1D%O$1R%Y\+SDC$$$$$$$$$$$$") ! (G) Telephone sym$(156,0)=inline$("$$$$$3DC&%&,(,(\D5&%&,(4D4b%`$$$$$$$$$") ! (G) Information (?) sym$(158,0)=inline$("$$$$$3Dc&&',,\DHF&6,,\DDF&',,4DDb'`$$$$$$$$$") ! (G) Parking Area sym$(159,0)=inline$("$$$$$$$%D$-$%&$,4$4D&%$4,$F4([Da$$($$$$$$$$$") ! (G) Park sym$(160,0)=inline$("$$$$$$$$`%b$$L$&:'7T+X$(,$DD&$$$$$$$$$$$$$$$") ! (G) Picnic area sym$(161,0)=inline$("$$$$$$$$G$B$%3Tcc'U`2[T_c'W`3T$$$$$$$$$$$$$$") ! (G) scenic area sym$(162,0)=inline$("$$$$$'$$0$$$$3$',$%D$($$T$&$(3D3$$$$$$$$$$$$") ! (G) Skiing Area sym$(163,0)=inline$("$$$$$$$$D$'D*5$?T$3D%U$5N&M$%$$$$$$$$$$$$$$$") ! (G) Swimming Area sym$(164,0)=inline$("$$$$$$$$N$+8$<$%N$+8$<$%N%;8.T$$$$$$$$$$$$$$") ! (G) Dam sym$(166,0)=inline$("T$+$$6$',$04%M$*X$[,'$'<$/X$1T%]$+H$Z4'A$$QL&ZD3cccccK]UD<*%D$$$$$$$$$") ! Train sym$(190,0)=inline$("\$@4&$D4%&$&43JV5A9)Q9J98=91HD-$%&$,(%$,\$@$") ! STOP sym$(191,0)=inline$("$$$$$3$3*%E<*P$'<$>T'?$1@$_T'T$$$$$$$$$$$$$$") ! Telefon ' Einer Reihe sym$(4,1)=inline$("$$$$$$$$$$4$'H$B\%_T+3$0@$UD$*$$$$$$$$$$$$$$") ! (G) Trackback Point sym$(5,1)=inline$("$$$$$$$%$$0$%T$'$$($$@$+0%H,,7$$.,$H4%)$)L$,$$$$$$$$$") ! (G) ghost town sym$(48,1)=inline$("$$$$$$$$L$=4%T$*L$]4'T$2L%]4+T$$$$$$$$$$$$$$") ! (G) Levee sym$(49,1)=inline$("$$$$$$$$$$&$%cTCT$a4)?%N8%8$$$$$$$$$$$$$$$$$") ! (G) military sym$(50,1)=inline$("$$$$$$$%T$B$$L$'D$-$%@$*T$$.<$T$$$$$$$$$") ! (G) oil field sym$(51,1)=inline$("$$$$$$$$D$3D'b$3`%aT+7$<(%($$$$%$$$$$$$$$$$$") ! (G) Tunnel sym$(52,1)=inline$("$$$$$1D$=$*4$,D$,$$D'E$C(%`,$3Tc$$$$$$$$$$$$") ! (G) Beach sym$(53,1)=inline$("$$$$$2$$($\,(1DY,&N4)G$)<$2$%,$(D$$$$$$$$$$$") ! (G) Forest sym$(54,1)=inline$("$$$$$$$$$$&$$($)4$ND)I$-$$$$$$$$$$$$$$$$$$$$") ! (G) Summit ' Zweier Reihe (Flug Symbole) sym$(0,2)=inline$("$$$$$$$$$$($$4$%D$3D'c$C$$($$<$'$$$$$$$$$$$$") ! (G) Flugzeug/Airport sym$(4,2)=inline$("$$$$$$$$T$@D&-$6H%.4(]$6H%,D&0$+$$$$$$$$$$$$") ! (G) heliportsym$(4,2)=inline$("$$$$$$$$T$@D&-$6H%.4(]$6H%,D&0$+$$$$$$$$$$$$") ! (G) heliport sym$(5,2)=inline$("$$$$$$$$T$@D&-$5H%.4(=$6H%,D&0$+$$$$$$$$$$$$") ! (G) private Field sym$(6,2)=inline$("$$$$$$$$T$@D&%$4(%$4(%$4(%$D&0$+$$$$$$$$$$$$") ! (G) Soft field sym$(7,2)=inline$("$$$$$$$%$$($$4$%$$($$<$'D$3$%J$00%H$$$$$$$$$") ! (G) tall tower sym$(8,2)=inline$("$$$$$$$$$$$$$$$%D$3$%J$00%H$$$$$$$$$$$$$$$$$") ! (G) short tower sym$(9,2)=inline$("$$$$$%$$*$$@,'$T<%G$',$+D$3$%[$0+%D$$$$$$$$$") ! (G) glider area sym$(10,2)=inline$("$$$$$$$T$'T$3cTCc$C\$@$'T$A$$T$&$$$$$$$$$$$$") ! (G) ultralight area sym$(11,2)=inline$("$$$$$,$'<$T4($DDb'b4(N$.4$:$$\$&D$0$$$$$$$$$") ! (G) parachute area sym$(18,2)=inline$("$$$$$,$'D$.$$T$%\$`$$4$%&&*<0c$C$$($$$$$$$$$") ! (G) Seaplane base color grau pbox sx,sy,sw,sh COLOR blau text 4*8,28*16,"ACTION:" text 4*8,29*16,"STATUS:" text 4*8,30*16,"RESULT:" RESTORE menudata FOR i=0 TO 127 read t$ menue$(i)=t$ EXIT IF menue$(i)="***" NEXT i menue$(i)="" menue$(i+1)="" @loadsettings(env$("HOME")+"/.garminrc") @legende @hscalerbar(sx+670,sy+170,100) RETURN procedure init_device OPEN "UX:9600,N,8,1",#1,devicename$ @garmincancel while inp?(#1) ~inp(#1) wend ' Garmin identifizieren @sendmessage(254," ") @procmessage(@getmessage$()) @procmessage(@getmessage$()) return procedure laengentreu local a,d defmouse 2 vsync d=@distance(xmin,ymin,xmax,ymin)/bw a=@distance(xmin,ymin,xmin,ymax)/bh print d,a ymax=ymin+(ymax-ymin)*d/a @sort_wp @redraw defmouse 0 return procedure loadsettings(f$) local t$,a$,b$ if exist(f$) open "I",#9,f$ while not eof(#9) lineinput #9,t$ t$=trim$(t$) if left$(t$)<>"#" wort_sep t$,"=",1,a$,b$ if upper$(a$)="DEVICE" devicename$=b$ else if upper$(a$)="XRANGE" b$=left$(b$,len(b$)-1) b$=right$(b$,len(b$)-1) wort_sep b$,":",1,a$,b$ xmin=val(a$) xmax=val(b$) else if upper$(a$)="YRANGE" b$=left$(b$,len(b$)-1) b$=right$(b$,len(b$)-1) wort_sep b$,":",1,a$,b$ ymin=val(a$) ymax=val(b$) endif endif wend close #9 endif return procedure savesettings open "O",#9,env$("HOME")+"/.garminrc" print #9,"# Settings for garmin.bas (c) Markus Hoffmann" print #9,"# "+date$+" "+time$ print #9,"DEVICE=";devicename$ print #9,"XRANGE=[";xmin;":";xmax;"]" print #9,"YRANGE=[";ymin;":";ymax;"]" close #9 return PROCEDURE m(k) print "MENU: #";k on k gosub info on k-10 gosub newall,n,loadtrack,loadwp,13,loadpoly,loadal,n,TWPinfo,n,exporttrack,exportwp,exportmap,importtrack,importwp,importmap,n,savetrack,savewp,savemap,saveal,saveescreen,n,preferences,savesettings,20,ende on k-39 gosub newwp,placewp,editwp,deletewp,deleteallwp,n,drawtrack,optimizetrack,tracktopoly,deletetrack,deletealltrack,n,editpoly,deletepoly,deletemap on k-55 gosub 23,getal,getwp,gettrack,getroute,28,garminpos,garmintime,getscreen,33,sendal,sendwp,sendtrack,n,garmincancel on k-73 gosub garminpvton,garminpvtoff,lichtan,lichtaus,asyncan,asyncaus,n,garminoff on k-83 gosub laengentreu,savegrafik,savefig,41,hoehenprofil,sonder,gotowp,gotopoly RETURN PROCEDURE info ~form_alert(1,"[0][**** GARMIN.BAS *****(X11-Basic)****|Frontend for a GARMIN GPS receiver.|Connected is a:||"+garminmes$+"|Product-ID="+str$(garminpid)+", Version="+str$(garminver)+"||(c) Markus Hoffmann 2002-2005][ OK ]") RETURN procedure newall clr anzwp,anztrack,anzal,anztrackl close run return ' Commands: ' 10 0 Cancel ' 10 1 Get Almanac ' 10 2 Get Position ' 10 3 Get Proximity Wpt (*)not supported ' 10 4 Get Route ' 10 5 Get Time ' 10 6 Get Tracks ' 10 7 Get Waypoints ' 10 8 Swich off ' 11 11 et Tone=MSG+KEY then power off. (*)not supported ' 10 32 Get Screendump ' 10 49 PVT on ' 10 50 PVT off procedure getroute @sendmessage(10,CHR$(4)+CHR$(0)) return procedure getal clr anzal @sendmessage(10,CHR$(1)+CHR$(0)) return procedure getwp clr anzwp @sendmessage(10,CHR$(7)+CHR$(0)) return procedure gettrack clr anztrack @sendmessage(10,CHR$(6)+CHR$(0)) return procedure getscreen clr anzscanlines @sendmessage(10,MKI$(32)) return procedure garmincancel @sendmessage(10,mki$(0)) return procedure garminoff @sendmessage(10,CHR$(8)+CHR$(0)) return procedure garminpos @sendmessage(10,CHR$(2)+CHR$(0)) return procedure garmintime @sendmessage(10,CHR$(5)+CHR$(0)) return procedure garminpvton ' PVT aktivieren @sendmessage(10,CHR$(49)+CHR$(0)) return procedure garminpvtoff ' PVT deaktivieren @sendmessage(10,CHR$(50)+CHR$(0)) return PROCEDURE ende ' Quit the program, close all open files remove all installations CLOSE quit RETURN procedure TWPinfo local t$ defmouse 2 vsync @calc_trackinfo t$=str$(anzwp)+" waypoints and "+str$(anztrack)+" trackpoints." if track_len>2000 t$=t$+"||Length: "+str$(int(track_len/100)/10)+" km" else t$=t$+"||Length: "+str$(int(track_len))+" m" endif t$=t$+"|Zeitspanne: "+@jdate$(track_adate)+" - "+@jdate$(track_bdate) t$=t$+"|Weg-Zeit: "+str$(int(track_zeit/3600),2,2,1)+":"+str$(int((track_zeit mod 3600)/60),2,2,1)+":"+str$(int(track_zeit mod 60),2,2,1) t$=t$+"|Max. Geschw.: "+str$(int(max_v*10)/10)+" km/h" if track_zeit t$=t$+"|mittl. Geschw.: "+str$(int(track_len/track_zeit*3.6*10)/10)+" km/h" endif t$=t$+"|Höhen: "+str$(int(track_altmin))+" m - "+str$(int(track_altmax))+" m" defmouse 0 ~form_alert(1,"[0]["+t$+"][ OK ]") return function jdate$(n) local t$,tagzeit tagzeit=n mod (24*3600) t$=@days2date$(int(n/(24*3600))) t$=t$+" "+str$(int(tagzeit/3600),2,2,1)+":"+str$(int((tagzeit mod 3600)/60),2,2,1)+":"+str$(int(tagzeit mod 60),2,2,1) return t$ endfunc function days2date$(days) ! 2447892 Julian date for 00:00 12/31/89 return juldate$(2447892+days) endfunction FUNCTION getmessage$() t=TIMER s$="" flag=0 flag2=0 DO IF inp?(#1) t$=chr$(inp(#1)) ' PRINT "Got:";ASC(t$) IF t$=CHR$(16) IF flag2=0 flag2=1 ELSE IF flag=0 flag=1 ELSE s$=s$+t$ flag=0 ENDIF ENDIF ELSE IF flag2=0 PRINT t$; flush @status(1,"ERROR/SKIP") ELSE IF flag=1 AND t$=CHR$(3) GOTO t ELSE IF flag=1 @status(1,"ERROR 16") flag=0 ENDIF s$=s$+t$ ENDIF ENDIF else pause 0.01 endif IF TIMER-t>2 @status(1,"TIMEOUT") s$="" GOTO t ENDIF LOOP t: pid=ASC(MID$(s$,1,1)) chk=ASC(MID$(s$,LEN(s$),1)) and 255 chk2=0 FOR i=1 TO LEN(s$)-1 chk2=chk2-ASC(MID$(s$,i,1)) NEXT i chk2=chk2 AND 255 IF chk=chk2 AND pid<>6 AND pid<>21 @sendACK(pid) ELSE IF chk<>chk2 @status(1,"CHK-SUM ERROR") ENDIF return s$ ENDFUNCTION function kx(dux) return bx+(dux-xmin)/(xmax-xmin)*bw endfunc function ky(duy) return by+bh-(duy-ymin)/(ymax-ymin)*bh endfunc FUNCTION ox(dux) return (dux-bx)*(xmax-xmin)/bw+xmin ENDFUNCTION FUNCTION oy(duy) return -(duy-by-bh)*(ymax-ymin)/bh+ymin ENDFUNCTION PROCEDURE loadwp local dlen,f$ fileselect "load waypoints ...","./*.wpt","waypoint.wpt",f$ if len(f$) if exist(f$) if anzwp if form_alert(1,"[2][Daten an bestehende Daten anfügen|oder ersetzen ?][anfügen|ersetzen]")=2 clr anzwp endif endif defmouse 2 @do_loadwp(f$) @status(3,STR$(anzwp)+"WP geladen") @redraw @showrange defmouse 0 else ~form_alert(1,"[3][File "+f$+"|not found !][ OH ]") endif endif RETURN procedure placewp local k,x,y,alt,ox,oy,depth,symbl,name$,comment$,subclass$,cc$,state$ defmouse 3 vsync color schwarz pause 0.3 while k=0 mouseevent ox,oy,k wend circle ox,oy,2 vsync depth=1e25 alt=1e25 symbl=16 ! Pin comment$="WP placed by GPS-Earth" name$="new "+str$(anzwp) subclass$=mki$(0)+mkl$(0)+mkl$(-1)+mkl$(-1)+mkl$(-1) cc$=" " state$=" " x=@ox(ox)/180*2^31 y=@oy(oy)/180*2^31 print x,y waypoint$(anzwp)=chr$(0)+chr$(255)+chr$(0)+chr$(0x60)+mki$(symbl)+subclass$+mkl$(y)+mkl$(x)+mkf$(alt)+mkf$(depth)+mkf$(dist)+state$+cc$+name$+chr$(0)+comment$+mkl$(0)+chr$(0) inc anzwp @sort_wp @redraw @showrange defmouse 0 return procedure exportwp local ers,f$,i,t$,x,y,alt,n$,b$,depth,name$,comment$,facility$,city$,addr$,crossr$ ers=2 if anzwp fileselect "export waypoints ...","./*.lst","waypoint.lst",f$ if len(f$) if exist(f$) ers=form_alert(3,"[1][File already exists! |append or replace ?][append|replace|CANCEL]")=2 endif if ers<3 defmouse 2 vsync if ers=1 open "A",#2,f$ else open "O",#2,f$ endif print #2,"# Waypoints from garmin.bas (c) Markus Hoffmann" print #2,"# ";anzwp;" waypoints. "+date$+" "+time$ print #2,"# Format=0 " for i=0 to anzwp-1 t$=" "+waypoint$(i) name$=mid$(t$,51,len(t$)-51) name$=replace$(name$,chr$(0),"|")+"|" wort_sep name$,"|",0,name$,comment$ wort_sep comment$,"|",0,comment$,facility$ wort_sep facility$,"|",0,facility$,city$ wort_sep city$,"|",0,city$,addr$ wort_sep addr$,"|",0,addr$,crossr$ if crossr$="|" crossr$="" endif y=180/2^31*CVL(MID$(t$,27,4)) x=180/2^31*CVL(MID$(t$,31,4)) alt=cvf(mid$(t$,35,4)) depth=cvf(mid$(t$,39,4)) dist=cvf(mid$(t$,43,4)) color=asc(mid$(t$,4,1)) attr=asc(mid$(t$,6,1)) class=asc(mid$(t$,3,1)) state$=mid$(t$,47,2) cc$=mid$(t$,49,2) displ=asc(mid$(t$,5,1)) subclass$=hex$(cvi(mid$(t$,9,2)),4,4,1)+hex$(cvl(mid$(t$,11,4)),8,8,1)+hex$(cvl(mid$(t$,15,4)),8,8,1)+hex$(cvl(mid$(t$,19,4)),8,8,1)+hex$(cvl(mid$(t$,23,4)),8,8,1) print #2," Name=";chr$(34);name$;chr$(34);space$(max(6,len(n$))-len(n$)); print #2," Symbl=0x";hex$(CVI(mid$(t$,7,2)),4,4,1); print #2," X=";x;" Y=";y; if alt<9e24 print #2," alt=";alt; endif if depth<9e24 print #2," depth=";depth; endif if dist<9e24 print #2," dist=";dist; endif if class print #2," Class=";class; endif if upper$(subclass$)<>"000000000000FFFFFFFFFFFFFFFFFFFFFFFF" print #2," Subclass=";subclass$; endif if color<>-1 print #2," Color=";color; endif if displ print #2," displ=";displ; endif if attr<>6*16 print #2," attr=";attr; endif if state$<>" " print #2," State=";chr$(34);state$;chr$(34); endif if cc$<>" " print #2," Cc=";chr$(34);cc$;chr$(34); endif if len(comment$) print #2," Comment=";chr$(34);comment$;chr$(34); endif if len(facility$) print #2," Facility=";chr$(34);facility$;chr$(34); endif if len(city$) print #2," City=";chr$(34);city$;chr$(34); endif if len(addr$) print #2," Addr=";chr$(34);addr$;chr$(34); endif if len(crossr$) print #2," Crossr=";chr$(34);crossr$;chr$(34); endif print #2 next i close #2 defmouse 0 vsync endif endif else ~form_alert(1,"[3][Keine Wegpunkte vorhanden!][ OH ]") endif return function inpoly(t$,x,y) local l1,l2,l3,l4,anz,i,j,xpi,xpj,ypi,ypj,c c=0 ' l1=cvf(mid$(t$,7,4)) ' l2=cvf(mid$(t$,11,4)) ' l3=cvf(mid$(t$,15,4)) ' l4=cvf(mid$(t$,19,4)) anz=cvi(mid$(t$,23,2)) i=0 j=anz-1 while i2 cc$=" " endif if len(state$)<>2 state$=" " endif if len(subclass$)<>18 print "Formatfehler !" else waypoint$(anzwp)=chr$(class)+chr$(color)+chr$(displ)+chr$(attr)+mki$(symbl)+subclass$+mkl$(y)+mkl$(x)+mkf$(alt)+mkf$(depth)+mkf$(dist)+state$+cc$+name$+chr$(0)+comment$+chr$(0)+facility$+chr$(0)+city$+chr$(0)+addr$+chr$(0)+crossr$+chr$(0) inc anzwp endif endif wend close #2 @status(3,STR$(anzwp)+" WP loaded") @sort_wp @redraw @showrange defmouse 0 endif endif return procedure importmap local i,g$,f$,t$,p$,a$,b$,x,y,alt,anz,name$,l1,l2,l3,l4,typ,flags dim px(100000),py(100000) fileselect "import Map elements ...","./*.lst","map.lst",f$ if len(f$) if exist(f$) if anzpoly if form_alert(1,"[2][Daten an bestehende Daten anfügen|oder ersetzen ?][anfügen|ersetzen]")=2 clr anzpoly endif endif defmouse 2 vsync OPEN "I",#2,f$ g$=input$(#2,lof(#2)) while len(g$) wort_sep g$,chr$(10),0,t$,g$ print anzpoly ' t$=@longlineinput$(2) t$=trim$(t$) if left$(t$)="#" ' nixtun else l1=360 l2=-360 l3=360 l4=-360 anz=0 typ=0 flags=0 name$="noname" alt=1e25 while len(t$) wort_sep t$," ",1,a$,t$ wort_sep a$,"=",1,a$,b$ a$=upper$(a$) if a$="ALT" alt=val(b$) else if a$="TYP" typ=val(b$) else if a$="FLAGS" flags=val(b$) else if a$="NAME" name$=right$(left$(b$,len(b$)-1),len(b$)-2) else if left$(a$,4)="DATA" while len(b$) wort_sep b$,";",0,a$,b$ wort_sep a$,",",0,p$,a$ x=val(p$) y=val(a$) px(anz)=x py(anz)=y l1=min(x,l1) l2=max(x,l2) l3=min(y,l3) l4=max(y,l4) inc anz wend else print a$,b$ endif wend p$=chr$(typ)+chr$(flags)+mkf$(alt)+mkf$(l1)+mkf$(l2)+mkf$(l3)+mkf$(l4)+mki$(anz) for i=0 to anz-1 p$=p$+mkf$(px(i))+mkf$(py(i)) next i p$=p$+name$+chr$(0) polygon$(anzpoly)=p$ inc anzpoly endif wend close #2 @status(3,STR$(anzpoly)+" MAP elements loaded") @redraw @showrange defmouse 0 endif endif return function longlineinput$(channel) local a,t$ a=inp(channel) while a<>10 t$=t$+chr$(A) a=inp(channel) wend return t$ endfunction procedure do_loadwp(f$) local dlen OPEN "I",#2,f$ WHILE inp?(#2) dlen=inp(#2) and 255 waypoint$(anzwp)=INPUT$(#2,dlen) inc anzwp WEND CLOSE #2 @sort_wp return PROCEDURE loadpoly local dlen,f$ fileselect "load map ...","./*.map","base.map",f$ if len(f$) if exist(f$) if anzpoly if form_alert(1,"[2][Daten an bestehende Daten anfügen|oder ersetzen ?][anfügen|ersetzen]")=2 clr anzpoly endif endif defmouse 2 @do_loadpoly(f$) @status(3,STR$(anzpoly)+" MAP elements loaded.") @redraw @showrange defmouse 0 else ~form_alert(1,"[3][File "+f$+"|not found !][ OH ]") endif endif RETURN procedure do_loadpoly(f$) local dlen OPEN "I",#2,f$ WHILE inp?(#2) dlen=cvi(input$(#2,2)) and 0xffff polygon$(anzpoly)=INPUT$(#2,dlen) inc anzpoly WEND CLOSE #2 return procedure sort_wp local xx,yy,x,y,t$,c1,c2 dim dist(anzwp) dim index(anzwp) xx=(xmax+xmin)/2 yy=(ymax+ymin)/2 c2=1e11 c1=@distance(xx,yy,xmax,ymax) print "calculate distances ..." for i=0 to anzwp-1 t$=" "+waypoint$(i) y=180/2^31*CVL(MID$(t$,27,4)) x=180/2^31*CVL(MID$(t$,31,4)) dist(i)=@distance(xx,yy,x,y) index(i)=i next i sort dist(),anzwp,index() PRINT "SWAPPING:" w$()=waypoint$() FOR i=0 TO anzwp-1 j=index(i) waypoint$(i)=w$(j) ' print dist(i),c1 if dist(i)>c1 c2=min(c2,i) endif NEXT i print "cutoff:",c2 waypoint_cutoff=c2 return procedure calc_cutoff local xx,yy,c1,c2 xx=(xmax+xmin)/2 yy=(ymax+ymin)/2 c2=1e11 c1=@distance(xx,yy,xmax,ymax) FOR i=0 TO anzwp-1 if dist(i)>c1 c2=i exit if true endif NEXT i print "cutoff:",c2 waypoint_cutoff=c2 return PROCEDURE loadtrack local dlen,f$ fileselect "load track ...","./*.track","my.track",f$ if len(f$) if exist(f$) if anztrack if form_alert(1,"[2][Daten an bestehende Daten anfügen|oder ersetzen ?][anfügen|ersetzen]")=2 clr anztrack,anztrackl endif endif defmouse 2 vsync OPEN "I",#2,f$ trackl1(anztrackl)=anztrack WHILE inp?(#2) and anztrack<20000 dlen=inp(#2) and 255 track$(anztrack)=INPUT$(#2,dlen) inc anztrack WEND CLOSE #2 trackname$=f$ wort_sep trackname$,".track",1,trackname$,f$ if rinstr(trackname$,"/") trackname$=right$(trackname$,len(trackname$)-rinstr(trackname$,"/")) endif tracklist$(anztrackl)=trackname$ trackl2(anztrackl)=anztrack-1 inc anztrackl @status(3,STR$(anztrack)+" TR geladen") @redraw @showrange else ~form_alert(1,"[3][File "+f$+"|not found !][ OH ]") endif endif RETURN procedure exporttrack local ers,x,y,t$ ers=2 if anztrack fileselect "export track ...","./*.lst","track.lst",f$ if len(f$) if exist(f$) ers=form_alert(3,"[1][Datei existiert bereits! |anfuegen oder ersetzen ?][anfügen|ersetzen|CANCEL]")=2 endif if ers<3 defmouse 2 vsync if ers=1 open "A",#2,f$ else open "O",#2,f$ endif print #2,"# Track von garmin.bas (c) Markus Hoffmann" print #2,"# Gesamt: ";anztrack;" Punkte. "+date$+" "+time$ if anztrackl print #2,"# Tracks:" for i=0 to anztrackl-1 print #2,"# "+tracklist$(i)+": ";trackl1(i);" bis ";trackl2(i) next i endif print #2,"# Format=0 " for i=0 to anztrack-1 t$=track$(i) y=180/2^31*CVL(MID$(t$,1,4)) x=180/2^31*CVL(MID$(t$,5,4)) date=CVL(MID$(t$,9,4)) alt=CVf(MID$(t$,13,4)) depth=CVf(MID$(t$,17,4)) new=asc(MID$(t$,21,1)) dist=@distance(ox,oy,x,y)*1000 if new print #2," **"; clr vv,vh,vx,vy,vz else dt=date-odate dx=@distance(ox,y,x,y)*1000 dy=@distance(x,oy,x,y)*1000 if dt vz=int((alt-oalt)/dt*100)/100 vx=int(dx/dt*100)/100 vy=int(dy/dt*100)/100 vh=dist/dt*3.6 vv=(alt-oalt)/dt*3.6 else clr vx,vy,vz,vh,vv endif print #2," +"; endif odate=date ox=x oy=y oalt=alt print #2," X=";x;" Y=";y; if alt<9e24 print #2," alt=";alt; endif if date<>-1 print #2," date=";date; endif if depth<9e24 print #2," depth=";depth; endif if i>0 print #2," dist=";int(1000*dist)/1000;" m"; if new=0 and dt print #2," V*=(";vx;",";vy;",";vz;") m/s v=";int(10*sqrt(vh*vh+vv*vv))/10;" km/h"; endif endif print #2 next i close #2 defmouse 0 vsync endif endif else ~form_alert(1,"[3][Keine Trackpunkte vorhanden!][ OH ]") endif return procedure importtrack local f$,t$,oanztrack,a$,b$,x,y,alt,depth fileselect "import track ...","./*.lst","my.lst",f$ if len(f$) if exist(f$) if anztrack if form_alert(1,"[2][Daten an bestehende Daten anfügen|oder ersetzen ?][anfügen|ersetzen]")=2 clr anztrack endif endif defmouse 2 vsync trackl1(anztrackl)=anztrack oanztrack=anztrack OPEN "I",#2,f$ while not eof(#2) lineinput #2,t$ t$=trim$(t$) if left$(t$)="#" ' nixtun else wort_sep t$," ",1,a$,t$ if a$="**" new=1 else if a$="+" new=0 else print "Formatfehler !" new=1 endif date=-1 alt=1e25 depth=1e25 while len(t$) wort_sep t$," ",1,a$,t$ wort_sep a$,"=",1,a$,b$ a$=upper$(a$) if a$="X" x=int(val(b$)/180*2^31) else if a$="Y" y=int(val(b$)/180*2^31) else if a$="ALT" alt=val(b$) else if a$="DATE" date=val(b$) else if a$="DEPTH" depth=val(b$) else print a$,b$ endif wend track$(anztrack)=mkl$(y)+mkl$(x)+mkl$(date)+mkf$(alt)+mkf$(depth)+chr$(new) inc anztrack endif wend close #2 trackname$=f$ wort_sep trackname$,".lst",1,trackname$,f$ if rinstr(trackname$,"/") trackname$=right$(trackname$,len(trackname$)-rinstr(trackname$,"/")) endif tracklist$(anztrackl)=trackname$ trackl2(anztrackl)=anztrack-1 inc anztrackl @status(3,STR$(anztrack)+" TR loaded") @redraw @showrange defmouse 0 endif endif return procedure drawtrack local oanztrack,x,y,alt,ox,oy,depth,new mindist=10 new=1 if anztrack if form_alert(1,"[2][Daten an bestehende Daten anfügen|oder ersetzen ?][anfügen|ersetzen]")=2 clr anztrack endif endif trackl1(anztrackl)=anztrack oanztrack=anztrack defmouse 3 vsync color schwarz mouseevent ox,oy,k graphmode 3 if k<>4*256 repeat motionevent x,y,a,b,k line ox,oy,x,y vsync line ox,oy,x,y if k=2*256 ox=x oy=y new=1 else if k=1*256 if @distance(@ox(ox),@oy(oy),@ox(x),@oy(y))*1000>mindist line ox,oy,x,y track$(anztrack)=mkl$(@oy(y)/180*2^31)+mkl$(@ox(x)/180*2^31)+mkl$(date)+mkf$(alt)+mkf$(depth)+chr$(new) inc anztrack circle x,y,2 new=0 ox=x oy=y endif endif until k=4*256 graphmode 1 endif tracklist$(anztrackl)="Drawn Track" trackl2(anztrackl)=anztrack-1 inc anztrackl @redraw @showrange defmouse 0 return procedure calc_trackinfo local i,t$,x,y,date,alt,new,dist,odate,ox,oy,new,dt,oalt clr max_v,track_len,track_zeit,track_bdate,track_altmax track_altmin=1e24 track_adate=1e24 for i=0 to anztrack-1 t$=track$(i) y=180/2^31*CVL(MID$(t$,1,4)) x=180/2^31*CVL(MID$(t$,5,4)) date=CVL(MID$(t$,9,4)) track_adate=min(date,track_adate) track_bdate=max(date,track_bdate) alt=CVf(MID$(t$,13,4)) track_altmin=min(alt,track_altmin) track_altmax=max(alt,track_altmax) new=asc(MID$(t$,21,1)) dist=@distance(ox,oy,x,y)*1000 if new clr vv,vh,vx,vy,vz else dt=date-odate dist=@distance(ox,oy,x,y)*1000 dx=@distance(ox,y,x,y)*1000 dy=@distance(x,oy,x,y)*1000 if dt vz=int((alt-oalt)/dt*100)/100 vx=int(dx/dt*100)/100 vy=int(dy/dt*100)/100 vh=dist/dt*3.6 vv=(alt-oalt)/dt*3.6 max_v=max(max_v,sqrt(vh*vh+vv*vv)) else clr vx,vy,vz,vh,vv endif add track_len,dist add track_zeit,dt endif odate=date ox=x oy=y oalt=alt next i return PROCEDURE sendtrack local dlen,f$,t$,i,bg$,tn$ tn$="X11-BASIC" if anztrack i=form_alert(1,"[2][Welchen Namen verwenden ?]["+tn$+"|"+trackname$+"|ACTIVE LOG]") if i=1 tn$=tn$ else if i=2 tn$=trackname$ else if i=3 tn$="ACTIVE LOG" endif if form_alert(1,"[2][Den aktuellen Track, |"+str$(anztrack)+" Punkte|jetzt als "+tn$+" zum GPS senden? ][Ja|Nein]")=1 defmouse 2 get sx+(sw-100)/2,sy+(sh-50)/2,sx+(sw+100)/2,sy+(sh+50)/2,bg$ color weiss pbox sx+(sw-100)/2,sy+(sh-50)/2,sx+(sw+100)/2,sy+(sh+50)/2 color schwarz box sx+(sw-100)/2,sy+(sh-50)/2,sx+(sw+100)/2,sy+(sh+50)/2 @sendmessage(27,mki$(anztrack)) @do_hscaler(sx+670,sy+170,100,0) @sendmessage(99,CHR$(1)+CHR$(255)+tn$+chr$(0)) for i=0 to anztrack-1 color weiss pbox sx+(sw-100)/2,sy+(sh-50)/2,sx+(sw+100)/2,sy+(sh+50)/2 color schwarz box sx+(sw-100)/2,sy+(sh-50)/2,sx+(sw+100)/2,sy+(sh+50)/2 TEXT sx+(sw-100)/2+10,sy+sh/2-10,"sende ..." TEXT sx+(sw-100)/2+10,sy+sh/2+10,"# "+str$(i,5,5) vsync @sendmessage(34,track$(i)) @do_hscaler(sx+670,sy+170,100,i/anztrack) next i @do_hscaler(sx+670,sy+170,100,1) @sendmessage(12,mki$(6)) put sx+(sw-100)/2,sy+(sh-50)/2,bg$ defmouse 0 endif else ~form_alert(1,"[3][Es ist kein Track geladen !][ OH ]") endif RETURN PROCEDURE sendwp local dlen,f$,t$,i,bg$ if anzwp if form_alert(1,"[2][Aktuelle Wegpunkte, |"+str$(anzwp)+" Punkte|jetzt zum GPS senden? ][Ja|Nein]")=1 defmouse 2 get sx+(sw-100)/2,sy+(sh-50)/2,sx+(sw+100)/2,sy+(sh+50)/2,bg$ color weiss pbox sx+(sw-100)/2,sy+(sh-50)/2,sx+(sw+100)/2,sy+(sh+50)/2 color schwarz box sx+(sw-100)/2,sy+(sh-50)/2,sx+(sw+100)/2,sy+(sh+50)/2 @sendmessage(27,mki$(anzwp)) @do_hscaler(sx+670,sy+170,100,0) for i=0 to anzwp-1 color weiss pbox sx+(sw-100)/2,sy+(sh-50)/2,sx+(sw+100)/2,sy+(sh+50)/2 color schwarz box sx+(sw-100)/2,sy+(sh-50)/2,sx+(sw+100)/2,sy+(sh+50)/2 TEXT sx+(sw-100)/2+10,sy+sh/2-10,"sende ..." TEXT sx+(sw-100)/2+10,sy+sh/2+10,"# "+str$(i,5,5) vsync @sendmessage(35,waypoint$(i)) @do_hscaler(sx+670,sy+170,100,i/anzwp) next i @do_hscaler(sx+670,sy+170,100,1) @sendmessage(12,mki$(7)) put sx+(sw-100)/2,sy+(sh-50)/2,bg$ defmouse 0 endif else ~form_alert(1,"[3][Es sind keine WP geladen !][ OH ]") endif RETURN PROCEDURE loadal local dlen,f$ fileselect "load almanach ...","./*.dat","almanach.dat",f$ if len(f$) if exist(f$) clr anzal defmouse 2 OPEN "I",#2,f$ WHILE inp?(#2) dlen=inp(#2) and 255 almanac$(anzal)=INPUT$(#2,dlen) inc anzal WEND CLOSE #2 @status(3,STR$(anzal)+" AL geladen") @showrange defmouse 0 else ~form_alert(1,"[3][Datei "+f$+"|existiert nicht !][ OH ]") endif endif RETURN PROCEDURE sendal local dlen,f$,t$,i,bg$ if anzal if form_alert(1,"[2][Aktueller Almanac, |"+str$(anzal)+" Satelitendaten|jetzt zum GPS senden? ][Ja|Nein]")=1 defmouse 2 get sx+(sw-100)/2,sy+(sh-50)/2,sx+(sw+100)/2,sy+(sh+50)/2,bg$ color weiss pbox sx+(sw-100)/2,sy+(sh-50)/2,sx+(sw+100)/2,sy+(sh+50)/2 color schwarz box sx+(sw-100)/2,sy+(sh-50)/2,sx+(sw+100)/2,sy+(sh+50)/2 @sendmessage(27,mki$(anzal)) @do_hscaler(sx+670,sy+170,100,0) for i=0 to anzal-1 color weiss pbox sx+(sw-100)/2,sy+(sh-50)/2,sx+(sw+100)/2,sy+(sh+50)/2 color schwarz box sx+(sw-100)/2,sy+(sh-50)/2,sx+(sw+100)/2,sy+(sh+50)/2 TEXT sx+(sw-100)/2+10,sy+sh/2-10,"sende ..." TEXT sx+(sw-100)/2+10,sy+sh/2+10,"# "+str$(i,5,5) vsync @sendmessage(31,almanac$(i)) @do_hscaler(sx+670,sy+170,100,i/anzal) next i @do_hscaler(sx+670,sy+170,100,1) @sendmessage(12,mki$(1)) put sx+(sw-100)/2,sy+(sh-50)/2,bg$ defmouse 0 endif else ~form_alert(1,"[3][Es sind keine AL geladen !][ OH ]") endif RETURN procedure sonder local a,f$,i alert 0,"Message-Nr eingeben:|MSGNR="+chr$(27)+"14 ",2,"send|CANCEL",a,f$ print f$,a if a=1 i=val(f$) print i @sendmessage(10,MKI$(i)) endif return @sendmessage(11,chr$(8)) ! Kontrast setzen procedure lichtan @sendmessage(15,chr$(0)) return procedure lichtaus @sendmessage(15,chr$(1)) return procedure asyncan @sendmessage(28,mki$(-1)) return procedure asyncaus @sendmessage(28,mki$(0)) return function qthlocator$(breite,laenge) print "laenge=";laenge,"Breite=";breite t$=chr$(int(laenge/20)+asc("J")) t$=t$+chr$(asc("J")+int(breite/10)) laenge=laenge-int(laenge/20)*20 laenge=laenge/2 t$=t$+str$(int(laenge)) breite=breite-int(breite/10)*10 t$=t$+str$(int(breite)) breite=breite-int(breite) laenge=laenge-int(laenge) t$=t$+chr$(asc("A")+24*laenge) t$=t$+chr$(asc("A")+24*breite) return t$ endfunc function breite$(x) local posx$ IF x>0 posx$="N" ELSE posx$="S" ENDIF x=ABS(x) posx$=posx$+RIGHT$("00"+str$(INT(x)),2)+":" x=x-INT(x) x=x*60 posx$=posx$+RIGHT$("00"+str$(INT(x)),2)+":" x=x-INT(x) x=x*60 posx$=posx$+RIGHT$("00"+str$(INT(x)),2)+"." x=x-INT(x) x=x*10 posx$=posx$+str$(INT(x)) return posx$ endfunc function laenge$(x) local posx$ IF x>0 posx$="E" ELSE posx$="W" ENDIF x=ABS(x) posx$=posx$+RIGHT$("000"+str$(INT(x)),3)+":" x=x-INT(x) x=x*60 posx$=posx$+RIGHT$("00"+str$(INT(x)),2)+":" x=x-INT(x) x=x*60 posx$=posx$+RIGHT$("00"+str$(INT(x)),2)+"." x=x-INT(x) x=x*10 posx$=posx$+str$(INT(x)) return posx$ endfunc function conv_laenge(posx$) local x x=VAL(MID$(posx$,2,2))+VAL(MID$(posx$,5,2))/60+VAL(MID$(posx$,8,6))/60/60 IF UPPER$(LEFT$(posx$,1))="S" x=-x endif return x endfunc function conv_breite(posy$) local y y=VAL(MID$(posy$,2,3))+VAL(MID$(posy$,6,2))/60+VAL(MID$(posy$,9,6))/60/60 IF UPPER$(LEFT$(posy$,1))="W" y=-y endif return y endfunc procedure hoehenprofil local i,x,y,date,alt,depth,new,dist,laenge,v defmouse 2 vsync laenge=0 gnutmp$="/tmp/"+str$(timer)+".gnu" dattmp$="/tmp/"+str$(timer)+".dat" open "O",#11,dattmp$ for i=0 to anztrack-1 t$=track$(i) y=180/2^31*CVL(MID$(t$,1,4)) x=180/2^31*CVL(MID$(t$,5,4)) date=CVL(MID$(t$,9,4)) alt=CVf(MID$(t$,13,4)) depth=CVf(MID$(t$,17,4)) new=asc(MID$(t$,21,1)) if new clr vv,vh,vx,vy,vz,dist else dist=@distance(ox,oy,x,y)*1000 dt=date-odate dx=@distance(ox,y,x,y)*1000 dy=@distance(x,oy,x,y)*1000 if dt vz=int((alt-oalt)/dt*100)/100 vx=int(dx/dt*100)/100 vy=int(dy/dt*100)/100 vh=dist/dt*3.6 vv=(alt-oalt)/dt*3.6 else clr vx,vy,vz,vh,vv endif endif odate=date ox=x oy=y oalt=alt v=sqrt(vh*vh+vv*vv) print #11,str$(i)+" "+str$(laenge)+" "+str$(date)+" "+str$(alt)+" "+str$(v) add laenge,dist next i close #11 open "O",#11,gnutmp$ print #11,"set multi" print #11,"set grid" print #11,"set xlabel "+chr$(34)+"Distanz [km]"+chr$(34) print #11,"set ylabel "+chr$(34)+"Hoehe [m]"+chr$(34) print #11,"set y2label "+chr$(34)+"Geschwindigkeit [km/h]"+chr$(34) print #11,"set origin 0,0" print #11,"set size 1,0.5" print #11,"plot [:][-10:3000] "+chr$(34)+dattmp$+chr$(34)+" u ($2/1000):4 t "; print #11,chr$(34)+"Hoehe"+chr$(34)+" w steps , "; print #11,chr$(34)+dattmp$+chr$(34)+" u ($2/1000):($5) t "; print #11,chr$(34)+"Geschwindigkeit"+chr$(34)+" w steps" print #11,"set origin 0,0.5" print #11,"set xlabel "+chr$(34)+"Zeit [h]"+chr$(34) print #11,"plot [:][-10:200] "+chr$(34)+dattmp$+chr$(34)+" u ($3/3600):4 t "; print #11,chr$(34)+"Hoehe"+chr$(34)+" w steps , "; print #11,chr$(34)+dattmp$+chr$(34)+" u ($3/3600):5 t "; print #11,chr$(34)+"Geschwindigkeit"+chr$(34)+" w steps" print #11,"set nomulti" print #11,"pause -1" close #11 defmouse 0 vsync system "gnuplot "+gnutmp$ system "rm -f "+gnutmp$+" "+dattmp$ return function waypointselect(info$) local i,n$,a$ dim sel$(anzwp-1) for i=0 to anzwp-1 n$=MID$(waypoint$(i),49,LEN(waypoint$(i))-49) wort_sep n$,chr$(0),0,n$,a$ sel$(i)=str$(i)+": 0x"+hex$(cvi(MID$(waypoint$(i),5,2)),4,4,1)+" "+n$+chr$(0) next i return listselect(info$,sel$()) endfunction function polyselect(info$) local i,n$,a$,anz dim sel$(anzpoly-1) for i=0 to anzpoly-1 anz=cvi(MID$(polygon$(i),23,2)) n$=MID$(polygon$(i),25+anz*8,LEN(polygon$(i))-49) wort_sep n$,chr$(0),0,n$,a$ sel$(i)=str$(i)+": 0x"+hex$(ASC(MID$(polygon$(i),1,1)) and 255,2,2,1)+" "+str$(anz)+" "+n$+chr$(0) next i return listselect(info$,sel$()) endfunction procedure gotowp local wpid,x,y,nxmin,nymin if anzwp>0 wpid=@waypointselect("Goto Waypoint ...") if wpid>=0 x=180/2^31*CVL(MID$(waypoint$(wpid),25,4)) y=180/2^31*CVL(MID$(waypoint$(wpid),29,4)) nxmin=y-(xmax-xmin)/2 nymin=x-(ymax-ymin)/2 xmax=nxmin+(xmax-xmin) ymax=nymin+(ymax-ymin) xmin=nxmin ymin=nymin @sort_wp @redraw @showrange endif else ~form_alert(1,"[3][No waypoint defined so far!][OK]") endif return procedure gotopoly local wpid,x,y,nxmin,nymin if anzpoly>0 wpid=@polyselect("Goto Map element ...") if wpid>=0 if cvf(MID$(polygon$(wpid),11,4))-cvf(MID$(polygon$(wpid),7,4))>0 and cvf(MID$(polygon$(wpid),19,4))-cvf(MID$(polygon$(wpid),15,4))>0 xmin=cvf(MID$(polygon$(wpid),7,4)) xmax=cvf(MID$(polygon$(wpid),11,4)) ymin=cvf(MID$(polygon$(wpid),15,4)) ymax=cvf(MID$(polygon$(wpid),19,4)) else x=(cvf(MID$(polygon$(wpid),7,4))+cvf(MID$(polygon$(wpid),11,4)))/2 y=(cvf(MID$(polygon$(wpid),15,4))+cvf(MID$(polygon$(wpid),19,4)))/2 nxmin=x-(xmax-xmin)/2 nymin=y-(ymax-ymin)/2 xmax=nxmin+(xmax-xmin) ymax=nymin+(ymax-ymin) xmin=nxmin ymin=nymin endif @sort_wp @redraw @showrange endif else ~form_alert(1,"[3][No map element defined so far!][OK]") endif return procedure deletewp local i,n$,a$ if anzwp>0 i=@waypointselect("Delete Waypoint:") if i>=0 print "delete "+sel$(i) waypoint$(i)=waypoint$(anzwp-1) dec anzwp @sort_wp @redraw @showrange endif else ~form_alert(1,"[3][No waypoint defined so far!][OK]") endif return procedure editwp local i,n$,a$ if anzwp>0 i=@waypointselect("Select Waypoint:") if i>=0 @doeditwp(i) endif else ~form_alert(1,"[3][No waypoint defined so far!][OK]") endif return procedure editpoly local i,n$,a$ if anzpoly>0 i=@polyselect("Select Map element:") if i>=0 @doeditpoly(i) endif else ~form_alert(1,"[3][No map element defined so far!][OK]") endif return procedure deletepoly local i,j if anzpoly>0 i=@polyselect("Delete Map element:") if i>=0 print "delete "+sel$(i) polygon$(i)=polygon$(anzpoly-1) for j=i to anzpoly-2 polygon$(j)=polygon$(j+1) next j dec anzpoly @redraw @showrange endif else ~form_alert(1,"[3][No map element defined so far!][OK]") endif return procedure select_track_piece(info$) local i,date,os,t$ ' Hier die Anzahl der zusammenhaengenden Stuecke bestimmen. anzt=0 for i=0 to anztrack-1 new=asc(MID$(track$(i),21,1)) if i=0 new=1 endif if new inc anzt endif next i dim sel$(anzt-1),anf(anzt-1),tlen(anzt-1) print anzt;" Zusammenhaengende Stuecke." anzt=0 for i=0 to anztrack-1 t$=track$(i) new=asc(MID$(t$,21,1)) if i=0 anf(0)=0 inc anzt os=0 date=CVL(MID$(t$,9,4)) new=0 endif if new tlen(anzt-1)=i-os sel$(anzt-1)=str$(anzt-1)+": "+str$(os)+"-"+str$(i-1)+" "+@jdate$(date)+chr$(0) date=CVL(MID$(t$,9,4)) anf(anzt)=i inc anzt os=i endif next i tlen(anzt-1)=i-os sel$(anzt-1)=str$(anzt-1)+": "+str$(os)+"-"+str$(i-1)+" "+@jdate$(date)+chr$(0) inc anzt track_select=listselect(info$,sel$()) return procedure deletetrack local i,j,anzt if anztrack>0 @select_track_piece("Delete Track:") if track_select>=0 print "delete "+sel$(track_select) print anf(track_select),tlen(track_select) for j=anf(track_select) to anztrack-1-tlen(track_select) track$(j)=track$(j+tlen(track_select)) next j sub anztrack,tlen(track_select) @redraw @showrange endif else ~form_alert(1,"[3][No track defined so far!][OK]") endif return procedure optimizetrack local i,j,anzt,alt,y1,x1,x2,x3,y3,y2,t$,oa,oe,c1,c2,c3,diff if anztrack>0 @select_track_piece("Select Track:") if track_select>=0 if tlen(track_select)>2 dim rflags(anztrack) arrayfill rflags(),0 oa=anf(track_select) oe=oa+tlen(track_select)-1 c1=oa c2=oa+1 c3=oa+2 do t$=track$(c1) y1=180/2^31*CVL(MID$(t$,1,4)) x1=180/2^31*CVL(MID$(t$,5,4)) t$=track$(c2) y2=180/2^31*CVL(MID$(t$,1,4)) x2=180/2^31*CVL(MID$(t$,5,4)) t$=track$(c3) y3=180/2^31*CVL(MID$(t$,1,4)) x3=180/2^31*CVL(MID$(t$,5,4)) diff=@distance(x2,y2,x3,y3)+@distance(x1,y1,x2,y2)-@distance(x1,y1,x3,y3) if diff<0.0005 print "removed #";c2 rflags(c2)=1 else inc c1 endif inc c2 inc c3 exit if c3=oe loop clr i,j do while rflags(j)=1 and j0 @select_track_piece("Select Track:") if track_select>=0 oa=anf(track_select) oe=oa+tlen(track_select)-1 alt=CVf(MID$(track$(oa),13,4)) typ=form_alert(2,"[0][Bitte Track-Typ auswaehlen:][Fussweg|Strasse|Hauptstrasse|Autobahn|Bezirk]")-1 if typ=4 typ=15 endif p$=chr$(typ)+chr$(0)+mkf$(alt)+mkf$(0)+mkf$(0)+mkf$(0)+mkf$(0)+mki$(tlen(track_select)) print oa,oe print anztrack,tlen(track_select) mx1=1000 mx2=-1000 my1=1000 my2=-1000 for j=oa to oe t$=track$(j) y=180/2^31*CVL(MID$(t$,1,4)) x=180/2^31*CVL(MID$(t$,5,4)) mx1=min(x,mx1) mx2=max(x,mx2) my1=min(y,my1) my2=max(y,my2) print x,y p$=p$+mkf$(x)+mkf$(y) next j print "Boundingbox: ";mx1,mx2,my1,my2 t$=mkf$(mx1)+mkf$(mx2)+mkf$(my1)+mkf$(my2) bmove varptr(t$),varptr(p$)+6,4*4 p$=p$+sel$(track_select)+chr$(0) polygon$(anzpoly)=p$ inc anzpoly @redraw @showrange endif else ~form_alert(1,"[3][No track defined so far!][OK]") endif return procedure deleteallwp if anzwp>0 if form_alert(2,"[3][Really delete all waypoints ?][YES|NO]")=1 anzwp=0 @redraw @showrange endif else ~form_alert(1,"[3][No waypoint defined so far!][OK]") endif return procedure deletealltrack if anztrack>0 if form_alert(2,"[3][Really delete all tracks ?][YES|NO]")=1 anztrack=0 @redraw @showrange endif else ~form_alert(1,"[3][No tracks defined so far!][OK]") endif return procedure deletemap if anzpoly>0 if form_alert(2,"[3][Really delete all map elements ?][YES|NO]")=1 anzpoly=0 @redraw @showrange endif else ~form_alert(1,"[3][No map elements defined so far!][OK]") endif return procedure doeditpoly(pid) local t$,typ,flags,alt,l1,l2,l3,l4,anz,name$,p$ t$=polygon$(pid) typ=asc(mid$(t$,1,1)) flags=asc(mid$(t$,2,1)) alt=cvf(mid$(t$,3,4)) l1=cvf(mid$(t$,7,4)) l2=cvf(mid$(t$,11,4)) l3=cvf(mid$(t$,15,4)) l4=cvf(mid$(t$,19,4)) anz=cvi(mid$(t$,23,2)) name$=mid$(t$,25+anz*8,len(t$)-25-anz*8) name$=replace$(name$,chr$(0),".") t$="Edit map element #"+str$(pid)+":|========================||" t$=t$+"Name: "+chr$(27)+name$+string$(max(32,len(name$))-len(name$),chr$(10))+"|" t$=t$+"Breiten: "+@breite$(l3)+" - "+@breite$(l4)+"|" t$=t$+"Längen: "+@laenge$(l1)+" - "+@laenge$(l2)+"|" t$=t$+"Altitude (m):"+chr$(27)+str$(alt,5,5)+"|" t$=t$+"Typ: "+chr$(27)+"0x"+hex$(typ,2,2)+"|" t$=t$+"flags: "+chr$(27)+"0x"+hex$(flags,2,2)+"|" t$=t$+"Content: "+str$(anz)+" Points.|" print replace$(replace$(t$,chr$(27),""),chr$(10),"") alert 0,t$,1,"OK|CANCEL",a,f$ if a=1 memdump varptr(f$),len(f$) f$=replace$(f$,chr$(10),"") wort_sep f$,chr$(13),0,name$,f$ wort_sep f$,chr$(13),0,a$,f$ alt=val(a$) wort_sep f$,chr$(13),0,a$,f$ typ=val(a$) wort_sep f$,chr$(13),0,a$,f$ flags=val(a$) p$=chr$(typ)+chr$(flags)+mkf$(alt)+mid$(polygon$(pid),7,4*4+2+8*anz)+name$+chr$(0) polygon$(pid)=p$ @redraw endif return procedure doeditwp(wpid) local color,class,x,y,alt,t$,name$,comment$ t$=" "+waypoint$(wpid) class=asc(mid$(t$,3,1)) color=asc(mid$(t$,4,1)) and 255 displ=asc(mid$(t$,5,1)) attr=asc(mid$(t$,6,1)) styp=cvi(mid$(t$,7,2)) y=180/2^31*CVL(MID$(t$,27,4)) x=180/2^31*CVL(MID$(t$,31,4)) alt=cvf(mid$(t$,35,4)) depth=cvf(mid$(t$,39,4)) dist=cvf(mid$(t$,43,4)) name$=mid$(t$,51,len(t$)-51) name$=replace$(name$,chr$(0),"|")+"|" wort_sep name$,"|",0,name$,comment$ wort_sep comment$,"|",0,comment$,facility$ wort_sep facility$,"|",0,facility$,city$ wort_sep city$,"|",0,city$,addr$ wort_sep addr$,"|",0,addr$,crossr$ if crossr$="|" crossr$="" endif state$=mid$(t$,47,2) cc$=mid$(t$,49,2) oldname$=name$ again_edit: subclass$=hex$(cvi(mid$(t$,9,2)),4,4,1)+hex$(cvl(mid$(t$,11,4)),8,8,1)+hex$(cvl(mid$(t$,15,4)),8,8,1)+hex$(cvl(mid$(t$,19,4)),8,8,1)+hex$(cvl(mid$(t$,23,4)),8,8,1) t$="Edit waypoint #"+str$(wpid)+":|========================||" t$=t$+"Name: "+chr$(27)+name$+string$(max(10,len(name$))-len(name$),chr$(10))+"|" t$=t$+"Breite: "+chr$(27)+@breite$(y)+"|" t$=t$+"Länge: "+chr$(27)+@laenge$(x)+"|" t$=t$+"Höhe (m):"+chr$(27)+str$(alt,5,5)+"|" t$=t$+"Tiefe: "+chr$(27)+str$(depth,5,5)+"|" t$=t$+"Dist: "+chr$(27)+str$(dist,5,5)+"|" t$=t$+"Symbol: "+chr$(27)+"0x"+hex$(styp,4,4)+"|" t$=t$+"Class: "+chr$(27)+"0x"+hex$(class,2,2)+"|" t$=t$+"Subclass:"+chr$(27)+subclass$+"|" t$=t$+"Color: "+chr$(27)+"0x"+hex$(color,2,2)+"|" t$=t$+"Displ: "+chr$(27)+str$(displ,1,1)+"|" t$=t$+"Attr: "+chr$(27)+"0x"+hex$(attr,2,2)+"|" t$=t$+"State: "+chr$(27)+state$+"|" t$=t$+"CC: "+chr$(27)+cc$+"|" t$=t$+"Comment: "+chr$(27)+comment$+string$(max(36,len(comment$))-len(comment$),chr$(10))+"|" t$=t$+"Facility: "+chr$(27)+facility$+string$(32-len(facility$),chr$(10))+"|" t$=t$+"City: "+chr$(27)+city$+string$(32-len(city$),chr$(10))+"|" t$=t$+"Addr: "+chr$(27)+addr$+string$(32-len(addr$),chr$(10))+"|" t$=t$+"Cross_road: "+chr$(27)+crossr$+string$(32-len(crossr$),chr$(10))+"|" ' print replace$(replace$(t$,chr$(27),""),chr$(10),"") alert 0,t$,1,"OK|CANCEL|DELETE|SEND TO GPS",a,f$ if a=3 if form_alert(2,"[3][Really delete Waypoint #"+str$(wpid)+" ?|"+oldname$+"][OK|CANCEL]")=1 waypoint$(wpid)=waypoint$(anzwp-1) dec anzwp @sort_wp @redraw @showrange endif else if a=1 or a=4 memdump varptr(f$),100 f$=replace$(f$,chr$(10),"") wort_sep f$,chr$(13),0,name$,f$ wort_sep f$,chr$(13),0,posy$,f$ wort_sep f$,chr$(13),0,posx$,f$ wort_sep f$,chr$(13),0,a$,f$ alt=val(a$) wort_sep f$,chr$(13),0,a$,f$ depth=val(a$) wort_sep f$,chr$(13),0,a$,f$ dist=val(a$) wort_sep f$,chr$(13),0,a$,f$ symbl=val(a$) wort_sep f$,chr$(13),0,a$,f$ class=val(a$) wort_sep f$,chr$(13),0,subclass$,f$ wort_sep f$,chr$(13),0,a$,f$ color=val(a$) wort_sep f$,chr$(13),0,a$,f$ displ=val(a$) wort_sep f$,chr$(13),0,a$,f$ attr=val(a$) wort_sep f$,chr$(13),0,state$,f$ wort_sep f$,chr$(13),0,cc$,f$ if len(cc$)<>2 cc$=" " endif if len(state$)<>2 state$=" " endif wort_sep f$,chr$(13),0,comment$,f$ wort_sep f$,chr$(13),0,facility$,f$ wort_sep f$,chr$(13),0,city$,f$ wort_sep f$,chr$(13),0,addr$,f$ wort_sep f$,chr$(13),0,crossr$,f$ y=VAL(MID$(posy$,2,2))+VAL(MID$(posy$,5,2))/60+VAL(MID$(posy$,8,4))/60/60 x=VAL(MID$(posx$,2,3))+VAL(MID$(posx$,6,2))/60+VAL(MID$(posx$,9,4))/60/60 IF UPPER$(LEFT$(posx$,1))="S" x=-x endif IF UPPER$(LEFT$(posy$,1))="W" y=-y endif print "New: x=";x,"y=";y if name$<>oldname$ if form_alert(1,"[2][Do you want to replace the old |waypoint "+oldname$+"?|Or do you want to keep it ?][REPLACE|KEEP IT]")=2 wpid=anzwp inc anzwp endif ' Testen, ob Name schon vergeben .... oldwpid=wpid FOR i=0 TO anzwp-1 IF name$+CHR$(0)=MID$(waypoint$(i),49,LEN(name$)+1) wpid=i ENDIF next i if wpid<>oldwpit if form_alert(1,"[1][Name is already in Use !| Replace the Waypoint ?][YES|NO]")=2 wpid=oldwpid goto again_edit endif if oldwpid" ELSE IF pid=56 print "MSG56: SAT #";asc(mid$(t$,36+3,1))+1;" " ELSE IF pid=57 print "SAT #";asc(mid$(t$,34+3,1))+1;" ACQUIRED PSEUDORANGE" ELSE IF pid=58 a=cvl(mid$(t$,3,4)) print "BUTTON ";hex$(a,4,4,1);": "; if a and 1 print "UP "; endif if a and 2 print "DOWN "; endif if a and 4 print "OK "; endif if a and 8 print "PAGE "; endif if a and 16 print "ON/OFF "; endif print ELSE IF pid=98 @procroutelink(t$) ELSE IF pid=99 @proctrackname(t$) ELSE IF pid=69 @procscanline(t$) else if pid and 255=248 ' Extended product information print "Extended product information received:" a$=t$ while len(a$) wort_sep a$,chr$(0),0,b$,a$ print ">";b$ wend ELSE IF pid=-3 @procprotocollarray(t$) ELSE IF pid=-2 PRINT "PID=254, Identification request!" ' Identifiaction. Wir senden unsere eigene Kennung zurueck: @sendmessage(255,mki$(0x17)+mki$(0xdd)+"GPS-Earth V.1.00 (c) Markus Hoffmann"+chr$(0)) @sendmessage(248,"This is the GARMIN frontend for Linux !"+chr$(0)) cap$="A"+mki$(10)+"A"+mki$(100)+"A"+mki$(200)+"A"+mki$(201)+"A"+mki$(300) cap$=cap$+"A"+mki$(301)+"A"+mki$(500)+"A"+mki$(600)+"A"+mki$(700)+"A"+mki$(800) cap$=cap$+"D"+mki$(108)+"D"+mki$(600)+"D"+mki$(700)+"D"+mki$(800) ! Diese Liste muss noch vervollstaendigt werden .... @sendmessage(253,cap$) ELSE IF pid=-1 @procproductdata(t$) ELSE @status(2,"? Paket pid="+STR$(pid)+" !") print "? Paket pid="+STR$(pid)+" ! LEN=";plen t$=mid$(t$,3,plen) @procunknown(t$) ENDIF endif RETURN procedure procunknown(t$) local i,gruba,grubb,plen plen=len(t$) for i=0 to len(t$)-1 print hex$(asc(mid$(t$,i+1,1)) and 255,2,2,1)' next i print " "+chr$(34); for i=0 to len(t$)-1 a=asc(mid$(t$,i+1,1)) and 255 if a<32 or a>asc("z") a=asc(".") endif print chr$(a); next i print chr$(34) for i=0 to plen/4-1 gruba=cvl(mid$(t$,i*4+1,4)) grubb=cvf(mid$(t$,i*4+1,4)) print i;": ";hex$(gruba,8,8,1);" ";grubb next i return PROCEDURE procroutelink(pt$) local a,i print "ROUTE: LINK="; a=cvi(mid$(pt$,3,2)) if a=0 print "LINE "; else if a=1 print "LINK "; else if a=2 print "NET "; else if a=3 print "DIRECT "; else if a=255 print "SNAP "; else print "UNKNOWN "; endif print "SUBCLASS="; for i=0 to 17 a=asc(mid$(pt$,5+i,1)) print hex$(a,2,2,1); next i print " "; print "IDENT="+chr$(34);mid$(pt$,5+18,asc(mid$(pt$,2,1))-5-18)+chr$(34) return PROCEDURE procpositiondata(pt$) oposx=posx oposy=posy posy=CVD(MID$(pt$,3,8))*180/pi posx=CVD(MID$(pt$,11,8))*180/pi print "Position: ",posx,posy,@breite$(posy),@laenge$(posx) color schwarz pbox 8*89,16*28,8*100,16*30 COLOR grau box 8*89,16*28,8*100,16*30 color gelb setfont normfont$ text 90*8,16*29-2,@breite$(posy) text 89*8,16*30-2,@laenge$(posx) color rot if posx>xmin and posxymin and posy0 defline ,3 line 8*54,16*28,8*54+32*veast/speed,16*28+32*vnorth/speed endif defline ,1 posx=-posx color rot CIRCLE @kx(posx),@ky(posy),4 LINE @kx(posx)-5,@ky(posy),@kx(posx)+5,@ky(posy) LINE @kx(posx),@ky(posy)-5,@kx(posx),@ky(posy)+5 vsync print #7,tow'-posx'posy'eph'alt+mslhgt'epv flush #7 RETURN PROCEDURE proctimedata(t$) local month,day,year,hour,minute,second month=ASC(MID$(t$,3,1)) day=ASC(MID$(t$,4,1)) year=CVI(MID$(t$,5,2)) hour=CVI(MID$(t$,7,2)) minute=ASC(MID$(t$,9,1)) second=ASC(MID$(t$,10,1)) ndate$=STR$(day,2,2)+"."+STR$(month,2,2,1)+"."+STR$(year,4,4) ntime$=str$(hour,2,2)+":"+str$(minute,2,2,1)+":"+str$(second,2,2,1) color schwarz pbox 8*89,16*30,8*100,16*32 COLOR grau box 8*89,16*30,8*100,16*32 color gelb setfont normfont$ text 89*8,16*31-2,ndate$ text 90*8,16*32-2,ntime$ vsync RETURN procedure procvoltage(t4) local u u=cvi(mid$(t$,3,2))/100 color grau pbox 0,420,60,436 color gelb setfont normfont$ text 2,433,"U="+str$(u)+" V" ' print "Voltage: ";cvi(mid$(t$,3,2))/100;" V" vsync return procedure proctemperature(t4) local t t=cvi(mid$(t$,3,2)) color grau pbox 60,420,110,436 color gelb setfont normfont$ text 62,433,"T="+str$(t)+" °C" vsync return PROCEDURE procscanline(t$) local plen,bmflag,offset plen=ASC(MID$(t$,2,1)) t$=MID$(t$,3,plen) bmflag=lpeek(varptr(t$)+0) ' print "BMFLAG=";bmflag ' print "PLEN=";plen if bmflag=0 screenplanes=lpeek(varptr(t$)+12) screenwidth=lpeek(varptr(t$)+16) sht=lpeek(varptr(t$)+20) screenbytes=screenplanes*screenwidth/8*sht print hex$(cvl(mid$(t$,5,4)))'cvl(mid$(t$,9,4))' ' print cvl(mid$(t$,13,4)),cvl(mid$(t$,17,4)),cvl(mid$(t$,21,4))' print hex$(cvl(mid$(t$,25,4))),cvl(mid$(t$,29,4)),cvl(mid$(t$,33,4))' print cvl(mid$(t$,37,4)) print "Planes: ";screenplanes print "Dimension: "+str$(screenwidth)+"x"+str$(sht) print "Bytes: ";screenplanes*screenwidth/8*sht escreenbuf$=space$(screenplanes*screenwidth/8*sht) else offset=cvl(mid$(t$,5,4)) @progress(sht,anzscanline) ' print "OFFSET=";offset bmove varptr(t$)+8,varptr(escreenbuf$)+offset,screenwidth/8*screenplanes inc anzscanline ' print anzscanline if anzscanline=sht ' bsave "escreen",varptr(escreenbuf$),len(escreenbuf$) print @show_screenshot endif endif RETURN PROCEDURE proctrackdata(t$) local plen,x,y,s$,date,alt,depth,new plen=ASC(MID$(t$,2,1)) track$(anztrack)=MID$(t$, 3, plen) if anztrackl trackl2(anztrackl-1)=anztrack endif inc anztrack y=180/2^31*CVL(MID$(t$,3,4)) x=180/2^31*CVL(MID$(t$,7,4)) date=CVL(MID$(t$,11,4)) alt=CVf(MID$(t$,15,4)) depth=CVf(MID$(t$,19,4)) new=asc(MID$(t$,23,1)) if x>xmin and xymin and y50 color gruen else color lila endif if alt<50 color blau endif if new plot @kx(x),@ky(y) else line @kx(otx),@ky(oty),@kx(x),@ky(y) endif if new pCIRCLE @kx(x),@ky(y),2 else CIRCLE @kx(x),@ky(y),1 endif endif otx=x oty=y RETURN PROCEDURE proctrackname(t$) local dlen,disp,col dlen=ASC(MID$(t$,2,1)) disp=ASC(MID$(t$,3,1)) col=ASC(MID$(t$,4,1)) name$=MID$(t$,5,dlen-3) tracklist$(anztrackl)=name$ trackl1(anztrackl)=anztrack trackl2(anztrackl)=anztrack inc anztrackl color schwarz pbox 8*2,16*31,8*25,16*32 color gelb text 8*2,16*32-1,"Track: "+MID$(t$,5,dlen-3)+" " RETURN procedure legende color schwarz pbox sx+sw-19*8,by,sx+sw,by+120 color blau pbox sx+sw-32,by,sx+sw,by+16 color gruen pbox sx+sw-32,by+16,sx+sw,by+32 color gelb pbox sx+sw-32,by+32,sx+sw,by+48 color orange pbox sx+sw-32,by+48,sx+sw,by+64 color rot pbox sx+sw-32,by+64,sx+sw,by+80 color weiss pbox sx+sw-32,by+80,sx+sw,by+96 color hellblau pbox sx+sw-32,by+96,sx+sw,by+112 color weiss box sx+sw-32,by,sx+sw,by+16 box sx+sw-32,by+16,sx+sw,by+32 box sx+sw-32,by+32,sx+sw,by+48 box sx+sw-32,by+48,sx+sw,by+64 box sx+sw-32,by+80,sx+sw,by+96 box sx+sw-32,by+96,sx+sw,by+112 setfont helveticasmallfont$ text sx+sw-66,by+10,"< 50 m" text sx+sw-78,by+16+10,"50-100 m" text sx+sw-85,by+32+10,"100-200 m" text sx+sw-85,by+48+10,"200-300 m" text sx+sw-85,by+64+10,"300-400 m" text sx+sw-85,by+80+10,"400-500 m" text sx+sw-70,by+96+10,"> 500 m" return procedure menneken(x,y) print x,y if len(omenneken$) put oldmennekenx,oldmennekeny,omenneken$ endif clr omenneken$ get x-8,y-8,x+8,y+8,omenneken$ oldmennekenx=x-8 oldmennekeny=y-8 graphmode 4 put_bitmap maenneken$,x-8,y-8,16,16 graphmode 1 return procedure norden(winkel) dim nordx(5),nordy(5) nordx(0)=0 nordy(0)=0 nordx(1)=8 nordy(1)=26 nordx(2)=0 nordy(2)=20 nordx(3)=-8 nordy(3)=26 nordx(4)=0 nordy(4)=0 color weiss polyfill 5,nordx(),nordy(),bx+16,by color schwarz polyline 5,nordx(),nordy(),bx+16,by setfont smallfont$ text bx+14,by+20,"N" return procedure savegrafik fileselect "save screen ...","./*.xwd","output.xwd",f$ if len(f$) if exist(f$) if form_alert(2,"[1][File already exists !|Replace ?][Yes|CANCEL]")=1 defmouse 2 vsync ' bsave f$,varptr(escreen$),len(escreen$) @savexwd(f$) defmouse 0 endif else defmouse 2 vsync @savexwd(f$) defmouse 0 endif endif vsync return procedure redraw local i,x,y,t$ defmouse 2 vsync defline 0,1 color hell pbox bx,by,bx+bw,by+bh color schwarz box bx,by,bx+bw,by+bh clip bx,by,bw,bh i=@distance(@ox(bx+bw/4*3),@oy(by+100),@ox(bx+bw/4*3+100),@oy(by+100)) masstab=i/100 ' Draw the Map if anzpoly>0 for i=0 to anzpoly-1 @draw_polyline(polygon$(i)) next i endif color schwarz defline 0,1 for i=0 to 4 pbox bx+bw-20,by+i*20,bx+bw-20+3,by+i*20+10 pbox bx+bw-120+i*20,by+20,bx+bw-120+i*20+10,by+20+3 next i line bx+bw-20+3,by,bx+bw-20+3,by+100 line bx+bw-20,by,bx+bw-20,by+100 line bx+bw-20-3,by+100,bx+bw-20+6,by+100 line bx+bw-120,by+20,bx+bw-20,by+20 line bx+bw-120,by+20+3,bx+bw-20,by+20+3 setfont normfont$ if masstab<=0.01 text bx+bw-120+10,by+16,str$(masstab*100*1000,4,4)+" m" else text bx+bw-120+10,by+16,str$(masstab*100,4,4)+" km" endif i=@distance(@ox(bx+bw/4*3),@oy(by),@ox(bx+bw/4*3),@oy(by+100)) if i<=1 text bx+bw-50,by+120,str$(i*1000,4,4)+" m" else text bx+bw-50,by+120,str$(i,4,4)+" km" endif color hellgrau ' Gitternetz defline ,1 if abs(int(xmin)-int(xmax))>0 and abs(int(xmin)-int(xmax))<50 for i=int(xmin) to int(xmax) line @kx(i),by,@kx(i),by+bw text @kx(i)-24,by+bh-16,str$(abs(i),3,3) next i endif if int(ymin)<>int(ymax) and abs(int(ymin)-int(ymax))<50 for i=int(ymin) to int(ymax) line bx,@ky(i),bx+bw,@ky(i) text bx+bw-16,@ky(i)-3,str$(abs(i),2,2) next i endif ' Karten-Raender color weiss pbox bx+bw,by,bx+bw+6,by+bh pbox bx,by+bh,bx+bw,by+bh+6 color schwarz line bx+bw,by,bx+bw,by+bh line bx+bw+3,by,bx+bw+3,by+bh line bx+bw+6,by,bx+bw+6,by+bh stepw1=1/60 stepw2=1/600 if ymax-ymin>2 stepw1=1 stepw2=1/60 else if ymax-ymin>1 stepw1=1/60 stepw2=1/120 endif start=int(ymin/stepw1)*stepw1 stop=int(ymax/stepw1)*stepw1+stepw1 for y=start to stop step 2*stepw1 pbox bx+bw+3,@ky(y),bx+bw+6,@ky(y+stepw1) for x=y to y+stepw1*2 step 2*stepw2 pbox bx+bw,@ky(x),bx+bw+3,@ky(x+stepw2) next x next y defline ,1 @norden(0) if anzwp if masstab>0.2 setfont helveticasmallfont$ else if masstab<0.005 setfont normfont$ else setfont mediumfont$ endif color schwarz,weiss graphmode 4 for i=0 to min(anzwp-1,waypoint_cutoff) t$=" "+waypoint$(i) y=180/2^31*CVL(MID$(t$,27,4)) x=180/2^31*CVL(MID$(t$,31,4)) if x>xmin and xymin and y1 name$=MID$(t$,51,len(t$)-51) wort_sep name$,chr$(0),0,name$,comment$ comment$=replace$(MID$(t$,52+len(name$),len(t$)-52-len(name$)),chr$(0),"|") ' print "$"+hex$(symbol,4,4,1),name$,comment$ wort_sep comment$,"|",0,comment$,a$ if len(comment$) and displ=2 name$=comment$ endif text @kx(x)-3*len(name$),@ky(y)-8,name$ endif put_bitmap sym$(symbol and 255,(symbol and 0x7000)/0x2000),@kx(x)-8,@ky(y)-8,16,16 endif next i endif if posx>xmin and posxymin and posyxmin and xymin and yxmin and my1ymin if int(@kx(mx1))<>int(@kx(mx2)) or int(@ky(my1))<>int(@ky(my2)) n=cvi(mid$(p$,23,2)) and 0xffff typ=asc(left$(p$)) flags=asc(mid$(p$,2,1)) ' alt=cvf(mid$(p$,3,4)) ' flags: ' Bit 0: offen (0) oder geschlossen ' Bit 1: one-way (1) oder two-way ' Bit 2: Comment anzeigen (1) oder nicht (0) if typ=0 ! Fussweg if masstab<0.02 @pcv color grau2 defline 0,0.01/masstab,2 polyline n,px(),py() endif else if typ=1 ! kleine Strasse if masstab<0.25 @pcv color grau2 defline 0,int(1/masstab/150*4+1)+2,2 polyline n,px(),py() color weiss defline ,int(1/masstab/150*4+1),2 polyline n,px(),py() else if masstab<0.5 @pcv color grau2 defline 0,1,2 polyline n,px(),py() endif else if typ=2 ! Hauptstrasse if masstab<0.3 @pcv color grau2 defline 0,int(1.5/masstab/150*4+1)+2,2 polyline n,px(),py() color hell defline ,int(1.5/masstab/150*4+1),2 polyline n,px(),py() else if masstab<1 @pcv color grau2 defline 0,1,2 polyline n,px(),py() endif else if typ=3 ! Autobahn if masstab<3 @pcv color gelb defline 0,8,2 polyline n,px(),py() color rot defline ,6,2 polyline n,px(),py() color grau2 defline ,1,2 polyline n,px(),py() endif else if typ=15 ! Bezirksgrenze @pcv color grau defline 1,1,2 polyline n,px(),py() else if typ=16 ! Landesgrenze @pcv color weiss defline 0,3,2 polyline n,px(),py() color rosa defline ,1,2 polyline n,px(),py() else if typ=32 ! Fluss if masstab<0.3 @pcv color wasserblau defline 0,int(10/masstab/150*4+1),2 polyline n,px(),py() else if masstab<2 @pcv color wasserblau defline 0,1,2 polyline n,px(),py() endif else if typ=100 ! Landflaeche color landgelb @pcv polyfill n,px(),py() color rot defmark ,0 polymark n,px(),py() else if typ=101 ! Wasserflaeche @pcv color wasserblau polyfill n,px(),py() color rot defmark ,0 polymark n,px(),py() else if typ=102 ! Watt @pcv color wattgruen polyfill n,px(),py() color rot defmark ,0 polymark n,px(),py() else if typ=103 ! Bebaute Flaeche @pcv color rosa polyfill n,px(),py() color rot defmark ,0 polymark n,px(),py() else ! Unbekannt @pcv color blau defline 0,1,2 defmark ,3,5 polymark n,px(),py() endif if btst(flags,2) if @kx(mx2)-@kx(mx1)>8*len(name$) print name$ graphmode 4 color hellgrau setfont helveticanormfont$ text @kx((mx2+mx1)/2)-8*len(name$)/2,@ky((my2+my1)/2)+4,name$ graphmode 1 endif endif endif endif return procedure showrange color schwarz pbox sx+sw-19*8,by+200,sx+sw,by+280 if anzal>31 color gelb else color grau endif text sx+sw-18*8,15*16,"ALMANAC" if anzwp>0 color gelb else color grau endif text sx+sw-18*8,16*16,"#WP: "+str$(waypoint_cutoff)+"/"+str$(anzwp) if anztrack>0 color gelb else color grau endif text sx+sw-18*8,17*16,"#TR: "+str$(anztrack,5,5) if anzpoly>0 color gelb else color grau endif text sx+sw-18*8,18*16,"#MAP: "+str$(anzpoly,6,6) vsync return procedure status(n,ssst$) color grau pbox 12*8,16*(30+1-n)+2,(12+30)*8,16*(30-n)+2 color weiss text 12*8,16*(30+1-n),LEFT$(ssst$+" ",28) vsync return procedure preferences local ret,ok,cancel,br1,br2,lon1,lon2,devtext local tree0$,obj0$,obj1$ string0$="Preferences ..."+chr$(0)+space$(0) string1$=""+chr$(0) string2$=""+chr$(0) tedinfo0$=mkl$(varptr(string0$))+mkl$(varptr(string1$))+mkl$(varptr(string2$))+mki$(3)+mki$(0)+mki$(2)+mki$(4209)+mki$(0)+mki$(65535)+mki$(0)+mki$(0) obj1$=mki$(2)+mki$(-1)+mki$(-1)+mki$(22)+mki$(0)+mki$(16)+mkl$(varptr(tedinfo0$))+mki$(16)+mki$(16)+mki$(560)+mki$(16) string3$="Interface Device:"+chr$(0) obj2$=mki$(3)+mki$(-1)+mki$(-1)+mki$(28)+mki$(0)+mki$(0)+mkl$(varptr(string3$))+mki$(16)+mki$(48)+mki$(136)+mki$(16) string4$="Breite:"+chr$(0) obj3$=mki$(4)+mki$(-1)+mki$(-1)+mki$(28)+mki$(0)+mki$(0)+mkl$(varptr(string4$))+mki$(16)+mki$(64)+mki$(56)+mki$(16) string5$="Länge:"+chr$(0) obj4$=mki$(5)+mki$(-1)+mki$(-1)+mki$(28)+mki$(0)+mki$(0)+mkl$(varptr(string5$))+mki$(16)+mki$(80)+mki$(56)+mki$(16) string6$="bis"+chr$(0) obj5$=mki$(6)+mki$(-1)+mki$(-1)+mki$(28)+mki$(0)+mki$(0)+mkl$(varptr(string6$))+mki$(280)+mki$(64)+mki$(56)+mki$(16) string7$="bis"+chr$(0) obj6$=mki$(7)+mki$(-1)+mki$(-1)+mki$(28)+mki$(0)+mki$(0)+mkl$(varptr(string7$))+mki$(280)+mki$(80)+mki$(56)+mki$(16) devtext=7 string8$=devicename$+chr$(0)+space$(39) string9$="_______________________________________"+chr$(0) string10$="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"+chr$(0) tedinfo1$=mkl$(varptr(string8$))+mkl$(varptr(string9$))+mkl$(varptr(string10$))+mki$(3)+mki$(0)+mki$(0)+mki$(4513)+mki$(0)+mki$(1)+mki$(39)+mki$(39) obj7$=mki$(8)+mki$(-1)+mki$(-1)+mki$(29)+mki$(8)+mki$(0)+mkl$(varptr(tedinfo1$))+mki$(160)+mki$(48)+mki$(240)+mki$(16) br1=8 string11$=@breite$(ymin)+chr$(0)+space$(12) string12$="____________"+chr$(0) string13$="XXXXXXXXXXXX"+chr$(0) tedinfo2$=mkl$(varptr(string11$))+mkl$(varptr(string12$))+mkl$(varptr(string13$))+mki$(3)+mki$(0)+mki$(0)+mki$(4513)+mki$(0)+mki$(1)+mki$(12)+mki$(12) obj8$=mki$(9)+mki$(-1)+mki$(-1)+mki$(29)+mki$(8)+mki$(0)+mkl$(varptr(tedinfo2$))+mki$(160)+mki$(64)+mki$(96)+mki$(16) br2=9 string14$=@breite$(ymax)+chr$(0)+space$(12) string15$="____________"+chr$(0) string16$="XXXXXXXXXXXX"+chr$(0) tedinfo3$=mkl$(varptr(string14$))+mkl$(varptr(string15$))+mkl$(varptr(string16$))+mki$(3)+mki$(0)+mki$(0)+mki$(4513)+mki$(0)+mki$(1)+mki$(12)+mki$(12) obj9$=mki$(10)+mki$(-1)+mki$(-1)+mki$(29)+mki$(8)+mki$(0)+mkl$(varptr(tedinfo3$))+mki$(320)+mki$(64)+mki$(96)+mki$(16) lon1=10 string17$=@laenge$(xmin)+chr$(0)+space$(13) string18$="_____________"+chr$(0) string19$="XXXXXXXXXXXXX"+chr$(0) tedinfo4$=mkl$(varptr(string17$))+mkl$(varptr(string18$))+mkl$(varptr(string19$))+mki$(3)+mki$(0)+mki$(0)+mki$(4513)+mki$(0)+mki$(1)+mki$(13)+mki$(13) obj10$=mki$(11)+mki$(-1)+mki$(-1)+mki$(29)+mki$(8)+mki$(0)+mkl$(varptr(tedinfo4$))+mki$(160)+mki$(80)+mki$(104)+mki$(16) lon2=11 string20$=@laenge$(xmax)+chr$(0)+space$(13) string21$="_____________"+chr$(0) string22$="XXXXXXXXXXXXX"+chr$(0) tedinfo5$=mkl$(varptr(string20$))+mkl$(varptr(string21$))+mkl$(varptr(string22$))+mki$(3)+mki$(0)+mki$(0)+mki$(4513)+mki$(0)+mki$(1)+mki$(13)+mki$(13) obj11$=mki$(12)+mki$(-1)+mki$(-1)+mki$(29)+mki$(8)+mki$(0)+mkl$(varptr(tedinfo5$))+mki$(320)+mki$(80)+mki$(104)+mki$(16) ok=12 string23$="OK"+chr$(0) obj12$=mki$(13)+mki$(-1)+mki$(-1)+mki$(26)+mki$(7)+mki$(0)+mkl$(varptr(string23$))+mki$(520)+mki$(64)+mki$(56)+mki$(64) cancel=13 string24$="CANCEL"+chr$(0) obj13$=mki$(0)+mki$(-1)+mki$(-1)+mki$(26)+mki$(37)+mki$(0)+mkl$(varptr(string24$))+mki$(520)+mki$(144)+mki$(56)+mki$(64) obj0$=mki$(-1)+mki$(1)+mki$(13)+mki$(20)+mki$(0)+mki$(16)+mkl$(135424)+mki$(bx+(bw-592)/2)+mki$(by+(bh-224)/2)+mki$(592)+mki$(224) tree0$=obj0$+obj1$+obj2$+obj3$+obj4$+obj5$+obj6$+obj7$+obj8$+obj9$+obj10$ tree0$=tree0$+obj11$+obj12$+obj13$ ~form_dial(0,0,0,0,0,bx,by,bw,bh) ~form_dial(1,0,0,0,0,bx,by,bw,bh) ' ~objc_draw(varptr(tree0$),0,-1,0,0) ret=form_do(varptr(tree0$)) if ret=ok wort_sep string8$,chr$(0),1,devicename$,b$ close #1 OPEN "UX:9600,N,8,1",#1,devicename$ @init_device endif ~form_dial(2,0,0,0,0,bx,by,bw,bh) ~form_dial(3,0,0,0,0,bx,by,bw,bh) vsync return PROCEDURE paper ' display graphics window with grid an axis ' Globale Vars: bx,by,bw,bh, grid, ' xmin,xmax,ymin,ymax,xstep,ystep local textfaktor,x$,y$,x2$,y2$,void,x,y COLOR schwarz pBOX bx,by,bx+bw,by+bh textfaktor=bw/10000 void=0 color grau BOX bx,by,bx+bw,by+bh FOR x=0 TO MAX(ABS(xmin),ABS(xmax)) STEP xstep COLOR hellgrau IF x>xmin AND xxmin AND -xxmin AND xxmin AND -xvoid+2 color schwarz deftext 0,textfaktor,textfaktor,0 ltext @kx(x)-textfaktor*LEN(x$)*130/2,@ky(0)+textfaktor*50,x$ void=ltextlen(x$) ltext @kx(-x)-textfaktor*LEN(x2$)*130/2,@ky(0)+textfaktor*50,x2$ ENDIF NEXT x FOR y=0 TO MAX(ABS(ymin),ABS(ymax)) STEP ystep COLOR hellgrau IF y>ymin AND yymin AND -yymin AND yymin AND -yymin AND yymin AND -ySGN(xmax) LINE @kx(0),@ky(ymin),@kx(0),@ky(ymax) ENDIF IF SGN(ymin)<>SGN(ymax) LINE @kx(xmin),@ky(0),@kx(xmax),@ky(0) ENDIF FOR i=-3 TO 3 ' Pfeile IF SGN(xmin)<>SGN(xmax) LINE @kx(0)+i,@ky(ymax)+10,@kx(0),@ky(ymax) ENDIF IF SGN(ymin)<>SGN(ymax) LINE @kx(xmax)-10,@ky(0)+i,@kx(xmax),@ky(0) ENDIF NEXT i ' Beschriftung COLOR weiss deftext 1,textfaktor*2,textfaktor*3,0 ltext bx+bw-textfaktor*2*130*LEN(ex$),@ky(0)-textfaktor*2*160,ex$ ltext @kx(0)+textfaktor*2*130,by+130*textfaktor*1.5,ey$ deftext ,textfaktor,textfaktor,-90 color gelb ltext bx+bw-textfaktor*130,by+bh-130*textfaktor,"(C) MARKUS HOFFMANN 9'1995" VSYNC DEFTEXT ,,,0 RETURN PROCEDURE stepsize ' calculate stepsize from range-data local i xstep=(xmax-xmin)/10 ystep=(ymax-ymin)/8 FOR i=-13 TO 13 IF xstep>=8*10^i AND xstep<2*10^(i+1) xstep=10^(i+1) else IF xstep>=2*10^(i+1) AND xstep<5*10^(i+1) xstep=2*10^(i+1) else IF xstep>=5*10^(i+1) AND xstep<8*10^(i+1) xstep=5*10^(i+1) ENDIF IF ystep>=8*10^i AND ystep<2*10^(i+1) ystep=10^(i+1) else IF ystep>=2*10^(i+1) AND ystep<5*10^(i+1) ystep=2*10^(i+1) else IF ystep>=5*10^(i+1) AND ystep<8*10^(i+1) ystep=5*10^(i+1) ENDIF NEXT i RETURN PROCEDURE hscalerbar(scaler_x,scaler_y,scaler_w) LOCAL i,k COLOR schwarz PBOX scaler_x,scaler_y,scaler_x+scaler_w,scaler_y+20 COLOR weiss BOX scaler_x,scaler_y,scaler_x+scaler_w,scaler_y+20 FOR i=0 TO 100 STEP 5 IF (i MOD 50)=0 k=7 TEXT scaler_x+i/100*scaler_w-len(str$(i))*2.5,scaler_y+37,str$(i) eLSE IF (i MOD 10)=0 k=5 ELSE k=3 ENDIF LINE scaler_x+i/100*scaler_w,scaler_y+20,scaler_x+i/100*scaler_w,scaler_y+20+k NEXT i RETURN procedure savefig fileselect "export fig ...","./*.fig","test.fig",f$ if len(f$) if exist(f$) if form_alert(2,"[1][Datei existiert schon !|Ersetzen ?][Ja|ABBRUCH]")=1 defmouse 2 vsync @makefig(f$) defmouse 0 endif else defmouse 2 @makefig(f$) defmouse 0 endif endif return procedure saveescreen fileselect "save screendump ...","./*.xpm","screen.xpm",f$ if len(f$) if exist(f$) if form_alert(2,"[1][Datei existiert schon !|Ersetzen ?][Ja|ABBRUCH]")=1 defmouse 2 vsync @savexpm(f$) defmouse 0 endif else defmouse 2 vsync @savexpm(f$) defmouse 0 endif endif vsync return procedure savexwd(f$) local t$ get bx,by,bw,bh,t$ bsave f$,varptr(t$),len(t$) return procedure savexpm(f$) print "Save screen as: "+f$ open "O",#4,f$ print #4,"/* XPM */" print #4,"static char *magick[] = {" print #4,"/* columns rows colors chars-per-pixel */" print #4,chr$(34)+str$(sht)+" "+str$(screenwidth)+" 4 1"+chr$(34)+"," print #4,chr$(34)+"0 c #ffffff"+chr$(34)+"," print #4,chr$(34)+"1 c #aaaaaa"+chr$(34)+"," print #4,chr$(34)+"2 c #555555"+chr$(34)+"," print #4,chr$(34)+"3 c #000000"+chr$(34)+"," print #4,"/* pixels erzeugt von GPS-Earth "+version$+" (garmin.bas) */" for x=screenwidth-1 downto 0 print #4,chr$(34); for y=0 to sht-1 a=asc(mid$(escreenbuf$,1+x/8*screenplanes+y*screenwidth*screenplanes/8,1)) and 255 b=x mod 4 if btst(a,b*2) and btst(a,b*2+1) print #4,"3"; else if btst(a,b*2)=0 and btst(a,b*2+1) print #4,"2"; else if btst(a,b*2) and btst(a,b*2+1)=0 print #4,"1"; else print #4,"0"; endif next x print #4,chr$(34)+"," next y print #4,"};" close #4 return procedure show_screenshot local x,y,b,a,bg$ if sht>0 and screenplanes>0 and screenwidth>0 get sx+sw-sht,sy+sh-screenwidth,sht,screenwidth,bg$ defmouse 2 for x=screenwidth-1 downto 0 for y=0 to sht-1 a=asc(mid$(escreenbuf$,1+x/8*screenplanes+y*screenwidth*screenplanes/8,1)) and 255 b=x mod 4 if btst(a,b*2) and btst(a,b*2+1) color schwarz else if btst(a,b*2)=0 and btst(a,b*2+1) color grau else if btst(a,b*2) and btst(a,b*2+1)=0 color hellgrau else color weiss endif plot sx+sw-sht+y,sy+sh-x next y vsync next x get sx+sw-sht,sy+sh-screenwidth,sht,screenwidth,escreen$ ~form_alert(1,"[0][continue ?][OK]") put sx+sw-sht,sy+sh-screenwidth,bg$ defmouse 0 endif return procedure progress(a,b) local t$ print chr$(13);"[";string$(b/a*32,"-");">";string$((1.03-b/a)*32,"-");"| ";str$(int(b/a*100),3,3);"% ]"; flush return procedure makefig(figfilename$) local plen,x,y,s$,date,alt,depth,new,t$,a$,x1$,x2$,y1$,y2$,a,b,c,d open "O",#4,figfilename$ print #4,"#FIG 3.2" print #4,"Landscape" print #4,"Center" print #4,"Metric" print #4,"A4" print #4,"100.00" print #4,"Single" print #4,"-2" print #4,"1200 2" if exist("Karten/Karten.dat") open "I",#7,"Karten/Karten.dat" while not eof(#7) lineinput #7,t$ wort_sep t$," ",1,y1$,t$ wort_sep t$," ",1,x1$,t$ wort_sep t$," ",1,y2$,t$ wort_sep t$," ",1,x2$,t$ a=@kx(@conv_breite(x1$)) b=@ky(@conv_laenge(y1$)) c=@kx(@conv_breite(x2$)) d=@ky(@conv_laenge(y2$)) print a,b,c,d if c-a>10 and d-b>10 and c-a<1000 and d-b<1000 and a>-1000 and b>-1000 and a<3000 and b<3000 if left$(t$)=chr$(34) t$=right$(t$,len(t$)-1) endif if right$(t$)=chr$(34) t$=left$(t$,len(t$)-1) endif print "Karte: ",t$ print #4,"2 5 0 1 0 -1 150 0 -1 0.000 0 0 -1 0 0 5" print #4," 0 Karten/"+t$ print #4," "+str$(int(45*@kx(@conv_breite(x1$))))+" "+str$(int(45*@ky(@conv_laenge(y1$)))); print #4," "+str$(int(45*@kx(@conv_breite(x1$))))+" "+str$(int(45*@ky(@conv_laenge(y2$)))); print #4," "+str$(int(45*@kx(@conv_breite(x2$))))+" "+str$(int(45*@ky(@conv_laenge(y2$)))); print #4," "+str$(int(45*@kx(@conv_breite(x2$))))+" "+str$(int(45*@ky(@conv_laenge(y1$)))); print #4," "+str$(int(45*@kx(@conv_breite(x1$))))+" "+str$(int(45*@ky(@conv_laenge(y1$)))) endif wend close #7 endif @ps_dicke(1) @ps_font(14) @ps_color(0) @ps_tmode(0) @ps_box(bx,by,bx+bw,by+bh) for i=0 to 4 @ps_pbox(bx+bw-20,by+i*20,bx+bw-20+3,by+i*20+10) @ps_pbox(bx+bw-120+i*20,by+20,bx+bw-120+i*20+10,by+20+3) next i @ps_line(bx+bw-20+3,by,bx+bw-20+3,by+100) @ps_line(bx+bw-20,by,bx+bw-20,by+100) @ps_line(bx+bw-20-3,by+100,bx+bw-20+6,by+100) @ps_line(bx+bw-120,by+20,bx+bw-20,by+20) @ps_line(bx+bw-120,by+20+3,bx+bw-20,by+20+3) i=@distance(@ox(bx+bw/4*3),@oy(by),@ox(bx+bw/4*3),@oy(by+100)) masstab=i/100 if i<=1 @ps_text(bx+bw-120+10,by+16,str$(i*1000,4,4)+" m") else @ps_text(bx+bw-120+10,by+16,str$(i,4,4)+" km") endif i=@distance(@ox(bx+bw/4*3),@oy(by+100),@ox(bx+bw/4*3+100),@oy(by+100)) if i<=1 @ps_text(bx+bw-50,by+120,str$(i*1000,4,4)+" m") else @ps_text(bx+bw-50,by+120,str$(i,4,4)+" km") endif if abs(int(xmin)-int(xmax))>0 and abs(int(xmin)-int(xmax))<50 for i=int(xmin) to int(xmax) @ps_dotline(@kx(i),by,@kx(i),by+bw) @ps_text(@kx(i)-24,by+bh-16,str$(abs(i),3,3)) next i endif if int(ymin)<>int(ymax) and abs(int(ymin)-int(ymax))<50 for i=int(ymin) to int(ymax) @ps_dotline(bx,@ky(i),bx+bw,@ky(i)) @ps_text(bx+bw-16,@ky(i)-3,str$(abs(i),2,2)) next i endif @ps_color(0) @ps_groesse(18) @ps_font(1) for i=0 to anzwp-1 t$=waypoint$(i) y=180/2^31*CVL(MID$(t$,25,4)) x=180/2^31*CVL(MID$(t$,29,4)) @ps_color(2) @ps_circle(@kx(x),@ky(y),2) @ps_color(1) a$=MID$(t$,49,len(t$)-48) wort_sep a$,chr$(0),0,a$,b$ @ps_text(@kx(x),@ky(y),a$) next i for i=0 to anztrack-1 t$=track$(i) y=180/2^31*CVL(MID$(t$,1,4)) x=180/2^31*CVL(MID$(t$,5,4)) date=CVL(MID$(t$,9,4)) alt=CVf(MID$(t$,13,4)) depth=CVf(MID$(t$,17,4)) new=asc(MID$(t$,21,1)) if new @ps_color(3) @ps_circle(@kx(x),@ky(y),1) else @ps_color(6) @ps_CIRCLE(@kx(x),@ky(y),0.6) endif if alt>100 @ps_color(10) else @ps_color(12) endif if new @ps_line(@kx(x),@ky(y),@kx(x),@ky(y)) else @ps_line(@kx(otx),@ky(oty),@kx(x),@ky(y)) endif otx=x oty=y next i @ps_angle(90) @ps_font(10) @ps_tmode(0) @ps_groesse(8) @ps_text(bx+bw/2,by+bh-5,"Garmin.bas, X11-Basic "+version$+" (c) Markus Hoffmann "+date$) close #4 ' system "fig2dev -L ps -z A4 -c "+figfilename$+" "+psfilename$ ' system "rm "+figfilename$ ' system "chmod 666 "+psfilename$ return PROCEDURE do_hscaler(scaler_x,scaler_y,scaler_w,wert) COLOR schwarz PBOX scaler_x+1,scaler_y+1,scaler_x+scaler_w,scaler_y+20 COLOR gelb PBOX scaler_x+1,scaler_y+1,scaler_x+1+(scaler_w-2)*wert,scaler_y+20 RETURN procedure ps_line(x1,y1,x2,y2) @mmm print #4,"2 1 0 "+str$(dicken)+" "+str$(colorn)+" 7 0 0 -1 0.000 0 0 -1 0 0 2" print #4," "+str$(x1)+" "+str$(y1)+" "+str$(x2)+" "+str$(y2) return procedure ps_dotline(x1,y1,x2,y2) @mmm print #4,"2 1 2 "+str$(dicken)+" "+str$(colorn)+" 7 0 0 -1 3.000 0 0 -1 0 0 2" print #4," "+str$(x1)+" "+str$(y1)+" "+str$(x2)+" "+str$(y2) return procedure ps_box(x1,y1,x2,y2) @mmm print #4,"2 1 0 "+str$(dicken)+" "+str$(colorn)+" 7 0 0 -1 0.000 0 0 -1 0 0 5" print #4," "+str$(x1)+" "+str$(y1)+" "+str$(x2)+" "+str$(y1); print #4," "+str$(x2)+" "+str$(y2)+" "+str$(x1)+" "+str$(y2); print #4," "+str$(x1)+" "+str$(y1) return procedure ps_pbox(x1,y1,x2,y2) @mmm print #4,"2 1 0 "+str$(dicken)+" "+str$(colorn)+" 7 0 0 20 0.000 0 0 -1 0 0 5" print #4," "+str$(x1)+" "+str$(y1)+" "+str$(x2)+" "+str$(y1); print #4," "+str$(x2)+" "+str$(y2)+" "+str$(x1)+" "+str$(y2); print #4," "+str$(x1)+" "+str$(y1) return procedure ps_circle(x1,y1,r) local x2,y2 x2=x1+2*r y2=y1+2*r @mmm print #4,"1 3 0 "+str$(dicken)+" "+str$(colorn)+" 7 50 0 20 0.000 1 0 "; print #4," "+str$(x1)+" "+str$(y1)+" "+str$(int(r*45))+" "+str$(int(r*45)); print #4," "+str$(x1)+" "+str$(y1)+" "+str$(x2)+" "+str$(y2) return procedure ps_text(x1,y1,t$) @mmm print #4,"4 "+str$(tmoden)+" 0 40 0 "+str$(fontn)+" "+str$(groessen)+" "+str$(anglen,6,6)+" 4 165 4830 "+str$(int(x1))+" "+str$(int(y1))+" "+t$+"\001" return procedure mmm mul x1,45 mul y1,45 mul x2,45 mul y2,45 y1=int(y1) y2=int(y2) x1=int(x1) x2=int(x2) return procedure ps_color(c) colorn=c return procedure ps_pattern(c) patternn=c return procedure ps_dicke(c) dicken=c return procedure ps_angle(c) anglen=c/180*pi return procedure ps_groesse(c) groessen=c return procedure ps_tmode(c) tmoden=c return procedure ps_font(c) fontn=c return function distance(lona,lata,lonb,latb) local DEG2RAD,l0,l1,b0,b1 DEG2RAD=(3.14159265358979323846/180.0) l0=lona*DEG2RAD l1=lonb*DEG2RAD b0=lata*DEG2RAD b1=latb*DEG2RAD return 6371*2*asin(sqrt(cos(b1)*cos(b0)*sin(0.5*(l1-l0))*sin(0.5*(l1-l0))+sin(0.5*(b1-b0))*sin(0.5*(b1 - b0)))) endfunc menudata: DATA "GPS-Earth"," Info","----------------","- 1","- 2","- 3","- 4","- 5","- 6","" DATA "File" data " new " data "---------------------------" data " load tracks ..." data " load waypoints ..." data " load routes ..." data " load map ..." data " load almanac ..." data "---------------------------" data " Track & WP Info " data "---------------------------" data " export track ..." data " export waypoints ..." data " export map ..." data " import track ..." data " import waypoints ..." data " import map ..." data "---------------------------" data " save tracks ..." data " save waypoints ..." data " save map ..." data " save almanac ..." data " save screendump ..." data "---------------------------" data " Preferences ..." data " save settings" data "---------------------------" data " Quit Q","" DATA "Edit" ' data " select waypoint ... " data " new waypoint ... " data " place waypoint ... " data " edit waypoint ... " data " delete waypoint ... " data " delete all waypoints " data "-----------------------------------" data " draw track ... " data " optimize track ... " data " convert track to map element ... " data " delete track ... " data " delete all tracks " data "-----------------------------------" data " edit map element ..." data " delete map element ..." data " delete all map elements","" DATA "Transfer" data " get almanac A" data " get waypoints W" data " get tracks T" data " get routes R" DATA "------------------------------" data " get position P" data " get time & date D" data " get screendump" DATA "------------------------------" DATA " send Almanac" data " send Waypoints" data " send Track" data " send Route" DATA "------------------------------" DATA " interrupt transfer ESC","" data "Command" data " PVT on" data " PVT off" data " Licht on" data " Licht off" data " Async on" data " Async off" DATA "------------------------" DATA " GPS off BSP","" DATA "Display" data " Längentreu" data " save graphic ..." data " make *.fig ..." data "------------------------" data " Diagramm d <--> v" data " experimental ..." data " goto waypoint ..." data " goto map element ...","" DATA "Setup" data " Time ..." data " Display ..." data " Units ..." data " Interface ..." data " System ..." data "" DATA "***" screenmessages: DATA 00,Can't Change Active WPT DATA 02,Start Altitude Change DATA 03,Final Altitude Alert DATA 05,Approaching DATA 07,Arrival at DATA 08,Cannot Navigate Locked Route DATA 0a,Stored Data was Lost DATA 0b,Database Memory Failed DATA 0c,No Position DATA 14,Transfer Complete DATA 16,Route is Full DATA 17,Route is not Empty DATA 18,Route Waypoint Can't be Deletd DATA 19,Route Waypoint was Deleted DATA 1a,Received an Invalid WPT DATA 1b,Timer Has Expired DATA 1c,Transfer has been Completed DATA 1d,Vertical Nav Cancelled DATA 1e,WPT Memory is Full DATA 1f,Already Exists DATA 21,Accuracy has been Degraded DATA 22,Anchor Drag Alarm DATA 23,Battery Power is Low DATA 24,CDI Alarm DATA 25,Leg not Smoothed DATA 26,Memory Battery is Low DATA 27,Need 2D Altitude DATA 28,No DGPS Position DATA 29,Oscillator Needs Adjustment DATA 2a,Poor GPS Coverage DATA 2c,Receiver has Failed DATA 2d,Power Down and Re-init DATA 2e,Read Only Mem has Failed DATA 2f,RTCM Input has Failed DATA 30,No RTCM Input DATA 31,Searching the Sky DATA 32,Steep Turn Ahead DATA 33,Inside SUA DATA 34,SUA Near & Ahead DATA 35,SUA Ahead < 10 min DATA 36,Near SUA < 2 nm data "***"