From: <ha...@us...> - 2009-12-16 16:14:40
|
Revision: 11921 http://jmol.svn.sourceforge.net/jmol/?rev=11921&view=rev Author: hansonr Date: 2009-12-16 16:14:30 +0000 (Wed, 16 Dec 2009) Log Message: ----------- version=11.9.12_dev plot3d # bug fix: stereo mode results in zoom for entire right panel. # code: preliminary plot3d command # code: better handling of syntax errors in ScriptEvaluator.isosurface Modified Paths: -------------- trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java trunk/Jmol/src/org/jmol/script/ScriptCompiler.java trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java trunk/Jmol/src/org/jmol/script/Token.java trunk/Jmol/src/org/jmol/shape/Shape.java trunk/Jmol/src/org/jmol/shapesurface/Isosurface.java trunk/Jmol/src/org/jmol/viewer/FileManager.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/JmolConstants.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Added Paths: ----------- trunk/Jmol/src/org/jmol/shapesurface/Plot3D.java trunk/Jmol/src/org/jmol/shapesurface/Plot3DRenderer.java Modified: trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java =================================================================== --- trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java 2009-12-15 22:27:44 UTC (rev 11920) +++ trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java 2009-12-16 16:14:30 UTC (rev 11921) @@ -113,6 +113,7 @@ package org.jmol.jvxl.readers; import java.io.BufferedReader; +import java.io.StringReader; import java.util.BitSet; import java.util.Hashtable; import java.util.Vector; @@ -182,6 +183,10 @@ return params.dataType; } + public String getFileName() { + return params.fileName; + } + MeshDataServer getMeshDataServer() { return meshDataServer; } @@ -322,7 +327,7 @@ if ("debug" == propertyName) { boolean TF = ((Boolean) value).booleanValue(); params.logMessages = TF; - //logCompression = TF; + // logCompression = TF; params.logCube = TF; return true; } @@ -338,7 +343,7 @@ params.script = TextFormat.simpleReplace(params.script, ";#", "; #"); } } - return false; //more to do + return false; // more to do } if ("finalize" == propertyName) { @@ -348,10 +353,11 @@ if ("commandOption" == propertyName) { String s = " # " + (String) value; - //System.out.println("sg commandOption0 " + params.script + " and " + propertyName); + // System.out.println("sg commandOption0 " + params.script + " and " + + // propertyName); if (params.script.indexOf(s) < 0) params.script += s; - //System.out.println("sg commandOption1 " + params.script); + // System.out.println("sg commandOption1 " + params.script); return true; } @@ -479,7 +485,7 @@ return true; } - /// color options + // / color options if ("remappable" == propertyName) { params.remappable = true; @@ -531,14 +537,17 @@ if ("setColorScheme" == propertyName) { String colorScheme = (String) value; if (colorScheme.equals("sets")) { - propertyName = "mapColor"; - } else { - colorEncoder.setColorScheme(colorScheme); - if (surfaceReader != null - && params.state == Parameters.STATE_DATA_COLORED) - surfaceReader.applyColorScale(); + getSurfaceSets(); + params.colorBySets = true; + mapSurface(); return true; } + colorEncoder.setColorScheme(colorScheme); + if (surfaceReader != null + && params.state == Parameters.STATE_DATA_COLORED) + surfaceReader.applyColorScale(); + return true; + } if ("center" == propertyName) { @@ -583,20 +592,15 @@ } /* - * Based on the form of the parameters, returns and encoded radius - * as follows: + * Based on the form of the parameters, returns and encoded radius as + * follows: * - * script meaning range encoded + * script meaning range encoded * - * +1.2 offset [0 - 10] x - * -1.2 offset 0) x - * 1.2 absolute (0 - 10] x + 10 - * -30% 70% (-100 - 0) x + 200 - * +30% 130% (0 x + 200 - * 80% percent (0 x + 100 + * +1.2 offset [0 - 10] x -1.2 offset 0) x 1.2 absolute (0 - 10] x + 10 -30% + * 70% (-100 - 0) x + 200 +30% 130% (0 x + 200 80% percent (0 x + 100 * - * in each case, numbers can be integer or float - * + * in each case, numbers can be integer or float */ boolean useIonic; @@ -656,11 +660,11 @@ if (step <= 0) step = 1; n = 0; - for (float p = from; p <= to + step/10; p += step, n++) { + for (float p = from; p <= to + step / 10; p += step, n++) { } params.contoursDiscrete = new float[n]; float p = from; - for (int i = 0; i < n; i++, p+= step) { + for (int i = 0; i < n; i++, p += step) { params.contoursDiscrete[i] = p; } params.nContours = n; @@ -677,10 +681,10 @@ } if ("colorDiscrete" == propertyName) { - params.contourColixes = (short[])value; + params.contourColixes = (short[]) value; return true; } - + if ("fullPlane" == propertyName) { // fullPlane == true --> params.contourFromZero is false // fullPlane == false --> params.contourFromZero is true @@ -690,20 +694,20 @@ // the setting is ignored when discrete contours // are specified, because in that case we just // define the triangle color by their centers - + params.contourFromZero = !((Boolean) value).booleanValue(); return true; } - /// final actions /// + // / final actions /// if ("property" == propertyName) { params.dataType = Parameters.SURFACE_PROPERTY; params.theProperty = (float[]) value; - mapSurface(null); + mapSurface(); return true; } - //these next four set the reader themselves. + // these next four set the reader themselves. if ("sphere" == propertyName) { params.setSphere(((Float) value).floatValue()); surfaceReader = new IsoShapeReader(this, params.distance); @@ -763,7 +767,9 @@ if ("functionXY" == propertyName) { params.setFunctionXY((Vector) value); if (params.isContoured) - volumeData.setPlaneParameters(new Point4f(0, 0, 1, 0)); //xy plane through origin + volumeData.setPlaneParameters(new Point4f(0, 0, 1, 0)); // xy plane + // through + // origin if (((String) params.functionXYinfo.get(0)).indexOf("_xyz") >= 0) getFunctionZfromXY(); processState(); @@ -846,18 +852,13 @@ getSurfaceSets(); return true; } - + if ("mapColor" == propertyName) { - if (value instanceof String && ((String) value).equalsIgnoreCase("sets")) { - getSurfaceSets(); - params.colorBySets = true; - } else { - if ((surfaceReader = setFileData(value)) == null) { - Logger.error("Could not set the mapping data"); - return true; - } + if ((surfaceReader = setFileData(value)) == null) { + Logger.error("Could not set the mapping data"); + return true; } - mapSurface(value); + mapSurface(); return true; } @@ -879,7 +880,7 @@ if (params.state == Parameters.STATE_INITIALIZED && params.thePlane != null) params.state++; if (params.state >= Parameters.STATE_DATA_READ) { - mapSurface(null); + mapSurface(); } else { generateSurface(); } @@ -959,7 +960,7 @@ surfaceReader = null; // resets voxel reader for mapping } - private void mapSurface(Object value) { + private void mapSurface() { if (params.state == Parameters.STATE_INITIALIZED && params.thePlane != null) params.state++; if (++params.state != Parameters.STATE_DATA_COLORED) @@ -1018,6 +1019,9 @@ volumeData = (VolumeData)((Hashtable) value).get("volumeData"); return new VolumeDataReader(this); } + if (value instanceof String) { + value = new BufferedReader(new StringReader((String) value)); + } BufferedReader br = (BufferedReader) value; if (fileType == null) fileType = SurfaceFileReader.determineFileType(br); Modified: trunk/Jmol/src/org/jmol/script/ScriptCompiler.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptCompiler.java 2009-12-15 22:27:44 UTC (rev 11920) +++ trunk/Jmol/src/org/jmol/script/ScriptCompiler.java 2009-12-16 16:14:30 UTC (rev 11921) @@ -1404,6 +1404,7 @@ && !Token.tokAttr(theTok, Token.expression)) return ERROR(ERROR_invalidExpressionToken, ident); break; + case Token.plot3d: case Token.pmesh: case Token.isosurface: // isosurface ... name.xxx Modified: trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2009-12-15 22:27:44 UTC (rev 11920) +++ trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2009-12-16 16:14:30 UTC (rev 11921) @@ -24,8 +24,6 @@ package org.jmol.script; import java.awt.Image; -import java.io.BufferedReader; -import java.io.StringReader; import java.util.BitSet; import java.util.Enumeration; import java.util.Hashtable; @@ -4706,6 +4704,9 @@ case Token.console: console(); break; + case Token.plot3d: + isosurface(JmolConstants.SHAPE_PLOT3D); + break; case Token.pmesh: isosurface(JmolConstants.SHAPE_PMESH); break; @@ -12306,6 +12307,8 @@ int signPt = 0; boolean isIsosurface = (iShape == JmolConstants.SHAPE_ISOSURFACE); boolean isPmesh = (iShape == JmolConstants.SHAPE_PMESH); + boolean isPlot3d = (iShape == JmolConstants.SHAPE_PLOT3D); + boolean surfaceObjectSeen = false; boolean planeSeen = false; boolean doCalcArea = false; @@ -12328,14 +12331,16 @@ String translucency = null; String colorScheme = null; short[] discreteColixes = null; - if (isPmesh) - setShapeProperty(iShape, "fileType", "Pmesh"); + Vector propertyList = new Vector(); + if (isPmesh || isPlot3d) + addShapeProperty(propertyList, "fileType", "Pmesh"); for (int i = iToken; i < statementLength; ++i) { if (isColorParam(i)) { if (i != signPt) error(ERROR_invalidParameterOrder); - setShapeProperty(iShape, (isColorMesh ? "colorMesh" : "colorRGB"), - new Integer(getArgbParam(i))); + addShapeProperty(propertyList, + (isColorMesh ? "colorMesh" : "colorRGB"), new Integer( + getArgbParam(i))); i = iToken; signPt = i + 1; idSeen = true; @@ -12349,17 +12354,17 @@ theTok = Token.string; switch (theTok) { case Token.pmesh: - setShapeProperty(iShape, "fileType", "Pmesh"); + addShapeProperty(propertyList, "fileType", "Pmesh"); continue; case Token.within: float distance = floatParameter(++i); propertyValue = centerParameter(++i); i = iToken; propertyName = "withinPoint"; - setShapeProperty(iShape, "withinDistance", new Float(distance)); + addShapeProperty(propertyList, "withinDistance", new Float(distance)); break; case Token.property: - setShapeProperty(iShape, "propertySmoothing", viewer + addShapeProperty(propertyList, "propertySmoothing", viewer .getIsosurfacePropertySmoothing() ? Boolean.TRUE : Boolean.FALSE); str = parameterAsString(i); propertyName = "property"; @@ -12401,7 +12406,7 @@ } propertyName = "modelIndex"; propertyValue = new Integer(modelIndex); - break; + break; case Token.select: propertyName = "select"; propertyValue = expression(++i); @@ -12526,7 +12531,7 @@ i = iToken; propertyName = "ellipsoid"; if (!isSyntaxCheck) - setShapeProperty(iShape, "center", viewer.getAtomPoint3f(iAtom)); + addShapeProperty(propertyList, "center", viewer.getAtomPoint3f(iAtom)); break; case Token.hkl: // miller indices hkl @@ -12538,7 +12543,7 @@ case Token.lcaocartoon: surfaceObjectSeen = true; String lcaoType = parameterAsString(++i); - setShapeProperty(iShape, "lcaoType", lcaoType); + addShapeProperty(propertyList, "lcaoType", lcaoType); switch (getToken(++i).tok) { case Token.bitset: case Token.expressionBegin: @@ -12556,7 +12561,7 @@ modelIndex = viewer.getAtomModelIndex(atomIndex); pt = viewer.getAtomPoint3f(atomIndex); } - setShapeProperty(iShape, "modelIndex", new Integer(modelIndex)); + addShapeProperty(propertyList, "modelIndex", new Integer(modelIndex)); Vector3f[] axes = { new Vector3f(), new Vector3f(), new Vector3f(pt), new Vector3f() }; if (!isSyntaxCheck) @@ -12604,7 +12609,8 @@ case Token.sasurface: case Token.solvent: surfaceObjectSeen = true; - setShapeProperty(iShape, "bsSolvent", lookupIdentifierValue("solvent")); + addShapeProperty(propertyList, "bsSolvent", + lookupIdentifierValue("solvent")); propertyName = (theTok == Token.sasurface ? "sasurface" : "solvent"); float radius = (isFloatParameter(i + 1) ? floatParameter(++i) : viewer .getSolventProbeRadius()); @@ -12647,8 +12653,6 @@ propertyValue = nlmZ; break; case Token.binary: - // if (!isPmesh) - // error(ERROR_invalidArgument); // for PMESH, specifically // ignore for now continue; @@ -12673,8 +12677,9 @@ : 10f); if (envelopeRadius > 10f) integerOutOfRange(0, 10); - setShapeProperty(iShape, "envelopeRadius", new Float(envelopeRadius)); - setShapeProperty(iShape, "cavityRadius", new Float(cavityRadius)); + addShapeProperty(propertyList, "envelopeRadius", new Float( + envelopeRadius)); + addShapeProperty(propertyList, "cavityRadius", new Float(cavityRadius)); propertyName = "cavity"; break; case Token.contour: @@ -12830,15 +12835,14 @@ if (xyzdata == null) { iToken = ptX; error(ERROR_what, "xyzdata is null."); - } - if (xyzdata.length != nX || xyzdata[0].length != nY + } + if (xyzdata.length != nX || xyzdata[0].length != nY || xyzdata[0][0].length != nZ) { iToken = ptX; - error(ERROR_what, "xyzdata[" + xyzdata.length - + "][" + xyzdata[0].length - + "][" + xyzdata[0][0].length + "] is not of size [" - + nX + "][" + nY + "][" + nZ + "]"); - } + error(ERROR_what, "xyzdata[" + xyzdata.length + "][" + + xyzdata[0].length + "][" + xyzdata[0][0].length + + "] is not of size [" + nX + "][" + nY + "][" + nZ + "]"); + } v.addElement(xyzdata); // (5) = float[][][] data } i = iToken; @@ -12907,7 +12911,7 @@ break; case Token.object: case Token.obj: - setShapeProperty(iShape, "fileType", "Obj"); + addShapeProperty(propertyList, "fileType", "Obj"); continue; case Token.phase: if (surfaceObjectSeen) @@ -12989,35 +12993,34 @@ } surfaceObjectSeen = true; if (tokAt(i + 1) == Token.integer) - setShapeProperty(iShape, "fileIndex", new Integer(intParameter(++i))); - String[] fullPathNameReturn = new String[1]; - Object t; + addShapeProperty(propertyList, "fileIndex", new Integer( + intParameter(++i))); if (filename.equalsIgnoreCase("INLINE")) { // inline PMESH data if (tokAt(i + 1) != Token.string) error(ERROR_stringExpected); - setShapeProperty(iShape, "fileType", "Pmesh"); + addShapeProperty(propertyList, "fileType", "Pmesh"); String sdata = parameterAsString(++i); sdata = TextFormat.replaceAllCharacters(sdata, "{,}|", ' '); if (logMessages) Logger.debug("pmesh inline data:\n" + sdata); - t = (isSyntaxCheck ? null : new BufferedReader(new StringReader(sdata))); - } else { + propertyValue = (isSyntaxCheck ? null : sdata); + addShapeProperty(propertyList, "fileName", ""); + } else if (!isSyntaxCheck) { if (thisCommand.indexOf("# FILE" + nFiles + "=") >= 0) filename = extractCommandOption("# FILE" + nFiles); - t = (isSyntaxCheck ? null : viewer - .getBufferedReaderOrErrorMessageFromName(filename, - fullPathNameReturn, false)); - if (t instanceof String) - error(ERROR_fileNotFoundException, filename + ":" + t); - if (!isSyntaxCheck) - Logger - .info("reading isosurface data from " + fullPathNameReturn[0]); - setShapeProperty(iShape, "commandOption", "FILE" + (nFiles++) + "=" - + Escape.escape(fullPathNameReturn[0])); - setShapeProperty(iShape, "fileName", fullPathNameReturn[0]); + // just checking here, and getting the full path name + String[] fullPathNameOrError = viewer.getFullPathNameOrError(filename); + filename = fullPathNameOrError[0]; + if (fullPathNameOrError[1] != null) + error(ERROR_fileNotFoundException, filename + ":" + fullPathNameOrError[1]); + Logger.info("reading isosurface data from " + filename); + addShapeProperty(propertyList, "commandOption", "FILE" + (nFiles++) + + "=" + Escape.escape(filename)); + addShapeProperty(propertyList, "fileName", filename); + // null value indicates that we need a reader based on the fileName + propertyValue = null; } - propertyValue = t; break; case Token.identifier: if (str.equalsIgnoreCase("LINK")) { // for state of lcaoCartoon @@ -13033,7 +13036,7 @@ // fall through default: if (planeSeen && !surfaceObjectSeen) { - setShapeProperty(iShape, "nomap", new Float(0)); + addShapeProperty(propertyList, "nomap", new Float(0)); surfaceObjectSeen = true; } if (!setMeshDisplayProperty(iShape, i, theTok)) { @@ -13049,31 +13052,35 @@ idSeen = (theTok != Token.delete); if (propertyName == "property" && !surfaceObjectSeen) { surfaceObjectSeen = true; - setShapeProperty(iShape, "bsSolvent", lookupIdentifierValue("solvent")); + addShapeProperty(propertyList, "bsSolvent", + lookupIdentifierValue("solvent")); propertyName = "sasurface"; propertyValue = new Float(0); } if (isWild && surfaceObjectSeen) error(ERROR_invalidArgument); if (propertyName != null) - setShapeProperty(iShape, propertyName, propertyValue); + addShapeProperty(propertyList, propertyName, propertyValue); } if (isCavity && !surfaceObjectSeen) { surfaceObjectSeen = true; - setShapeProperty(iShape, "bsSolvent", lookupIdentifierValue("solvent")); - setShapeProperty(iShape, "sasurface", new Float(0)); + addShapeProperty(propertyList, "bsSolvent", + lookupIdentifierValue("solvent")); + addShapeProperty(propertyList, "sasurface", new Float(0)); } if (planeSeen && !surfaceObjectSeen) { - setShapeProperty(iShape, "nomap", new Float(0)); + addShapeProperty(propertyList, "nomap", new Float(0)); surfaceObjectSeen = true; } if (thisSetNumber > 0) - setShapeProperty(iShape, "getSurfaceSets", new Integer(thisSetNumber - 1)); - if (discreteColixes != null) { - setShapeProperty(iShape, "colorDiscrete", discreteColixes); - } else if (colorScheme != null) - setShapeProperty(iShape, "setColorScheme", colorScheme); + addShapeProperty(propertyList, "getSurfaceSets", new Integer( + thisSetNumber - 1)); + if (discreteColixes != null) + addShapeProperty(propertyList, "colorDiscrete", discreteColixes); + else if (colorScheme != null) + addShapeProperty(propertyList, "setColorScheme", colorScheme); + setShapeProperty(iShape, "setProperties", propertyList); Object area = null; Object volume = null; if (doCalcArea) { @@ -13123,6 +13130,12 @@ setShapeProperty(iShape, "clear", null); } + private void addShapeProperty(Vector propertyList, String key, + Object value) { + if (!isSyntaxCheck) + propertyList.add(new Object[] {key, value}); + } + private boolean setMeshDisplayProperty(int shape, int i, int tok) throws ScriptException { String propertyName = null; Modified: trunk/Jmol/src/org/jmol/script/Token.java =================================================================== --- trunk/Jmol/src/org/jmol/script/Token.java 2009-12-15 22:27:44 UTC (rev 11920) +++ trunk/Jmol/src/org/jmol/script/Token.java 2009-12-16 16:14:30 UTC (rev 11921) @@ -296,14 +296,15 @@ public final static int lcaocartoon = scriptCommand | 30; //final static int load see mathfunc final static int loop = scriptCommand | 31 | defaultON; - final static int minimize = scriptCommand | 33; - public final static int mo = scriptCommand | 34 | expression; + final static int minimize = scriptCommand | 32; + public final static int mo = scriptCommand | 33 | expression; //final static int model see mathfunc - public final static int monitor = scriptCommand | 35 | setparam | expression | defaultON; - final static int move = scriptCommand | 36; - public final static int moveto = scriptCommand | 37; - final static int navigate = scriptCommand | 38; - public final static int pmesh = scriptCommand | 39; + public final static int monitor = scriptCommand | 34 | setparam | expression | defaultON; + final static int move = scriptCommand | 35; + public final static int moveto = scriptCommand | 36; + final static int navigate = scriptCommand | 37; + public final static int pmesh = scriptCommand | 38; + public final static int plot3d = scriptCommand | 39; public final static int polyhedra = scriptCommand | 40; //final static int quaternion see mathfunc final static int quit = scriptCommand | 41 | noArgs; @@ -1011,6 +1012,7 @@ "out", new Token(out), "pause", new Token(pause), "wait", null, + "plot3d", new Token(plot3d), "pmesh", new Token(pmesh), "polyhedra", new Token(polyhedra), "print", new Token(print), Modified: trunk/Jmol/src/org/jmol/shape/Shape.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/Shape.java 2009-12-15 22:27:44 UTC (rev 11920) +++ trunk/Jmol/src/org/jmol/shape/Shape.java 2009-12-16 16:14:30 UTC (rev 11921) @@ -134,6 +134,14 @@ } public void setProperty(String propertyName, Object value, BitSet bsSelected) { + if (propertyName == "setProperties") { + Vector propertyList = (Vector) value; + while (propertyList.size() > 0) { + Object[] data = (Object[]) propertyList.remove(0); + setProperty(((String) data[0]).intern(), data[1], bsSelected); + } + return; + } if (propertyName == "translucentLevel") { translucentLevel = ((Float) value).floatValue(); return; Modified: trunk/Jmol/src/org/jmol/shapesurface/Isosurface.java =================================================================== --- trunk/Jmol/src/org/jmol/shapesurface/Isosurface.java 2009-12-15 22:27:44 UTC (rev 11920) +++ trunk/Jmol/src/org/jmol/shapesurface/Isosurface.java 2009-12-16 16:14:30 UTC (rev 11921) @@ -343,6 +343,20 @@ newSg(); } + if ("mapColor" == propertyName || "readFile" == propertyName) { + if (value == null) { + // ScriptEvaluator has passed the filename to us as the value of the + // "fileName" property. We retrieve that from the surfaceGenerator + // and open a BufferedReader for it. Or not. But that would be + // unlikely since we have just checked it in ScriptEvaluator + value = viewer.getBufferedReaderOrErrorMessageFromName(sg.getFileName(), + null, false); + if (value instanceof String) { + Logger.error("Isosurface: could not open file " + sg.getFileName() + " -- " + sg.getFileName()); + return; + } + } + } //surface generator only (return TRUE) or shared (return FALSE) if (sg != null && sg.setParameter(propertyName, value, bs)) Added: trunk/Jmol/src/org/jmol/shapesurface/Plot3D.java =================================================================== --- trunk/Jmol/src/org/jmol/shapesurface/Plot3D.java (rev 0) +++ trunk/Jmol/src/org/jmol/shapesurface/Plot3D.java 2009-12-16 16:14:30 UTC (rev 11921) @@ -0,0 +1,32 @@ +/* $RCSfile$ + * $Author: hansonr $ + * $Date: 2007-04-16 18:06:32 -0500 (Mon, 16 Apr 2007) $ + * $Revision: 7418 $ + * + * Copyright (C) 2002-2005 The Jmol Development Team + * + * Contact: jmo...@li... + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.jmol.shapesurface; + +public class Plot3D extends Pmesh { + public void initShape() { + super.initShape(); + myType = "plot3d"; + } +} Property changes on: trunk/Jmol/src/org/jmol/shapesurface/Plot3D.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/Jmol/src/org/jmol/shapesurface/Plot3DRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/shapesurface/Plot3DRenderer.java (rev 0) +++ trunk/Jmol/src/org/jmol/shapesurface/Plot3DRenderer.java 2009-12-16 16:14:30 UTC (rev 11921) @@ -0,0 +1,27 @@ +/* $RCSfile$ + * $Author: hansonr $ + * $Date: 2007-04-16 18:06:32 -0500 (Mon, 16 Apr 2007) $ + * $Revision: 7418 $ + * + * Copyright (C) 2005 Miguel, Jmol Development + * + * Contact: jmo...@li..., jmo...@li... + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.jmol.shapesurface; + +public class Plot3DRenderer extends PmeshRenderer { +} Property changes on: trunk/Jmol/src/org/jmol/shapesurface/Plot3DRenderer.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: trunk/Jmol/src/org/jmol/viewer/FileManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/FileManager.java 2009-12-15 22:27:44 UTC (rev 11920) +++ trunk/Jmol/src/org/jmol/viewer/FileManager.java 2009-12-16 16:14:30 UTC (rev 11921) @@ -196,7 +196,7 @@ private String getZipDirectoryAsString(String fileName) { return ZipUtil .getZipDirectoryAsStringAndClose((InputStream) getInputStreamOrErrorMessageFromName( - fileName, false)); + fileName, false, false)); } /////////////// createAtomSetCollectionFromXXX methods ///////////////// @@ -385,7 +385,8 @@ : null); } - Object getInputStreamOrErrorMessageFromName(String name, boolean showMsg) { + Object getInputStreamOrErrorMessageFromName(String name, boolean showMsg, + boolean checkOnly) { String errorMessage = null; int iurlPrefix; for (iurlPrefix = urlPrefixes.length; --iurlPrefix >= 0;) @@ -394,7 +395,7 @@ boolean isURL = (iurlPrefix >= 0); boolean isApplet = (appletDocumentBase != null); InputStream in = null; - //int length; + // int length; try { if (isApplet || isURL) { if (isApplet && isURL && appletProxy != null) @@ -404,15 +405,19 @@ if (showMsg) Logger.info("FileManager opening " + url.toString()); URLConnection conn = url.openConnection(); - //length = conn.getContentLength(); + // length = conn.getContentLength(); in = conn.getInputStream(); } else { if (showMsg) Logger.info("FileManager opening " + name); File file = new File(name); - //length = (int) file.length(); + // length = (int) file.length(); in = new FileInputStream(file); } + if (checkOnly) { + in.close(); + in = null; + } return in; } catch (Exception e) { try { @@ -425,6 +430,25 @@ return errorMessage; } + /** + * just check for a file as being readable. Do not go into a zip file + * + * @param filename + * @return String[2] where [0] is fullpathname and [1] is error message or null + */ + String[] getFullPathNameOrError(String filename) { + String[] names = classifyName(filename, true); + if (names == null || names[0] == null || names.length < 2) + return new String[] { null, "cannot read file name: " + filename }; + String name = names[0]; + String fullPath = names[0].replace('\\', '/'); + if (name.indexOf("|") >= 0) + name = TextFormat.split(name, "|")[0]; + Object errMsg = getInputStreamOrErrorMessageFromName(name, false, true); + return new String[] { fullPath, + (errMsg instanceof String ? (String) errMsg : null) }; + } + Object getBufferedReaderOrErrorMessageFromName(String name, String[] fullPathNameReturn, boolean isBinary, boolean doSpecialLoad) { @@ -486,7 +510,7 @@ } if (name.indexOf("|") >= 0) name = (subFileList = TextFormat.split(name, "|"))[0]; - Object t = getInputStreamOrErrorMessageFromName(name, true); + Object t = getInputStreamOrErrorMessageFromName(name, true, false); if (t instanceof String) return t; try { @@ -522,7 +546,7 @@ String[] getZipDirectory(String fileName, boolean addManifest) { return ZipUtil.getZipDirectoryAndClose( - (InputStream) getInputStreamOrErrorMessageFromName(fileName, false), + (InputStream) getInputStreamOrErrorMessageFromName(fileName, false, false), addManifest); } @@ -558,7 +582,7 @@ } BufferedInputStream bis = null; try { - Object t = getInputStreamOrErrorMessageFromName(name, false); + Object t = getInputStreamOrErrorMessageFromName(name, false, false); if (t instanceof String) { fileData.put(name0, (String) t + "\n"); return name0; @@ -625,7 +649,7 @@ String[] subFileList = null; if (name.indexOf("|") >= 0) name = (subFileList = TextFormat.split(name, "|"))[0]; - Object t = getInputStreamOrErrorMessageFromName(name, false); + Object t = getInputStreamOrErrorMessageFromName(name, false, false); if (t instanceof String) return "Error:" + t; try { @@ -1216,7 +1240,7 @@ htParams.put("subFileList", subFileList); String[] zipDirectory = getZipDirectory(name, true); InputStream is = new BufferedInputStream( - (InputStream) getInputStreamOrErrorMessageFromName(name, false), + (InputStream) getInputStreamOrErrorMessageFromName(name, false, false), 8192); t = viewer.getModelAdapter() .getAtomSetCollectionOrBufferedReaderFromZip(is, name, Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2009-12-15 22:27:44 UTC (rev 11920) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2009-12-16 16:14:30 UTC (rev 11921) @@ -4,6 +4,8 @@ version=11.9.12_dev # bug fix: stereo mode results in zoom for entire right panel. +# code: preliminary plot3d command +# code: better handling of syntax errors in ScriptEvaluator.isosurface # -------------------------------------------------------------- Modified: trunk/Jmol/src/org/jmol/viewer/JmolConstants.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/JmolConstants.java 2009-12-15 22:27:44 UTC (rev 11920) +++ trunk/Jmol/src/org/jmol/viewer/JmolConstants.java 2009-12-16 16:14:30 UTC (rev 11921) @@ -2781,21 +2781,22 @@ public final static int SHAPE_LCAOCARTOON = 23; public final static int SHAPE_MO = 24; //but no ID for MO public final static int SHAPE_PMESH = 25; + public final static int SHAPE_PLOT3D = 26; - public final static int SHAPE_MAX_SURFACE = 26; ////////// - public final static int SHAPE_MAX_MESH_COLLECTION = 26; ////////// + public final static int SHAPE_MAX_SURFACE = 27; ////////// + public final static int SHAPE_MAX_MESH_COLLECTION = 27; ////////// - public final static int SHAPE_ECHO = 26; + public final static int SHAPE_ECHO = 27; - public final static int SHAPE_MAX_HAS_ID = 27; + public final static int SHAPE_MAX_HAS_ID = 28; - public final static int SHAPE_AXES = 27; - public final static int SHAPE_BBCAGE = 28; - public final static int SHAPE_UCCAGE = 29; - public final static int SHAPE_HOVER = 30; + public final static int SHAPE_AXES = 28; + public final static int SHAPE_BBCAGE = 29; + public final static int SHAPE_UCCAGE = 30; + public final static int SHAPE_HOVER = 31; // last should be frank: - public final static int SHAPE_FRANK = 31; + public final static int SHAPE_FRANK = 32; public final static int SHAPE_MAX = SHAPE_FRANK + 1; public final static boolean isShapeSecondary(int i ) { @@ -2810,7 +2811,7 @@ "Labels", "Measures", "Dots", "Stars", "Halos", "Backbone", "Trace", "Cartoon", "Strands", "MeshRibbon", "Ribbons", "Rockets", "Dipoles", "Vectors", "GeoSurface", "Ellipsoids", "Polyhedra", - "Draw", "Isosurface", "LcaoCartoon", "MolecularOrbital", "Pmesh", + "Draw", "Isosurface", "LcaoCartoon", "MolecularOrbital", "Pmesh", "Plot3D", "Echo", "Axes", "Bbcage", "Uccage", "Hover", "Frank" }; @@ -2881,6 +2882,8 @@ return SHAPE_MO; case Token.pmesh: return SHAPE_PMESH; + case Token.plot3d: + return SHAPE_PLOT3D; case Token.echo: return SHAPE_ECHO; case Token.axes: Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2009-12-15 22:27:44 UTC (rev 11920) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2009-12-16 16:14:30 UTC (rev 11921) @@ -2129,6 +2129,15 @@ return fileManager.getFileName(); } + /** + * + * @param filename + * @return String[2] where [0] is fullpathname and [1] is error message or null + */ + public String[] getFullPathNameOrError(String filename) { + return fileManager.getFullPathNameOrError(filename); + } + public String getFileAsString(String name) { return getFileAsString(name, Integer.MAX_VALUE, false); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |