Class TLspFXScaleIndicator
java.lang.Object
com.luciad.view.swing.ALcdScaleIndicator
com.luciad.view.lightspeed.javafx.TLspFXScaleIndicator
- All Implemented Interfaces:
ILcdIcon,ILcdChangeSource,ILcdCloneable,Serializable,Cloneable
A JavaFX 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
TLspFXScaleIndicator scaleIndicator = new TLspFXScaleIndicator(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);
TLspFXView, to the south-east corner of an AnchorPane.
//Add the view and the scale indicator to the same pane
//This ensures that the scale label is placed on top of the map
AnchorPane pane = new AnchorPane(view.getHostNode(), scaleIndicator.getNode());
AnchorPane.setTopAnchor(view.getHostNode(), 0.0);
AnchorPane.setBottomAnchor(view.getHostNode(), 0.0);
AnchorPane.setLeftAnchor(view.getHostNode(), 0.0);
AnchorPane.setRightAnchor(view.getHostNode(), 0.0);
AnchorPane.setRightAnchor(scaleIndicator.getNode(), 10.0);
AnchorPane.setBottomAnchor(scaleIndicator.getNode(), 10.0);
//The AnchorPane now can be shown on a javafx.scene.Scene instance
- Since:
- 2019.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.luciad.view.swing.ALcdScaleIndicator
ALcdScaleIndicator.Representation -
Constructor Summary
ConstructorsConstructorDescriptionTLspFXScaleIndicator(ILspView aView) Creates a new instance of TLspFXScaleIndicator for the specified view. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChangeListener(ILcdChangeListener aListener) Registers the given listener so it will receive change events from this source.getNode()Returns aNodecontaining this scale indicator as an icon.voidremoveChangeListener(ILcdChangeListener aListener) Removes the specified listener so it is no longer notified.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
-
TLspFXScaleIndicator
Creates a new instance of TLspFXScaleIndicator for the specified view.- Parameters:
aView- the specified view
-
-
Method Details
-
getNode
Returns aNodecontaining this scale indicator as an icon. The returned Node will automatically refresh itself when needed, for example on view changes or when changing the settings of this scale indicator instance. Additionally, clicking on the scale indicator will trigger theALcdScaleIndicator.toggleScaleRepresentation()method.- Returns:
- a Node containing this scale indicator as an icon.
- Since:
- 2020.0
-
addChangeListener
Description copied from interface:ILcdChangeSourceRegisters the given listener so it will receive change events from this source.
In case you need to register a listener which keeps a reference to an object with a shorter life-time than this change source, you can use a
ALcdWeakChangeListenerinstance as change listener.- Specified by:
addChangeListenerin interfaceILcdChangeSource- Parameters:
aListener- The listener to be notified when a change has happened.- See Also:
-
removeChangeListener
Description copied from interface:ILcdChangeSourceRemoves the specified listener so it is no longer notified.- Specified by:
removeChangeListenerin interfaceILcdChangeSource- Parameters:
aListener- The listener to remove.
-
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
-