Class TLcdMapScale
- All Implemented Interfaces:
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
See the Working with map scales tutorial for more information.
- Since:
- 2021.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enumeration to help compare scales.static enum
Defines how a map scale is measured. -
Field Summary
Modifier and TypeFieldDescriptionstatic final TLcdMapScale
The value that represents a maximally zoomed in map scale (1:0 ≈ the maximum double value)static final TLcdMapScale
The value that represents a maximally zoomed out map scale (1:inf == 0) -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
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
static TLcdMapScale
fromDenominator
(double denominator) Creates a map scale defined by the given map scale denominator.double
double
getValue()
int
hashCode()
boolean
is
(TLcdMapScale.ScaleComparison aComparison, TLcdMapScale aOther) Convenience method for readable scale comparisons.toString()
zoomIn
(double factor) zoomOut
(double factor)
-
Field Details
-
Constructor Details
-
Method Details
-
fromDenominator
Creates a map scale defined by the given map scale denominator.- Parameters:
denominator
- the scale denominator. For example when using 1:50000 as map scale, the denominator is 50000.- Returns:
- a map scale that corresponds to 1:denominator
-
createScaleRange
public static TLcdDimensionInterval<TLcdMapScale> createScaleRange(TLcdMapScale aMostZoomedOutValue, TLcdMapScale aMostZoomedInValue) Creates a scale range based on the given minimum and maximum map scale values.- Parameters:
aMostZoomedOutValue
- the minimum, most zoomed out map scale (included)aMostZoomedInValue
- the maximum, most zoomed in map scale (excluded)- Returns:
- an interval defining the scale range
-
zoomOut
- Parameters:
factor
- the factor using which to zoom out- Returns:
- a new map scale that is zoomed out using the given factor. For example, when applying this method on a 1 : 50 000 scale, with a factor or 2, the resulting map scale will be 1 : 100 000
-
zoomIn
- Parameters:
factor
- the factor using which to zoom in- Returns:
- a new map scale that is zoomed in using the given factor. For example, when applying this method on a 1 : 50 000 scale, with a factor or 2, the resulting map scale will be 1 : 25 000
-
getDenominator
public double getDenominator()- Returns:
- the denominator of this map scale. For example when the Map Scale is 1 : 50 000, this method will return 50000.
-
getValue
public double getValue()- Returns:
- the scale value
-
compareTo
Compares this scale with the given one.- Specified by:
compareTo
in interfaceComparable<TLcdMapScale>
- Parameters:
aOther
- the scale to compare this scale with- Returns:
- zero if both scales are equal, less than zero if this scale is smaller (i.e. more zoomed out), more than zero if this scale is larger (i.e. more zoomed in).
- See Also:
-
is
Convenience method for readable scale comparisons.- Parameters:
aComparison
- how to compare the valuesaOther
- the other scale to compare with- Returns:
- true if the comparison statement holds
-
equals
-
hashCode
public int hashCode() -
toString
-