|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectAsciiGridRaster
public abstract class AsciiGridRaster
Abstract base class to handle ASCII ArcGrid/GRASS formats
Nested Class Summary | |
---|---|
static class |
AsciiGridRaster.AsciiGridRasterType
|
Field Summary | |
---|---|
protected boolean |
abortRequired
|
protected double |
cellSizeX
The size of a single cell of the grid along X |
protected double |
cellSizeY
The size of a single cell of the grid along Y |
protected boolean |
compress
true if the file related to this raster is compressed |
protected long |
dataStartAt
A kind of Bookmark that point at the first byte in the stream after the header |
protected ImageInputStream |
imageIS
ImageInputStream used to read the source that contain data |
protected ImageOutputStream |
imageOS
ImageOutputStream used to write the raster to the device (file,stream,...) |
protected boolean |
isCorner
If isCorner is true then
xllCellCoordinate is the coordinate of the lower-left
corner of the grid. |
protected static Logger |
LOGGER
|
protected double |
maxValue
max value found in the file |
protected double |
minValue
min value found in the file |
protected int |
nCols
The number of columns of the raster |
static String |
newline
The OS-dependent line separator |
protected double |
noData
the value used to represent noData for an element of the raster |
protected int |
nRows
The number of rows of the raster |
protected AsciiGridsImageReader |
reader
the AsciiGridsImageReader to be used for read operations |
protected int |
sourceXSubsampling
horizontal subsampling |
protected int |
sourceYSubsampling
vertical subsampling |
protected int |
tileHeight
the height of a tile |
protected TreeMap<Long,Long> |
tileMarker
A TreeMap used to Skip spaces-count operation when the image is tiled. |
protected int[] |
tileTreeMutex
|
protected int |
tileWidth
the width of a tile |
protected AsciiGridsImageWriter |
writer
the AsciiGridsImageWriter to be used for write operations |
protected double |
xllCellCoordinate
x coordinate of the grid origin (the lower left corner) in compliance with the isCorner value |
protected double |
yllCellCoordinate
y coordinate of the grid origin (the lower left corner) in compliance with the isCorner value |
Constructor Summary | |
---|---|
protected |
AsciiGridRaster(ImageInputStream iis)
A constructor b |
protected |
AsciiGridRaster(ImageInputStream iis,
AsciiGridsImageReader reader)
A constructor to build an AsciiGridRaster given an
ImageInputStream and an AsciiGridsImageReader |
protected |
AsciiGridRaster(ImageOutputStream ios)
A base constructor to write AsciiGridRaster s. |
protected |
AsciiGridRaster(ImageOutputStream ios,
AsciiGridsImageWriter writer)
A constructor to build an AsciiGridRaster given an
ImageOutputStream and an AsciiGridsImageWriter |
Method Summary | |
---|---|
void |
abort()
|
void |
clearAbort()
|
double |
getCellSizeX()
Cell Size X value |
double |
getCellSizeY()
Cell Size Y value |
double |
getMaxValue()
Max value. |
double |
getMinValue()
Min value. |
int |
getNCols()
Number of columns. |
double |
getNoData()
NoData value. |
abstract String |
getNoDataMarker()
Return the String representing noData. |
int |
getNRows()
Number of rows. |
abstract AsciiGridRaster.AsciiGridRasterType |
getRasterType()
Retrieves the type of raster we are serving, GRASS or ESRI. |
int |
getSourceXSubsampling()
XSubSampling factor |
int |
getSourceYSubsampling()
YSubSampling factor |
int |
getTileHeight()
TileHeight value |
int |
getTileWidth()
TileWidth value |
double |
getXllCellCoordinate()
Lower-Left Cell: X coordinate |
double |
getYllCellCoordinate()
Lower-Left Cell: Y coordinate |
boolean |
isAborting()
|
boolean |
isCorner()
Returns the isCorner field. |
abstract void |
parseHeader()
The header structure of an ASCII GRASS file is different from the one of an ASCII ArcGrid file. |
WritableRaster |
readRaster(ImageReadParam param)
This method reads data values from the ImageInputStream and returns a raster having these data values as samples. |
void |
setTilesSize(int tileWidth,
int tileHeight)
Initializes tile sizes |
abstract void |
writeHeader(String columns,
String rows,
String xll,
String yll,
String cellsizeX,
String cellsizeY,
String rasterSpaceType,
String noDataValue)
As stated for parseHeader , the differences betweens the
structure of the header of an ASCII ArcGrid and the one of an ASCII GRASS
require a different management also during the writing process. |
void |
writeRaster(RectIter iterator,
Double noDataDouble,
String noDataMarker)
Writes the raster |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final Logger LOGGER
public static final String newline
protected final int[] tileTreeMutex
protected volatile boolean abortRequired
protected double maxValue
protected double minValue
protected double xllCellCoordinate
isCorner
value
protected double yllCellCoordinate
isCorner
value
protected int sourceXSubsampling
protected int sourceYSubsampling
protected boolean isCorner
isCorner
is true
then
xllCellCoordinate
is the coordinate of the lower-left
corner of the grid. If isCorner
is false
then xllCellCoordinate
is the coordinate of the center of
the lower-left gridcell of the grid.
protected double cellSizeX
protected double cellSizeY
protected int nCols
protected int nRows
protected boolean compress
true
if the file related to this raster is compressed
protected long dataStartAt
protected TreeMap<Long,Long> tileMarker
protected int tileWidth
protected int tileHeight
protected ImageInputStream imageIS
protected ImageOutputStream imageOS
protected double noData
protected AsciiGridsImageReader reader
AsciiGridsImageReader
to be used for read operations
protected AsciiGridsImageWriter writer
AsciiGridsImageWriter
to be used for write operations
Constructor Detail |
---|
protected AsciiGridRaster(ImageInputStream iis)
protected AsciiGridRaster(ImageInputStream iis, AsciiGridsImageReader reader)
AsciiGridRaster
given an
ImageInputStream
and an AsciiGridsImageReader
iis
- ImageInputStream
needed to read the raster.reader
- AsciiGridsImageReader
used to read the raster.protected AsciiGridRaster(ImageOutputStream ios)
AsciiGridRaster
s.
ios
- ImageOutputStream
needed to write the raster.protected AsciiGridRaster(ImageOutputStream ios, AsciiGridsImageWriter writer)
AsciiGridRaster
given an
ImageOutputStream
and an AsciiGridsImageWriter
iis
- ImageOutputStream
needed to read the raster.writer
- AsciiGridsImageWriter
used to read the raster.Method Detail |
---|
public abstract void parseHeader() throws IOException
A GRASS Header has the following form: --------------------------------------- NORTH: XX SOUTH: XX EAST: XX WEST: XX ROWS: XX COLS: XX An ArcGrid header has the following form: ----------------------------------------- nrows XX ncols XX xllcorner (OR xllcenter) XX yllcorner (OR yllcenter) XX cellsize XX NODATA_value XX (Optional) (note: XX represents the value of the specific field)For this reason, a specific implementation is required.
IOException
public abstract void writeHeader(String columns, String rows, String xll, String yll, String cellsizeX, String cellsizeY, String rasterSpaceType, String noDataValue) throws IOException
parseHeader
, the differences betweens the
structure of the header of an ASCII ArcGrid and the one of an ASCII GRASS
require a different management also during the writing process. For this
reason, a specific implementation is required.
IOException
public abstract String getNoDataMarker()
String
representing noData.
public final double getMaxValue()
public final double getMinValue()
public final double getNoData()
public final int getNRows()
public abstract AsciiGridRaster.AsciiGridRasterType getRasterType()
public final int getNCols()
public int getSourceXSubsampling()
public int getSourceYSubsampling()
public final double getCellSizeX()
public final double getCellSizeY()
public final double getXllCellCoordinate()
isCorner
public final double getYllCellCoordinate()
isCorner
public final int getTileHeight()
public final int getTileWidth()
public final void setTilesSize(int tileWidth, int tileHeight)
tileWidth
- the width of the tiletileHeight
- the height of the tilepublic final boolean isCorner()
isCorner
field.true
if xllCellCoordinate
and
yllCellCoordinate
represent the coordinates of the
lower-left corner of the lower-left cell of the grid. It is
false
if they represent the coordinates of the center of
the lower-left cell of the grid.
public WritableRaster readRaster(ImageReadParam param) throws IOException
param
- an ImageReadParam which specifies source region properties as
width, height, x and y offsets.
IOException
NumberFormatException
- TODO we ignore destination region, destinationOffset etc...public void writeRaster(RectIter iterator, Double noDataDouble, String noDataMarker) throws IOException
iterator
- A RectIterator
built on Lines and Pixels of the
Raster which need to be written.noDataDouble
- the value representing noData.noDataMarker
- a String
which need to be printed when founding
a noData value
IOException
public void abort()
public boolean isAborting()
public void clearAbort()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |