Skip to content

Commit

Permalink
DefaultMapScaleBar: allow override draw
Browse files Browse the repository at this point in the history
  • Loading branch information
devemux86 committed Jan 13, 2024
1 parent 2a7fa50 commit f6aa01a
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions vtm/src/org/oscim/scalebar/DefaultMapScaleBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@
public class DefaultMapScaleBar extends MapScaleBar {
public static int BITMAP_HEIGHT = 40;
public static int BITMAP_WIDTH = 120;
private static final int DEFAULT_HORIZONTAL_MARGIN = 5;
private static final int DEFAULT_VERTICAL_MARGIN = 0;
private static final int SCALE_BAR_MARGIN = 10;
private static final float STROKE_EXTERNAL = 4;
private static final float STROKE_INTERNAL = 2;
private static final int TEXT_MARGIN = 1;
public static final int DEFAULT_HORIZONTAL_MARGIN = 5;
public static final int DEFAULT_VERTICAL_MARGIN = 0;
public static final int SCALE_BAR_MARGIN = 10;
public static final float STROKE_EXTERNAL = 4;
public static final float STROKE_INTERNAL = 2;
public static final int TEXT_MARGIN = 1;

public enum ScaleBarMode {BOTH, SINGLE}

private ScaleBarMode scaleBarMode;
private DistanceUnitAdapter secondaryDistanceUnitAdapter;

private final Paint paintScaleBar;
private final Paint paintScaleBarStroke;
private final Paint paintScaleText;
private final Paint paintScaleTextStroke;
protected final Paint paintScaleBar;
protected final Paint paintScaleBarStroke;
protected final Paint paintScaleText;
protected final Paint paintScaleTextStroke;

public DefaultMapScaleBar(Map map) {
this(map, CanvasAdapter.getScale());
Expand Down Expand Up @@ -142,7 +142,7 @@ protected void redraw(Canvas canvas) {
drawScaleText(canvas, scaleText1, scaleText2, this.paintScaleText, this.scale);
}

private void drawScaleBar(Canvas canvas, int scaleBarLength1, int scaleBarLength2, Paint paint, float scale) {
protected void drawScaleBar(Canvas canvas, int scaleBarLength1, int scaleBarLength2, Paint paint, float scale) {
int maxScaleBarLength = Math.max(scaleBarLength1, scaleBarLength2);

switch (scaleBarPosition) {
Expand Down Expand Up @@ -263,7 +263,7 @@ private void drawScaleBar(Canvas canvas, int scaleBarLength1, int scaleBarLength
}
}

private void drawScaleText(Canvas canvas, String scaleText1, String scaleText2, Paint paint, float scale) {
protected void drawScaleText(Canvas canvas, String scaleText1, String scaleText2, Paint paint, float scale) {
switch (scaleBarPosition) {
case BOTTOM_CENTER:
if (scaleText2.length() == 0) {
Expand Down

0 comments on commit f6aa01a

Please sign in to comment.