public final class TLcdMapScale extends Object implements Comparable<TLcdMapScale>
// Both statements create a map scale of 1 : 50 000
new TLcdMapScale(1d / 50_000d);
TLcdMapScale.fromDenominator(50_000);
In the case when the unit of measure is of a different type (for example, time or temperature),
the scale is the ratio of 1 meter on the screen per units of measure.
For example, such a scale might express something like 1 meter equals 5 hours.
This class gives a natural ordering to map scales, from zoomed out to zoomed in, which is easy to check.
When a part of the API takes an ordered collection as input, it must be ordered according to this natural ordering
(unless stated otherwise).
To interpret map scales values correctly, the view needs to know the DPI value of the screen on which it is rendered.
You can override the auto-detected value by passing it using the system property luciad.dpi
, e.g. -Dluciad.dpi=120
Modifier and Type | Class and Description |
---|---|
static class |
TLcdMapScale.ScaleComparison
Enumeration to help compare scales.
|
static class |
TLcdMapScale.ScaleLocation
Defines how a map scale is measured.
|
Modifier and Type | Field and Description |
---|---|
static TLcdMapScale |
MAX_ZOOMED_IN
The value that represents a maximally zoomed in map scale (1:0 ≈ the maximum double value)
|
static TLcdMapScale |
MAX_ZOOMED_OUT
The value that represents a maximally zoomed out map scale (1:inf == 0)
|
Constructor and Description |
---|
TLcdMapScale(double value)
Creates a new MapScale based on the given ratio
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(TLcdMapScale aOther)
Compares this scale with the given one.
|
static TLcdDimensionInterval<TLcdMapScale> |
createScaleRange(TLcdMapScale aMostZoomedOutValue,
TLcdMapScale aMostZoomedInValue)
Creates a scale range based on the given minimum and maximum map scale values.
|
boolean |
equals(Object aO) |
static TLcdMapScale |
fromDenominator(double denominator)
Creates a map scale defined by the given map scale denominator.
|
double |
getDenominator() |
double |
getValue() |
int |
hashCode() |
boolean |
is(TLcdMapScale.ScaleComparison aComparison,
TLcdMapScale aOther)
Convenience method for readable scale comparisons.
|
String |
toString() |
TLcdMapScale |
zoomIn(double factor) |
TLcdMapScale |
zoomOut(double factor) |
public static final TLcdMapScale MAX_ZOOMED_OUT
public static final TLcdMapScale MAX_ZOOMED_IN
public TLcdMapScale(double value)
value
- a value that represents 1 / denominator. For example: a MapScale of 1:50000 can be created using 0.00002 (=1/50000) as value.public static TLcdMapScale fromDenominator(double denominator)
denominator
- the scale denominator. For example when using 1:50000 as map scale, the denominator is 50000.public static TLcdDimensionInterval<TLcdMapScale> createScaleRange(TLcdMapScale aMostZoomedOutValue, TLcdMapScale aMostZoomedInValue)
aMostZoomedOutValue
- the minimum, most zoomed out map scale (included)aMostZoomedInValue
- the maximum, most zoomed in map scale (excluded)public TLcdMapScale zoomOut(double factor)
factor
- the factor using which to zoom outpublic TLcdMapScale zoomIn(double factor)
factor
- the factor using which to zoom inpublic double getDenominator()
public double getValue()
public int compareTo(TLcdMapScale aOther)
compareTo
in interface Comparable<TLcdMapScale>
aOther
- the scale to compare this scale withis(ScaleComparison, TLcdMapScale)
public boolean is(TLcdMapScale.ScaleComparison aComparison, TLcdMapScale aOther)
aComparison
- how to compare the valuesaOther
- the other scale to compare with