From: <ha...@us...> - 2007-03-07 06:52:00
|
Revision: 7037 http://svn.sourceforge.net/jmol/?rev=7037&view=rev Author: hansonr Date: 2007-03-06 22:51:57 -0800 (Tue, 06 Mar 2007) Log Message: ----------- 11.1.18 allows # comments in JVXL files at the beginning. This is useful because APBS files have comments, and we can copy them in this way. Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/smarter/CubeReader.java trunk/Jmol/src/org/jmol/viewer/Isosurface.java Modified: trunk/Jmol/src/org/jmol/adapter/smarter/CubeReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/smarter/CubeReader.java 2007-03-07 06:04:24 UTC (rev 7036) +++ trunk/Jmol/src/org/jmol/adapter/smarter/CubeReader.java 2007-03-07 06:51:57 UTC (rev 7037) @@ -90,6 +90,8 @@ void readAtomCountAndOrigin() throws Exception { readLine(); + while (line != null && line.indexOf("#") == 0) + readLine(); atomCount = parseInt(line); origin[0] = parseFloat(); origin[1] = parseFloat(); Modified: trunk/Jmol/src/org/jmol/viewer/Isosurface.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Isosurface.java 2007-03-07 06:04:24 UTC (rev 7036) +++ trunk/Jmol/src/org/jmol/viewer/Isosurface.java 2007-03-07 06:51:57 UTC (rev 7037) @@ -1325,7 +1325,7 @@ jvxlFileHeader = new StringBuffer(); jvxlFileHeader.append(br.readLine()); jvxlFileHeader.append('\n'); - line = br.readLine(); + skipComments(true); isApbsDx = (line.indexOf("object 1 class gridpositions counts") == 0); if (isApbsDx) { line = "APBS OpenDx DATA: " + line + " see http://apbs.sourceforge.net"; @@ -1342,7 +1342,7 @@ void readAtomCountAndOrigin() throws Exception { String atomLine; - line = br.readLine(); + skipComments(true); if (!isSilent) Logger.debug(line); atomCount = parseInt(line); @@ -1701,10 +1701,17 @@ jvxlWritePrecisionColor = false; } + void skipComments(boolean addToHeader) throws Exception { + while ((line = br.readLine()) != null && (line.length() == 0 + || line.charAt(0) == '#')) { + if (addToHeader) { + jvxlFileHeader.append(line); + jvxlFileHeader.append('\n'); + } + } + } void jvxlReadDefinitionLine(boolean showMsg) throws Exception { - while ((line = br.readLine()) != null && line.length() == 0 - || line.charAt(0) == '#') { - } + skipComments(false); if (showMsg) Logger.info("reading jvxl data set: " + line); @@ -2267,6 +2274,10 @@ short[] colixes = mesh.vertexColixes; fractionData = new StringBuffer(); strFractionTemp = (isJvxl ? jvxlColorDataRead : ""); + if (isJvxl && strFractionTemp.length() == 0) { + Logger.error("You cannot use JVXL data to map onto OTHER data, because it only containts the data for one surface. Use ISOSURFACE \"file.jvxl\" not ISOSURFACE .... MAP \"file.jvxl\"."); + return; + } fractionPtr = 0; Logger.info("JVXL reading color data base/range: " + mappedDataMin + "/" + mappedDataMax + " for " + vertexCount + " vertices." This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |