From: <ha...@us...> - 2006-05-25 06:25:39
|
Revision: 5170 Author: hansonr Date: 2006-05-24 23:25:31 -0700 (Wed, 24 May 2006) ViewCVS: http://svn.sourceforge.net/jmol/?rev=5170&view=rev Log Message: ----------- bob200603 adjusts measure to allow cross-model measuring in script similar to in clicking, that is, when cardinality of each point's bitset is 1. Modified Paths: -------------- branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java branches/bob200603/Jmol/src/org/jmol/viewer/Measures.java Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java 2006-05-25 05:45:51 UTC (rev 5169) +++ branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java 2006-05-25 06:25:31 UTC (rev 5170) @@ -1749,6 +1749,8 @@ runScript(defaultScript); } + //measure() see monitor() + void monitor() throws ScriptException { int[] monitorArgs = new int[5]; float[] rangeMinMax = new float[2]; Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Measures.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/viewer/Measures.java 2006-05-25 05:45:51 UTC (rev 5169) +++ branches/bob200603/Jmol/src/org/jmol/viewer/Measures.java 2006-05-25 06:25:31 UTC (rev 5170) @@ -143,14 +143,18 @@ int nPoints = monitorExpressions.size(); if (nPoints < 2) return; + boolean isOneToOne = true; + for (int i = 0; i < nPoints && isOneToOne; i++) + if (viewer.cardinalityOf((BitSet) monitorExpressions.get(i)) > 1) + isOneToOne = false; int[] atomCountPlusIndices = new int[5]; atomCountPlusIndices[0] = nPoints; - nextMeasure(0, nPoints, monitorExpressions, atomCountPlusIndices, 0); + nextMeasure(0, nPoints, monitorExpressions, atomCountPlusIndices, isOneToOne ? -1 : 0); } - void nextMeasure(int thispt, int nPoints, Vector monitorExpressions, + void nextMeasure(int thispt, int nPoints, Vector monitorExpressions, int[] atomCountPlusIndices, int thisModel) { - BitSet bs = (BitSet)monitorExpressions.get(thispt); + BitSet bs = (BitSet) monitorExpressions.get(thispt); //System.out.println("nextMeasure"+thispt+" acpi:"+atomCountPlusIndices); //System.out.println("bs "+ bs); for (int i = bs.size(); --i >= 0;) { @@ -159,17 +163,19 @@ continue; int modelIndex = frame.atoms[i].getModelIndex(); //System.out.println("nextMeasure i"+i+" modelIndex:"+modelIndex); - if (thispt == 0) { - thisModel = modelIndex; - } else if (thisModel != modelIndex) { - continue; + if (thisModel >= 0) { + if (thispt == 0) { + thisModel = modelIndex; + } else if (thisModel != modelIndex) { + continue; + } } atomCountPlusIndices[thispt + 1] = i; if (thispt == nPoints - 1) { - if (! isDefined(atomCountPlusIndices)) + if (!isDefined(atomCountPlusIndices)) define(atomCountPlusIndices); } else { - nextMeasure(thispt+1, nPoints, monitorExpressions, + nextMeasure(thispt + 1, nPoints, monitorExpressions, atomCountPlusIndices, thisModel); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |