When I add osm service in a mapContent
mapContent.addLayer(new AsyncTileLayer(new OSMService("Mapnik", "http://tile.openstreetmap.org/")));
Then when I use the paint method of StreamingRenderer class, there is an infinite run. More precisely the infinite run occurs in the line 563 of the StreamingRenderer class file with :
painterFuture.get();
I call paint method to paint what I add to the mapContent, i.e. here the layer and the osm map.
MapContent mapContent = new MapContent();
mapContent.addLayer(layer);
mapContent.addLayer(new AsyncTileLayer(new OSMService("Mapnik", "http://tile.openstreetmap.org/")));
mapContent.getViewport().setBounds(layer.getBounds());
GTRenderer renderer = new StreamingRenderer();
renderer.setMapContent(mapContent);
Rectangle imageBounds;
ReferencedEnvelope mapBounds;
try {
mapBounds = map.getMaxBounds();
double heightToWidth = mapBounds.getSpan(1) / mapBounds.getSpan(0);
imageBounds = new Rectangle(5, 5, 1000, (int) Math.round(1000 * heightToWidth) + 20);
} catch (Exception e) {
// failed to access map layers
throw new RuntimeException(e);
}
BufferedImage mapBufferedImage = new BufferedImage(imageBounds.width, imageBounds.height, BufferedImage.TYPE_INT_ARGB);
Graphics2D gr = mapBufferedImage.createGraphics();
renderer.paint(gr, imageBounds, mapBounds);
Here is the content of the painterFuture object : state = 0, callable = java.util.concurrent.Executors$RunnableAdapter@3533df16[Wrapped task = org.geotools.renderer.lite.StreamingRenderer$PainterThread@15d0849], outcome = null, runner = "Thread[pool-1-thread-1,5,main]", waiters = null
When there is just the featureLayer and not the osm service, the painterFuture object is marked as Completed normally and contains : state = 2, callable = null, outcome = null, runner = null, waiters = null.
Thank you.