For JMapPane is swing double buffering turned on? Java lets you take pretty good control over what is going on using a volatile buffer for direct access to the graphics card; you do need to listen to what is going on and do the draw in a while loop or you will get effects like the one you had the screen snap of. - http://www.javalobby.org/forums/thread.jspa?threadID=16840&tstart=0 - http://java.sun.com/products/jfc/tsc/articles/painting/
Normally Swing draws into a buffer; and then has the draw loop draw the buffered image instead of hitting the data each time. Now it could be that JMapPane implemented the wrong method - ie paint vs update? Can you check if setDoubleBuffered is called? More details: - http://java.sun.com/products/jfc/tsc/articles/painting/#paint_process Now GeoTools takes no part in these games; we generally supply a renderer an application can use to draw into a graphics buffer. I would not recommend drawing into a hard ware accelerated image except from backed data. But GeoTools leaves these choices up to you. It is possible that JMapPane is nor providing a good example; if so please look into the above issues and submit a patch. Jody PS. You mentioned SWT .. you can create an SWT Image that will work with Java 2D and then use GeoTools to draw into it. This results in an SWT image you can draw repeatedly as content is dragged around and your screen needs to be refreshed. The intereting bit is making the SWT Image with the a byte order that you can describe to Java. I tend to go for brute force on this one with ... /** Create a buffered image that can be be coverted to SWTland later */ public static BufferedImage createBufferedImage(int w, int h) { return new BufferedImage(w, h, BufferedImage.TYPE_4BYTE_ABGR_PRE); } public static Image createSWTImage(RenderedImage image, boolean transparent) { ImageData data = createImageData(image, transparent); return new org.eclipse.swt.graphics.Image(Display.getDefault(), data); } // optimized version that works if the image is rgb with a byte data buffer public static ImageData createImageDataFromBytes( RenderedImage image ) { ImageData swtdata = null; int width = image.getWidth(); int height = image.getHeight(); PaletteData palette; int depth; depth = 24; palette = new PaletteData(0xFF0000, 0xFF00, 0xFF); swtdata = new ImageData(width, height, depth, palette); Raster raster = image.getData(); raster.getDataElements(0,0,width, height, swtdata.data); return swtdata; } - http://svn.refractions.net/udig/udig/trunk/plugins/net.refractions.udig.ui/SWTGraphics.java On Thu, Jul 8, 2010 at 4:13 PM, LSA <[email protected]> wrote: > Hello everyone, > > Recently I wrote about JMapPane refresh problem when it is used via > AWT_SWT bridge: > http://www.listware.net/201007/geotools-gt2-users/12102-geotools-gt2-users-problem-with-jmappane-refresh-when-it-used-via-swtawt-bridge.html > > However, I was able to reproduce it in ShapefileViewer, which simply > uses JMapPane (via Swing, no AWT_SWT): > http://files.rsdn.ru/81424/refreshProblem2.PNG > > To reproduce it under Windows XP, start > org.geotools.demo.swing.ShapefileViewer example, add some shapefile > layer, and slowly drag over map some Windows application (for example, > notepad). > > One can notice, that redraw problem only touches areas of map with no > features, so basically it is background redraw problem. Are there some > means at geotools allowing 'more aggressive' redrawing of the backround? > > Thanks in advance, > Sergey > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > Geotools-gt2-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
