Package noaa.coastwatch.render.lines
Class LabeledLine
java.lang.Object
noaa.coastwatch.render.lines.LabeledLine
- All Implemented Interfaces:
Comparable<LabeledLine>
The
LabeledLine
class holds the line label text
and segment information for one labeled line on the earth.- Since:
- 3.3.1
- Author:
- Peter Hollemans
-
Constructor Summary
ConstructorDescriptionLabeledLine
(String labelText) Creates an empty line with the specified label text. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSegment
(DataLocation start, DataLocation end, EarthImageTransform trans) Adds a segment to the line.void
addSegment
(EarthLocation start, EarthLocation end, EarthImageTransform trans) Adds a segment to the line.int
compareTo
(LabeledLine line) getLabels
(Dimension imageDims, LineLabelFactory labelFactory) Gets the line labels.int
Gets the number of segments in this line.void
render
(Graphics2D g) Renders this line.
-
Constructor Details
-
LabeledLine
Creates an empty line with the specified label text.- Parameters:
labelText
- the text for labeling the line.
-
-
Method Details
-
addSegment
Adds a segment to the line. The starting and ending locations are translated to image points, and only added if the points are valid.- Parameters:
start
- the starting data location.end
- the ending data location.trans
- the transform for converting from data location to image location.
-
addSegment
Adds a segment to the line. The starting and ending locations are translated to image points, and only added if the points are valid.- Parameters:
start
- the starting earth location.end
- the ending earth location.trans
- the transform for converting from earth location to image location.
-
getSegmentCount
public int getSegmentCount()Gets the number of segments in this line. -
compareTo
- Specified by:
compareTo
in interfaceComparable<LabeledLine>
-
render
Renders this line.- Parameters:
g
- the graphics device for rendering.
-
getLabels
Gets the line labels. A line is given labels based on the type of factory used.- Parameters:
imageDims
- the image dimensions.labelFactory
- the label factory to use for creating labels.- Returns:
- an array of text elements for line labels, or null if no segments are inside the image boundaries.
-