public abstract class LineOverlay extends EarthDataOverlay
An implementation note: The normal BasicStroke
object
that would be used to define a stroke for vector overlays is not
serializable. So we add some special serialization methods here to
handle saving and restoring stroke objects. The alternative is to
create a new serializable stroke class, which may be required if
there are other classes that use a stroke and need serialization.
For now, we keep it simple.
Modifier and Type | Field and Description |
---|---|
protected boolean |
drawingShadow
The shadow rendering flag, true if we are rendering a shadow.
|
alpha, lastTrans, prepared
Modifier | Constructor and Description |
---|---|
protected |
LineOverlay(java.awt.Color color)
Constructs a new vector overlay.
|
protected |
LineOverlay(java.awt.Color color,
int layer,
java.awt.Stroke stroke)
Constructs a new vector overlay.
|
Modifier and Type | Method and Description |
---|---|
static java.awt.geom.Line2D |
clip(java.awt.geom.Line2D line,
java.awt.geom.Rectangle2D rect)
Clips the line segment to the specified rectangle.
|
protected void |
drawShadow(java.awt.Graphics2D g,
EarthDataView view)
Draws a drop shadow version of this overlay.
|
boolean |
getDropShadow()
Gets the drop shadow flag.
|
static java.awt.Color |
getShadowColor(java.awt.Color foreground)
Gets the shadow color that will have the greatest contrast to the
specified foreground color.
|
java.awt.Stroke |
getStroke()
Gets the vector path stroke.
|
void |
render(java.awt.Graphics2D g,
EarthDataView view)
Renders the overlay graphics.
|
void |
setDropShadow(boolean flag)
Sets the drop shadow flag.
|
void |
setStroke(java.awt.Stroke stroke)
Sets the vector path stroke.
|
clone, compareTo, draw, getAlphaVersion, getColor, getColors, getColorWithAlpha, getLayer, getMetadataAtPoint, getName, getTransparency, getVisible, hasMetadata, invalidate, isPrepared, needsPrepare, prepare, setColor, setLayer, setName, setTransparency, setVisible
protected boolean drawingShadow
protected LineOverlay(java.awt.Color color, int layer, java.awt.Stroke stroke)
color
- the overlay color.layer
- the overlay layer number.stroke
- the stroke to use for vector paths.protected LineOverlay(java.awt.Color color)
BasicStroke
with
beveled joins.color
- the overlay color.public boolean getDropShadow()
public void setDropShadow(boolean flag)
protected void drawShadow(java.awt.Graphics2D g, EarthDataView view)
g
- the graphics device to draw to.view
- the data for drawing.public void render(java.awt.Graphics2D g, EarthDataView view)
EarthDataOverlay
render
in class EarthDataOverlay
g
- the graphics object for drawing.view
- the earth data view.public static java.awt.Color getShadowColor(java.awt.Color foreground)
foreground
- the foreground color in question.public void setStroke(java.awt.Stroke stroke)
public java.awt.Stroke getStroke()
public static java.awt.geom.Line2D clip(java.awt.geom.Line2D line, java.awt.geom.Rectangle2D rect)
Foley, J.D., A. van Dam, S.K. Feiner, and J.F. Hughes, "Computer Graphics: Principles and Practice, Second edition in C", Addison-Wesley, July 1997, pp 117-124, 274.
line
- the line for clipping.rect
- the clipping rectangle.