Stefan,
- with regards to the ascii grid displacement problem, there was
actually an error in reading the header values (when handling the corner
vs. centre origin position). I attach to this email 2 new java files
that should be ok (the flt grid code had the same problem). When I have
time (sic!) I might try to reorganize the two now independent classes in
one abstract class and 2 subclasses. Let me know if things are ok now.
If not, could you please send me the ascii grid that's giving you
problems, so I can test on it?
- incidentally: I've noticed that when a grid file is read by the
AddRasterImageLayerWizard class, if a world file is not found the method
#getGeoReferencing will generate one for you. This could be dangerous
because next time you open the raster, the georeferencing information
are read from the world file and not from the raster. So if the file
(say an ASCII GRID) has been modified in terms of georeferencing, it
will be loaded in the wrong position. What do you reckon?
- the javax.swing.GroupLayout is a standard feature in Java SE 6
(http://download-llnw.oracle.com/javase/6/docs/api/javax/swing/GroupLayout.html).
I can rewrite the plug in to avoid SE 6 classes if you want. Let me know.
I'm going back to raster symbology as soon as I can. In the meantime,
thank you for your help.
Alberto
On 10/08/2010 21:38, Stefan Steiniger wrote:
so, I think I could fix the problem.
What I do now is a complete reload of the image when getRasterData() is
called (but not replacing the image4display). This way I get sure that
always the rasterdata are delivered to Sextante which seemed to be the
problem.
While testing I noticed that when I load an ascii grid and calculate the
contours of that grid with sextante [own plugin that accesses the
sextante function], then the delivered contours are displaced in the
location (don't fit with the raster anymore). Not sure where this is to
be attributed to?
But when I calculate contours for KernelDensity raster (tif) that I
created earlier out of points, then the contours seem to be in the right
place. So maybe its some referencing info????
Alberto, could you check that?
I hope tomorrows nightly build is fine with all the raster stuff
stefan
Stefan Steiniger wrote:
Hei Alberto,
ok.. I have a problem here.
I needed to revert some changes (dynamic loading etc).
I am not sure what is going on, but if I do now some calculations I
don't get proper reference to the rasters/layerable.
So sometimes I have no reference and in other instance after the
processing is done and results are returned... those results are
shifted. It even happens with the convert to polygons function.
Interestingly this faulty behaviour is visible when I open the raster
color editor. if it contains no further elements, just the name, then
something is wrong.
However, if I use from the raster layer context menu the function:
"Export Envelope as geometry", then I get the correct reference back.
not sure what happens here...
stefan
Stefan Steiniger wrote:
me again,
I don't have
javax.swing.GroupLayout
where is that from? I have only GridBagLayout from java.awt.*
stefan
Stefan Steiniger wrote:
I actually just see that the Properties dialog of the raster layer has a
transparency checkbox
stefan
Stefan Steiniger wrote:
Hei Alberto,
I changed the RasterImageLayer class to allow for dynamic loading.
I haven't tested fully if it works as expected. Can you have a look.
With respect to this I chose now some arbitrary values for
maxPixelsForFastDisplayMode
so we can change it...
I have also added the changes to read ASCII grids.
Also if you want I can give you write access to our SVN. I think you
will do the right thing... ;)
next I will look at the coloring.
Have a good 2 weeks (holidays I assume ;).
stefan
Alberto De Luca wrote:
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
package org.openjump.core.rasterimage;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferFloat;
import java.awt.image.Raster;
import java.awt.image.SampleModel;
import java.awt.image.WritableRaster;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import javax.media.jai.RasterFactory;
import javax.media.jai.TiledImage;
import javax.swing.JOptionPane;
public class GridFloat {
public GridFloat(String fltFullFileName){
this.fltFullFileName = fltFullFileName;
hdrFullFileName = fltFullFileName.substring(0,
fltFullFileName.lastIndexOf(".")) + ".hdr";
readHdr();
}
public GridFloat(String fltFullFileName, GridFloat gridFloat2){
this.fltFullFileName = fltFullFileName;
hdrFullFileName = fltFullFileName.substring(0,
fltFullFileName.lastIndexOf(".")) + ".hdr";
this.nCols = gridFloat2.getnCols();
this.nRows = gridFloat2.getnRows();
this.xllCorner = gridFloat2.getXllCorner();
this.yllCorner = gridFloat2.getYllCorner();
this.cellSize = gridFloat2.getCellSize();
this.noData = gridFloat2.getNoData();
this.byteOrder = gridFloat2.getByteOrder();
}
public GridFloat(String fltFullFileName, int nCols, int nRows, boolean
origCorner,
double xllOrig, double yllOrig, double cellSize, double noData,
String byteOrder){
this.fltFullFileName = fltFullFileName;
hdrFullFileName = fltFullFileName.substring(0,
fltFullFileName.lastIndexOf(".")) + ".hdr";
this.nCols = nCols;
this.nRows = nRows;
this.origCorner = origCorner;
if(origCorner){
this.xllCorner = xllOrig;
this.yllCorner = yllOrig;
}else{
this.xllCorner = xllOrig - 0.5*cellSize;
this.yllCorner = yllOrig - 0.5*cellSize;
}
this.cellSize = cellSize;
this.noData = noData;
if(byteOrder.toLowerCase().equals("lsbfirst") &&
byteOrder.toLowerCase().equals("lsblast")){
this.byteOrder = "LSBFIRST";
}else{
this.byteOrder = byteOrder;
}
}
private int readHdr(){
try{
String line = null;
BufferedReader buffRead = new BufferedReader(new
FileReader(hdrFullFileName));
while((line = buffRead.readLine()) != null){
String[] lines = line.split(" +");
if(lines[0].toLowerCase().equals("ncols")){
nCols = Integer.parseInt(lines[1].toString());
}else if(lines[0].toLowerCase().equals("nrows")){
nRows = Integer.parseInt(lines[1].toString());
}else if(lines[0].toLowerCase().equals("xllcorner")){
xllCorner = Double.parseDouble(lines[1].toString());
origCorner = true;
}else if(lines[0].toLowerCase().equals("yllcorner")){
yllCorner = Double.parseDouble(lines[1].toString());
}else if(lines[0].toLowerCase().equals("xllcenter")){
xllCorner = Double.parseDouble(lines[1].toString());
origCorner = false;
}else if(lines[0].toLowerCase().equals("yllcenter")){
yllCorner = Double.parseDouble(lines[1].toString());
}else if(lines[0].toLowerCase().equals("cellsize")){
cellSize = Double.parseDouble(lines[1].toString());
}else if(lines[0].toLowerCase().equals("nodata_value")){
noData = Double.parseDouble(lines[1].toString());
}else if(lines[0].toLowerCase().equals("byteorder")){
byteOrder = lines[1].toString();
}
}
buffRead.close();
buffRead = null;
if(!origCorner){
xllCorner =- 0.5*cellSize;
yllCorner =- 0.5*cellSize;
}
return 0;
}catch(IOException Ex){
JOptionPane.showMessageDialog(null, "Error while reading hdr file:
" + Ex, "Error", JOptionPane.ERROR_MESSAGE);
return 1;
}
}
public int writeHdr(){
try{
File fileHeader = new File(hdrFullFileName);
BufferedWriter buffWrite = new BufferedWriter(new
FileWriter(fileHeader));
buffWrite.write("ncols" + " " + nCols);
buffWrite.newLine();
buffWrite.write("nrows" + " " + nRows);
buffWrite.newLine();
if(origCorner){
buffWrite.write("xllcorner" + " " + xllCorner);
buffWrite.newLine();
buffWrite.write("yllcorner" + " " + yllCorner);
buffWrite.newLine();
}else{
buffWrite.write("xllcenter" + " " + xllCorner + 0.5*cellSize);
buffWrite.newLine();
buffWrite.write("yllcenter" + " " + yllCorner + 0.5*cellSize);
buffWrite.newLine();
}
buffWrite.write("cellsize" + " " + cellSize);
buffWrite.newLine();
buffWrite.write("NODATA_value" + " " + noData);
buffWrite.newLine();
buffWrite.write("byteorder" + " " + byteOrder);
buffWrite.newLine();
buffWrite.close();
buffWrite = null;
return 0;
}catch(IOException IOExc){
JOptionPane.showMessageDialog(null, "Error while reading hdr file:
" + IOExc, "Error", JOptionPane.ERROR_MESSAGE);
return 1;
}
}
public int readGrid(){
int ret = readHdr();
if(ret != 0) return 1;
double valSum = 0;
double valSumSquare = 0;
minVal = Double.MAX_VALUE;
maxVal = -minVal;
try{
File fileFlt = new File(fltFullFileName);
FileInputStream fileInStream = new FileInputStream(fileFlt);
FileChannel fileChannel = fileInStream.getChannel();
long length = fileFlt.length();
MappedByteBuffer mbb;
mbb = fileChannel.map(
FileChannel.MapMode.READ_ONLY,
0,
length
);
mbb.order(ByteOrder.LITTLE_ENDIAN);
fileChannel.close();
fileInStream.close();
int i = 0;
dataArray = new float[nCols*nRows];
for(int c=0; c<nCols*nRows; c++){
dataArray[c] = mbb.getFloat(i);
if(dataArray[c] != noData) {
valSum += dataArray[c];
valSumSquare += (dataArray[c] * dataArray[c]);
cellCount++;
if(dataArray[c] < minVal){minVal = dataArray[c];}
if(dataArray[c] > maxVal){maxVal = dataArray[c];}
if((int)dataArray[c] != dataArray[c]) isInteger = false;
}
i+=4;
}
meanVal = valSum / cellCount;
stDevVal = Math.sqrt(valSumSquare/cellCount - meanVal*meanVal);
mbb=null;
// Create raster
SampleModel sampleModel =
RasterFactory.createBandedSampleModel(DataBuffer.TYPE_FLOAT, nCols, nRows, 1);
DataBuffer db = new DataBufferFloat(dataArray, nCols*nRows);
java.awt.Point point = new java.awt.Point();
point.setLocation(xllCorner, yllCorner);
raster = RasterFactory.createRaster(sampleModel, db, point);
return 0;
}catch(Exception ex){
JOptionPane.showMessageDialog(null, "Error while reading the flt
file: " + ex, "Error", JOptionPane.ERROR_MESSAGE);
return 1;
}
}
public int writeGrid(){
try{
if(raster == null){
// Create raster
SampleModel sampleModel =
RasterFactory.createBandedSampleModel(DataBuffer.TYPE_FLOAT, nCols, nRows, 1);
dataArray = new float[nCols*nRows];
DataBuffer db = new DataBufferFloat(dataArray, nCols*nRows);
java.awt.Point point = new java.awt.Point();
point.setLocation(xllCorner, yllCorner);
raster = RasterFactory.createRaster(sampleModel, db, point);
}
if(writeHdr() != 0) return -1;
File fileOut = new File(fltFullFileName);
FileOutputStream fileOutStream = new FileOutputStream(fileOut);
FileChannel fileChannelOut = fileOutStream.getChannel();
ByteBuffer bb = ByteBuffer.allocateDirect(nCols * 4);
bb.order(ByteOrder.LITTLE_ENDIAN);
for(int r=0; r<nRows; r++){
for(int c=0; c<nCols; c++){
if(bb.hasRemaining()){
bb.putFloat(raster.getSampleFloat(c, r, 0));
}else{
c--;
bb.compact();
fileChannelOut.write(bb);
bb.clear();
}
}
}
bb.compact();
fileChannelOut.write(bb);
bb.clear();
return 0;
}catch(Exception ex){
JOptionPane.showMessageDialog(null, "Error while reading flt file:
" + ex, "Error", JOptionPane.ERROR_MESSAGE);
return 1;
}
}
public void setFltFullFileName(String fltFullFileName){
this.fltFullFileName = fltFullFileName;
hdrFullFileName = fltFullFileName.substring(0,
fltFullFileName.lastIndexOf(".")) + ".hdr";
}
public boolean isSpatiallyEqualTo(GridFloat gridFloat2){
boolean isEqual = true;
if(nCols != gridFloat2.getnCols()) isEqual = false;
if(nRows != gridFloat2.getnRows()) isEqual = false;
if(origCorner != gridFloat2.getOrigCorner()) isEqual = false;
if(xllCorner != gridFloat2.getXllCorner()) isEqual = false;
if(yllCorner != gridFloat2.getYllCorner()) isEqual = false;
if(cellSize != gridFloat2.getCellSize()) isEqual = false;
if(noData != gridFloat2.getNoData()) isEqual = false;
if(!byteOrder.equals(gridFloat2.getByteOrder())) isEqual = false;
return isEqual;
}
public javax.media.jai.PlanarImage getPlanarImage (){
try{
// Create sample model
SampleModel sampleModel =
RasterFactory.createBandedSampleModel(DataBuffer.TYPE_FLOAT, nCols, nRows, 1);
// Create tiled image
TiledImage tiledImage = new TiledImage(0, 0, nCols, nRows, 0, 0,
sampleModel, null);
// Create writebaleraster
WritableRaster wraster = tiledImage.getWritableTile(0,0);
// Set raster data
wraster.setPixels(0, 0, nCols, nRows, dataArray);
// Set image raster
tiledImage.setData(wraster);
return tiledImage;
}catch(Exception ex){
System.out.println(ex);
return null;
}
}
public int getnCols() {
return nCols;
}
public void setnCols(int nCols) {
this.nCols = nCols;
}
public int getnRows() {
return nRows;
}
public void setnRows(int nRows) {
this.nRows = nRows;
}
public double getXllCorner() {
return xllCorner;
}
public void setXllCorner(double xllCorner) {
this.xllCorner = xllCorner;
}
public double getYllCorner() {
return yllCorner;
}
public void setYllCorner(double yllCorner) {
this.yllCorner = yllCorner;
}
public boolean getOrigCorner(){
return origCorner;
}
public void setOrigCorner(boolean origCorner){
this.origCorner = origCorner;
}
public double getCellSize() {
return cellSize;
}
public void setCellSize(double cellSize) {
this.cellSize = cellSize;
}
public double getNoData() {
return noData;
}
public void setNoData(double noData) {
this.noData = noData;
}
public String getByteOrder() {
return byteOrder;
}
public void setByteOrder(String byteOrder) {
this.byteOrder = byteOrder;
}
public Raster getRaster(){
return raster;
}
public void setRas(Raster raster){
this.raster = raster;
cellCount = 0;
DataBuffer db = raster.getDataBuffer();
for(int e=0; e<db.getSize(); e++){
if(db.getElemFloat(e) != noData) cellCount++;
}
}
public double getMinVal(){
return minVal;
}
public double getMaxVal(){
return maxVal;
}
public double getMeanVal(){
return meanVal;
}
public double getStDevVal(){
return stDevVal;
}
public long getCellCount(){
return cellCount;
}
public boolean isInteger(){
return isInteger;
}
private String fltFullFileName = null;
private String hdrFullFileName = null;
private int nCols = 0;
private int nRows = 0;
private double xllCorner = 0;
private double yllCorner = 0;
// private double xllCenter = 0;
// private double yllCenter = 0;
private double cellSize = 0;
private double noData = -9999;
private String byteOrder = "LSBFIRST";
private boolean origCorner = true;
// private double[][] ras = null;
private float[] dataArray = null;
private Raster raster = null;
private long cellCount = 0;
private double minVal = Double.MAX_VALUE;
private double maxVal = -Double.MAX_VALUE;
private double meanVal = 0;
private double stDevVal = 0;
private boolean isInteger = true;
public static final String LSBFIRST = "LSBFIRST";
public static final String MSBFIRST = "MSBFIRST";
}
package org.openjump.core.rasterimage;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferDouble;
import java.awt.image.Raster;
import java.awt.image.SampleModel;
import java.awt.image.WritableRaster;
import java.io.BufferedReader;
import java.io.FileReader;
import javax.media.jai.RasterFactory;
import javax.media.jai.TiledImage;
public class GridAscii {
public GridAscii(String ascFullFileName){
this.ascFullFileName = ascFullFileName;
readHeader();
}
public GridAscii(String ascFullFileName, GridAscii gridAscii2){
this.ascFullFileName = ascFullFileName;
this.nCols = gridAscii2.getnCols();
this.nRows = gridAscii2.getnRows();
this.xllCorner = gridAscii2.getXllCorner();
this.yllCorner = gridAscii2.getYllCorner();
this.cellSize = gridAscii2.getCellSize();
this.noData = gridAscii2.getNoData();
}
public GridAscii(String ascFullFileName, int nCols, int nRows, boolean
origCorner,
double xllOrig, double yllOrig, double cellSize, double noData,
String byteOrder){
this.ascFullFileName = ascFullFileName;
this.nCols = nCols;
this.nRows = nRows;
this.origCorner = origCorner;
if(origCorner){
this.xllCorner = xllOrig;
this.yllCorner = yllOrig;
}else{
this.xllCorner = xllOrig - 0.5*cellSize;
this.yllCorner = yllOrig - 0.5*cellSize;
}
this.cellSize = cellSize;
this.noData = noData;
}
public final int readHeader(){
try{
BufferedReader buffRead = new BufferedReader(new
FileReader(ascFullFileName));
String line = null;
String[] lines = null;
int nDecimalsXll = 0;
int nDecimalsYll = 0;
int nDecimalsCellSize = 0;
String[] header = new String[6];
for(int l=0; l<6; l++){
line = buffRead.readLine();
lines = line.split(" +");
if(lines[0].trim().toLowerCase().equals("ncols")){
header[0] = lines[1];
}
if(lines[0].trim().toLowerCase().equals("nrows")){
header[1] = lines[1];
}
if(lines[0].trim().toLowerCase().equals("xllcorner")){
header[2] = lines[1];
origCorner = true;
nDecimalsXll = lines[1].length() -
lines[1].lastIndexOf(".") - 1;
}
if(lines[0].trim().toLowerCase().equals("yllcorner")){
header[3] = lines[1];
origCorner = true;
nDecimalsYll = lines[1].length() -
lines[1].lastIndexOf(".") - 1;
}
if(lines[0].trim().toLowerCase().equals("xllcenter")){
header[2] = lines[1];
origCorner = false;
nDecimalsXll = lines[1].length() -
lines[1].lastIndexOf(".") - 1;
}
if(lines[0].trim().toLowerCase().equals("yllcenter")){
header[3] = lines[1];
origCorner = false;
nDecimalsYll = lines[1].length() -
lines[1].lastIndexOf(".") - 1;
}
if(lines[0].trim().toLowerCase().equals("cellsize")){
header[4] = lines[1];
nDecimalsCellSize = lines[1].length() -
lines[1].lastIndexOf(".") - 1;
}
if(lines[0].trim().toLowerCase().equals("nodata_value")){
header[5] = lines[1];
}
}
buffRead.close();
nCols = Integer.parseInt(header[0]);
nRows = Integer.parseInt(header[1]);
xllCorner = Double.parseDouble(header[2]);
yllCorner = Double.parseDouble(header[3]);
cellSize = Double.parseDouble(header[4]);
noData = Double.parseDouble(header[5]);
// From corner to center, if needed
if(!origCorner){
xllCorner = xllCorner + 0.5 * cellSize;
yllCorner = yllCorner + 0.5 * cellSize;
}
return 0;
}catch(Exception ex){
return 1;
}
}
public int readGrid(){
int ret = readHeader();
if(ret != 0) return 1;
double valSum = 0;
double valSumSquare = 0;
minVal = Double.MAX_VALUE;
maxVal = -minVal;
try{
BufferedReader buffRead = new BufferedReader(new
FileReader(ascFullFileName));
// Skip header
for(int l=0; l<=5; l++){
buffRead.readLine();
}
// Read remaining part of grids
String dtmLine = null;
String[] dtmLines = null;
int col = 0;
int row = 0;
// Read DTM
int line = 0;
int cell = 0;
cellCount = 0;
dataArray = new double[nCols*nRows];
while((dtmLine = buffRead.readLine()) != null){
dtmLine = dtmLine.trim();
dtmLines = dtmLine.split(" +");
for(int c=0; c<dtmLines.length; c++){
// row = (cell/nCols);
// col = cell - (row * nCols) + 1;
dataArray[cell] = Double.parseDouble(dtmLines[c]);
// ras[col][row] = Double.parseDouble(dtmLines[c]);
if(dataArray[cell] != noData) {
valSum += dataArray[cell];
valSumSquare += (dataArray[cell] * dataArray[cell]);
cellCount++;
if(dataArray[cell] < minVal){minVal = dataArray[cell];}
if(dataArray[cell] > maxVal){maxVal = dataArray[cell];}
if((int)dataArray[cell] != dataArray[cell]) isInteger =
false;
}
cell++;
}
line++;
}
buffRead.close();
meanVal = valSum / cellCount;
stDevVal = Math.sqrt(valSumSquare/cellCount - meanVal*meanVal);
// Create raster
SampleModel sampleModel =
RasterFactory.createBandedSampleModel(DataBuffer.TYPE_FLOAT, nCols, nRows, 1);
DataBuffer db = new DataBufferDouble(dataArray, nCols*nRows);
java.awt.Point point = new java.awt.Point();
point.setLocation(xllCorner, yllCorner);
raster = RasterFactory.createRaster(sampleModel, db, point);
return 0;
}catch(Exception ex){
return 1;
}
}
public void setHeaderEqualTo(GridAscii gridAscii){
this.nCols = gridAscii.getnCols();
this.nRows = gridAscii.getnRows();
this.xllCorner = gridAscii.getXllCorner();
this.yllCorner = gridAscii.getYllCorner();
this.cellSize = gridAscii.getCellSize();
this.noData = gridAscii.getNoData();
this.origCorner = gridAscii.origCorner;
}
public boolean isSpatiallyEqualTo(GridAscii gridAscii2){
boolean isEqual = true;
if(nCols != gridAscii2.getnCols()) isEqual = false;
if(nRows != gridAscii2.getnRows()) isEqual = false;
if(origCorner != gridAscii2.getOrigCorner()) isEqual = false;
if(xllCorner != gridAscii2.getXllCorner()) isEqual = false;
if(yllCorner != gridAscii2.getYllCorner()) isEqual = false;
if(cellSize != gridAscii2.getCellSize()) isEqual = false;
if(noData != gridAscii2.getNoData()) isEqual = false;
return isEqual;
}
public javax.media.jai.PlanarImage getPlanarImage (){
try{
// Create sample model
SampleModel sampleModel =
RasterFactory.createBandedSampleModel(DataBuffer.TYPE_FLOAT, nCols, nRows, 1);
// Create tiled image
TiledImage tiledImage = new TiledImage(0, 0, nCols, nRows, 0, 0,
sampleModel, null);
// Create writebaleraster
WritableRaster wraster = tiledImage.getWritableTile(0,0);
// Set raster data
wraster.setPixels(0, 0, nCols, nRows, dataArray);
// Set image raster
tiledImage.setData(wraster);
return tiledImage;
}catch(Exception ex){
System.out.println(ex);
return null;
}
}
public int getnCols() {
return nCols;
}
public void setnCols(int nCols) {
this.nCols = nCols;
}
public int getnRows() {
return nRows;
}
public void setnRows(int nRows) {
this.nRows = nRows;
}
public double getXllCorner() {
return xllCorner;
}
public void setXllCorner(double xllCorner) {
this.xllCorner = xllCorner;
}
public double getYllCorner() {
return yllCorner;
}
public void setYllCorner(double yllCorner) {
this.yllCorner = yllCorner;
}
public boolean getOrigCorner(){
return origCorner;
}
public void setOrigCorner(boolean origCorner){
this.origCorner = origCorner;
}
public double getCellSize() {
return cellSize;
}
public void setCellSize(double cellSize) {
this.cellSize = cellSize;
}
public double getNoData() {
return noData;
}
public void setNoData(double noData) {
this.noData = noData;
}
public Raster getRaster(){
return raster;
}
public void setRas(Raster raster){
this.raster = raster;
cellCount = 0;
DataBuffer db = raster.getDataBuffer();
for(int e=0; e<db.getSize(); e++){
if(db.getElemFloat(e) != noData) cellCount++;
}
}
public double getMinVal(){
return minVal;
}
public double getMaxVal(){
return maxVal;
}
public double getMeanVal(){
return meanVal;
}
public double getStDevVal(){
return stDevVal;
}
public long getCellCount(){
return cellCount;
}
public boolean isInteger(){
return isInteger;
}
private String ascFullFileName = null;
private boolean origCorner = false;
private int nCols = 0;
private int nRows = 0;
private double xllCorner = 0;
private double yllCorner = 0;
private double cellSize = 0;
private double noData = -9999;
private double[] dataArray = null;
private Raster raster = null;
private long cellCount = 0;
private double minVal = Double.MAX_VALUE;
private double maxVal = -Double.MAX_VALUE;
private double meanVal = 0;
private double stDevVal = 0;
private boolean isInteger = true;
}
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel