From: <ha...@us...> - 2007-05-22 12:48:15
|
Revision: 7806 http://svn.sourceforge.net/jmol/?rev=7806&view=rev Author: hansonr Date: 2007-05-22 05:48:05 -0700 (Tue, 22 May 2007) Log Message: ----------- 11.1.43 strandCount carryover to meshRibbon; consistency in initState Modified Paths: -------------- trunk/Jmol/src/org/jmol/shape/AtomShape.java trunk/Jmol/src/org/jmol/shape/Axes.java trunk/Jmol/src/org/jmol/shape/Bbcage.java trunk/Jmol/src/org/jmol/shape/Dipole.java trunk/Jmol/src/org/jmol/shape/Dots.java trunk/Jmol/src/org/jmol/shape/Echo.java trunk/Jmol/src/org/jmol/shape/FontLineShape.java trunk/Jmol/src/org/jmol/shape/Frank.java trunk/Jmol/src/org/jmol/shape/GeoSurface.java trunk/Jmol/src/org/jmol/shape/Hover.java trunk/Jmol/src/org/jmol/shape/Labels.java trunk/Jmol/src/org/jmol/shape/Measures.java trunk/Jmol/src/org/jmol/shape/MeshCollection.java trunk/Jmol/src/org/jmol/shape/Stars.java trunk/Jmol/src/org/jmol/shape/Sticks.java trunk/Jmol/src/org/jmol/shape/TextShape.java trunk/Jmol/src/org/jmol/shape/Uccage.java trunk/Jmol/src/org/jmol/shapebio/Backbone.java trunk/Jmol/src/org/jmol/shapebio/BioShape.java trunk/Jmol/src/org/jmol/shapebio/Cartoon.java trunk/Jmol/src/org/jmol/shapebio/MeshRibbon.java trunk/Jmol/src/org/jmol/shapebio/MeshRibbonRenderer.java trunk/Jmol/src/org/jmol/shapebio/Rockets.java trunk/Jmol/src/org/jmol/shapebio/Strands.java trunk/Jmol/src/org/jmol/shapebio/StrandsRenderer.java trunk/Jmol/src/org/jmol/shapebio/Trace.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/shape/AtomShape.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/AtomShape.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shape/AtomShape.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -33,7 +33,7 @@ import org.jmol.util.ArrayUtil; import org.jmol.viewer.JmolConstants; -public class AtomShape extends Shape { +public abstract class AtomShape extends Shape { // Balls, Dots, Halos, Labels, Polyhedra, Stars, Vectors Modified: trunk/Jmol/src/org/jmol/shape/Axes.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/Axes.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shape/Axes.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -31,7 +31,7 @@ public class Axes extends FontLineShape { - final static Point3f[] unitAxisPoints = { + private final static Point3f[] unitAxisPoints = { new Point3f( 1, 0, 0), new Point3f( 0, 1, 0), new Point3f( 0, 0, 1), @@ -47,11 +47,12 @@ axisPoints[i] = new Point3f(); } - final static float MIN_AXIS_LEN = 1.5f; - public void initShape() { + private final static float MIN_AXIS_LEN = 1.5f; + + public void initShape() { + super.initShape(); myType = "axes"; font3d = g3d.getFont3D(JmolConstants.AXES_DEFAULT_FONTSIZE); - super.initShape(); int axesMode = viewer.getAxesMode(); if (axesMode == JmolConstants.AXES_MODE_UNITCELL && modelSet.getCellInfos() != null) { UnitCell unitcell = viewer.getCurrentUnitCell(); Modified: trunk/Jmol/src/org/jmol/shape/Bbcage.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/Bbcage.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shape/Bbcage.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -27,11 +27,14 @@ public class Bbcage extends FontLineShape { // by XORing each of the three bits of my index - final static byte edges[] = - {0,1, 0,2, 0,4, 1,3, 1,5, 2,3, 2,6, 3,7, 4,5, 4,6, 5,7, 6,7}; + final static byte edges[] = { + 0,1, 0,2, 0,4, 1,3, + 1,5, 2,3, 2,6, 3,7, + 4,5, 4,6, 5,7, 6,7 + }; - public void initShape() { + public void initShape() { + super.initShape(); myType = "boundBox"; - super.initShape(); } } Modified: trunk/Jmol/src/org/jmol/shape/Dipole.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/Dipole.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shape/Dipole.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -24,7 +24,6 @@ package org.jmol.shape; -import java.util.BitSet; import javax.vecmath.Vector3f; import javax.vecmath.Point3f; import org.jmol.g3d.Graphics3D; @@ -83,12 +82,6 @@ this.type = DIPOLE_TYPE_UNKNOWN; } - public void initShape() { - } - - public void setProperty(String propertyName, Object value, BitSet bsSelected) { - } - void setTranslucent(boolean isTranslucent, float translucentLevel) { colix = Graphics3D.getColixTranslucent(colix, isTranslucent, translucentLevel); } Modified: trunk/Jmol/src/org/jmol/shape/Dots.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/Dots.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shape/Dots.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -36,14 +36,14 @@ public class Dots extends AtomShape { EnvelopeCalculation ec; - + final static float SURFACE_DISTANCE_FOR_CALCULATION = 10f; BitSet bsOn = new BitSet(); private BitSet bsSelected, bsIgnore; - + static int MAX_LEVEL = EnvelopeCalculation.MAX_LEVEL; - + int thisAtom; float thisRadius; int thisArgb; @@ -51,26 +51,24 @@ //short mad = 0; short lastMad = 0; float lastSolventRadius = 0; - + long timeBeginExecution; long timeEndExecution; + int getExecutionWalltime() { return (int) (timeEndExecution - timeBeginExecution); } - public void initShape() { - - //these next two are for the geodesic fragment at a distance - - translucentAllowed = false; //except for geosurface + public void initShape() { super.initShape(); + translucentAllowed = false; //except for geosurface ec = new EnvelopeCalculation(viewer, atomCount, mads); } boolean isSurface = false; - - public void setProperty(String propertyName, Object value, BitSet bs) { + public void setProperty(String propertyName, Object value, BitSet bs) { + if (Logger.isActiveLevel(Logger.LEVEL_DEBUG)) { Logger.debug("Dots.setProperty: " + propertyName + " " + value); } @@ -81,7 +79,8 @@ } if ("translucency" == propertyName) { - return; // no translucent dots + if (!translucentAllowed) + return; // no translucent dots, but ok for geosurface } if ("ignore" == propertyName) { @@ -133,10 +132,6 @@ super.setProperty(propertyName, value, bs); } - void setSuperProperty(String propertyName, Object value, BitSet bs) { - super.setProperty(propertyName, value, bs); - } - void initialize() { bsSelected = null; bsIgnore = null; @@ -144,8 +139,8 @@ if (ec == null) ec = new EnvelopeCalculation(viewer, atomCount, mads); } - - public void setSize(int size, BitSet bsSelected) { + + public void setSize(int size, BitSet bsSelected) { if (this.bsSelected != null) bsSelected = this.bsSelected; @@ -233,7 +228,8 @@ } boolean disregardNeighbors = (viewer.getDotSurfaceFlag() == false); boolean onlySelectedDots = (viewer.getDotsSelectedOnlyFlag() == true); - ec.calculate(addRadius, setRadius, scale, maxRadius, bsOn, bsIgnore, + ec + .calculate(addRadius, setRadius, scale, maxRadius, bsOn, bsIgnore, useVanderwaalsRadius, disregardNeighbors, onlySelectedDots, isSurface); } @@ -243,7 +239,7 @@ } } - public void setModelClickability() { + public void setModelClickability() { for (int i = atomCount; --i >= 0;) { Atom atom = atoms[i]; if ((atom.getShapeVisibilityFlags() & myVisibilityFlag) == 0 @@ -253,7 +249,7 @@ } } - public String getShapeState() { + public String getShapeState() { int[][] dotsConvexMaps = ec.getDotsConvexMaps(); if (dotsConvexMaps == null || ec.getDotsConvexMax() == 0) return ""; @@ -277,8 +273,8 @@ bs.set(iDot); } if (n > 0) { - appendCmd(s, type + i + " radius " + ec.getAppropriateRadius(i) - + " " + Escape.escape(bs)); + appendCmd(s, type + i + " radius " + ec.getAppropriateRadius(i) + " " + + Escape.escape(bs)); } } s.append(getShapeCommands(temp, null, atomCount)); Modified: trunk/Jmol/src/org/jmol/shape/Echo.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/Echo.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shape/Echo.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -34,7 +34,6 @@ public class Echo extends TextShape { - /* * set echo Text.TOP [Text.LEFT|Text.CENTER|Text.RIGHT] * set echo MIDDLE [Text.LEFT|Text.CENTER|Text.RIGHT] @@ -44,17 +43,17 @@ * set echo none to initiate setting default settings * */ - private final static String FONTFACE = "Serif"; private final static int FONTSIZE = 20; private final static short COLOR = Graphics3D.RED; - - public void initShape() { + + public void initShape() { + super.initShape(); setProperty("target", "top", null); } - public void setProperty(String propertyName, Object value, BitSet bsSelected) { + public void setProperty(String propertyName, Object value, BitSet bsSelected) { if (Logger.isActiveLevel(Logger.LEVEL_DEBUG)) { Logger.debug("Echo.setProperty(" + propertyName + "," + value + ")"); @@ -62,7 +61,7 @@ if ("script" == propertyName) { if (currentText != null) - currentText.setScript((String)value); + currentText.setScript((String) value); return; } if ("target" == propertyName) { @@ -81,8 +80,8 @@ } else if ("bottom" == target) { valign = Text.BOTTOM; } - text = new Text(viewer, g3d, g3d.getFont3D(FONTFACE, FONTSIZE), target, - COLOR, valign, halign); + text = new Text(viewer, g3d, g3d.getFont3D(FONTFACE, FONTSIZE), + target, COLOR, valign, halign); text.setAdjustForWindow(true); // when a box is around it texts.put(target, text); if (currentFont != null) @@ -102,8 +101,8 @@ } super.setProperty(propertyName, value, null); } - - public String getShapeState() { + + public String getShapeState() { StringBuffer s = new StringBuffer(); String lastFormat = ""; Enumeration e = texts.elements(); @@ -118,7 +117,7 @@ } return s.toString(); } - + public boolean checkObjectClicked(int x, int y, int modifiers) { Enumeration e = texts.elements(); while (e.hasMoreElements()) { @@ -152,6 +151,4 @@ return false; } - } - Modified: trunk/Jmol/src/org/jmol/shape/FontLineShape.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/FontLineShape.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shape/FontLineShape.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -29,24 +29,25 @@ import java.util.BitSet; public abstract class FontLineShape extends Shape { - + // Axes, Bbcage, Frank, Uccage Font3D font3d; String myType; - public void initShape() { + public void initShape() { + super.initShape(); translucentAllowed = false; } - - public void setProperty(String propertyName, Object value, BitSet bs) { + + public void setProperty(String propertyName, Object value, BitSet bs) { if ("font" == propertyName) { - font3d = (Font3D)value; + font3d = (Font3D) value; return; } } - - public String getShapeState() { + + public String getShapeState() { return viewer.getObjectState(myType) + Shape.getFontCommand(myType, font3d) + ";\n"; } Modified: trunk/Jmol/src/org/jmol/shape/Frank.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/Frank.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shape/Frank.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -23,13 +23,14 @@ */ package org.jmol.shape; + import org.jmol.g3d.Graphics3D; import org.jmol.g3d.Font3D; import java.awt.FontMetrics; public class Frank extends FontLineShape { - + // Axes, Bbcage, Frank, Uccage final static String frankString = "Jmol"; @@ -44,11 +45,10 @@ int frankAscent; int frankDescent; - - public void initShape() { + public void initShape() { + super.initShape(); myType = "frank"; font3d = g3d.getFont3D(defaultFontName, defaultFontStyle, defaultFontSize); - super.initShape(); } public boolean wasClicked(int x, int y) { @@ -58,10 +58,8 @@ x *= 2; y *= 2; } - return (width > 0 && - height > 0 && - x > width - frankWidth - frankMargin && - y > height - frankAscent - frankMargin); + return (width > 0 && height > 0 && x > width - frankWidth - frankMargin && y > height + - frankAscent - frankMargin); } void calcMetrics() { Modified: trunk/Jmol/src/org/jmol/shape/GeoSurface.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/GeoSurface.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shape/GeoSurface.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -24,29 +24,12 @@ package org.jmol.shape; -import java.util.BitSet; - -import org.jmol.util.Logger; - public class GeoSurface extends Dots { public void initShape() { - isSurface = true; - super.initShape(); + super.initShape(); + isSurface = true; + translucentAllowed = true; } - public void setProperty(String propertyName, Object value, BitSet bs) { - - if (Logger.isActiveLevel(Logger.LEVEL_DEBUG)) { - Logger.debug("GeoSurface.setProperty: " + propertyName + " " + value); - } - - if ("translucency" == propertyName) { - //skip dots and go straight to AtomShape - super.setSuperProperty(propertyName, value, bs); - return; - } - super.setProperty(propertyName, value, bs); - } - } Modified: trunk/Jmol/src/org/jmol/shape/Hover.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/Hover.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shape/Hover.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -46,16 +46,17 @@ String labelFormat = "%U"; String[] atomFormats; - public void initShape() { + public void initShape() { + super.initShape(); Font3D font3d = g3d.getFont3D(FONTFACE, FONTSTYLE, FONTSIZE); short bgcolix = Graphics3D.getColix("#FFFFC3"); // 255, 255, 195 short colix = Graphics3D.BLACK; - currentText = hoverText = new Text(g3d, font3d, null, colix, bgcolix, - 0, 0, 1, Integer.MIN_VALUE, Text.LEFT); + currentText = hoverText = new Text(g3d, font3d, null, colix, bgcolix, 0, 0, + 1, Integer.MIN_VALUE, Text.LEFT); hoverText.setAdjustForWindow(true); } - public void setProperty(String propertyName, Object value, BitSet bsSelected) { + public void setProperty(String propertyName, Object value, BitSet bsSelected) { if (Logger.isActiveLevel(Logger.LEVEL_DEBUG)) { Logger.debug("Hover.setProperty(" + propertyName + "," + value + ")"); @@ -71,14 +72,14 @@ } return; } - + if ("text" == propertyName) { text = (String) value; if (text != null && text.length() == 0) text = null; return; } - + if ("atomLabel" == propertyName) { String text = (String) value; if (text != null && text.length() == 0) @@ -86,16 +87,16 @@ int count = viewer.getAtomCount(); if (atomFormats == null) atomFormats = new String[count]; - for (int i = count; --i >= 0; ) - if (bsSelected.get(i)) - atomFormats[i] = text; + for (int i = count; --i >= 0;) + if (bsSelected.get(i)) + atomFormats[i] = text; return; } - + if ("xy" == propertyName) { xy = (Point3i) value; } - + if ("label" == propertyName) { labelFormat = (String) value; if (labelFormat != null && labelFormat.length() == 0) @@ -104,17 +105,16 @@ } super.setProperty(propertyName, value, null); - + } - public String getShapeState() { + public String getShapeState() { Hashtable temp = new Hashtable(); int atomCount = viewer.getAtomCount(); if (atomFormats != null) for (int i = atomCount; --i >= 0;) if (atomFormats[i] != null) - setStateInfo(temp, i, "hover = " - + Escape.escape(atomFormats[i])); + setStateInfo(temp, i, "hover = " + Escape.escape(atomFormats[i])); return getShapeCommands(temp, null, atomCount); - } + } } Modified: trunk/Jmol/src/org/jmol/shape/Labels.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/Labels.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shape/Labels.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -43,7 +43,7 @@ Hashtable atomLabels = new Hashtable(); Text text; - + BitSet bsFontSet, bsBgColixSet; int defaultOffset; @@ -57,23 +57,21 @@ int zeroOffset; boolean defaultsOnlyForNone = true; - //labels - - public void initShape() { + + public void initShape() { + super.initShape(); defaultFontId = zeroFontId = g3d.getFont3D(JmolConstants.DEFAULT_FONTFACE, - JmolConstants.DEFAULT_FONTSTYLE, - JmolConstants.LABEL_DEFAULT_FONTSIZE).fid; + JmolConstants.DEFAULT_FONTSTYLE, JmolConstants.LABEL_DEFAULT_FONTSIZE).fid; defaultColix = 0; //"none" -- inherit from atom defaultBgcolix = 0; //"none" -- off defaultOffset = zeroOffset = (JmolConstants.LABEL_DEFAULT_X_OFFSET << 8) - | JmolConstants.LABEL_DEFAULT_Y_OFFSET; + | JmolConstants.LABEL_DEFAULT_Y_OFFSET; translucentAllowed = false; - super.initShape(); } - public void setProperty(String propertyName, Object value, BitSet bsSelected) { + public void setProperty(String propertyName, Object value, BitSet bsSelected) { isActive = true; if ("color" == propertyName) { isActive = true; @@ -89,7 +87,7 @@ } return; } - + if ("label" == propertyName) { isActive = true; if (bsSizeSet == null) @@ -142,7 +140,7 @@ } // the rest require bsFontSet setting - + if (bsFontSet == null) bsFontSet = new BitSet(); @@ -163,7 +161,7 @@ } if ("font" == propertyName) { - byte fid = ((Font3D) value).fid; + byte fid = ((Font3D) value).fid; int n = 0; for (int i = atomCount; --i >= 0;) if (bsSelected.get(i)) @@ -209,7 +207,7 @@ } if ("pointer" == propertyName) { - int pointer = ((Integer)value).intValue(); + int pointer = ((Integer) value).intValue(); int n = 0; for (int i = atomCount; --i >= 0;) if (bsSelected.get(i)) @@ -220,7 +218,7 @@ } if ("front" == propertyName) { - boolean TF = ((Boolean)value).booleanValue(); + boolean TF = ((Boolean) value).booleanValue(); int n = 0; for (int i = atomCount; --i >= 0;) if (bsSelected.get(i)) @@ -229,12 +227,12 @@ defaultOffset = defaultOffset & ~ZPOS_FLAGS | (TF ? FRONT_FLAG : 0); //FindBugs mission accomplished! //if (n == 0 || !defaultsOnlyForNone) - //defaultZpos = TF ? GROUP_FLAG : 0; + //defaultZpos = TF ? GROUP_FLAG : 0; return; } if ("group" == propertyName) { - boolean TF = ((Boolean)value).booleanValue(); + boolean TF = ((Boolean) value).booleanValue(); int n = 0; for (int i = atomCount; --i >= 0;) if (bsSelected.get(i)) @@ -243,7 +241,7 @@ defaultOffset = defaultOffset & ~ZPOS_FLAGS | (TF ? GROUP_FLAG : 0); //FindBugs mission accomplished! //if (n == 0 || !defaultsOnlyForNone) - //defaultZpos = TF ? GROUP_FLAG : 0; + //defaultZpos = TF ? GROUP_FLAG : 0; return; } @@ -278,18 +276,18 @@ else atomLabels.put(atoms[i], text); } - + Text getLabel(int i) { return (Text) atomLabels.get(atoms[i]); } - + void setColix(int i, short colix, byte pid, int n) { setColixAndPalette(colix, pid, i); text = getLabel(i); if (text != null) text.setColix(colixes[i]); } - + void setBgcolix(int i, short bgcolix, int n) { if (bgcolixes == null || i >= bgcolixes.length) { if (bgcolix == 0) @@ -302,14 +300,14 @@ if (text != null) text.setBgColix(bgcolix); } - + final static int ZPOS_FLAGS = 0x30; final static int FRONT_FLAG = 0x20; final static int GROUP_FLAG = 0x10; final static int POINTER_FLAGS = 0x3; final static int ALIGN_FLAGS = 0xC; final static int FLAGS = 0x3F; - + void setOffsets(int i, int offset, int n) { //entry is just xxxxxxxxyyyyyyyy // xxxxxxxxyyyyyyyyfgaabp @@ -340,7 +338,7 @@ if (text != null) text.setAlignment(alignment); } - + void setPointer(int i, int pointer, int n) { if (offsets == null || i >= offsets.length) { if (pointer == Text.POINTER_NONE) @@ -352,25 +350,25 @@ if (text != null) text.setPointer(pointer); } - + void setFront(int i, boolean TF, int n) { if (offsets == null || i >= offsets.length) { if (!TF) return; offsets = ArrayUtil.ensureLength(offsets, i + 1); } - offsets[i] = (offsets[i] & ~ZPOS_FLAGS) + (TF? FRONT_FLAG : 0); + offsets[i] = (offsets[i] & ~ZPOS_FLAGS) + (TF ? FRONT_FLAG : 0); } - + void setGroup(int i, boolean TF, int n) { if (offsets == null || i >= offsets.length) { if (!TF) return; offsets = ArrayUtil.ensureLength(offsets, i + 1); } - offsets[i] = (offsets[i] & ~ZPOS_FLAGS) + (TF? GROUP_FLAG : 0); + offsets[i] = (offsets[i] & ~ZPOS_FLAGS) + (TF ? GROUP_FLAG : 0); } - + void setFont(int i, byte fid, int n) { if (fids == null || i >= fids.length) { if (fid == zeroFontId) @@ -381,39 +379,38 @@ bsFontSet.set(i); text = getLabel(i); if (text != null) - text.setFid(fid); + text.setFid(fid); } - - public void setModelClickability() { + + public void setModelClickability() { if (strings == null) return; for (int i = strings.length; --i >= 0;) { String label = strings[i]; - if (label != null && modelSet.atoms.length > i && !modelSet.isAtomHidden(i)) + if (label != null && modelSet.atoms.length > i + && !modelSet.isAtomHidden(i)) modelSet.atoms[i].setClickable(myVisibilityFlag); } } - + public void getDefaultState(StringBuffer s) { appendCmd(s, "\n# label defaults;\nselect none"); - appendCmd(s, getColorCommand("label", defaultPaletteID, - defaultColix)); + appendCmd(s, getColorCommand("label", defaultPaletteID, defaultColix)); appendCmd(s, "background label " + encodeColor(defaultBgcolix)); appendCmd(s, "labelOffset = " + Text.getXOffset(defaultOffset) + " " + (-Text.getYOffset(defaultOffset))); String align = Text.getAlignment(defaultAlignment); appendCmd(s, "labelAlignment = " + (align.length() < 5 ? "left" : align)); String pointer = Text.getPointer(defaultPointer); - appendCmd(s, "labelPointer = " - + (pointer.length() == 0 ? "off" : pointer)); + appendCmd(s, "labelPointer = " + (pointer.length() == 0 ? "off" : pointer)); if ((defaultOffset & FRONT_FLAG) != 0) appendCmd(s, "set labelFront"); if ((defaultOffset & GROUP_FLAG) != 0) appendCmd(s, "set labelGroup"); appendCmd(s, getFontCommand("label", Font3D.getFont3D(defaultFontId))); - } + } - public String getShapeState() { + public String getShapeState() { if (!isActive) return ""; Hashtable temp = new Hashtable(); @@ -430,9 +427,8 @@ setStateInfo(temp2, i, "background label " + encodeColor(bgcolixes[i])); if (offsets != null && offsets.length > i) { int offset = offsets[i]; - setStateInfo(temp2, i, "labelOffset = " - + Text.getXOffset(offset >> 6) + " " - + (-Text.getYOffset(offset >> 6))); + setStateInfo(temp2, i, "labelOffset = " + Text.getXOffset(offset >> 6) + + " " + (-Text.getYOffset(offset >> 6))); String align = Text.getAlignment(offset >> 2); String pointer = Text.getPointer(offset); if (pointer.length() > 0) @@ -443,14 +439,14 @@ setStateInfo(temp2, i, "set labelGroup"); //labelAlignment must come last, so we put it in a separate hash table if (align.length() > 0) - setStateInfo(temp3, i, "labelAlignment = " + align); + setStateInfo(temp3, i, "labelAlignment = " + align); } if (bsFontSet != null && bsFontSet.get(i)) setStateInfo(temp2, i, getFontCommand("label", Font3D .getFont3D(fids[i]))); } return getShapeCommands(temp, temp2, atomCount) - + getShapeCommands(null, temp3, atomCount) ; + + getShapeCommands(null, temp3, atomCount); } - + } Modified: trunk/Jmol/src/org/jmol/shape/Measures.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/Measures.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shape/Measures.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -61,6 +61,7 @@ } public void initShape() { + super.initShape(); font3d = g3d.getFont3D(JmolConstants.MEASURE_DEFAULT_FONTSIZE); } Modified: trunk/Jmol/src/org/jmol/shape/MeshCollection.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/MeshCollection.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shape/MeshCollection.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -74,6 +74,7 @@ } public void initShape() { + super.initShape(); colix = Graphics3D.ORANGE; modelCount = viewer.getModelCount(); } Modified: trunk/Jmol/src/org/jmol/shape/Stars.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/Stars.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shape/Stars.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -27,5 +27,5 @@ public class Stars extends AtomShape { - + // differences are in renderer } Modified: trunk/Jmol/src/org/jmol/shape/Sticks.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/Sticks.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shape/Sticks.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -29,7 +29,6 @@ import org.jmol.viewer.JmolConstants; import org.jmol.viewer.Viewer; - import java.util.BitSet; import java.util.Hashtable; @@ -38,39 +37,40 @@ import org.jmol.modelset.BondIterator; public class Sticks extends Shape { - - short myMask; + + short myMask; boolean reportAll; BitSet bsOrderSet; BitSet bsSizeSet; BitSet bsColixSet; - - public void initShape() { + + public void initShape() { + super.initShape(); myMask = JmolConstants.BOND_COVALENT_MASK; reportAll = false; } - public void setSize(int size, BitSet bsSelected) { + public void setSize(int size, BitSet bsSelected) { if (bsSizeSet == null) bsSizeSet = new BitSet(); boolean isBonds = viewer.isBondSelection(); - BondIterator iter = (isBonds ? modelSet.getBondIterator(bsSelected) : modelSet - .getBondIterator(myMask, bsSelected)); + BondIterator iter = (isBonds ? modelSet.getBondIterator(bsSelected) + : modelSet.getBondIterator(myMask, bsSelected)); short mad = (short) size; while (iter.hasNext()) { bsSizeSet.set(iter.nextIndex()); iter.next().setMad(mad); } } - - public void setProperty(String propertyName, Object value, BitSet bsSelected) { + + public void setProperty(String propertyName, Object value, BitSet bsSelected) { if (Logger.isActiveLevel(Logger.LEVEL_DEBUG)) { Logger.debug(propertyName + " " + value + " " + bsSelected); } boolean isBonds = viewer.isBondSelection(); if ("type" == propertyName) { - myMask = ((Integer)value).shortValue(); + myMask = ((Integer) value).shortValue(); return; } if ("reportAll" == propertyName) { @@ -91,8 +91,8 @@ if (bsOrderSet == null) bsOrderSet = new BitSet(); short order = ((Short) value).shortValue(); - BondIterator iter = (isBonds ? modelSet.getBondIterator(bsSelected) : modelSet - .getBondIterator(myMask, bsSelected)); + BondIterator iter = (isBonds ? modelSet.getBondIterator(bsSelected) + : modelSet.getBondIterator(myMask, bsSelected)); while (iter.hasNext()) { bsOrderSet.set(iter.nextIndex()); iter.next().setOrder(order); @@ -117,8 +117,8 @@ } if (colix == Graphics3D.USE_PALETTE) return; //palettes not implemented for bonds - BondIterator iter = (isBonds ? modelSet.getBondIterator(bsSelected) : modelSet - .getBondIterator(myMask, bsSelected)); + BondIterator iter = (isBonds ? modelSet.getBondIterator(bsSelected) + : modelSet.getBondIterator(myMask, bsSelected)); while (iter.hasNext()) { int iBond = iter.nextIndex(); Bond bond = iter.next(); @@ -131,8 +131,8 @@ if (bsColixSet == null) bsColixSet = new BitSet(); boolean isTranslucent = (((String) value).equals("translucent")); - BondIterator iter = (isBonds ? modelSet.getBondIterator(bsSelected) : modelSet - .getBondIterator(myMask, bsSelected)); + BondIterator iter = (isBonds ? modelSet.getBondIterator(bsSelected) + : modelSet.getBondIterator(myMask, bsSelected)); while (iter.hasNext()) { bsColixSet.set(iter.nextIndex()); iter.next().setTranslucent(isTranslucent, translucentLevel); @@ -142,7 +142,7 @@ super.setProperty(propertyName, value, bsSelected); } - public void setModelClickability() { + public void setModelClickability() { Bond[] bonds = modelSet.getBonds(); for (int i = modelSet.getBondCount(); --i >= 0;) { Bond bond = bonds[i]; @@ -154,8 +154,8 @@ bond.getAtom2().setClickable(myVisibilityFlag); } } - - public String getShapeState() { + + public String getShapeState() { Hashtable temp = new Hashtable(); Bond[] bonds = modelSet.getBonds(); for (int i = modelSet.getBondCount(); --i >= 0;) { @@ -171,5 +171,5 @@ setStateInfo(temp, i, getColorCommand("bonds", bond.getColix())); } return getShapeCommands(temp, null, -1, "select BONDS") + "\n"; - } + } } Modified: trunk/Jmol/src/org/jmol/shape/TextShape.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/TextShape.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shape/TextShape.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -34,7 +34,7 @@ import javax.vecmath.Point3f; -public class TextShape extends Shape { +public abstract class TextShape extends Shape { // echo, hover Modified: trunk/Jmol/src/org/jmol/shape/Uccage.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/Uccage.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shape/Uccage.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -23,17 +23,16 @@ */ package org.jmol.shape; - public class Uccage extends FontLineShape { - - public String getShapeState() { + + public String getShapeState() { if (modelSet.getCellInfos() == null) return ""; return super.getShapeState(); } - - public void initShape() { - myType = "unitcell"; + + public void initShape() { super.initShape(); + myType = "unitcell"; } } Modified: trunk/Jmol/src/org/jmol/shapebio/Backbone.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/Backbone.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shapebio/Backbone.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -32,12 +32,12 @@ public class Backbone extends BioShapeCollection { public void initShape() { + super.initShape(); madOn = 1; madHelixSheet = 1500; madTurnRandom = 500; madDnaRna = 2000; isActive = true; - super.initShape(); } public void setSize(int size, BitSet bsSelected) { Modified: trunk/Jmol/src/org/jmol/shapebio/BioShape.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/BioShape.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shapebio/BioShape.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -208,6 +208,8 @@ private short setMad(int groupIndex, short mad) { //undocumented bsSizeDefault.set(groupIndex, mad == -1 || mad == -2); + if (mad >= 0) + return mad; switch (mad) { case -1: // trace on case -2: // trace structure Modified: trunk/Jmol/src/org/jmol/shapebio/Cartoon.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/Cartoon.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shapebio/Cartoon.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -24,11 +24,10 @@ package org.jmol.shapebio; -public class Cartoon extends BioShapeCollection { +public class Cartoon extends Rockets { public void initShape() { - madTurnRandom = 500; - madDnaRna = 1000; super.initShape(); + madDnaRna = 1000; } } Modified: trunk/Jmol/src/org/jmol/shapebio/MeshRibbon.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/MeshRibbon.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shapebio/MeshRibbon.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -24,6 +24,12 @@ package org.jmol.shapebio; -public class MeshRibbon extends BioShapeCollection { - //differences are in renderer only +public class MeshRibbon extends Strands { + + public void initShape() { + super.initShape(); + strandCount = 7; + isMesh = true; + } + } Modified: trunk/Jmol/src/org/jmol/shapebio/MeshRibbonRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/MeshRibbonRenderer.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shapebio/MeshRibbonRenderer.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -28,9 +28,8 @@ public class MeshRibbonRenderer extends StrandsRenderer { protected void renderBioShape(BioShape bioShape) { - if (wingVectors == null) + if (!setStrandCount()) return; - setStrandCount(7); float offset = ((strandCount >> 1) * strandSeparation) + baseOffset; render2Strand(false, offset, offset); render1(); Modified: trunk/Jmol/src/org/jmol/shapebio/Rockets.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/Rockets.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shapebio/Rockets.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -27,6 +27,7 @@ public class Rockets extends BioShapeCollection { public void initShape() { + super.initShape(); madTurnRandom = 500; } } Modified: trunk/Jmol/src/org/jmol/shapebio/Strands.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/Strands.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shapebio/Strands.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -35,11 +35,12 @@ *==============================================================*/ int strandCount = 5; - + boolean isMesh = false; + public void setProperty(String propertyName, Object value, BitSet bs) { initialize(); if ("strandCount" == propertyName) { - strandCount = Math.min(20, Math.max(0, ((Integer) value).intValue())); + strandCount = Math.min(20, Math.max(0, ((Integer)value).intValue())); return; } super.setProperty(propertyName, value, bs); @@ -53,7 +54,7 @@ } public String getShapeState() { - return "strandCount = " + strandCount + ";\n" + return (isMesh ? "" : "strandCount = " + strandCount + ";\n") + super.getShapeState(); } } Modified: trunk/Jmol/src/org/jmol/shapebio/StrandsRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/StrandsRenderer.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shapebio/StrandsRenderer.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -33,17 +33,19 @@ protected float baseOffset; protected void renderBioShape(BioShape bioShape) { - if (wingVectors == null) + if (!setStrandCount()) return; - setStrandCount(((Strands) shape).strandCount); render1(); } - protected void setStrandCount(int strandCount) { - this.strandCount = strandCount; + protected boolean setStrandCount() { + if (wingVectors == null) + return false; + strandCount =((Strands) shape).strandCount; strandSeparation = (strandCount <= 1) ? 0 : 1f / (strandCount - 1); baseOffset = ((strandCount & 1) == 0 ? strandSeparation / 2 : strandSeparation); + return true; } protected void render1() { Modified: trunk/Jmol/src/org/jmol/shapebio/Trace.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/Trace.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/shapebio/Trace.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -27,11 +27,11 @@ public class Trace extends BioShapeCollection { public void initShape() { + super.initShape(); madOn = 600; madHelixSheet = 1500; madTurnRandom = 500; madDnaRna = 1500; - super.initShape(); } } \ No newline at end of file Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2007-05-22 12:48:05 UTC (rev 7806) @@ -3,6 +3,7 @@ # bug fix for labels mysteriously disappearing. Also probably taking up HUGE amounts of hashtable space. # bug fix for hydrogen bond calculation with incomplete nucleic acid definitions. # bug fix for "set picking draw" crashing Jmol +# bug fix for strandCount not carrying over to meshRibbon # ----------------------------------------------------------------------------- Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2007-05-22 06:38:41 UTC (rev 7805) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2007-05-22 12:48:05 UTC (rev 7806) @@ -4021,8 +4021,13 @@ ///11.1/// if (key.equalsIgnoreCase("strandCount")) { + loadShape(JmolConstants.SHAPE_STRANDS); setShapeProperty(JmolConstants.SHAPE_STRANDS, "strandCount", - new Integer(value >= 0 && value <= 20 ? value : 5)); + new Integer(value)); + loadShape(JmolConstants.SHAPE_MESHRIBBON); + setShapeProperty(JmolConstants.SHAPE_MESHRIBBON, "strandCount", + new Integer(value)); + refresh(0, "set strandCount"); break; } if (key.equalsIgnoreCase("perspectiveModel")) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |