Re: 'notify' signal handler



On Sun, Nov 28, 2010 at 11:13 PM, Robert Park <rbpark exolucere ca> wrote:
> I'm not sure I follow you entirely. Isn't the entire problem that it
> only updates after a certain threshold already? Did you just make the
> threshold smaller then?

In old implementation when update happend it took the currently set
lat/lon, calculated the new lat/lon and compared if the threshold is
greater than 0.001, on the next update it did the same. Because of
this you could slowly move around the map without fireing a signal
because you never crossed the threshold between old lat/lon and new
lat/lon. In my correction you remember the last updated lat/lon and
always compare to that by which it fires an signal when you cross
0.001 threshold in either lat or lon and this problem does not happen
anymore. I have calculated that the threshold of 0.001 is about
150m/515feet which is the distance the map center has to move that the
threshold fires. If zoom is at maximum this could be a problem but not
at other zoom settings as the resolution is low. This is why I
wondered if this should be pixel/meter dependent (for example you have
to move 5 pixels in the current zoom level to fire an event).

> Ultimately, if it's possible, I'd prefer the signal to be fired based
> on how long ago it was last fired, instead of passing some minimum
> threshold. Like, instead of saying "only fire the signal if the new
> location is further than 0.001 degrees away", say "only fire the
> signal if it was last fired more than 1/10 of a second ago." That way
> you won't run into performance issues with the signal being fired too
> often, but you don't have a silly threshhold that prevents small,
> precise movements.

I have also tought about to make it time dependent but in 1/10s you
still could move the map for quite some distance if you are zoomed out
from the map. To overcome this you would have to fire one update event
on map "idle" - when you don't move the map for a certain time - for
example 1s. This is more complicated to implement that is why I did
not implement it in this way. I will try to implement this solution
also, but it may take some time.

> --
> http://exolucere.ca
>

Regards, Tomaž


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