Revision: 20903 http://sourceforge.net/p/jmol/code/20903 Author: hansonr Date: 2015-12-23 08:23:37 +0000 (Wed, 23 Dec 2015) Log Message: ----------- Jmol.___JmolVersion="14.4.1_2015.12.23"
bug fix: PyMOL 1.8 PSE files cannot be read bug fix: dots broken when colored none bug fix: color cartoons red blue not saved in state bug fix: color cartoons red blue flipping red/blue in sheets Modified Paths: -------------- branches/v14_4/Jmol/src/org/jmol/render/MeshRenderer.java branches/v14_4/Jmol/src/org/jmol/renderbio/BioShapeRenderer.java branches/v14_4/Jmol/src/org/jmol/shape/AtomShape.java branches/v14_4/Jmol/src/org/jmol/shapebio/BioShape.java branches/v14_4/Jmol/src/org/jmol/shapebio/BioShapeCollection.java branches/v14_4/Jmol/src/org/jmol/shapespecial/Dots.java branches/v14_4/Jmol/src/org/jmol/viewer/Jmol.properties branches/v14_4/Jmol/src/org/jmol/viewer/JmolStateCreator.java branches/v14_4/Jmol/src/org/jmol/viewer/StateCreator.java branches/v14_4/Jmol/src/org/jmol/viewer/Viewer.java trunk/Jmol/src/org/jmol/render/MeshRenderer.java trunk/Jmol/src/org/jmol/renderbio/BioShapeRenderer.java trunk/Jmol/src/org/jmol/shape/AtomShape.java trunk/Jmol/src/org/jmol/shapebio/BioShape.java trunk/Jmol/src/org/jmol/shapebio/BioShapeCollection.java trunk/Jmol/src/org/jmol/shapespecial/Dots.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/JmolStateCreator.java trunk/Jmol/src/org/jmol/viewer/StateCreator.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: branches/v14_4/Jmol/src/org/jmol/render/MeshRenderer.java =================================================================== --- branches/v14_4/Jmol/src/org/jmol/render/MeshRenderer.java 2015-12-23 04:42:24 UTC (rev 20902) +++ branches/v14_4/Jmol/src/org/jmol/render/MeshRenderer.java 2015-12-23 08:23:37 UTC (rev 20903) @@ -25,8 +25,15 @@ +import javajs.util.AU; +import javajs.util.M4; +import javajs.util.P3; +import javajs.util.P3i; +import javajs.util.P4; +import javajs.util.T3; +import javajs.util.V3; + import org.jmol.api.SymmetryInterface; -import org.jmol.g3d.Graphics3D; import org.jmol.java.BS; import org.jmol.script.T; import org.jmol.shape.Mesh; @@ -34,14 +41,6 @@ import org.jmol.util.GData; import org.jmol.util.MeshSurface; -import javajs.util.AU; -import javajs.util.M4; -import javajs.util.P3; -import javajs.util.P3i; -import javajs.util.P4; -import javajs.util.T3; -import javajs.util.V3; - /** * an abstract class subclasssed by BioShapeRenderer, DrawRenderer, and IsosurfaceRenderer */ Modified: branches/v14_4/Jmol/src/org/jmol/renderbio/BioShapeRenderer.java =================================================================== --- branches/v14_4/Jmol/src/org/jmol/renderbio/BioShapeRenderer.java 2015-12-23 04:42:24 UTC (rev 20902) +++ branches/v14_4/Jmol/src/org/jmol/renderbio/BioShapeRenderer.java 2015-12-23 08:23:37 UTC (rev 20903) @@ -404,10 +404,10 @@ // cartoons and meshRibbon setNeighbors(i); - colix = getLeadColix(i); + short c0 = colix = getLeadColix(i); if (!setBioColix(colix)) return; - colixBack = getLeadColixBack(i); + short cb = colixBack = getLeadColixBack(i); if (doFill && (aspectRatio != 0 || isExport)) { if (setMads(i, thisTypeOnly) || isExport) { try { @@ -415,22 +415,31 @@ && !createMesh(i, madBeg, madMid, madEnd, aspectRatio, isNucleic ? 4 : 7)) return; meshes[i].setColix(colix); - meshes[i].setColixBack(colixBack); + meshes[i].setColixBack(cb); bsRenderMesh.set(i); - return; } catch (Exception e) { bsRenderMesh.clear(i); meshes[i] = null; Logger.error("render mesh error hermiteRibbon: " + e.toString()); //System.out.println(e.getMessage()); } + return; } } - g3d.drawHermite7(doFill, ribbonBorder, (reversed.get(i) ? -1 : 1) * (isNucleic ? 4 : 7), + boolean isReversed = reversed.get(i); + if (isReversed && colixBack != 0) { + setColix(colixBack); + cb = c0; + } + g3d.drawHermite7(doFill, ribbonBorder, (isReversed ? -1 : 1) * (isNucleic ? 4 : 7), ribbonTopScreens[iPrev], ribbonTopScreens[i], ribbonTopScreens[iNext], ribbonTopScreens[iNext2], ribbonBottomScreens[iPrev], ribbonBottomScreens[i], ribbonBottomScreens[iNext], - ribbonBottomScreens[iNext2], (int) aspectRatio, colixBack); + ribbonBottomScreens[iNext2], (int) aspectRatio, cb); + if (isReversed && colixBack != 0) { + setColix(c0); + cb = colixBack; + } } //// cardinal hermite (box or flat) arrow head (cartoon) Modified: branches/v14_4/Jmol/src/org/jmol/shape/AtomShape.java =================================================================== --- branches/v14_4/Jmol/src/org/jmol/shape/AtomShape.java 2015-12-23 04:42:24 UTC (rev 20902) +++ branches/v14_4/Jmol/src/org/jmol/shape/AtomShape.java 2015-12-23 08:23:37 UTC (rev 20903) @@ -25,16 +25,14 @@ package org.jmol.shape; +import javajs.util.AU; + import org.jmol.atomdata.RadiusData; import org.jmol.atomdata.RadiusData.EnumType; import org.jmol.c.PAL; import org.jmol.c.VDW; import org.jmol.java.BS; import org.jmol.modelset.Atom; -import org.jmol.modelset.Group; - -import javajs.util.AU; - import org.jmol.util.BSUtil; import org.jmol.util.C; @@ -53,10 +51,6 @@ public int monomerCount; public BS bsSizeDefault; - public Group[] getMonomers() { - return null; - } - @Override public void initShape() { // nothing to do @@ -167,13 +161,8 @@ if ("translucency" == propertyName) { isActive = true; boolean isTranslucent = (value.equals("translucent")); - if (bsColixSet == null) - bsColixSet = new BS(); + checkColixLength(C.BLACK, ac); for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) { - if (colixes == null) { - colixes = new short[ac]; - paletteIDs = new byte[ac]; - } colixes[i] = C.getColixTranslucent3(colixes[i], isTranslucent, translucentLevel); if (isTranslucent) Modified: branches/v14_4/Jmol/src/org/jmol/shapebio/BioShape.java =================================================================== --- branches/v14_4/Jmol/src/org/jmol/shapebio/BioShape.java 2015-12-23 04:42:24 UTC (rev 20902) +++ branches/v14_4/Jmol/src/org/jmol/shapebio/BioShape.java 2015-12-23 08:23:37 UTC (rev 20903) @@ -25,10 +25,15 @@ package org.jmol.shapebio; +import java.util.Map; + +import javajs.util.AU; +import javajs.util.PT; +import javajs.util.V3; + import org.jmol.c.PAL; import org.jmol.java.BS; import org.jmol.modelset.Atom; -import org.jmol.modelset.Group; import org.jmol.modelset.ModelSet; import org.jmol.modelsetbio.AlphaPolymer; import org.jmol.modelsetbio.BioPolymer; @@ -37,11 +42,9 @@ import org.jmol.modelsetbio.NucleicPolymer; import org.jmol.shape.AtomShape; import org.jmol.shape.Mesh; +import org.jmol.util.BSUtil; import org.jmol.util.C; import org.jmol.util.Logger; - -import javajs.util.AU; -import javajs.util.V3; import org.jmol.viewer.JC; public class BioShape extends AtomShape { @@ -66,11 +69,6 @@ public Monomer[] monomers; - @Override - public Group[] getMonomers() { - return monomers; - } - public V3[] wingVectors; int[] leadAtomIndices; @@ -285,29 +283,39 @@ void setColixBS(short colix, byte pid, BS bsSelected) { isActive = true; if (bsColixSet == null) - bsColixSet = new BS(); + bsColixSet = BS.newN(monomerCount); for (int i = monomerCount; --i >= 0;) { int atomIndex = leadAtomIndices[i]; if (bsSelected.get(atomIndex)) { colixes[i] = shape.getColixI(colix, pid, atomIndex); if (colixesBack != null && colixesBack.length > i) - colixesBack[i] = 0; + colixesBack[i] = C.INHERIT_ALL; paletteIDs[i] = pid; bsColixSet.setBitTo(i, colixes[i] != C.INHERIT_ALL); } } } + void setColixBack(short colix, BS bsSelected) { + if (colixesBack == null) + colixesBack = new short[colixes.length]; + if (colixesBack.length < colixes.length) + colixesBack = AU.ensureLengthShort(colixesBack, colixes.length); + for (int i = monomerCount; --i >= 0;) + if (bsSelected.get(leadAtomIndices[i])) + colixesBack[i] = colix; + } + void setColixes(short[] atomColixes, BS bsSelected) { isActive = true; if (bsColixSet == null) - bsColixSet = new BS(); + bsColixSet = BS.newN(monomerCount); for (int i = monomerCount; --i >= 0;) { int atomIndex = leadAtomIndices[i]; if (bsSelected.get(atomIndex) && i < colixes.length && atomIndex < atomColixes.length) { colixes[i] = shape.getColixI(atomColixes[atomIndex], PAL.UNKNOWN.id, atomIndex); if (colixesBack != null && i < colixesBack.length) - colixesBack[i] = 0; + colixesBack[i] = C.INHERIT_ALL; paletteIDs[i] = PAL.UNKNOWN.id; bsColixSet.set(i); } @@ -325,7 +333,7 @@ isActive = true; if (bsColixSet == null) - bsColixSet = new BS(); + bsColixSet = BS.newN(monomerCount); int n = atomMap.length; for (int i = monomerCount; --i >= 0;) { int atomIndex = leadAtomIndices[i]; @@ -344,25 +352,10 @@ } } - - - void setColixBack(short colix, BS bsSelected) { - for (int i = monomerCount; --i >= 0;) { - int atomIndex = leadAtomIndices[i]; - if (bsSelected.get(atomIndex)) { - if (colixesBack == null) - colixesBack = new short[colixes.length]; - if (colixesBack.length < colixes.length) - colixesBack = AU.ensureLengthShort(colixesBack, colixes.length); - colixesBack[i] = colix; - } - } - } - void setTranslucent(boolean isTranslucent, BS bsSelected, float translucentLevel) { isActive = true; if (bsColixSet == null) - bsColixSet = new BS(); + bsColixSet = BS.newN(monomerCount); for (int i = monomerCount; --i >= 0; ) if (bsSelected.get(leadAtomIndices[i])) { colixes[i] = C.getColixTranslucent3(colixes[i], isTranslucent, translucentLevel); @@ -392,4 +385,34 @@ } } + void getBioShapeState(String type, boolean translucentAllowed, + Map<String, BS> temp, Map<String, BS> temp2) { + if (monomerCount > 0) { + if (!isActive || bsSizeSet == null && bsColixSet == null) + return; + for (int i = 0; i < monomerCount; i++) { + int atomIndex1 = monomers[i].firstAtomIndex; + int atomIndex2 = monomers[i].lastAtomIndex; + if (bsSizeSet != null + && (bsSizeSet.get(i) || bsColixSet != null && bsColixSet.get(i))) {//shapes MUST have been set with a size + if (bsSizeDefault.get(i)) { + BSUtil.setMapBitSet(temp, atomIndex1, atomIndex2, + type + (bsSizeSet.get(i) ? " on" : " off")); + } else { + BSUtil.setMapBitSet(temp, atomIndex1, atomIndex2, + type + " " + PT.escF(mads[i] / 2000f)); + } + } + if (bsColixSet == null || !bsColixSet.get(i)) + continue; + String s = getColorCommand(type, paletteIDs[i], colixes[i], + translucentAllowed); + if (colixesBack != null && colixesBack.length > i + && colixesBack[i] != C.INHERIT_ALL) + s += " " + C.getHexCode(colixesBack[i]); + BSUtil.setMapBitSet(temp2, atomIndex1, atomIndex2, s); + } + } + } + } \ No newline at end of file Modified: branches/v14_4/Jmol/src/org/jmol/shapebio/BioShapeCollection.java =================================================================== --- branches/v14_4/Jmol/src/org/jmol/shapebio/BioShapeCollection.java 2015-12-23 04:42:24 UTC (rev 20902) +++ branches/v14_4/Jmol/src/org/jmol/shapebio/BioShapeCollection.java 2015-12-23 08:23:37 UTC (rev 20903) @@ -25,6 +25,11 @@ package org.jmol.shapebio; +import java.util.Hashtable; +import java.util.Map; + +import javajs.util.AU; + import org.jmol.atomdata.RadiusData; import org.jmol.c.PAL; import org.jmol.java.BS; @@ -35,11 +40,9 @@ import org.jmol.modelsetbio.BioPolymer; import org.jmol.modelsetbio.Monomer; import org.jmol.shape.Shape; - -import javajs.util.AU; - import org.jmol.util.BSUtil; import org.jmol.util.C; +import org.jmol.viewer.JC; /**************************************************************** * Mps stands for Model-Polymer-Shape * @@ -180,7 +183,7 @@ for (int i = bioShapes.length; --i >= 0;) { BioShape bioShape = bioShapes[i]; if (bioShape.monomerCount > 0) { - bioShape.setColixBS(colix, (byte) 0, bsSelected); + bioShape.setColixBS(colix, PAL.PALETTE_VOLATILE, bsSelected); bioShape.setColixBack(colixBack, bsSelected); } } @@ -201,9 +204,19 @@ @Override public String getShapeState() { - return vwr.getAtomShapeSetState(this, bioShapes); + // leaving this here because it is so specialized + Map<String, BS> temp = new Hashtable<String, BS>(); + Map<String, BS> temp2 = new Hashtable<String, BS>(); + String type = JC.shapeClassBases[shapeID]; + for (int iShape = bioShapes.length; --iShape >= 0;) + bioShapes[iShape].getBioShapeState(type, translucentAllowed, temp, temp2); + String s = "\n" + + vwr.getCommands(temp, temp2, + shapeID == JC.SHAPE_BACKBONE ? "Backbone" : "select"); + return s; } + void initialize() { int modelCount = ms.mc; Model[] models = ms.am; Modified: branches/v14_4/Jmol/src/org/jmol/shapespecial/Dots.java =================================================================== --- branches/v14_4/Jmol/src/org/jmol/shapespecial/Dots.java 2015-12-23 04:42:24 UTC (rev 20902) +++ branches/v14_4/Jmol/src/org/jmol/shapespecial/Dots.java 2015-12-23 08:23:37 UTC (rev 20903) @@ -141,10 +141,8 @@ ec.setMads(mads); } mads[thisAtom] = (short) (thisRadius * 1000f); - if (colixes == null) { - colixes = new short[ac]; - paletteIDs = new byte[ac]; - } + if (colixes == null) + checkColixLength(C.BLACK, ac); colixes[thisAtom] = C.getColix(thisArgb); bsOn.set(thisAtom); //all done! @@ -271,10 +269,8 @@ } // now, calculate surface for selected atoms - if (dotsConvexMaps == null && (colixes == null || colixes.length != ac)) { - colixes = new short[ac]; - paletteIDs = new byte[ac]; - } + if (dotsConvexMaps == null && (colixes == null || colixes.length != ac)) + checkColixLength(C.BLACK, ac); ec.calculate(rd, maxRadius, bsOn, bsIgnore, !vwr.getBoolean(T.dotsurface), vwr.getBoolean(T.dotsselectedonly), isSurface, true); Modified: branches/v14_4/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- branches/v14_4/Jmol/src/org/jmol/viewer/Jmol.properties 2015-12-23 04:42:24 UTC (rev 20902) +++ branches/v14_4/Jmol/src/org/jmol/viewer/Jmol.properties 2015-12-23 08:23:37 UTC (rev 20903) @@ -7,9 +7,12 @@ # see also http://chemapps.stolaf.edu/jmol/zip for daily updates -Jmol.___JmolVersion="14.4.1_2015.12.22" +Jmol.___JmolVersion="14.4.1_2015.12.23" bug fix: PyMOL 1.8 PSE files cannot be read +bug fix: dots broken when colored none +bug fix: color cartoons red blue not saved in state +bug fix: color cartoons red blue flipping red/blue in sheets JmolVersion="14.4.1_2015.12.21" Modified: branches/v14_4/Jmol/src/org/jmol/viewer/JmolStateCreator.java =================================================================== --- branches/v14_4/Jmol/src/org/jmol/viewer/JmolStateCreator.java 2015-12-23 04:42:24 UTC (rev 20902) +++ branches/v14_4/Jmol/src/org/jmol/viewer/JmolStateCreator.java 2015-12-23 08:23:37 UTC (rev 20903) @@ -2,18 +2,17 @@ import java.util.Map; +import javajs.awt.Font; +import javajs.util.Lst; +import javajs.util.SB; + import org.jmol.java.BS; -import org.jmol.modelset.Group; import org.jmol.modelset.Measurement; import org.jmol.modelset.TickInfo; import org.jmol.shape.AtomShape; import org.jmol.shape.Measures; import org.jmol.shape.Shape; -import javajs.awt.Font; -import javajs.util.Lst; -import javajs.util.SB; - public abstract class JmolStateCreator { abstract void setViewer(Viewer vwr); @@ -31,16 +30,11 @@ abstract String getFontLineShapeState(String s, String myType, TickInfo[] tickInfos); - abstract void getShapeSetState(AtomShape atomShape, Shape shape, int monomerCount, Group[] monomers, - BS bsSizeDefault, Map<String, BS> temp, Map<String, BS> temp2); - abstract String getMeasurementState(Measures shape, Lst<Measurement> mList, int measurementCount, Font font3d, TickInfo tickInfo); abstract String getBondState(Shape shape, BS bsOrderSet, boolean reportAll); - abstract String getAtomShapeSetState(Shape shape, AtomShape[] shapes); - abstract String getShapeState(Shape shape); abstract String getCommands(Map<String, BS> htDefine, Map<String, BS> htMore, Modified: branches/v14_4/Jmol/src/org/jmol/viewer/StateCreator.java =================================================================== --- branches/v14_4/Jmol/src/org/jmol/viewer/StateCreator.java 2015-12-23 04:42:24 UTC (rev 20902) +++ branches/v14_4/Jmol/src/org/jmol/viewer/StateCreator.java 2015-12-23 08:23:37 UTC (rev 20903) @@ -23,17 +23,16 @@ package org.jmol.viewer; -import javajs.awt.Font; -import javajs.util.Lst; -import javajs.util.PT; -import javajs.util.SB; - import java.util.Arrays; import java.util.Date; import java.util.Hashtable; import java.util.Map; +import javajs.awt.Font; +import javajs.util.Lst; import javajs.util.P3; +import javajs.util.PT; +import javajs.util.SB; import org.jmol.api.JmolDataManager; import org.jmol.api.JmolModulationSet; @@ -47,7 +46,6 @@ import org.jmol.modelset.AtomCollection; import org.jmol.modelset.Bond; import org.jmol.modelset.BondSet; -import org.jmol.modelset.Group; import org.jmol.modelset.Measurement; import org.jmol.modelset.Model; import org.jmol.modelset.ModelSet; @@ -968,33 +966,6 @@ } @Override - void getShapeSetState(AtomShape as, Shape shape, int monomerCount, - Group[] monomers, BS bsSizeDefault, - Map<String, BS> temp, Map<String, BS> temp2) { - String type = JC.shapeClassBases[shape.shapeID]; - for (int i = 0; i < monomerCount; i++) { - int atomIndex1 = monomers[i].firstAtomIndex; - int atomIndex2 = monomers[i].lastAtomIndex; - if (as.bsSizeSet != null - && (as.bsSizeSet.get(i) || as.bsColixSet != null - && as.bsColixSet.get(i))) {//shapes MUST have been set with a size - if (bsSizeDefault.get(i)) { - BSUtil.setMapBitSet(temp, atomIndex1, atomIndex2, type - + (as.bsSizeSet.get(i) ? " on" : " off")); - } else { - - BSUtil.setMapBitSet(temp, atomIndex1, atomIndex2, type + " " - + PT.escF(as.mads[i] / 2000f)); - } - } - if (as.bsColixSet != null && as.bsColixSet.get(i)) - BSUtil.setMapBitSet(temp2, atomIndex1, atomIndex2, Shape - .getColorCommand(type, as.paletteIDs[i], as.colixes[i], - shape.translucentAllowed)); - } - } - - @Override String getMeasurementState(Measures shape, Lst<Measurement> mList, int measurementCount, Font font3d, @@ -1121,25 +1092,6 @@ } @Override - String getAtomShapeSetState(Shape shape, AtomShape[] bioShapes) { - clearTemp(); - for (int i = bioShapes.length; --i >= 0;) { - AtomShape bs = bioShapes[i]; - if (bs.monomerCount > 0) { - if (!bs.isActive || bs.bsSizeSet == null && bs.bsColixSet == null) - continue; - vwr.getShapeSetState(bs, shape, bs.monomerCount, bs.getMonomers(), - bs.bsSizeDefault, temp, temp2); - } - } - String s = "\n" - + getCommands(temp, temp2, - shape.shapeID == JC.SHAPE_BACKBONE ? "Backbone" : "select"); - clearTemp(); - return s; - } - - @Override String getShapeState(Shape shape) { String s; switch (shape.shapeID) { Modified: branches/v14_4/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- branches/v14_4/Jmol/src/org/jmol/viewer/Viewer.java 2015-12-23 04:42:24 UTC (rev 20902) +++ branches/v14_4/Jmol/src/org/jmol/viewer/Viewer.java 2015-12-23 08:23:37 UTC (rev 20903) @@ -8972,15 +8972,6 @@ return getStateCreator().getFontLineShapeState(s, myType, tickInfos); } - public void getShapeSetState(AtomShape atomShape, Shape shape, - int monomerCount, Group[] monomers, - BS bsSizeDefault, Map<String, BS> temp, - Map<String, BS> temp2) { - getStateCreator().getShapeSetState(atomShape, shape, monomerCount, - monomers, bsSizeDefault, temp, temp2); - - } - public String getMeasurementState(Measures measures, Lst<Measurement> mList, int measurementCount, Font font3d, TickInfo ti) { @@ -8992,10 +8983,6 @@ return getStateCreator().getBondState(shape, bsOrderSet, reportAll); } - public String getAtomShapeSetState(Shape shape, AtomShape[] shapes) { - return getStateCreator().getAtomShapeSetState(shape, shapes); - } - public String getShapeState(Shape shape) { return getStateCreator().getShapeState(shape); } Modified: trunk/Jmol/src/org/jmol/render/MeshRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/render/MeshRenderer.java 2015-12-23 04:42:24 UTC (rev 20902) +++ trunk/Jmol/src/org/jmol/render/MeshRenderer.java 2015-12-23 08:23:37 UTC (rev 20903) @@ -25,8 +25,15 @@ +import javajs.util.AU; +import javajs.util.M4; +import javajs.util.P3; +import javajs.util.P3i; +import javajs.util.P4; +import javajs.util.T3; +import javajs.util.V3; + import org.jmol.api.SymmetryInterface; -import org.jmol.g3d.Graphics3D; import org.jmol.java.BS; import org.jmol.script.T; import org.jmol.shape.Mesh; @@ -34,14 +41,6 @@ import org.jmol.util.GData; import org.jmol.util.MeshSurface; -import javajs.util.AU; -import javajs.util.M4; -import javajs.util.P3; -import javajs.util.P3i; -import javajs.util.P4; -import javajs.util.T3; -import javajs.util.V3; - /** * an abstract class subclasssed by BioShapeRenderer, DrawRenderer, and IsosurfaceRenderer */ Modified: trunk/Jmol/src/org/jmol/renderbio/BioShapeRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/renderbio/BioShapeRenderer.java 2015-12-23 04:42:24 UTC (rev 20902) +++ trunk/Jmol/src/org/jmol/renderbio/BioShapeRenderer.java 2015-12-23 08:23:37 UTC (rev 20903) @@ -404,10 +404,10 @@ // cartoons and meshRibbon setNeighbors(i); - colix = getLeadColix(i); + short c0 = colix = getLeadColix(i); if (!setBioColix(colix)) return; - colixBack = getLeadColixBack(i); + short cb = colixBack = getLeadColixBack(i); if (doFill && (aspectRatio != 0 || isExport)) { if (setMads(i, thisTypeOnly) || isExport) { try { @@ -415,22 +415,31 @@ && !createMesh(i, madBeg, madMid, madEnd, aspectRatio, isNucleic ? 4 : 7)) return; meshes[i].setColix(colix); - meshes[i].setColixBack(colixBack); + meshes[i].setColixBack(cb); bsRenderMesh.set(i); - return; } catch (Exception e) { bsRenderMesh.clear(i); meshes[i] = null; Logger.error("render mesh error hermiteRibbon: " + e.toString()); //System.out.println(e.getMessage()); } + return; } } - g3d.drawHermite7(doFill, ribbonBorder, (reversed.get(i) ? -1 : 1) * (isNucleic ? 4 : 7), + boolean isReversed = reversed.get(i); + if (isReversed && colixBack != 0) { + setColix(colixBack); + cb = c0; + } + g3d.drawHermite7(doFill, ribbonBorder, (isReversed ? -1 : 1) * (isNucleic ? 4 : 7), ribbonTopScreens[iPrev], ribbonTopScreens[i], ribbonTopScreens[iNext], ribbonTopScreens[iNext2], ribbonBottomScreens[iPrev], ribbonBottomScreens[i], ribbonBottomScreens[iNext], - ribbonBottomScreens[iNext2], (int) aspectRatio, colixBack); + ribbonBottomScreens[iNext2], (int) aspectRatio, cb); + if (isReversed && colixBack != 0) { + setColix(c0); + cb = colixBack; + } } //// cardinal hermite (box or flat) arrow head (cartoon) Modified: trunk/Jmol/src/org/jmol/shape/AtomShape.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/AtomShape.java 2015-12-23 04:42:24 UTC (rev 20902) +++ trunk/Jmol/src/org/jmol/shape/AtomShape.java 2015-12-23 08:23:37 UTC (rev 20903) @@ -53,10 +53,6 @@ public int monomerCount; public BS bsSizeDefault; - public Group[] getMonomers() { - return null; - } - @Override public void initShape() { // nothing to do @@ -167,13 +163,8 @@ if ("translucency" == propertyName) { isActive = true; boolean isTranslucent = (value.equals("translucent")); - if (bsColixSet == null) - bsColixSet = new BS(); + checkColixLength(C.BLACK, ac); for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) { - if (colixes == null) { - colixes = new short[ac]; - paletteIDs = new byte[ac]; - } colixes[i] = C.getColixTranslucent3(colixes[i], isTranslucent, translucentLevel); if (isTranslucent) Modified: trunk/Jmol/src/org/jmol/shapebio/BioShape.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/BioShape.java 2015-12-23 04:42:24 UTC (rev 20902) +++ trunk/Jmol/src/org/jmol/shapebio/BioShape.java 2015-12-23 08:23:37 UTC (rev 20903) @@ -25,10 +25,15 @@ package org.jmol.shapebio; +import java.util.Map; + +import javajs.util.AU; +import javajs.util.PT; +import javajs.util.V3; + import org.jmol.c.PAL; import org.jmol.java.BS; import org.jmol.modelset.Atom; -import org.jmol.modelset.Group; import org.jmol.modelset.ModelSet; import org.jmol.modelsetbio.AlphaPolymer; import org.jmol.modelsetbio.BioPolymer; @@ -37,11 +42,9 @@ import org.jmol.modelsetbio.NucleicPolymer; import org.jmol.shape.AtomShape; import org.jmol.shape.Mesh; +import org.jmol.util.BSUtil; import org.jmol.util.C; import org.jmol.util.Logger; - -import javajs.util.AU; -import javajs.util.V3; import org.jmol.viewer.JC; public class BioShape extends AtomShape { @@ -66,11 +69,6 @@ public Monomer[] monomers; - @Override - public Group[] getMonomers() { - return monomers; - } - public V3[] wingVectors; int[] leadAtomIndices; @@ -285,29 +283,39 @@ void setColixBS(short colix, byte pid, BS bsSelected) { isActive = true; if (bsColixSet == null) - bsColixSet = new BS(); + bsColixSet = BS.newN(monomerCount); for (int i = monomerCount; --i >= 0;) { int atomIndex = leadAtomIndices[i]; if (bsSelected.get(atomIndex)) { colixes[i] = shape.getColixI(colix, pid, atomIndex); if (colixesBack != null && colixesBack.length > i) - colixesBack[i] = 0; + colixesBack[i] = C.INHERIT_ALL; paletteIDs[i] = pid; bsColixSet.setBitTo(i, colixes[i] != C.INHERIT_ALL); } } } + void setColixBack(short colix, BS bsSelected) { + if (colixesBack == null) + colixesBack = new short[colixes.length]; + if (colixesBack.length < colixes.length) + colixesBack = AU.ensureLengthShort(colixesBack, colixes.length); + for (int i = monomerCount; --i >= 0;) + if (bsSelected.get(leadAtomIndices[i])) + colixesBack[i] = colix; + } + void setColixes(short[] atomColixes, BS bsSelected) { isActive = true; if (bsColixSet == null) - bsColixSet = new BS(); + bsColixSet = BS.newN(monomerCount); for (int i = monomerCount; --i >= 0;) { int atomIndex = leadAtomIndices[i]; if (bsSelected.get(atomIndex) && i < colixes.length && atomIndex < atomColixes.length) { colixes[i] = shape.getColixI(atomColixes[atomIndex], PAL.UNKNOWN.id, atomIndex); if (colixesBack != null && i < colixesBack.length) - colixesBack[i] = 0; + colixesBack[i] = C.INHERIT_ALL; paletteIDs[i] = PAL.UNKNOWN.id; bsColixSet.set(i); } @@ -325,7 +333,7 @@ isActive = true; if (bsColixSet == null) - bsColixSet = new BS(); + bsColixSet = BS.newN(monomerCount); int n = atomMap.length; for (int i = monomerCount; --i >= 0;) { int atomIndex = leadAtomIndices[i]; @@ -344,25 +352,10 @@ } } - - - void setColixBack(short colix, BS bsSelected) { - for (int i = monomerCount; --i >= 0;) { - int atomIndex = leadAtomIndices[i]; - if (bsSelected.get(atomIndex)) { - if (colixesBack == null) - colixesBack = new short[colixes.length]; - if (colixesBack.length < colixes.length) - colixesBack = AU.ensureLengthShort(colixesBack, colixes.length); - colixesBack[i] = colix; - } - } - } - void setTranslucent(boolean isTranslucent, BS bsSelected, float translucentLevel) { isActive = true; if (bsColixSet == null) - bsColixSet = new BS(); + bsColixSet = BS.newN(monomerCount); for (int i = monomerCount; --i >= 0; ) if (bsSelected.get(leadAtomIndices[i])) { colixes[i] = C.getColixTranslucent3(colixes[i], isTranslucent, translucentLevel); @@ -392,4 +385,34 @@ } } + void getBioShapeState(String type, boolean translucentAllowed, + Map<String, BS> temp, Map<String, BS> temp2) { + if (monomerCount > 0) { + if (!isActive || bsSizeSet == null && bsColixSet == null) + return; + for (int i = 0; i < monomerCount; i++) { + int atomIndex1 = monomers[i].firstAtomIndex; + int atomIndex2 = monomers[i].lastAtomIndex; + if (bsSizeSet != null + && (bsSizeSet.get(i) || bsColixSet != null && bsColixSet.get(i))) {//shapes MUST have been set with a size + if (bsSizeDefault.get(i)) { + BSUtil.setMapBitSet(temp, atomIndex1, atomIndex2, + type + (bsSizeSet.get(i) ? " on" : " off")); + } else { + BSUtil.setMapBitSet(temp, atomIndex1, atomIndex2, + type + " " + PT.escF(mads[i] / 2000f)); + } + } + if (bsColixSet == null || !bsColixSet.get(i)) + continue; + String s = getColorCommand(type, paletteIDs[i], colixes[i], + translucentAllowed); + if (colixesBack != null && colixesBack.length > i + && colixesBack[i] != C.INHERIT_ALL) + s += " " + C.getHexCode(colixesBack[i]); + BSUtil.setMapBitSet(temp2, atomIndex1, atomIndex2, s); + } + } + } + } \ No newline at end of file Modified: trunk/Jmol/src/org/jmol/shapebio/BioShapeCollection.java =================================================================== --- trunk/Jmol/src/org/jmol/shapebio/BioShapeCollection.java 2015-12-23 04:42:24 UTC (rev 20902) +++ trunk/Jmol/src/org/jmol/shapebio/BioShapeCollection.java 2015-12-23 08:23:37 UTC (rev 20903) @@ -25,6 +25,11 @@ package org.jmol.shapebio; +import java.util.Hashtable; +import java.util.Map; + +import javajs.util.AU; + import org.jmol.atomdata.RadiusData; import org.jmol.c.PAL; import org.jmol.java.BS; @@ -35,11 +40,9 @@ import org.jmol.modelsetbio.BioPolymer; import org.jmol.modelsetbio.Monomer; import org.jmol.shape.Shape; - -import javajs.util.AU; - import org.jmol.util.BSUtil; import org.jmol.util.C; +import org.jmol.viewer.JC; /**************************************************************** * Mps stands for Model-Polymer-Shape * @@ -67,11 +70,6 @@ public BioShape[] bioShapes; @Override - public void initShape() { - // nothing to do - } - - @Override public final void initModelSet() { isBioShape = true; atoms = ms.at; @@ -79,6 +77,11 @@ } @Override + public void initShape() { + // nothing to do + } + + @Override public int getSizeG(Group group) { Monomer m = (Monomer) group; int groupIndex = m.groupIndex; @@ -180,7 +183,7 @@ for (int i = bioShapes.length; --i >= 0;) { BioShape bioShape = bioShapes[i]; if (bioShape.monomerCount > 0) { - bioShape.setColixBS(colix, (byte) 0, bsSelected); + bioShape.setColixBS(colix, PAL.PALETTE_VOLATILE, bsSelected); bioShape.setColixBack(colixBack, bsSelected); } } @@ -201,9 +204,19 @@ @Override public String getShapeState() { - return vwr.getAtomShapeSetState(this, bioShapes); + // leaving this here because it is so specialized + Map<String, BS> temp = new Hashtable<String, BS>(); + Map<String, BS> temp2 = new Hashtable<String, BS>(); + String type = JC.shapeClassBases[shapeID]; + for (int iShape = bioShapes.length; --iShape >= 0;) + bioShapes[iShape].getBioShapeState(type, translucentAllowed, temp, temp2); + String s = "\n" + + vwr.getCommands(temp, temp2, + shapeID == JC.SHAPE_BACKBONE ? "Backbone" : "select"); + return s; } + void initialize() { int modelCount = ms.mc; Model[] models = ms.am; Modified: trunk/Jmol/src/org/jmol/shapespecial/Dots.java =================================================================== --- trunk/Jmol/src/org/jmol/shapespecial/Dots.java 2015-12-23 04:42:24 UTC (rev 20902) +++ trunk/Jmol/src/org/jmol/shapespecial/Dots.java 2015-12-23 08:23:37 UTC (rev 20903) @@ -141,10 +141,8 @@ ec.setMads(mads); } mads[thisAtom] = (short) (thisRadius * 1000f); - if (colixes == null) { - colixes = new short[ac]; - paletteIDs = new byte[ac]; - } + if (colixes == null) + checkColixLength(C.BLACK, ac); colixes[thisAtom] = C.getColix(thisArgb); bsOn.set(thisAtom); //all done! @@ -271,10 +269,8 @@ } // now, calculate surface for selected atoms - if (dotsConvexMaps == null && (colixes == null || colixes.length != ac)) { - colixes = new short[ac]; - paletteIDs = new byte[ac]; - } + if (dotsConvexMaps == null && (colixes == null || colixes.length != ac)) + checkColixLength(C.BLACK, ac); ec.calculate(rd, maxRadius, bsOn, bsIgnore, !vwr.getBoolean(T.dotsurface), vwr.getBoolean(T.dotsselectedonly), isSurface, true); Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2015-12-23 04:42:24 UTC (rev 20902) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2015-12-23 08:23:37 UTC (rev 20903) @@ -62,9 +62,12 @@ TODO: consider if models with no atoms will cause issues in relation to model.firstAtomIndex -Jmol.___JmolVersion="14.5.1_2015.12.22" +Jmol.___JmolVersion="14.5.1_2015.12.23" bug fix: PyMOL 1.8 PSE files cannot be read +bug fix: dots broken when colored none +bug fix: color cartoons red blue not saved in state +bug fix: color cartoons red blue flipping red/blue in sheets JmolVersion="14.5.1_2015.12.21" Modified: trunk/Jmol/src/org/jmol/viewer/JmolStateCreator.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/JmolStateCreator.java 2015-12-23 04:42:24 UTC (rev 20902) +++ trunk/Jmol/src/org/jmol/viewer/JmolStateCreator.java 2015-12-23 08:23:37 UTC (rev 20903) @@ -2,18 +2,17 @@ import java.util.Map; +import javajs.awt.Font; +import javajs.util.Lst; +import javajs.util.SB; + import org.jmol.java.BS; -import org.jmol.modelset.Group; import org.jmol.modelset.Measurement; import org.jmol.modelset.TickInfo; import org.jmol.shape.AtomShape; import org.jmol.shape.Measures; import org.jmol.shape.Shape; -import javajs.awt.Font; -import javajs.util.Lst; -import javajs.util.SB; - public abstract class JmolStateCreator { abstract void setViewer(Viewer vwr); @@ -31,16 +30,11 @@ abstract String getFontLineShapeState(String s, String myType, TickInfo[] tickInfos); - abstract void getShapeSetState(AtomShape atomShape, Shape shape, int monomerCount, Group[] monomers, - BS bsSizeDefault, Map<String, BS> temp, Map<String, BS> temp2); - abstract String getMeasurementState(Measures shape, Lst<Measurement> mList, int measurementCount, Font font3d, TickInfo tickInfo); abstract String getBondState(Shape shape, BS bsOrderSet, boolean reportAll); - abstract String getAtomShapeSetState(Shape shape, AtomShape[] shapes); - abstract String getShapeState(Shape shape); abstract String getCommands(Map<String, BS> htDefine, Map<String, BS> htMore, Modified: trunk/Jmol/src/org/jmol/viewer/StateCreator.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/StateCreator.java 2015-12-23 04:42:24 UTC (rev 20902) +++ trunk/Jmol/src/org/jmol/viewer/StateCreator.java 2015-12-23 08:23:37 UTC (rev 20903) @@ -23,17 +23,16 @@ package org.jmol.viewer; -import javajs.awt.Font; -import javajs.util.Lst; -import javajs.util.PT; -import javajs.util.SB; - import java.util.Arrays; import java.util.Date; import java.util.Hashtable; import java.util.Map; +import javajs.awt.Font; +import javajs.util.Lst; import javajs.util.P3; +import javajs.util.PT; +import javajs.util.SB; import org.jmol.api.JmolDataManager; import org.jmol.api.JmolModulationSet; @@ -47,7 +46,6 @@ import org.jmol.modelset.AtomCollection; import org.jmol.modelset.Bond; import org.jmol.modelset.BondSet; -import org.jmol.modelset.Group; import org.jmol.modelset.Measurement; import org.jmol.modelset.Model; import org.jmol.modelset.ModelSet; @@ -343,6 +341,7 @@ if (sb.length() > 0) commands.append(" frame " + ms.getModelNumberDotted(i) + ";\n").appendSB(sb); } + boolean loadUC = false; if (ms.unitCells != null) { boolean haveModulation = false; @@ -973,33 +972,6 @@ } @Override - void getShapeSetState(AtomShape as, Shape shape, int monomerCount, - Group[] monomers, BS bsSizeDefault, - Map<String, BS> temp, Map<String, BS> temp2) { - String type = JC.shapeClassBases[shape.shapeID]; - for (int i = 0; i < monomerCount; i++) { - int atomIndex1 = monomers[i].firstAtomIndex; - int atomIndex2 = monomers[i].lastAtomIndex; - if (as.bsSizeSet != null - && (as.bsSizeSet.get(i) || as.bsColixSet != null - && as.bsColixSet.get(i))) {//shapes MUST have been set with a size - if (bsSizeDefault.get(i)) { - BSUtil.setMapBitSet(temp, atomIndex1, atomIndex2, type - + (as.bsSizeSet.get(i) ? " on" : " off")); - } else { - - BSUtil.setMapBitSet(temp, atomIndex1, atomIndex2, type + " " - + PT.escF(as.mads[i] / 2000f)); - } - } - if (as.bsColixSet != null && as.bsColixSet.get(i)) - BSUtil.setMapBitSet(temp2, atomIndex1, atomIndex2, Shape - .getColorCommand(type, as.paletteIDs[i], as.colixes[i], - shape.translucentAllowed)); - } - } - - @Override String getMeasurementState(Measures shape, Lst<Measurement> mList, int measurementCount, Font font3d, @@ -1126,25 +1098,6 @@ } @Override - String getAtomShapeSetState(Shape shape, AtomShape[] bioShapes) { - clearTemp(); - for (int i = bioShapes.length; --i >= 0;) { - AtomShape bs = bioShapes[i]; - if (bs.monomerCount > 0) { - if (!bs.isActive || bs.bsSizeSet == null && bs.bsColixSet == null) - continue; - vwr.getShapeSetState(bs, shape, bs.monomerCount, bs.getMonomers(), - bs.bsSizeDefault, temp, temp2); - } - } - String s = "\n" - + getCommands(temp, temp2, - shape.shapeID == JC.SHAPE_BACKBONE ? "Backbone" : "select"); - clearTemp(); - return s; - } - - @Override String getShapeState(Shape shape) { String s; switch (shape.shapeID) { Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2015-12-23 04:42:24 UTC (rev 20902) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2015-12-23 08:23:37 UTC (rev 20903) @@ -8972,15 +8972,6 @@ return getStateCreator().getFontLineShapeState(s, myType, tickInfos); } - public void getShapeSetState(AtomShape atomShape, Shape shape, - int monomerCount, Group[] monomers, - BS bsSizeDefault, Map<String, BS> temp, - Map<String, BS> temp2) { - getStateCreator().getShapeSetState(atomShape, shape, monomerCount, - monomers, bsSizeDefault, temp, temp2); - - } - public String getMeasurementState(Measures measures, Lst<Measurement> mList, int measurementCount, Font font3d, TickInfo ti) { @@ -8992,10 +8983,6 @@ return getStateCreator().getBondState(shape, bsOrderSet, reportAll); } - public String getAtomShapeSetState(Shape shape, AtomShape[] shapes) { - return getStateCreator().getAtomShapeSetState(shape, shapes); - } - public String getShapeState(Shape shape) { return getStateCreator().getShapeState(shape); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits