Re: Many changes in layers and markers



On Sat, 2011-02-12 at 14:31 -0700, Robert Park wrote:
> On Fri, Feb 11, 2011 at 10:05 PM, Russell Strong <russell strong id au> wrote:
> > or how about .append_points which would take a list/array of points.
> 
> This wouldn't do anything in my case because I'm appending points from
> within an expat callback (so my method that calls append_point never
> has access to more than one point at a time anyway).
> 
> > This may be an easy workaround for doing multiple redraws.  Another way
> > multiple redraws could be handled would be to set up an idle callback
> > that would do the redraw after any points were added.
> 
> You mean with some kind of threshold, so that a redraw would only
> happen x seconds after points have stopped being added? I could get
> behind this, but it would need some kind of override method you could
> call to force a redraw. The way my GPX parser is structured it pulses
> a GtkProgressbar every 0.2 seconds, and it would be nice if the loaded
> points would be visible to the user at this time, so that they can see
> that something is actually happening (there's really nothing worse
> than a slow-loading file just sitting there looking like the app is
> hung).
> 
Something along the lines of

event happens ( points available )
	while read point
		append point call to libchamplain (Note 1)
event finishes ( returning to glib event loop )
|
champlain redraw function kicks off and does the rendering

Note 1
------
A call which modifies the scenegraph, for the want of a better word,
causes an timer function to be added to do the redraw.  Timer could be
set to immediately expire.  The important thing is that scenegraph
modification is separated from rendering.



In the case of a large number of points your program could be structured
as:

event happens ( points still available to read )
	for 1% of the points:
		append point to libchamplain
	update status bar +1%
	add idle/timer/io_watch to ensure we do this again
event finishes
|
champlain does redraw
|
next 1% event happens



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]