Out of memory bug happened occasionally - now fixed by writing to original canvas instead of creating its own
bitmap buffer. It's going to be a lot quicker, too. Since the altitude band is now solid, though, it should be
in the renderer list before the standard track segment.
I have also done some work on the distance/marker renderer, and that is enabled in this update. It draws the
distance (km) as a marker and number over the top of each track.
I went for a ride on my motorbike today to check out how some of the changes work. The "current track" stuff
is hopeless, so that needs to be fixed. Basically I was trying to NOT resample the current track, as it
causes all sorts of speed issues when points are continually added and resamples are continually fired. But
my change clearly didn't work properly so I will revisit that shortly.
I do urge anyone testing to try with a GPX track which has elevation data - the rainbow track backing is
quite nice I think... I hope others like it.
As a side note; I found out how to get the exception log - I have to setup an email account on my emulator
to get it to work.
It's a lot simpler - and a lot faster, I'm sure. Basically it didn't need to be as complex as it was, and mostly
the 'hard stuff' it was solving is actually fairly easily handled by the draw. So. Seems to be working fine.
There are other little tweaks here and there as I test out the system.
The renderers need to behave under density and zoom changes; so that would be the widths of things should scale
properly, and the look of some of them leave a bit to be desired. However, it's the system that is now fully
functional, and work on the renderers can come later. The main track draw seems pretty solid.
Fixed the '1st pass' flag check for the draw loop. Previously was trying to draw at negative infinity
- this *may* have been the reason this routine appeared to occaionally crash the emulator
Modified the draw so it only draws lines which are partially or completely on-screen
This routine is now optimal as far as minimising draw goes
- first cull based on limits of entire track
- second cull on per-segment basis based on screen visibility
Sitations with low point-counts may have been problematic. Now, 0, 1 and 2 point arrays are explicitly handled.
Added a copy constructor to WptPt to allow copies to be made, rather than returning original array.
Cases where no data is returned always returns a zero-sized array rather than a null array.
Just occurred to me that when zooming out (away) then the culled line we have is suitable for display. Previously when
zooming in or out, the culled line was discarded and the original line was drawn. That was to prevent you seeing really
low-resolution stuff while you wait for the asynchroous line cull to finish (can be in the order of several seconds).
However, with this modification, that is now only done when you are zooming in. This improves dramatically the "busy"
look when too much stuff is drawn for the given resolution. Anyway, simple fix but great effect. :P
This gives a simple GPX track that is drawn with asynchronous point reduction to improve the speed of display.
Also, the simple region-based culling gets rid of entire tracks from the draw pipeline for further sppedups.
Reworked all the renderers to be much more object oriented.
Got the sample arrow and conveyor renderers working
Tracked down a few bugs - particularly one still there - TrkSegment with 0 points!
This in my opinion should never happen - it's coming in from "outside" to my code.
WHAT THIS PROVIDES:
A generic rendering/draw of GPX tracks that allows multiple 'renders' to be included as a part of the draw of any
TrkSegment. These 'renders' include the basic track drawing, but also other options such as dashed lines,
rainbow-coloured altitude indication, speed indication, arrows to point direction, animating 'lines' showing
direction of movement, and dots/text showing 1km (or any other) distances along tracks. It's very extendable
and incredibly cheap in terms of procesisng speed.
For a view of some of these operating on this version of the code, see https://youtu.be/aRGCNLmBAlk
Additionally, all of the above have automatic asynchronous track resampling - either via line culling of
Ramer-Douglas-Peucer (implemented for the base track draw at different zooms), or an actual resampler that
takes a distance and steps off and creates a new track with points spaced exactly that distance apart along
the original track. The asynchronous resampling/culling willl automatically enable the new (optimal) track
display when the background task has completed.
This is completely up to date with the master branch as of an hour or so ago!
Two modified files
- GPXUtilities
Added some fields to WptPt to enable distance measurement on tracks and colouring for altitude/speed
- GPXLayer
Installed the new track rendering with examples (commented/out)
Two new files
- AsynchronousResampler.java
Implements line resampling and culling asynchrnonously for all line drawing
- Renderable.java
Set of classes for drawing different kinds of gpx 'renders'
- normal with automatic Ramer-Douglas-Peucer line culling
- conveyor-belt type animation of segments on a path
- altitude colouring of a path
- speed colouring of a path
- distance based waypoint/marker drawing