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
This commit is contained in:
Andrew Davie 2016-03-30 03:12:53 +11:00
parent 1fedd78e23
commit 7b4daba1eb

View file

@ -143,15 +143,19 @@ public class Renderable {
}
} else if (culler == null || hashZoom != zoom) {
hashZoom = zoom;
if (culler != null) {
culler.cancel(true);
}
double cullDistance = Math.pow(2.0, base - zoom);
culler = new AsynchronousResampler.RamerDouglasPeucer(this, cullDistance);
culled = null; // use full-resolution until re-cull complete (see [Note 1] below)
if (hashZoom < zoom) { // if line would look worse (we're zooming in) then...
culled = null; // use full-resolution until re-cull complete
}
hashZoom = zoom;
culler.execute("");
// The trackBounds may be slightly inaccurate (unlikely, but...) so let's reset it