Fix small shifts (use double)

This commit is contained in:
vshcherb 2013-11-26 17:11:29 +01:00
parent cc152f16c8
commit 9798a3b55c
3 changed files with 10 additions and 10 deletions

View file

@ -28,13 +28,13 @@ public class RenderingContext {
}
public float leftX;
public float topY;
public double leftX;
public double topY;
public int width;
public int height;
public int zoom;
public float tileDivisor;
public double tileDivisor;
public float rotate;
// debug purpose

View file

@ -586,11 +586,11 @@ public class MapRenderRepositories {
final QuadPointDouble lt = requestedBox.getLeftTopTile(requestedBox.getZoom());
// LatLon ltn = requestedBox.getLeftTopLatLon();
final float mapDensity = (float) Math.pow(2, requestedBox.getZoomScale());
final float tileDivisor = (float) MapUtils.getPowZoom(31 - requestedBox.getZoom() -
final double tileDivisor = MapUtils.getPowZoom(31 - requestedBox.getZoom() -
requestedBox.getZoomScale());
currentRenderingContext.leftX = (float) (lt.x * MapUtils.getPowZoom(requestedBox.getZoomScale()));
currentRenderingContext.leftX = lt.x * MapUtils.getPowZoom(requestedBox.getZoomScale());
// MapUtils.get31TileNumberX(ltn.getLongitude()) / tileDivisor;
currentRenderingContext.topY = (float) (lt.y * MapUtils.getPowZoom(requestedBox.getZoomScale()));
currentRenderingContext.topY = lt.y * MapUtils.getPowZoom(requestedBox.getZoomScale());
//MapUtils.get31TileNumberY(ltn.getLatitude()) / tileDivisor;
currentRenderingContext.zoom = requestedBox.getZoom();
currentRenderingContext.rotate = requestedBox.getRotate();

View file

@ -415,10 +415,10 @@ public class OsmandRenderer {
private PointF calcPoint(int xt, int yt, RenderingContext rc){
rc.pointCount ++;
float tx = xt / rc.tileDivisor;
float ty = yt / rc.tileDivisor;
float dTileX = tx - rc.leftX;
float dTileY = ty - rc.topY;
double tx = xt / rc.tileDivisor;
double ty = yt / rc.tileDivisor;
float dTileX = (float) (tx - rc.leftX);
float dTileY = (float) (ty - rc.topY);
float x = rc.cosRotateTileSize * dTileX - rc.sinRotateTileSize * dTileY;
float y = rc.sinRotateTileSize * dTileX + rc.cosRotateTileSize * dTileY;
rc.tempPoint.set(x, y);