public class ScreenImage extends WWObjectImpl implements Renderable, Exportable
Modifier and Type | Class and Description |
---|---|
protected class |
ScreenImage.OrderedImage |
Modifier and Type | Field and Description |
---|---|
protected java.awt.Point |
awtScreenLocation
Indicates the location of this screen image in the viewport (on the screen) in AWT coordinates.
|
protected java.awt.Color |
color |
protected java.lang.Object |
delegateOwner |
protected double |
dx |
protected double |
dy |
protected long |
frameNumber |
protected int |
height |
protected Offset |
imageOffset |
protected java.lang.Object |
imageSource |
protected double |
opacity |
protected ScreenImage.OrderedImage |
orderedImage |
protected int |
originalImageHeight |
protected int |
originalImageWidth |
protected Layer |
pickLayer |
protected PickSupport |
pickSupport |
protected java.lang.Double |
rotation |
protected Offset |
rotationOffset |
protected java.awt.Point |
rotationPoint |
protected java.awt.Point |
screenLocation
Indicates the location of this screen image in the viewport (on the screen) in OpenGL coordinates.
|
protected Offset |
screenOffset |
protected Size |
size |
protected BasicWWTexture |
texture |
protected int |
width |
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
Constructor and Description |
---|
ScreenImage() |
Modifier and Type | Method and Description |
---|---|
protected void |
computeOffsets(DrawContext dc)
Compute the image size, rotation, and position based on the current viewport size.
|
protected void |
doRender(DrawContext dc) |
protected void |
draw(DrawContext dc) |
void |
export(java.lang.String mimeType,
java.lang.Object output)
Export the screen image.
|
protected void |
exportAsKML(java.lang.Object output)
Export the screen image to KML as a
<ScreenOverlay> element. |
java.awt.Color |
getColor()
If no image is set, or if the image is not yet available, a rectangle will be drawn in this color.
|
java.lang.Object |
getDelegateOwner()
Indicates the object included in
SelectEvent s when this object is picked. |
int |
getImageHeight(DrawContext dc)
Returns the height of the image after dynamic scaling has been applied.
|
Offset |
getImageOffset()
Get the offset of the point on the image to align with the screen offset point.
|
java.lang.Object |
getImageSource()
Returns the current image source.
|
int |
getImageWidth(DrawContext dc)
Returns the width of the source image after dynamic scaling has been applied.
|
double |
getOpacity()
Returns the opacity of the surface.
|
java.lang.Double |
getRotation()
Get the rotation applied to the image.
|
Offset |
getRotationOffset()
Get the point about which the image is rotated.
|
java.awt.Point |
getScreenLocation()
Returns the location of the image on the screen.
|
java.awt.Point |
getScreenLocation(DrawContext dc)
Returns the location of the image on the screen.
|
Offset |
getScreenOffset()
Get the offset of the point on the screen to align with the image offset point.
|
Size |
getSize()
Get the dimension to apply to the image.
|
protected BasicWWTexture |
getTexture()
Get the texture for this image.
|
protected BasicWWTexture |
initializeTexture()
Create and initialize the texture from the image source.
|
java.lang.String |
isExportFormatSupported(java.lang.String format)
Does this object support a certain export format?
|
void |
pick(DrawContext dc,
java.awt.Point pickPoint) |
void |
render(DrawContext dc)
Causes this
Renderable to render itself using the provided draw context. |
void |
setColor(java.awt.Color defaultColor)
Set the color of the rectangle drawn when the image cannot be drawn.
|
void |
setDelegateOwner(java.lang.Object delegateOwner)
Specify the object to identify as the picked object when this shape is picked.
|
void |
setImageOffset(Offset imageOffset)
Set the image offset point.
|
void |
setImageSource(java.lang.Object imageSource)
Specifies the image source, which may be either a file path
String or a BufferedImage . |
void |
setOpacity(double opacity)
Sets the opacity of the surface.
|
void |
setRotation(java.lang.Double rotation)
Specifies a rotation to be applied to the image.
|
void |
setRotationOffset(Offset rotationOffset)
Set the point on the image about which rotation is performed.
|
void |
setScreenLocation(java.awt.Point screenLocation)
Convenience method to specify the location of the image on the screen.
|
void |
setScreenOffset(Offset screenOffset)
Set the offset of the image relative to the viewport.
|
void |
setSize(Size size)
Set a dynamic dimension to apply to the image.
|
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, toString, wait, wait, wait
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
protected java.awt.Point awtScreenLocation
setScreenLocation
and computeOffsets
. In computeOffsets
, this
is computed by converting the screenLocation
from OpenGL coordinates to AWT coordinates. Initially
null
.protected java.awt.Color color
protected java.lang.Object delegateOwner
protected double dx
protected double dy
protected long frameNumber
protected int height
protected Offset imageOffset
protected java.lang.Object imageSource
protected double opacity
protected ScreenImage.OrderedImage orderedImage
protected int originalImageHeight
protected int originalImageWidth
protected Layer pickLayer
protected PickSupport pickSupport
protected java.lang.Double rotation
protected Offset rotationOffset
protected java.awt.Point rotationPoint
protected java.awt.Point screenLocation
computeOffsets
and used in draw
Initially null
.protected Offset screenOffset
protected Size size
protected BasicWWTexture texture
protected int width
protected void computeOffsets(DrawContext dc)
dc
- DrawContext into which the image will be rendered.protected void doRender(DrawContext dc)
protected void draw(DrawContext dc)
public void export(java.lang.String mimeType, java.lang.Object output) throws java.io.IOException
output
object will receive the exported data. The type of this object
depends on the export format. The formats and object types supported by this class are:
Format Supported output object types ================================================================================ KML (application/vnd.google-earth.kml+xml) java.io.Writer java.io.OutputStream javax.xml.stream.XMLStreamWriter
export
in interface Exportable
mimeType
- MIME type of desired export format.output
- An object that will receive the exported data. The type of this object depends on the export
format (see above).java.io.IOException
- If an exception occurs writing to the output object.Exportable.isExportFormatSupported(String)
protected void exportAsKML(java.lang.Object output) throws java.io.IOException, javax.xml.stream.XMLStreamException
<ScreenOverlay>
element. The output
object will receive the
data. This object must be one of: java.io.Writer java.io.OutputStream javax.xml.stream.XMLStreamWriter.
The image path can only be exported if the image source is a path or URL. If the image source is a BufferedImage, for example, the image will not be exported and no icon reference will be written into the ScreenOverlay tag.
output
- Object to receive the generated KML.javax.xml.stream.XMLStreamException
- If an exception occurs while writing the KMLjava.io.IOException
- if an exception occurs while exporting the data.export(String, Object)
public java.awt.Color getColor()
public java.lang.Object getDelegateOwner()
SelectEvent
s when this object is picked.public int getImageHeight(DrawContext dc)
dc
- the current draw context.getSize()
public Offset getImageOffset()
getScreenOffset()
public java.lang.Object getImageSource()
getImageSource()
public int getImageWidth(DrawContext dc)
dc
- the current draw context.getSize()
public double getOpacity()
public java.lang.Double getRotation()
getRotationOffset()
public Offset getRotationOffset()
getRotation()
public java.awt.Point getScreenLocation()
getScreenLocation(DrawContext)
to ensure an accurate result based on the
current viewport.getScreenLocation(DrawContext)
,
getImageOffset()
,
getScreenOffset()
public java.awt.Point getScreenLocation(DrawContext dc)
dc
- The DrawContext in which the image will be drawn.public Offset getScreenOffset()
getImageOffset()
public Size getSize()
protected BasicWWTexture getTexture()
protected BasicWWTexture initializeTexture()
public java.lang.String isExportFormatSupported(java.lang.String format)
isExportFormatSupported
in interface Exportable
format
- Desired export format.Exportable.FORMAT_SUPPORTED
, Exportable.FORMAT_NOT_SUPPORTED
, or Exportable.FORMAT_PARTIALLY_SUPPORTED
.Exportable.export(String, Object)
public void pick(DrawContext dc, java.awt.Point pickPoint)
public void render(DrawContext dc)
Renderable
Renderable
to render itself using the provided draw context.render
in interface Renderable
dc
- the DrawContext
to be usedDrawContext
public void setColor(java.awt.Color defaultColor)
defaultColor
- New color for the default rectangle.public void setDelegateOwner(java.lang.Object delegateOwner)
delegateOwner
- the object included in SelectEvent
s as the picked object.public void setImageOffset(Offset imageOffset)
imageOffset
- Offset that identifies a point on the image to align with the screen offset point.setScreenOffset(Offset)
public void setImageSource(java.lang.Object imageSource)
String
or a BufferedImage
. If the image is not already in memory, it will be loaded in the background.imageSource
- the image source, either a file path String
or a BufferedImage
.java.lang.IllegalArgumentException
- if the imageSource
is null.public void setOpacity(double opacity)
opacity
- a positive value indicating the opacity of the surface.java.lang.IllegalArgumentException
- if the specified opacity is less than zero.public void setRotation(java.lang.Double rotation)
rotation
- Rotation in decimal degrees.setRotationOffset(Offset)
public void setRotationOffset(Offset rotationOffset)
rotationOffset
- Rotation offset.setRotation(Double)
public void setScreenLocation(java.awt.Point screenLocation)
screenLocation
is relative to the upper-left corner of the WorldWindow, and the image is centered on this location.screenLocation
- the screen location on which to center the image. May be null, in which case the image is
not displayed.setScreenOffset(Offset)
,
setImageOffset(Offset)
public void setScreenOffset(Offset screenOffset)
screenOffset
- The screen offset.setImageOffset(Offset)
public void setSize(Size size)
size
- Image dimension. May not be null.