empty !Sim.Drecent % % create map for tracker % install locaters in map % "markmaps" *trakpreh % % get this trackers physical user device data % _Sim.Data execstr _DeviceMode "+++___" log)( !Sim.Sid "Status" !Sim.Track *trakstan "Trak\" _Sim.Imei 10 right & ofconn folder !Trak.Folder % % filter data points forward to get valid movement % *trakfwdp % % Sim.NewMove is flagged if map needs updating for new data % empty !Sim.Valid 0.0 !Sim.Vlat 0.0 !Sim.Vlon 0 !counter % % tag as first cycle % true !fircyc % % should not be more than this significant points % 100 !Limiter % % forces next value of latitude and longitude to be counted % 0.0 !Trak.Lat 0.0 !Trak.Lon false !needed false !Trak.Hister _Trak.Folder empty { % % stack: path seed % "" textwild -Limiter negative ? prevfile ? "data point" log)( _fircyc "firstcyc" log)( { % % do not process new map if no new data point % is there a current map file % "tracker" *trakings "-----------ftrak" log)( "vehicle" *trakings or "-----------fveh" log)( "fence" *trakings or "-----------ffen" log)( { % % change in data other than data points % true } { % % surrounding data is stable, check map existence % /* "map" &_Sim.Sid &".html" oflocal "-----------mapr" log)( dup exists "mapexist" log)( { % % prior map file exists, check times against most recent data record % stamp second ^4 stamp "s" Time.Diff positive % % positive difference means new significant data point % } { % % we need new map file, none exists % pop true } ifelse */ % % generate new map if significant move or map does not exist % _Sim.NewMove "checknewmove" log)( _Sim.MapExist "checkmapexist" log)( not or } ifelse "setneeded" log)( !needed } if _needed "ckneeded" log)( { % % must generate map and inject fence checking seed % dup !Sim.File % % next downward in time locater data point file % dup noext !Sim.Msec reading % % stack: path seed seed-content % _Trak.Lat _Trak.Lon rot execstr _Trak.Lat hex2asc !Trak.Lat _Trak.Lon hex2asc !Trak.Lon _Sim.Msec "msec" log)( !Sim.Valid _fircyc { _Trak.Lat !Sim.Vlat _Trak.Lon !Sim.Vlon } if % % observe deltas in lat and lon % _Trak.Lon sub abs exch _Trak.Lat sub abs add dup !Loc.Diff _Sim.Choke gt { +:counter % % valid previous history point with enough departure % interpret date of data point, insert in map % _sumr second noext telldate dup !Trak.Date _Sim.Drecent any)? { } { _Trak.Date " " left$ !Sim.Drecent } ifelse "{{" &_counter &"}}" exch replall _Trak.Lat "{{lat" &_counter &"}}" exch replall _Trak.Lon "{{lon" &_counter &"}}" exch replall !sumr % % create significant history point % %%% *trakhist } { % % not significant enough departure from original lat and lon % } ifelse % % have we reached the necessary number of insertions % _counter _Sim.Marks eq } { % % no need to create new map or continue earlier data point analysis % true } ifelse false !fircyc ? } loop dup !Trak.Continue filing) _counter !Trak.Counter _Sim.Valid isnull) _needed not or "exclude" log)( { % % no significant content for a map file % % % track fence violations % %%% *trakvioo *trakvior } { % % valid map basis, get user info inserts % empty !Sim.License empty !Sim.Vehicle _Sim.UniqueName "-----------tracker" log)( "Vimages" conntext lookin pop % % track fence violations % %%% *trakvioo *trakvior % % insert the user id info attached to tracker % _sumr _Sim.UniqueName "{{sid}}" exch replall empty !Fen.Vios "chk" &_Sim.Sid text ofconn exec$ _Fen.Vios "{{cmpid}}" exch replall "Imei " &_IMEI &"(" &_Sim.UniqueName &")" "{{trin}}" exch replall _IMEI "{{trk1}}" exch replall _Sim.UniqueName "{{trk2}}" exch replall _Sim.Valid "{{trk3}}" exch replall _Sim.Vlat "{{trk4}}" exch replall _Sim.Vlon "{{trk5}}" exch replall _Sim.License "{{trk6}}" exch replall _Sim.Vehicle "{{trk7}}" exch replall _Sim.Bat %%% -1 right trim ^"0" 0 add "{{batA}}" exch replall _Trak.Speed hex2asc trim ^"0" 0 add /* 0.621371 mul */ normint "{{batB}}" exch replall !sumr _Trak.Counter !counter % % replace history points with repeat of earliest valid point % _counter _Sim.Marks eq !Trak.Hister { +counter _Sim.Marks gt ? _sumr _Trak.Date "{{" &_counter &"}}" exch replall _Trak.Lat "{{lat" &_counter &"}}" exch replall _Trak.Lon "{{lon" &_counter &"}}" exch replall !sumr } loop % % new map file with valid data point % further inject fence and other surrounding data _sumr "fence_Fences_" &_UserID text "____________" log)( ofconn read &"var UserID = " _UserID quoter & &"; var Sid = " _Sim.Sid quoter & jsend dup "var Fencer = {lat:" &_Sim.Vlat &",lng:" &_Sim.Vlon &"}; " & "chk" &_Sim.Sid &"_" basenow & &".nex" "Fencing\" ofconn ^ dup tuck write "-=-=-=-=-=-=-= nex" log)( ".new" overext cr prefix "{{fences}}" exch replall *trakmapi "{{recent}}" _Sim.Drecent replall "map" &_Sim.Sid &".htmx" oflocal dup tuck write ".html" overext } ifelse _Trak.Hister "hister" log)( { % % we did reach generation of required display points % continue analyzing and shelving point data into history % _Trak.Continue "ckcont" log)( any? { _Trak.Folder exch "nowcont" log)( { "" textwild prevfile ? "conting" log)( dup !Sim.File % % next downward in time locater data point file % dup noext !Sim.Msec reading % % stack: path seed seed-content % _Trak.Lat _Trak.Lon rot execstr _Sim.Msec "msec" log)( !Sim.Valid _Trak.Lat hex2asc dup !Trak.Lat !Sim.Vlat _Trak.Lon hex2asc dup !Trak.Lon !Sim.Vlon % % observe deltas in lat and lon % _Trak.Lon sub abs exch _Trak.Lat sub abs add dup !Loc.Diff _Sim.Choke gt { +:counter % % valid previous history point with enough departure % dup noext telldate !Trak.Date %%% *trakhist } if finaled } loop "endcont" log)( filing) } if } if "endmapt" log#