public class ScalebarLayer extends AbstractLayer
Modifier and Type | Class and Description |
---|---|
protected class |
ScalebarLayer.OrderedImage |
Modifier and Type | Field and Description |
---|---|
protected int |
borderWidth |
protected java.awt.Color |
color |
protected java.awt.Font |
defaultFont |
protected long |
frameStampForDrawing |
protected long |
frameStampForPicking |
protected Vec4 |
locationCenter |
protected Vec4 |
locationOffset |
protected PickSupport |
pickSupport |
protected java.lang.String |
position |
protected java.lang.String |
resizeBehavior |
protected java.awt.Dimension |
size |
protected double |
toViewportScale |
protected java.lang.String |
unit |
static java.lang.String |
UNIT_IMPERIAL |
static java.lang.String |
UNIT_METRIC |
static java.lang.String |
UNIT_NAUTICAL |
Constructor and Description |
---|
ScalebarLayer()
Renders a scalebar graphic in a screen corner
|
Modifier and Type | Method and Description |
---|---|
protected void |
addOrderedImage(DrawContext dc) |
protected double |
computePixelSize(DrawContext dc,
Position referencePosition) |
void |
doPick(DrawContext dc,
java.awt.Point pickPoint) |
void |
doRender(DrawContext dc) |
void |
draw(DrawContext dc,
ScalebarLayer.OrderedImage orderedImage) |
int |
getBorderWidth() |
java.awt.Color |
getColor()
Get the scalebar color
|
java.awt.Font |
getFont()
Get the scalebar legend Fon
|
Vec4 |
getLocationCenter()
Returns the current scalebar center location.
|
Vec4 |
getLocationOffset()
Returns the current location offset.
|
java.lang.String |
getPosition() |
java.lang.String |
getResizeBehavior()
Returns the layer's resize behavior.
|
java.awt.Dimension |
getSize()
Get the scalebar graphic Dimension (in pixels)
|
double |
getToViewportScale()
Returns the scalebar-to-viewport scale factor.
|
java.lang.String |
getUnit() |
void |
setBorderWidth(int borderWidth)
Sets the scalebar offset from the viewport border.
|
void |
setColor(java.awt.Color color)
Set the scalbar Color
|
void |
setFont(java.awt.Font font)
Set the scalebar legend Fon
|
void |
setLocationCenter(Vec4 locationCenter)
Specifies the screen location of the scalebar center.
|
void |
setLocationOffset(Vec4 locationOffset)
Specifies a placement offset from the scalebar's position on the screen.
|
void |
setPosition(java.lang.String position)
Sets the relative viewport location to display the scalebar.
|
void |
setResizeBehavior(java.lang.String resizeBehavior)
Sets the behavior the layer uses to size the scalebar when the viewport size changes, typically when the World
Wind window is resized.
|
void |
setSize(java.awt.Dimension size)
Set the scalebar graphic Dimenion (in pixels)
|
void |
setToViewportScale(double toViewportScale)
Sets the scale factor applied to the viewport size to determine the displayed size of the scalebar.
|
void |
setUnit(java.lang.String unit)
Sets the unit the scalebar uses to display distances.
|
java.lang.String |
toString() |
createLayerConfigElements, dispose, doPreRender, getDataFileStore, getExpiryTime, getLayerConfigParams, getMaxActiveAltitude, getMaxEffectiveAltitude, getMinActiveAltitude, getMinEffectiveAltitude, getName, getOpacity, getRestorableState, getScale, getScreenCredit, isAtMaxResolution, isEnabled, isLayerActive, isLayerConfigDocument, isLayerInView, isMultiResolution, isNetworkRetrievalEnabled, isPickEnabled, pick, preRender, render, restoreState, setDataFileStore, setEnabled, setExpiryTime, setMaxActiveAltitude, setMinActiveAltitude, setName, setNetworkRetrievalEnabled, setOpacity, setPickEnabled, setScreenCredit
onMessage, propertyChange
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
onMessage
protected int borderWidth
protected java.awt.Color color
protected java.awt.Font defaultFont
protected long frameStampForDrawing
protected long frameStampForPicking
protected Vec4 locationCenter
protected Vec4 locationOffset
protected PickSupport pickSupport
protected java.lang.String position
protected java.lang.String resizeBehavior
protected java.awt.Dimension size
protected double toViewportScale
protected java.lang.String unit
public static final java.lang.String UNIT_IMPERIAL
public static final java.lang.String UNIT_METRIC
public static final java.lang.String UNIT_NAUTICAL
public ScalebarLayer()
protected void addOrderedImage(DrawContext dc)
protected double computePixelSize(DrawContext dc, Position referencePosition)
public void doPick(DrawContext dc, java.awt.Point pickPoint)
doPick
in class AbstractLayer
public void doRender(DrawContext dc)
doRender
in class AbstractLayer
public void draw(DrawContext dc, ScalebarLayer.OrderedImage orderedImage)
public int getBorderWidth()
public java.awt.Color getColor()
public java.awt.Font getFont()
public Vec4 getLocationCenter()
public Vec4 getLocationOffset()
public java.lang.String getPosition()
public java.lang.String getResizeBehavior()
public java.awt.Dimension getSize()
public double getToViewportScale()
public java.lang.String getUnit()
public void setBorderWidth(int borderWidth)
borderWidth
- the number of pixels to offset the scalebar from the borders indicated by setPosition(String)
.public void setColor(java.awt.Color color)
color
- the scalebar Colorpublic void setFont(java.awt.Font font)
font
- the scalebar legend Fontpublic void setLocationCenter(Vec4 locationCenter)
locationCenter
- the scalebar center. May be null.setPosition(java.lang.String)
,
setLocationOffset(gov.nasa.worldwind.geom.Vec4)
public void setLocationOffset(Vec4 locationOffset)
locationOffset
- the number of pixels to shift the scalebar from its specified screen position. A positive X
value shifts the image to the right. A positive Y value shifts the image up. If null, no
offset is applied. The default offset is null.setLocationCenter(gov.nasa.worldwind.geom.Vec4)
,
setPosition(java.lang.String)
public void setPosition(java.lang.String position)
position
- the desired scalebar positionpublic void setResizeBehavior(java.lang.String resizeBehavior)
resizeBehavior
- the desired resize behaviorpublic void setSize(java.awt.Dimension size)
size
- the scalebar graphic Dimensionpublic void setToViewportScale(double toViewportScale)
toViewportScale
- the scalebar to viewport scale factorpublic void setUnit(java.lang.String unit)
UNIT_METRIC
(the default), or UNIT_IMPERIAL
.unit
- the desired unitpublic java.lang.String toString()
toString
in class AbstractLayer