OSMDroid PathOverlay绘图高缩放级别的损坏缩放、级别、OSMDroid、PathOverlay

2023-09-08 08:55:57 作者:最近流行的长大全

我使用OSMdroid实现地图应用程序。

I'm using OSMdroid to implement a mapping application.

我已经实现了使用瓷砖源,使缩放级别高达22自定义MapTileProvider。

I have implemented a custom MapTileProvider that uses a tile source that allows zoom levels up to 22.

默认Mapnik的供应商只允许缩放到18级。

The default MAPNIK provider only allows zooms to level 18.

问题是,任何PathOverlay情况下完美地画,直到缩放级别19,但随后不缩放级别为20-22正确绘制。它看起来像一个人的抹掉了用橡皮擦路径在路径长度的90%(见下面的截图)。

The problem is that any PathOverlay instances draw perfectly until zoom level 19, but then are not drawn properly at zoom level 20-22. it looks like someone's rubbed out the path with an eraser over 90% of the path length (see screenshots below).

我已经通过PathOverlay的拉伸()方法台阶和exerything的似乎的被正确计算(中间点显示校正缩放级别22,然后在XY突起22-缩放级别分割获得当前的屏幕坐标)。

I've stepped through the draw() method of PathOverlay and exerything seems to be calculating correctly (the intermediate points appear correct for ZoomLevel 22, and then the XY projections are dividing by 22-ZoomLevel to get current screen coordinates).

任何人都可以提供一些洞察力的问题是什么,以及如何解决它?

Can anyone provide some insight as to what the problem is, and how to resolve it?

同样的事情发生,如果我用调用小Cloudmade瓷砖的MapView,这使得放大,直到20级,是一个'内置'osmDroid瓷砖供应商类。

The same thing happens if I invoke the MapView using Cloudmade small tiles, which allows zooms up until level 20 and is a 'built-in' osmDroid tile provider class.

    //mMapTileProvider = new HighResMapTileProvider(this);
    mMapTileProvider = new MapTileProviderBasic(this,TileSourceFactory.CLOUDMADESMALLTILES);
    mMapView = new MapView(this, 256, mResourceProxy,mMapTileProvider);

所以,问题不出现以与瓦片源或提供商但与帆布拉伸法。关于如何解决这个任何想法?

So the problem does not appear to be with the tile source or provider but with the canvas drawing method. Any ideas on how to resolve this?

当zoomLevel 19,我可以很好地看到我的路径:

At zoomLevel 19 I can see my paths nicely:

但这里是,在接下来的缩放级别相同的路径:

But here is that same path at the next zoom level:

推荐答案

更新:此问题已修复在osmdroid 3.0.9

Update: This has been fixed in osmdroid 3.0.9.

的原来的答复:的这个问题似乎根植于Android系统。我相信这是因为,当你滚动视图到一个大的偏移(可能是由于使用SKScalar的),这种情况发生的舍入误差。

Original Answer: This issue appears to be rooted in Android. I believe it is due to a rounding error that happens when you scroll a view to a large offset (possibly due to use of SKScalar). This bug can be isolated by creating a new android project with an activity and a view:

开始与没有滚动的起源尚未弥补的看法。画在画布上的圆: canvas.drawCircle(screenCenterX,screenCenterY,100,mPaint) 滚动视图,以大量的: mainView.scrollTo(536870912,536870912) 画在画布上的圆: canvas.drawCircle(newScreenCenterX,newScreenCenterY,100,mPaint) Begin with the view at the origin with no scroll offset yet. Draw a circle on the canvas: canvas.drawCircle(screenCenterX, screenCenterY, 100, mPaint) Scroll the view to a large number: mainView.scrollTo(536870912, 536870912) Draw a circle on the canvas: canvas.drawCircle(newScreenCenterX, newScreenCenterY, 100, mPaint)

第一圈画好了,第二个吸引失真。对于进一步的证据,试图亲近0纬度/ 0长,放大你的路径 - 注意失真不再出现。

The first circle draws ok, the second one draws distorted. For further evidence, try to draw your path near 0 lat/0 long and zoom in - notice the distortion no longer appears.

我将与一些可能的解决方案更新osmdroid票的变通方法。

I will update the osmdroid ticket with some possible solutions workarounds.