Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Listening to render events

Thanks Ugo:

I added your code example to this page:
- http://udig.refractions.net/confluence/display/DEV/09+Renderers

Jody

On 11/06/2010, at 10:43 PM, Ugo Taddei wrote:

> Hi,
> 
> here's the snippet:
> 
> // Print some state, for illustration's sake
> System.out.println("Some Rendering States---------------");
> System.out.println("IRenderer.STARTING " +  IRenderer.STARTING);
> System.out.println("IRenderer.RENDERING " +  IRenderer.RENDERING);
> System.out.println("IRenderer.DONE " +  IRenderer.DONE);
> 
> 
> IMap map = mapViewer.getMap();
> final IRenderManager rm = map.getRenderManager();
> 
> //only the RendererImpl has a visible RendererExecutor
> final RenderManagerImpl rmi = (RenderManagerImpl) rm;
> 
> //add a listener to the model
> rmi.getRenderExecutor().eAdapters().add(new AdapterImpl(){
>    public void notifyChanged(Notification notification) {
> 
> 	//on change, print the name (in RendererImpl only) and the state
>        for (IRenderer rdr : rm.getRenderers()) {	
>            System.out.println( ((RendererImpl)rdr).getName() + " -> " +rdr.getState() );
>        }
>    }
> 
> });
> 
> You can also use something similar directly on a single renderer
> ((RendererImpl)rdr).eAdapters().add( theAdatper );
> 
> Cheers,
> 
> Ugo
> 
> Jody Garnett wrote:
>> Great;
>> And if you come up with a code snippet of listening to the rendering process please share so we can add to the developers guide.
>> Jody
>> On 11/06/2010, at 5:59 PM, Ugo Taddei wrote:
>>> Found it. Great!
>>> 
>>> Thanks,
>>> 
>>> Ugo
>>> 
>>> Jody Garnett wrote:
>>>> I think so; the thing doing the rendering is called the render executor and you could go and see what it provides. Remember to use the Notification system for more detail then is provided by listeners (as per my previous email).
>>>> Jody
>>>> On 11/06/2010, at 4:40 PM, Ugo Taddei wrote:
>>>>> Hello,
>>>>> 
>>>>> I want to know when the map has finished rendering all layers. Is there a way to listen to render events? (If there is such a thing, anyway.)
>>>>> 
>>>>> Background: sometimes a layer (coming from a WMS) takes more time than usual (has lots of polys), and the user is left waiting, so I want to include a more visible message to to the user. Furthermore, I've got the impression that map.getRenderManager().refresh(null) doesn't always work ok. Looks like some layers don't refresh or get redrawn).
>>>>> 
>>>>> Thanks in advance,
>>>>> 
>>>>> Ugo
>>>>> _______________________________________________
>>>>> User-friendly Desktop Internet GIS (uDig)
>>>>> http://udig.refractions.net
>>>>> http://lists.refractions.net/mailman/listinfo/udig-devel
>>>> _______________________________________________
>>>> User-friendly Desktop Internet GIS (uDig)
>>>> http://udig.refractions.net
>>>> http://lists.refractions.net/mailman/listinfo/udig-devel
>>> _______________________________________________
>>> User-friendly Desktop Internet GIS (uDig)
>>> http://udig.refractions.net
>>> http://lists.refractions.net/mailman/listinfo/udig-devel
>> _______________________________________________
>> User-friendly Desktop Internet GIS (uDig)
>> http://udig.refractions.net
>> http://lists.refractions.net/mailman/listinfo/udig-devel
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel



Back to the top