diff --git a/OsmAnd-java/src/net/osmand/RenderingContext.java b/OsmAnd-java/src/net/osmand/RenderingContext.java index 4297912146..d6536b3a90 100644 --- a/OsmAnd-java/src/net/osmand/RenderingContext.java +++ b/OsmAnd-java/src/net/osmand/RenderingContext.java @@ -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 diff --git a/OsmAnd-java/src/net/osmand/data/QuadRect.java b/OsmAnd-java/src/net/osmand/data/QuadRect.java index fced8e7c9a..237d56fbd0 100644 --- a/OsmAnd-java/src/net/osmand/data/QuadRect.java +++ b/OsmAnd-java/src/net/osmand/data/QuadRect.java @@ -1,12 +1,12 @@ package net.osmand.data; public class QuadRect { - public float left; - public float right; - public float top; - public float bottom; + public double left; + public double right; + public double top; + public double bottom; - public QuadRect(float left, float top, float right, float bottom) { + public QuadRect(double left, double top, double right, double bottom) { this.left = left; this.right = right; this.top = top; @@ -20,15 +20,15 @@ public class QuadRect { public QuadRect() { } - public float width() { + public double width() { return right - left; } - public float height() { + public double height() { return bottom - top; } - public boolean contains(float left, float top, float right, float bottom) { + public boolean contains(double left, double top, double right, double bottom) { return this.left < this.right && this.top < this.bottom && this.left <= left && this.top <= top && this.right >= right && this.bottom >= bottom; } @@ -41,15 +41,15 @@ public class QuadRect { return a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom; } - public float centerX() { + public double centerX() { return (left + right) / 2; } - public float centerY() { + public double centerY() { return (top + bottom) / 2; } - public void offset(float dx, float dy) { + public void offset(double dx, double dy) { left += dx; top += dy; right += dx; @@ -57,7 +57,7 @@ public class QuadRect { } - public void inset(float dx, float dy) { + public void inset(double dx, double dy) { left += dx; top += dy; right -= dx; diff --git a/OsmAnd-java/src/net/osmand/data/QuadTree.java b/OsmAnd-java/src/net/osmand/data/QuadTree.java index 92c726556a..e9bd2f1a99 100644 --- a/OsmAnd-java/src/net/osmand/data/QuadTree.java +++ b/OsmAnd-java/src/net/osmand/data/QuadTree.java @@ -86,13 +86,13 @@ public class QuadTree { void splitBox(QuadRect node_extent, QuadRect[] n) { // coord2d c=node_extent.center(); - float width = node_extent.width(); - float height = node_extent.height(); + double width = node_extent.width(); + double height = node_extent.height(); - float lox = node_extent.left; - float loy = node_extent.top; - float hix = node_extent.right; - float hiy = node_extent.bottom; + double lox = node_extent.left; + double loy = node_extent.top; + double hix = node_extent.right; + double hiy = node_extent.bottom; n[0] = new QuadRect(lox, loy, lox + width * ratio, loy + height * ratio); n[1] = new QuadRect(hix - width * ratio, loy, hix, loy + height * ratio); diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index f001d6b717..c9b3a936d6 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -483,10 +483,10 @@ public class MapActivityActions implements DialogProvider { } final RotatedTileBox tb = mapView.getCurrentRotatedTileBox(); final QuadRect tilesRect = tb.getTileBounds(); - int left = (int) FloatMath.floor(tilesRect.left); - int top = (int) FloatMath.floor(tilesRect.top); - int width = (int) (FloatMath.ceil(tilesRect.right) - left); - int height = (int) (FloatMath.ceil(tilesRect.bottom) - top); + int left = (int) Math.floor(tilesRect.left); + int top = (int) Math.floor(tilesRect.top); + int width = (int) (Math.ceil(tilesRect.right) - left); + int height = (int) (Math.ceil(tilesRect.bottom) - top); for (int i = 0; i = 0 && points[i].x <= rc.width && points[i].x >= 0 && points[i].y <= rc.height; if (i > 0) { - float d = FloatMath.sqrt(sqr(points[i].x - points[i - 1].x) + - sqr(points[i].y - points[i - 1].y)); + float d = FloatMath.sqrt(fsqr(points[i].x - points[i - 1].x) + + fsqr(points[i].y - points[i - 1].y)); distances[i-1]= d; roadLength += d; if(inside) { diff --git a/OsmAnd/src/net/osmand/plus/views/MapTileLayer.java b/OsmAnd/src/net/osmand/plus/views/MapTileLayer.java index 987c085ba9..23ab270a24 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapTileLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapTileLayer.java @@ -16,7 +16,6 @@ import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.RectF; -import android.util.FloatMath; import android.widget.Toast; public class MapTileLayer extends BaseMapLayer { @@ -142,10 +141,10 @@ public class MapTileLayer extends BaseMapLayer { } - int left = (int) FloatMath.floor(tilesRect.left); - int top = (int) FloatMath.floor(tilesRect.top + ellipticTileCorrection); - int width = (int) FloatMath.ceil(tilesRect.right - left); - int height = (int) FloatMath.ceil(tilesRect.bottom + ellipticTileCorrection - top); + int left = (int) Math.floor(tilesRect.left); + int top = (int) Math.floor(tilesRect.top + ellipticTileCorrection); + int width = (int) Math.ceil(tilesRect.right - left); + int height = (int) Math.ceil(tilesRect.bottom + ellipticTileCorrection - top); boolean useInternet = settings.USE_INTERNET_TO_DOWNLOAD_TILES.get() && settings.isInternetConnectionAvailable() && map.couldBeDownloadedFromInternet();