I want to draw in a other window (a SWT shell) the image obtained with RenderedImage from the uDIg's map . To achieve this I have written this code:
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Demo");
shell.setLayout(new FillLayout());
RenderManager manager =(RenderManager)getContext().getMap().getRenderManager();
RenderedImage renderedImage = manager.getRenderExecutor().getContext().getImage();
Image image = new Image(display, renderedImage.getWidth(),renderedImage.getHeight());
SWTGraphics graphicSWT = new SWTGraphics(image, display);
graphicSWT.drawImage(renderedImage,0,0);
In the last step the program stops. This code doesn't work and surely it's wrong. Somebody knows how I can obtain to draw a renderedImage in a shell?
From: Jesse Eichar <[EMAIL PROTECTED]>
Reply-To: User-friendly Desktop Internet GIS <[email protected]>
To: User-friendly Desktop Internet GIS <[email protected]>
Subject: Re: [udig-devel] Developing Plugin
Date: Tue, 13 Dec 2005 10:00:40 -0800
>Ok fair enough. I have added a method to the IRenderManager for
>1.1 so that you can ask for the most recently rendered image.
>However, for 1.0.x there is no method so you will have to follow
>this hack: (It will work for 1.1 as well so don't worry about that).
>
>RenderManager manager=(RenderManager)map.getRenderManager;
>RenderedImage
>image=manager.getRenderExecutor().getContext().getImage();
>
>Jesse
>
>Iñigo Telleria Elola wrote:
>
>>Hi,
>>I want to the develop a simple plugin: when I click on a plugin's
>>button a new windows appears with the image I have opened on Udig.
>> I have obtained open a window with this code (I have to improve
>>it because it isn't efficient):
>> Display display = new Display();
>> Shell shell = new Shell(display);
>> shell.setText("Demo");
>> shell.setBounds(100, 100, 200, 100);
>> shell.setLayout(new FillLayout());
>> shell.open();
>> while (!shell.isDisposed()) {
>> if (!display.readAndDispatch()) display.sleep();
>> }
>> display.dispose();
>> But now I don't know how to obtain the image from uDig to the new
>>window and open this image in the new window.
>> Thanks
>>
>>------------------------------------------------------------------------
>>
>>_______________________________________________
>>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
