OSMDROID: error: incompatible types: IGeoPoint cannot be converted to GeoPoint

心已入冬 提交于 2019-12-06 17:37:33

OverlayItem.getPoint() returns a IGeoPoint, and Projection.toPixels() needs a IGeoPoint. So :

IGeoPoint in = overlayItemArray.get(0).getPoint();

mapview.getProjection().toPixels(in, out);

(and don't go back to an older version, but upgrade to the latest one!)

Workaround: Change the osmdroid version from 4.3 to 3.0.x. IGeoPoint class does not exist in 3.0.x, but in 4.3 it does.

NOTE: version 4.2 has the same problem with IMapController

Solution: Change declaration to private IGeoPoint startPoint; and the same for IMapController and my code became compatible with versions 4.3+ .

Jaime López Romero
import org.osmdroid.api.IMapController;


private IMapController myMapController;
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!