From: <ha...@us...> - 2006-02-28 18:47:09
|
Revision: 4537 Author: hansonr Date: 2006-02-28 10:46:42 -0800 (Tue, 28 Feb 2006) ViewCVS: http://svn.sourceforge.net/jmol/?rev=4537&view=rev Log Message: ----------- OK, this is my first SVN commit. Included here: (1) all atom visibility flag setting pulled from rendering methods. (2) new Atom.visibilityFlags (3) new constants in JmolConstants (4) new Viewer.isTainted (5) visibility calculations only carried when Viewer.isTainted (6) Viewer.isTainted is after any script (7) Eval.expression no longer needs a refresh() prior to using Token.visible (8) Eval.expression runs Viewer.setModelVisibility() instead, only for first Token.visible (9) BackboneRenderer, BallsRenderer, StarsRenderer, SticksRenderer all modified. (10) Backbone, Balls, Bond, Mps, NucleicMonomer, Shape, Stars, Sticks all include some sort of visibility setting (11) Frame, ModelManager modified as necessary. Bob Hanson Modified Paths: -------------- trunk/Jmol/src/org/jmol/viewer/Atom.java trunk/Jmol/src/org/jmol/viewer/Backbone.java trunk/Jmol/src/org/jmol/viewer/BackboneRenderer.java trunk/Jmol/src/org/jmol/viewer/Balls.java trunk/Jmol/src/org/jmol/viewer/BallsRenderer.java trunk/Jmol/src/org/jmol/viewer/Bond.java trunk/Jmol/src/org/jmol/viewer/Eval.java trunk/Jmol/src/org/jmol/viewer/Frame.java trunk/Jmol/src/org/jmol/viewer/JmolConstants.java trunk/Jmol/src/org/jmol/viewer/ModelManager.java trunk/Jmol/src/org/jmol/viewer/Mps.java trunk/Jmol/src/org/jmol/viewer/NucleicMonomer.java trunk/Jmol/src/org/jmol/viewer/Shape.java trunk/Jmol/src/org/jmol/viewer/Stars.java trunk/Jmol/src/org/jmol/viewer/StarsRenderer.java trunk/Jmol/src/org/jmol/viewer/Sticks.java trunk/Jmol/src/org/jmol/viewer/SticksRenderer.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/viewer/Atom.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Atom.java 2006-02-28 18:10:24 UTC (rev 4536) +++ trunk/Jmol/src/org/jmol/viewer/Atom.java 2006-02-28 18:46:42 UTC (rev 4537) @@ -2,6 +2,7 @@ * $Author$ * $Date$ * $Revision$ + * * Copyright (C) 2003-2005 The Jmol Development Team * @@ -36,7 +37,6 @@ final class Atom implements Tuple { - final static byte VISIBLE_FLAG = 0x01; final static byte VIBRATION_VECTOR_FLAG = 0x02; final static byte IS_HETERO_FLAG = 0x04; @@ -48,6 +48,7 @@ byte elementNumber; byte formalChargeAndFlags; byte alternateLocationID; + int visibilityFlags; short madAtom; short colixAtom; Bond[] bonds; @@ -73,6 +74,7 @@ this.colixAtom = viewer.getColixAtom(this); this.alternateLocationID = (byte)alternateLocationID; setMadAtom(viewer.getMadAtom()); + this.point3f = new Point3f(x, y, z); if (isHetero) formalChargeAndFlags |= IS_HETERO_FLAG; @@ -314,8 +316,6 @@ final static int MAX_Z = 14383; void transform(Viewer viewer) { - if (madAtom == JmolConstants.MAR_DELETED) - return; Point3i screen; Vector3f[] vibrationVectors; if ((formalChargeAndFlags & VIBRATION_VECTOR_FLAG) == 0 || @@ -323,7 +323,6 @@ screen = viewer.transformPoint(point3f); else screen = viewer.transformPoint(point3f, vibrationVectors[atomIndex]); - int z = screen.z; z = ((z < MIN_Z) ? MIN_Z @@ -417,7 +416,7 @@ } boolean isVisible() { - return (formalChargeAndFlags & VISIBLE_FLAG) != 0; + return (visibilityFlags > JmolConstants.VISIBLE_MODEL); } float getPartialCharge() { @@ -443,8 +442,8 @@ public float getDimensionValue(int dimension) { return (dimension == 0 - ? point3f.x - : (dimension == 1 ? point3f.y : point3f.z)); + ? point3f.x + : (dimension == 1 ? point3f.y : point3f.z)); } short getVanderwaalsMar() { @@ -923,7 +922,7 @@ boolean isCursorOnTopOfVisibleAtom(int xCursor, int yCursor, int minRadius, Atom competitor) { - return (((formalChargeAndFlags & VISIBLE_FLAG) != 0) && + return (isVisible() && isCursorOnTop(xCursor, yCursor, minRadius, competitor)); } Modified: trunk/Jmol/src/org/jmol/viewer/Backbone.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Backbone.java 2006-02-28 18:10:24 UTC (rev 4536) +++ trunk/Jmol/src/org/jmol/viewer/Backbone.java 2006-02-28 18:46:42 UTC (rev 4537) @@ -2,6 +2,7 @@ * $Author$ * $Date$ * $Revision$ + * * Copyright (C) 2003-2005 The Jmol Development Team * @@ -54,5 +55,18 @@ mads[i] = mad; } } + + void setModelVisibility() { + for (int i = monomerCount - 1; --i >= 0; ) { + if (mads[i] == 0) + continue; + int[] atomIndices = polymer.getLeadAtomIndices(); + Atom atomA = frame.getAtomAt(atomIndices[i]); + Atom atomB = frame.getAtomAt(atomIndices[i + 1]); + atomA.visibilityFlags |= JmolConstants.VISIBLE_BACKBONE; + atomB.visibilityFlags |= JmolConstants.VISIBLE_BACKBONE; + } + } } + } Modified: trunk/Jmol/src/org/jmol/viewer/BackboneRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/BackboneRenderer.java 2006-02-28 18:10:24 UTC (rev 4536) +++ trunk/Jmol/src/org/jmol/viewer/BackboneRenderer.java 2006-02-28 18:46:42 UTC (rev 4537) @@ -2,6 +2,7 @@ * $Author$ * $Date$ * $Revision$ + * * Copyright (C) 2003-2005 The Jmol Development Team * @@ -46,8 +47,7 @@ Atom atomA = frame.getAtomAt(atomIndices[i]); Atom atomB = frame.getAtomAt(atomIndices[i + 1]); - atomA.formalChargeAndFlags |= Atom.VISIBLE_FLAG; - atomB.formalChargeAndFlags |= Atom.VISIBLE_FLAG; + int xA = atomA.getScreenX(), yA = atomA.getScreenY(), zA = atomA.getScreenZ(); int xB = atomB.getScreenX(), yB = atomB.getScreenY(), Modified: trunk/Jmol/src/org/jmol/viewer/Balls.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Balls.java 2006-02-28 18:10:24 UTC (rev 4536) +++ trunk/Jmol/src/org/jmol/viewer/Balls.java 2006-02-28 18:46:42 UTC (rev 4537) @@ -2,6 +2,7 @@ * $Author$ * $Date$ * $Revision$ + * * Copyright (C) 2002-2005 The Jmol Development Team * @@ -88,4 +89,25 @@ } closest.atom = champion; } + + void setModelVisibility() { + Atom[] atoms = frame.atoms; + int displayModelIndex = viewer.getDisplayModelIndex(); + boolean isOneFrame = (displayModelIndex >= 0); + boolean showHydrogens = viewer.getShowHydrogens(); + for (int i = frame.atomCount; --i >= 0; ) { + Atom atom = atoms[i]; + atom.visibilityFlags = 0; + if (atom.madAtom == JmolConstants.MAR_DELETED + || ! showHydrogens && atom.elementNumber == 1) + continue; + if (! isOneFrame || atom.modelIndex == displayModelIndex) { + atom.visibilityFlags = JmolConstants.VISIBLE_MODEL; + if (atom.madAtom != 0) + atom.visibilityFlags |= JmolConstants.VISIBLE_BALL; + if(viewer.hasSelectionHalo(atom.atomIndex)) + atom.visibilityFlags |= JmolConstants.VISIBLE_HALO; + } + } + } } Modified: trunk/Jmol/src/org/jmol/viewer/BallsRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/BallsRenderer.java 2006-02-28 18:10:24 UTC (rev 4536) +++ trunk/Jmol/src/org/jmol/viewer/BallsRenderer.java 2006-02-28 18:46:42 UTC (rev 4537) @@ -2,6 +2,7 @@ * $Author$ * $Date$ * $Revision$ + * * Copyright (C) 2003-2005 The Jmol Development Team * @@ -30,7 +31,6 @@ int minX, maxX, minY, maxY; boolean wireframeRotating; - boolean showHydrogens; short colixSelection; void render() { @@ -41,60 +41,37 @@ wireframeRotating = viewer.getWireframeRotating(); colixSelection = viewer.getColixSelection(); - showHydrogens = viewer.getShowHydrogens(); - Atom[] atoms = frame.atoms; - int displayModelIndex = this.displayModelIndex; - boolean isOneFrame = (displayModelIndex >= 0); - /* - *unnecessary - if (displayModelIndex < 0) { - for (int i = frame.atomCount; --i >= 0; ) { - Atom atom = atoms[i]; - atom.transform(viewer); - render(atom); - } - } else { -*/ - for (int i = frame.atomCount; --i >= 0; ) { - Atom atom = atoms[i]; - if (isOneFrame && atom.modelIndex != displayModelIndex) { - atom.formalChargeAndFlags &= ~Atom.VISIBLE_FLAG; - continue; - } - atom.transform(viewer); - render(atom); - } - // } + for (int i = frame.atomCount; --i >= 0; ) { + Atom atom = atoms[i]; + if ((atom.visibilityFlags & JmolConstants.VISIBLE_MODEL) == 0) + continue; + atom.transform(viewer); + if ((atom.visibilityFlags & JmolConstants.VISIBLE_BALL) != 0) + renderBall(atom); + if ((atom.visibilityFlags & JmolConstants.VISIBLE_HALO) != 0) + renderHalo(atom); + } } - void render(Atom atom) { - if (!showHydrogens && atom.elementNumber == 1) - return; + void renderBall(Atom atom) { long xyzd = atom.xyzd; - int diameter = Xyzd.getD(xyzd); - boolean hasHalo = viewer.hasSelectionHalo(atom.atomIndex); - if (diameter == 0 && !hasHalo) { - atom.formalChargeAndFlags &= ~Atom.VISIBLE_FLAG; - return; - } - // mth 2004 04 02 ... hmmm ... I don't like this here ... looks ugly - atom.formalChargeAndFlags |= Atom.VISIBLE_FLAG; - if (!wireframeRotating) g3d.fillSphereCentered(atom.colixAtom, xyzd); else g3d.drawCircleCentered(atom.colixAtom, xyzd); + } - if (hasHalo) { - int halowidth = diameter / 4; - if (halowidth < 4) halowidth = 4; - if (halowidth > 10) halowidth = 10; - int haloDiameter = diameter + 2 * halowidth; - g3d.fillScreenedCircleCentered(colixSelection, + void renderHalo(Atom atom) { + long xyzd = atom.xyzd; + int diameter = Xyzd.getD(xyzd); + int halowidth = diameter / 4; + if (halowidth < 4) halowidth = 4; + if (halowidth > 10) halowidth = 10; + int haloDiameter = diameter + 2 * halowidth; + g3d.fillScreenedCircleCentered(colixSelection, haloDiameter, Xyzd.getX(xyzd), Xyzd.getY(xyzd), Xyzd.getZ(xyzd)); - } } } Modified: trunk/Jmol/src/org/jmol/viewer/Bond.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Bond.java 2006-02-28 18:10:24 UTC (rev 4536) +++ trunk/Jmol/src/org/jmol/viewer/Bond.java 2006-02-28 18:46:42 UTC (rev 4537) @@ -2,6 +2,7 @@ * $Author$ * $Date$ * $Revision$ + * * Copyright (C) 2003-2005 The Jmol Development Team * @@ -33,6 +34,7 @@ short order; short mad; short colix; + int visibilityFlags; Bond(Atom atom1, Atom atom2, short order, short mad, short colix) { @@ -118,4 +120,3 @@ return Graphics3D.inheritColix(colix, atom2.colixAtom); } } - Modified: trunk/Jmol/src/org/jmol/viewer/Eval.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Eval.java 2006-02-28 18:10:24 UTC (rev 4536) +++ trunk/Jmol/src/org/jmol/viewer/Eval.java 2006-02-28 18:46:42 UTC (rev 4537) @@ -2,6 +2,7 @@ * $Author$ * $Date$ * $Revision$ + * * Copyright (C) 2003-2005 The Jmol Development Team * @@ -312,6 +313,7 @@ viewer.scriptStatus("Script completed"); clearMyThread(); terminationNotification = true; + viewer.setTainted(true); viewer.popHoldRepaint(); } @@ -910,7 +912,7 @@ break; case Token.visible: if(! refreshed) - refresh(); + viewer.setModelVisibility(); refreshed = true; stack[sp++] = copyBitSet(viewer.getVisibleSet()); break; Modified: trunk/Jmol/src/org/jmol/viewer/Frame.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Frame.java 2006-02-28 18:10:24 UTC (rev 4536) +++ trunk/Jmol/src/org/jmol/viewer/Frame.java 2006-02-28 18:46:42 UTC (rev 4537) @@ -2,6 +2,7 @@ * $Author$ * $Date$ * $Revision$ + * * Copyright (C) 2003-2005 The Jmol Development Team * @@ -968,6 +969,7 @@ shapes[i].findNearestAtomIndex(x, y, closest); if (closest.atom != null) break; + } } int closestIndex = (closest.atom == null ? -1 : closest.atom.atomIndex); @@ -1662,9 +1664,14 @@ BitSet getVisibleSet() { BitSet bs = new BitSet(); - for (int i = atomCount; --i >= 0; ) - if(atoms[i].isVisible()) + int n=0; + for (int i = atomCount; --i >= 0; ) { + if(atoms[i].isVisible()) { bs.set(i); + n++; + } + } + System.out.println("Frame.getVisibleSet: " + n + " size:" + bs.size() + " length:" + bs.length() + " cardinality:" + bs.cardinality()); return bs; } Modified: trunk/Jmol/src/org/jmol/viewer/JmolConstants.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/JmolConstants.java 2006-02-28 18:10:24 UTC (rev 4536) +++ trunk/Jmol/src/org/jmol/viewer/JmolConstants.java 2006-02-28 18:46:42 UTC (rev 4537) @@ -2,6 +2,7 @@ * $Author$ * $Date$ * $Revision$ + * * Copyright (C) 2003-2005 Miguel, Jmol Development, www.jmol.org * @@ -27,6 +28,16 @@ final public class JmolConstants { + + public final static int VISIBLE_MODEL = 1; + public final static int VISIBLE_BALL = 2; + public final static int VISIBLE_STICK = 4; + public final static int VISIBLE_BACKBONE = 8; + public final static int VISIBLE_CARTOON = 16; + public final static int VISIBLE_STAR = 32; + public final static int VISIBLE_HALO = 64; + + // for now, just update this by hand // perhaps use ant filter later ... but mth doesn't like it :-( public final static String copyright = "(C) 2006 Jmol Development"; @@ -1665,7 +1676,7 @@ }; public final static String[] specialAtomNames = { - + //////////////////////////////////////////////////////////////// // The ordering of these entries can be changed ... BUT ... // the offsets must be kept consistent with the ATOMID definitions Modified: trunk/Jmol/src/org/jmol/viewer/ModelManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/ModelManager.java 2006-02-28 18:10:24 UTC (rev 4536) +++ trunk/Jmol/src/org/jmol/viewer/ModelManager.java 2006-02-28 18:46:42 UTC (rev 4537) @@ -2,6 +2,7 @@ * $Author$ * $Date$ * $Revision$ + * * Copyright (C) 2003-2005 Miguel, Jmol Development, www.jmol.org * @@ -485,7 +486,7 @@ } int getAtomModelIndex(int i) { - return frame.getAtomAt(i).getModelIndex(); + return frame.getAtomAt(i).getModelIndex(); } Point3f getBondPoint3f1(int i) { @@ -521,15 +522,15 @@ } int getBondModelIndex(int i) { - Atom atom = frame.getBondAt(i).getAtom1(); - if (atom != null) { - return atom.getModelIndex(); - } - atom = frame.getBondAt(i).getAtom2(); - if (atom != null) { - return atom.getModelIndex(); - } - return 0; + Atom atom = frame.getBondAt(i).getAtom1(); + if (atom != null) { + return atom.getModelIndex(); + } + atom = frame.getBondAt(i).getAtom2(); + if (atom != null) { + return atom.getModelIndex(); + } + return 0; } public Point3f[] getPolymerLeadMidPoints(int modelIndex, int polymerIndex) { @@ -830,5 +831,16 @@ return info; } + + void setModelVisibility() { + if (frame == null) + return; + for (int i = 0; i < JmolConstants.SHAPE_MAX; ++i) { + Shape shape = frame.shapes[i]; + if (shape != null) { + System.out.println("modelManager-setModelVis "+JmolConstants.shapeClassBases[i]); + shape.setModelVisibility(); + } + } + } } - Modified: trunk/Jmol/src/org/jmol/viewer/Mps.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Mps.java 2006-02-28 18:10:24 UTC (rev 4536) +++ trunk/Jmol/src/org/jmol/viewer/Mps.java 2006-02-28 18:46:42 UTC (rev 4537) @@ -2,6 +2,7 @@ * $Author$ * $Date$ * $Revision$ + * * Copyright (C) 2003-2005 The Jmol Development Team * @@ -93,6 +94,11 @@ mpsmodels[i].findNearestAtomIndex(xMouse, yMouse, closest); } + void setModelVisibility() { + for (int i = mpsmodels.length; --i >= 0; ) + mpsmodels[i].setModelVisibility(); + } + class Mpsmodel { Mpspolymer[] mpspolymers; int modelIndex; @@ -140,8 +146,15 @@ for (int i = mpspolymers.length; --i >= 0; ) mpspolymers[i].findNearestAtomIndex(xMouse, yMouse, closest); } + + void setModelVisibility() { + for (int i = mpspolymers.length; --i >= 0; ) + mpspolymers[i].setModelVisibility(); + } + } + abstract class Mpspolymer { Polymer polymer; short madOn; @@ -351,6 +364,19 @@ void findNearestAtomIndex(int xMouse, int yMouse, Closest closest) { polymer.findNearestAtomIndex(xMouse, yMouse, closest, mads); } + + void setModelVisibility() { + if (wingVectors == null) + return; + boolean isNucleicPolymer = polymer instanceof NucleicPolymer; + if (! isNucleicPolymer) + return; + for (int i = monomerCount; --i >= 0; ) { + if (mads[i] <= 0) + continue; + NucleicMonomer group = (NucleicMonomer) monomers[i]; + group.setModelVisibility(); + } + } } } - Modified: trunk/Jmol/src/org/jmol/viewer/NucleicMonomer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/NucleicMonomer.java 2006-02-28 18:10:24 UTC (rev 4536) +++ trunk/Jmol/src/org/jmol/viewer/NucleicMonomer.java 2006-02-28 18:46:42 UTC (rev 4537) @@ -2,6 +2,7 @@ * $Author$ * $Date$ * $Revision$ + * * Copyright (C) 2004-2005 The Jmol Development Team * @@ -197,7 +198,6 @@ void getBaseRing6Points(Point3f[] ring6Points) { for (int i = 6; --i >= 0; ) { Atom atom = getAtomFromOffsetIndex(i + 3); - atom.formalChargeAndFlags |= Atom.VISIBLE_FLAG; ring6Points[i] = atom.point3f; } } @@ -208,7 +208,6 @@ if (isPurine) for (int i = 5; --i >= 0; ) { Atom atom = getAtomFromOffsetIndex(ring5OffsetIndexes[i]); - atom.formalChargeAndFlags |= Atom.VISIBLE_FLAG; ring5Points[i] = atom.point3f; } return isPurine; @@ -248,4 +247,17 @@ c3prime.isCursorOnTop(x, y, radius, competitor)) closest.atom = lead; } + + void setModelVisibility() { + Atom atom; + for (int i = 6; --i >= 0; ) { + atom = getAtomFromOffsetIndex(i + 3); + atom.visibilityFlags |= JmolConstants.VISIBLE_CARTOON; + } + if (isPurine) + for (int i = 5; --i >= 0; ) { + atom = getAtomFromOffsetIndex(ring5OffsetIndexes[i]); + atom.visibilityFlags |= JmolConstants.VISIBLE_CARTOON; + } + } } Modified: trunk/Jmol/src/org/jmol/viewer/Shape.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Shape.java 2006-02-28 18:10:24 UTC (rev 4536) +++ trunk/Jmol/src/org/jmol/viewer/Shape.java 2006-02-28 18:46:42 UTC (rev 4537) @@ -2,6 +2,7 @@ * $Author$ * $Date$ * $Revision$ + * * Copyright (C) 2003-2005 The Jmol Development Team * @@ -66,4 +67,6 @@ void checkBoundsMinMax(Point3f pointMin, Point3f pointMax) { } + void setModelVisibility() { + } } Modified: trunk/Jmol/src/org/jmol/viewer/Stars.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Stars.java 2006-02-28 18:10:24 UTC (rev 4536) +++ trunk/Jmol/src/org/jmol/viewer/Stars.java 2006-02-28 18:46:42 UTC (rev 4537) @@ -2,6 +2,7 @@ * $Author$ * $Date$ * $Revision$ + * * Copyright (C) 2002-2005 The Jmol Development Team * @@ -69,4 +70,17 @@ return; } } + + void setModelVisibility() { + if (mads == null) + return; + Atom[] atoms = frame.atoms; + int displayModelIndex = viewer.getDisplayModelIndex(); + for (int i = frame.atomCount; --i >= 0; ) { + Atom atom = atoms[i]; + if ((displayModelIndex < 0 || atom.modelIndex == displayModelIndex) + && mads[i] > 0) + atom.visibilityFlags |= JmolConstants.VISIBLE_STAR; + } + } } Modified: trunk/Jmol/src/org/jmol/viewer/StarsRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/StarsRenderer.java 2006-02-28 18:10:24 UTC (rev 4536) +++ trunk/Jmol/src/org/jmol/viewer/StarsRenderer.java 2006-02-28 18:46:42 UTC (rev 4537) @@ -2,6 +2,7 @@ * $Author$ * $Date$ * $Revision$ + * * Copyright (C) 2003-2005 The Jmol Development Team * @@ -33,16 +34,12 @@ if (stars.mads == null) return; Atom[] atoms = frame.atoms; - int displayModelIndex = this.displayModelIndex; for (int i = frame.atomCount; --i >= 0; ) { Atom atom = atoms[i]; - if (displayModelIndex >= 0 && atom.modelIndex != displayModelIndex) - continue; - short mad = stars.mads[i]; - if (mad == 0) - continue; - short colix = stars.colixes == null ? 0 : stars.colixes[i]; - render1(atom, mad, colix); + if ((atom.visibilityFlags & JmolConstants.VISIBLE_STAR) !=0) { + short colix = stars.colixes == null ? 0 : stars.colixes[i]; + render1(atom, stars.mads[i], colix); + } } } @@ -52,40 +49,11 @@ int y = Xyzd.getY(xyzd); int z = Xyzd.getZ(xyzd); int d = viewer.scaleToScreen(z, mad); - // make available for hover/click/measure - atom.formalChargeAndFlags |= Atom.VISIBLE_FLAG; d -= (d & 1) ^ 1; // round down to odd value colix = Graphics3D.inheritColix(colix, atom.colixAtom); int r = d / 2; g3d.drawLine(colix, x - r, y, z, x - r + d, y, z); g3d.drawLine(colix, x, y - r, z, x, y - r + d, z); - /* - long xyzd = atom.xyzd; - int diameter = Xyzd.getD(xyzd); - boolean hasHalo = viewer.hasSelectionHalo(atom.atomIndex); - if (diameter == 0 && !hasHalo) { - atom.formalChargeAndFlags &= ~Atom.VISIBLE_FLAG; - return; - } - // mth 2004 04 02 ... hmmm ... I don't like this here ... looks ugly - atom.formalChargeAndFlags |= Atom.VISIBLE_FLAG; - - if (!wireframeRotating) - g3d.fillSphereCentered(atom.colixAtom, xyzd); - else - g3d.drawCircleCentered(atom.colixAtom, xyzd); - - if (hasHalo) { - int halowidth = diameter / 4; - if (halowidth < 4) halowidth = 4; - if (halowidth > 10) halowidth = 10; - int haloDiameter = diameter + 2 * halowidth; - g3d.fillScreenedCircleCentered(colixSelection, - haloDiameter, - Xyzd.getX(xyzd), Xyzd.getY(xyzd), - Xyzd.getZ(xyzd)); - } - */ } } Modified: trunk/Jmol/src/org/jmol/viewer/Sticks.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Sticks.java 2006-02-28 18:10:24 UTC (rev 4536) +++ trunk/Jmol/src/org/jmol/viewer/Sticks.java 2006-02-28 18:46:42 UTC (rev 4537) @@ -2,6 +2,7 @@ * $Author$ * $Date$ * $Revision$ + * * Copyright (C) 2002-2005 The Jmol Development Team * @@ -229,4 +230,27 @@ viewer.scriptStatus(nbonds + " bonds " + (order == 0 ? " deleted":" formed or modified")); viewer.setBondSelectionModeOr(bondmode); } + + void setModelVisibility() { + Bond[] bonds = frame.bonds; + int displayModelIndex = viewer.getDisplayModelIndex(); + boolean isOneFrame = (displayModelIndex >= 0); + boolean showHydrogens = viewer.getShowHydrogens(); + for (int i = frame.bondCount; --i >= 0; ) { + Bond bond = bonds[i]; + bond.visibilityFlags = 0; + if (!isOneFrame || bond.atom1.modelIndex == displayModelIndex) { + if (bond.mad == 0) + continue; + Atom atomA = bond.atom1; + Atom atomB = bond.atom2; + if (showHydrogens + || atomA.elementNumber != 1 && atomB.elementNumber != 1) { + atomA.visibilityFlags |= JmolConstants.VISIBLE_STICK; + atomB.visibilityFlags |= JmolConstants.VISIBLE_STICK; + bond.visibilityFlags |= JmolConstants.VISIBLE_STICK; + } + } + } + } } Modified: trunk/Jmol/src/org/jmol/viewer/SticksRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/SticksRenderer.java 2006-02-28 18:10:24 UTC (rev 4536) +++ trunk/Jmol/src/org/jmol/viewer/SticksRenderer.java 2006-02-28 18:46:42 UTC (rev 4537) @@ -2,6 +2,7 @@ * $Author$ * $Date$ * $Revision$ + * * Copyright (C) 2002-2005 The Jmol Development Team * @@ -69,7 +70,6 @@ colixSelection = viewer.getColixSelection(); showMultipleBonds = viewer.getShowMultipleBonds(); modeMultipleBond = viewer.getModeMultipleBond(); - showHydrogens = viewer.getShowHydrogens(); ssbondsBackbone = viewer.getSsbondsBackbone(); hbondsBackbone = viewer.getHbondsBackbone(); @@ -77,31 +77,18 @@ hbondsSolid = viewer.getHbondsSolid(); Bond[] bonds = frame.bonds; - int displayModelIndex = this.displayModelIndex; - if (displayModelIndex < 0) { - for (int i = frame.bondCount; --i >= 0; ) - render(bonds[i]); - } else { - for (int i = frame.bondCount; --i >= 0; ) { - Bond bond = bonds[i]; - if (bond.atom1.modelIndex != displayModelIndex) - continue; + for (int i = frame.bondCount; --i >= 0; ) { + Bond bond = bonds[i]; + if ((bond.visibilityFlags & JmolConstants.VISIBLE_STICK) != 0) render(bond); - } } } void render(Bond bond) { - if ((madBond = bond.mad) == 0) - return; + madBond = bond.mad; int order = bond.order; Atom atomA = bond.atom1; Atom atomB = bond.atom2; - if (!showHydrogens && (atomA.elementNumber == 1 || - atomB.elementNumber == 1)) - return; - atomA.formalChargeAndFlags |= Atom.VISIBLE_FLAG; - atomB.formalChargeAndFlags |= Atom.VISIBLE_FLAG; colixA = Graphics3D.inheritColix(bond.colix, atomA.colixAtom); colixB = Graphics3D.inheritColix(bond.colix, atomB.colixAtom); if (bondsBackbone) { Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2006-02-28 18:10:24 UTC (rev 4536) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2006-02-28 18:46:42 UTC (rev 4537) @@ -2,6 +2,7 @@ * $Author$ * $Date$ * $Revision$ + * * Copyright (C) 2003-2005 Miguel, Jmol Development, www.jmol.org * @@ -1750,6 +1751,8 @@ public void renderScreenImage(Graphics g, Dimension size, Rectangle clip) { manageScriptTermination(); + if(isTainted)setModelVisibility(); + isTainted = false; if (size != null) setScreenDimension(size); int stereoMode = getStereoMode(); @@ -2911,4 +2914,13 @@ return g3d.getHexColorFromIndex(colix); } + void setModelVisibility(){ + modelManager.setModelVisibility(); + } + + boolean isTainted = true; + void setTainted(boolean TF) { + isTainted = TF; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |