MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / indexAt

Method indexAt

ij/src/main/java/ij/gui/Overlay.java:132–139  ·  view source on GitHub ↗

Returns the index of the last ROI that contains the point (x,y) or null if no ROI contains the point.

(int x, int y)

Source from the content-addressed store, hash-verified

130 /** Returns the index of the last ROI that contains the point (x,y)
131 or null if no ROI contains the point. */
132 public int indexAt(int x, int y) {
133 Roi[] rois = toArray();
134 for (int i=rois.length-1; i>=0; i--) {
135 if (contains(rois[i],x,y))
136 return i;
137 }
138 return -1;
139 }
140
141 private boolean contains(Roi roi, int x, int y) {
142 if (roi==null) return false;

Callers 1

doOverlayMethod · 0.95

Calls 2

toArrayMethod · 0.95
containsMethod · 0.95

Tested by

no test coverage detected