Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DefaultMapScaleBar: allow override draw #1093

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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