| java.lang.Object org.geotools.resources.coverage.CoverageUtilities
All known Subclasses: org.geotools.resources.image.CoverageUtilities,
CoverageUtilities | public class CoverageUtilities (Code) | | A set of utilities methods for the Grid Coverage package. Those methods are not really
rigorous; must of them should be seen as temporary implementations.
since: 2.4 version: $Id: CoverageUtilities.java 25447 2007-05-06 16:56:19Z desruisseaux $ author: Martin Desruisseaux author: Simone Giannecchini |
Constructor Summary | |
protected | CoverageUtilities() Do not allows instantiation of this class. |
Method Summary | |
public static double[] | getBackgroundValues(GridCoverage2D coverage) Retrieves a best guess for the sample value to use for background,
inspecting the categories of the provided
GridCoverage2D .
Parameters: coverage - to use for guessing background values. | public static int | getVisibleBand(Object image) Returns the visible band in the specified
RenderedImage or
PropertySource .
This method fetch the
"GC_VisibleBand" property. | public static boolean | hasRenderingCategories(GridCoverage gridCoverage) Returns
true if the provided
GridCoverage has
Category objects twith a real transformation.
Common use case for this method is understanding if a
GridCoverage has an accompanying Gephysiscs or non-Geophysics
view, which means a dicotomy between the coverage with the "real" data
and the coverage with the rendered version of the original data exists.
An example is when you have raw data whose data type is float and you
want to render them using a palette. | public static boolean | hasTransform(SampleDimension[] sampleDimensions) Returns
true if at least one of the specified sample dimensions has a
transform
which is not the identity transform. | public static int | prepareSourcesForGCOperation(GridCoverage2D coverage, Interpolation interpolation, boolean hasFilter, RenderingHints hints) General purpose method used in various operations for
GridCoverage2D to help
with taking decisions on how to treat coverages with respect to their
ColorModel .
The need for this method arose in consideration of the fact that applying most operations
on coverage whose
ColorModel is an instance of
IndexColorModel may lead to
unpredictable results depending on the applied
Interpolation (think about applying
"Scale" with
InterpolationBilinear on a non-geophysics
GridCoverage2D with an
IndexColorModel ) or more simply on the operation itself ("SubsampleAverage" cannot
be applied at all on a
GridCoverage2D backed by an
IndexColorModel ).
This method suggests the actions to take depending on the structure of the provided
GridCoverage2D , the provided
Interpolation and if the operation uses
a filter or not (this is useful for operations like SubsampleAverage or FilteredSubsample).
In general the idea is as follows: If the original coverage is backed by a
RenderedImage with an
IndexColorModel , we have the following cases:
- if the interpolation is
InterpolationNearest and there is no filter involved
we can apply the operation on the
IndexColorModel -backed coverage with nor
probs.
- If the interpolations in of higher order or there is a filter to apply we have to
options:
- If the coverage has a twin geophysics view we need to go back to it and apply
the operation there.
- If the coverage has no geophysics view (an orthophoto with an intrisic
IndexColorModel view) we need to perform an RGB(A) color expansion
before applying the operation.
A special case is when we want to apply an operation on the geophysics view of a coverage that
does not involve high order interpolation of filters. | public static boolean | uses(GridCoverage coverage, RenderedImage image) Returns
true if the specified grid coverage or any of its source
uses the following image. | public static FeatureCollection | wrapGc(GridCoverage coverage) Wraps a grid coverage into a Feature. | public static FeatureCollection | wrapGcReader(AbstractGridCoverage2DReader reader) Wraps a grid coverage into a Feature. |
LENIENT_HINT | final public static Hints LENIENT_HINT(Code) | | Controlling datum shift process.
|
CoverageUtilities | protected CoverageUtilities()(Code) | | Do not allows instantiation of this class.
|
getBackgroundValues | public static double[] getBackgroundValues(GridCoverage2D coverage)(Code) | | Retrieves a best guess for the sample value to use for background,
inspecting the categories of the provided
GridCoverage2D .
Parameters: coverage - to use for guessing background values. an array of double values to use as a background. |
getVisibleBand | public static int getVisibleBand(Object image)(Code) | | Returns the visible band in the specified
RenderedImage or
PropertySource .
This method fetch the
"GC_VisibleBand" property. If this property is undefined,
then the visible band default to the first one.
Parameters: image - The image for which to fetch the visible band, or null . The visible band. |
hasRenderingCategories | public static boolean hasRenderingCategories(GridCoverage gridCoverage)(Code) | | Returns
true if the provided
GridCoverage has
Category objects twith a real transformation.
Common use case for this method is understanding if a
GridCoverage has an accompanying Gephysiscs or non-Geophysics
view, which means a dicotomy between the coverage with the "real" data
and the coverage with the rendered version of the original data exists.
An example is when you have raw data whose data type is float and you
want to render them using a palette. You usually do this by specifying a
set of
Category object which will map some intervals of the raw
data to some specific colors. The rendered version that we will create
using the method
GridCoverage2D#geophysics(false) will be backed
by a RenderedImage with an IndexColorModel representing the colors
provided in the Categories.
Parameters: gridCoverage - to check for the existence of categories with tranformationsbetween original data and their rendered counterpart. false if this coverage has only a single view associated with it, true otherwise. |
hasTransform | public static boolean hasTransform(SampleDimension[] sampleDimensions)(Code) | | Returns
true if at least one of the specified sample dimensions has a
transform
which is not the identity transform.
|
prepareSourcesForGCOperation | public static int prepareSourcesForGCOperation(GridCoverage2D coverage, Interpolation interpolation, boolean hasFilter, RenderingHints hints)(Code) | | General purpose method used in various operations for
GridCoverage2D to help
with taking decisions on how to treat coverages with respect to their
ColorModel .
The need for this method arose in consideration of the fact that applying most operations
on coverage whose
ColorModel is an instance of
IndexColorModel may lead to
unpredictable results depending on the applied
Interpolation (think about applying
"Scale" with
InterpolationBilinear on a non-geophysics
GridCoverage2D with an
IndexColorModel ) or more simply on the operation itself ("SubsampleAverage" cannot
be applied at all on a
GridCoverage2D backed by an
IndexColorModel ).
This method suggests the actions to take depending on the structure of the provided
GridCoverage2D , the provided
Interpolation and if the operation uses
a filter or not (this is useful for operations like SubsampleAverage or FilteredSubsample).
In general the idea is as follows: If the original coverage is backed by a
RenderedImage with an
IndexColorModel , we have the following cases:
- if the interpolation is
InterpolationNearest and there is no filter involved
we can apply the operation on the
IndexColorModel -backed coverage with nor
probs.
- If the interpolations in of higher order or there is a filter to apply we have to
options:
- If the coverage has a twin geophysics view we need to go back to it and apply
the operation there.
- If the coverage has no geophysics view (an orthophoto with an intrisic
IndexColorModel view) we need to perform an RGB(A) color expansion
before applying the operation.
A special case is when we want to apply an operation on the geophysics view of a coverage that
does not involve high order interpolation of filters. In this case we suggest to apply the
operation on the non-geophysics view, which is usually much faster. Users may ignore this
advice.
Parameters: coverage - to check for the action to take. Parameters: interpolation - to use for the action to take. Parameters: hasFilter - if the operation we will apply is going to use a filter. Parameters: hints - to use when applying a certain operation. 0 if nothing has to be done on the provided coverage, 1 if a color expansion has to beprovided, 2 if we need to employ the geophysics vew of the provided coverage,3 if we suggest to employ the non-geophysics vew of the provided coverage. since: 2.3.1org.geotools.coverage.grid.ViewType |
uses | public static boolean uses(GridCoverage coverage, RenderedImage image)(Code) | | Returns
true if the specified grid coverage or any of its source
uses the following image.
|
|
|