Class ColoredMarks

Object
ColoredMarks
All Implemented Interfaces:
Iterable<Mark>

public class ColoredMarks extends Object implements Iterable<Mark>
A collection of marks, each associated with a color.
  • Constructor Details

    • ColoredMarks

      public ColoredMarks()
      Creates an empty ColoredMarks instance.
    • ColoredMarks

      public ColoredMarks(MarkCollection marks, ColorIndex colorIndex, IdentifierGetter<Mark> colorIDGetter)
      Creates a ColoredMarks instance from a MarkCollection and assigns colors based on a ColorIndex. Note: This constructor changes the IDs of the marks.
      Parameters:
      marks - the collection of marks
      colorIndex - the color index to use for assigning colors
      colorIDGetter - a function to get color IDs for marks
    • ColoredMarks

      public ColoredMarks(Mark mark, RGBColor color)
      Creates a ColoredMarks instance with a single mark and color.
      Parameters:
      mark - the mark to add
      color - the color for the mark
    • ColoredMarks

      public ColoredMarks(MarkCollection marks, ColorList colorList)
  • Method Details

    • add

      public void add(Mark mark, Color color)
      Adds a mark with an associated color.
      Parameters:
      mark - the mark to add
      color - the color for the mark
    • addChangeID

      public void addChangeID(Mark mark, Color color)
      Adds a mark, changes its ID, and associates it with a color.
      Parameters:
      mark - the mark to add
      color - the color for the mark
    • addChangeID

      public void addChangeID(Mark mark, RGBColor color)
      Adds a mark, changes its ID, and associates it with an RGBColor.
      Parameters:
      mark - the mark to add
      color - the RGBColor for the mark
    • add

      public void add(Mark mark, RGBColor color)
      Adds a mark with an associated RGBColor.
      Parameters:
      mark - the mark to add
      color - the RGBColor for the mark
    • addAll

      public void addAll(MarkCollection marks, RGBColor color)
      Adds all marks from a MarkCollection with the same color.
      Parameters:
      marks - the MarkCollection to add from
      color - the color for all added marks
    • addAll

      public void addAll(ColoredMarks marks)
      Adds all marks and colors from another ColoredMarks instance.
      Parameters:
      marks - the ColoredMarks to add from
    • iterator

      public Iterator<Mark> iterator()
      Specified by:
      iterator in interface Iterable<Mark>
    • size

      public final int size()
      Returns the number of marks in the collection.
      Returns:
      the size of the collection
    • deepCopy

      public ColoredMarks deepCopy()
      Creates a deep copy of this ColoredMarks instance.
      Returns:
      a new ColoredMarks instance with copied marks and colors
    • shallowCopy

      public ColoredMarks shallowCopy()
      Creates a shallow copy of this ColoredMarks instance.
      Returns:
      a new ColoredMarks instance with the same marks and colors
    • createMerged

      public ColoredMarks createMerged(ColoredMarks toMerge)
      Merges this ColoredMarks with another, avoiding duplicates.
      Parameters:
      toMerge - the ColoredMarks to merge with
      Returns:
      a new ColoredMarks instance with merged marks and colors
    • subsetWhereBBoxIntersects

      public ColoredMarks subsetWhereBBoxIntersects(Dimensions dimensions, int regionID, List<BoundingBox> intersectList)
      Creates a subset of marks whose bounding boxes intersect with given boxes.
      Parameters:
      dimensions - the dimensions to use for bounding box calculations
      regionID - the region ID to use for bounding box calculations
      intersectList - the list of bounding boxes to check for intersection
      Returns:
      a new ColoredMarks instance with the intersecting marks
    • remove

      public void remove(int index)
      Removes a mark and its associated color at the specified index.
      Parameters:
      index - the index of the mark to remove
    • getMarks

      public MarkCollection getMarks()
    • getColorList

      public ColorList getColorList()