Revision: 18449 http://sourceforge.net/p/jmol/code/18449 Author: hansonr Date: 2013-07-16 23:07:15 +0000 (Tue, 16 Jul 2013) Log Message: ----------- ___JmolVersion="13.1.19_dev_2013.07.16"
new feature: set exportScale x.x -- adjusts export scale -- only implemented for VRML and X3D exporters bug fix: magres measurement of dipole coupling constants do not reach just min-distance set bug fix: "cs" for Cs symmetry broken in chemicalshift Modified Paths: -------------- trunk/Jmol/src/org/jmol/bspt/Node.java trunk/Jmol/src/org/jmol/export/_VrmlExporter.java trunk/Jmol/src/org/jmol/export/_X3dExporter.java trunk/Jmol/src/org/jmol/export/__CartesianExporter.java trunk/Jmol/src/org/jmol/export/___Exporter.java trunk/Jmol/src/org/jmol/script/T.java trunk/Jmol/src/org/jmol/shape/Measures.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/StateManager.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/bspt/Node.java =================================================================== --- trunk/Jmol/src/org/jmol/bspt/Node.java 2013-07-15 21:03:15 UTC (rev 18448) +++ trunk/Jmol/src/org/jmol/bspt/Node.java 2013-07-16 23:07:15 UTC (rev 18449) @@ -23,7 +23,7 @@ package org.jmol.bspt; -import org.jmol.util.Logger; +//import org.jmol.util.Logger; import org.jmol.util.P3; import org.jmol.util.SB; @@ -55,8 +55,10 @@ this.bspt = bspt; if (level == bspt.treeDepth) { bspt.treeDepth = level + 1; - if (bspt.treeDepth >= Bspt.MAX_TREE_DEPTH) - Logger.error("BSPT tree depth too great:" + bspt.treeDepth); + // no longer necessary -- in a long unfolded protein, + // we can go over 100 here + //if (bspt.treeDepth >= Bspt.MAX_TREE_DEPTH) + //Logger.error("BSPT tree depth too great:" + bspt.treeDepth); } if (leafLeft.count != Bspt.leafCountMax) throw new NullPointerException(); Modified: trunk/Jmol/src/org/jmol/export/_VrmlExporter.java =================================================================== --- trunk/Jmol/src/org/jmol/export/_VrmlExporter.java 2013-07-15 21:03:15 UTC (rev 18448) +++ trunk/Jmol/src/org/jmol/export/_VrmlExporter.java 2013-07-16 23:07:15 UTC (rev 18449) @@ -59,7 +59,7 @@ @Override protected void output(Tuple3f pt) { - output(round(pt)); + output(round(scalePt(pt))); } protected UseTable useTable; @@ -69,7 +69,7 @@ output("#VRML V2.0 utf8 Generated by Jmol " + Viewer.getJmolVersion() + "\n"); output("WorldInfo { \n"); - output(" title " + Escape.eS(viewer.getModelSetName()) + "\n"); + output(" title " + Escape.eS(viewer.getModelSetName()) + "\n"); output(" info [ \"Generated by Jmol " + Viewer.getJmolVersion() + " \", \n"); output(" \"http://www.jmol.org \", \n"); output(" \"Creation date: " + getExportDate() + " \" ]\n"); @@ -77,14 +77,16 @@ output("NavigationInfo { type \"EXAMINE\" } \n"); // puts the viewer into model-rotation mode - output("Background { skyColor [" - + rgbFractionalFromColix(backgroundColix) + "] } \n"); + output("Background { skyColor [" + rgbFractionalFromColix(backgroundColix) + + "] } \n"); // next is an approximation only - float angle = (float) (aperatureAngle * Math.PI / 180); - viewer.getAxisAngle(viewpoint); - output("Viewpoint{fieldOfView " + angle - + " position " + cameraPosition.x + " " + cameraPosition.y + " " + cameraPosition.z - + " orientation " + viewpoint.x + " " + viewpoint.y + " " + (viewpoint.angle == 0 ? 1 : viewpoint.z) + " " + -viewpoint.angle); + float angle = getViewpoint(); + output("Viewpoint{fieldOfView " + angle); + output(" position "); + output(cameraPosition); + output(" orientation "); + output(tempP1); + output(" " + -viewpoint.angle); output("\n jump TRUE description \"v1\"\n}\n\n"); output(getJmolPerspective()); output("\nTransform{children Transform{translation "); @@ -94,6 +96,13 @@ output("\nchildren [\n"); } + protected float getViewpoint() { + viewer.getAxisAngle(viewpoint); + tempP1.set(viewpoint.x, viewpoint.y, (viewpoint.angle == 0 ? 1 + : viewpoint.z)); + return (float) (aperatureAngle * Math.PI / 180); + } + @Override protected void outputFooter() { useTable = null; @@ -129,8 +138,8 @@ tempV1.scale(0.5f); output(tempV1); output(" children Billboard{axisOfRotation 0 0 0 children Transform{rotation 1 0 0 1.5708"); - outputCylinderChild(pt1, pt2, colix, GData.ENDCAPS_FLAT, - (int) (radius * 2000)); + outputCylinderChildScaled(pt1, pt2, colix, GData.ENDCAPS_FLAT, + radius * 2000); output("}}}\n"); return; } @@ -172,8 +181,9 @@ @Override protected void outputCone(P3 ptBase, P3 ptTip, float radius, short colix) { - float height = tempP1.distance(tempP2); - outputTransRot(tempP1, tempP2, 0, 1, 0); + radius = scale(radius); + float height = scale(ptBase.distance(ptTip)); + outputTransRot(ptBase, ptTip, 0, 1, 0); output(" children "); String cone = "o" + (int) (height * 100) + "_" + (int) (radius * 100); String child = useTable.getDef("c" + cone + "_" + colix); @@ -207,7 +217,7 @@ pt1.set(0, 0, -1); pt2.set(0, 0, 1); } - outputCylinderChild(pt1, pt2, colix, endcaps, radius); + outputCylinderChildScaled(pt1, pt2, colix, endcaps, radius); output("}\n"); if (endcaps == GData.ENDCAPS_SPHERICAL) { outputSphere(pt1, radius * 1.01f, colix, checkRadius); @@ -216,10 +226,11 @@ return true; } - private void outputCylinderChild(P3 pt1, P3 pt2, short colix, + private void outputCylinderChildScaled(P3 pt1, P3 pt2, short colix, byte endcaps, float radius) { output(" children "); - float length = pt1.distance(pt2); + float length = scale(pt1.distance(pt2)); + radius = scale(radius); String child = useTable.getDef("C" + colix + "_" + (int) (length * 100) + "_" + radius + "_" + endcaps); if (child.charAt(0) == '_') { @@ -253,7 +264,7 @@ outputQuaternionFrame(ptCenter, points[1], points[3], points[5], 1, " ", ""); output(" children "); tempP3.set(0, 0, 0); - outputSphereChild(tempP3, 1.0f, colix); + outputSphereChildUnscaled(tempP3, 1.0f, colix); output("}\n"); } @@ -278,9 +289,9 @@ output(a.x + " " + a.y + " " + a.z + " " + a.angle); output(post); } - float sx = ptX.distance(ptCenter); - float sy = ptY.distance(ptCenter) * yScale; - float sz = ptZ.distance(ptCenter); + float sx = scale(ptX.distance(ptCenter)); + float sy = scale(ptY.distance(ptCenter) * yScale); + float sz = scale(ptZ.distance(ptCenter)); output(" scale"); output(pre); output(sx + " " + sy + " " + sz); @@ -393,14 +404,15 @@ @Override protected void outputSphere(P3 ptCenter, float radius, short colix, boolean checkRadius) { - String check = round(ptCenter) + (checkRadius ? " " + (int) (radius * 100) : ""); + radius = scale(radius); + String check = round(scalePt(ptCenter)) + (checkRadius ? " " + (int) (radius * 100) : ""); if (htSpheresRendered.get(check) != null) return; htSpheresRendered.put(check, Boolean.TRUE); - outputSphereChild(ptCenter, radius, colix); + outputSphereChildUnscaled(ptCenter, radius, colix); } - protected void outputSphereChild(P3 ptCenter, float radius, short colix) { + protected void outputSphereChildUnscaled(P3 ptCenter, float radius, short colix) { int iRad = (int) (radius * 100); String child = useTable.getDef("S" + colix + "_" + iRad); output("Transform{translation "); @@ -452,11 +464,11 @@ tempV1.normalize(); tempV2.set(x, y, z); tempV2.add(tempV1); - tempA.set4(tempV2.x, tempV2.y, tempV2.z, 3.14159f); output(" rotation"); output(pre); - output(round(tempA.x) + " " + round(tempA.y) + " " + round(tempA.z) + " " - + round(tempA.angle)); + output(tempV2); + output(" "); + output(round((float) Math.PI)); output(post); } Modified: trunk/Jmol/src/org/jmol/export/_X3dExporter.java =================================================================== --- trunk/Jmol/src/org/jmol/export/_X3dExporter.java 2013-07-15 21:03:15 UTC (rev 18448) +++ trunk/Jmol/src/org/jmol/export/_X3dExporter.java 2013-07-16 23:07:15 UTC (rev 18449) @@ -55,31 +55,34 @@ output("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"); output("<!DOCTYPE X3D PUBLIC \"ISO//Web3D//DTD X3D 3.1//EN\" \"http://www.web3d.org/specifications/x3d-3.1.dtd\">\n"); output("<X3D profile='Immersive' version='3.1' " - + "xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' " - + "xsd:noNamespaceSchemaLocation=' http://www.web3d.org/specifications/x3d-3.1.xsd '>" - + "\n"); + + "xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' " + + "xsd:noNamespaceSchemaLocation=' http://www.web3d.org/specifications/x3d-3.1.xsd '>" + + "\n"); output("<head>\n"); - output("<meta name='title' content=" + Escape.eS(viewer.getModelSetName()).replace('<',' ').replace('>',' ').replace('&',' ') + "/>\n"); + output("<meta name='title' content=" + + Escape.eS(viewer.getModelSetName()).replace('<', ' ').replace('>', + ' ').replace('&', ' ') + "/>\n"); output("<meta name='description' content='Jmol rendering'/>\n"); output("<meta name='creator' content=' '/>\n"); output("<meta name='created' content='" + getExportDate() + "'/>\n"); - output("<meta name='generator' content='Jmol "+ Viewer.getJmolVersion() +", http://www.jmol.org'/>\n"); - output("<meta name='license' content='http://www.gnu.org/licenses/licenses.html#LGPL'/>\n"); + output("<meta name='generator' content='Jmol " + Viewer.getJmolVersion() + + ", http://www.jmol.org'/>\n"); + output("<meta name='license' content='http://www.gnu.org/licenses/licenses.html#LGPL'/>\n"); output("</head>\n"); output("<Scene>\n"); output("<NavigationInfo type='EXAMINE'/>\n"); // puts the viewer into model-rotation mode - output("<Background skyColor='" - + rgbFractionalFromColix(backgroundColix) + "'/>\n"); - // next is an approximation only - float angle = (float) (aperatureAngle * Math.PI / 180); - viewer.getAxisAngle(viewpoint); - output("<Viewpoint fieldOfView='" + angle - + "' position='" + round(cameraPosition) - + "' orientation='" + viewpoint.x + " " + viewpoint.y + " " - + (viewpoint.angle == 0 ? 1 : viewpoint.z) + " " + -viewpoint.angle - + "'\n jump='true' description='v1'/>\n"); + output("<Background skyColor='" + rgbFractionalFromColix(backgroundColix) + + "'/>\n"); + // next is an approximation only + float angle = getViewpoint(); + output("<Viewpoint fieldOfView='" + angle); + output("' position='"); + output(cameraPosition); + output("' orientation='"); + output(tempP1); + output(" " + -viewpoint.angle + "'\n jump='true' description='v1'/>\n"); output("\n <!-- "); output(getJmolPerspective()); output("\n -->\n\n"); @@ -135,7 +138,7 @@ tempV1.scale(0.5f); output(tempV1); output("'><Billboard axisOfRotation='0 0 0'><Transform rotation='1 0 0 1.5708'>"); - outputCylinderChild(pt1, tempP3, colix, GData.ENDCAPS_FLAT, radius); + outputCylinderChildScaled(pt1, tempP3, colix, GData.ENDCAPS_FLAT, radius); output("</Transform></Billboard>"); output("</Transform>\n"); @@ -181,7 +184,8 @@ @Override protected void outputCone(P3 ptBase, P3 ptTip, float radius, short colix) { - float height = ptBase.distance(ptTip); + radius = scale(radius); + float height = scale(ptBase.distance(ptTip)); output("<Transform"); outputTransRot(ptBase, ptTip, 0, 1, 0); output(">\n<Shape "); @@ -220,7 +224,7 @@ pt2.set(0, 0, 1); } output(">\n"); - outputCylinderChild(pt1, pt2, colix, endcaps, radius); + outputCylinderChildScaled(pt1, pt2, colix, endcaps, radius); output("\n</Transform>\n"); if (endcaps == GData.ENDCAPS_SPHERICAL) { outputSphere(pt1, radius * 1.01f, colix, true); @@ -229,9 +233,10 @@ return true; } - private void outputCylinderChild(P3 pt1, P3 pt2, short colix, + private void outputCylinderChildScaled(P3 pt1, P3 pt2, short colix, byte endcaps, float radius) { - float length = pt1.distance(pt2); + float length = scale(pt1.distance(pt2)); + radius = scale(radius); String child = useTable.getDef("C" + colix + "_" + (int) (length * 100) + "_" + radius + "_" + endcaps); output("<Shape "); @@ -267,12 +272,12 @@ outputQuaternionFrame(center, points[1], points[3], points[5], 1, "='", "'"); output(">"); tempP3.set(0, 0, 0); - outputSphereChild(tempP3, 1.0f, colix); + outputSphereChildUnscaled(tempP3, 1.0f, colix); output("</Transform>\n"); } @Override - protected void outputSphereChild(P3 center, float radius, short colix) { + protected void outputSphereChildUnscaled(P3 center, float radius, short colix) { output("<Transform translation='"); output(center); output("'>\n<Shape "); Modified: trunk/Jmol/src/org/jmol/export/__CartesianExporter.java =================================================================== --- trunk/Jmol/src/org/jmol/export/__CartesianExporter.java 2013-07-15 21:03:15 UTC (rev 18448) +++ trunk/Jmol/src/org/jmol/export/__CartesianExporter.java 2013-07-16 23:07:15 UTC (rev 18449) @@ -110,6 +110,31 @@ } } + /** + * used only for VRML and X3D; could be expanded + * + * @param f + * @return f*exportScale + */ + protected float scale(float f) { + return f * exportScale; + } + + protected P3 ptScaled = new P3(); + /** + * used only for VRML and X3D; could be expanded + * + * @param pt + * @return pt or pt scaled by exportScale + */ + protected Tuple3f scalePt(Tuple3f pt) { + if (exportScale == 1) + return pt; + ptScaled.setT(pt); + ptScaled.scale(exportScale); + return ptScaled; + } + protected int getCoordinateMap(Tuple3f[] vertices, int[] coordMap, BS bsValid) { int n = 0; for (int i = 0; i < coordMap.length; i++) { @@ -332,7 +357,7 @@ protected Matrix4f sphereMatrix = new Matrix4f(); - protected void setSphereMatrix(P3 center, float rx, float ry, float rz, + protected void setSphereMatrix(Tuple3f center, float rx, float ry, float rz, AxisAngle4f a, Matrix4f sphereMatrix) { if (a != null) { Matrix3f mq = new Matrix3f(); Modified: trunk/Jmol/src/org/jmol/export/___Exporter.java =================================================================== --- trunk/Jmol/src/org/jmol/export/___Exporter.java 2013-07-15 21:03:15 UTC (rev 18448) +++ trunk/Jmol/src/org/jmol/export/___Exporter.java 2013-07-16 23:07:15 UTC (rev 18449) @@ -46,7 +46,6 @@ import org.jmol.modelset.Atom; import org.jmol.script.T; import org.jmol.util.ArrayUtil; -import org.jmol.util.AxisAngle4f; import org.jmol.util.BS; import org.jmol.util.C; import org.jmol.util.JmolFont; @@ -171,6 +170,7 @@ protected float cameraDistance; protected float aperatureAngle; protected float scalePixelsPerAngstrom; + protected float exportScale = 1; // currently VRML and X3D only @@ -197,7 +197,6 @@ final protected V3 tempV1 = new V3(); final protected V3 tempV2 = new V3(); final protected V3 tempV3 = new V3(); - final protected AxisAngle4f tempA = new AxisAngle4f(); public ___Exporter() { } @@ -217,6 +216,8 @@ this.privateKey = privateKey; backgroundColix = viewer.getObjectColix(StateManager.OBJ_BACKGROUND); center.setT(viewer.getRotationCenter()); + exportScale = viewer.getFloat(T.exportscale); + if ((screenWidth <= 0) || (screenHeight <= 0)) { screenWidth = viewer.getScreenWidth(); screenHeight = viewer.getScreenHeight(); @@ -256,7 +257,7 @@ } abstract protected void outputHeader(); - + protected int nBytes; protected void output(String data) { nBytes += data.length(); Modified: trunk/Jmol/src/org/jmol/script/T.java =================================================================== --- trunk/Jmol/src/org/jmol/script/T.java 2013-07-15 21:03:15 UTC (rev 18448) +++ trunk/Jmol/src/org/jmol/script/T.java 2013-07-16 23:07:15 UTC (rev 18449) @@ -843,7 +843,8 @@ public final static int defaultdrawarrowscale = floatparam | 8; public final static int defaulttranslucent = floatparam | 10; public final static int dipolescale = floatparam | 12; - public final static int ellipsoidaxisdiameter = floatparam | 14; + public final static int ellipsoidaxisdiameter = floatparam | 13; + public final static int exportscale = floatparam | 14; public final static int gestureswipefactor = floatparam | 15; public final static int hbondsangleminimum = floatparam | 16; public final static int hbondsdistancemaximum = floatparam | 17; @@ -1132,9 +1133,9 @@ final static int drawing = misc | 105; final static int eccentricity = misc | 106; final static int ed = misc | 108 | expression; - final static int edges = misc | 110; - final static int energy = misc | 111; - final static int error = misc | 112; + final static int edges = misc | 109; + final static int energy = misc | 110; + final static int error = misc | 111; final static int facecenteroffset = misc | 113; public final static int fill = misc | 114; final static int filter = misc | 116; @@ -1826,6 +1827,7 @@ "elemno", T.t(elemno), "_e", T.t(elemisono), "error", T.t(error), + "exportScale", T.t(exportscale), "fill", T.t(fill), "find", T.t(find), "fixedTemperature",T.t(fixedtemp), Modified: trunk/Jmol/src/org/jmol/shape/Measures.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/Measures.java 2013-07-15 21:03:15 UTC (rev 18448) +++ trunk/Jmol/src/org/jmol/shape/Measures.java 2013-07-16 23:07:15 UTC (rev 18449) @@ -183,10 +183,14 @@ defaultTickInfo = md.tickInfo; return; } - if (md.isAll && md.points.size() == 2 && md.points.get(0) instanceof BS - && Measurement.nmrType(viewer.getDistanceUnits(md.strFormat)) - == Measurement.NMR_JC) + if (md.isAll && md.points.size() == 2 && md.points.get(0) instanceof BS) { + int type = Measurement.nmrType(viewer.getDistanceUnits(md.strFormat)); + switch (type) { + case Measurement.NMR_JC: + case Measurement.NMR_DC: md.htMin = viewer.getNMRCalculation().getMinDistances(md); + } + } tickInfo = md.tickInfo; radiusData = md.radiusData; htMin = md.htMin; Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2013-07-15 21:03:15 UTC (rev 18448) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2013-07-16 23:07:15 UTC (rev 18449) @@ -9,8 +9,13 @@ # The quotes above look odd for a parameter file, but they are # important for the JavaScript version of Jmol. -___JmolVersion="13.1.19_dev_2013.07.15b" +___JmolVersion="13.1.19_dev_2013.07.16" +new feature: set exportScale x.x + -- adjusts export scale + -- only implemented for VRML and X3D exporters + +bug fix: magres measurement of dipole coupling constants do not reach just min-distance set bug fix: "cs" for Cs symmetry broken in chemicalshift bug fix: cartoons with too small nonzero size will not render anything Modified: trunk/Jmol/src/org/jmol/viewer/StateManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/StateManager.java 2013-07-15 21:03:15 UTC (rev 18448) +++ trunk/Jmol/src/org/jmol/viewer/StateManager.java 2013-07-16 23:07:15 UTC (rev 18449) @@ -557,7 +557,8 @@ + ";antialiasdisplay;antialiasimages;antialiastranslucent;appendnew;axescolor" + ";axesposition;axesmolecular;axesorientationrasmol;axesunitcell;axeswindow;axis1color;axis2color" + ";axis3color;backgroundcolor;backgroundmodel;bondsymmetryatoms;boundboxcolor;cameradepth" - + ";debug;debugscript;defaultlatttice;defaults;defaultdropscript;diffusepercent;exportdrivers" + + ";debug;debugscript;defaultlatttice;defaults;defaultdropscript;diffusepercent;" + + ";exportdrivers;exportscale" + ";_filecaching;_filecache;fontcaching;fontscaling;forcefield;language" + ";legacyautobonding;legacyhaddition" + ";loglevel;logfile;loggestures;logcommands;measurestylechime" @@ -863,6 +864,7 @@ setS("energyUnits", energyUnits); // setParameterValue("_fileCaching", _fileCaching); // setParameterValue("_fileCache", _fileCache); + setF("exportScale", exportScale); setB("fontScaling", fontScaling); setB("fontCaching", fontCaching); setB("forceAutoBond", forceAutoBond); @@ -1171,13 +1173,14 @@ String defaultLabelPDB = "%m%r"; float defaultTranslucent = 0.5f; int delayMaximumMs = 0; - float dipoleScale = 1.0f; + float dipoleScale = 1f; boolean disablePopupMenu = false; boolean dragSelected = false; boolean drawHover = false; boolean drawPicking = false; boolean dsspCalcHydrogen = true; String energyUnits = "kJ"; + float exportScale = 1f; String helpPath = JC.DEFAULT_HELP_PATH; boolean fontScaling = false; boolean fontCaching = true; Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2013-07-15 21:03:15 UTC (rev 18448) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2013-07-16 23:07:15 UTC (rev 18449) @@ -5827,6 +5827,8 @@ return global.defaultDrawArrowScale; case T.dipolescale: return global.dipoleScale; + case T.exportscale: + return global.exportScale; case T.hbondsangleminimum: return global.hbondsAngleMinimum; case T.hbondsdistancemaximum: @@ -6101,6 +6103,10 @@ private void setFloatPropertyTok(String key, int tok, float value) { switch (tok) { + case T.exportscale: + // 13.1.19 + global.exportScale = value; + break; case T.starscale: // 13.1.15 global.starScale = value; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits