I styled a layer with uDig and exported the style as SLD file. I then applied the same style to the a layer (same shapefile) in my code using Geotools. However, uDig's rendering of the map looks much better than mine.
My project uses geotools version 21.2, Java 1.8 and I'm rendering the map with Geotools's JMapPane. Having noticed that the uDig version looks better that mine, I attempted digging into the uDig source to see how the shape files are rendered. I found that shape file are rendered in uDig by ShapefileFeatureRenderer, or so I think. I then copied and pasted the renderer's initialization code and applied it in my project but I didn't notice any difference.
renderer = new StreamingRenderer();
HashMap<String, Object> rendererHints = new HashMap<String, Object>();
rendererHints.put("optimizedDataLoadingEnabled", true); //$NON-NLS-1$
renderer.setRendererHints(rendererHints);
// renderer.removeRenderListener(StreamingRenderer.DEFAULT_LISTENER);
renderer.addRenderListener(listener);
// JG - these may be overriden by the preferences before use?
RenderingHints hints = new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderer.setJava2DHints(hints)
mapPane.setRenderer(renderer);
How do I make my map rendering as good as uDig's (uDig's rendering is to the left in the screenshot below) ?
I would like some one to point me in the right direction on how to go about this. Any help would be appreciated.