public class EarthContextElement extends PictureElement
The context element may be set up to highlight not only the central context area, but a set of individual areas via the specification of polygon bounding boxes. The box edges are rendered in a highlighted color, and filled with a slightly darker, semi-transparent version of the same color. The bounding boxes may optionally be annotated with text labels, which are centered on each box area and rendered in a default 12 point font using the same color as the box edges.
position, preferred
Constructor and Description |
---|
EarthContextElement(EarthLocation center)
Creates a new earth context element showing the entire Earth.
|
EarthContextElement(EarthTransform trans,
DataLocation upperLeft,
DataLocation lowerRight)
Creates a new earth context element from the specified properties.
|
EarthContextElement(java.awt.geom.Point2D position,
java.awt.Dimension size,
EarthTransform trans,
DataLocation upperLeft,
DataLocation lowerRight)
Creates a new earth context element from the specified properties.
|
Modifier and Type | Method and Description |
---|---|
void |
addBoundingBox(EarthTransform trans,
DataLocation upperLeft,
DataLocation lowerRight,
java.awt.Color color,
java.lang.String label)
Adds a bounding box to this context element.
|
void |
addBoundingBox(LineFeature polygon,
java.awt.Color color,
java.lang.String label)
Adds a bounding box to this context element.
|
java.awt.geom.Area |
getArea(java.awt.Graphics2D g)
Gets the element bounding area.
|
LineFeature |
getBoundingBox(int index)
Gets a polygon bounding box.
|
int |
getBoundingBoxes()
Gets the current number of polygon bounding boxes.
|
EarthLocation |
getCenter()
Gets the context element center earth location.
|
EarthImageTransform |
getEarthImageTransform()
Gets the current earth image transform for this element.
|
java.awt.Font |
getLabelFont()
Gets the font for rendering bounding box labels.
|
DataLocation |
getLowerRight()
Gets the lower-right corner of the context area.
|
double |
getSizeFactor()
Gets the context size to total size factor.
|
EarthTransform |
getTransform()
Gets the earth transform used in the context area, or null if no
context area is defined.
|
DataLocation |
getUpperLeft()
Gets the upper-left corner of the context area.
|
void |
removeAllBoundingBoxes()
Removes all polygon bounding boxes.
|
void |
render(java.awt.Graphics2D g,
java.awt.Color foreground,
java.awt.Color background)
Renders the element graphics.
|
void |
setContextArea(EarthArea area)
Sets the area which should be used as the center of attention in
the context element using an earth area object.
|
void |
setContextArea(EarthTransform trans,
DataLocation upperLeft,
DataLocation lowerRight)
Sets the area which should be used as the center of attention in
the context element using an earth transform and data location
bounds.
|
void |
setContextCenter(EarthLocation center)
Sets the earth context center projection point.
|
void |
setEdge(boolean flag)
Sets the edge flag to render the earth edges.
|
void |
setGrid(boolean flag)
Sets the grid flag to render a global grid.
|
void |
setGridIncrement(int inc)
Sets the grid increment in degrees.
|
void |
setLabelFont(java.awt.Font font)
Sets the font for rendering bounding box labels.
|
void |
setPreferredSize(java.awt.Dimension size)
Sets the preferred size of the picture.
|
void |
setSizeFactor(double factor)
Sets the context size to total size factor.
|
void |
setSolarZenith(SolarZenith sz)
Sets the solar zenith object.
|
void |
setSolarZenithFill(java.awt.Color dayColor,
java.awt.Color nightColor)
Sets the solar zenith fill colors.
|
setPosition
getBounds
public EarthContextElement(java.awt.geom.Point2D position, java.awt.Dimension size, EarthTransform trans, DataLocation upperLeft, DataLocation lowerRight)
position
- the top-left corner position of the picture.size
- the preferred size of the picture (see PictureElement.setPreferredSize(java.awt.Dimension)
).trans
- the earth transform for converting data to
geographic coordinates.upperLeft
- the upper-left corner of the context data window.lowerRight
- the lower-right corner of the context data window.setContextArea(noaa.coastwatch.util.EarthArea)
public EarthContextElement(EarthLocation center)
center
- the initial center location.setContextCenter(noaa.coastwatch.util.EarthLocation)
public EarthContextElement(EarthTransform trans, DataLocation upperLeft, DataLocation lowerRight)
trans
- the earth transform for converting data to
geographic coordinates.upperLeft
- the upper-left corner of the context data window.lowerRight
- the lower-right corner of the context data window.setContextArea(noaa.coastwatch.util.EarthArea)
public java.awt.Font getLabelFont()
public void setLabelFont(java.awt.Font font)
public double getSizeFactor()
public void setSizeFactor(double factor)
public void setSolarZenithFill(java.awt.Color dayColor, java.awt.Color nightColor)
public void setEdge(boolean flag)
public void setGrid(boolean flag)
public void setGridIncrement(int inc)
public void setSolarZenith(SolarZenith sz)
public void addBoundingBox(EarthTransform trans, DataLocation upperLeft, DataLocation lowerRight, java.awt.Color color, java.lang.String label)
trans
- the earth transform for converting data to
geographic coordinates.upperLeft
- the upper-left corner of the data window.lowerRight
- the lower-right corner of the data window.color
- the bounding box color.label
- the bounding box label, or null for no label.public DataLocation getUpperLeft()
public DataLocation getLowerRight()
public EarthTransform getTransform()
public void setContextArea(EarthArea area)
area
- the earth area to use for the context area. The area
center point and context size are determined by examining the
extreme latitude and longitude values.setContextArea(EarthTransform,DataLocation,DataLocation)
public void setContextArea(EarthTransform trans, DataLocation upperLeft, DataLocation lowerRight)
trans
- the earth transform for converting data to
geographic coordinates.upperLeft
- the upper-left corner of the data window.lowerRight
- the lower-right corner of the data window.setContextArea(EarthArea)
public void removeAllBoundingBoxes()
public void addBoundingBox(LineFeature polygon, java.awt.Color color, java.lang.String label)
polygon
- the bounding box earth location polygon points.color
- the bounding box color.label
- the bounding box label, or null for no label.public void setPreferredSize(java.awt.Dimension size)
PictureElement
setPreferredSize
in class PictureElement
size
- the preferred picture size, or null if the picture size
should be determined by the element.public void setContextCenter(EarthLocation center)
center
- the new center location.public EarthLocation getCenter()
public void render(java.awt.Graphics2D g, java.awt.Color foreground, java.awt.Color background)
AnnotationElement
render
in class AnnotationElement
g
- the graphics object for drawing.foreground
- the foreground element color.background
- the background element color or null for no
background.public java.awt.geom.Area getArea(java.awt.Graphics2D g)
AnnotationElement
getArea
in class AnnotationElement
g
- the graphics object for drawing.public int getBoundingBoxes()
public LineFeature getBoundingBox(int index)
index
- the index of the desired polygon bounding box,
in the range [0..boxes-1].getBoundingBoxes()
,
addBoundingBox(noaa.coastwatch.util.trans.EarthTransform, noaa.coastwatch.util.DataLocation, noaa.coastwatch.util.DataLocation, java.awt.Color, java.lang.String)
public EarthImageTransform getEarthImageTransform()