|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.imageio.ImageReader
org.geotools.image.io.mosaic.MosaicImageReader
public class MosaicImageReader
An image reader built from a mosaic of other image readers. The mosaic is specified as a
collection of Tile
objects, organized in a TileManager
.
Nested Class Summary | |
---|---|
static class |
MosaicImageReader.Spi
Service provider for MosaicImageReader . |
Field Summary |
---|
Fields inherited from class javax.imageio.ImageReader |
---|
availableLocales, ignoreMetadata, input, locale, minIndex, originatingProvider, progressListeners, seekForwardOnly, updateListeners, warningListeners, warningLocales |
Constructor Summary | |
---|---|
MosaicImageReader()
Constructs an image reader with the default provider. |
|
MosaicImageReader(javax.imageio.spi.ImageReaderSpi spi)
Constructs an image reader with the specified provider. |
Method Summary | |
---|---|
void |
abort()
Requests that any current read operation be aborted. |
void |
close()
Closes any image input streams thay may be held by tiles. |
void |
dispose()
Allows any resources held by this reader to be released. |
float |
getAspectRatio(int imageIndex)
Returns the aspect ratio. |
java.util.Locale[] |
getAvailableLocales()
Returns an array of locales that may be used to localize warning listeners. |
ImageTypePolicy |
getDefaultImageTypePolicy()
Returns the policy for computing image types . |
MosaicImageReadParam |
getDefaultReadParam()
Returns default parameters appropriate for this format. |
int |
getHeight(int imageIndex)
Returns the height in pixels of the given image within the input source. |
javax.imageio.metadata.IIOMetadata |
getImageMetadata(int imageIndex)
Returns the metadata associated with the given image, or null . |
javax.imageio.metadata.IIOMetadata |
getImageMetadata(int imageIndex,
java.lang.String formatName,
java.util.Set<java.lang.String> nodeNames)
Returns the image metadata for the given format and nodes, or null . |
java.util.Iterator<javax.imageio.ImageTypeSpecifier> |
getImageTypes(int imageIndex)
Returns possible image types to which the given image may be decoded. |
TileManager[] |
getInput()
Returns the input, which is a an array of tile managers. |
java.util.logging.Level |
getLogLevel()
Returns the logging level for tile information during reads. |
int |
getNumImages(boolean allowSearch)
Returns the number of images, not including thumbnails. |
javax.imageio.ImageTypeSpecifier |
getRawImageType(int imageIndex)
Returns an image type which most closely represents the "raw" internal format of the image. |
javax.imageio.metadata.IIOMetadata |
getStreamMetadata()
Returns the metadata associated with the input source as a whole, or null . |
javax.imageio.metadata.IIOMetadata |
getStreamMetadata(java.lang.String formatName,
java.util.Set<java.lang.String> nodeNames)
Returns the stream metadata for the given format and nodes, or null . |
int |
getTileHeight(int imageIndex)
Returns the height of a tile in the given image. |
java.util.Set<javax.imageio.spi.ImageReaderSpi> |
getTileReaderSpis()
Returns the Service Provider Interfaces (SPI) of every image readers to be used for reading tiles. |
int |
getTileWidth(int imageIndex)
Returns the width of a tile in the given image. |
int |
getWidth(int imageIndex)
Returns the width in pixels of the given image within the input source. |
boolean |
isImageTiled(int imageIndex)
Returns true if there is more than one tile for the given image index. |
boolean |
isRandomAccessEasy(int imageIndex)
Returns true if the storage format of the given image places no inherent impediment
on random access to pixels. |
java.awt.image.BufferedImage |
read(int imageIndex,
javax.imageio.ImageReadParam param)
Reads the image indexed by imageIndex using a supplied parameters. |
java.awt.image.BufferedImage |
readTile(int imageIndex,
int tileX,
int tileY)
Reads the tile indicated by the tileX and tileY arguments. |
void |
setInput(java.lang.Object input,
boolean seekForwardOnly,
boolean ignoreMetadata)
Sets the input source, which is expected to be an array of tile managers. |
void |
setLocale(java.util.Locale locale)
Sets the current locale of this image reader and every tile readers. |
void |
setLogLevel(java.util.logging.Level level)
Sets the logging level for tile information during reads. |
Methods inherited from class javax.imageio.ImageReader |
---|
abortRequested, addIIOReadProgressListener, addIIOReadUpdateListener, addIIOReadWarningListener, canReadRaster, checkReadParamBandSettings, clearAbortRequest, computeRegions, getDestination, getFormatName, getLocale, getMinIndex, getNumThumbnails, getOriginatingProvider, getSourceRegion, getThumbnailHeight, getThumbnailWidth, getTileGridXOffset, getTileGridYOffset, hasThumbnails, isIgnoringMetadata, isSeekForwardOnly, processImageComplete, processImageProgress, processImageStarted, processImageUpdate, processPassComplete, processPassStarted, processReadAborted, processSequenceComplete, processSequenceStarted, processThumbnailComplete, processThumbnailPassComplete, processThumbnailPassStarted, processThumbnailProgress, processThumbnailStarted, processThumbnailUpdate, processWarningOccurred, processWarningOccurred, read, readAll, readAll, readAsRenderedImage, readerSupportsThumbnails, readRaster, readThumbnail, readTileRaster, removeAllIIOReadProgressListeners, removeAllIIOReadUpdateListeners, removeAllIIOReadWarningListeners, removeIIOReadProgressListener, removeIIOReadUpdateListener, removeIIOReadWarningListener, reset, setInput, setInput |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MosaicImageReader()
public MosaicImageReader(javax.imageio.spi.ImageReaderSpi spi)
spi
- The image reader provider, or null
for the default one.Method Detail |
---|
public java.util.logging.Level getLogLevel()
public void setLogLevel(java.util.logging.Level level)
Level.FINE
. A null
value restore the default.
level
- The new logging level, or null
for the default.public TileManager[] getInput()
getInput
in class javax.imageio.ImageReader
public void setInput(java.lang.Object input, boolean seekForwardOnly, boolean ignoreMetadata) throws java.lang.IllegalArgumentException
Tile
objects, then it will be wrapped in an
array of TileManager
s.
setInput
in class javax.imageio.ImageReader
input
- The input.seekForwardOnly
- if true
, images and metadata may only be read in ascending
order from this input source.ignoreMetadata
- if true
, metadata may be ignored during reads.
java.lang.IllegalArgumentException
- if input
is not an instance of one of the
expected classes, or if the input can not be used because of an I/O error
(in which case the exception has a IOException
as its
cause).public java.util.Set<javax.imageio.spi.ImageReaderSpi> getTileReaderSpis()
TileManager.getImageReaderSpis()
public java.util.Locale[] getAvailableLocales()
getAvailableLocales
in class javax.imageio.ImageReader
null
.public void setLocale(java.util.Locale locale) throws java.lang.IllegalArgumentException
setLocale
in class javax.imageio.ImageReader
locale
- the desired locale, or null
.
java.lang.IllegalArgumentException
- if locale
is non-null but is not
one of the available locales.public int getNumImages(boolean allowSearch) throws java.io.IOException
getNumImages
in class javax.imageio.ImageReader
java.io.IOException
- If an error occurs reading the information from the input source.public boolean isImageTiled(int imageIndex) throws java.io.IOException
true
if there is more than one tile for the given image index.
isImageTiled
in class javax.imageio.ImageReader
imageIndex
- The index of the image to be queried.
true
If there is at least two tiles.
java.io.IOException
- If an error occurs reading the information from the input source.public int getWidth(int imageIndex) throws java.io.IOException
getWidth
in class javax.imageio.ImageReader
imageIndex
- The index of the image to be queried.
java.io.IOException
- If an error occurs reading the information from the input source.public int getHeight(int imageIndex) throws java.io.IOException
getHeight
in class javax.imageio.ImageReader
imageIndex
- The index of the image to be queried.
java.io.IOException
- If an error occurs reading the information from the input source.public int getTileWidth(int imageIndex) throws java.io.IOException
getTileWidth
in class javax.imageio.ImageReader
imageIndex
- The index of the image to be queried.
java.io.IOException
- If an error occurs reading the information from the input source.public int getTileHeight(int imageIndex) throws java.io.IOException
getTileHeight
in class javax.imageio.ImageReader
imageIndex
- The index of the image to be queried.
java.io.IOException
- If an error occurs reading the information from the input source.public boolean isRandomAccessEasy(int imageIndex) throws java.io.IOException
true
if the storage format of the given image places no inherent impediment
on random access to pixels. The default implementation returns true
if the input of
every tiles is a File
and isRandomAccessEasy
returned true
for all
tile readers.
isRandomAccessEasy
in class javax.imageio.ImageReader
java.io.IOException
- If an error occurs reading the information from the input source.public float getAspectRatio(int imageIndex) throws java.io.IOException
getAspectRatio
in class javax.imageio.ImageReader
imageIndex
- The index of the image to be queried.
java.io.IOException
- If an error occurs reading the information from the input source.public ImageTypePolicy getDefaultImageTypePolicy()
computing image types
. This is also
the policy used by read method when none has been explicitly
set in read parameters.
The default implementation makes the following choice based on the number of reader providers:
SUPPORTED_BY_ALL
if two or moreSUPPORTED_BY_ONE
if exactly oneALWAYS_ARGB
if none.
Note that SUPPORTED_BY_ONE
is not
a really safe choice even if there is only one provider, because the image type can also
depends on tile input. However the safest choice in all cases
(SUPPORTED_BY_ALL
) is costly and often not
necessary. The current implementation is a compromize between safety and performance.
If Java assertions are enabled, this reader will verify that SUPPORTED_BY_ONE
produces the same result than SUPPORTED_BY_ALL
.
Subclasses can override this method if they want a different policy.
public javax.imageio.ImageTypeSpecifier getRawImageType(int imageIndex) throws java.io.IOException
SUPPORTED_BY_ONE
, this method delegates
directly to the reader of an arbitrary tile (typically the first one).SUPPORTED_BY_ALL
, this method invokes
getRawImageType
for every tile readers, ommits the types that are not declared
in getImageTypes(imageIndex)
for
every tile readers, and returns the most common remainding value. If none is found,
then some default specifier is returned.
getRawImageType
in class javax.imageio.ImageReader
imageIndex
- The image index, from 0 inclusive to getNumImages(boolean)
exclusive.
java.io.IOException
- If an error occurs reading the information from the input source.public java.util.Iterator<javax.imageio.ImageTypeSpecifier> getImageTypes(int imageIndex) throws java.io.IOException
SUPPORTED_BY_ONE
, this method delegates
directly to the reader of an arbitrary tile (typically the first one).SUPPORTED_BY_ALL
, this method invokes
getImageTypes(imageIndex)
on
every tile readers and returns the intersection of all sets (i.e. only the types
that are supported by every readers).
getImageTypes
in class javax.imageio.ImageReader
imageIndex
- The image index, from 0 inclusive to getNumImages(boolean)
exclusive.
java.io.IOException
- If an error occurs reading the information from the input source.public MosaicImageReadParam getDefaultReadParam()
getDefaultReadParam
in class javax.imageio.ImageReader
public javax.imageio.metadata.IIOMetadata getStreamMetadata() throws java.io.IOException
null
.
The default implementation tries to merge the
metadata from every tiles.
getStreamMetadata
in class javax.imageio.ImageReader
java.io.IOException
- if an error occurs during reading.public javax.imageio.metadata.IIOMetadata getStreamMetadata(java.lang.String formatName, java.util.Set<java.lang.String> nodeNames) throws java.io.IOException
null
.
The default implementation tries to merge
the metadata from every tiles.
getStreamMetadata
in class javax.imageio.ImageReader
java.io.IOException
- if an error occurs during reading.public javax.imageio.metadata.IIOMetadata getImageMetadata(int imageIndex) throws java.io.IOException
null
. The
default implementation tries to merge
the metadata from every tiles.
getImageMetadata
in class javax.imageio.ImageReader
imageIndex
- the index of the image whose metadata is to be retrieved.
null
.
java.lang.IllegalStateException
- if the input source has not been set.
java.lang.IndexOutOfBoundsException
- if the supplied index is out of bounds.
java.io.IOException
- if an error occurs during reading.public javax.imageio.metadata.IIOMetadata getImageMetadata(int imageIndex, java.lang.String formatName, java.util.Set<java.lang.String> nodeNames) throws java.io.IOException
null
.
The default implementation tries to merge
the metadata from every tiles.
getImageMetadata
in class javax.imageio.ImageReader
java.io.IOException
- if an error occurs during reading.public java.awt.image.BufferedImage read(int imageIndex, javax.imageio.ImageReadParam param) throws java.io.IOException
imageIndex
using a supplied parameters.
See MosaicImageReadParam
for a performance recommandation.
If the parameters allow subsampling changes, then the subsampling effectively used
will be written back in the given parameters.
read
in class javax.imageio.ImageReader
imageIndex
- The index of the image to be retrieved.param
- The parameters used to control the reading process, or null
.
An instance of MosaicImageReadParam
is expected but not required.
java.io.IOException
- if an error occurs during reading.public java.awt.image.BufferedImage readTile(int imageIndex, int tileX, int tileY) throws java.io.IOException
tileX
and tileY
arguments.
readTile
in class javax.imageio.ImageReader
imageIndex
- The index of the image to be retrieved.tileX
- The column index (starting with 0) of the tile to be retrieved.tileY
- The row index (starting with 0) of the tile to be retrieved.
java.io.IOException
- if an error occurs during reading.public void abort()
abort
in class javax.imageio.ImageReader
public void close() throws java.io.IOException
java.io.IOException
- if error occured while closing a stream.public void dispose()
dispose
in class javax.imageio.ImageReader
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |