public static void setCenterGeoPoint(GeoPoint[] mGeoPoint ,
MapController mapController)
{
GeoPoint mGeoPointCenter;
int maxLatitude = 0;
int minLatitude = 0;
int maxLongitude = 0;
int minLongitude = 0;
try {
if(mGeoPoint.length!=0)
{
for (GeoPoint item : mGeoPoint)
{ // item Contain list of Geopints
int lat = item.getLatitudeE6();
int lon = item.getLongitudeE6();
maxLatitude = Math.max(lat, maxLatitude);
minLatitude = Math.min(lat, minLatitude);
maxLongitude = Math.max(lon, maxLongitude);
minLongitude = Math.min(lon, minLongitude);
}
}
mapController.zoomToSpan(Math.abs(maxLatitude - minLatitude)/2,
Math.abs(maxLongitude - minLongitude)/2);
mGeoPointCenter = new GeoPoint(
(maxLatitude + minLatitude) ,(maxLongitude + minLongitude));
mapController.animateTo(mGeoPointCenter);
}
catch (Exception e)
{
e.printStackTrace();
}
}
MapController mapController)
{
GeoPoint mGeoPointCenter;
int maxLatitude = 0;
int minLatitude = 0;
int maxLongitude = 0;
int minLongitude = 0;
try {
if(mGeoPoint.length!=0)
{
for (GeoPoint item : mGeoPoint)
{ // item Contain list of Geopints
int lat = item.getLatitudeE6();
int lon = item.getLongitudeE6();
maxLatitude = Math.max(lat, maxLatitude);
minLatitude = Math.min(lat, minLatitude);
maxLongitude = Math.max(lon, maxLongitude);
minLongitude = Math.min(lon, minLongitude);
}
}
mapController.zoomToSpan(Math.abs(maxLatitude - minLatitude)/2,
Math.abs(maxLongitude - minLongitude)/2);
mGeoPointCenter = new GeoPoint(
(maxLatitude + minLatitude) ,(maxLongitude + minLongitude));
mapController.animateTo(mGeoPointCenter);
}
catch (Exception e)
{
e.printStackTrace();
}
}
No comments:
Post a Comment