-2

I am working with google maps api 10 for some time now and there is a bug that i just cant fix because im 99.9% sure its within googles library.

I do a lot of Projection .toPixels() to draw stuff and all works fine. I zoom with custom zoom methods mapController.setZoom(getZoom() +1) and it all works UNTIL i use a pinch-zoom (2-finger zoom). After that, the Projection seems to be stuck within certain zoom levels.

If i pinch zoom from 12 to 11 the maps getZoomLevel() gives me 11 (it always reports the right level). Now if i use my zoomOut method i am on level 13 and the projection calculates all right for level 13 but every subsequent zoomOut only changes the maps zoom-level (internally, remember, device has no internet so no map data). The projection continues to calculate everything as if it was still zoomlevel 13!
Should i zoomIn the projection suddenly jumps to level 11, no matter what the real level of the map is. So if i pinch zoomed to 12 the projection is stuck at 11 / 13 and will only jump between those two if i zoom out/in.
IF i pinch-zoom again, the projection is updated but stuck again at the new level to which i pinch-zoomed.

So a pinch zoom without internet completely kills the projection and the whole map becomes useless (in my case i dont really need the visual map, i just need its geoPoint translation, thats the most important part).


Does anyone know a hotfix/workaround or anything that could help me other than to disable more than 1 pointer in the on-touch ?

Map Stuff in the constructor of my customMapView

    setVisibility(View.VISIBLE);

    mapController = getController();

    mapController.setZoom(17);

    setBuiltInZoomControls(false);
    getZoomButtonsController().setVisible(false);

    setSatellite(false);
    setTraffic(false);
    setClickable(true);
    preLoad();


and thats how i zoom with custom buttons

mapController.setZoom(getZoomLevel() + 1); // zoom in
mapController.setZoom(getZoomLevel() - 1); // zoom out


1) zoom buttons work
2) pinch zoom out
3) now the buttons/zoom via button shows the behaviour as described above


Additional Info:
i just used the apps "myTracks" and "Torque".
Both use googlemaps.
In both i have recorded tracks.
Now if i disable internet and use 2-finger zoom and after that zoom in/out with the usual buttons, at some point the track wanders off into some direction even if it is perfectly centered. Up to the point where the track is gone after lots of zoom out/in.
The second i reactivate internet and the map is able to load some tiles the NEXT zoom is working and all is fine... because the map seems to require some data from the internet to calculate something within the projection and this something seems to be provided by a 2-finger zoom... thats how i see it.

3 Apps, all the same issue...

4

1 回答 1

0

你的问题很混乱,你应该重新措辞。

但至少我知道您正在使用MapView未连接到互联网的设备,并且您在将投影与地图缩放级别同步时遇到问题。

首先也是最重要的,问题不在谷歌地图中,​​您需要在代码中查找问题。

实现和之间同步的最常见错误getZoomLevel()Projection经常忘记第一个是整数值(它以 1 的倍数的离散步长增加/减少),而地图图像和投影可以在它们之间取值以向用户提供更平滑的放大/缩小。

例如,当您捏合缩放时,当您将手指放在屏幕上并更改地图大小(和投影)时,该方法getZoomLevel()始终返回您开始捏合缩放时地图的缩放级别。只有在您停止捏合进行缩放(将手指从屏幕上移开)后,该方法getZoomLevel()才会返回最终选择的缩放级别。但是如果没有在这里完成,因为动画会继续将地图图像放大/缩小到最接近的整数缩放级别(getZoomLevel()在您停止捏缩放后开始返回的缩放级别)。

希望你能理解。如果没有发布您的代码示例来说明问题,您将获得纠正它的帮助。

问候。

于 2012-11-27T22:17:20.767 回答