ilog.views.maps.raster
Class IlvRasterTileLoader

java.lang.Object
  extended by ilog.views.maps.raster.IlvRasterTileLoader
All Implemented Interfaces:
IlvPersistentObject, IlvTileLoader
Direct Known Subclasses:
IlvRasterSubsamplingLoader

public class IlvRasterTileLoader
extends Object
implements IlvTileLoader, IlvPersistentObject

This class provides the mechanism for the dynamic tiling. A projected image is cut into tiles and filled with pixels according to the projection of the view. The pixels are computed according to the original projection of the source raster.
The dynamic tiling also allows a subsampled preview in order to provide the user with a rough image while the tile loader is computing the detailed picture.

Since:
JViews 7.5

Constructor Summary
IlvRasterTileLoader(IlvInputStream stream)
          Reads the raster info from the specified input stream.
IlvRasterTileLoader(IlvRasterProperties rasterProperties, IlvRasterMappedBuffer rasterMappedBuffer, IlvCoordinateTransformation transformation)
          Constructor taking as parameters the information about the raster and the data in two separated objects.
 
Method Summary
protected  int getBytePixel(IlvCoordinate pret, int noData)
          Compute the pixel value.
 IlvMathTransform getInternalTransformation()
          Returns the internal transformation from lat/lon to raster x/y.
protected  int getIntPixel(IlvCoordinate pret, int noData)
          Compute the pixel value.
 int getPreviewDelay()
          Returns the preview Delay.
 int getPreviewSubsampling()
          Returns the subsampling factor for a possible preview image.
 IlvAttributeProperty getProperties()
          The image properties.
 IlvRasterMappedBuffer getRasterMappedBuffer()
          Return the data of the raster of the original image.
 IlvRasterProperties getRasterProperties()
          Accesses the information about the raster of the image.
 ImageProducer getRawImageProducer()
          Returns an image producer to return the whole unprojected image.
 ImageProducer getScaledImageProducer(int subsampling, IlvRect managerBounds)
          Returns an image producer able to generate an image for the parameters passed.
 IlvCoordinateTransformation getTransformation()
          Returns Coordinate transformation to attach the image to a manager.
 boolean isHighQualityRendering()
          Indicates if the icon should be rendered high quality.
 boolean isPersistent()
          Returns true if the object must be saved by a tile controller.
 boolean isSynchronous()
          Tests if this raster tile loader is loading images synchronously or not.
 void load(IlvTile tile)
          Function called when a tile has to be loaded.
protected  IlvRasterIcon makeIcon(int subsampling, Point2D.Double p1, Point2D.Double p2)
          Factory of icons from the subsampling and two corners parameters.
protected  void rasterTileLoaded(IlvTile tile)
          This method is called when a raster tile has been loaded.
 void release(IlvTile tile)
          Function called when a tile has to be released.
 void setHighQualityRendering(boolean value)
          Changes the rendering quality state of the image.
 void setPreviewSubsampling(int previewSubsampling, int previewDelay)
          Sets the subsampling factor for a possible preview image.
 void setProperties(IlvAttributeProperty properties)
          Sets the properties that will affect the image when it is created.
 void setSynchronous(boolean synchronous)
          Sets the synchronous image loading policy for this tile loader.
 void setTransformation(IlvCoordinateTransformation transformation)
          Sets the coordinate transformation to use for creating an image attached to a manager.
protected  void setupIcon(IlvRasterIcon icon)
          Sets up the icon.
 void write(IlvOutputStream out)
          Writes the attributes of a persistent object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvRasterTileLoader

public IlvRasterTileLoader(IlvInputStream stream)
                    throws IlvReadFileException
Reads the raster info from the specified input stream.

Parameters:
stream - The input stream.
Throws:
IlvReadFileException - if an error occurs while reading the data.

IlvRasterTileLoader

public IlvRasterTileLoader(IlvRasterProperties rasterProperties,
                           IlvRasterMappedBuffer rasterMappedBuffer,
                           IlvCoordinateTransformation transformation)
Constructor taking as parameters the information about the raster and the data in two separated objects.

Parameters:
rasterProperties - The information about the raster.
rasterMappedBuffer - The data of the raster of the original image.
transformation - The transformation to use from view to geographic coordinates.
Method Detail

getInternalTransformation

public IlvMathTransform getInternalTransformation()
Returns the internal transformation from lat/lon to raster x/y.

Returns:
The internal transformation from lat/lon to raster x/y.

getRasterMappedBuffer

public IlvRasterMappedBuffer getRasterMappedBuffer()
Return the data of the raster of the original image.

Returns:
Data of the raster of the original image.

getRasterProperties

public final IlvRasterProperties getRasterProperties()
Accesses the information about the raster of the image.

Returns:
The information for the dynamic tiling.

getRawImageProducer

public ImageProducer getRawImageProducer()
Returns an image producer to return the whole unprojected image.

Returns:
An image producer.

getTransformation

public IlvCoordinateTransformation getTransformation()
Returns Coordinate transformation to attach the image to a manager.

Returns:
Coordinate transformation to attach the image to a manager.

isPersistent

public boolean isPersistent()
Returns true if the object must be saved by a tile controller.

Specified by:
isPersistent in interface IlvTileLoader
See Also:
IlvTileLoader.isPersistent()

load

public void load(IlvTile tile)
          throws Exception
Function called when a tile has to be loaded. When the tile loader has finished its operation, it should call the function IlvTile.loadComplete to notify the tile listeners.

Specified by:
load in interface IlvTileLoader
Throws:
Exception
See Also:
IlvTileLoader.load(ilog.views.tiling.IlvTile)

rasterTileLoaded

protected void rasterTileLoaded(IlvTile tile)
This method is called when a raster tile has been loaded. Default implementation checks whether the new tile contains an altitude data source in order to update GUI elements that could depend on the altitude provider.

Parameters:
tile -

makeIcon

protected IlvRasterIcon makeIcon(int subsampling,
                                 Point2D.Double p1,
                                 Point2D.Double p2)
Factory of icons from the subsampling and two corners parameters.

Parameters:
subsampling - Initial subsampling of the image created.
p1 - The definition rectangle of the object.
p2 - The definition rectangle of the object.
Returns:
The subsampled icon graphic.

setupIcon

protected void setupIcon(IlvRasterIcon icon)
Sets up the icon. By default, it prevents size change and sets the named properties.

Parameters:
icon - Icon to setup.

release

public void release(IlvTile tile)
Function called when a tile has to be released.

Specified by:
release in interface IlvTileLoader
See Also:
IlvTileLoader.release(ilog.views.tiling.IlvTile)

setHighQualityRendering

public void setHighQualityRendering(boolean value)
Changes the rendering quality state of the image. Setting the value to true will improve the rendering. The default value is false.

Parameters:
value - The value.

isHighQualityRendering

public boolean isHighQualityRendering()
Indicates if the icon should be rendered high quality.

Returns:
true if the icon is high quality.

setProperties

public void setProperties(IlvAttributeProperty properties)
Sets the properties that will affect the image when it is created.

Parameters:
properties - Feature properties that will affect the image.

setTransformation

public void setTransformation(IlvCoordinateTransformation transformation)
Sets the coordinate transformation to use for creating an image attached to a manager.

Parameters:
transformation - Coordinate transformation from view to geographic coordinates to attach the image to a manager.

write

public void write(IlvOutputStream out)
           throws IOException
Writes the attributes of a persistent object.

Specified by:
write in interface IlvPersistentObject
Specified by:
write in interface IlvTileLoader
Parameters:
out - the output stream
Throws:
IOException - thrown when an exception occurs during the write operation for this object.
See Also:
IlvPersistentObject.write(ilog.views.io.IlvOutputStream)

getBytePixel

protected int getBytePixel(IlvCoordinate pret,
                           int noData)
Compute the pixel value. It is retrieved from an original raster containing byte data.

Parameters:
pret - Manager x,y coordinate.
noData - Value to return when no pixel is present at the location.
Returns:
The computed pixel value or noData.

getIntPixel

protected int getIntPixel(IlvCoordinate pret,
                          int noData)
Compute the pixel value. It is retrieved from an original raster containing integer data.

Parameters:
pret - Manager x,y coordinate.
noData - Value to return when no pixel is present at the location.
Returns:
The computed pixel value or noData.

getScaledImageProducer

public ImageProducer getScaledImageProducer(int subsampling,
                                            IlvRect managerBounds)
Returns an image producer able to generate an image for the parameters passed.

Parameters:
subsampling - Subsampling to apply to the image.
managerBounds - Manager bounds of the image.
Returns:
The image producer.

getPreviewSubsampling

public int getPreviewSubsampling()
Returns the subsampling factor for a possible preview image.

Returns:
The subsampling factor for a possible preview image.

setPreviewSubsampling

public void setPreviewSubsampling(int previewSubsampling,
                                  int previewDelay)
Sets the subsampling factor for a possible preview image. If this parameter is above 1, the load method will first create a subsampled image of the raster. After some time has elapsed, the final image will be generated, if the tile is still loaded.

Parameters:
previewSubsampling - The subsampling factor for a possible preview image.
previewDelay - The time in ms where the preview will be visible (for example 500ms).

getProperties

public IlvAttributeProperty getProperties()
The image properties.

Returns:
The image properties used when loading the tile.

getPreviewDelay

public int getPreviewDelay()
Returns the preview Delay.

Returns:
Returns the preview Delay.

isSynchronous

public boolean isSynchronous()
Tests if this raster tile loader is loading images synchronously or not.

Returns:
If image loading is synchronous, true is returned.
Since:
JViews 8.0

setSynchronous

public void setSynchronous(boolean synchronous)
Sets the synchronous image loading policy for this tile loader.

Parameters:
synchronous - Set to true to load images synchronously.
Since:
JViews 8.0


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.