Class Mosaic
-
- All Implemented Interfaces:
Serializable
,Operation
public class Mosaic extends OperationJAI
This operation does a mosaic of multipleGridCoverage2D
s. TheGridCoverage2D
s can have different resolutions; the operation will resample them to the same one. The policies for choosing the output resolution are:- resolution of the FIRST coverage (Default)
- FINE resolution
- COARSE resolution
- resolution of an EXTERNAL GridGeometry
GridCoverage2D
s are in the same CRS, else an exception is thrown.The input parameters of the operation are:
- a Collection of the
GridCoverage2D
to mosaic - an optional
GridGeometry
object for setting the final resolution and BoundingBox - an optional
String
indicating the policy to use for choosing the resolution - an optional
double[]
indicating the nodata values to set for the background. Note that the only the first value will be used
- Author:
- Nicola Lagomarsini GesoSolutions S.A.S.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Mosaic.GridGeometryPolicy
Enum used for choosing the outputGridGeometry2D
to use and then resampling all theGridCoverage2D
to its resolution.protected static class
Mosaic.Params
A block of parameters for aGridCoverage2D
processed by theMosaic
operation.-
Nested classes/interfaces inherited from class OperationJAI
OperationJAI.Parameters
-
-
Field Summary
Fields Modifier and Type Field Description static ParameterDescriptor<Collection>
ALPHA
The parameter descriptor for the Alpha band.static String
ALPHA_NAME
Name for the input Alpha bandsstatic String
GEOMETRY
Name for the GG2D parameterstatic ParameterDescriptor<String>
GEOMETRY_POLICY
The parameter descriptor for the GridGeometry choosing policy.static ParameterDescriptor<GridGeometry>
GG
The parameter descriptor for the GridGeometry to use.static String
OUTNODATA_NAME
Name for the Output No Data parameterstatic ParameterDescriptor<double[]>
OUTPUT_NODATA
The parameter descriptor for the Transformation Choice.static String
POLICY
Name for the COVERAGE_INDEX parameterstatic ParameterDescriptor<Collection>
SOURCES
The parameter descriptor for the Sources.static String
SOURCES_NAME
Name for the Sources parameter-
Fields inherited from class OperationJAI
operation, RENDERED_MODE
-
Fields inherited from class Operation2D
PRIMARY_SOURCE_INDEX, SOURCE_0
-
Fields inherited from class AbstractOperation
descriptor
-
-
Constructor Summary
Constructors Constructor Description Mosaic()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected RenderedImage
createRenderedImage(ParameterBlockJAI parameters, RenderingHints hints)
We override this one to get some extra behavior that ImageWorker has (ROI, paletted images management)Coverage
doOperation(ParameterValueGroup parameters, Hints hints)
Applies a process operation to a grid coverage.protected void
extractSources(ParameterValueGroup parameters, Collection<GridCoverage2D> sources, String[] sourceNames)
Extraction of the sources from the parameter called SOURCES.protected Map<String,?>
getProperties(RenderedImage data, CoordinateReferenceSystem crs, InternationalString name, MathTransform gridToCRS, GridCoverage2D[] sources, Mosaic.Params parameters)
-
Methods inherited from class OperationJAI
deriveCategory, deriveGridCoverage, deriveName, deriveRange, deriveSampleDimension, deriveUnit, equals, getJAI, getOperationDescriptor, getProperties, getQuantitative, handleJAIEXTParams, handleROINoDataInternal, handleROINoDataProperties, hashCode, prepareParameters, resampleToCommonGeometry
-
Methods inherited from class Operation2D
extractSources, getFactory
-
Methods inherited from class AbstractOperation
getDescription, getDocURL, getName, getNumSources, getParameters, getVendor, getVersion, toString
-
-
-
-
Field Detail
-
POLICY
public static final String POLICY
Name for the COVERAGE_INDEX parameter- See Also:
- Constant Field Values
-
GEOMETRY
public static final String GEOMETRY
Name for the GG2D parameter- See Also:
- Constant Field Values
-
SOURCES_NAME
public static final String SOURCES_NAME
Name for the Sources parameter- See Also:
- Constant Field Values
-
OUTNODATA_NAME
public static final String OUTNODATA_NAME
Name for the Output No Data parameter- See Also:
- Constant Field Values
-
ALPHA_NAME
public static final String ALPHA_NAME
Name for the input Alpha bands- See Also:
- Constant Field Values
-
SOURCES
public static final ParameterDescriptor<Collection> SOURCES
The parameter descriptor for the Sources.
-
GG
public static final ParameterDescriptor<GridGeometry> GG
The parameter descriptor for the GridGeometry to use.
-
GEOMETRY_POLICY
public static final ParameterDescriptor<String> GEOMETRY_POLICY
The parameter descriptor for the GridGeometry choosing policy.
-
OUTPUT_NODATA
public static final ParameterDescriptor<double[]> OUTPUT_NODATA
The parameter descriptor for the Transformation Choice.
-
ALPHA
public static final ParameterDescriptor<Collection> ALPHA
The parameter descriptor for the Alpha band.
-
-
Method Detail
-
doOperation
public Coverage doOperation(ParameterValueGroup parameters, Hints hints) throws CoverageProcessingException
Description copied from class:OperationJAI
Applies a process operation to a grid coverage. The default implementation performs the following steps:- Ensures that every sources
GridCoverage2D
s use the same coordinate reference system (at least for the two-dimensional part) with the samegridToCRS
relationship. - Invokes
OperationJAI.deriveGridCoverage(org.geotools.coverage.grid.GridCoverage2D[], org.geotools.coverage.processing.OperationJAI.Parameters)
. The sources in theParameterBlock
areRenderedImage
objects obtained fromGridCoverage2D.getRenderedImage()
. - If a changes from non-geophysics to geophysics view were performed at step 1, converts
the result back to the original view using
GridCoverage2D.geophysics(false)
.
- Overrides:
doOperation
in classOperationJAI
- Parameters:
parameters
- List of name value pairs for the parameters required for the operation.hints
- A set of rendering hints, ornull
if none.- Returns:
- The result as a grid coverage.
- Throws:
CoverageProcessingException
- if the operation can't be applied.- See Also:
OperationJAI.deriveGridCoverage(org.geotools.coverage.grid.GridCoverage2D[], org.geotools.coverage.processing.OperationJAI.Parameters)
- Ensures that every sources
-
createRenderedImage
protected RenderedImage createRenderedImage(ParameterBlockJAI parameters, RenderingHints hints)
We override this one to get some extra behavior that ImageWorker has (ROI, paletted images management)- Overrides:
createRenderedImage
in classOperationJAI
- Parameters:
parameters
- The parameters to be given to JAI.hints
- The rendering hints to be given to JAI.- Returns:
- The result of JAI operation using the given parameters and hints.
-
getProperties
protected Map<String,?> getProperties(RenderedImage data, CoordinateReferenceSystem crs, InternationalString name, MathTransform gridToCRS, GridCoverage2D[] sources, Mosaic.Params parameters)
-
extractSources
protected void extractSources(ParameterValueGroup parameters, Collection<GridCoverage2D> sources, String[] sourceNames) throws ParameterNotFoundException, InvalidParameterValueException
Description copied from class:OperationJAI
Extraction of the sources from the parameter called SOURCES. The sources are stored inside a List.- Overrides:
extractSources
in classOperationJAI
- Throws:
ParameterNotFoundException
InvalidParameterValueException
-
-