Package org.geotools.coverageio.jp2k
Class JP2KReader
- Object
-
- AbstractGridCoverage2DReader
-
- JP2KReader
-
- All Implemented Interfaces:
GridCoverageReader
,GridCoverage2DReader
public final class JP2KReader extends AbstractGridCoverage2DReader implements GridCoverage2DReader
This class can read a JP2K data source and create aGridCoverage2D
from the data.- Author:
- Daniele Romagnoli, GeoSolutions., Simone Giannecchini (simboss), GeoSolutions
-
-
Field Summary
-
Fields inherited from class AbstractGridCoverage2DReader
closeMe, coverageFactory, coverageName, crs, dtLayout, EPS, gzipped, highestRes, hints, inStream, inStreamSPI, numOverviews, offsets, originalEnvelope, originalGridRange, overViewResolutions, raster2Model, scales, source
-
Fields inherited from interface GridCoverage2DReader
ELEVATION_DOMAIN, ELEVATION_DOMAIN_MAXIMUM, ELEVATION_DOMAIN_MINIMUM, ELEVATION_DOMAIN_RESOLUTION, FILE_SOURCE_PROPERTY, HAS_ELEVATION_DOMAIN, HAS_TIME_DOMAIN, MULTICRS_EPSGCODES, MULTICRS_READER, PAM_DATASET, REPROJECTING_READER, SOURCE_URL_PROPERTY, TIME_DOMAIN, TIME_DOMAIN_MAXIMUM, TIME_DOMAIN_MINIMUM, TIME_DOMAIN_RESOLUTION
-
-
Constructor Summary
Constructors Constructor Description JP2KReader(Object input)
Creates a new instance of aJP2KReader
.JP2KReader(Object source, Hints uHints)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Releases resources held by this reader.protected GeneralBounds
getCoverageEnvelope()
protected GridEnvelope2D
getCoverageGridRange()
Format
getFormat()
Returns the format handled by thisGridCoverageReader
.int
getGridCoverageCount()
Number of coverages for this reader is 1protected double[]
getHighestRes()
Package private accessor for the highest resolution values.protected void
parsePRJFile()
Gets the coordinate reference system that will be associated to theGridCoverage
by looking for a related PRJ.protected void
parseWorldFile()
Checks whether a world file is associated with the data source.GridCoverage2D
read(GeneralParameterValue[] params)
Read the current grid coverage from the stream.protected void
setCoverageEnvelope(GeneralBounds coverageEnvelope)
protected void
setCoverageGridRange(GridEnvelope2D coverageGridRange)
protected void
setCoverageProperties(ImageReader reader)
Setting Envelope, GridRange and CRS from the givenImageReader
-
Methods inherited from class AbstractGridCoverage2DReader
addAllSiblings, addSiblings, checkName, collectScaleOffset, createImageCoverage, createImageCoverage, createImageCoverage, createImageCoverage, decimationOnReadingControl, finalize, getCoordinateReferenceSystem, getCoordinateReferenceSystem, getDatasetLayout, getDatasetLayout, getDynamicParameters, getDynamicParameters, getFiles, getGridCoverageNames, getGroundControlPoints, getGroundControlPoints, getHighestRes, getImageLayout, getImageLayout, getInfo, getInfo, getMetadataNames, getMetadataNames, getMetadataValue, getMetadataValue, getMultiLevelROIProvider, getOriginalEnvelope, getOriginalEnvelope, getOriginalGridRange, getOriginalGridRange, getOriginalGridToWorld, getOriginalGridToWorld, getOverviewGridEnvelope, getOverviewGridEnvelope, getPamDataset, getPamDataset, getReadingResolutions, getReadingResolutions, getRescaledRasterToModel, getResolution, getResolutionLevels, getResolutionLevels, getSibling, getSource, getSourceAsFile, read, setlayout, setLayout, setReadParams, setReadParams
-
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface GridCoverage2DReader
getCoordinateReferenceSystem, getCoordinateReferenceSystem, getDatasetLayout, getDatasetLayout, getDynamicParameters, getDynamicParameters, getImageLayout, getImageLayout, getInfo, getInfo, getOriginalEnvelope, getOriginalEnvelope, getOriginalGridRange, getOriginalGridRange, getOriginalGridToWorld, getOriginalGridToWorld, getReadingResolutions, getReadingResolutions, getResolutionLevels, getResolutionLevels, read
-
Methods inherited from interface GridCoverageReader
getGridCoverageNames, getMetadataNames, getMetadataNames, getMetadataValue, getMetadataValue, getSource
-
-
-
-
Constructor Detail
-
JP2KReader
public JP2KReader(Object input) throws IOException
Creates a new instance of aJP2KReader
. I assume nothing about file extension.- Parameters:
input
- Source object for which we want to build an JP2KReader.- Throws:
IOException
-
JP2KReader
public JP2KReader(Object source, Hints uHints) throws IOException
Constructor.- Parameters:
source
- The source object.- Throws:
IOException
-
-
Method Detail
-
setCoverageProperties
protected void setCoverageProperties(ImageReader reader) throws IOException
Setting Envelope, GridRange and CRS from the givenImageReader
- Parameters:
reader
- theImageReader
from which to retrieve metadata (if available) for setting properties- Throws:
IOException
-
setCoverageEnvelope
protected void setCoverageEnvelope(GeneralBounds coverageEnvelope)
- Parameters:
coverageEnvelope
- the envelope to set
-
getCoverageEnvelope
protected GeneralBounds getCoverageEnvelope()
- Returns:
- the nativeEnvelope
-
setCoverageGridRange
protected void setCoverageGridRange(GridEnvelope2D coverageGridRange)
- Parameters:
coverageGridRange
- the coverage grid range to set
-
getCoverageGridRange
protected GridEnvelope2D getCoverageGridRange()
- Returns:
- the nativeGridRange
-
getGridCoverageCount
public int getGridCoverageCount()
Number of coverages for this reader is 1- Specified by:
getGridCoverageCount
in interfaceGridCoverageReader
- Overrides:
getGridCoverageCount
in classAbstractGridCoverage2DReader
- Returns:
- the number of coverages for this reader.
- See Also:
GridCoverageReader.getGridCoverageCount()
-
dispose
public void dispose()
Releases resources held by this reader.- Specified by:
dispose
in interfaceGridCoverageReader
- Overrides:
dispose
in classAbstractGridCoverage2DReader
-
getFormat
public Format getFormat()
Description copied from interface:GridCoverageReader
Returns the format handled by thisGridCoverageReader
.- Specified by:
getFormat
in interfaceGridCoverageReader
- See Also:
GridCoverageReader.getFormat()
-
read
public GridCoverage2D read(GeneralParameterValue[] params) throws IOException
Description copied from class:AbstractGridCoverage2DReader
Read the current grid coverage from the stream.Example:
- Specified by:
read
in interfaceGridCoverage2DReader
- Specified by:
read
in interfaceGridCoverageReader
- Specified by:
read
in classAbstractGridCoverage2DReader
- Parameters:
params
- Optional parameters matchingFormat.getReadParameters()
.- Returns:
- a grid coverage from the input source.
- Throws:
IOException
- if a read operation failed for some other input/output reason, includingFileNotFoundException
if no file with the givenname
can be found, orIIOException
if an error was thrown by the underlying image library.- See Also:
GridCoverageReader.read(org.geotools.api.parameter.GeneralParameterValue[])
-
getHighestRes
protected double[] getHighestRes()
Package private accessor for the highest resolution values.- Overrides:
getHighestRes
in classAbstractGridCoverage2DReader
- Returns:
- the highest resolution values.
-
parsePRJFile
protected void parsePRJFile() throws UnsupportedEncodingException
Gets the coordinate reference system that will be associated to theGridCoverage
by looking for a related PRJ.- Throws:
UnsupportedEncodingException
-
parseWorldFile
protected void parseWorldFile() throws IOException
Checks whether a world file is associated with the data source. If found, set a proper envelope.- Throws:
IOException
-
-