[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| Re: [udig-devel] Developing Plugin | 
You need to add an SWT Composite to the Shell. A good one would
probably be a Canvas:
http://help.eclipse.org/help31/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Canvas.html
Canvas canvas = new Canvas(shell, SWT.DOUBLE_BUFFERED);
Then you would need to create a GC (graphics context,
org.eclipse.swt.graphics.GC) object from the Canvas (it implements
Drawable). You can use that instead of the image to create the
SWTGraphics object and it should work.
Cole
On 12/15/05, Iñigo Telleria Elola <tellenaiz@xxxxxxxxxxx> wrote:
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 <jeichar@xxxxxxxxxxxxxxx
>
Reply-To:  User-friendly Desktop Internet GIS <udig-devel@xxxxxxxxxxxxxxxxxxxxx
>
To:  User-friendly Desktop Internet GIS <udig-devel@xxxxxxxxxxxxxxxxxxxxx>
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