public class SurfaceIcon extends AbstractSurfaceRenderable implements Movable, Draggable
| Modifier and Type | Class and Description |
|---|---|
protected static class |
SurfaceIcon.SectorInfo |
AbstractSurfaceObject.CacheEntry, AbstractSurfaceObject.SurfaceObjectStateKey| Modifier and Type | Field and Description |
|---|---|
protected boolean |
dragEnabled |
protected DraggableSupport |
draggableSupport |
protected int |
imageHeight |
protected int |
imageWidth |
protected WWTexture |
texture |
delegateOwner, drawBoundingSectors, enableBatchPicking, extentCache, lastModifiedTime, nextUniqueId, pickLayer, pickSupport, pickTileBuilder, uniqueId, visible| Constructor and Description |
|---|
SurfaceIcon(java.lang.Object imageSource) |
SurfaceIcon(java.lang.Object imageSource,
LatLon location) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
applyDrawColor(DrawContext dc) |
protected void |
applyDrawTransform(DrawContext dc,
SurfaceTileDrawContext sdc,
LatLon location,
double drawScale) |
protected void |
beginDraw(DrawContext dc) |
protected java.awt.geom.Rectangle2D.Double |
computeDrawDimension(double pixelSize) |
protected java.awt.geom.Rectangle2D.Double |
computeDrawDimension(DrawContext dc,
LatLon location) |
protected Angle |
computeDrawHeading(DrawContext dc) |
protected double |
computeDrawScale(DrawContext dc,
SurfaceTileDrawContext sdc,
LatLon location) |
protected java.util.List<Sector> |
computeSectors(DrawContext dc) |
protected void |
doDrag(DragContext dragContext) |
void |
drag(DragContext dragContext)
Drag the object given the provided
DragContext. |
void |
drawGeographic(DrawContext dc,
SurfaceTileDrawContext sdc)
Causes the SurfaceObject to render itself to the specified region in geographic coordinates.
|
protected void |
drawIcon(DrawContext dc,
SurfaceTileDrawContext sdc) |
protected void |
endDraw(DrawContext dc) |
java.awt.Color |
getColor()
Get the
Color the source image is combined with. |
Extent |
getExtent(DrawContext dc)
Returns the surface object's enclosing volume as an
Extent in model coordinates,
given a specified DrawContext. |
Angle |
getHeading()
Get the current heading
Angle, clockwise from North or null. |
java.lang.Object |
getImageSource()
Get the source for the icon image.
|
LatLon |
getLocation()
Get the icon reference location on the globe.
|
Vec4 |
getLocationOffset()
Get the icon displacement in pixels relative to the reference location.
|
double |
getMaxSize()
Get the maximum size in meter the icon image is allowed to be enlarged to once applied to the terrain surface.
|
double |
getMinSize()
Get the minimum size in meter the icon image is allowed to be reduced to once applied to the terrain surface.
|
Position |
getReferencePosition()
A position associated with the object that indicates its aggregate geographic position.
|
double |
getScale()
Get the current scaling factor applied to the source image.
|
java.util.List<Sector> |
getSectors(DrawContext dc)
Returns a list of sectors indicating the geographic region that bounds this renderable for the specified draw
context.
|
java.lang.Object |
getStateKey(DrawContext dc)
Returns an object that uniquely identifies this renderable's state for the specified draw context.
|
protected WWTexture |
getTexture() |
boolean |
isDragEnabled()
Indicates whether the object is enabled for dragging.
|
protected boolean |
isMaintainAppearance() |
boolean |
isMaintainSize()
Determines whether the icon constantly maintains it's apparent size.
|
boolean |
isUseMipMaps()
Returns whether the icon will apply mip-map filtering to it's source image.
|
void |
move(Position delta)
Shift the shape over the globe's surface while maintaining its original azimuth, its orientation relative to
North.
|
void |
moveTo(Position position)
Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to
North.
|
void |
setColor(java.awt.Color color)
Set the
Color the source image will be combined with - default to white. |
void |
setDragEnabled(boolean enabled)
Controls whether the object is enabled for dragging.
|
void |
setHeading(Angle heading)
Set the heading
Angle, clockwise from North. |
void |
setImageSource(java.lang.Object imageSource)
Set the source for the icon image.
|
void |
setLocation(LatLon location)
Set the icon reference location on the globe.
|
void |
setLocationOffset(Vec4 locationOffset)
Set the icon displacement in pixels relative to the reference location.
|
void |
setMaintainSize(boolean state)
Sets whether the icon constantly maintains it's apparent size.
|
void |
setMaxSize(double sizeInMeter)
Get the maximum size in meter the icon image is allowed to be enlarged to once applied to the terrain surface.
|
void |
setMinSize(double sizeInMeter)
Set the minimum size in meter the icon image is allowed to be reduced to once applied to the terrain surface.
|
void |
setScale(double scale)
Set the scaling factor to apply to the source image.
|
void |
setUseMipMaps(boolean useMipMaps)
Sets whether the icon will apply mip-map filtering to it's source image.
|
applyNonPremultipliedAlphaColor, applyPremultipliedAlphaColor, computeDrawPixelSize, computeDrawPoint, computeHemisphereOffset, computeNormalizedSectors, computePixelSizeAtLocation, computeRotatedSectorBounds, getOpacity, getViewHeading, setOpacitybuildPickRepresentation, clearCaches, computeExtent, computeExtent, createPickedObject, createPickTileBuilder, drawBoundingSectors, drawOrderedRenderable, drawPickRepresentation, getDelegateOwner, getDistanceFromEye, getUniqueId, intersectsFrustum, intersectsPickFrustum, intersectsVisibleSector, isDrawBoundingSectors, isEnableBatchPicking, isVisible, makeOrderedPreRenderable, makeOrderedRenderable, nextUniqueId, onShapeChanged, pick, pickBatched, pickOrderedRenderable, preRender, render, setDelegateOwner, setDrawBoundingSectors, setEnableBatchPicking, setVisible, updateModifiedTimeonMessage, propertyChangeaddPropertyChangeListener, 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, setValuesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValuesprotected boolean dragEnabled
protected DraggableSupport draggableSupport
protected int imageHeight
protected int imageWidth
protected WWTexture texture
public SurfaceIcon(java.lang.Object imageSource)
public SurfaceIcon(java.lang.Object imageSource,
LatLon location)
protected void applyDrawColor(DrawContext dc)
protected void applyDrawTransform(DrawContext dc, SurfaceTileDrawContext sdc, LatLon location, double drawScale)
protected void beginDraw(DrawContext dc)
protected java.awt.geom.Rectangle2D.Double computeDrawDimension(double pixelSize)
protected java.awt.geom.Rectangle2D.Double computeDrawDimension(DrawContext dc, LatLon location)
protected Angle computeDrawHeading(DrawContext dc)
protected double computeDrawScale(DrawContext dc, SurfaceTileDrawContext sdc, LatLon location)
protected java.util.List<Sector> computeSectors(DrawContext dc)
protected void doDrag(DragContext dragContext)
public void drag(DragContext dragContext)
DraggableDragContext.drag in interface DraggabledragContext - the DragContext of this dragging event.public void drawGeographic(DrawContext dc, SurfaceTileDrawContext sdc)
AbstractSurfaceObjectdrawGeographic in class AbstractSurfaceObjectdc - the current draw context.sdc - the context containing a geographic region and screen viewport corresponding to a surface tile.protected void drawIcon(DrawContext dc, SurfaceTileDrawContext sdc)
protected void endDraw(DrawContext dc)
public java.awt.Color getColor()
Color the source image is combined with.Color the source image is combined with.public Extent getExtent(DrawContext dc)
AbstractSurfaceObjectExtent in model coordinates,
given a specified DrawContext.getExtent in interface SurfaceObjectgetExtent in class AbstractSurfaceObjectdc - the current draw context.public Angle getHeading()
Angle, clockwise from North or null.Angle, clockwise from North or null.public java.lang.Object getImageSource()
BufferedImage
reference.public LatLon getLocation()
public Vec4 getLocationOffset()
null.
When null the icon will be drawn with it's image center on top of it's reference location - see
setLocation(LatLon). Otherwise the icon will be shifted of a distance equivalent to the number of pixels
specified as x and y offset values. Positive values will move the icon to the right for
x and up for y. Negative values will have the opposite effect.
public double getMaxSize()
The icon will try to maintain it's apparent size depending on it's distance from the eye and will extend over a
rectangular area which largest dimension is bounded by the values provided with setMinSize(double) and
setMaxSize(double).
public double getMinSize()
The icon will try to maintain it's apparent size depending on it's distance from the eye and will extend over a
rectangular area which largest dimension is bounded by the values provided with setMinSize(double) and
setMaxSize(double).
public Position getReferencePosition()
MovablegetReferencePosition in interface Movablepublic double getScale()
public java.util.List<Sector> getSectors(DrawContext dc)
SurfaceRenderableThe returned list typically contains one sector that bounds this renderable in geographic coordinates. When this renderable spans the anti-meridian - the +/- 180 degree meridian - the returned list contains two sectors, one on either side of the anti-meridian.
getSectors in interface SurfaceRenderabledc - the draw context for which to determine this renderable's geographic bounds.public java.lang.Object getStateKey(DrawContext dc)
Callers can perform an equality test on two state keys using Object.equals(Object) in order to determine
whether or not a renderable has changed. The returned object is guaranteed to be globally unique with respect to
other SurfaceRenderable state keys; an equality test with a state key from another renderable always returns
false.
Overridden to return a unique state key if the icon is configured to always redraw. SurfaceIcon does not use a cached representation if it's heading is configured to follow the view, or if it's configured to maintain a constant screen size.
getStateKey in interface SurfaceRenderablegetStateKey in class AbstractSurfaceObjectdc - the draw context for which to determine this renderable's current state.getHeading(),
isMaintainSize()protected WWTexture getTexture()
public boolean isDragEnabled()
DraggableisDragEnabled in interface Draggableprotected boolean isMaintainAppearance()
public boolean isMaintainSize()
true the icon is constantly
redrawn at the proper size depending on it's distance from the eye. If false the icon will be drawn
only once per level of the underlying tile pyramid. Thus it's apparent size will vary up to twice it's 'normal'
dimension in between levels.true if the icon constantly maintains it's apparent size.public boolean isUseMipMaps()
true the icon image
is drawn using mip-maps. If false the icon is drawn without mip-maps, resulting in aliasing if the
icon image is drawn smaller than it's native size in pixels.true if the icon image is drawn with mip-map filtering; false otherwise.public void move(Position delta)
Movablepublic void moveTo(Position position)
Movablepublic void setColor(java.awt.Color color)
Color the source image will be combined with - default to white.
A non white color will mostly affect the white portions from the original image. This is mostly useful to alter the appearance of 'colorless' icons - which mainly contain black, white and shades of gray.
color - the Color the source image will be combined with.java.lang.IllegalArgumentException - if color is null.public void setDragEnabled(boolean enabled)
DraggablesetDragEnabled in interface Draggableenabled - true if the object is enabled, else false.public void setHeading(Angle heading)
Angle, clockwise from North. Setting this value to null will have the icon
follow the view heading so as to always face the eye. The icon will rotate around it's reference location.heading - the heading Angle, clockwise from North or null.public void setImageSource(java.lang.Object imageSource)
BufferedImage
reference.imageSource - the source for the icon image.java.lang.IllegalArgumentException - if imageSource is null.public void setLocation(LatLon location)
location - the icon reference location on the globe.java.lang.IllegalArgumentException - if location is null.public void setLocationOffset(Vec4 locationOffset)
null.
When null the icon will be drawn with it's image center on top of it's refence location - see setLocation(LatLon). Otherwise the icon will be shifted of a distance equivalent to the number of pixels
specified as x and y offset values. Positive values will move the icon to the right for
x and up for y. Negative values will have the opposite effect.
locationOffset - the icon displacement in pixels relative to the reference location.public void setMaintainSize(boolean state)
true the icon is constantly
redrawn at the proper size depending on it's distance from the eye. If false the icon will be drawn
only once per level of the underlying tile pyramid. Thus it's apparent size will vary up to twice it's 'normal'
dimension in between levels.state - true if the icon should constantly maintains it's apparent size.public void setMaxSize(double sizeInMeter)
The icon will try to maintain it's apparent size depending on it's distance from the eye and will extend over a
rectangular area which largest dimension is bounded by the values provided with setMinSize(double) and
setMaxSize(double).
sizeInMeter - the maximum size of the icon in meter.public void setMinSize(double sizeInMeter)
The icon will try to maintain it's apparent size depending on it's distance from the eye and will extend over a
rectangular area which largest dimension is bounded by the values provided with setMinSize(double)
and setMaxSize(double).
sizeInMeter - the minimum size of the icon in meter.public void setScale(double scale)
1 will produce no change, a value
greater then 1 will enlarge the image and a value smaller then 1 will reduce it.scale - the scaling factor to apply to the source image.java.lang.IllegalArgumentException - if scale is zero or negative.public void setUseMipMaps(boolean useMipMaps)
true the icon image is
drawn using mip-maps. If false the icon is drawn without mip-maps, resulting in aliasing if the icon
image is drawn smaller than it's native size in pixels.useMipMaps - true if the icon image should be drawn with mip-map filtering; false
otherwise.