public class WorldMapLayer extends AbstractLayer
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 Color |
backColor |
protected int |
borderWidth |
protected Color |
color |
protected ArrayList<? extends LatLon> |
footPrintPositions |
protected long |
frameStampForDrawing |
protected long |
frameStampForPicking |
protected 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 String |
position |
protected 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(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(Rectangle viewport,
double scale) |
protected Position |
computePickPosition(DrawContext dc,
Vec4 locationSW,
Dimension mapSize)
Computes the lat/lon of the pickPoint over the world map
|
protected double |
computeScale(Rectangle viewport) |
protected ArrayList<LatLon> |
computeViewFootPrint(DrawContext dc,
int steps)
Compute the view range footprint on the globe.
|
void |
doPick(DrawContext dc,
Point pickPoint) |
void |
doRender(DrawContext dc) |
protected void |
drawIcon(DrawContext dc) |
Color |
getBackgrounColor() |
int |
getBorderWidth() |
List<? extends LatLon> |
getFootPrintPositions()
Get the current view footprint position list.
|
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.
|
String |
getPosition()
Returns the current relative world map icon position.
|
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(Color color) |
void |
setBorderWidth(int borderWidth)
Sets the world map icon offset from the viewport border.
|
void |
setIconFilePath(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(String position)
Sets the relative viewport location to display the world map icon.
|
void |
setResizeBehavior(String resizeBehavior)
Sets the behavior the layer uses to size the world map icon when the viewport size changes, typically when the
World Wind 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.
|
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
propertyChange
onMessage
protected Color backColor
protected int borderWidth
protected Color color
protected long frameStampForDrawing
protected long frameStampForPicking
protected 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 String position
protected String resizeBehavior
protected boolean showFootprint
protected double toViewportScale
public WorldMapLayer()
public WorldMapLayer(String iconFilePath)
iconFilePath
- the world map image path and filenameprotected Position computeGroundPosition(DrawContext dc, View view)
dc
- the current DrawContextview
- the current Viewprotected Position computePickPosition(DrawContext dc, Vec4 locationSW, 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(Rectangle viewport)
protected 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, Point pickPoint)
doPick
in class AbstractLayer
public void doRender(DrawContext dc)
doRender
in class AbstractLayer
protected void drawIcon(DrawContext dc)
public Color getBackgrounColor()
public int getBorderWidth()
public List<? extends LatLon> getFootPrintPositions()
public String getIconFilePath()
public double getIconScale()
setIconScale(double)
for a description of the scale factor.public Vec4 getLocationCenter()
public Vec4 getLocationOffset()
public String getPosition()
public String getResizeBehavior()
protected double getScaledIconHeight()
protected double getScaledIconWidth()
public boolean getShowFootprint()
public double getToViewportScale()
protected void initializeTexture(DrawContext dc)
public void setBackgroundColor(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(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(String position)
position
- the desired world map positionpublic void setResizeBehavior(String resizeBehavior)
resizeBehavior
- the desired resize behaviorpublic void setShowFootprint(boolean state)
public void setToViewportScale(double toViewportScale)
toViewportScale
- the world map to viewport scale factorpublic String toString()
toString
in class AbstractLayer