Commit graph

29336 commits

Author SHA1 Message Date
Andrew Davie
b7d826483c Paint/context preserving local state
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.
2016-04-02 01:55:58 +11:00
Andrew Davie
778a243cdf Bugfix: Current Track disappeared when starting point wandered offscreen
The 'bounds' that I had implemeted earlier described the minimal rectangle inside which a whole track was contained. This
bounding rectangle was used to quickly cull all track types at draw-time. And it worked well... too well!  The current track
is continually adding points to itself, so its bounds need to be recalculated regularly, not just at startup like other
track types.

So, I've implemented a new Renderable, 'CurrentTrack' which does the special handling for that type of track. It is
smart in that it only recalculates/updates bounding rectangle on the newly added points, so it's very quick. I tested
it on my phone and it appears to be working OK.

Other minor adjustments here and there as I tweak things.
2016-04-01 17:00:02 +11:00
Andrew Davie
3fc4702c9e Epsilon for line simplification was using incorrect value - now much nicer
Fixed a bug related to the distance used for line reduction. The previous value of zoom was being used, instead
of the new value. This kind of explains why I could see line reduction changes more than I though I should have
been able to. Now it's looking very nice. I don't think there will be many more changes. If any.
2016-04-01 04:22:31 +11:00
Andrew Davie
160f280ee1 minor fixup - make sure Conveyor Render checks the track limits early-on 2016-04-01 04:09:36 +11:00
Andrew Davie
71e84acc9f Final pass clean-up on code. It's done.
I've been through and cleaned up the code - minor improvements and cleanups. I'm happy with it and will I stop making
changes and wait for review. I also now understand how git branches work :) so I will work on my own branch.
I hope that this addition makes it into OsmAnd; I'm confident that it is robust and well written.
There will probably be a bug or two, but relatively minor I am sure.
2016-04-01 03:29:05 +11:00
Andrew Davie
112ffdd69a Final pass clean-up on code. It's done.
I've been through and cleaned up the code - minor improvements and cleanups.
It's done. Now that I'm happy with it I propose to stop making changes and wait for review.
I also now understand how git branches work, so I will work on my own branch.
I hope that this addition makes it into OsmAnd; I'm confident that it is robust and well written.
2016-04-01 02:48:03 +11:00
Andrew Davie
7ee1cae93c Prevented current track from participating in line reduction
The current track is constantly changing. It is not suitable for the line culling stuff, so that track is detected
and special-cased.
2016-04-01 01:18:20 +11:00
Andrew Davie
7e9afc68d6 Arrows renderer now working reasonably well.
I put a bit of effort into "pretty". Also, arrows are not displayed until a particular zoom level.
Sample video of this version with the following renderers active: rainbow altitude band, original track, distance
markers and arrows. See video at https://youtu.be/FNui0zxJGJI

