Thank you Andrea.

You are correct, I am not passing the rendering hints to the renderer. Although I read the javadoc enough to realize that the Renderer classes could be given some rendering hints, it never occurred to me that they should be given the hints. So little time, so much to learn :-)

I added the code snippet you suggested and it clears up the Exception.
renderer = new StreamingRenderer();
HashMap<String, Boolean> rendererParams = new HashMap<String, Boolean>();
rendererParams.put("optimizedDataLoadingEnabled", new Boolean(true));
renderer.setRendererHints(rendererParams);
Now you've got me thinking that there might be some more useful rendering hints I should know about. Does anyone know of a good web page that tells what hints to use and when?


In terms of the JAI problems, all I can say is that dealing with Eclipse classloader issues are wearing me out :-( I have tried everything I could to make sure that the GeoToolsPlugIn I created is exporting the JAI material. I haven't tried a buddy classloader yet because all the documentation I've found for them to be, well, rather "half baked". I guess I'll have to read some more. There may be somebody out there who has written a web page explaining it with clarity, depth, and coherence, but he's sure not writing in English (serves me right for not learning another language when I had the chance).

If I ever get this all sorted out, I promise that I'm going to send you guys a tutorial for the GeoTools web site.

Gary




At 05:21 AM 4/10/2007, Andrea Aime wrote:
Gary W. Lucas ha scritto:

I've been trying to run GeoTools 2.4-M1 and have been getting some mysterious exceptions.
I was wondering whether anyone could point me in the right direction.
The following occurs when
I try to use the StreamingRenderer class to plot a ShapeFile. The shapefile is a global-scale map with simple polygons and nothing special in the SLD file except to draw lines. Although the picture appears, this exception is rather alarming and I suspect it means that even though the
picture does appear something serious is going to go wrong downstream.
Apr 9, 2007 12:50:44 PM org.geotools.renderer.lite.StreamingRenderer processStylers
SEVERE: 0
_ java.lang.ArrayIndexOutOfBoundsException_ _: 0
at com.vividsolutions.jts.geom.GeometryCollection.getGeometryN( GeometryCollection.java:136 ) at org.geotools.geometry.jts.GeomCollectionIterator.init( GeomCollectionIterator.java:82 ) at org.geotools.geometry.jts.LiteShape2.getPathIterator( LiteShape2.java:578 ) at org.geotools.geometry.jts.LiteShape2.getPathIterator( LiteShape2.java:643 )

Hum, yeah, this one looks bad, but funny, too. For some reason I don't understand, the renderer is getting a geometry collection (a multypolygon if you're playing with shapefile polygons) that's empty,
that is, it does not have a single geometry. And it's not protecting
itself against that case.
Also, I do believe this happens only if optimized data loading is not
enabled. You don't have this code there, right?

Map rendererParams = new HashMap();
rendererParams.put("optimizedDataLoadingEnabled", new Boolean(true));
renderer.setRendererHints(rendererParams);

Anyways, this has been reported already twice, GEOT-1139, GEOT-1154,
so I guess this is enough, I'm fixing it.

_Also, the main thing I am trying to accomplish by moving to 2.4-M1 is to get GeoTiff images to plot. However I am getting the following Exception when I try to add GeoTiff image code. I am attempting to run GeoTools as part of an eclipse plug-in and I believe, but cannot absolutely be sure,
that I've got the JAI stuff properly installed.  Any suggestions?
SEVERE: null
java.lang.ExceptionInInitializerError
at org.geotools.coverage.processing.DefaultProcessor.<clinit>( _ DefaultProcessor.java:86_ )
...
Caused by: _ java.lang.ClassCastException_ : com.sun.media.jai.imageioimpl.ImageReadWriteSpi at javax.media.jai.OperationRegistry.registerServices( _ OperationRegistry.java:2047_ ) at javax.media.jai.ThreadSafeOperationRegistry.registerServices( _ ThreadSafeOperationRegistry.java:612_ ) at javax.media.jai.OperationRegistry.initializeRegistry( _ OperationRegistry.java:365_ )
at javax.media.jai.JAI.<clinit>( _JAI.java:560_ )

Hum, this one is scary.  OperationRegistry.registerServices is here:
https://jai.dev.java.net/source/browse/jai-core/src/share/classes/javax/media/jai/OperationRegistry.java?rev=1.1&view=markup

as you can see it looks for OperationRegistrySpi implementors in the SPI
subsystem and works against them. The classcast exception tells us that
apparently com.sun.media.jai.imageioimpl.ImageReadWriteSpi is not an
OperationRegistrySpi implementor. But in fact, it is, and it has been for quite some time at least, see here:
https://jai-imageio-core.dev.java.net/source/browse/jai-imageio-core/src/share/classes/com/sun/media/jai/imageioimpl/ImageReadWriteSpi.java?rev=1.1&view=markup

Now, the two files are in separate jars. I see from you stack trace
that you're playing in an Eclipse environment, and there there are classloading issues that would take any man out of mental sanity.
I'm not an RCP expert, but are you sure both JAI and JAI-ImageIO
are visible, exported, or in the buddy list, whatever is needed to
make both be seen by the same classloader just once?
I'd suggest you ask the uDig guys since they should have already
faced this kind of issue.

Cheers
Andrea



Gary W. Lucas
Sonalysts, Inc.
215 Parkway North
Waterford CT 06320, USA
(860) 326-3682 
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to