public abstract class EarthDataOverlay
extends java.lang.Object
implements java.lang.Comparable, java.lang.Cloneable, java.io.Serializable
Cloneable
to provide a simple
shallow copy of the object. If child classes have any deep mutable
data structures such as lists, they should override the
clone()
method.Modifier and Type | Field and Description |
---|---|
protected int |
alpha
The overlay alpha value.
|
protected EarthImageTransform |
lastTrans
The last earth image transform used for rendering.
|
protected boolean |
prepared
The prepared flag, true if this overlay is ready to be drawn.
|
Modifier | Constructor and Description |
---|---|
protected |
EarthDataOverlay(java.awt.Color color)
Constructs a new data overlay.
|
protected |
EarthDataOverlay(java.awt.Color color,
int layer)
Constructs a new data overlay.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone() |
int |
compareTo(java.lang.Object o) |
protected abstract void |
draw(java.awt.Graphics2D g,
EarthDataView view)
Draws the overlay graphics.
|
java.awt.Color |
getAlphaVersion(java.awt.Color color)
Gets a version of the color with the overlay transparency
applied.
|
java.awt.Color |
getColor()
Gets the overlay color.
|
java.util.List |
getColors()
Gets a list of all the colors used by this overlay.
|
java.awt.Color |
getColorWithAlpha()
Gets the overlay color with alpha component.
|
int |
getLayer()
Gets the overlay layer.
|
java.util.Map<java.lang.String,java.lang.Object> |
getMetadataAtPoint(java.awt.Point point)
Gets the metadata at the specified point.
|
java.lang.String |
getName()
Gets the overlay name.
|
int |
getTransparency()
Gets the overlay transparency.
|
boolean |
getVisible()
Gets the overlay visibility flag.
|
boolean |
hasMetadata()
Gets the metadata flag, true if the overlay has metadata associated
with its rendered graphics, false if not.
|
void |
invalidate()
Invalidates the overlay.
|
boolean |
isPrepared(EarthDataView view)
Gets the status of the overlay preparation.
|
protected boolean |
needsPrepare()
Determines if this overlay class needs to be prepared for
rendering.
|
protected abstract void |
prepare(java.awt.Graphics2D g,
EarthDataView view)
Prepares the overlay graphics prior to drawing.
|
void |
render(java.awt.Graphics2D g,
EarthDataView view)
Renders the overlay graphics.
|
void |
setColor(java.awt.Color color)
Sets the overlay color.
|
void |
setLayer(int layer)
Sets the overlay layer.
|
void |
setName(java.lang.String name)
Sets the overlay name.
|
void |
setTransparency(int trans)
Sets the overlay transparency.
|
void |
setVisible(boolean flag)
Sets the overlay visibility flag.
|
protected transient EarthImageTransform lastTrans
protected transient boolean prepared
protected int alpha
protected EarthDataOverlay(java.awt.Color color, int layer)
color
- the overlay color.layer
- the overlay layer number.protected EarthDataOverlay(java.awt.Color color)
color
- the overlay color.public void setColor(java.awt.Color color)
setTransparency(int)
.color
- the new opaque overlay color.public java.awt.Color getColor()
setColor(java.awt.Color)
specifies a color with an alpha
component. The overlay transparency may be accessed through
setTransparency(int)
or getTransparency()
.public java.awt.Color getColorWithAlpha()
public void setLayer(int layer)
public int getLayer()
public void setName(java.lang.String name)
public java.lang.String getName()
public void setVisible(boolean flag)
public boolean getVisible()
public int compareTo(java.lang.Object o) throws java.lang.ClassCastException
compareTo
in interface java.lang.Comparable
java.lang.ClassCastException
public boolean isPrepared(EarthDataView view)
view
- the earth data view for the next rendering operation.protected boolean needsPrepare()
public void render(java.awt.Graphics2D g, EarthDataView view)
g
- the graphics object for drawing.view
- the earth data view.protected abstract void prepare(java.awt.Graphics2D g, EarthDataView view)
g
- the graphics object for drawing.view
- the earth data view.protected abstract void draw(java.awt.Graphics2D g, EarthDataView view)
g
- the graphics object for drawing.view
- the earth data view.public java.lang.Object clone()
clone
in class java.lang.Object
public void invalidate()
render()
. This method does nothing unless
overridden in the child class.public void setTransparency(int trans)
trans
- the transparency level in percent from 0 to 100. A
transparency of 0% is completely opaque, and 100% is completely
transparent.public int getTransparency()
public java.awt.Color getAlphaVersion(java.awt.Color color)
color
- the color to convert.public java.util.List getColors()
public boolean hasMetadata()
getMetadataAtPoint(java.awt.Point)
may be used. By default this method returns
false unless overridden by the child class.getMetadataAtPoint(java.awt.Point)
public java.util.Map<java.lang.String,java.lang.Object> getMetadataAtPoint(java.awt.Point point)
point
- the point to get metadata for.java.lang.UnsupportedOperationException
- if this class doesn't support
metadata.