Set encoding UTF-8

git-svn-id: https://osmand.googlecode.com/svn/trunk@20 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-04-29 08:04:05 +00:00
parent cccf85c74a
commit 4cec45384e
4 changed files with 20 additions and 9 deletions

View file

@ -0,0 +1,3 @@
#Thu Apr 29 00:40:46 EEST 2010
eclipse.preferences.version=1
encoding/<project>=UTF-8

View file

@ -108,6 +108,17 @@ public class MapUtils {
return (int) ((getTileNumberX(zoom, long1) - getTileNumberX(zoom, long2)) * tileSize); return (int) ((getTileNumberX(zoom, long1) - getTileNumberX(zoom, long2)) * tileSize);
} }
public static int getLengthXFromMeters(int zoom, double latitude, double longitude, double meters, int tileSize, int widthOfDisplay) {
double tileNumberX = MapUtils.getTileNumberX(zoom, longitude);
double tileNumberLeft = tileNumberX - ((double) widthOfDisplay) / (2d * tileSize);
double tileNumberRight = tileNumberX + ((double) widthOfDisplay) / (2d * tileSize);
double dist = getDistance(latitude, getLongitudeFromTile(zoom, tileNumberLeft), latitude, getLongitudeFromTile(zoom,
tileNumberRight));
return (int) ((double) widthOfDisplay / dist * meters);
}
public static int getPixelShiftY(int zoom, double lat1, double lat2, int tileSize){ public static int getPixelShiftY(int zoom, double lat1, double lat2, int tileSize){
return (int) ((getTileNumberY(zoom, lat1) - getTileNumberY(zoom, lat2)) * tileSize); return (int) ((getTileNumberY(zoom, lat1) - getTileNumberY(zoom, lat2)) * tileSize);
} }

View file

@ -0,0 +1,3 @@
#Thu Apr 29 00:40:57 EEST 2010
eclipse.preferences.version=1
encoding/<project>=UTF-8

View file

@ -115,15 +115,9 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
int newY = MapUtils.getPixelShiftY(mapView.getZoom(), int newY = MapUtils.getPixelShiftY(mapView.getZoom(),
lastKnownLocation.getLatitude(), mapView.getLatitude() , mapView.getTileSize()) + lastKnownLocation.getLatitude(), mapView.getLatitude() , mapView.getTileSize()) +
mapView.getHeight()/2; mapView.getHeight()/2;
// TODO clear radius & specify bearing! // TODO specify bearing!
double tileNumberX = MapUtils.getTileNumberX(mapView.getZoom(), mapView.getLongitude()); int radius = MapUtils.getLengthXFromMeters(mapView.getZoom(), mapView.getLatitude(), mapView.getLongitude(),
double tileNumberLeft = tileNumberX - ((double)mapView.getWidth()) / (2d * mapView.getTileSize()); lastKnownLocation.getAccuracy(), mapView.getTileSize(), mapView.getWidth());
double dist = MapUtils.getDistance(mapView.getLatitude(),
MapUtils.getLongitudeFromTile(mapView.getZoom(),tileNumberLeft), mapView.getLatitude(),
MapUtils.getLongitudeFromTile(mapView.getZoom(),tileNumberX));
int radius = (int) ((mapView.getWidth()/ (2d*dist))* lastKnownLocation.getAccuracy());
pointOfView.setLocationX(newX); pointOfView.setLocationX(newX);
pointOfView.setLocationY(newY); pointOfView.setLocationY(newY);