Class ColoredOverlayCollection
Object
org.anchoranalysis.overlay.collection.ColoredOverlayCollection
public class ColoredOverlayCollection extends Object implements Iterable<Overlay>
Like a
OverlayCollection but additionally associates a color with each overlay.- Author:
- Owen Feehan
-
Constructor Summary
Constructors Constructor Description ColoredOverlayCollection()Create an empty collection.ColoredOverlayCollection(OverlayCollection overlays, ColorList colors) -
Method Summary
Modifier and Type Method Description voidadd(Overlay overlay, RGBColor color)Append an overlay and its respective color to the end of the list..RGBColorgetColor(int index)Access a particular color in the collection by index.ColorListgetColors()The list of colors, each element corresponding tooverlays.OverlaygetOverlay(int index)Access a particularOverlayin the collection by index.OverlayCollectiongetOverlays()The collection of overlays, each element corresponding tocolors.Iterator<Overlay>iterator()intsize()The total number of elements in the list.ColoredOverlayCollectionsubsetWhereBoxIntersects(Dimensions scene, DrawOverlay drawOverlay, List<org.anchoranalysis.spatial.box.BoundingBox> toIntersectWith)Find overlays whose bounding-boxes intersect with any of the boxes intoIntersectWith.StringtoString()
-
Constructor Details
-
ColoredOverlayCollection
public ColoredOverlayCollection()Create an empty collection. -
ColoredOverlayCollection
-
-
Method Details
-
add
Append an overlay and its respective color to the end of the list..- Parameters:
overlay- the overlay to append.color- the corresponding color of the overlay.
-
iterator
-
size
public int size()The total number of elements in the list.- Returns:
- the total number of elements.
-
getOverlay
Access a particularOverlayin the collection by index.- Parameters:
index- the index (starting at 0).- Returns:
- the respective element at index
index. - Throws:
IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= size())
-
getColor
Access a particular color in the collection by index.- Parameters:
index- the index (starting at 0).- Returns:
- the respective element at index
index. - Throws:
IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= size())
-
toString
-
subsetWhereBoxIntersects
public ColoredOverlayCollection subsetWhereBoxIntersects(Dimensions scene, DrawOverlay drawOverlay, List<org.anchoranalysis.spatial.box.BoundingBox> toIntersectWith)Find overlays whose bounding-boxes intersect with any of the boxes intoIntersectWith.- Parameters:
scene- the size of the image in which all bounding-boxes must fully fit inside.drawOverlay- what draws the overlays on the image, and thus determines the bounding-box of an overlay.toIntersectWith- the list of boxes against which elements are searched for any intersection.- Returns:
- a newly created
ColoredOverlayCollectioncontaining the elements (uncopied) which match the criteria. This may be empty if no elements match the criteria.
-
getOverlays
The collection of overlays, each element corresponding tocolors. -
getColors
The list of colors, each element corresponding tooverlays.
-