在地图内容中添加OSM服务并使用streamrenderer类的油漆方法后,无限运行

发布于 2025-01-27 17:24:55 字数 1674 浏览 3 评论 0 原文

当我在MAPCONTENT中添加OSM服务时

mapContent.addLayer(new AsyncTileLayer(new OSMService("Mapnik", "http://tile.openstreetmap.org/")));

,然后使用流媒体类的油漆方法时,会有无限运行。 更确切地说,无限运行发生在流renderer类文件的第563行中:

painterFuture.get();

我调用油漆方法将我添加到MAPCONTENT中的内容,即在此处和OSM映射。

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);

这是painterfuture对象的内容:state = 0,callable = java.util.concurrent.executors $ runnableDapter@353333df16 [包装task = org.geotools.renderer.lite.lite.lite.lite.streamingrenderer- streamingrendererqunrenderqainterqainterqainterqainterthread read rade @15d0849] =“ thread [pool-1-thread-1,5,main]”,waiter = null

仅有featurelayer而不是OSM服务时,painterfuture对象被标记为正态上并且包含:state = 2,callable = 2,callable = 2 null,结果= null,runner = null,waiter = null。

谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文