| org.geotools.coverage.AbstractCoverage org.geotools.coverage.CoverageStack
CoverageStack | public class CoverageStack extends AbstractCoverage (Code) | | Wraps a stack of
as an extra dimension. For example this class
can wraps an array of
org.geotools.coverage.grid.GridCoverage2D on the same geographic
area, but where each
GridCoverage2D is for a different date. This
CoverageStack manages the two-dimensional coverages as if the whole set was a huge three-dimensional coverage.
Each
in the stack usually covers the same
, but this is not a requirement. However,
they must use the same
.
For performance reason, the later condition will not be checked except at construction time
if the CRS is provided in the envelope, and at evaluation time if Java assertion are enabled.
If the CRS of coverage elements is uncertain, consider wrapping them in a
TransformedCoverage object.
Coverage elements are often two-dimensional, but this is not a requirement. This stack will
simply append one more dimension to the coverage element's CRS dimensions. Coverage elements
may be other
CoverateStack objects, thus allowing construction of coverages with four
or more dimensions.
GridCoverage2D objects tend to be big. In order to keep memory usage raisonable, this
implementation doesn't requires all
GridCoverage objects at once. Instead, it requires
an array of
Element objects, which will load the coverage content only when first
needed. This
CoverageStack implementation remember the last coverage elements used;
it will not trig new data loading as long as consecutive calls to
evaluate(...) methods require the same coverage elements. Apart from this very simple caching mechanism,
caching is the responsability of
Element implementations. Note that this simple
caching mechanism is suffisient if
evaluate(...) methods are invoked with increasing
z values.
Each coverage element is expected to extends over a range of z values (the new
dimensions appended by this
CoverageStack ). If an
evaluate(...) method is
invoked with a z value not falling in the middle of a coverage element, a linear
interpolation is applied.
Note: This implementation is thread-safe.
since: 2.1 version: $Id: CoverageStack.java 27862 2007-11-12 19:51:19Z desruisseaux $ author: Martin Desruisseaux |
Inner Class :public static interface Element | |
Inner Class :public static class Adapter implements Element | |
Field Summary | |
final public int | zDimension The dimension of the z ordinate (the last value in coordinate points). |
Method Summary | |
public void | addIIOReadProgressListener(IIOReadProgressListener listener) Adds an
IIOReadProgressListener to the list of registered progress listeners. | public void | addIIOReadWarningListener(IIOReadWarningListener listener) Adds an
IIOReadWarningListener to the list of registered warning listeners. | public synchronized List | coveragesAt(double z) Returns the coverages to be used for the specified z value. | public Object | evaluate(DirectPosition coord) Returns a sequence of values for a given point in the coverage. | public synchronized boolean[] | evaluate(DirectPosition coord, boolean[] dest) Returns a sequence of boolean values for a given point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null to create a new array. | public synchronized byte[] | evaluate(DirectPosition coord, byte[] dest) Returns a sequence of byte values for a given point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null to create a new array. | public synchronized int[] | evaluate(DirectPosition coord, int[] dest) Returns a sequence of integer values for a given point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null to create a new array. | public synchronized float[] | evaluate(DirectPosition coord, float[] dest) Returns a sequence of float values for a given point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null to create a new array. | public synchronized double[] | evaluate(DirectPosition coord, double[] dest) Returns a sequence of double values for a given point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null to create a new array. | public Envelope | getEnvelope() Returns the bounding box for the coverage domain in coordinate system coordinates. | public int | getNumSampleDimensions() Returns the number of sample dimension in this coverage. | public SampleDimension | getSampleDimension(int index) Retrieve sample dimension information for the coverage.
For a grid coverage, a sample dimension is a band. | public boolean | isInterpolationEnabled() Returns
true if interpolation are enabled in the z value dimension. | protected void | logLoading(LogRecord record) Invoked automatically when an image is about to be loaded. | public void | removeIIOReadProgressListener(IIOReadProgressListener listener) Removes an
IIOReadProgressListener from the list of registered progress listeners. | public void | removeIIOReadWarningListener(IIOReadWarningListener listener) Removes an
IIOReadWarningListener from the list of registered warning listeners. | public synchronized void | setInterpolationEnabled(boolean flag) Enable or disable interpolations in the z value dimension. | public void | snap(DirectPosition point) Snaps the specified coordinate point to the coordinate of the nearest voxel available in
this coverage. |
zDimension | final public int zDimension(Code) | | The dimension of the z ordinate (the last value in coordinate points).
This is always the
dimension minus 1.
since: 2.3 |
CoverageStack | public CoverageStack(CharSequence name, Collection coverages) throws IOException(Code) | | Constructs a new coverage stack with all the supplied elements. All coverages must uses the
same coordinate reference system. Additionnaly, all coverages must specify their z
value in the last dimension of their envelope. The example below constructs two dimensional
grid coverages (to be given as the
coverages argument) for the same area, but at
different times:
GridCoverageFactory factory = ...;
CoordinateReferenceSystem crs2D = ...; // Yours horizontal CRS.
TemporalCRS timeCRS = ...; // Yours CRS for time measurement.
CoordinateReferenceSystem crs3D = new CompoundCRS(crs3D, timeCRS);
List<Coverage> coverages = new ArrayList<Coverage>();
GeneralEnvelope envelope = new GeneralEnvelope(3); // A 3-dimensional envelope.
envelope.setRange(...); // Set the horizontal part.
for (int i=0; i<...; i++) {
envelope.setRange(2, startTime, endTime);
coverages.add(factory.create(..., crs, envelope, ...);
}
This convenience constructor wraps all coverage intos a
Adapter Adapter object.
Users with a significant amount of data are encouraged to uses the constructor expecting
Element Element objects instead, in order to provides their own implementation
loading data only when needed.
Parameters: name - The name for this coverage. Parameters: coverages - All Coverage elements for this stack. throws: IOException - if an I/O operation was required and failed. |
CoverageStack | public CoverageStack(CharSequence name, CoordinateReferenceSystem crs, Collection elements) throws IOException(Code) | | Constructs a new coverage stack with all the supplied elements.
Parameters: name - The name for this coverage. Parameters: crs - The coordinate reference system for this coverage. Parameters: elements - All coverage Element Elements for this stack. throws: IOException - if an I/O operation was required and failed. |
CoverageStack | protected CoverageStack(CharSequence name, CoverageStack source)(Code) | | Constructs a new coverage using the same elements than the specified coverage stack.
|
coveragesAt | public synchronized List coveragesAt(double z)(Code) | | Returns the coverages to be used for the specified z value. Special cases:
- If there is no coverage available for the specified z value, returns
an
.
- If there is only one coverage available, or if the specified z value
falls exactly in the middle of the
(i.e. no interpolation are needed), or if
, then this method returns a
.
- Otherwise, this method returns a list containing at least 2 coverages, one before
and one after the specified z value.
Parameters: z - The z value for the coverages to be returned. The coverages for the specified values. May contains 0, 1 or 2 elements. since: 2.3 |
evaluate | public Object evaluate(DirectPosition coord) throws CannotEvaluateException(Code) | | Returns a sequence of values for a given point in the coverage. The default implementation
delegates to the
CoverageStack.evaluate(DirectPosition,double[]) method.
Parameters: coord - The coordinate point where to evaluate. The value at the specified point. throws: PointOutsideCoverageException - if coord is outside coverage. throws: CannotEvaluateException - if the computation failed for some other reason. |
evaluate | public synchronized boolean[] evaluate(DirectPosition coord, boolean[] dest) throws CannotEvaluateException(Code) | | Returns a sequence of boolean values for a given point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null to create a new array. The dest array, or a newly created array if dest was null. throws: PointOutsideCoverageException - if coord is outside coverage. throws: CannotEvaluateException - if the computation failed for some other reason. |
evaluate | public synchronized byte[] evaluate(DirectPosition coord, byte[] dest) throws CannotEvaluateException(Code) | | Returns a sequence of byte values for a given point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null to create a new array. The dest array, or a newly created array if dest was null. throws: PointOutsideCoverageException - if coord is outside coverage. throws: CannotEvaluateException - if the computation failed for some other reason. |
evaluate | public synchronized int[] evaluate(DirectPosition coord, int[] dest) throws CannotEvaluateException(Code) | | Returns a sequence of integer values for a given point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null to create a new array. The dest array, or a newly created array if dest was null. throws: PointOutsideCoverageException - if coord is outside coverage. throws: CannotEvaluateException - if the computation failed for some other reason. |
evaluate | public synchronized float[] evaluate(DirectPosition coord, float[] dest) throws CannotEvaluateException(Code) | | Returns a sequence of float values for a given point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null to create a new array. The dest array, or a newly created array if dest was null. throws: PointOutsideCoverageException - if coord is outside coverage. throws: CannotEvaluateException - if the computation failed for some other reason. |
evaluate | public synchronized double[] evaluate(DirectPosition coord, double[] dest) throws CannotEvaluateException(Code) | | Returns a sequence of double values for a given point in the coverage.
Parameters: coord - The coordinate point where to evaluate. Parameters: dest - An array in which to store values, or null to create a new array. The dest array, or a newly created array if dest was null. throws: PointOutsideCoverageException - if coord is outside coverage. throws: CannotEvaluateException - if the computation failed for some other reason. |
getEnvelope | public Envelope getEnvelope()(Code) | | Returns the bounding box for the coverage domain in coordinate system coordinates.
|
getNumSampleDimensions | public int getNumSampleDimensions()(Code) | | Returns the number of sample dimension in this coverage.
|
getSampleDimension | public SampleDimension getSampleDimension(int index)(Code) | | Retrieve sample dimension information for the coverage.
For a grid coverage, a sample dimension is a band. The sample dimension information
include such things as description, data type of the value (bit, byte, integer...),
the no data values, minimum and maximum values and a color table if one is associated
with the dimension.
|
isInterpolationEnabled | public boolean isInterpolationEnabled()(Code) | | Returns
true if interpolation are enabled in the z value dimension.
Interpolations are enabled by default.
|
logLoading | protected void logLoading(LogRecord record)(Code) | | Invoked automatically when an image is about to be loaded. The default implementation
logs the message in the
"org.geotools.coverage" logger. Subclasses can override
this method if they wants a different logging.
Parameters: record - The log record. The message contains information about the images to load. |
setInterpolationEnabled | public synchronized void setInterpolationEnabled(boolean flag)(Code) | | Enable or disable interpolations in the z value dimension.
|
snap | public void snap(DirectPosition point) throws IOException(Code) | | Snaps the specified coordinate point to the coordinate of the nearest voxel available in
this coverage. First, this method locate the
at or
near the last ordinate value (the z value). If no coverage is available at the
specified z value, then the nearest one is selected. Next, this method locate
the pixel under the
point coordinate in the coverage element. The
point is then set to the pixel center coordinate and to the z value of the selected
coverage element. Consequently, calling any
evaluate(...) method with snapped
coordinates will returns non-interpolated values.
Parameters: point - The point to snap. throws: IOException - if an I/O operation was required but failed. |
Fields inherited from org.geotools.coverage.AbstractCoverage | final protected CoordinateReferenceSystem crs(Code)(Java Doc)
|
Methods inherited from org.geotools.coverage.AbstractCoverage | public boolean dispose(boolean force)(Code)(Java Doc) public void dispose()(Code)(Java Doc) public Set evaluate(DirectPosition coord, Set list)(Code)(Java Doc) public boolean[] evaluate(DirectPosition coord, boolean[] dest) throws CannotEvaluateException(Code)(Java Doc) public byte[] evaluate(DirectPosition coord, byte[] dest) throws CannotEvaluateException(Code)(Java Doc) public int[] evaluate(DirectPosition coord, int[] dest) throws CannotEvaluateException(Code)(Java Doc) public float[] evaluate(DirectPosition coord, float[] dest) throws CannotEvaluateException(Code)(Java Doc) public double[] evaluate(DirectPosition coord, double[] dest) throws CannotEvaluateException(Code)(Java Doc) public Set evaluateInverse(Record v)(Code)(Java Doc) public List find(DirectPosition p, int limit)(Code)(Java Doc) public GeometryValuePair find(DirectPosition p)(Code)(Java Doc) public CommonPointRule getCommonPointRule()(Code)(Java Doc) public CoordinateReferenceSystem getCoordinateReferenceSystem()(Code)(Java Doc) final public int getDimension()(Code)(Java Doc) public InternationalString[] getDimensionNames()(Code)(Java Doc) final public String[] getDimensionNames(Locale locale)(Code)(Java Doc) public Set getDomainElements()(Code)(Java Doc) public Set getDomainExtents()(Code)(Java Doc) public Envelope getEnvelope()(Code)(Java Doc) public Locale getLocale()(Code)(Java Doc) public String[] getMetadataNames()(Code)(Java Doc) public String getMetadataValue(String name) throws MetadataNameNotFoundException(Code)(Java Doc) public InternationalString getName()(Code)(Java Doc) public Set getRangeElements()(Code)(Java Doc) public RecordType getRangeType()(Code)(Java Doc) public RenderableImage getRenderableImage(int xAxis, int yAxis)(Code)(Java Doc) public List getSources()(Code)(Java Doc) public Set list()(Code)(Java Doc) public Set select(Geometry arg0, Period arg1)(Code)(Java Doc) public void show(int xAxis, int yAxis)(Code)(Java Doc) public void show(String title, int xAxis, int yAxis)(Code)(Java Doc) public void show(String title)(Code)(Java Doc) public void show()(Code)(Java Doc) public String toString()(Code)(Java Doc)
|
|
|