Package org.anchoranalysis.mpp.mark
Class ColoredMarks
Object
org.anchoranalysis.mpp.mark.ColoredMarks
public class ColoredMarks extends Object implements Iterable<Mark>
A collection of marks, each associated with a color.
-
Constructor Summary
Constructors Constructor Description ColoredMarks()Creates 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 Type Method Description voidadd(Mark mark, Color color)Adds a mark with an associated color.voidadd(Mark mark, RGBColor color)Adds a mark with an associated RGBColor.voidaddAll(ColoredMarks marks)Adds all marks and colors from another ColoredMarks instance.voidaddAll(MarkCollection marks, RGBColor color)Adds all marks from a MarkCollection with the same color.voidaddChangeID(Mark mark, Color color)Adds a mark, changes its ID, and associates it with a color.voidaddChangeID(Mark mark, RGBColor color)Adds a mark, changes its ID, and associates it with an RGBColor.ColoredMarkscreateMerged(ColoredMarks toMerge)Merges this ColoredMarks with another, avoiding duplicates.ColoredMarksdeepCopy()Creates a deep copy of this ColoredMarks instance.ColorListgetColorList()MarkCollectiongetMarks()Iterator<Mark>iterator()voidremove(int index)Removes a mark and its associated color at the specified index.ColoredMarksshallowCopy()Creates a shallow copy of this ColoredMarks instance.intsize()Returns the number of marks in the collection.ColoredMarkssubsetWhereBBoxIntersects(Dimensions dimensions, int regionID, List<org.anchoranalysis.spatial.box.BoundingBox> intersectList)Creates a subset of marks whose bounding boxes intersect with given boxes.
-
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<org.anchoranalysis.spatial.box.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
-