public abstract class IlvRasterAbstractReader extends Object implements IlvMapReusableFeatureIterator, IlvPersistentObject
Class containing the methods for all readers of raster image formats. It
contains a built-in mechanism for tiling the image to be displayed.
The raster to be displayed is managed by
IlvRasterMappedBuffer
, information about
the raster to be displayed in the image is in
IlvRasterProperties
, and the mechanism of the
dynamic tiling is managed by a
IlvRasterTileLoader
.
The raster image will be read by the reader in a method of the subclassed
reader, often called read
. This method adds a raster to the list of the
rasters using the addRaster(IlvRasterProperties, IlvRasterMappedBuffer)
method.
Then the image is built when the getTileLoader(int)
method is called. It creates a
IlvRasterTileLoader
to tile the raster.
The IlvRasterAbstractReader
needs the projection or the original raster and the
projection to use in the view. From these it can compute dynamically all the pixel
values in the image to produce from the raster of the original image.
The classes extending the IlvRasterAbstractReader
must provide the
implementation of the getInternalTransformation(int)
in order to provide
the projection of the source.
The other projection is used to project the raster in order to fill the image
created by the reader.
IlvRasterProperties
,
IlvRasterMappedBuffer
,
IlvRasterTileLoader
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected boolean |
needReload
Indicates that this reader should be reloaded when the data source is called.
|
Constructor and Description |
---|
IlvRasterAbstractReader()
Default constructor.
|
IlvRasterAbstractReader(IlvInputStream stream)
Stream constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
addRaster(IlvRasterProperties rasterInfo,
IlvRasterMappedBuffer source)
Adds a new set of image information to the list managed by the raster reader.
|
protected Rectangle2D.Double |
computeGisImageBounds(int imgIndex,
IlvRasterProperties rasterInfo)
Computes the map bounds of the GIS image displaying the raster.
|
protected Rectangle2D.Double |
computeLimits(int imgIndex,
IlvCoordinate min,
IlvCoordinate max,
int horizStep,
int verticStep)
Compute bounds projected with the projection of the view given two points
projected with the original projection.
|
IlvRasterTileLoader |
createRasterTileLoader(IlvRasterProperties rasterInfo,
IlvRasterMappedBuffer source,
int imageIndex,
boolean allowSubsampling)
Creates the
IlvRasterTileLoader used to tile the images produced by
the getTileLoader(int) method. |
void |
dispose()
Disposes this reader.
|
IlvFeatureRenderer |
getDefaultFeatureRenderer()
Returns an
IlvFeatureRenderer suitable
for the IlvMapFeature built by this
reader. |
static int |
getDefaultMaximumIntervalsForDeterminingImageLocation()
Returns the default maximum number of intervals for determining the image location.
|
Rectangle2D.Double |
getImageBounds(int imageIndex)
Returns the bounds of the image in manager coordinates.
|
int |
getImageCount()
Returns The number of registered images.
|
abstract IlvMathTransform |
getInternalTransformation(int imageIndex)
Return the projection associated with the raster stored at the given
index.
|
IlvCoordinateTransformation |
getInverseTransformation()
Gets the transformation used to reproject the data to produce the bounds
returned by the
getImageBounds(int) method. |
IlvCoordinate |
getLowerRightCorner()
Retrieves the lower right corner of the image or
null if none has been set. |
protected IlvCoordinate |
getLowerRightCorner(int idxImage)
Retrieves the lower right corner of the image.
|
int |
getMaximumIntervalsForDeterminingImageLocation()
Returns the maximum number of intervals for determining Image location.
|
IlvMapFeature |
getNextFeature()
Returns the
IlvMapFeature whose geometry is
an IlvMapImage . |
abstract IlvFeatureAttributeProperty |
getProperties(int imageIndex)
Returns the feature properties to be associated with the image.
|
IlvRasterMappedBuffer |
getRasterMappedBuffer(int imageIndex)
Retrieves the pixel buffer of the image.
|
IlvRasterProperties |
getRasterProperties(int imageIndex)
Retrieves the raster properties of the image.
|
IlvRasterTileLoader |
getTileLoader(int imageIndex)
Creates and returns the image corresponding to the raster info and raster
image source of the provided index.
|
IlvRasterTileLoader |
getTileLoader(int imageIndex,
boolean allowSubsampling)
Creates and returns the image corresponding to the raster info and raster
image source of the provided index.
|
Collection<IlvRasterTileLoader> |
getTileLoaders()
Creates and returns the images corresponding to the rasters read.
|
IlvCoordinateTransformation |
getTransformation()
Gets the transformation used to reproject the data to produce the images
returned by the
getTileLoader(int) method. |
IlvCoordinate |
getUpperLeftCorner()
Retrieves the upper left corner of the first image or
null if none has been set. |
protected IlvCoordinate |
getUpperLeftCorner(int idxImage)
Retrieves the upper left corner of the image.
|
boolean |
isForceImageLoadingWhenSaving()
Indicates whether this reader loads all images at the time that the map is saved.
|
boolean |
isGeoreferenced()
Indicates if the reader is georeferenced (that is
if a source projection has been defined for this reader.
|
boolean |
isHighQualityRendering()
Indicates if the icon should be rendered high quality.
|
boolean |
isNeedReload()
Returns the
needReload . |
void |
reload(IlvThreadMonitoringData monitorInfo)
Given the state of the reader (number of images read, coverage zone,...), the purpose of this method
is to recreate all images from the original source.
|
void |
removeRaster(int imageIndex)
Remove a raster image from the list known by the raster reader.
|
void |
restart()
Rewinds the iterator for a new use.
|
static void |
setDefaultMaximumIntervalsForDeterminingImageLocation(int maxIntervals)
Sets the default number of intervals on the border of an image for the purpose of determining its location in the manager.
|
void |
setForceImageLoadingWhenSaving(boolean force)
Sets whether to force this reader to load all images at the time that the map
is saved.
|
void |
setHighQualityRendering(boolean value)
Changes the rendering quality state of the images produced by the IlvRasterTileLoader created by this reader.
|
void |
setMaximumIntervalsForDeterminingImageLocation(int maxIntervals)
Optimizes the number of intervals on the border of an image for the purpose of determining its location in the manager.
|
void |
setTransformation(IlvCoordinateTransformation transformation)
Sets the transformation to use to project the data read from the file.
|
void |
write(IlvOutputStream stream)
Writes the attributes of a persistent object.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCoordinateSystem
protected boolean needReload
public IlvRasterAbstractReader()
public IlvRasterAbstractReader(IlvInputStream stream) throws IlvReadFileException
stream
- IlvReadFileException
public static int getDefaultMaximumIntervalsForDeterminingImageLocation()
setMaximumIntervalsForDeterminingImageLocation(int)
public static void setDefaultMaximumIntervalsForDeterminingImageLocation(int maxIntervals)
maxIntervals
- The default maximum number of intervals for determining the image location.setMaximumIntervalsForDeterminingImageLocation(int)
public void reload(IlvThreadMonitoringData monitorInfo)
IlvRasterProperties
of the reader as they
might not be saved when the theme only is saved.monitorInfo
- Used to update task progress.public int addRaster(IlvRasterProperties rasterInfo, IlvRasterMappedBuffer source)
rasterInfo
- Information about the raster.source
- The raster data.public void removeRaster(int imageIndex)
imageIndex
- The index of the information stored in the list of rasters.addRaster(IlvRasterProperties, IlvRasterMappedBuffer)
public IlvRasterTileLoader createRasterTileLoader(IlvRasterProperties rasterInfo, IlvRasterMappedBuffer source, int imageIndex, boolean allowSubsampling)
IlvRasterTileLoader
used to tile the images produced by
the getTileLoader(int)
method.rasterInfo
- Information to tile the raster.source
- The raster data.imageIndex
- The index of the image (ignored in default implementation).allowSubsampling
- If true
, will generate a loader that shows only the necessary subsampled image for the current zoom factor, and reloads it when the zoom factor changes.public void setHighQualityRendering(boolean value)
true
will improve the rendering. The default value is
false
.value
- The value.public boolean isHighQualityRendering()
true
if the icon is high quality.public void dispose()
dispose
in interface IlvMapFeatureIterator
public IlvFeatureRenderer getDefaultFeatureRenderer()
IlvFeatureRenderer
suitable
for the IlvMapFeature
built by this
reader. The returned IlvFeatureRenderer
is
an IlvDefaultImageRenderer
.getDefaultFeatureRenderer
in interface IlvMapFeatureIterator
IlvDefaultImageRenderer
.public Rectangle2D.Double getImageBounds(int imageIndex)
imageIndex
- The index of the information stored in the list of rasters.public abstract IlvMathTransform getInternalTransformation(int imageIndex)
imageIndex
- The index of the raster.public IlvCoordinateTransformation getInverseTransformation()
getImageBounds(int)
method.setTransformation
.public IlvCoordinate getLowerRightCorner()
null
if none has been set.getLowerRightCorner
in interface IlvMapFeatureIterator
public IlvMapFeature getNextFeature()
IlvMapFeature
whose geometry is
an IlvMapImage
.getNextFeature
in interface IlvMapFeatureIterator
IlvMapFeature
.public void restart()
restart
in interface IlvMapReusableFeatureIterator
IlvMapReusableFeatureIterator.restart()
public abstract IlvFeatureAttributeProperty getProperties(int imageIndex)
imageIndex
- The index of the image.public IlvRasterTileLoader getTileLoader(int imageIndex)
imageIndex
- The index of the information stored in the list of rasters.addRaster(IlvRasterProperties, IlvRasterMappedBuffer)
public IlvRasterTileLoader getTileLoader(int imageIndex, boolean allowSubsampling)
imageIndex
- The index of the information stored in the list of rasters.allowSubsampling
- If true, will generate a loader that show only the necessary subsampled image for the current zoom factor, and reload it when the zoom factor changes.addRaster(IlvRasterProperties, IlvRasterMappedBuffer)
public Collection<IlvRasterTileLoader> getTileLoaders()
IlvRasterAbstractReader
reads a raster file, it stores the
raster using the addRaster(IlvRasterProperties, IlvRasterMappedBuffer)
method. The images returned by this method are built from the stored
info.IlvRasterTileLoader
getTileLoader(int)
public IlvCoordinateTransformation getTransformation()
getTileLoader(int)
method.setTransformation
.public IlvCoordinate getUpperLeftCorner()
null
if none has been set.getUpperLeftCorner
in interface IlvMapFeatureIterator
public boolean isGeoreferenced()
isGeoreferenced
in interface IlvMapFeatureIterator
true
if a source projection has been set,
false
otherwise.public void setTransformation(IlvCoordinateTransformation transformation)
transformation
- The transformation of the view.public void setForceImageLoadingWhenSaving(boolean force)
.ivl
file.force
- Indicates whether the reader loads all images at
write time. By default, some images may not be loaded, and references
to them remain in the saved .ivl
file. Set to
true
if you want to redistribute the
.ivl
file without references to unread raster files.public boolean isForceImageLoadingWhenSaving()
true
, the reader loads all images at write time,
and any references to unread raster files are not included in the saved
.ivl
file.public void write(IlvOutputStream stream) throws IOException
write
in interface IlvPersistentObject
stream
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.protected Rectangle2D.Double computeGisImageBounds(int imgIndex, IlvRasterProperties rasterInfo)
imgIndex
- The index of the image that will fill these bounds.rasterInfo
- The information about the raster.protected Rectangle2D.Double computeLimits(int imgIndex, IlvCoordinate min, IlvCoordinate max, int horizStep, int verticStep)
imgIndex
- The index of the image that will fill these bounds.min
- The lower left corner.max
- The upper right corner.horizStep
- The step for the x coordinates in the view projection.verticStep
- The step for the x coordinates in the view projection.protected IlvCoordinate getLowerRightCorner(int idxImage)
idxImage
- The index of the information stored in the list of rasters.public IlvRasterMappedBuffer getRasterMappedBuffer(int imageIndex)
imageIndex
- The index of the image.public IlvRasterProperties getRasterProperties(int imageIndex)
imageIndex
- The index of the image.protected IlvCoordinate getUpperLeftCorner(int idxImage)
idxImage
- The index of the information stored in the list of rasters.public int getImageCount()
public int getMaximumIntervalsForDeterminingImageLocation()
public void setMaximumIntervalsForDeterminingImageLocation(int maxIntervals)
maxIntervals
- The maximum number of intervals for determining the image location.
The default value is 16, which is a good compromise for speed.
Increase it when the projection seems to leave out parts of the image.
Decrease it to improve performance when you have a relatively rectangular projection or many imagespublic boolean isNeedReload()
needReload
.needReload
.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.