public class TLcdGXYScaleIndicator extends ALcdScaleIndicator
An ALcdScaleIndicator
implementation for ILcdGXYView
instances.
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
TLcdGXYScaleIndicator scaleIndicator = new TLcdGXYScaleIndicator(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 overlay container of a GXY view.
//Add the scale indicator in an overlay panel that is placed on top of the view
//This ensures that the scale label is placed on top of the map
viewOverlayPanel.add(scaleIndicator.getLabel(), TLcdOverlayLayout.Location.SOUTH_EAST);
ALcdScaleIndicator.Representation
Constructor and Description |
---|
TLcdGXYScaleIndicator(ILcdGXYView aView)
Creates a new
TLcdGXYScaleIndicator for the specified ILcdGXYView |
Modifier and Type | Method and Description |
---|---|
JLabel |
getLabel()
Returns a
JLabel containing this scale indicator as an icon. |
protected ILcdXYWorldReference |
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 TLcdGXYScaleIndicator(ILcdGXYView aView)
TLcdGXYScaleIndicator
for the specified ILcdGXYView
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 ILcdXYWorldReference 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