From 2869cae3a032f70d2b92b1501e146eb40d535f43 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 3 Sep 2020 20:15:31 +0300 Subject: [PATCH] still cleanup --- .../java/net/osmand/data/RotatedTileBox.java | 38 +++++----- OsmAnd/AndroidManifest.xml | 4 +- OsmAnd/res/layout/server_activity.xml | 70 +++++++------------ OsmAnd/res/values/strings.xml | 4 ++ .../plus/activities/ServerActivity.java | 10 +-- .../src/net/osmand/plus/server/ApiRouter.java | 17 ++++- .../osmand/plus/views/OsmandMapTileView.java | 18 +---- 7 files changed, 69 insertions(+), 92 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/data/RotatedTileBox.java b/OsmAnd-java/src/main/java/net/osmand/data/RotatedTileBox.java index 477f985e1a..bd3452789b 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/RotatedTileBox.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/RotatedTileBox.java @@ -2,8 +2,6 @@ package net.osmand.data; import net.osmand.util.MapUtils; -import java.util.Objects; - public class RotatedTileBox { /// primary fields @@ -124,11 +122,11 @@ public class RotatedTileBox { public double getCenterTileX(){ return oxTile; } - + public int getCenter31X(){ return MapUtils.get31TileNumberX(lon); } - + public int getCenter31Y(){ return MapUtils.get31TileNumberY(lat); } @@ -191,7 +189,7 @@ public class RotatedTileBox { float right = (float) MapUtils.getLongitudeFromTile(zoom, alignTile(tileBounds.right)); latLonBounds = new QuadRect(left, top, right, bottom); } - + private double alignTile(double tile) { if(tile < 0) { return 0; @@ -234,7 +232,7 @@ public class RotatedTileBox { double yTile = MapUtils.getTileNumberY(zoom, latitude); return getPixXFromTile(xTile, yTile); } - + public float getPixXFromTile(double tileX, double tileY, float zoom) { double pw = MapUtils.getPowZoom(zoom - this.zoom); double xTile = tileX / pw; @@ -261,7 +259,7 @@ public class RotatedTileBox { double yTile = MapUtils.getTileNumberY(zoom, latitude); return getPixYFromTile(xTile, yTile); } - + public float getPixYFromTile(double tileX, double tileY, float zoom) { double pw = MapUtils.getPowZoom(zoom - this.zoom); double xTile = (tileX / pw); @@ -311,11 +309,11 @@ public class RotatedTileBox { checkTileRectangleCalculated(); return latLonBounds; } - + public double getRotateCos() { return rotateCos; } - + public double getRotateSin() { return rotateSin; } @@ -363,7 +361,7 @@ public class RotatedTileBox { public double getZoomAnimation() { return zoomAnimation; } - + public double getZoomFloatPart() { return zoomFloatPart; } @@ -374,7 +372,7 @@ public class RotatedTileBox { this.zoom = zoom; calculateDerivedFields(); } - + public void setZoomAndAnimation(int zoom, double zoomAnimation) { this.zoomAnimation = zoomAnimation; this.zoom = zoom; @@ -393,20 +391,20 @@ public class RotatedTileBox { MapUtils.getLongitudeFromTile(zoom, alignTile(tileLT.x))); } - + public QuadPointDouble getLeftTopTile(double zoom) { checkTileRectangleCalculated(); return new QuadPointDouble((tileLT.x * MapUtils.getPowZoom(zoom - this.zoom)), (tileLT.y * MapUtils.getPowZoom(zoom - this.zoom))); } - + public QuadPointDouble getRightBottomTile(float zoom) { checkTileRectangleCalculated(); return new QuadPointDouble((tileRB.x * MapUtils.getPowZoom(zoom - this.zoom)), (tileRB.y * MapUtils.getPowZoom(zoom - this.zoom))); } - + private void checkTileRectangleCalculated() { if(tileBounds == null){ @@ -424,7 +422,7 @@ public class RotatedTileBox { this.mapDensity = mapDensity; calculateDerivedFields(); } - + public double getMapDensity() { return mapDensity; } @@ -473,7 +471,7 @@ public class RotatedTileBox { double ty = getPixYFromTile(qp.x, qp.y); return tx >= 0 && tx <= pixWidth && ty >= 0 && ty <= pixHeight; } - + public boolean containsTilePoint(QuadPointDouble qp) { double tx = getPixXFromTile(qp.x, qp.y); double ty = getPixYFromTile(qp.x, qp.y); @@ -485,7 +483,7 @@ public class RotatedTileBox { double ty = getPixYFromLatLon(lat, lon); return tx >= 0 && tx <= pixWidth && ty >= 0 && ty <= pixHeight; } - + public boolean containsLatLon(LatLon latLon) { double tx = getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude()); double ty = getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude()); @@ -532,7 +530,7 @@ public class RotatedTileBox { zoomSet = true; return this; } - + public RotatedTileBoxBuilder setLocation(double lat, double lon) { tb.lat = lat; tb.lon = lon; @@ -594,6 +592,6 @@ public class RotatedTileBox { + pixHeight + "]"; } - - + + } diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml index db085436cd..1b0e648f6b 100644 --- a/OsmAnd/AndroidManifest.xml +++ b/OsmAnd/AndroidManifest.xml @@ -65,9 +65,7 @@ - + - - - - - - - - - + + android:textAlignment="center" + android:autoLink="web" + android:text="@string/click_button_to_start_server" + android:gravity="center_horizontal"/> - \ No newline at end of file +