public class GDALDataRaster extends AbstractDataRaster implements Cacheable
Modifier and Type | Field and Description |
---|---|
protected GDAL.Area |
area |
protected static int |
DEFAULT_MAX_RASTER_SIZE_LIMIT |
protected org.gdal.gdal.Dataset |
dsVRT |
protected java.io.File |
srcFile |
protected org.gdal.osr.SpatialReference |
srs |
protected java.lang.Object |
usageLock |
height, width
Constructor and Description |
---|
GDALDataRaster(org.gdal.gdal.Dataset ds) |
GDALDataRaster(java.lang.Object source)
Opens a data raster
|
GDALDataRaster(java.lang.Object source,
boolean quickReadingMode)
Opens a data raster
|
Modifier and Type | Method and Description |
---|---|
protected org.gdal.gdal.Dataset |
buildNonNorthUpDatasetFromOverview(int bestOverviewIdx,
int destWidth,
int destHeight) |
protected org.gdal.gdal.Dataset |
buildNorthUpDatasetFromOverview(Sector reqSector,
int reqWidth,
int reqHeight,
int bestOverviewIdx,
int srcWidth,
int srcHeight) |
protected java.lang.String |
composeExceptionReason(java.lang.Throwable t) |
protected static java.lang.String |
convertAVListToString(AVList list) |
protected org.gdal.gdal.Dataset |
createCompatibleDataset(int width,
int height,
Sector sector,
AVList destParams) |
protected org.gdal.gdal.Dataset |
createMaskDataset(int width,
int height,
Sector sector) |
void |
dispose()
Disposes of any internal resources allocated by the object.
|
protected void |
doDrawOnTo(DataRaster canvas) |
protected DataRaster |
doGetSubRaster(int roiWidth,
int roiHeight,
Sector roiSector,
AVList roiParams) |
void |
drawOnTo(DataRaster canvas)
Copies this raster into a specified raster.
|
protected static org.gdal.gdal.Band |
findAlphaBand(org.gdal.gdal.Dataset ds) |
protected org.gdal.gdal.Dataset |
getBestSuitedDataset(int reqWidth,
int reqHeight,
Sector reqSector)
The purpose of this method is to create the best suited dataset for the requested area.
|
protected static int |
getMaxRasterSizeLimit() |
AVList |
getMetadata() |
long |
getSizeInBytes()
Retrieves the approximate size of this object in bytes.
|
DataRaster |
getSubRaster(AVList params)
Builds a writable data raster for the requested region of interest (ROI)
|
protected void |
init(org.gdal.gdal.Dataset ds,
boolean quickReadingMode)
Extracts metadata and sets next key/value pairs:
AVKey.WIDTH - the maximum width of the image
AVKey.HEIGHT - the maximum height of the image
AVKey.COORDINATE_SYSTEM - one of the next values: AVKey.COORDINATE_SYSTEM_SCREEN
AVKey.COORDINATE_SYSTEM_GEOGRAPHIC AVKey.COORDINATE_SYSTEM_PROJECTED
AVKey.SECTOR - in case of Geographic CS, contains a regular Geographic Sector defined by lat/lon coordinates of
corners in case of Projected CS, contains a bounding box of the area
|
protected boolean |
intersects(Sector reqSector) |
protected org.gdal.osr.SpatialReference |
readSpatialReference(org.gdal.gdal.Dataset ds) |
void |
setSector(Sector sector)
Set a new extent to the data raster.
|
java.lang.String |
toString() |
computeClipRect, computeGeographicToRasterTransform, computeSourceToDestTransform, getHeight, getSector, getSubRaster, getWidth, setValue
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValues
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValues
protected GDAL.Area area
protected static final int DEFAULT_MAX_RASTER_SIZE_LIMIT
protected org.gdal.gdal.Dataset dsVRT
protected java.io.File srcFile
protected org.gdal.osr.SpatialReference srs
protected final java.lang.Object usageLock
public GDALDataRaster(org.gdal.gdal.Dataset ds) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public GDALDataRaster(java.lang.Object source) throws java.lang.IllegalArgumentException, java.io.FileNotFoundException
source
- the location of the local file, expressed as either a String path, a File, or a file URL.java.lang.IllegalArgumentException
- if the source is nulljava.io.FileNotFoundException
- if the source (File) does not existpublic GDALDataRaster(java.lang.Object source, boolean quickReadingMode) throws java.lang.IllegalArgumentException, java.io.FileNotFoundException
source
- the location of the local file, expressed as either a String path, a File, or a file
URL.quickReadingMode
- if quick reading mode is enabled GDAL will not spend much time on heavy calculations,
like for example calculating Min/Max for entire elevation rasterjava.lang.IllegalArgumentException
- if the source is nulljava.io.FileNotFoundException
- if the source (File) does not existprotected org.gdal.gdal.Dataset buildNonNorthUpDatasetFromOverview(int bestOverviewIdx, int destWidth, int destHeight)
protected org.gdal.gdal.Dataset buildNorthUpDatasetFromOverview(Sector reqSector, int reqWidth, int reqHeight, int bestOverviewIdx, int srcWidth, int srcHeight)
protected java.lang.String composeExceptionReason(java.lang.Throwable t)
protected static java.lang.String convertAVListToString(AVList list)
protected org.gdal.gdal.Dataset createCompatibleDataset(int width, int height, Sector sector, AVList destParams)
protected org.gdal.gdal.Dataset createMaskDataset(int width, int height, Sector sector)
public void dispose()
Disposable
dispose
in interface Disposable
protected void doDrawOnTo(DataRaster canvas)
protected DataRaster doGetSubRaster(int roiWidth, int roiHeight, Sector roiSector, AVList roiParams)
public void drawOnTo(DataRaster canvas)
DataRaster
drawOnTo
in interface DataRaster
canvas
- - the raster to copy into.protected static org.gdal.gdal.Band findAlphaBand(org.gdal.gdal.Dataset ds)
protected org.gdal.gdal.Dataset getBestSuitedDataset(int reqWidth, int reqHeight, Sector reqSector)
reqWidth
- width of the requested areareqHeight
- height of the requested areareqSector
- sector of the requested areaprotected static int getMaxRasterSizeLimit()
public AVList getMetadata()
public long getSizeInBytes()
Cacheable
getSizeInBytes
in interface Cacheable
Cacheable
object's size in bytespublic DataRaster getSubRaster(AVList params)
getSubRaster
in interface DataRaster
getSubRaster
in class AbstractDataRaster
params
- Required parameters are:
AVKey.HEIGHT as Integer, specifies a height of the desired ROI
AVKey.WIDTH as Integer, specifies a width of the desired ROI
AVKey.SECTOR as Sector, specifies an extent of the desired ROI
Optional parameters are:
AVKey.BAND_ORDER as array of integers, examples: for RGBA image: new int[] { 0, 1, 2, 3 }, or
for ARGB image: new int[] { 3, 0, 1, 2 } , or if you want only RGB bands of the RGBA image: new
int[] {0, 1, 2 }, or only Intensity (4th) band of the specific aerial image: new int[] { 3 }protected void init(org.gdal.gdal.Dataset ds, boolean quickReadingMode)
ds
- GDAL's DatasetquickReadingMode
- if quick reading mode is enabled GDAL will not spend much time on heavy calculations,
like for example calculating Min/Max for entire elevation rasterprotected boolean intersects(Sector reqSector)
protected org.gdal.osr.SpatialReference readSpatialReference(org.gdal.gdal.Dataset ds)
public void setSector(Sector sector) throws java.lang.IllegalArgumentException
sector
- A valid sector instancejava.lang.IllegalArgumentException
- if the Sector is nullpublic java.lang.String toString()
toString
in class java.lang.Object