Class LineCollection

java.lang.Object
java.util.AbstractMap<K,V>
java.util.TreeMap<String,LabeledLine>
noaa.coastwatch.render.lines.LineCollection
All Implemented Interfaces:
Serializable, Cloneable, Map<String,LabeledLine>, NavigableMap<String,LabeledLine>, SortedMap<String,LabeledLine>

public class LineCollection extends TreeMap<String,LabeledLine>
The LineCollection class holds an ordered set of line objects. Each line encodes information about which line it is and what line segments it contains. The line collection is used as a convenient interface for adding segments to a set of lines, and then iterating over the lines for rendering.
Since:
3.3.1
Author:
Peter Hollemans
See Also:
  • Constructor Details

    • LineCollection

      public LineCollection()
      Creates a new empty collection of lines.
  • Method Details

    • addSegment

      public void addSegment(String textLabel, EarthImageTransform trans, EarthLocation start, EarthLocation end)
      Adds a line segment to the collection. The segment is added to the appropriate line object. If the line does not yet exist, it is created.
      Parameters:
      textLabel - the line text label, used as a key in the collection.
      trans - the earth image transform used for translating earth locations to image points.
      start - the starting earth location.
      end - the ending earth location.
    • addSegment

      public void addSegment(String textLabel, EarthImageTransform trans, DataLocation start, DataLocation end)
      Adds a line segment to the collection. The segment is added to the appropriate line object. If the line does not yet exist, it is created.
      Parameters:
      textLabel - the line text label, used as a key in the collection.
      trans - the earth image transform used for translating data locations to image points.
      start - the starting data location.
      end - the ending Earthdata location.
    • render

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

      public List<TextElement> getLabels(Dimension imageDims, LineLabelFactory labelFactory)
      Gets the labels for this collection of lines.
      Parameters:
      imageDims - the image dimensions.
      labelFactory - the label factory to use for creating labels.
      Returns:
      a list of text elements for the line labels.