|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.media.jai.PropertySourceImpl org.geotools.coverage.AbstractCoverage org.geotools.coverage.grid.AbstractGridCoverage org.geotools.coverage.grid.GridCoverage2D
Basic access to grid data values backed by a two-dimensional rendered image. Each band in an image is represented as a sample dimension.
Grid coverages are usually two-dimensional. However, their envelope may have more than two dimensions. For example, a remote sensing image may be valid only over some time range (the time of satellite pass over the observed area). Envelopes for such grid coverage can have three dimensions: the two usual ones (horizontal extent along x and y), and a third one for start time and end time (time extent along t). However, the grid range for all extra-dimension must have a size not greater than 1. In other words, a can be a slice in a 3 dimensional grid coverage. Each slice can have an arbitrary width and height (like any two-dimensional images), but only 1 voxel depth (a "voxel" is a three-dimensional pixel).
Serialization note:
Because it is serializable, can be included as method argument or as
return type in Remote Method Invocation (RMI). However, the pixel data are not
sent during serialization. Instead, the image data are transmitted "on-demand" using socket
communications. This mechanism is implemented using JAI SerializableRenderedImage
class. While serialization (usually on server side) should work on J2SE 1.4 and above,
deserialization (usually on client side) of instances requires J2SE 1.5.
Nested Class Summary | |
protected class |
GridCoverage2D.Renderable
A view of a grid coverage as a renderable image. |
Field Summary | |
protected GridGeometry2D |
gridGeometry
The grid geometry. |
protected javax.media.jai.PlanarImage |
image
The raster data. |
Fields inherited from class org.geotools.coverage.grid.AbstractGridCoverage |
LOGGER |
Fields inherited from class org.geotools.coverage.AbstractCoverage |
crs |
Fields inherited from class javax.media.jai.PropertySourceImpl |
cachedPropertyNames, properties, propertySources |
Constructor Summary | |
protected |
GridCoverage2D(java.lang.CharSequence name,
GridCoverage2D coverage)
Construct a new grid coverage with the same parameter than the specified coverage. |
protected |
GridCoverage2D(java.lang.CharSequence name,
javax.media.jai.PlanarImage image,
GridGeometry2D gridGeometry,
GridSampleDimension[] bands,
org.opengis.coverage.grid.GridCoverage[] sources,
java.util.Map properties)
Constructs a grid coverage with the specified grid geometry and sample dimensions. |
|
GridCoverage2D(java.lang.CharSequence name,
java.awt.image.RenderedImage image,
org.opengis.referencing.crs.CoordinateReferenceSystem crs,
org.opengis.spatialschema.geometry.Envelope envelope,
GridSampleDimension[] bands,
org.opengis.coverage.grid.GridCoverage[] sources,
java.util.Map properties)
Deprecated. Use GridCoverageFactory instead. |
|
GridCoverage2D(java.lang.CharSequence name,
java.awt.image.RenderedImage image,
org.opengis.referencing.crs.CoordinateReferenceSystem crs,
org.opengis.referencing.operation.MathTransform gridToCRS,
GridSampleDimension[] bands,
org.opengis.coverage.grid.GridCoverage[] sources,
java.util.Map properties)
Deprecated. Use GridCoverageFactory instead. |
Method Summary | |
protected GridCoverage2D |
createGeophysics(boolean geo)
Invoked by geophysics(boolean) when the packed or geophysics companion of this
grid coverage need to be created. |
java.lang.Object |
evaluate(org.opengis.spatialschema.geometry.DirectPosition point)
Return the value vector for a given point in the coverage. |
byte[] |
evaluate(org.opengis.spatialschema.geometry.DirectPosition coord,
byte[] dest)
Returns a sequence of byte values for a given point in the coverage. |
double[] |
evaluate(org.opengis.spatialschema.geometry.DirectPosition coord,
double[] dest)
Returns a sequence of double values for a given point in the coverage. |
float[] |
evaluate(org.opengis.spatialschema.geometry.DirectPosition coord,
float[] dest)
Returns a sequence of float values for a given point in the coverage. |
int[] |
evaluate(org.opengis.spatialschema.geometry.DirectPosition coord,
int[] dest)
Returns a sequence of integer values for a given point in the coverage. |
double[] |
evaluate(java.awt.geom.Point2D coord,
double[] dest)
Returns a sequence of double values for a given two-dimensional point in the coverage. |
float[] |
evaluate(java.awt.geom.Point2D coord,
float[] dest)
Returns a sequence of float values for a given two-dimensional point in the coverage. |
int[] |
evaluate(java.awt.geom.Point2D coord,
int[] dest)
Returns a sequence of integer values for a given two-dimensional point in the coverage. |
GridCoverage2D |
geophysics(boolean geo)
If , returns the geophysics companion of this grid coverage. |
org.opengis.referencing.crs.CoordinateReferenceSystem |
getCoordinateReferenceSystem2D()
Returns the two-dimensional part of this grid coverage CRS. |
java.lang.String |
getDebugString(org.opengis.spatialschema.geometry.DirectPosition coord)
Returns a debug string for the specified coordinate. |
org.opengis.spatialschema.geometry.Envelope |
getEnvelope()
Returns the bounding box for the coverage domain in coordinate reference system coordinates. |
Envelope2D |
getEnvelope2D()
Returns the two-dimensional bounding box for the coverage domain in coordinate reference system coordinates. |
org.opengis.coverage.grid.GridGeometry |
getGridGeometry()
Returns information for the grid coverage geometry. |
javax.media.jai.Interpolation |
getInterpolation()
Returns the interpolation used for all methods. |
int |
getNumSampleDimensions()
Returns the number of bands in the grid coverage. |
int[] |
getOptimalDataBlockSizes()
Returns the optimal size to use for each dimension when accessing grid values. |
java.awt.image.renderable.RenderableImage |
getRenderableImage(int xAxis,
int yAxis)
Returns 2D view of this grid coverage as a renderable image. |
java.awt.image.RenderedImage |
getRenderedImage()
Returns grid data as a rendered image. |
org.opengis.coverage.SampleDimension |
getSampleDimension(int index)
Retrieve sample dimension information for the coverage. |
GridSampleDimension[] |
getSampleDimensions()
Returns all sample dimensions for this grid coverage. |
boolean |
isDataEditable()
Returns if grid data can be edited. |
void |
prefetch(java.awt.geom.Rectangle2D area)
Hints that the given area may be needed in the near future. |
void |
show()
Display this coverage in a windows. |
Methods inherited from class org.geotools.coverage.grid.AbstractGridCoverage |
getDataBlock, getDataBlock, getDataBlock, getDataBlock, getDataBlock, getDataBlock, getGridPacking, getNumOverviews, getOverview, getOverviewGridGeometry, getPackedDataBlock, getSources, pointOutsideCoverage, pointOutsideCoverage, setDataBlock, setDataBlock, setDataBlock, setDataBlock, setDataBlock, setDataBlock, setPackedDataBlock |
Methods inherited from class org.geotools.coverage.AbstractCoverage |
dispose, evaluate, getCoordinateReferenceSystem, getDimension, getDimensionNames, getDimensionNames, getLocale, getMetadataNames, getMetadataValue, getName, show, toString |
Methods inherited from class javax.media.jai.PropertySourceImpl |
getProperties, getProperty, getPropertyClass, getPropertyNames, getPropertyNames |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.opengis.coverage.grid.GridCoverage |
getDataBlock, getDataBlock, getDataBlock, getDataBlock, getDataBlock, getDataBlock, getGridPacking, getNumOverviews, getOverview, getOverviewGridGeometry, getPackedDataBlock, setDataBlock, setDataBlock, setDataBlock, setDataBlock, setDataBlock, setDataBlock, setPackedDataBlock |
Methods inherited from interface org.opengis.coverage.Coverage |
evaluate, getCoordinateReferenceSystem, getDimensionNames, getMetadataNames, getMetadataValue, getSources |
Methods inherited from interface javax.media.jai.PropertySource |
getProperty, getPropertyClass, getPropertyNames, getPropertyNames |
Field Detail |
protected final transient javax.media.jai.PlanarImage image
protected final GridGeometry2D gridGeometry
Constructor Detail |
protected GridCoverage2D(java.lang.CharSequence name, GridCoverage2D coverage)
name
- The name for this coverage, or for the same than .coverage
- The source grid coverage.public GridCoverage2D(java.lang.CharSequence name, java.awt.image.RenderedImage image, org.opengis.referencing.crs.CoordinateReferenceSystem crs, org.opengis.spatialschema.geometry.Envelope envelope, GridSampleDimension[] bands, org.opengis.coverage.grid.GridCoverage[] sources, java.util.Map properties) throws org.opengis.spatialschema.geometry.MismatchedDimensionException, java.lang.IllegalArgumentException
GridCoverageFactory
instead.
An exception to the above rule applies for CRS using exactly the following axis order:
(NORTH
|SOUTH
,
EAST
|WEST
).
Example of such CRS is . This convenience constructor swaps automatically
the axis order for such CRS.
The rules applied by this convenience constructor are heuristic. While we try to keep them
stable, some adjustments may be applied in future versions. For strict, determinist behavior,
use the constructor variant expecting a MathTransform
argument instead of an
Envelope
. The math transform allows full control on axis swapping and inversion.
name
- The grid coverage name.image
- The image.crs
- The coordinate reference system. This specifies the CRS used when
accessing a grid coverage with the methods. The
number of dimensions must matches the number of dimensions
of .envelope
- The grid coverage cordinates. This envelope must have at least two
dimensions. The two first dimensions describe the image location
along x and y axis. The other dimensions are
optional and may be used to locate the image on a vertical axis or
on the time axis.bands
- Sample dimensions for each image band, or for default
sample dimensions. If non-null, then this array's length must matches
the number of bands in .sources
- The sources for this grid coverage, or if none.properties
- The set of properties for this coverage, or if there is none.
"Properties" in Java Advanced Imaging is what OpenGIS calls "Metadata".
Keys are String
objects (CaselessStringKey
are accepted as well),
while values may be any Object
.
org.opengis.spatialschema.geometry.MismatchedDimensionException
- If the envelope's dimension
is not the same than the coordinate system's dimension.
java.lang.IllegalArgumentException
- if the number of bands differs
from the number of sample dimensions.public GridCoverage2D(java.lang.CharSequence name, java.awt.image.RenderedImage image, org.opengis.referencing.crs.CoordinateReferenceSystem crs, org.opengis.referencing.operation.MathTransform gridToCRS, GridSampleDimension[] bands, org.opengis.coverage.grid.GridCoverage[] sources, java.util.Map properties) throws org.opengis.spatialschema.geometry.MismatchedDimensionException, java.lang.IllegalArgumentException
GridCoverageFactory
instead.
name
- The grid coverage name.image
- The image.crs
- The coordinate reference system. This specifies the CRS used when
accessing a grid coverage with the methods. The
number of dimensions must matches the number of target dimensions
of .gridToCRS
- The math transform from grid to coordinate reference system.bands
- Sample dimensions for each image band, or for
default sample dimensions. If non-null, then this array's length
must matches the number of bands in .sources
- The sources for this grid coverage, or if none.properties
- The set of properties for this coverage, or if there is none.
"Properties" in Java Advanced Imaging is what OpenGIS calls "Metadata".
Keys are String
objects (CaselessStringKey
are accepted as well),
while values may be any Object
.
org.opengis.spatialschema.geometry.MismatchedDimensionException
- If the transform's dimension
is not the same than the coordinate system's dimension.
java.lang.IllegalArgumentException
- if the number of bands differs
from the number of sample dimensions.protected GridCoverage2D(java.lang.CharSequence name, javax.media.jai.PlanarImage image, GridGeometry2D gridGeometry, GridSampleDimension[] bands, org.opengis.coverage.grid.GridCoverage[] sources, java.util.Map properties) throws java.lang.IllegalArgumentException
This constructor accepts an optional set of properties. "Properties" in Java Advanced
Imaging is what OpenGIS calls "Metadata". Keys are String
objects
(CaselessStringKey
are accepted as well), while values may be any Object
.
name
- The grid coverage name.image
- The image.gridGeometry
- The grid geometry (must contains an envelope with its coordinate reference system and a "grid to CRS" transform).bands
- Sample dimensions for each image band, or for default sample
dimensions. If non-null, then this array's length must matches the number
of bands in .sources
- The sources for this grid coverage, or if none.properties
- The set of properties for this coverage, or none.
java.lang.IllegalArgumentException
- if the number of bands differs from the number of sample
dimensions.Method Detail |
public boolean isDataEditable()
image
is an
instance of WritableRenderedImage
.
isDataEditable
in interface org.opengis.coverage.grid.GridCoverage
isDataEditable
in class AbstractGridCoverage
public org.opengis.coverage.grid.GridGeometry getGridGeometry()
getGridGeometry
in interface org.opengis.coverage.grid.GridCoverage
public org.opengis.spatialschema.geometry.Envelope getEnvelope()
getEnvelope
in interface org.opengis.coverage.Coverage
getEnvelope
in class AbstractCoverage
public Envelope2D getEnvelope2D()
public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem2D()
AbstractCoverage.getCoordinateReferenceSystem()
public int getNumSampleDimensions()
getNumSampleDimensions
in interface org.opengis.coverage.Coverage
public org.opengis.coverage.SampleDimension getSampleDimension(int index)
getSampleDimension
in interface org.opengis.coverage.Coverage
public GridSampleDimension[] getSampleDimensions()
public javax.media.jai.Interpolation getInterpolation()
InterpolationNearest
.
public java.lang.Object evaluate(org.opengis.spatialschema.geometry.DirectPosition point) throws org.opengis.coverage.CannotEvaluateException
evaluate
in interface org.opengis.coverage.Coverage
org.opengis.coverage.CannotEvaluateException
public byte[] evaluate(org.opengis.spatialschema.geometry.DirectPosition coord, byte[] dest) throws org.opengis.coverage.CannotEvaluateException
evaluate
in interface org.opengis.coverage.Coverage
evaluate
in class AbstractCoverage
coord
- The coordinate point where to evaluate.dest
- An array in which to store values, or .
org.opengis.coverage.CannotEvaluateException
- if the values can't be computed at the specified coordinate.
More specifically, PointOutsideCoverageException
is thrown if the evaluation
failed because the input point has invalid coordinates.public int[] evaluate(org.opengis.spatialschema.geometry.DirectPosition coord, int[] dest) throws org.opengis.coverage.CannotEvaluateException
evaluate
in interface org.opengis.coverage.Coverage
evaluate
in class AbstractCoverage
coord
- The coordinate point where to evaluate.dest
- An array in which to store values, or .
org.opengis.coverage.CannotEvaluateException
- if the values can't be computed at the specified coordinate.
More specifically, PointOutsideCoverageException
is thrown if the evaluation
failed because the input point has invalid coordinates.public float[] evaluate(org.opengis.spatialschema.geometry.DirectPosition coord, float[] dest) throws org.opengis.coverage.CannotEvaluateException
evaluate
in interface org.opengis.coverage.Coverage
evaluate
in class AbstractCoverage
coord
- The coordinate point where to evaluate.dest
- An array in which to store values, or .
org.opengis.coverage.CannotEvaluateException
- if the values can't be computed at the specified coordinate.
More specifically, PointOutsideCoverageException
is thrown if the evaluation
failed because the input point has invalid coordinates.public double[] evaluate(org.opengis.spatialschema.geometry.DirectPosition coord, double[] dest) throws org.opengis.coverage.CannotEvaluateException
evaluate
in interface org.opengis.coverage.Coverage
evaluate
in class AbstractCoverage
coord
- The coordinate point where to evaluate.dest
- An array in which to store values, or .
org.opengis.coverage.CannotEvaluateException
- if the values can't be computed at the specified coordinate.
More specifically, PointOutsideCoverageException
is thrown if the evaluation
failed because the input point has invalid coordinates.public int[] evaluate(java.awt.geom.Point2D coord, int[] dest) throws org.opengis.coverage.CannotEvaluateException
coord
- The coordinate point where to evaluate.dest
- An array in which to store values, or .
org.opengis.coverage.CannotEvaluateException
- if the values can't be computed at the specified coordinate.
More specifically, PointOutsideCoverageException
is thrown if the evaluation
failed because the input point has invalid coordinates.public float[] evaluate(java.awt.geom.Point2D coord, float[] dest) throws org.opengis.coverage.CannotEvaluateException
coord
- The coordinate point where to evaluate.dest
- An array in which to store values, or .
org.opengis.coverage.CannotEvaluateException
- if the values can't be computed at the specified coordinate.
More specifically, PointOutsideCoverageException
is thrown if the evaluation
failed because the input point has invalid coordinates.public double[] evaluate(java.awt.geom.Point2D coord, double[] dest) throws org.opengis.coverage.CannotEvaluateException
coord
- The coordinate point where to evaluate.dest
- An array in which to store values, or .
org.opengis.coverage.CannotEvaluateException
- if the values can't be computed at the specified coordinate.
More specifically, PointOutsideCoverageException
is thrown if the evaluation
failed because the input point has invalid coordinates.public java.lang.String getDebugString(org.opengis.spatialschema.geometry.DirectPosition coord)
(1171,1566)=[196 (29.6 ?C)]
coord
- The coordinate point where to evaluate.
public int[] getOptimalDataBlockSizes()
getOptimalDataBlockSizes
in interface org.opengis.coverage.grid.GridCoverage
public java.awt.image.RenderedImage getRenderedImage()
getRenderedImage
in interface RenderedCoverage
public java.awt.image.renderable.RenderableImage getRenderableImage(int xAxis, int yAxis)
getRenderableImage
in interface org.opengis.coverage.Coverage
getRenderableImage
in class AbstractCoverage
xAxis
- Dimension to use for x axis.yAxis
- Dimension to use for y axis.
public void show()
show
in class AbstractCoverage
public void prefetch(java.awt.geom.Rectangle2D area)
area
- A rectangle indicating which geographic area to prefetch.
This area's coordinates must be expressed according the
grid coverage's coordinate reference system, as given by
AbstractCoverage.getCoordinateReferenceSystem()
.public GridCoverage2D geophysics(boolean geo)
This method may be understood as applying the JAI's piecewise operation with breakpoints specified by the Category
objects in
each sample dimension. However, it is more general in that the transformation specified
with each breakpoint doesn't need to be linear. On an implementation note, this method
will really try to use the first of the following operations which is found applicable:
identity, lookup, rescale, piecewise and in last ressort a more general
(but slower) sample transcoding algorithm.
objects live by pair: a geophysics one (used for computation) and a non-geophysics one (used for packing data, usually as integers). The argument specifies which object from the pair is wanted, regardless if this method is invoked on the geophysics or non-geophysics instance of the pair. In other words, the result of depends only on the value in the last call ().
geo
- to get a grid coverage with sample values equals to geophysics
values, or to get the packed version.
GridSampleDimension.geophysics(boolean)
,
Category.geophysics(boolean)
,
LookupDescriptor
,
RescaleDescriptor
,
PiecewiseDescriptor
protected GridCoverage2D createGeophysics(boolean geo)
geophysics(boolean)
when the packed or geophysics companion of this
grid coverage need to be created. Subclasses may override this method in order to modify
the object to be created.
geo
- to get a grid coverage with sample values equals to
geophysics values, or to get the packed version.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |