Class Mosaic
-
- All Implemented Interfaces:
Serializable,Operation
public class Mosaic extends OperationJAI
This operation does a mosaic of multipleGridCoverage2Ds. TheGridCoverage2Ds 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
GridCoverage2Ds are in the same CRS, else an exception is thrown.The input parameters of the operation are:
- a Collection of the
GridCoverage2Dto mosaic - an optional
GridGeometryobject for setting the final resolution and BoundingBox - an optional
Stringindicating 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 classMosaic.GridGeometryPolicyEnum used for choosing the outputGridGeometry2Dto use and then resampling all theGridCoverage2Dto its resolution.protected static classMosaic.ParamsA block of parameters for aGridCoverage2Dprocessed by theMosaicoperation.-
Nested classes/interfaces inherited from class OperationJAI
OperationJAI.Parameters
-
-
Field Summary
Fields Modifier and Type Field Description static ParameterDescriptor<Collection>ALPHAThe parameter descriptor for the Alpha band.static StringALPHA_NAMEName for the input Alpha bandsstatic StringGEOMETRYName for the GG2D parameterstatic ParameterDescriptor<String>GEOMETRY_POLICYThe parameter descriptor for the GridGeometry choosing policy.static ParameterDescriptor<GridGeometry>GGThe parameter descriptor for the GridGeometry to use.static StringOUTNODATA_NAMEName for the Output No Data parameterstatic ParameterDescriptor<double[]>OUTPUT_NODATAThe parameter descriptor for the Transformation Choice.static StringPOLICYName for the COVERAGE_INDEX parameterstatic ParameterDescriptor<Collection>SOURCESThe parameter descriptor for the Sources.static StringSOURCES_NAMEName 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 RenderedImagecreateRenderedImage(ParameterBlockJAI parameters, RenderingHints hints)We override this one to get some extra behavior that ImageWorker has (ROI, paletted images management)CoveragedoOperation(ParameterValueGroup parameters, Hints hints)Applies a process operation to a grid coverage.protected voidextractSources(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:OperationJAIApplies a process operation to a grid coverage. The default implementation performs the following steps:- Ensures that every sources
GridCoverage2Ds use the same coordinate reference system (at least for the two-dimensional part) with the samegridToCRSrelationship. - Invokes
OperationJAI.deriveGridCoverage(org.geotools.coverage.grid.GridCoverage2D[], org.geotools.coverage.processing.OperationJAI.Parameters). The sources in theParameterBlockareRenderedImageobjects 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:
doOperationin classOperationJAI- Parameters:
parameters- List of name value pairs for the parameters required for the operation.hints- A set of rendering hints, ornullif 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:
createRenderedImagein 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:OperationJAIExtraction of the sources from the parameter called SOURCES. The sources are stored inside a List.- Overrides:
extractSourcesin classOperationJAI- Throws:
ParameterNotFoundExceptionInvalidParameterValueException
-
-