|
||||||||||
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 (gt-coverage.jar)
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,
PlanarImage image,
GridGeometry2D gridGeometry,
GridSampleDimension[] bands,
GridCoverage[] sources,
Map<?,?> properties,
Hints hints)
Constructs a grid coverage with the specified grid geometry and sample dimensions. |
Method Summary | |
---|---|
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)
Deprecated. Replaced by view(org.geotools.coverage.grid.ViewType) . |
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. |
GridGeometry2D |
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. |
GridSampleDimension |
getSampleDimension(int index)
Retrieve sample dimension information for the coverage. |
GridSampleDimension[] |
getSampleDimensions()
Returns all sample dimensions for this grid coverage. |
Set<ViewType> |
getViewTypes()
Returns the set of views that this coverage represents. |
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} |
String |
toString()
Returns a string representation of this grid coverage. |
GridCoverage2D |
view(ViewType type)
Returns a view of the specified type. |
Methods inherited from class AbstractCoverage |
---|
evaluate, evaluate, evaluateInverse, find, find, getCommonPointRule, getCoordinateReferenceSystem, getDimension, getDomainElements, getDomainExtents, getLocale, getName, getRangeElements, getRangeType, list, select, show |
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, getSources, setDataBlock, setDataBlock, setDataBlock, setDataBlock, setDataBlock, setDataBlock |
Methods inherited from interface Coverage |
---|
evaluate, evaluate, evaluateInverse, find, find, getCommonPointRule, getCoordinateReferenceSystem, getDomainElements, getDomainExtents, getRangeElements, getRangeType, 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, PlanarImage image, GridGeometry2D gridGeometry, GridSampleDimension[] bands, GridCoverage[] sources, Map<?,?> properties, Hints hints) throws IllegalArgumentException
This constructor accepts an optional set of properties. 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.hints
- An optional set of hints, or null
if 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 GridCoverage
isDataEditable
in class AbstractGridCoverage
public GridGeometry2D getGridGeometry()
getGridGeometry
in interface GridCoverage
public Envelope getEnvelope()
getEnvelope
in interface Coverage
getEnvelope
in class AbstractCoverage
public Envelope2D getEnvelope2D()
public CoordinateReferenceSystem getCoordinateReferenceSystem2D()
AbstractCoverage.getCoordinateReferenceSystem()
public int getNumSampleDimensions()
getNumSampleDimensions
in interface Coverage
public GridSampleDimension getSampleDimension(int index)
getSampleDimension
in interface Coverage
public GridSampleDimension[] getSampleDimensions()
public Interpolation getInterpolation()
evaluate(...)
methods.
The default implementation returns InterpolationNearest
.
public Object evaluate(DirectPosition point) throws CannotEvaluateException
evaluate
in interface Coverage
CannotEvaluateException
public byte[] evaluate(DirectPosition coord, byte[] dest) throws CannotEvaluateException
evaluate
in interface Coverage
evaluate
in class AbstractCoverage
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 int[] evaluate(DirectPosition coord, int[] dest) throws CannotEvaluateException
evaluate
in interface Coverage
evaluate
in class AbstractCoverage
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(DirectPosition coord, float[] dest) throws CannotEvaluateException
evaluate
in interface Coverage
evaluate
in class AbstractCoverage
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(DirectPosition coord, double[] dest) throws CannotEvaluateException
evaluate
in interface Coverage
evaluate
in class AbstractCoverage
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 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 GridCoverage
public RenderedImage getRenderedImage()
getRenderedImage
in interface RenderedCoverage
public RenderableImage getRenderableImage(int xAxis, int yAxis)
getRenderableImage
in interface Coverage
getRenderableImage
in class AbstractCoverage
xAxis
- 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 AbstractCoverage
title
- 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 AbstractCoverage
title
- 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()
.@Deprecated public GridCoverage2D geophysics(boolean geo)
view(org.geotools.coverage.grid.ViewType)
.
public GridCoverage2D view(ViewType type)
GEOPHYSICS
: all sample values are equals to geophysics
("real world") values without the need for any transformation. The
sample to geophysics transform
is identity
for all sample dimensions. "No data" values (if any) are expressed as
NaN numbers. This view is suitable for computation, but usually
not for rendering.
PACKED
: sample values are typically integers. A
sample to geophysics transform may
exists for converting them to "real world" values.
RENDERED
: synonymous of PACKED
for now. Will be
improved in a future version.
PHOTOGRAPHIC
: synonymous of RENDERED
for now.
Will be improved in a future version.
SAME
: returns this
coverage unchanged.
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
tries 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.
type
- The kind of view wanted.
null
, but may be this
.GridSampleDimension.geophysics(boolean)
,
Category.geophysics(boolean)
,
LookupDescriptor
,
RescaleDescriptor
,
PiecewiseDescriptor
public Set<ViewType> getViewTypes()
PACKED
and RENDERED
view.
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 AbstractCoverage
force
- 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()
public String toString()
toString
in class AbstractCoverage
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |