Remove unnecessary getters
This commit is contained in:
parent
e4e2dc0c3f
commit
0c5aa539bf
2 changed files with 3 additions and 17 deletions
|
@ -8,7 +8,6 @@ import android.graphics.Paint;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
|
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.data.LatLon;
|
|
||||||
import net.osmand.data.QuadPoint;
|
import net.osmand.data.QuadPoint;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -19,22 +18,12 @@ public class RulerControlLayer extends OsmandMapLayer {
|
||||||
private Bitmap centerIcon;
|
private Bitmap centerIcon;
|
||||||
private Paint bitmapPaint;
|
private Paint bitmapPaint;
|
||||||
private Paint linePaint;
|
private Paint linePaint;
|
||||||
private Location currentLoc;
|
|
||||||
private LatLon centerLoc;
|
|
||||||
private MapActivity mapActivity;
|
private MapActivity mapActivity;
|
||||||
|
|
||||||
public RulerControlLayer(MapActivity mapActivity) {
|
public RulerControlLayer(MapActivity mapActivity) {
|
||||||
this.mapActivity = mapActivity;
|
this.mapActivity = mapActivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getCurrentLoc() {
|
|
||||||
return currentLoc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LatLon getCenterLoc() {
|
|
||||||
return centerLoc;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initLayer(OsmandMapTileView view) {
|
public void initLayer(OsmandMapTileView view) {
|
||||||
centerIcon = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_ruler_center);
|
centerIcon = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_ruler_center);
|
||||||
|
@ -59,8 +48,7 @@ public class RulerControlLayer extends OsmandMapLayer {
|
||||||
canvas.drawBitmap(centerIcon, centerPos.x - centerIcon.getWidth() / 2,
|
canvas.drawBitmap(centerIcon, centerPos.x - centerIcon.getWidth() / 2,
|
||||||
centerPos.y - centerIcon.getHeight() / 2, bitmapPaint);
|
centerPos.y - centerIcon.getHeight() / 2, bitmapPaint);
|
||||||
canvas.rotate(tileBox.getRotate(), centerPos.x, centerPos.y);
|
canvas.rotate(tileBox.getRotate(), centerPos.x, centerPos.y);
|
||||||
centerLoc = tileBox.getCenterLatLon();
|
Location currentLoc = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
|
||||||
currentLoc = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
|
|
||||||
if (currentLoc != null) {
|
if (currentLoc != null) {
|
||||||
int currentLocX = tileBox.getPixXFromLonNoRot(currentLoc.getLongitude());
|
int currentLocX = tileBox.getPixXFromLonNoRot(currentLoc.getLongitude());
|
||||||
int currentLocY = tileBox.getPixYFromLatNoRot(currentLoc.getLatitude());
|
int currentLocY = tileBox.getPixYFromLatNoRot(currentLoc.getLatitude());
|
||||||
|
|
|
@ -29,7 +29,6 @@ import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
|
||||||
import net.osmand.plus.routing.RouteDirectionInfo;
|
import net.osmand.plus.routing.RouteDirectionInfo;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||||
import net.osmand.plus.views.RulerControlLayer;
|
|
||||||
import net.osmand.plus.views.mapwidgets.NextTurnInfoWidget.TurnDrawable;
|
import net.osmand.plus.views.mapwidgets.NextTurnInfoWidget.TurnDrawable;
|
||||||
import net.osmand.router.TurnType;
|
import net.osmand.router.TurnType;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -111,13 +110,12 @@ public class MapInfoWidgetsFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextInfoWidget createRulerControl(final MapActivity map) {
|
public TextInfoWidget createRulerControl(final MapActivity map) {
|
||||||
final RulerControlLayer rulerLayer = map.getMapLayers().getRulerControlLayer();
|
|
||||||
final String title = map.getResources().getString(R.string.map_widget_show_ruler);
|
final String title = map.getResources().getString(R.string.map_widget_show_ruler);
|
||||||
final TextInfoWidget rulerControl = new TextInfoWidget(map) {
|
final TextInfoWidget rulerControl = new TextInfoWidget(map) {
|
||||||
@Override
|
@Override
|
||||||
public boolean updateInfo(DrawSettings drawSettings) {
|
public boolean updateInfo(DrawSettings drawSettings) {
|
||||||
Location currentLoc = rulerLayer.getCurrentLoc();
|
Location currentLoc = map.getMyApplication().getLocationProvider().getLastKnownLocation();
|
||||||
LatLon centerLoc = rulerLayer.getCenterLoc();
|
LatLon centerLoc = map.getMapLocation();
|
||||||
if (currentLoc != null && centerLoc != null) {
|
if (currentLoc != null && centerLoc != null) {
|
||||||
float dist = (float) MapUtils.getDistance(currentLoc.getLatitude(), currentLoc.getLongitude(),
|
float dist = (float) MapUtils.getDistance(currentLoc.getLatitude(), currentLoc.getLongitude(),
|
||||||
centerLoc.getLatitude(), centerLoc.getLongitude());
|
centerLoc.getLatitude(), centerLoc.getLongitude());
|
||||||
|
|
Loading…
Reference in a new issue