Mark Presling wrote:
Hi all.
I can't seem to find how to register a listener that notifies me of a
change to the map state, ie zoom, pan, resize. I am rendering a point
on the map at the moment, but whenever I alter the map in some way it
stays in the same location. I want to be able to make it move with the
world coordinates of the map.
I've been looking at the edit tools to see if I can figure out how
they do it, but it's a bit above my level of understanding in there... :(
Can someone PLEASE point me in the right direction... I'm going nuts.
Too many hours + release tomorrow = STRESS!
Hi Mark!
Okay - brief to the point:
1. uDig zoom levels (and so on) are modeled using EMF (Eclipse Modeling
Framework)
2. A few things are so common that we have helper functions: addListener
/ removeListener
Short Term fix for Your Release
So here is what you do - look at one of those addListener methods
and do what they do. At somepoint here will be an "adapter" that will be
paying attention to the EMF model, when the right kind of even goes by
it will notice and notify all the listeners. It figures out the right
kind of event by comparing the event information to a series of
constants (aka something like ADD_LAYER), you will want to pay attention
to something like SCALE.
If worst comes to worse remember the old value, and compare it to the
new on every single event (and only do your work when it changes).
Next time I am able to look at the code I will try and find a code
example for you (and set up a page in the FAQ).
Q: Would it be easier if we forced you to know about "adapaters" from
the get go? It is something we are considering, but are unsure if it is
worthwhile.
Jody
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel