Package noaa.coastwatch.render.lines
Class LineCollection
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<String,
,LabeledLine> NavigableMap<String,
,LabeledLine> SortedMap<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:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addSegment
(String textLabel, EarthImageTransform trans, DataLocation start, DataLocation end) Adds a line segment to the collection.void
addSegment
(String textLabel, EarthImageTransform trans, EarthLocation start, EarthLocation end) Adds a line segment to the collection.getLabels
(Dimension imageDims, LineLabelFactory labelFactory) Gets the labels for this collection of lines.void
render
(Graphics2D g) Renders this collection of lines.Methods inherited from class java.util.TreeMap
ceilingEntry, ceilingKey, clear, clone, comparator, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, forEach, get, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, merge, navigableKeySet, pollFirstEntry, pollLastEntry, put, putAll, putIfAbsent, remove, replace, replace, replaceAll, size, subMap, subMap, tailMap, tailMap, values
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty, toString
-
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
Renders this collection of lines.- Parameters:
g
- the graphics device for rendering.
-
getLabels
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.
-