Revision: 18403 http://sourceforge.net/p/jmol/code/18403 Author: hansonr Date: 2013-07-02 10:11:41 +0000 (Tue, 02 Jul 2013) Log Message: ----------- ___JmolVersion="13.1.19_dev_2013.07.02"
new feature: ellipsoid OPTIONS "xxxx" -- "xxxx" is a quoted string of options separated by semicolon: "arcs;arrows;axes;ball;dots;fill;wireframe" with optional "no" in front of each Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/xml/XmlVaspReader.java trunk/Jmol/src/org/jmol/renderspecial/EllipsoidsRenderer.java trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java trunk/Jmol/src/org/jmol/script/T.java trunk/Jmol/src/org/jmol/shapespecial/Ellipsoid.java trunk/Jmol/src/org/jmol/shapespecial/Ellipsoids.java trunk/Jmol/src/org/jmol/util/Parser.java trunk/Jmol/src/org/jmol/viewer/JC.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/StateCreator.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/xml/XmlVaspReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/xml/XmlVaspReader.java 2013-07-02 07:17:11 UTC (rev 18402) +++ trunk/Jmol/src/org/jmol/adapter/readers/xml/XmlVaspReader.java 2013-07-02 10:11:41 UTC (rev 18403) @@ -125,7 +125,7 @@ if ("varray".equals(localName)) { name = atts.get("name"); - if (name != null && Parser.isOneOf(name, "basis;positions;forces")) + if (name != null && Parser.isOneOf(name, ";basis;positions;forces;")) data = new SB(); return; } Modified: trunk/Jmol/src/org/jmol/renderspecial/EllipsoidsRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/renderspecial/EllipsoidsRenderer.java 2013-07-02 07:17:11 UTC (rev 18402) +++ trunk/Jmol/src/org/jmol/renderspecial/EllipsoidsRenderer.java 2013-07-02 10:11:41 UTC (rev 18403) @@ -36,6 +36,7 @@ import org.jmol.util.Normix; import org.jmol.util.P3; import org.jmol.util.P3i; +import org.jmol.util.Parser; import org.jmol.util.V3; import org.jmol.modelset.Atom; import org.jmol.render.ShapeRenderer; @@ -48,10 +49,20 @@ private Ellipsoids ellipsoids; - private boolean drawDots, drawArcs, drawAxes, drawFill, drawBall, drawArrows; + private boolean[] bGlobals = new boolean[7]; + private boolean[] bOptions = new boolean[7]; + private final String[] OPTS = new String[] { "dots", "arcs", "axes", "fill", "ball", "arrows", "wireframe" }; + private final static int OPT_DOTS = 0; + private final static int OPT_ARCS = 1; + private final static int OPT_AXES = 2; + private final static int OPT_FILL = 3; + private final static int OPT_BALL = 4; + private final static int OPT_ARROWS = 5; + private final static int OPT_WIREFRAME = 6; + private static final int OPT_COUNT = 7; + private boolean fillArc; private boolean isSet; - private boolean wireframeOnly; private int diameter, diameter0; private int dotCount, dotScale; @@ -89,6 +100,7 @@ private final static float toRadians = (float) Math.PI/180f; private final static float[] cossin = new float[36]; + static { for (int i = 5, pt = 0; i <= 90; i += 5) { cossin[pt++] = (float) Math.cos(i * toRadians); @@ -115,16 +127,40 @@ } private boolean setGlobals() { - wireframeOnly = (viewer.getBoolean(T.wireframerotation) && viewer.getInMotion(true)); - drawAxes = viewer.getBooleanProperty("ellipsoidAxes"); - drawArcs = viewer.getBooleanProperty("ellipsoidArcs"); - drawArrows = viewer.getBooleanProperty("ellipsoidArrows"); - drawBall = viewer.getBooleanProperty("ellipsoidBall") && !wireframeOnly; - drawDots = viewer.getBooleanProperty("ellipsoidDots") && !wireframeOnly; - drawFill = viewer.getBooleanProperty("ellipsoidFill") && !wireframeOnly; - fillArc = drawFill && !drawBall; + bGlobals[OPT_ARCS] = viewer.getBooleanProperty("ellipsoidArcs"); + bGlobals[OPT_ARROWS] = viewer.getBooleanProperty("ellipsoidArrows"); + bGlobals[OPT_AXES] = viewer.getBooleanProperty("ellipsoidAxes"); + bGlobals[OPT_BALL] = viewer.getBooleanProperty("ellipsoidBall"); + bGlobals[OPT_DOTS] = viewer.getBooleanProperty("ellipsoidDots"); + bGlobals[OPT_FILL] = viewer.getBooleanProperty("ellipsoidFill"); + bGlobals[OPT_WIREFRAME] = (viewer.getBoolean(T.wireframerotation) && viewer.getInMotion(true)); diameter0 = Math.round (((Float) viewer.getParameter("ellipsoidAxisDiameter")) - .floatValue() * 1000); + .floatValue() * 1000); + Matrix4f m4 = viewer.getMatrixtransform(); + mat.setRow(0, m4.m00, m4.m01, m4.m02); + mat.setRow(1, m4.m10, m4.m11, m4.m12); + mat.setRow(2, m4.m20, m4.m21, m4.m22); + matScreenToCartesian.invertM(mat); + setLogic(); + return true; + } + + private void setOptions(String options) { + for (int i = 0; i < OPT_COUNT; i++) + bOptions[i] = bGlobals[i]; + if (options != null) { + options = ";" + options + ";"; + for (int i = 0; i < OPT_COUNT; i++) { + if (Parser.isOneOf(OPTS[i], options)) + bOptions[i] = true; + else if (Parser.isOneOf("no" + OPTS[i], options)) + bOptions[i] = false; + } + } + setLogic(); + } + + private void setLogic() { //perspectiveOn = viewer.getPerspectiveDepth(); /* general logic: * @@ -137,31 +173,28 @@ * filling for ARCS */ - if (drawBall) - drawDots = false; - if (!drawDots && !drawArcs && !drawBall) - drawAxes = true; - if (drawDots) { - drawArcs = false; - drawFill = false; + bOptions[OPT_DOTS] &= !bOptions[OPT_WIREFRAME]; + bOptions[OPT_BALL] &= !bOptions[OPT_WIREFRAME]; + bOptions[OPT_FILL] &= !bOptions[OPT_WIREFRAME]; + fillArc = bOptions[OPT_FILL] && !bOptions[OPT_BALL]; + + if (bOptions[OPT_BALL]) + bOptions[OPT_DOTS] = false; + if (!bOptions[OPT_DOTS] && !bOptions[OPT_ARCS] && !bOptions[OPT_BALL]) + bOptions[OPT_AXES] = true; + if (bOptions[OPT_DOTS]) { + bOptions[OPT_ARCS] = false; + bOptions[OPT_FILL] = false; dotScale = viewer.getInt(T.dotscale); } - if (drawDots) { + if (bOptions[OPT_DOTS]) { dotCount = ((Integer) viewer.getParameter("ellipsoidDotCount")) .intValue(); if (coords == null || coords.length != dotCount * 3) coords = new int[dotCount * 3]; } - - Matrix4f m4 = viewer.getMatrixtransform(); - mat.setRow(0, m4.m00, m4.m01, m4.m02); - mat.setRow(1, m4.m10, m4.m11, m4.m12); - mat.setRow(2, m4.m20, m4.m21, m4.m22); - matScreenToCartesian.invertM(mat); - return true; } - private boolean renderEllipsoids(Map<?, Ellipsoid> ht, boolean isSimple) { boolean needTranslucent = false; Iterator<Ellipsoid> e = ht.values().iterator(); @@ -205,31 +238,32 @@ if (g3d.isClippedXY(dx + dx, s0.x, s0.y)) return; eigenSignMask = e.tensor.eigenSignMask; - diameter = (int) viewer.scaleToScreen(s0.z, wireframeOnly ? 1 : diameter0); + setOptions(e.options); + diameter = (int) viewer.scaleToScreen(s0.z, bOptions[OPT_WIREFRAME] ? 1 : diameter0); if (e.tensor.isIsotropic) { renderBall(); return; } - if (drawBall) { + if (bOptions[OPT_BALL]) { renderBall(); - if (drawArcs || drawAxes) { + if (bOptions[OPT_ARCS] || bOptions[OPT_AXES]) { g3d.setColix(viewer.getColixBackgroundContrast()); //setAxes(atom, 1.0f); - if (drawAxes) + if (bOptions[OPT_AXES]) renderAxes(); - if (drawArcs) + if (bOptions[OPT_ARCS]) renderArcs(); g3d.setColix(colix); } } else { - if (drawAxes) + if (bOptions[OPT_AXES]) renderAxes(); - if (drawArcs) + if (bOptions[OPT_ARCS]) renderArcs(); } - if (drawDots) + if (bOptions[OPT_DOTS]) renderDots(); - if (drawArrows) + if (bOptions[OPT_ARROWS]) renderArrows(); } @@ -350,7 +384,7 @@ } private void renderAxes() { - if (drawBall && drawFill) { + if (bOptions[OPT_BALL] && bOptions[OPT_FILL]) { g3d.fillCylinder(GData.ENDCAPS_FLAT, diameter, s0, selectedPoints[0]); g3d.fillCylinder(GData.ENDCAPS_FLAT, diameter, s0, @@ -372,7 +406,7 @@ // screens[5]); // g3d.setColix(colix); // } else { - if (drawBall) { + if (bOptions[OPT_BALL]) { g3d.fillCylinder(GData.ENDCAPS_FLAT, diameter, screens[32], screens[33]); g3d.fillCylinder(GData.ENDCAPS_FLAT, diameter, screens[34], @@ -412,9 +446,9 @@ } private void renderArcs() { - if (g3d.drawEllipse(center, points[0], points[2], fillArc, wireframeOnly)) { - g3d.drawEllipse(center, points[2], points[5], fillArc, wireframeOnly); - g3d.drawEllipse(center, points[5], points[0], fillArc, wireframeOnly); + if (g3d.drawEllipse(center, points[0], points[2], fillArc, bOptions[OPT_WIREFRAME])) { + g3d.drawEllipse(center, points[2], points[5], fillArc, bOptions[OPT_WIREFRAME]); + g3d.drawEllipse(center, points[5], points[0], fillArc, bOptions[OPT_WIREFRAME]); return; } for (int i = 1; i < 8; i += 2) { @@ -438,7 +472,7 @@ pt1.setT(points[ptA]); s1.setT(screens[ptA]); short normix = Normix.get2SidedNormix(v3, bsTemp); - if (!fillArc && !wireframeOnly) + if (!fillArc && !bOptions[OPT_WIREFRAME]) screens[6].setT(s1); for (int i = 0, pt = 0; i < 18; i++, pt += 2) { pt2.scaleAdd2(cossin[pt] * d1, v1, center); @@ -447,14 +481,14 @@ if (fillArc) g3d.fillTriangle3CN(s0, colix, normix, s1, colix, normix, s2, colix, normix); - else if (wireframeOnly) + else if (bOptions[OPT_WIREFRAME]) g3d.fillCylinder(GData.ENDCAPS_FLAT, diameter, s1, s2); else screens[i + 7].setT(s2); pt1.setT(pt2); s1.setT(s2); } - if (!fillArc && !wireframeOnly) + if (!fillArc && !bOptions[OPT_WIREFRAME]) for (int i = 0; i < 18; i++) { g3d.fillHermite(5, diameter, diameter, diameter, screens[i == 0 ? i + 6 : i + 5], @@ -469,7 +503,7 @@ int zMin = Integer.MAX_VALUE; selectedOctant = -1; iCutout = -1; - if (drawFill) { + if (bOptions[OPT_FILL]) { for (int i = 0; i < 8; i++) { int ptA = octants[i * 3]; int ptB = octants[i * 3 + 1]; Modified: trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2013-07-02 07:17:11 UTC (rev 18402) +++ trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2013-07-02 10:11:41 UTC (rev 18403) @@ -9997,7 +9997,7 @@ .substring(0, 1); if (type.equals("a") || type.equals("r")) isDerivative = true; - if (!Parser.isOneOf(type, "w;x;y;z;r;a")) // a absolute; r relative + if (!Parser.isOneOf(type, ";w;x;y;z;r;a;")) // a absolute; r relative evalError("QUATERNION [w,x,y,z,a,r] [difference][2]", null); type = "quaternion " + type + (isDerivative ? " difference" : "") + (isSecondDerivative ? "2" : "") + (isDraw ? " draw" : ""); @@ -10962,7 +10962,7 @@ break; case 2: applet = parameterAsString(1); - if (applet.indexOf("jmolApplet") == 0 || Parser.isOneOf(applet, "*;.;^")) { + if (applet.indexOf("jmolApplet") == 0 || Parser.isOneOf(applet, ";*;.;^;")) { text = "ON"; if (!chk) viewer.syncScript(text, applet, 0); @@ -11651,6 +11651,20 @@ boolean checkMore = false; boolean isSet = false; setShapeProperty(JC.SHAPE_ELLIPSOIDS, "thisID", null); + // the first three options, ON, OFF, and (int)scalePercent + // were implemented long before the idea of customized + // ellipsoids was considered. "ON" will produce an ellipsoid + // with a standard radius, and "OFF" will reduce its scale to 0, + // effectively elliminating it. + + // The new options SET and ID are much more powerful. In those, + // ON and OFF simply do that -- turn the ellipsoid on or off -- + // and there are many more options. + + // The SET type ellipsoids, introduced in Jmol 13.1.19 in 7/2013, + // are created by all readers that read ellipsoid (PDB/CIF) or + // tensor (Castep, MagRes) data. + switch (getToken(1).tok) { case T.on: mad = Integer.MAX_VALUE; // default for this type @@ -11720,6 +11734,7 @@ checkLength(i + 1); break; } + // these next are for SET "XXX" or ID "XXX" syntax only if (value == null) switch (theTok) { case T.on: @@ -11745,6 +11760,9 @@ translucentLevel = getColorTrans(i, true); i = iToken; continue; + case T.options: + value = parameterAsString(++i); + break; } if (value == null) error(ERROR_invalidArgument); @@ -13368,7 +13386,7 @@ if (lckey.indexOf("label") == 0 && Parser .isOneOf(key.substring(5).toLowerCase(), - "front;group;atom;offset;offsetexact;pointer;alignment;toggle;scalereference")) { + ";front;group;atom;offset;offsetexact;pointer;alignment;toggle;scalereference;")) { if (setLabel(key.substring(5))) return; } @@ -13775,10 +13793,10 @@ private boolean setUnits(String units, int tok) throws ScriptException { if (tok == T.measurementunits && Parser.isOneOf(units.toLowerCase(), - "angstroms;au;bohr;nanometers;nm;picometers;pm;vanderwaals;vdw")) { + ";angstroms;au;bohr;nanometers;nm;picometers;pm;vanderwaals;vdw;")) { if (!chk) viewer.setUnits(units, true); - } else if (tok == T.energyunits && Parser.isOneOf(units.toLowerCase(), "kcal;kj")) { + } else if (tok == T.energyunits && Parser.isOneOf(units.toLowerCase(), ";kcal;kj;")) { if (!chk) viewer.setUnits(units, false); } else { @@ -14199,7 +14217,7 @@ int tok = tokAt(index); String type = optParameterAsString(index).toLowerCase(); if (slen == index + 1 - && Parser.isOneOf(type, "window;unitcell;molecular")) { + && Parser.isOneOf(type, ";window;unitcell;molecular;")) { setBooleanProperty("axes" + type, true); return; } @@ -14686,7 +14704,7 @@ if (!chk) { viewer.setVibrationOff(); if (!isJS) - viewer.delayScript(this, 100); + viewer.delayScript(this, 100); } pt++; break; @@ -14704,7 +14722,7 @@ break; case T.scene: val = SV.sValue(tokenAt(++pt, args)).toUpperCase(); - if (Parser.isOneOf(val, "PNG;PNGJ")) { + if (Parser.isOneOf(val, ";PNG;PNGJ;")) { sceneType = val; pt++; } @@ -14714,8 +14732,7 @@ break; } if (tok == T.image) { - T t = T.getTokenFromName(SV.sValue(args[pt]) - .toLowerCase()); + T t = T.getTokenFromName(SV.sValue(args[pt]).toLowerCase()); if (t != null) type = SV.sValue(t).toUpperCase(); if (Parser.isOneOf(type, driverList.toUpperCase())) { @@ -14750,16 +14767,16 @@ // if (isApplet) // evalError(GT._("The {0} command is not available for the applet.", // "WRITE CLIPBOARD")); - } else if (Parser.isOneOf(val.toLowerCase(), - "png;pngj;pngt;jpg;jpeg;jpg64;jpeg64")) { - if (tokAtArray(pt + 1, args) == T.integer && tokAtArray(pt + 2, args) == T.integer) { + } else if (Parser.isOneOf(val.toLowerCase(), JC.IMAGE_TYPES)) { + if (tokAtArray(pt + 1, args) == T.integer + && tokAtArray(pt + 2, args) == T.integer) { width = SV.iValue(tokenAt(++pt, args)); height = SV.iValue(tokenAt(++pt, args)); } if (tokAtArray(pt + 1, args) == T.integer) quality = SV.iValue(tokenAt(++pt, args)); } else if (Parser.isOneOf(val.toLowerCase(), - "xyz;xyzrn;xyzvib;mol;sdf;v2000;v3000;cd;pdb;pqr;cml")) { + ";xyz;xyzrn;xyzvib;mol;sdf;v2000;v3000;cd;pdb;pqr;cml;")) { type = val.toUpperCase(); if (pt + 1 == argCount) pt++; @@ -14773,8 +14790,7 @@ // write isosurface t.jvxl if (type.equals("(image)") - && Parser.isOneOf(val.toUpperCase(), - "GIF;JPG;JPG64;JPEG;JPEG64;PNG;PNGJ;PNGT;PPM")) { + && Parser.isOneOf(val.toLowerCase(), JC.IMAGE_OR_SCENE)) { type = val.toUpperCase(); pt++; } @@ -14850,8 +14866,7 @@ if (type.equals("COORD")) type = (fileName != null && fileName.indexOf(".") >= 0 ? fileName .substring(fileName.lastIndexOf(".") + 1).toUpperCase() : "XYZ"); - isImage = Parser.isOneOf(type, - "GIF;JPEG64;JPEG;JPG64;JPG;PPM;PNG;PNGJ;PNGT;SCENE"); + isImage = Parser.isOneOf(type.toLowerCase(), JC.IMAGE_OR_SCENE); if (scripts != null) { if (type.equals("PNG")) type = "PNGJ"; @@ -14865,7 +14880,7 @@ && !Parser .isOneOf( type, - "SCENE;JMOL;ZIP;ZIPALL;SPT;HISTORY;MO;ISOSURFACE;MESH;PMESH;VAR;FILE;FUNCTION;CD;CML;XYZ;XYZRN;XYZVIB;MENU;MOL;PDB;PGRP;PQR;QUAT;RAMA;SDF;V2000;V3000;INLINE")) + ";SCENE;JMOL;ZIP;ZIPALL;SPT;HISTORY;MO;ISOSURFACE;MESH;PMESH;VAR;FILE;FUNCTION;CD;CML;XYZ;XYZRN;XYZVIB;MENU;MOL;PDB;PGRP;PQR;QUAT;RAMA;SDF;V2000;V3000;INLINE;")) errorStr2( ERROR_writeWhat, "COORDS|FILE|FUNCTIONS|HISTORY|IMAGE|INLINE|ISOSURFACE|JMOL|MENU|MO|POINTGROUP|QUATERNION [w,x,y,z] [derivative]" @@ -14883,8 +14898,8 @@ // todo -- there's no reason this data has to be done this way. // we could send all of them out to file directly fullPath[0] = fileName; - data = viewer.generateOutputForExport(data, - isCommand || fileName != null ? fullPath : null, width, height); + data = viewer.generateOutputForExport(data, isCommand + || fileName != null ? fullPath : null, width, height); if (data == null || data.length() == 0) return ""; if (!isCommand) @@ -14947,8 +14962,9 @@ data = viewer.getFunctionCalls(null); type = "TXT"; } else if (data == "VAR") { - data = ((SV) getParameter(SV.sValue(tokenAt( - isCommand ? 2 : 1, args)), T.variable)).asString(); + data = ((SV) getParameter( + SV.sValue(tokenAt(isCommand ? 2 : 1, args)), T.variable)) + .asString(); type = "TXT"; } else if (data == "SPT") { if (isCoord) { @@ -14976,13 +14992,12 @@ error(ERROR_noData); type = "XJVXL"; } else if (data == "ISOSURFACE" || data == "MESH") { - if ((data = getIsosurfaceJvxl(data == "MESH", - JC.SHAPE_ISOSURFACE)) == null) + if ((data = getIsosurfaceJvxl(data == "MESH", JC.SHAPE_ISOSURFACE)) == null) error(ERROR_noData); type = (data.indexOf("<?xml") >= 0 ? "XJVXL" : "JVXL"); if (!isShow) - showString((String) getShapeProperty( - JC.SHAPE_ISOSURFACE, "jvxlFileInfo")); + showString((String) getShapeProperty(JC.SHAPE_ISOSURFACE, + "jvxlFileInfo")); } else { // image len = -1; @@ -15021,11 +15036,10 @@ if (doDefer) msg = viewer.streamFileData(fileName, type, type2, 0, null); else - msg = viewer.createImageSet(fileName, type, - (bytes instanceof String ? (String) bytes : null), - (bytes instanceof byte[] ? (byte[]) bytes : null), - scripts, quality, - width, height, bsFrames, nVibes, fullPath); + msg = viewer.createImageSet(fileName, type, + (bytes instanceof String ? (String) bytes : null), + (bytes instanceof byte[] ? (byte[]) bytes : null), scripts, + quality, width, height, bsFrames, nVibes, fullPath); } if (!chk && msg != null) { if (!msg.startsWith("OK")) Modified: trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java 2013-07-02 07:17:11 UTC (rev 18402) +++ trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java 2013-07-02 10:11:41 UTC (rev 18403) @@ -1434,7 +1434,7 @@ else if (s.equalsIgnoreCase("minArray")) asArray = (nBitSets >= 1); else if (Parser.isOneOf(s.toLowerCase(), - "nm;nanometers;pm;picometers;angstroms;ang;au")) + ";nm;nanometers;pm;picometers;angstroms;ang;au;")) units = s.toLowerCase(); else strFormat = nPoints + ":" + s; Modified: trunk/Jmol/src/org/jmol/script/T.java =================================================================== --- trunk/Jmol/src/org/jmol/script/T.java 2013-07-02 07:17:11 UTC (rev 18402) +++ trunk/Jmol/src/org/jmol/script/T.java 2013-07-02 10:11:41 UTC (rev 18403) @@ -1220,6 +1220,7 @@ final static int once = misc | 246; final static int only = misc | 248; final static int opaque = misc | 250; + final static int options = misc | 251; final static int orbital = misc | 252; final static int orientation = misc | 253; final static int origin = misc | 254; // 12.1.51 @@ -1914,6 +1915,7 @@ "omega", T.t(omega), "only", T.t(only), "opaque", T.t(opaque), + "options", T.t(options), "partialCharge", T.t(partialcharge), "phi", T.t(phi), "plane", T.t(plane), Modified: trunk/Jmol/src/org/jmol/shapespecial/Ellipsoid.java =================================================================== --- trunk/Jmol/src/org/jmol/shapespecial/Ellipsoid.java 2013-07-02 07:17:11 UTC (rev 18402) +++ trunk/Jmol/src/org/jmol/shapespecial/Ellipsoid.java 2013-07-02 10:11:41 UTC (rev 18403) @@ -39,6 +39,7 @@ public boolean isValid; public P3 center = P3.new3(0, 0, 0); public Tensor tensor; + public String options; boolean isOn = true; String id; Modified: trunk/Jmol/src/org/jmol/shapespecial/Ellipsoids.java =================================================================== --- trunk/Jmol/src/org/jmol/shapespecial/Ellipsoids.java 2013-07-02 07:17:11 UTC (rev 18402) +++ trunk/Jmol/src/org/jmol/shapespecial/Ellipsoids.java 2013-07-02 10:11:41 UTC (rev 18403) @@ -153,6 +153,9 @@ ellipsoidSelected.isOn = ((Boolean) value).booleanValue(); return; } + if ("options" == propertyName) { + ellipsoidSelected.options = ((String) value).toLowerCase(); + } if ("points" == propertyName) { //Object[] o = (Object[]) value; //setPoints((P3[]) o[1], (BS) o[2]); @@ -219,6 +222,20 @@ return; } + if ("options" == propertyName) { + String options = ((String) value).toLowerCase().trim(); + if (options.length() == 0) + options = null; + if (selectedAtoms != null) + bs = selectedAtoms; + if (options != null) + setSize(Integer.MAX_VALUE, bs); + for (Ellipsoid e : atomEllipsoids.values()) + if (e.tensor.type.equals(typeSelected) && e.tensor.isSelected(bs, -1)) + e.options = options; + return; + } + if ("color" == propertyName) { short colix = C.getColixO(value); byte pid = EnumPalette.pidOf(value); @@ -315,6 +332,8 @@ sb.append(" ").append(Escape.eP(v1)); } sb.append(" " + getColorCommandUnk("", ellipsoid.colix, translucentAllowed)); + if (ellipsoid.options != null) + sb.append(" options ").append(Escape.eS(ellipsoid.options)); if (!ellipsoid.isOn) sb.append(" off"); sb.append(";\n"); @@ -338,7 +357,9 @@ int i = e2.tensor.atomIndex1; // BSUtil.setMapBitSet(temp, i, i, (isADP ? "Ellipsoids " + e2.percent - : cmd + " scale " + e2.scale + (e2.isOn ? " ON" : " OFF"))); + : cmd + " scale " + e2.scale + + (e2.options == null ? "" : " options " + Escape.eS(e2.options)) + + (e2.isOn ? " ON" : " OFF"))); if (e2.colix != C.INHERIT_ALL) BSUtil.setMapBitSet(temp2, i, i, getColorCommand(cmd, e2.pid, e2.colix, translucentAllowed)); Modified: trunk/Jmol/src/org/jmol/util/Parser.java =================================================================== --- trunk/Jmol/src/org/jmol/util/Parser.java 2013-07-02 07:17:11 UTC (rev 18402) +++ trunk/Jmol/src/org/jmol/util/Parser.java 2013-07-02 10:11:41 UTC (rev 18403) @@ -586,7 +586,9 @@ } public static boolean isOneOf(String key, String semiList) { - return key.indexOf(";") < 0 && (';' + semiList + ';').indexOf(';' + key + ';') >= 0; + if (semiList.charAt(0) != ';') + semiList = ";" + semiList + ";"; + return key.indexOf(";") < 0 && (semiList).indexOf(';' + key + ';') >= 0; } public static String getQuotedAttribute(String info, String name) { Modified: trunk/Jmol/src/org/jmol/viewer/JC.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/JC.java 2013-07-02 07:17:11 UTC (rev 18402) +++ trunk/Jmol/src/org/jmol/viewer/JC.java 2013-07-02 10:11:41 UTC (rev 18403) @@ -122,7 +122,7 @@ public final static String SCRIPT_EDITOR_IGNORE = "\1## EDITOR_IGNORE ##"; - public final static String LOAD_ATOM_DATA_TYPES = "xyz;vxyz;vibration;temperature;occupancy;partialcharge"; + public final static String LOAD_ATOM_DATA_TYPES = ";xyz;vxyz;vibration;temperature;occupancy;partialcharge;"; public final static float radiansPerDegree = (float) (Math.PI / 180); @@ -1541,6 +1541,9 @@ public final static String binaryExtensions = ";pse=PyMOL;";// PyMOL public static final String SCRIPT_COMPLETED = "Script completed"; + public static final String JPEG_EXTENSIONS = ";jpg;jpeg;jpg64;jpeg64;"; + public final static String IMAGE_TYPES = JPEG_EXTENSIONS + "gif;ppm;png;pngj;pngt;"; + public static final String IMAGE_OR_SCENE = IMAGE_TYPES + "scene;"; public final static int getShapeVisibilityFlag(int shapeID) { return (4 << shapeID); Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2013-07-02 07:17:11 UTC (rev 18402) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2013-07-02 10:11:41 UTC (rev 18403) @@ -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.01" +___JmolVersion="13.1.19_dev_2013.07.02" +new feature: ellipsoid OPTIONS "xxxx" + -- "xxxx" is a quoted string of options separated by semicolon: + "arcs;arrows;axes;ball;dots;fill;wireframe" + with optional "no" in front of each + new feature: {xxx}.tensor(type,what) -- type = "temp", "ms", "efg", etc. -- what = "eigenvalues", "eigenvectors", "asymmetric", "symmetric", "trace", "indices", and "type" Modified: trunk/Jmol/src/org/jmol/viewer/StateCreator.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/StateCreator.java 2013-07-02 07:17:11 UTC (rev 18402) +++ trunk/Jmol/src/org/jmol/viewer/StateCreator.java 2013-07-02 10:11:41 UTC (rev 18403) @@ -2261,7 +2261,7 @@ JmolImageCreatorInterface c = null; Object bytes = null; type = type.toLowerCase(); - if (!Parser.isOneOf(type, "jpg;jpeg;jpg64;jpeg64")) + if (!Parser.isOneOf(type, JC.JPEG_EXTENSIONS)) try { c = viewer.getImageCreator(); } catch (Error er) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits