Package org.anchoranalysis.mpp.mark
Class ColoredMarks
Object
ColoredMarks
A collection of marks, each associated with a color.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty ColoredMarks instance.ColoredMarks
(MarkCollection marks, ColorIndex colorIndex, IdentifierGetter<Mark> colorIDGetter) Creates a ColoredMarks instance from a MarkCollection and assigns colors based on a ColorIndex.ColoredMarks
(MarkCollection marks, ColorList colorList) ColoredMarks
(Mark mark, RGBColor color) Creates a ColoredMarks instance with a single mark and color. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a mark with an associated color.void
Adds a mark with an associated RGBColor.void
addAll
(ColoredMarks marks) Adds all marks and colors from another ColoredMarks instance.void
addAll
(MarkCollection marks, RGBColor color) Adds all marks from a MarkCollection with the same color.void
addChangeID
(Mark mark, Color color) Adds a mark, changes its ID, and associates it with a color.void
addChangeID
(Mark mark, RGBColor color) Adds a mark, changes its ID, and associates it with an RGBColor.createMerged
(ColoredMarks toMerge) Merges this ColoredMarks with another, avoiding duplicates.deepCopy()
Creates a deep copy of this ColoredMarks instance.getMarks()
iterator()
void
remove
(int index) Removes a mark and its associated color at the specified index.Creates a shallow copy of this ColoredMarks instance.final int
size()
Returns the number of marks in the collection.subsetWhereBBoxIntersects
(Dimensions dimensions, int regionID, List<BoundingBox> intersectList) Creates a subset of marks whose bounding boxes intersect with given boxes.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
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 markscolorIndex
- the color index to use for assigning colorscolorIDGetter
- a function to get color IDs for marks
-
ColoredMarks
Creates a ColoredMarks instance with a single mark and color.- Parameters:
mark
- the mark to addcolor
- the color for the mark
-
ColoredMarks
-
-
Method Details
-
add
Adds a mark with an associated color.- Parameters:
mark
- the mark to addcolor
- the color for the mark
-
addChangeID
Adds a mark, changes its ID, and associates it with a color.- Parameters:
mark
- the mark to addcolor
- the color for the mark
-
addChangeID
Adds a mark, changes its ID, and associates it with an RGBColor.- Parameters:
mark
- the mark to addcolor
- the RGBColor for the mark
-
add
Adds a mark with an associated RGBColor.- Parameters:
mark
- the mark to addcolor
- the RGBColor for the mark
-
addAll
Adds all marks from a MarkCollection with the same color.- Parameters:
marks
- the MarkCollection to add fromcolor
- the color for all added marks
-
addAll
Adds all marks and colors from another ColoredMarks instance.- Parameters:
marks
- the ColoredMarks to add from
-
iterator
-
size
public final int size()Returns the number of marks in the collection.- Returns:
- the size of the collection
-
deepCopy
Creates a deep copy of this ColoredMarks instance.- Returns:
- a new ColoredMarks instance with copied marks and colors
-
shallowCopy
Creates a shallow copy of this ColoredMarks instance.- Returns:
- a new ColoredMarks instance with the same marks and colors
-
createMerged
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 calculationsregionID
- the region ID to use for bounding box calculationsintersectList
- 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
-
getColorList
-