Class LabeledLine

java.lang.Object
noaa.coastwatch.render.lines.LabeledLine
All Implemented Interfaces:
Comparable<LabeledLine>

public class LabeledLine extends Object implements 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 Details

    • LabeledLine

      public LabeledLine(String labelText)
      Creates an empty line with the specified label text.
      Parameters:
      labelText - the text for labeling the line.
  • Method Details

    • addSegment

      public void addSegment(DataLocation start, DataLocation end, EarthImageTransform trans)
      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

      public void addSegment(EarthLocation start, EarthLocation end, EarthImageTransform trans)
      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

      public int compareTo(LabeledLine line)
      Specified by:
      compareTo in interface Comparable<LabeledLine>
    • render

      public void render(Graphics2D g)
      Renders this line.
      Parameters:
      g - the graphics device for rendering.
    • getLabels

      public List<TextElement> getLabels(Dimension imageDims, LineLabelFactory labelFactory)
      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.