MapScaleBar: fix scaling
This commit is contained in:
parent
ae04fa83f6
commit
0dd82cb68f
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
|
||||
* Copyright 2014 Ludwig M Brinckmann
|
||||
* Copyright 2014-2017 devemux86
|
||||
* Copyright 2014-2019 devemux86
|
||||
* Copyright 2014 Erik Duisters
|
||||
* Copyright 2014 Christian Pesch
|
||||
*
|
||||
@ -39,7 +39,6 @@ public class DefaultMapScaleBar extends MapScaleBar {
|
||||
|
||||
public enum ScaleBarMode {BOTH, SINGLE}
|
||||
|
||||
private final float scale;
|
||||
private ScaleBarMode scaleBarMode;
|
||||
private DistanceUnitAdapter secondaryDistanceUnitAdapter;
|
||||
|
||||
@ -53,12 +52,11 @@ public class DefaultMapScaleBar extends MapScaleBar {
|
||||
}
|
||||
|
||||
public DefaultMapScaleBar(Map map, float scale) {
|
||||
super(map, (int) (BITMAP_WIDTH * scale), (int) (BITMAP_HEIGHT * scale));
|
||||
super(map, (int) (BITMAP_WIDTH * scale), (int) (BITMAP_HEIGHT * scale), scale);
|
||||
|
||||
setMarginHorizontal((int) (DEFAULT_HORIZONTAL_MARGIN * scale));
|
||||
setMarginVertical((int) (DEFAULT_VERTICAL_MARGIN * scale));
|
||||
|
||||
this.scale = scale;
|
||||
this.scaleBarMode = ScaleBarMode.BOTH;
|
||||
this.secondaryDistanceUnitAdapter = ImperialUnitAdapter.INSTANCE;
|
||||
|
||||
|
||||
@ -44,8 +44,9 @@ public abstract class MapScaleBar {
|
||||
protected Canvas mapScaleCanvas;
|
||||
private int marginHorizontal;
|
||||
private int marginVertical;
|
||||
private final MapPosition prevMapPosition = new MapPosition();
|
||||
protected final MapPosition prevMapPosition = new MapPosition();
|
||||
protected boolean redrawNeeded;
|
||||
protected final float scale;
|
||||
protected ScaleBarPosition scaleBarPosition;
|
||||
private boolean visible;
|
||||
|
||||
@ -62,9 +63,10 @@ public abstract class MapScaleBar {
|
||||
}
|
||||
}
|
||||
|
||||
public MapScaleBar(Map map, int width, int height) {
|
||||
public MapScaleBar(Map map, int width, int height, float scale) {
|
||||
this.map = map;
|
||||
this.mapScaleBitmap = CanvasAdapter.newBitmap(width, height, 0);
|
||||
this.scale = scale;
|
||||
|
||||
this.scaleBarPosition = DEFAULT_SCALE_BAR_POSITION;
|
||||
|
||||
@ -206,7 +208,7 @@ public abstract class MapScaleBar {
|
||||
for (int scaleBarValue : scaleBarValues) {
|
||||
mapScaleValue = scaleBarValue;
|
||||
scaleBarLength = (int) (mapScaleValue / groundResolution);
|
||||
if (scaleBarLength < (this.mapScaleBitmap.getWidth() - 10)) {
|
||||
if (scaleBarLength < (this.mapScaleBitmap.getWidth() - 10 * this.scale)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user