Skip to content
Permalink
Browse files

Scale bar: allow extend unit adapters

  • Loading branch information...
devemux86 committed Aug 27, 2019
1 parent 06f63ba commit 08e5b5118c2f0e9e3b9976a1eab0fab5a0deabd8
@@ -1,5 +1,6 @@
/*
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
* Copyright 2019 devemux86
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
@@ -14,17 +15,13 @@
*/
package org.mapsforge.map.scalebar;

public final class ImperialUnitAdapter implements DistanceUnitAdapter {
public class ImperialUnitAdapter implements DistanceUnitAdapter {
public static final ImperialUnitAdapter INSTANCE = new ImperialUnitAdapter();
private static final double METER_FOOT_RATIO = 0.3048;
private static final int ONE_MILE = 5280;
private static final int[] SCALE_BAR_VALUES = {26400000, 10560000, 5280000, 2640000, 1056000, 528000, 264000,
public static final double METER_FOOT_RATIO = 0.3048;
public static final int ONE_MILE = 5280;
public static final int[] SCALE_BAR_VALUES = {26400000, 10560000, 5280000, 2640000, 1056000, 528000, 264000,
105600, 52800, 26400, 10560, 5280, 2000, 1000, 500, 200, 100, 50, 20, 10, 5, 2, 1};

private ImperialUnitAdapter() {
// do nothing
}

@Override
public double getMeterRatio() {
return METER_FOOT_RATIO;
@@ -1,5 +1,6 @@
/*
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
* Copyright 2019 devemux86
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
@@ -14,16 +15,12 @@
*/
package org.mapsforge.map.scalebar;

public final class MetricUnitAdapter implements DistanceUnitAdapter {
public class MetricUnitAdapter implements DistanceUnitAdapter {
public static final MetricUnitAdapter INSTANCE = new MetricUnitAdapter();
private static final int ONE_KILOMETER = 1000;
private static final int[] SCALE_BAR_VALUES = {10000000, 5000000, 2000000, 1000000, 500000, 200000, 100000, 50000,
public static final int ONE_KILOMETER = 1000;
public static final int[] SCALE_BAR_VALUES = {10000000, 5000000, 2000000, 1000000, 500000, 200000, 100000, 50000,
20000, 10000, 5000, 2000, 1000, 500, 200, 100, 50, 20, 10, 5, 2, 1};

private MetricUnitAdapter() {
// do nothing
}

@Override
public double getMeterRatio() {
return 1;
@@ -1,6 +1,6 @@
/*
* Copyright 2014 Christian Pesch
* Copyright 2014, 2015 devemux86
* Copyright 2014-2019 devemux86
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
@@ -15,16 +15,12 @@
*/
package org.mapsforge.map.scalebar;

public final class NauticalUnitAdapter implements DistanceUnitAdapter {
public class NauticalUnitAdapter implements DistanceUnitAdapter {
public static final NauticalUnitAdapter INSTANCE = new NauticalUnitAdapter();
private static final int ONE_MILE = 1852;
private static final int[] SCALE_BAR_VALUES = {9260000, 3704000, 1852000, 926000, 370400, 185200, 92600,
public static final int ONE_MILE = 1852;
public static final int[] SCALE_BAR_VALUES = {9260000, 3704000, 1852000, 926000, 370400, 185200, 92600,
37040, 18520, 9260, 3704, 1852, 926, 500, 200, 100, 50, 20, 10, 5, 2, 1};

private NauticalUnitAdapter() {
// do nothing
}

@Override
public double getMeterRatio() {
return 1;

0 comments on commit 08e5b51

Please sign in to comment.
You can’t perform that action at this time.