|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectPropertySourceImpl
AbstractCoverage
AbstractGridCoverage
GridCoverage2D
public class 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
GridCoverage2D 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, GridCoverage2D 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 GridCoverage2D instances requires J2SE 1.5.
modules/library/coverage (gt2-coverage.jar) (Maven report) (SVN head)| 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 PlanarImage |
image
The raster data. |
| Fields inherited from class AbstractGridCoverage |
|---|
LOGGER |
| Fields inherited from class AbstractCoverage |
|---|
crs |
| Fields inherited from class PropertySourceImpl |
|---|
cachedPropertyNames, properties, propertySources |
| Constructor Summary | |
|---|---|
protected |
GridCoverage2D(CharSequence name,
GridCoverage2D coverage)
Construct a new grid coverage with the same parameter than the specified coverage. |
protected |
GridCoverage2D(CharSequence name,
PlanarImage image,
GridGeometry2D gridGeometry,
GridSampleDimension[] bands,
GridCoverage[] sources,
Map properties)
Constructs a grid coverage with the specified grid geometry and sample dimensions. |
| 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. |
boolean |
dispose(boolean force)
Provides a hint that a coverage will no longer be accessed from a reference in user space. |
Object |
evaluate(DirectPosition point)
Returns the value vector for a given point in the coverage. |
byte[] |
evaluate(DirectPosition coord,
byte[] dest)
Returns a sequence of byte values for a given point in the coverage. |
double[] |
evaluate(DirectPosition coord,
double[] dest)
Returns a sequence of double values for a given point in the coverage. |
float[] |
evaluate(DirectPosition coord,
float[] dest)
Returns a sequence of float values for a given point in the coverage. |
int[] |
evaluate(DirectPosition coord,
int[] dest)
Returns a sequence of integer values for a given point in the coverage. |
double[] |
evaluate(Point2D coord,
double[] dest)
Returns a sequence of double values for a given two-dimensional point in the coverage. |
float[] |
evaluate(Point2D coord,
float[] dest)
Returns a sequence of float values for a given two-dimensional point in the coverage. |
int[] |
evaluate(Point2D coord,
int[] dest)
Returns a sequence of integer values for a given two-dimensional point in the coverage. |
GridCoverage2D |
geophysics(boolean geo)
If true, returns the geophysics companion of this grid coverage. |
CoordinateReferenceSystem |
getCoordinateReferenceSystem2D()
Returns the two-dimensional part of this grid coverage CRS. |
String |
getDebugString(DirectPosition coord)
Returns a debug string for the specified coordinate. |
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. |
GridGeometry |
getGridGeometry()
Returns information for the grid coverage geometry. |
Interpolation |
getInterpolation()
Returns the interpolation used for all evaluate(...) 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. |
RenderableImage |
getRenderableImage(int xAxis,
int yAxis)
Returns 2D view of this grid coverage as a renderable image. |
RenderedImage |
getRenderedImage()
Returns grid data as a rendered image. |
SampleDimension |
getSampleDimension(int index)
Retrieve sample dimension information for the coverage. |
GridSampleDimension[] |
getSampleDimensions()
Returns all sample dimensions for this grid coverage. |
boolean |
isDataEditable()
Returns true if grid data can be edited. |
void |
prefetch(Rectangle2D area)
Hints that the given area may be needed in the near future. |
void |
show(String title)
{inheritDoc} |
void |
show(String title,
int xAxis,
int yAxis)
{inheritDoc} |
| Methods inherited from class AbstractCoverage |
|---|
dispose, evaluate, evaluate, evaluateInverse, find, find, getCommonPointRule, getCoordinateReferenceSystem, getDimension, getDimensionNames, getDimensionNames, getDomainElements, getDomainExtents, getLocale, getMetadataNames, getMetadataValue, getName, getRangeElements, getRangeType, list, select, show, show, toString |
| Methods inherited from class PropertySourceImpl |
|---|
getProperties, getProperty, getPropertyClass, getPropertyNames, getPropertyNames |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface GridCoverage |
|---|
getDataBlock, getDataBlock, getDataBlock, getDataBlock, getDataBlock, getDataBlock, getGridPacking, getNumOverviews, getOverview, getOverviewGridGeometry, getPackedDataBlock, setDataBlock, setDataBlock, setDataBlock, setDataBlock, setDataBlock, setDataBlock, setPackedDataBlock |
| Methods inherited from interface Coverage |
|---|
evaluate, evaluate, evaluateInverse, find, find, getCommonPointRule, getCoordinateReferenceSystem, getDimensionNames, getDomainElements, getDomainExtents, getMetadataNames, getMetadataValue, getRangeElements, getRangeType, getSources, list, select |
| Methods inherited from interface PropertySource |
|---|
getProperty, getPropertyClass, getPropertyNames, getPropertyNames |
| Field Detail |
|---|
protected final transient PlanarImage image
protected final GridGeometry2D gridGeometry
| Constructor Detail |
|---|
protected GridCoverage2D(CharSequence name,
GridCoverage2D coverage)
name - The name for this coverage, or null for the same than coverage.coverage - The source grid coverage.
protected GridCoverage2D(CharSequence name,
PlanarImage image,
GridGeometry2D gridGeometry,
GridSampleDimension[] bands,
GridCoverage[] sources,
Map properties)
throws 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 null for default sample
dimensions. If non-null, then this array's length must matches the number
of bands in image.sources - The sources for this grid coverage, or null if none.properties - The set of properties for this coverage, or null none.
IllegalArgumentException - if the number of bands differs from the number of sample
dimensions.| Method Detail |
|---|
public boolean isDataEditable()
true if grid data can be edited. The default
implementation returns true if image is an
instance of WritableRenderedImage.
isDataEditable in interface GridCoverageisDataEditable in class AbstractGridCoveragepublic GridGeometry getGridGeometry()
getGridGeometry in interface GridCoveragepublic Envelope getEnvelope()
getEnvelope in interface CoveragegetEnvelope in class AbstractCoveragepublic Envelope2D getEnvelope2D()
public CoordinateReferenceSystem getCoordinateReferenceSystem2D()
AbstractCoverage.getCoordinateReferenceSystem()public int getNumSampleDimensions()
getNumSampleDimensions in interface Coveragepublic SampleDimension getSampleDimension(int index)
getSampleDimension in interface Coveragepublic GridSampleDimension[] getSampleDimensions()
public Interpolation getInterpolation()
evaluate(...) methods.
The default implementation returns InterpolationNearest.
public Object evaluate(DirectPosition point)
throws CannotEvaluateException
evaluate in interface CoverageCannotEvaluateException
public byte[] evaluate(DirectPosition coord,
byte[] dest)
throws CannotEvaluateException
evaluate in interface Coverageevaluate in class AbstractCoveragecoord - The coordinate point where to evaluate.dest - An array in which to store values, or null.
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(DirectPosition coord,
int[] dest)
throws CannotEvaluateException
evaluate in interface Coverageevaluate in class AbstractCoveragecoord - The coordinate point where to evaluate.dest - An array in which to store values, or null.
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(DirectPosition coord,
float[] dest)
throws CannotEvaluateException
evaluate in interface Coverageevaluate in class AbstractCoveragecoord - The coordinate point where to evaluate.dest - An array in which to store values, or null.
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(DirectPosition coord,
double[] dest)
throws CannotEvaluateException
evaluate in interface Coverageevaluate in class AbstractCoveragecoord - The coordinate point where to evaluate.dest - An array in which to store values, or null.
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(Point2D coord,
int[] dest)
throws CannotEvaluateException
coord - The coordinate point where to evaluate.dest - An array in which to store values, or null.
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(Point2D coord,
float[] dest)
throws CannotEvaluateException
coord - The coordinate point where to evaluate.dest - An array in which to store values, or null.
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(Point2D coord,
double[] dest)
throws CannotEvaluateException
coord - The coordinate point where to evaluate.dest - An array in which to store values, or null.
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 String getDebugString(DirectPosition coord)
(1171,1566)=[196 (29.6 °C)]
coord - The coordinate point where to evaluate.
null if coord is outside coverage.public int[] getOptimalDataBlockSizes()
getOptimalDataBlockSizes in interface GridCoveragepublic RenderedImage getRenderedImage()
getRenderedImage in interface RenderedCoverage
public RenderableImage getRenderableImage(int xAxis,
int yAxis)
getRenderableImage in interface CoveragegetRenderableImage in class AbstractCoveragexAxis - Dimension to use for x axis.yAxis - Dimension to use for y axis.
public void show(String title,
int xAxis,
int yAxis)
show in class AbstractCoveragetitle - The window title, or null for default value.xAxis - Dimension to use for the x display axis.yAxis - Dimension to use for the y display axis.public void show(String title)
show in class AbstractCoveragetitle - The window title, or null for default value.public void prefetch(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)
true, returns the geophysics companion of this grid coverage. In a
geophysics grid coverage, all sample values are equals to geophysics
("real world") values without the need for any transformation. In such geophysics
coverage, the sample to geophysics
transform is the identity transform for all sample dimensions. "No data" values are
expressed by NaN numbers.
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.
GridCoverage objects live by pair: a geophysics one (used for
computation) and a non-geophysics one (used for packing data, usually as
integers). The geo 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 geophysics(b1).geophysics(b2).geophysics(b3)
depends only on the value in the last call (b3).
geo - true to get a grid coverage with sample values equals to geophysics
values, or false to get the packed version.
null, but may be this.GridSampleDimension.geophysics(boolean),
Category.geophysics(boolean),
LookupDescriptor,
RescaleDescriptor,
PiecewiseDescriptorprotected 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 - true to get a grid coverage with sample values equals to
geophysics values, or false to get the packed version.
public boolean dispose(boolean force)
force is true, orThis safety check helps to prevent the disposal of an image that still used in a JAI operation chain. It doesn't prevent the disposal in every cases however. When unsure about whatever a coverage is still in use or not, it is safer to not invoke this method and rely on the garbage collector instead.
dispose in class AbstractCoverageforce - true for forcing an inconditionnal disposal, or false for
performing a conservative disposal. The recommanded value is false.
true if this method disposed at least some resources, or false
if this method vetoed against the disposal.PlanarImage.dispose()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||