org.deegree_impl.model.gc
Class ImageGridCoverage

java.lang.Object
  extended byorg.deegree_impl.model.cv.CV_Coverage_Impl
      extended byorg.deegree_impl.model.gc.ImageGridCoverage
All Implemented Interfaces:
CV_Coverage, GC_GridCoverage, java.rmi.Remote, java.io.Serializable

public class ImageGridCoverage
extends CV_Coverage_Impl
implements GC_GridCoverage

Represent the basic implementation which provides access to grid coverage data. A GC_GridCoverage implementation may provide the ability to update grid values.

Version:
2.11.2002
Author:
Andreas Poth
See Also:
Serialized Form

Field Summary
private  PT_Envelope envImg
           
private  GC_GridGeometry gridGeometry
           
private  GC_GridPacking gridPacking
           
private  GeoTransform gt
           
private  java.awt.image.BufferedImage image
           
private  boolean isEditable
           
private  GC_GridGeometry[] overviewGridGeometry
           
private  GC_GridCoverage[] overviews
           
 
Fields inherited from class org.deegree_impl.model.cv.CV_Coverage_Impl
descriptor, dimensionNames, envelope, metadata, numSources, sampleDimensions
 
Constructor Summary
ImageGridCoverage(java.awt.image.BufferedImage image, GM_Envelope bbox, CS_CoordinateSystem crs, boolean isEditable)
          initialzies a simple CV_Coverage with an image, coordinate reference system, an envelope describing the spatial extension of of the coverage and the coverages metadata.
 
