public class WorldMapLayer extends AbstractLayer
A ClickAndGoSelectListener
can be used in conjunction with this layer to move
the view to a selected location when that location is clicked within the layer's map. Specify
WorldMapLayer.class
when constructing the ClickAndGoSelectListener
.
Note: This layer may not be shared among multiple WorldWindow
s.
Modifier and Type | Class and Description |
---|---|
protected class |
WorldMapLayer.OrderedIcon |
Modifier and Type | Field and Description |
---|---|
protected java.awt.Color |
backColor |
protected int |
borderWidth |
protected java.awt.Color |
color |
protected java.util.ArrayList<? extends LatLon> |
footPrintPositions |
protected long |
frameStampForDrawing |
protected long |
frameStampForPicking |
protected java.lang.String |
iconFilePath |
protected int |
iconHeight |
protected double |
iconScale |
protected int |
iconWidth |
protected Vec4 |
locationCenter |
protected Vec4 |
locationOffset |
protected WorldMapLayer.OrderedIcon |
orderedImage |
protected PickSupport |
pickSupport |
protected java.lang.String |
position |
protected java.lang.String |
resizeBehavior |
protected boolean |
showFootprint |
protected double |
toViewportScale |
Constructor and Description |
---|
WorldMapLayer()
Displays a world map overlay with a current position crosshair in a screen corner
|
WorldMapLayer(java.lang.String iconFilePath)
Displays a world map overlay with a current position crosshair in a screen corner
|
Modifier and Type | Method and Description |
---|---|
protected Position |
computeGroundPosition(DrawContext dc,
View view)
Compute the lat/lon position of the view center
|
protected Vec4 |
computeLocation(java.awt.Rectangle viewport,
double scale) |
protected Position |
computePickPosition(DrawContext dc,
Vec4 locationSW,
java.awt.Dimension mapSize)
Computes the lat/lon of the pickPoint over the world map
|
protected double |
computeScale(java.awt.Rectangle viewport) |
protected java.util.ArrayList<LatLon> |
computeViewFootPrint(DrawContext dc,
int steps)
Compute the view range footprint on the globe.
|
void |
doPick(DrawContext dc,
java.awt.Point pickPoint) |
void |
doRender(DrawContext dc) |
protected void |
drawIcon(DrawContext dc) |
java.awt.Color |
getBackgrounColor() |
int |
getBorderWidth() |
java.util.List<? extends LatLon> |
getFootPrintPositions()
Get the current view footprint position list.
|
java.lang.String |
getIconFilePath()
Returns the layer's current icon file path.
|
double |
getIconScale()
Returns the icon scale factor.
|
Vec4 |
getLocationCenter()
Returns the current worldmap image location.
|
Vec4 |
getLocationOffset()
Returns the current location offset.
|
java.lang.String |
getPosition()
Returns the current relative world map icon position.
|
java.lang.String |
getResizeBehavior()
Returns the world map icon's resize behavior.
|
protected double |
getScaledIconHeight() |
protected double |
getScaledIconWidth() |
boolean |
getShowFootprint() |
double |
getToViewportScale()
Returns the layer's world map-to-viewport scale factor.
|
protected void |
initializeTexture(DrawContext dc) |
void |
setBackgroundColor(java.awt.Color color) |
void |
setBorderWidth(int borderWidth)
Sets the world map icon offset from the viewport border.
|
void |
setIconFilePath(java.lang.String iconFilePath)
Sets the world map icon's image location.
|
void |
setIconScale(double iconScale)
Sets the scale factor defining the displayed size of the world map icon relative to the icon's width and height
in its image file.
|
void |
setLocationCenter(Vec4 locationCenter)
Specifies the screen location of the worldmap image, relative to the image's center.
|
void |
setLocationOffset(Vec4 locationOffset)
Specifies a placement offset from the worldmap's position on the screen.
|
void |
setPosition(java.lang.String position)
Sets the relative viewport location to display the world map icon.
|
void |
setResizeBehavior(java.lang.String resizeBehavior)
Sets the behavior the layer uses to size the world map icon when the viewport size changes, typically when the
WorldWind window is resized.
|
void |
setShowFootprint(boolean state) |
void |
setToViewportScale(double toViewportScale)
Sets the scale factor applied to the viewport size to determine the displayed size of the world map icon.
|
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 java.awt.Color backColor
protected int borderWidth
protected java.awt.Color color
protected java.util.ArrayList<? extends LatLon> footPrintPositions
protected long frameStampForDrawing
protected long frameStampForPicking
protected java.lang.String iconFilePath
protected int iconHeight
protected double iconScale
protected int iconWidth
protected Vec4 locationCenter
protected Vec4 locationOffset
protected WorldMapLayer.OrderedIcon orderedImage
protected PickSupport pickSupport
protected java.lang.String position
protected java.lang.String resizeBehavior
protected boolean showFootprint
protected double toViewportScale
public WorldMapLayer()
public WorldMapLayer(java.lang.String iconFilePath)
iconFilePath
- the world map image path and filenameprotected Position computeGroundPosition(DrawContext dc, View view)
dc
- the current DrawContextview
- the current Viewprotected Vec4 computeLocation(java.awt.Rectangle viewport, double scale)
protected Position computePickPosition(DrawContext dc, Vec4 locationSW, java.awt.Dimension mapSize)
dc
- the current DrawContext
locationSW
- the screen location of the bottom left corner of the mapmapSize
- the world map screen dimension in pixelsprotected double computeScale(java.awt.Rectangle viewport)
protected java.util.ArrayList<LatLon> computeViewFootPrint(DrawContext dc, int steps)
dc
- the current DrawContext
steps
- the number of steps.LatLon
forming a closed shape.public void doPick(DrawContext dc, java.awt.Point pickPoint)
doPick
in class AbstractLayer
public void doRender(DrawContext dc)
doRender
in class AbstractLayer
protected void drawIcon(DrawContext dc)
public java.awt.Color getBackgrounColor()
public int getBorderWidth()
public java.util.List<? extends LatLon> getFootPrintPositions()
public java.lang.String getIconFilePath()
public double getIconScale()
setIconScale(double)
for a description of the scale factor.public Vec4 getLocationCenter()
public Vec4 getLocationOffset()
public java.lang.String getPosition()
public java.lang.String getResizeBehavior()
protected double getScaledIconHeight()
protected double getScaledIconWidth()
public boolean getShowFootprint()
public double getToViewportScale()
protected void initializeTexture(DrawContext dc)
public void setBackgroundColor(java.awt.Color color)
public void setBorderWidth(int borderWidth)
borderWidth
- the number of pixels to offset the world map icon from the borders indicated by setPosition(String)
.public void setIconFilePath(java.lang.String iconFilePath)
iconFilePath
- the path to the icon's image filepublic void setIconScale(double iconScale)
setToViewportScale(double)
and the current viewport size.iconScale
- the icon scale factorpublic void setLocationCenter(Vec4 locationCenter)
locationCenter
- the location center. May be null.the screen location at which to place the map.
public void setLocationOffset(Vec4 locationOffset)
locationOffset
- the number of pixels to shift the worldmap image 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(String)
public void setPosition(java.lang.String position)
position
- the desired world map positionpublic void setResizeBehavior(java.lang.String resizeBehavior)
resizeBehavior
- the desired resize behaviorpublic void setShowFootprint(boolean state)
public void setToViewportScale(double toViewportScale)
toViewportScale
- the world map to viewport scale factorpublic java.lang.String toString()
toString
in class AbstractLayer