From: Miguel <mig...@us...> - 2005-07-07 21:03:52
|
Update of /cvsroot/jmol/Jmol/src/org/jmol/adapter/smarter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24344/src/org/jmol/adapter/smarter Modified Files: CubeReader.java Log Message: cube file work Index: CubeReader.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/org/jmol/adapter/smarter/CubeReader.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- CubeReader.java 7 Jul 2005 00:51:35 -0000 1.5 +++ CubeReader.java 7 Jul 2005 21:03:42 -0000 1.6 @@ -128,11 +128,11 @@ void readVoxelData() throws Exception { System.out.println("entering readVoxelData"); - String line = null; + String line = ""; + ichNextParse = 0; int voxelCountX = voxelCounts[0]; int voxelCountY = voxelCounts[1]; int voxelCountZ = voxelCounts[2]; - int iVoxel = 0; voxelData = new float[voxelCountX][][]; for (int x = 0; x < voxelCountX; ++x) { float[][] plane = new float[voxelCountY][]; @@ -141,12 +141,15 @@ float[] strip = new float[voxelCountZ]; plane[y] = strip; for (int z = 0; z < voxelCountZ; ++z) { - if ((iVoxel % 6) == 0) { + float voxelValue = parseFloat(line, ichNextParse); + if (Float.isNaN(voxelValue)) { line = br.readLine(); - ichNextParse = 0; + if (line == null || Float.isNaN(voxelValue = parseFloat(line))) { + System.out.println("end of file in CubeReader?"); + throw new NullPointerException(); + } } - ++iVoxel; - strip[z] = parseFloat(line, ichNextParse); + strip[z] = voxelValue; } } } |