Seems to be pretty solid for all renderers. Speed is good. This is close to a "final" version.
2016-03-31 22:57:04 +11:00
Andrew Davie
e8e6ca2854 Found/fixed crash bug in Altitude renderer
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.
2016-03-31 20:04:00 +11:00
Andrew Davie
d99692e429 Rewrote the standard GPX track draw/clipping
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.
2016-03-31 03:16:59 +11:00
Andrew Davie
8e7026c537 mid-work backup 2016-03-30 22:25:52 +11:00
Andrew Davie
64d481e47d Fixed a bug in the rainbow/altitude & speed renderer
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
2016-03-30 16:09:47 +11:00
Andrew Davie
5d4ab73620 Edge cases handled gracefully for low point-count arrays
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.
2016-03-30 15:14:24 +11:00
Andrew Davie
7b4daba1eb Optimisation for zooming/resampling to improve visuals
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
2016-03-30 03:12:53 +11:00
Andrew Davie
1fedd78e23 Removed all the renderers, except for the plain-vanilla one.
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.
2016-03-30 02:15:26 +11:00
Andrew Davie
63ff22b6ab "Trivial" area bounds for segments for super-quick culling during draw.
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.
2016-03-30 01:47:04 +11:00
Andrew Davie
c8a245d031 Honoured isCancelled() for the async renderer, and return correct status
This should speed up things a bit by killing background tasks earlier
2016-03-29 04:57:52 +11:00
Andrew Davie
93587fe210 Very clean OO-type classes for the renderers and asynchronous resamplers. 2016-03-29 03:58:16 +11:00
Andrew Davie
109ca692f1 New GPX track rendering and animation/overlay package.
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
2016-03-28 23:40:30 +11:00
Weblate
ce2f2eceee Merge remote-tracking branch 'origin/master' 2016-03-27 22:54:15 +02:00
YFdyh000
c2ebc25b9d Translated using Weblate (Simplified Chinese)
Currently translated at 56.6% (1106 of 1954 strings)
2016-03-27 22:54:09 +02:00
Hinagiku Zeppeki
1cd5a7382a Translated using Weblate (Japanese)
Currently translated at 99.9% (1953 of 1954 strings)
2016-03-27 22:54:06 +02:00
Viktar Palstsiuk
ccdddf49d2 Translated using Weblate (Belarusian)
Currently translated at 99.5% (1945 of 1954 strings)
2016-03-27 22:54:03 +02:00
Victor Shcherb
adc1a8c2ab Update version 2016-03-27 22:53:14 +02:00
Weblate
e2ec85b1c9 Merge remote-tracking branch 'origin/master' 2016-03-26 18:43:10 +01:00
jan madsen
16e586058b Translated using Weblate (Danish)
Currently translated at 100.0% (2469 of 2469 strings)
2016-03-26 18:43:05 +01:00
Hinagiku Zeppeki
da5d3e4db6 Translated using Weblate (Japanese)
Currently translated at 99.9% (1953 of 1954 strings)
2016-03-26 18:43:00 +01:00
Alexey Kulish
40c7f7b7ce Fix storage selection crash 2016-03-26 20:42:44 +03:00
GaidamakUA
09b78d044f Refactoring 2016-03-25 18:56:48 +02:00
GaidamakUA
12f8c1f115 Reordering. 2016-03-25 15:30:59 +02:00
GaidamakUA
1ae6683dbc Revert "ContextMenuAdapter refactoring. Need to review GpxUiHelper."
This reverts commit f010b21fda.
2016-03-25 15:29:25 +02:00
GaidamakUA
61cc83da27 Revert "Revert "Skip permission and storage dialog first time""
This reverts commit da64aeea1c.
2016-03-25 15:28:48 +02:00
GaidamakUA
da64aeea1c Revert "Skip permission and storage dialog first time"
This reverts commit 9baf7df13d.
2016-03-25 15:27:06 +02:00
GaidamakUA
f010b21fda ContextMenuAdapter refactoring. Need to review GpxUiHelper. 2016-03-25 09:48:46 +02:00
Alexey Kulish
9baf7df13d Skip permission and storage dialog first time 2016-03-24 18:32:24 +03:00
GaidamakUA
f410fbf03c Fixed string problem 2016-03-24 16:05:51 +02:00
Alexey Kulish
e2036d3792 Revert "Fix first start screen after permission"
This reverts commit 0fde34eecb.
2016-03-24 16:44:10 +03:00
Alexey Kulish
0fde34eecb Fix first start screen after permission 2016-03-24 15:34:06 +03:00
Weblate
b5fbd3d131 Merge remote-tracking branch 'origin/master' 2016-03-24 10:08:07 +01:00
Rafał Michalski
774ba797a1 Translated using Weblate (Polish)
Currently translated at 47.6% (1177 of 2469 strings)
2016-03-24 10:08:05 +01:00
Rafał Michalski
b23716c5c6 Translated using Weblate (Polish)
Currently translated at 100.0% (1954 of 1954 strings)
2016-03-24 10:08:00 +01:00
Yogesh
21df054a40 Translated using Weblate (Kannada)
Currently translated at 12.3% (241 of 1954 strings)
2016-03-24 10:07:57 +01:00
Hinagiku Zeppeki
5fd423546b Translated using Weblate (Japanese)
Currently translated at 99.9% (1953 of 1954 strings)
2016-03-24 10:07:57 +01:00
Verdulo
25ecc74848 Translated using Weblate (Esperanto)
Currently translated at 41.5% (812 of 1954 strings)
2016-03-24 10:07:55 +01:00
Viktar Palstsiuk
ca84625fb8 Translated using Weblate (Belarusian)
Currently translated at 99.5% (1945 of 1954 strings)
2016-03-24 10:07:54 +01:00
vshcherb
f68fd9aa71 Update AndroidManifest.xml 2016-03-24 10:07:50 +01:00
Weblate
2f314618b9 Merge remote-tracking branch 'origin/master' 2016-03-23 22:36:23 +01:00
Jurijus
afcabad8ec Translated using Weblate (Lithuanian)
Currently translated at 97.5% (1906 of 1954 strings)
2016-03-23 22:36:15 +01:00
vshcherb
f6fad6df53 Merge pull request #2361 from yurkiss/test_turn_lanes_1
LanseDrawable
2016-03-23 22:36:06 +01:00
y.ridkous@gmail.com
7f746a76e2 Update LanesDrawable to use bitmaps instead of drawing paths. 2016-03-23 23:16:35 +02:00