When rendering a map with a raster layer and a legend using
ApplicationGIS.drawMap function I get the exception listed below.
From my debugging this seems to be a result of drawMap cloning the map
layers/resources. When rendering glyphs for the raster layer it
requires the raster layers georesource info. This is a problem because
the cloned georesource does not have any cached info and IGeResource
does not allow you to create the info in the display thread. (The
generate glyph code is run in the Display thread).
I have resolved this locally by adding the following lines to the
LegendGraphic.draw(...) function just after the "String layerId =
getLayerId(layer);"
try {
layer.getGeoResources().get(0).getInfo(null);
} catch (IOException e1) {
//eatme
}
It seems the other alternative is to add similar lines of code to the
ApplicationGIS.drawMap function.
Any preference? If this fix is okay I can create a bug report/pull request.
Emily
org.eclipse.swt.SWTException: Failed to execute runnable
(java.lang.IllegalStateException: Lookup of getInfo not available from
the display thread)
at org.eclipse.swt.SWT.error(SWT.java:4282)
at org.eclipse.swt.SWT.error(SWT.java:4197)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:138)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.wcs.smart.SmartApp.start(SmartApp.java:46)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: java.lang.IllegalStateException: Lookup of getInfo not
available from the display thread
at
net.refractions.udig.catalog.IGeoResource.getInfo(IGeoResource.java:221)
at
net.refractions.udig.project.ui.internal.LayerGeneratedGlyphDecorator.generateDefaultIcon(LayerGeneratedGlyphDecorator.java:552)
at
net.refractions.udig.project.ui.internal.LayerGeneratedGlyphDecorator.generateIcon(LayerGeneratedGlyphDecorator.java:393)
at
net.refractions.udig.legend.ui.LegendGraphic$1.run(LegendGraphic.java:274)
at net.refractions.udig.ui.PlatformGIS$2.run(PlatformGIS.java:288)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
... 23 more
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel