Package com.luciad.view.lightspeed.swing
Class TLspScaleIndicator
java.lang.Object
com.luciad.view.swing.ALcdScaleIndicator
com.luciad.view.lightspeed.swing.TLspScaleIndicator
- All Implemented Interfaces:
ILcdIcon,ILcdCloneable,Serializable,Cloneable
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);
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);
- Since:
- 2012.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.luciad.view.swing.ALcdScaleIndicator
ALcdScaleIndicator.Representation -
Constructor Summary
ConstructorsConstructorDescriptionTLspScaleIndicator(ILspView aView) Creates a new instance of TLspScaleIndicator for the specified view. -
Method Summary
Modifier and TypeMethodDescriptiongetLabel()Returns aJLabelcontaining this scale indicator as an icon.protected ILcdXYZWorldReferenceReturns 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
-
TLspScaleIndicator
Creates a new instance of TLspScaleIndicator for the specified view.- 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
-