Android 数据库与MapView总结
2010-11-05 00:54:34 来源:WEB开发网}
}
private GeoPoint getGeoByAddress(String strSearchAddress)
{
GeoPoint gp = null;
try
{
if(strSearchAddress!="")
{
Geocoder mGeocoder01 =
new Geocoder(EX10_06_04.this, Locale.getDefault());
List
lstAddress =
mGeocoder01.getFromLocationName(strSearchAddress, 1);
if (!lstAddress.isEmpty())
{
Address adsLocation = lstAddress.get(0);
/* 1E6 = 1000000*/
double geoLatitude = adsLocation.getLatitude()*1E6;
double geoLongitude = adsLocation.getLongitude()*1E6;
gp = new GeoPoint((int) geoLatitude, (int) geoLongitude);
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
return gp;
}
/**
* 更新MapView地图
* @param gp GeoPoint地理坐标对象
* @param mv 查询的数据的字段名称
* @param zoomLevel 放大层级
* @param setSatellite 是否显示卫星地图
*/
public static void refreshMapViewByGeoPoint
(GeoPoint gp, MapView mv, int zoomLevel, boolean setSatellite)
{
try
{
mv.displayZoomControls(true);
MapController mc = mv.getController();
mc.animateTo(gp);
mc.setZoom(zoomLevel);
mv.setSatellite(setSatellite);
}
catch(Exception e)
{
e.printStackTrace();
}
}
/**
* 在地图上显示Overlay图片
* @param gp GeoPoint地理坐标对象
*/
private void showImageOverlay(GeoPoint gp)
{
/* 设置Overlay */
GeoPointImageOverlay mLocationOverlay01;
mLocationOverlay01 = new GeoPointImageOverlay
更多精彩
赞助商链接