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)
| 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; |