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 net.osmand.Location;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.QuadPoint;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -19,22 +18,12 @@ public class RulerControlLayer extends OsmandMapLayer {
|
|||
private Bitmap centerIcon;
|
||||
private Paint bitmapPaint;
|
||||
private Paint linePaint;
|
||||
private Location currentLoc;
|
||||
private LatLon centerLoc;
|
||||
private MapActivity mapActivity;
|
||||
|
||||
public RulerControlLayer(MapActivity mapActivity) {
|
||||
this.mapActivity = mapActivity;
|
||||
}
|
||||
|
||||
public Location getCurrentLoc() {
|
||||
return currentLoc;
|
||||
}
|
||||
|
||||
public LatLon getCenterLoc() {
|
||||
return centerLoc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initLayer(OsmandMapTileView view) {
|
||||
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,
|
||||
centerPos.y - centerIcon.getHeight() / 2, bitmapPaint);
|
||||
canvas.rotate(tileBox.getRotate(), centerPos.x, centerPos.y);
|
||||
centerLoc = tileBox.getCenterLatLon();
|
||||
currentLoc = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
|
||||
Location currentLoc = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
|
||||
if (currentLoc != null) {
|
||||
int currentLocX = tileBox.getPixXFromLonNoRot(currentLoc.getLongitude());
|
||||
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.RoutingHelper;
|
||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||
import net.osmand.plus.views.RulerControlLayer;
|
||||
import net.osmand.plus.views.mapwidgets.NextTurnInfoWidget.TurnDrawable;
|
||||
import net.osmand.router.TurnType;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
@ -111,13 +110,12 @@ public class MapInfoWidgetsFactory {
|
|||
}
|
||||
|
||||
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 TextInfoWidget rulerControl = new TextInfoWidget(map) {
|
||||
@Override
|
||||
public boolean updateInfo(DrawSettings drawSettings) {
|
||||
Location currentLoc = rulerLayer.getCurrentLoc();
|
||||
LatLon centerLoc = rulerLayer.getCenterLoc();
|
||||
Location currentLoc = map.getMyApplication().getLocationProvider().getLastKnownLocation();
|
||||
LatLon centerLoc = map.getMapLocation();
|
||||
if (currentLoc != null && centerLoc != null) {
|
||||
float dist = (float) MapUtils.getDistance(currentLoc.getLatitude(), currentLoc.getLongitude(),
|
||||
centerLoc.getLatitude(), centerLoc.getLongitude());
|
||||
|
|
Loading…
Reference in a new issue