public abstract class AbstractSimpleIterator extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractSimpleIterator.Order
Constants defining the visiting order that the iterator will
follow when moved with the
next() method. |
| Constructor and Description |
|---|
AbstractSimpleIterator(org.jaitools.imageutils.iterator.AbstractSimpleIterator.DelegateHelper helper,
RenderedImage image,
Rectangle bounds,
Number outsideValue,
AbstractSimpleIterator.Order order)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
done()
Closes this iterator and frees resources including the iterator's
reference to the source image.
|
Rectangle |
getBounds()
Gets the bounds of this iterator.
|
Point |
getEndPos()
Gets the final position for this iterator.
|
RenderedImage |
getImage()
Returns the image that this iterator is working with.
|
Point |
getPos()
Gets the current iterator position.
|
Point |
getPos(Point dest)
Gets the current iterator position.
|
Number |
getSample()
Returns the value from the first band of the image at the current position,
or the outside value if the iterator is positioned beyond the image bounds.
|
Number |
getSample(int band)
Returns the value from the specified band of the image at the current position,
or the outside value if the iterator is positioned beyond the image bounds.
|
Number |
getSample(int x,
int y)
Returns the value from the first band of the image at the specified position,
If the position is within the iterator's bounds, but outside the target
image bounds, the outside value is returned.
|
Number |
getSample(int x,
int y,
int band)
Returns the value from the specified band of the image at the specified position,
If the position is within the iterator's bounds, but outside the target
image bounds, the outside value is returned.
|
Number |
getSample(Point pos)
Returns the value from the first band of the image at the specified position,
If the position is within the iterator's bounds, but outside the target
image bounds, the outside value is returned.
|
Number |
getSample(Point pos,
int band)
Returns the value from the specified band of the image at the specified position,
If the position is within the iterator's bounds, but outside the target
image bounds, the outside value is returned.
|
Point |
getStartPos()
Gets the starting position for this iterator.
|
List<Rectangle> |
getSubBounds()
Gets the list of sub-bounds for this iterator.
|
boolean |
hasNext()
Tests if this iterator can be advanced further, ie.
|
boolean |
isWithinImage()
Tests whether the iterator is currently positioned within the bounds of
the target image.
|
boolean |
next()
Advances the iterator to the next position.
|
void |
reset()
Resets the iterator to its first position.
|
boolean |
setPos(int x,
int y)
Sets the iterator to a new position.
|
boolean |
setPos(Point pos)
Sets the iterator to a new position.
|
public AbstractSimpleIterator(org.jaitools.imageutils.iterator.AbstractSimpleIterator.DelegateHelper helper,
RenderedImage image,
Rectangle bounds,
Number outsideValue,
AbstractSimpleIterator.Order order)
helper - a helper provided by sub-class to create the delegate iteratorimage - the target imagebounds - the bounds for this iterator; null means to use the
target image boundsoutsideValue - value to return when positioned outside the bounds of
the target imageorder - order of movement for this iteratorIllegalArgumentException - if the image argument is nullpublic RenderedImage getImage()
null.public Rectangle getBounds()
public List<Rectangle> getSubBounds()
When working in the default AbstractSimpleIterator.Order.IMAGE_X_Y processing order, this method will return a list containing a single rectangle, identical to that returned by getBounds().
The returned List and the Rectangles within it are copies, so the
iterator will not be affected by subsequent modifications to them.
public Point getStartPos()
public Point getEndPos()
public boolean isWithinImage()
true if within the target image; false otherwisepublic boolean hasNext()
next() would return true.true if the iterator can be advanced;
false if it is at the end of its boundspublic boolean next()
true if the iterator was successfully advanced;
false if it was already at the end of its boundspublic void reset()
public Point getPos()
public Point getPos(Point dest)
dest is not null
it will be set to the current position and returned, otherwise a new
Point instance is returned. It is always safe to call this method.public boolean setPos(Point pos)
true indicates that the new position was valid. If the new position
is equal to the iterator's current position this method will still
return true even though the iterator has not moved.
If the new position is outside this iterator's bounds, the position remains
unchanged and false is returned.
pos - the new positiontrue if the new position was valid; false
otherwiseIllegalArgumentException - if pos is nullpublic boolean setPos(int x,
int y)
true indicates that the new position was valid. If the new position
is equal to the iterator's current position this method will still
return true even though the iterator has not moved.
If the new position is outside this iterator's bounds, the position remains
unchanged and false is returned.
x - image X positiony - image Y positiontrue if the new position was valid; false
otherwisepublic Number getSample()
public Number getSample(Point pos)
If the position is outside the iterator's bounds, null is returned
and the iterator's position will remain unchanged.
pos - the position to samplenullIllegalArgumentException - if pos is nullpublic Number getSample(int x, int y)
If the position is outside the iterator's bounds, null is returned
and the iterator's position will remain unchanged.
x - sampling position X-ordinatey - sampling position Y-ordinatenullpublic Number getSample(int band)
band - image bandIllegalArgumentException - if band is out of range for the the
target imagepublic Number getSample(Point pos, int band)
If the position is outside the iterator's bounds, null is returned
and the iterator's position will remain unchanged.
pos - the position to sampleband - image bandnullIllegalArgumentException - if pos is null or
band is out of rangepublic Number getSample(int x, int y, int band)
If the position is outside the iterator's bounds, null is returned
and the iterator's position will remain unchanged.
x - sampling position X-ordinatey - sampling position Y-ordinateband - image bandnullIllegalArgumentException - if band is out of rangepublic void done()
Copyright © 2009–2018. All rights reserved.