done. :-) Stefan Steiniger schrieb: > Hei Sascha, > > thanx a lot. > are you going to commit it the openjump cvs repository? > would be nice :o) > > stefan > > Sascha L. Teichmann schrieb: >> Hi together, >> >> I'm currently hunting down some timing bugs in the Print/Layout plug-in. >> If WMS layers are used they are not always imported correctly into >> the layout sheet. >> >> On my trip down the rendering path I found out that WMS layers >> do not cache the resulting images of there requests. >> >> I've written a patch (see attachment) against WMSLayer [1] that stores >> the result of the last request using a pair of java.net.URL and >> java.lang.ref.SoftReference (java.awt.Image). >> If the next WMS request URL equals the last one the stored >> image is used and so expensive traffic is avoid. >> >> This does not solve my timing problem but it improves it a bit. >> IMHO this little tweak improves WMS performance in general >> by removing redundant HTTP traffic. >> >> Kind regards, >> Sascha >> >> [1] com.vividsolutions.jump.workbench.model.WMSLayer >> >> >> ------------------------------------------------------------------------ >> >> Index: src/com/vividsolutions/jump/workbench/model/WMSLayer.java >> =================================================================== >> RCS file: >> /cvsroot/jump-pilot/openjump/src/com/vividsolutions/jump/workbench/model/WMSLayer.java,v >> retrieving revision 1.2 >> diff -u -w -r1.2 WMSLayer.java >> --- src/com/vividsolutions/jump/workbench/model/WMSLayer.java 24 Jun >> 2005 09:01:57 -0000 1.2 >> +++ src/com/vividsolutions/jump/workbench/model/WMSLayer.java 22 May >> 2007 16:16:43 -0000 >> @@ -51,6 +51,11 @@ >> import com.vividsolutions.wms.MapRequest; >> import com.vividsolutions.wms.WMService; >> >> +import java.net.URL; >> + >> +import java.lang.ref.Reference; >> +import java.lang.ref.SoftReference; >> + >> /** >> * A Layerable that retrieves images from a Web Map Server. >> */ >> @@ -66,6 +71,10 @@ >> private WMService service; >> >> private String wmsVersion = WMService.WMS_1_0_0; >> + >> + protected Reference oldImage; >> + protected URL oldURL; >> + >> /** >> * Called by Java2XML >> */ >> @@ -121,7 +130,20 @@ >> } >> >> public Image createImage(LayerViewPanel panel) throws IOException { >> - Image image = createRequest(panel).getImage(); >> + >> + MapRequest request = createRequest(panel); >> + URL newURL = request.getURL(); >> + >> + Image image; >> + >> + // look if last request equals new one. >> + // if it does take the image from the cache. >> + if (oldURL == null >> + || !newURL.equals(oldURL) >> + || oldImage == null >> + || (image = (Image)oldImage.get()) == null >> + ) { >> + image = request.getImage(); >> MediaTracker mt = new MediaTracker(new JButton()); >> mt.addImage(image, 0); >> >> @@ -130,6 +152,9 @@ >> } catch (InterruptedException e) { >> Assert.shouldNeverReachHere(); >> } >> + oldImage = new SoftReference(image); >> + oldURL = newURL; >> + } >> >> return image; >> } >> >> >> ------------------------------------------------------------------------ >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by DB2 Express >> Download DB2 Express C - the FREE version of DB2 express and take >> control of your XML. No limits. Just data. Click to get it now. >> http://sourceforge.net/powerbar/db2/ >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Jump-pilot-devel mailing list >> Jump-pilot-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel