From: <ha...@us...> - 2007-05-20 12:25:41
|
Revision: 7764 http://svn.sourceforge.net/jmol/?rev=7764&view=rev Author: hansonr Date: 2007-05-20 05:25:38 -0700 (Sun, 20 May 2007) Log Message: ----------- 11.1.42 group ... working... Modified Paths: -------------- trunk/Jmol/src/org/jmol/modelset/Chain.java trunk/Jmol/src/org/jmol/modelset/Group.java trunk/Jmol/src/org/jmol/modelset/Mmset.java trunk/Jmol/src/org/jmol/modelset/ModelLoader.java trunk/Jmol/src/org/jmol/modelset/ModelManager.java Modified: trunk/Jmol/src/org/jmol/modelset/Chain.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/Chain.java 2007-05-20 12:24:07 UTC (rev 7763) +++ trunk/Jmol/src/org/jmol/modelset/Chain.java 2007-05-20 12:25:38 UTC (rev 7764) @@ -84,16 +84,23 @@ return modelSet.atoms[index]; } + /** + * prior to coloring by group, we need the chain count per chain + * that is selected + * + * @param bsSelected + */ public void calcSelectedGroupsCount(BitSet bsSelected) { selectedGroupCount = 0; if (bsSelectedGroups == null) bsSelectedGroups = new BitSet(); - else - BitSetUtil.clear(bsSelectedGroups); - for (int i = groupCount; --i >= 0; ) { + BitSetUtil.clear(bsSelectedGroups); + for (int i = 0; i < groupCount; i++) { if (groups[i].isSelected(bsSelected)) { - ++selectedGroupCount; + groups[i].selectedIndex = selectedGroupCount++; bsSelectedGroups.set(i); + } else { + groups[i].selectedIndex = -1; } } } @@ -145,16 +152,13 @@ return selectedGroupCount; } + /** + * + * @param group + * @return selection index within selection set + */ int getSelectedGroupIndex(Group group) { - int selectedGroupIndex = 0; - for (int i = 0; i < groupCount; ++i) { - if (bsSelectedGroups.get(i)) { - if (groups[i] == group) - return selectedGroupIndex; - ++selectedGroupIndex; - } - } - return -1; + return group.selectedIndex; } public final void updateOffsetsForAlternativeLocations(BitSet bsSelected, Modified: trunk/Jmol/src/org/jmol/modelset/Group.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/Group.java 2007-05-20 12:24:07 UTC (rev 7763) +++ trunk/Jmol/src/org/jmol/modelset/Group.java 2007-05-20 12:25:38 UTC (rev 7764) @@ -35,6 +35,7 @@ protected Chain chain; int seqcode; short groupID; + int selectedIndex; protected int firstAtomIndex = -1; protected int lastAtomIndex; @@ -287,9 +288,11 @@ } public boolean isSelected(BitSet bs) { + System.out.println("group selected? " + firstAtomIndex+" " + lastAtomIndex); for (int i = firstAtomIndex; i <= lastAtomIndex; ++i) if (bs.get(i)) return true; + System.out.println("no"); return false; } Modified: trunk/Jmol/src/org/jmol/modelset/Mmset.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/Mmset.java 2007-05-20 12:24:07 UTC (rev 7763) +++ trunk/Jmol/src/org/jmol/modelset/Mmset.java 2007-05-20 12:25:38 UTC (rev 7764) @@ -421,7 +421,7 @@ return chainCount; } - int getBioPolymerCount() { + public int getBioPolymerCount() { int polymerCount = 0; for (int i = modelCount; --i >= 0;) polymerCount += models[i].getBioPolymerCount(); Modified: trunk/Jmol/src/org/jmol/modelset/ModelLoader.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/ModelLoader.java 2007-05-20 12:24:07 UTC (rev 7763) +++ trunk/Jmol/src/org/jmol/modelset/ModelLoader.java 2007-05-20 12:25:38 UTC (rev 7764) @@ -170,7 +170,6 @@ * */ private void initializeGroupBuild() { - groupCount = 0; chains = new Chain[defaultGroupCount]; group3s = new String[defaultGroupCount]; seqcodes = new int[defaultGroupCount]; @@ -759,7 +758,7 @@ } if (group3 != null) countGroup(modelIndex, key, group3); - + System.out.println("adding group to " + chain + " g "+groupIndex + " m " + modelIndex+" "+group3); chain.addGroup(group); groups[groupIndex] = group; @@ -899,7 +898,7 @@ } // the ONLY nonprivate method in this class - + /** * allows rebuilding of PDB structures; * also accessed by ModelManager from Eval @@ -910,20 +909,26 @@ */ void calculateStructures(boolean rebuild, BitSet alreadyDefined) { if (rebuild) { -// for (int i = JmolConstants.SHAPE_MAX; --i >= 0;) - // if (JmolConstants.isShapeSecondary(i)) - // shapes[i] = null; + // for (int i = JmolConstants.SHAPE_MAX; --i >= 0;) + // if (JmolConstants.isShapeSecondary(i)) + // shapes[i] = null; if (jbr != null && groupCount > 0) jbr.clearBioPolymers(groups, groupCount, alreadyDefined); + if (alreadyDefined == null) { + alreadyDefined = new BitSet(); + groupCount = 0; + } mmset.clearStructures(alreadyDefined); initializeGroupBuild(); for (int i = 0; i < atomCount; i++) { Atom atom = atoms[i]; - if (atom.group == null) - checkNewGroup(i, atom.modelIndex, '\0', null, 0, '\0'); - else - checkNewGroup(i, atom.modelIndex, atom.getChainID(), - atom.getGroup3(), atom.getSeqNumber(), atom.getInsertionCode()); + if (!alreadyDefined.get(atom.modelIndex)) { + if (atom.group == null) + checkNewGroup(i, atom.modelIndex, '\0', null, 0, '\0'); + else + checkNewGroup(i, atom.modelIndex, atom.getChainID(), atom + .getGroup3(), atom.getSeqNumber(), atom.getInsertionCode()); + } } finalizeGroupBuild(); moleculeCount = 0; Modified: trunk/Jmol/src/org/jmol/modelset/ModelManager.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/ModelManager.java 2007-05-20 12:24:07 UTC (rev 7763) +++ trunk/Jmol/src/org/jmol/modelset/ModelManager.java 2007-05-20 12:25:38 UTC (rev 7764) @@ -1402,12 +1402,13 @@ } public void calculateStructures(int modelIndex) { + //for now, redefine all, because I don't know what is wrong. int modelCount = modelSet.getModelCount(); BitSet bsDefined = new BitSet(modelCount); for (int i = 0; i < modelCount; i++) - if (modelIndex < 0 || i != modelIndex) + if (modelIndex >= 0 && i != modelIndex) bsDefined.set(i); - modelLoader.calculateStructures(true, bsDefined); + modelLoader.calculateStructures(true, null);//bsDefined); } public boolean getEchoStateActive() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |