public class TLspScaleIndicator extends ALcdScaleIndicator
An ALcdScaleIndicator
implementation for ILspView
.
By default the indicator will only change if you zoom, not if you pan.
Call ALcdScaleIndicator.setScaleAtCenterOfMap(boolean)
to change this behavior.
//Create a scale indicator for the view
TLspScaleIndicator scaleIndicator = new TLspScaleIndicator(view);
//Optionally, change some settings on the scale indicator.
//Check the javadoc for all available customization options
scaleIndicator.setBarColor(Color.DARK_GRAY);
scaleIndicator.setAlternateBarColor(Color.LIGHT_GRAY);
which is then added to the south-east corner of an ILspAWTView
.
//Add the scale indicator in the overlay panel of the view
//This ensures that the scale label is placed on top of the map
view.getOverlayComponent().add(scaleIndicator.getLabel(), TLcdOverlayLayout.Location.SOUTH_EAST);
ALcdScaleIndicator.Representation
Constructor and Description |
---|
TLspScaleIndicator(ILspView aView)
Creates a new instance of TLspScaleIndicator for the specified view.
|
Modifier and Type | Method and Description |
---|---|
JLabel |
getLabel()
Returns a
JLabel containing this scale indicator as an icon. |
protected ILcdXYZWorldReference |
retrieveMapReference()
Returns the current world reference of the map, used to retrieve the world unit of measure.
|
protected double |
retrieveScale()
Returns the current view scale according to the
ALcdScaleIndicator.isScaleAtCenterOfMap() value. |
addPropertyChangeListener, calculateScaleIndication, clone, firePropertyChangeEvent, getAlternateBarColor, getBarColor, getBarHeight, getBarSegmentCount, getBarWidth, getDistanceUnit, getFont, getFractionFormat, getHaloColor, getIconHeight, getIconWidth, getLabelColor, getScaleRepresentation, isScaleAtCenterOfMap, paintIcon, removePropertyChangeListener, setAlternateBarColor, setBarColor, setBarHeight, setBarSegmentCount, setBarWidth, setDistanceUnit, setFont, setFractionFormat, setHaloColor, setLabelColor, setScaleAtCenterOfMap, setScaleRepresentation, toggleScaleRepresentation
public TLspScaleIndicator(ILspView aView)
aView
- the specified viewpublic JLabel getLabel()
JLabel
containing this scale indicator as an icon.
The returned label will automatically update and repaint itself when needed, for example on view changes
or when changing the settings of this scale indicator instance.
Additionally, clicking on the label will trigger the ALcdScaleIndicator.toggleScaleRepresentation()
method.protected double retrieveScale()
ALcdScaleIndicator
ALcdScaleIndicator.isScaleAtCenterOfMap()
value.retrieveScale
in class ALcdScaleIndicator
protected ILcdXYZWorldReference retrieveMapReference()
ALcdScaleIndicator
ILcdXYWorldReference
or
ILcdXYZWorldReference
.
This method will return null
if the reference is unknown, in which case the world unit
will be assumed to be 1 meter.retrieveMapReference
in class ALcdScaleIndicator
null
if it is unknown