Has all the structure of the classes needed for extension to arrows/markers/whatever.
However, this is just the minimal subset of those base classes required to implement the line drawing functionality
with the asynchronous resampling, and fully compatible with 'current track' which is NOT resampled in any way.
These files are a branch from the prior pull request, and hopefully will make everyone more comfortable about including
the code. The altitude and speed displays, all the bells and whistles - that can come later if needed.
In the drawing loop, culling was performed on pixel boundaries based on x/y positions compared to the tileBox x/y position,
however calculating these from lat/lon was quite a slow process involving calls to getPixXFromLatLon and getPixYFromLatLon
which in turn had a horrendous amount of calculations happening. But since the tileBox has lat/lon and the pixel/lines being
drawn also have lat/lon it seems reasonable - despite potential spherical issues on lat/lon coordinates (?) to just use the
lat/lon as a visibility cull. So, that's what I've done and it does seem to work OK. Heaps faster; aside from the actual
line draw we're talking a couple orders of magnitude improvement in speed. Getting really zippy now, even when drawing
groups super big tracks, and I mean big - hundredsof thousands of points big.
The video at https://youtu.be/J1ppW3_hWds shows well over a thousand kilometers of tracks, 230 thousand points.
By enabling on-zoom resampling of arrows, speed, altitude and conveyor data it is possible to more effectively
tailor the visuals of these renderers. For example, the altitude and speed are point-reduced based on zoom, and now
look much cleaner at low zoom values. Likewise, the arrows are now rendered at consistent size regardless of
zoom. Also, the conveyor segments are similar length onscreen regardless of zoom. During a zoom change, the
prevoiusly resampled track is killed, so there is a brief flash while the appropriate track is resampled. This
appeared visually better than drawing the old track with incorrect spacing/scaling.
A bit of inspiration; rather than trigger the culling for tracks when they are loaded and every time you zoom
(i.e, creating the resampled or simplified tracks such as standard track (Ramer Douglas Peucer line reduction), arrows,
speed, markers (all resample)... now the system uses the bounding rectangle of the original track to trigger the cull(s)
only when the track is onscreen and viewable. This now allows dozens of tracks to be loaded without initial slowdown
caused by all those resamplers and cullers running in the background. It's an on-demand system, in other words.
So, whereas previously if you had 20 GPX tracks loaded, and you zoomed in/out, then all 20 of those tracks would start
a Ramer-Douglas-Peucer resize, which would significantly slow down the whole thing (even though they are asynchronous
they do take a toll on performance). Now, when you zoom in/out, only visible tracks (or ones which become visible)
will start the RDP resize.
I've done quite a bit of refactoring on the asynchronous resamplers to optimise the code. I've also checked carefully
the boundary cases of 0 and 1 point lists and ensured that they operate OK. Fixed up the speed resampler, which was
placing results in the wrong list :)
I got to thinking that the paint variable state should be preserved after the drawing functions did their stuff. Saving
and restoring individual values inside each function was getting messy, so I implemented a local paint variable which
was updated with the important stuff from the passed-in paints. The local variable is now used for all painting/drawing
and the original paint guaranteed unchanged. I could see issues elsewhere if I changed something and other code
was assuming it was already set. So, quite a bit of fiddling with the code to get this working, but now it's clean.
I also did a bit of work on the arrows - see video at https://youtu.be/wvE9HUDMqSM
Basically they're much nicer, but also they are coloured. It's just an experimental thing, where the colour is based
upon the distance along the track; using the same rainbow scaling as the altitude display does; that is... purple up
to red.