Package com.luciad.view.gxy.swing
Class TLcdGXYScaleIndicator
java.lang.Object
com.luciad.view.swing.ALcdScaleIndicator
com.luciad.view.gxy.swing.TLcdGXYScaleIndicator
- All Implemented Interfaces:
ILcdIcon,ILcdCloneable,Serializable,Cloneable
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);
//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);
- Since:
- 2012.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.luciad.view.swing.ALcdScaleIndicator
ALcdScaleIndicator.Representation -
Constructor Summary
ConstructorsConstructorDescriptionTLcdGXYScaleIndicator(ILcdGXYView aView) Creates a newTLcdGXYScaleIndicatorfor the specifiedILcdGXYView -
Method Summary
Modifier and TypeMethodDescriptiongetLabel()Returns aJLabelcontaining this scale indicator as an icon.protected ILcdXYWorldReferenceReturns the current world reference of the map, used to retrieve the world unit of measure.protected doubleReturns the current view scale according to theALcdScaleIndicator.isScaleAtCenterOfMap()value.Methods inherited from class com.luciad.view.swing.ALcdScaleIndicator
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
-
Constructor Details
-
TLcdGXYScaleIndicator
Creates a newTLcdGXYScaleIndicatorfor the specifiedILcdGXYView- Parameters:
aView- the specified view
-
-
Method Details
-
getLabel
Returns aJLabelcontaining 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 theALcdScaleIndicator.toggleScaleRepresentation()method.- Returns:
- a label containing this scale indicator as an icon.
- Since:
- 2020.0
-
retrieveScale
protected double retrieveScale()Description copied from class:ALcdScaleIndicatorReturns the current view scale according to theALcdScaleIndicator.isScaleAtCenterOfMap()value.- Specified by:
retrieveScalein classALcdScaleIndicator- Returns:
- the current scale in toolkit pixels per meter.
-
retrieveMapReference
Description copied from class:ALcdScaleIndicatorReturns the current world reference of the map, used to retrieve the world unit of measure. EitherILcdXYWorldReferenceorILcdXYZWorldReference. This method will returnnullif the reference is unknown, in which case the world unit will be assumed to be 1 meter.- Overrides:
retrieveMapReferencein classALcdScaleIndicator- Returns:
- the current world reference of the map, or
nullif it is unknown
-