Method Summary
 boolean[] getDataBlockAsBoolean(GC_GridRange gridRange)
          Return a sequence of boolean values for a block.
 byte[] getDataBlockAsByte(GC_GridRange gridRange)
          Return a sequence of byte values for a block.
 int[] getDataBlockAsInteger(GC_GridRange gridRange)
          Return a sequence of int values for a block.
 PT_Envelope getGridCorverageSize()
           
 GC_GridGeometry getGridGeometry()
          Information for the grid coverage geometry.
 GC_GridPacking getGridPacking()
          Information for the packing of grid coverage values.
 int getNumOverviews()
          Number of predetermined overviews for the grid.
 int[] getOptimalDataBlockSizes()
          Optimal size to use for each dimension when accessing grid values.
 GC_GridCoverage getOverview(int overviewIndex)
          Returns a pre-calculated overview for a grid coverage.
 GC_GridGeometry getOverviewGridGeometry(int overviewIndex)
          Return the grid geometry for an overview.
 byte[] getPackedDataBlock(GC_GridRange gridRange)
          Return a block of grid coverage data for all sample dimensions.
 CV_PaletteInterpretation getPaletteInterpretation()
          returns the paletteinterpretation of the grid coverages bands
 java.lang.Object getRaster(GM_Envelope env)
          returns a part of the GridCoverage defined by the submitted bounding box (coordinates at the gc's CRS) as BufferedImage
 java.lang.Object getRaster(GM_Envelope env, int width, int height)
          returns a part of the GridCoverage defined by the submitted bounding box (coordinates at the gc's CRS)
 java.lang.Object getRaster(GM_Envelope env, int width, int height, int imageType)
          returns a part of the GridCoverage defined by the submitted bounding box (coordinates at the gc's CRS) as BufferedImage
 CV_SampleDimensionType getSampleDimensionType()
           
 double[] getValueBlockAsDouble(GC_GridRange gridRange)
          Return a sequence of double values for a block.
 boolean isDataEditable()
          Returns true if grid data can be edited.
 void setDataBlockAsBoolean(GC_GridRange gridRange, boolean[] values)
          Set a block of boolean values for all sample dimensions.
 void setDataBlockAsByte(GC_GridRange gridRange, byte[] values)
          Set a block of byte values for all sample dimensions.
 void setDataBlockAsDouble(GC_GridRange gridRange, double[] values)
          Set a block of double values for all sample dimensions.
 void setDataBlockAsInteger(GC_GridRange gridRange, int[] values)
          Set a block of bint values for all sample dimensions.
 void setPackedDataBlock(GC_GridRange gridRange, byte[] values)
          Set a block of grid coverage data for all sample dimensions.
 
Methods inherited from class org.deegree_impl.model.cv.CV_Coverage_Impl
evaluate, evaluateAsBoolean, evaluateAsByte, evaluateAsDouble, evaluateAsInteger, getCoordinateSystem, getDimensionNames, getEnvelope, getMetadataNames, getMetadataValue, getNumSampleDimensions, getNumSources, getSampleDimension, getSource, getTiles, setSampleDimension
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opengis.cv.CV_Coverage
evaluate, evaluateAsBoolean, evaluateAsByte, evaluateAsDouble, evaluateAsInteger, getCoordinateSystem, getDimensionNames, getEnvelope, getMetadataNames, getMetadataValue, getNumSampleDimensions, getNumSources, getSampleDimension, getSource
 

Field Detail

isEditable

private boolean isEditable

overviewGridGeometry

private GC_GridGeometry[] overviewGridGeometry

overviews

private GC_GridCoverage[] overviews

gridGeometry

private GC_GridGeometry gridGeometry

gridPacking

private GC_GridPacking gridPacking

gt

private GeoTransform gt

envImg

private PT_Envelope envImg

image

private java.awt.image.BufferedImage image
Constructor Detail

ImageGridCoverage

public ImageGridCoverage(java.awt.image.BufferedImage image,
                         GM_Envelope bbox,
                         CS_CoordinateSystem crs,
                         boolean isEditable)
initialzies a simple CV_Coverage with an image, coordinate reference system, an envelope describing the spatial extension of of the coverage and the coverages metadata.

Parameters:
isEditable - indicates if the grid coverages data can be edited
Method Detail

getPaletteInterpretation

public CV_PaletteInterpretation getPaletteInterpretation()
returns the paletteinterpretation of the grid coverages bands


getSampleDimensionType

public CV_SampleDimensionType getSampleDimensionType()

isDataEditable

public boolean isDataEditable()
                       throws java.rmi.RemoteException
Returns true if grid data can be edited.

Specified by:
isDataEditable in interface GC_GridCoverage
Returns:
true if grid data can be edited.
Throws:
java.rmi.RemoteException - if a remote method call failed.

setPackedDataBlock

public void setPackedDataBlock(GC_GridRange gridRange,
                               byte[] values)
                        throws java.rmi.RemoteException
Set a block of grid coverage data for all sample dimensions. See getDataBlock for details on how to pack the values. The requested grid range must satisfy the following rules for each dimension of the grid coverage:
 Min grid coordinate <= grid range minimum <= grid range maximum <= maximum grid coordinate
 
For byte padding rules see getDataBlock.

Specified by:
setPackedDataBlock in interface GC_GridCoverage
Parameters:
gridRange - Grid range for block of data to be accessed.
values - Sequence of grid values for the given region.
Throws:
java.rmi.RemoteException - if a remote method call failed.

setDataBlockAsInteger

public void setDataBlockAsInteger(GC_GridRange gridRange,
                                  int[] values)
                           throws java.rmi.RemoteException
Set a block of bint values for all sample dimensions.

Specified by:
setDataBlockAsInteger in interface GC_GridCoverage
Parameters:
gridRange - Grid range for block of data to be accessed.
values - Sequence of grid values for the given region.
Throws:
java.rmi.RemoteException - if a remote method call failed.

setDataBlockAsDouble

public void setDataBlockAsDouble(GC_GridRange gridRange,
                                 double[] values)
                          throws java.rmi.RemoteException
Set a block of double values for all sample dimensions.

Specified by:
setDataBlockAsDouble in interface GC_GridCoverage
Parameters:
gridRange - Grid range for block of data to be accessed.
values - Sequence of grid values for the given region.
Throws:
java.rmi.RemoteException - if a remote method call failed.

setDataBlockAsByte

public void setDataBlockAsByte(GC_GridRange gridRange,
                               byte[] values)
                        throws java.rmi.RemoteException
Set a block of byte values for all sample dimensions.

Specified by:
setDataBlockAsByte in interface GC_GridCoverage
Parameters:
gridRange - Grid range for block of data to be accessed.
values - Sequence of grid values for the given region.
Throws:
java.rmi.RemoteException - if a remote method call failed.

setDataBlockAsBoolean

public void setDataBlockAsBoolean(GC_GridRange gridRange,
                                  boolean[] values)
                           throws java.rmi.RemoteException
Set a block of boolean values for all sample dimensions. The requested grid range must satisfy the following rules for each dimension of the grid coverage:
 Min grid coordinate <= grid range minimum <= grid range maximum <= maximum grid coordinate
 
The number of values must equal:
 (Max1   Min1 + 1) * (Max2   Min2 + 1)... * (Maxn   Minn + 1) * numberSampleDimensions
 
Where

Specified by:
setDataBlockAsBoolean in interface GC_GridCoverage
Parameters:
gridRange - Grid range for block of data to be accessed.
values - Sequence of grid values for the given region.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getValueBlockAsDouble

public double[] getValueBlockAsDouble(GC_GridRange gridRange)
                               throws java.rmi.RemoteException
Return a sequence of double values for a block. A value for each sample dimension will be returned.

Specified by:
getValueBlockAsDouble in interface GC_GridCoverage
Parameters:
gridRange - Grid range for block of data to be accessed.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getPackedDataBlock

public byte[] getPackedDataBlock(GC_GridRange gridRange)
                          throws java.rmi.RemoteException
Return a block of grid coverage data for all sample dimensions. A value for each sample dimension will be returned. This operation provides efficient access of the grid values. The sequencing order of the values in the sequence will follow the rules given by valueInBytePacking and bandPacking defined in GC_GridPacking. The requested grid range must satisfy the following rules for each dimension of the grid coverage:
 Min grid coordinate <= grid range minimum <= grid range maximum <= maximum grid coordinate
 
The sequence of bytes returned will match the data type of the dimension. For example, a grid with one 16 bit unsigned (CV_16BIT_U) sample dimension will return 2 bytes for every cell in the block.

Byte padding Rules for grid values of less than 8 bits
For 2 D grid coverages, padding is to the nearest byte for the following cases:
For PixelInterleaved For grids with multiple sample dimensions, padding occurs between pixels for each change in dimension type.
For LineInterleaved Padding occurs at the end of each row or column (depending on the valueSequence of the grid).
For BandSequencial Padding occurs at the end of every sample dimension.
For grid values smaller than 8 bits, their order within each byte is given by the value defined in valueInBytePacking. For grid values bigger than 8 bits, the order of their bytes is given by the value defined in byteInValuePacking.

Specified by:
getPackedDataBlock in interface GC_GridCoverage
Parameters:
gridRange - Grid range for block of data to be accessed.
Returns:
a block of grid coverage data for all sample dimensions.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getOverviewGridGeometry

public GC_GridGeometry getOverviewGridGeometry(int overviewIndex)
                                        throws java.rmi.RemoteException
Return the grid geometry for an overview.

Specified by:
getOverviewGridGeometry in interface GC_GridCoverage
Parameters:
overviewIndex - Overview index for which to retrieve grid geometry. Indices start at 0.
Returns:
the grid geometry for an overview.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getOverview

public GC_GridCoverage getOverview(int overviewIndex)
                            throws java.rmi.RemoteException
Returns a pre-calculated overview for a grid coverage. The overview indices are numbered from 0 to numberOverviews-1. The overviews are ordered from highest (index 0) to lowest (numberOverviews -1) resolution. Overview grid coverages will have overviews which are the overviews for the grid coverage with lower resolution than the overview. For example, a 1 meter grid coverage with 3, 9, and 27 meter overviews will be ordered as follows:
Index resolution
0 3
1 9
2 27


The 3 meter overview will have 2 overviews as follows:
Index resolution
0 9
1 27

Specified by:
getOverview in interface GC_GridCoverage
Parameters:
overviewIndex - Index of grid coverage overview to retrieve. Indexes start at 0.
Returns:
a pre-calculated overview for a grid coverage.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getOptimalDataBlockSizes

public int[] getOptimalDataBlockSizes()
                               throws java.rmi.RemoteException
Optimal size to use for each dimension when accessing grid values. These values together give the optimal block size to use when retrieving grid coverage values. For example, a client application can achieve better performance for a 2-D grid coverage by reading blocks of 128 by 128 if the grid is tiled into blocks of this size. The sequence is ordered by dimension. If the implementation does not have optimal sizes the sequence will be empty.

Specified by:
getOptimalDataBlockSizes in interface GC_GridCoverage
Returns:
the optimal size to use for each dimension when accessing grid values.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getNumOverviews

public int getNumOverviews()
                    throws java.rmi.RemoteException
Number of predetermined overviews for the grid.

Specified by:
getNumOverviews in interface GC_GridCoverage
Returns:
the number of predetermined overviews for the grid.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getGridPacking

public GC_GridPacking getGridPacking()
                              throws java.rmi.RemoteException
Information for the packing of grid coverage values.

Specified by:
getGridPacking in interface GC_GridCoverage
Returns:
the information for the packing of grid coverage values.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getGridGeometry

public GC_GridGeometry getGridGeometry()
                                throws java.rmi.RemoteException
Information for the grid coverage geometry. Grid geometry includes the valid range of grid coordinates and the georeferencing.

Specified by:
getGridGeometry in interface GC_GridCoverage
Returns:
the information for the grid coverage geometry.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getDataBlockAsInteger

public int[] getDataBlockAsInteger(GC_GridRange gridRange)
                            throws java.rmi.RemoteException
Return a sequence of int values for a block. A value for each sample dimension will be returned.

Specified by:
getDataBlockAsInteger in interface GC_GridCoverage
Parameters:
gridRange - Grid range for block of data to be accessed.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getDataBlockAsByte

public byte[] getDataBlockAsByte(GC_GridRange gridRange)
                          throws java.rmi.RemoteException
Return a sequence of byte values for a block. A value for each sample dimension will be returned.

Specified by:
getDataBlockAsByte in interface GC_GridCoverage
Parameters:
gridRange - Grid range for block of data to be accessed.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getGridCorverageSize

public PT_Envelope getGridCorverageSize()

getDataBlockAsBoolean

public boolean[] getDataBlockAsBoolean(GC_GridRange gridRange)
                                throws java.rmi.RemoteException
Return a sequence of boolean values for a block. A value for each sample dimension will be returned.

Specified by:
getDataBlockAsBoolean in interface GC_GridCoverage
Parameters:
gridRange - Grid range for block of data to be accessed.
Throws:
java.rmi.RemoteException - if a remote method call failed.

getRaster

public java.lang.Object getRaster(GM_Envelope env)
                           throws java.io.IOException
returns a part of the GridCoverage defined by the submitted bounding box (coordinates at the gc's CRS) as BufferedImage

Parameters:
env - bounding box of the area to extracted
Throws:
java.io.IOException

getRaster

public java.lang.Object getRaster(GM_Envelope env,
                                  int width,
                                  int height,
                                  int imageType)
                           throws java.io.IOException,
                                  CoverageCreationException
returns a part of the GridCoverage defined by the submitted bounding box (coordinates at the gc's CRS) as BufferedImage

Parameters:
env - bounding box of the area to extracted
width - width of the returned raster
height - height of the returned raster
imageType - (color model) type of the image will only be used if the result is a BufferedImage @see java.awt.image.BufferedImage
Throws:
java.io.IOException
CoverageCreationException

getRaster

public java.lang.Object getRaster(GM_Envelope env,
                                  int width,
                                  int height)
                           throws java.io.IOException
returns a part of the GridCoverage defined by the submitted bounding box (coordinates at the gc's CRS)

Parameters:
env - bounding box of the area to extracted
width - width of the returned raster
height - height of the returned raster
Throws:
java.io.IOException