Revision: 20907 http://sourceforge.net/p/jmol/code/20907 Author: hansonr Date: 2015-12-31 09:06:06 +0000 (Thu, 31 Dec 2015) Log Message: ----------- Jmol.___JmolVersion="14.4.1_2015.12.29"
bug fix: file dropping of JVXL files does not work bug fix: Mesh capper not working for multiple cuts due to unclosed surface cut -- for example: load maleic.cif 1;select on atomindex=6;lcaocartoon scale 1.0 CAP unitcell "cpk" bug fix: Escape.e(P4) returns value for Escape.e(T3) -- only affects SurfaceTool bug fix: (JSmol only) Java return (int) fValue(x); will return "NaN" instead of "0" for x NaN -- JSmol script 0 + "test" will print "NaN" rather than "0" Modified Paths: -------------- branches/v14_4/Jmol/src/org/jmol/awt/FileDropper.java branches/v14_4/Jmol/src/org/jmol/dialog/Dialog.java branches/v14_4/Jmol/src/org/jmol/script/ScriptManager.java branches/v14_4/Jmol/src/org/jmol/viewer/FileManager.java branches/v14_4/Jmol/src/org/jmol/viewer/JC.java branches/v14_4/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/awt/FileDropper.java trunk/Jmol/src/org/jmol/dialog/Dialog.java trunk/Jmol/src/org/jmol/script/ScriptManager.java trunk/Jmol/src/org/jmol/util/MeshCapper.java trunk/Jmol/src/org/jmol/viewer/FileManager.java trunk/Jmol/src/org/jmol/viewer/JC.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties Modified: branches/v14_4/Jmol/src/org/jmol/awt/FileDropper.java =================================================================== --- branches/v14_4/Jmol/src/org/jmol/awt/FileDropper.java 2015-12-31 08:49:48 UTC (rev 20906) +++ branches/v14_4/Jmol/src/org/jmol/awt/FileDropper.java 2015-12-31 09:06:06 UTC (rev 20907) @@ -25,32 +25,29 @@ import java.awt.Component; import java.awt.Point; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetEvent; import java.awt.dnd.DropTargetListener; -import java.awt.dnd.DropTargetEvent; -import java.awt.dnd.DropTargetDropEvent; -import java.awt.dnd.DropTargetDragEvent; - -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.Transferable; - import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; - import java.io.File; import java.util.List; -import javax.swing.JOptionPane; - import javajs.util.PT; import javajs.util.SB; +import javax.swing.JOptionPane; + import org.jmol.api.JmolStatusListener; import org.jmol.i18n.GT; import org.jmol.util.Logger; -import org.jmol.viewer.JC; +import org.jmol.viewer.FileManager; import org.jmol.viewer.Viewer; /** @@ -102,8 +99,9 @@ return; int flags = 1; // - boolean isScript = JC.isScriptType(fname); - switch (vwr.ms.ac > 0 && !isScript ? JOptionPane.showConfirmDialog(null, GT._("Would you like to replace the current model with the selected model?")) : JOptionPane.OK_OPTION) { + boolean isScript = FileManager.isScriptType(fname); + boolean isSurface = FileManager.isSurfaceType(fname); + switch (vwr.ms.ac > 0 && !isScript && !isSurface ? JOptionPane.showConfirmDialog(null, GT._("Would you like to replace the current model with the selected model?")) : JOptionPane.OK_OPTION) { case JOptionPane.CANCEL_OPTION: return; case JOptionPane.OK_OPTION: Modified: branches/v14_4/Jmol/src/org/jmol/dialog/Dialog.java =================================================================== --- branches/v14_4/Jmol/src/org/jmol/dialog/Dialog.java 2015-12-31 08:49:48 UTC (rev 20906) +++ branches/v14_4/Jmol/src/org/jmol/dialog/Dialog.java 2015-12-31 09:06:06 UTC (rev 20907) @@ -53,7 +53,6 @@ import org.jmol.i18n.GT; import org.jmol.util.Logger; import org.jmol.viewer.FileManager; -import org.jmol.viewer.JC; import org.jmol.viewer.Viewer; public class Dialog extends JPanel implements JmolDialogInterface { @@ -151,7 +150,7 @@ if (fileName.startsWith("/")) fileName = "file://" + fileName; // for Macs boolean doCartoons = (jmolApp == null || allowAppend && openPreview != null && openPreview.isCartoonsSelected()); - boolean doAppend = (allowAppend && !JC.isScriptType(fileName) + boolean doAppend = (allowAppend && !FileManager.isScriptType(fileName) && openPreview != null && openPreview.isAppendSelected()); closePreview(); return (doCartoons ? "" : "#NOCARTOONS#;") + (doAppend ? "#APPEND#;" : "") + fileName; Modified: branches/v14_4/Jmol/src/org/jmol/script/ScriptManager.java =================================================================== --- branches/v14_4/Jmol/src/org/jmol/script/ScriptManager.java 2015-12-31 08:49:48 UTC (rev 20906) +++ branches/v14_4/Jmol/src/org/jmol/script/ScriptManager.java 2015-12-31 09:06:06 UTC (rev 20907) @@ -519,7 +519,8 @@ * From file dropping. * * @param fileName - * @param flags 1=pdbCartoons, 2=no scripting, 4=append + * @param flags + * 1=pdbCartoons, 2=no scripting, 4=append * */ @Override @@ -545,9 +546,7 @@ } if (fileName.endsWith("jvxl")) { cmd = "isosurface "; - return; - } - if (!fileName.toLowerCase().endsWith(".spt")) { + } else if (!fileName.toLowerCase().endsWith(".spt")) { String type = getDragDropFileTypeName(fileName); if (type == null) { type = FileManager.determineSurfaceTypeIs(vwr @@ -557,7 +556,6 @@ + PT.esc(fileName) + " mesh nofill }; else; { isosurface " + PT.esc(fileName) + "}"; - return; } else if (type.equals("Jmol")) { cmd = "script "; } else if (type.equals("Cube")) { @@ -565,8 +563,7 @@ } else if (!type.equals("spt")) { cmd = vwr.g.defaultDropScript; cmd = PT.rep(cmd, "%FILE", fileName); - cmd = PT.rep(cmd, "%ALLOWCARTOONS", "" - + pdbCartoons); + cmd = PT.rep(cmd, "%ALLOWCARTOONS", "" + pdbCartoons); if (cmd.toLowerCase().startsWith("zap") && (isCached || isAppend)) cmd = cmd.substring(3); if (isAppend) { Modified: branches/v14_4/Jmol/src/org/jmol/viewer/FileManager.java =================================================================== --- branches/v14_4/Jmol/src/org/jmol/viewer/FileManager.java 2015-12-31 08:49:48 UTC (rev 20906) +++ branches/v14_4/Jmol/src/org/jmol/viewer/FileManager.java 2015-12-31 09:06:06 UTC (rev 20907) @@ -1326,6 +1326,14 @@ private final static String DELPHI_BINARY_MAGIC_NUMBER = "\24\0\0\0"; + public static boolean isScriptType(String fname) { + return PT.isOneOf(fname.toLowerCase().substring(fname.lastIndexOf(".")+1), ";pse;spt;png;pngj;jmol;zip;"); + } + + public static boolean isSurfaceType(String fname) { + return PT.isOneOf(fname.toLowerCase().substring(fname.lastIndexOf(".")+1), ";jvxl;kin;o;msms;map;pmesh;mrc;efvet;cube;obj;"); + } + public static String determineSurfaceFileType(BufferedReader bufferedReader) { // drag-drop and isosurface command only // JVXL should be on the FIRST line of the file, but it may be @@ -1335,6 +1343,7 @@ String line = null; LimitedLineReader br = null; + try { br = new LimitedLineReader(bufferedReader, 16000); Modified: branches/v14_4/Jmol/src/org/jmol/viewer/JC.java =================================================================== --- branches/v14_4/Jmol/src/org/jmol/viewer/JC.java 2015-12-31 08:49:48 UTC (rev 20906) +++ branches/v14_4/Jmol/src/org/jmol/viewer/JC.java 2015-12-31 09:06:06 UTC (rev 20907) @@ -631,8 +631,19 @@ "@spine protein&_a>=1&_a<4|nucleic&(_a>=6&_a<11|_a=13)", "@sidechain (protein,nucleic) & !backbone", "@base nucleic & !backbone", - "@dynamic_flatring search('[a]')" + "@dynamic_flatring search('[a]')", + //periodic table + "@nonmetal _H,_He,_B,_C,_N,_O,_F,_Ne,_Si,_P,_S,_Cl,_Ar,_As,_Se,_Br,_Kr,_Te,_I,_Xe,_At,_Rn", + "@metal !nonmetal", + "@alkaliMetal _Li,_Na,_K,_Rb,_Cs,_Fr", + "@alkalineEarth _Be,_Mg,_Ca,_Sr,_Ba,_Ra", + "@nobleGas _He,_Ne,_Ar,_Kr,_Xe,_Rn", + "@metalloid _B,_Si,_Ge,_As,_Sb,_Te", + "@transitionMetal elemno>=21&elemno<=30|elemno>=39&elemno<=48|elemno>=72&elemno<=80|elemno>=104&elemno<=112", + "@lanthanide elemno>=57&elemno<=71", + "@actinide elemno>=89&elemno<=103", + // "@hetero", handled specially }; @@ -877,12 +888,6 @@ public final static String IMAGE_TYPES = JPEG_EXTENSIONS + "gif;gift;pdf;ppm;png;pngj;pngt;"; public static final String IMAGE_OR_SCENE = IMAGE_TYPES + "scene;"; - public static boolean isScriptType(String fname) { - return PT.isOneOf(fname.substring(fname.lastIndexOf(".")+1), ";pse;spt;png;pngj;jmol;zip;"); - } - - - static { /** * @j2sNative Modified: branches/v14_4/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- branches/v14_4/Jmol/src/org/jmol/viewer/Jmol.properties 2015-12-31 08:49:48 UTC (rev 20906) +++ branches/v14_4/Jmol/src/org/jmol/viewer/Jmol.properties 2015-12-31 09:06:06 UTC (rev 20907) @@ -7,8 +7,18 @@ # see also http://chemapps.stolaf.edu/jmol/zip for daily updates -Jmol.___JmolVersion="14.4.1_2015.12.23b" +Jmol.___JmolVersion="14.4.1_2015.12.29" +bug fix: file dropping of JVXL files does not work +bug fix: Mesh capper not working for multiple cuts due to unclosed surface cut + -- for example: load maleic.cif 1;select on atomindex=6;lcaocartoon scale 1.0 CAP unitcell "cpk" +bug fix: Escape.e(P4) returns value for Escape.e(T3) + -- only affects SurfaceTool +bug fix: (JSmol only) Java return (int) fValue(x); will return "NaN" instead of "0" for x NaN + -- JSmol script 0 + "test" will print "NaN" rather than "0" + +JmolVersion="14.4.1_2015.12.23b" + bug fix: JavaScript error reporting uses alert() instead of just setting the error message bug fix: PyMOL 1.8 PSE files cannot be read because of missing settings Modified: trunk/Jmol/src/org/jmol/awt/FileDropper.java =================================================================== --- trunk/Jmol/src/org/jmol/awt/FileDropper.java 2015-12-31 08:49:48 UTC (rev 20906) +++ trunk/Jmol/src/org/jmol/awt/FileDropper.java 2015-12-31 09:06:06 UTC (rev 20907) @@ -25,32 +25,29 @@ import java.awt.Component; import java.awt.Point; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetEvent; import java.awt.dnd.DropTargetListener; -import java.awt.dnd.DropTargetEvent; -import java.awt.dnd.DropTargetDropEvent; -import java.awt.dnd.DropTargetDragEvent; - -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.Transferable; - import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; - import java.io.File; import java.util.List; -import javax.swing.JOptionPane; - import javajs.util.PT; import javajs.util.SB; +import javax.swing.JOptionPane; + import org.jmol.api.JmolStatusListener; import org.jmol.i18n.GT; import org.jmol.util.Logger; -import org.jmol.viewer.JC; +import org.jmol.viewer.FileManager; import org.jmol.viewer.Viewer; /** @@ -102,8 +99,9 @@ return; int flags = 1; // - boolean isScript = JC.isScriptType(fname); - switch (vwr.ms.ac > 0 && !isScript ? JOptionPane.showConfirmDialog(null, GT._("Would you like to replace the current model with the selected model?")) : JOptionPane.OK_OPTION) { + boolean isScript = FileManager.isScriptType(fname); + boolean isSurface = FileManager.isSurfaceType(fname); + switch (vwr.ms.ac > 0 && !isScript && !isSurface ? JOptionPane.showConfirmDialog(null, GT._("Would you like to replace the current model with the selected model?")) : JOptionPane.OK_OPTION) { case JOptionPane.CANCEL_OPTION: return; case JOptionPane.OK_OPTION: Modified: trunk/Jmol/src/org/jmol/dialog/Dialog.java =================================================================== --- trunk/Jmol/src/org/jmol/dialog/Dialog.java 2015-12-31 08:49:48 UTC (rev 20906) +++ trunk/Jmol/src/org/jmol/dialog/Dialog.java 2015-12-31 09:06:06 UTC (rev 20907) @@ -53,7 +53,6 @@ import org.jmol.i18n.GT; import org.jmol.util.Logger; import org.jmol.viewer.FileManager; -import org.jmol.viewer.JC; import org.jmol.viewer.Viewer; public class Dialog extends JPanel implements JmolDialogInterface { @@ -151,7 +150,7 @@ if (fileName.startsWith("/")) fileName = "file://" + fileName; // for Macs boolean doCartoons = (jmolApp == null || allowAppend && openPreview != null && openPreview.isCartoonsSelected()); - boolean doAppend = (allowAppend && !JC.isScriptType(fileName) + boolean doAppend = (allowAppend && !FileManager.isScriptType(fileName) && openPreview != null && openPreview.isAppendSelected()); closePreview(); return (doCartoons ? "" : "#NOCARTOONS#;") + (doAppend ? "#APPEND#;" : "") + fileName; Modified: trunk/Jmol/src/org/jmol/script/ScriptManager.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptManager.java 2015-12-31 08:49:48 UTC (rev 20906) +++ trunk/Jmol/src/org/jmol/script/ScriptManager.java 2015-12-31 09:06:06 UTC (rev 20907) @@ -518,7 +518,7 @@ * * From file dropping. * - * @param fileName + * @param fileName * @param flags 1=pdbCartoons, 2=no scripting, 4=append * */ @@ -545,9 +545,7 @@ } if (fileName.endsWith("jvxl")) { cmd = "isosurface "; - return; - } - if (!fileName.toLowerCase().endsWith(".spt")) { + } else if (!fileName.toLowerCase().endsWith(".spt")) { String type = getDragDropFileTypeName(fileName); if (type == null) { type = FileManager.determineSurfaceTypeIs(vwr @@ -565,8 +563,7 @@ } else if (!type.equals("spt")) { cmd = vwr.g.defaultDropScript; cmd = PT.rep(cmd, "%FILE", fileName); - cmd = PT.rep(cmd, "%ALLOWCARTOONS", "" - + pdbCartoons); + cmd = PT.rep(cmd, "%ALLOWCARTOONS", "" + pdbCartoons); if (cmd.toLowerCase().startsWith("zap") && (isCached || isAppend)) cmd = cmd.substring(3); if (isAppend) { Modified: trunk/Jmol/src/org/jmol/util/MeshCapper.java =================================================================== --- trunk/Jmol/src/org/jmol/util/MeshCapper.java 2015-12-31 08:49:48 UTC (rev 20906) +++ trunk/Jmol/src/org/jmol/util/MeshCapper.java 2015-12-31 09:06:06 UTC (rev 20907) @@ -244,6 +244,7 @@ */ void createCap(V3 norm) { + capMap = null; CapVertex[] vs = new CapVertex[vertices.size()]; @@ -269,16 +270,17 @@ M4 m4 = M4.newMV(m3, vertices.get(0)); M4 m4inv = M4.newM4(m4).invert(); vertices.toArray(vs); + vertices = null; + for (int i = vs.length; --i >= 0;) m4inv.rotTrans2(vs[i], vs[i]); - vertices = null; // link by Y,X sort vs = test(vs); Logger.info("MeshCapper using " + vs.length + " vertices"); - + CapVertex v0 = vs[0].sort(vs); if (v0 == null) { Logger.error("two identical points -- aborting"); @@ -296,6 +298,7 @@ } while (v != v0); } catch (Exception e) { System.out.println("MeshCapper exception " + e); + e.printStackTrace(); } if (slicer != null) clear(); @@ -327,6 +330,8 @@ if (v.prev == v.next) return q; + if (v.next == null) + System.out.println("OHO"); boolean isDescending = (v.prev.region != null); boolean isAscending = (v.next.region != null); @@ -777,6 +782,8 @@ */ protected int ok = 1; + boolean disabled; + CapVertex(T3 p, int i) { ipt = i; id = "" + i; @@ -799,12 +806,39 @@ * @return null if there are two identical points (edge crossings) */ public CapVertex sort(CapVertex[] vs) { - Arrays.sort(vs, this); - if (ok == 0) - return null; - for (int i = vs.length - 1; --i >= 0;) - vs[i].qnext = vs[i + 1]; - vs[vs.length - 1].qnext = vs[0]; + CapVertex v0 = null; + CapVertex v1 = null; + int n = vs.length; + for (int i = n; --i >= 0;) { + if (vs[i].next == null) { + if (v0 == null) { + v1 = vs[i]; + } else { + vs[i].link(v0); + v0 = null; + } + } else if (vs[i].prev == null) { + if (v1 == null) { + v0 = vs[i]; + } else { + v1.link(vs[i]); + v1 = null; + } + } + } + + ok = 0; + while (ok == 0) { + ok = 1; + Arrays.sort(vs, this); + System.out.println(ok); + } + for (int i = n; --i >= 0;) { + if (vs[i].x == Float.MAX_VALUE) + n = i; + vs[i].qnext = vs[(i + 1) % n]; + } + vs[n - 1].qnext = vs[0]; return vs[0]; } @@ -812,9 +846,21 @@ public int compare(CapVertex v1, CapVertex v2) { // first HIGHEST Y to LOWEST Y, then LOWEST X to HIGHEST X return (v1.y < v2.y ? 1 : v1.y > v2.y || v1.x < v2.x ? -1 - : v1.x > v2.x ? 1 : (ok = 0)); + : v1.x > v2.x ? 1 + : disable(v1, v2)); } + private int disable(CapVertex v1, CapVertex v2) { + if (v2.x == Float.MAX_VALUE) + return 0; // both are disabled + CapVertex v = (v1.x == Float.MAX_VALUE ? v1 : v2); + v.x = Float.MAX_VALUE; + v.y = -Float.MAX_VALUE; + v.link(null); + ok = 0; + return (v1.x > v2.x ? 1 : -1); + } + /** * Get interpolated x for the scan line intersection with an edge. This * method is used both in finding the last point for a split and for @@ -889,8 +935,8 @@ + " " + z + "} # " - + (prev == null ? "" : prev.id) - + (next == null ? "" : " " + next.id) + + (prev == null ? "null" : prev.id) + + (next == null ? " null" : " " + next.id) + (region == null ? "" : dumpRegion()); } Modified: trunk/Jmol/src/org/jmol/viewer/FileManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/FileManager.java 2015-12-31 08:49:48 UTC (rev 20906) +++ trunk/Jmol/src/org/jmol/viewer/FileManager.java 2015-12-31 09:06:06 UTC (rev 20907) @@ -1326,6 +1326,14 @@ private final static String DELPHI_BINARY_MAGIC_NUMBER = "\24\0\0\0"; + public static boolean isScriptType(String fname) { + return PT.isOneOf(fname.toLowerCase().substring(fname.lastIndexOf(".")+1), ";pse;spt;png;pngj;jmol;zip;"); + } + + public static boolean isSurfaceType(String fname) { + return PT.isOneOf(fname.toLowerCase().substring(fname.lastIndexOf(".")+1), ";jvxl;kin;o;msms;map;pmesh;mrc;efvet;cube;obj;"); + } + public static String determineSurfaceFileType(BufferedReader bufferedReader) { // drag-drop and isosurface command only // JVXL should be on the FIRST line of the file, but it may be @@ -1335,6 +1343,7 @@ String line = null; LimitedLineReader br = null; + try { br = new LimitedLineReader(bufferedReader, 16000); Modified: trunk/Jmol/src/org/jmol/viewer/JC.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/JC.java 2015-12-31 08:49:48 UTC (rev 20906) +++ trunk/Jmol/src/org/jmol/viewer/JC.java 2015-12-31 09:06:06 UTC (rev 20907) @@ -887,12 +887,6 @@ public final static String IMAGE_TYPES = JPEG_EXTENSIONS + "gif;gift;pdf;ppm;png;pngj;pngt;"; public static final String IMAGE_OR_SCENE = IMAGE_TYPES + "scene;"; - public static boolean isScriptType(String fname) { - return PT.isOneOf(fname.substring(fname.lastIndexOf(".")+1), ";pse;spt;png;pngj;jmol;zip;"); - } - - - static { /** * @j2sNative Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2015-12-31 08:49:48 UTC (rev 20906) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2015-12-31 09:06:06 UTC (rev 20907) @@ -62,13 +62,17 @@ TODO: consider if models with no atoms will cause issues in relation to model.firstAtomIndex -Jmol.___JmolVersion="14.5.1_2015.12.23b" -bug fix: JavaScript error reporting uses alert() instead of just setting the error message +Jmol.___JmolVersion="14.5.1_2015.12.29" -code: more efficient loading of PyMOL .pse session files +bug fix: file dropping of JVXL files does not work +bug fix: Mesh capper not working for multiple cuts due to unclosed surface cut + -- for example: load maleic.cif 1;select on atomindex=6;lcaocartoon scale 1.0 CAP unitcell "cpk" +bug fix: Escape.e(P4) returns value for Escape.e(T3) -- only affects SurfaceTool +bug fix: (JSmol only) Java return (int) fValue(x); will return "NaN" instead of "0" for x NaN + -- JSmol script 0 + "test" will print "NaN" rather than "0" -Jmol.___JmolVersion="14.5.1_2015.12.23b" +JmolVersion="14.5.1_2015.12.23b" bug fix: JavaScript error reporting uses alert() instead of just setting the error message bug fix: PyMOL 1.8 PSE files cannot be read because of missing settings This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits