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 aGridCoverage2Dfrom 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 voiddispose()Releases resources held by this reader.protected GeneralBoundsgetCoverageEnvelope()protected GridEnvelope2DgetCoverageGridRange()FormatgetFormat()Returns the format handled by thisGridCoverageReader.intgetGridCoverageCount()Number of coverages for this reader is 1protected double[]getHighestRes()Package private accessor for the highest resolution values.protected voidparsePRJFile()Gets the coordinate reference system that will be associated to theGridCoverageby looking for a related PRJ.protected voidparseWorldFile()Checks whether a world file is associated with the data source.GridCoverage2Dread(GeneralParameterValue[] params)Read the current grid coverage from the stream.protected voidsetCoverageEnvelope(GeneralBounds coverageEnvelope)protected voidsetCoverageGridRange(GridEnvelope2D coverageGridRange)protected voidsetCoverageProperties(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- theImageReaderfrom 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:
getGridCoverageCountin interfaceGridCoverageReader- Overrides:
getGridCoverageCountin 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:
disposein interfaceGridCoverageReader- Overrides:
disposein classAbstractGridCoverage2DReader
-
getFormat
public Format getFormat()
Description copied from interface:GridCoverageReaderReturns the format handled by thisGridCoverageReader.- Specified by:
getFormatin interfaceGridCoverageReader- See Also:
GridCoverageReader.getFormat()
-
read
public GridCoverage2D read(GeneralParameterValue[] params) throws IOException
Description copied from class:AbstractGridCoverage2DReaderRead the current grid coverage from the stream.Example:
- Specified by:
readin interfaceGridCoverage2DReader- Specified by:
readin interfaceGridCoverageReader- Specified by:
readin 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, includingFileNotFoundExceptionif no file with the givennamecan be found, orIIOExceptionif 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:
getHighestResin classAbstractGridCoverage2DReader- Returns:
- the highest resolution values.
-
parsePRJFile
protected void parsePRJFile() throws UnsupportedEncodingExceptionGets the coordinate reference system that will be associated to theGridCoverageby looking for a related PRJ.- Throws:
UnsupportedEncodingException
-
parseWorldFile
protected void parseWorldFile() throws IOExceptionChecks whether a world file is associated with the data source. If found, set a proper envelope.- Throws:
IOException
-
-