public abstract class AsciiGridRaster extends Object
Modifier and Type | Class and Description |
---|---|
static class |
AsciiGridRaster.AsciiGridRasterType |
Modifier and Type | Field and Description |
---|---|
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 |
Modifier | Constructor and Description |
---|---|
protected |
AsciiGridRaster(ImageInputStream iis)
A constructor b
|
protected |
AsciiGridRaster(ImageInputStream iis,
AsciiGridsImageReader reader)
|
protected |
AsciiGridRaster(ImageOutputStream ios)
A base constructor to write
AsciiGridRaster s. |
protected |
AsciiGridRaster(ImageOutputStream ios,
AsciiGridsImageWriter writer)
|
Modifier and Type | Method and Description |
---|---|
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(javax.media.jai.iterator.RectIter iterator,
Double noDataDouble,
String noDataMarker)
Writes the raster
|
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
valueprotected double yllCellCoordinate
isCorner
valueprotected 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 compressedprotected 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 operationsprotected AsciiGridsImageWriter writer
AsciiGridsImageWriter
to be used for write operationsprotected AsciiGridRaster(ImageInputStream iis)
protected AsciiGridRaster(ImageInputStream iis, AsciiGridsImageReader reader)
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)
iis
- ImageOutputStream
needed to read the raster.writer
- AsciiGridsImageWriter
used to read the raster.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(javax.media.jai.iterator.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 valueIOException
public void abort()
public boolean isAborting()
public void clearAbort()
Copyright © 2006–2015 GeoSolutions. All rights reserved.