+ protected void processselectionChanged(BS arg0, AtomSpec[] lastHighlighted)
+ {
+ int atom = arg0.nextSetBit(0);
+ int modelNo=-1,resNo=-1;
+ String chainCode="NOCHAIN";
+ List<AtomSpec> toSelect = new ArrayList<AtomSpec>();
+ while (atom>-1 && arg0.get(atom)){
+ //
+ Model atomModel = jmolViewer.getModelForAtomIndex(atom);
+ Atom firstAtom = atomModel.ms.getAtom(atom);
+ String chcode = firstAtom.getChainIDStr();
+ if (atomModel.modelIndex!=modelNo || resNo != firstAtom.getResno() || !chainCode.equals(chcode))
+ {
+ resNo = firstAtom.getResno();
+ modelNo = atomModel.modelIndex;
+ chainCode = chcode;
+ boolean ignore=false;
+ String modelFile = getPdbEntry(modelNo).getFile();
+ if (lastHighlighted!=null)
+ {
+
+ for (AtomSpec hgh:lastHighlighted)
+ {
+ if (hgh.getPdbResNum() == resNo && chainCode.equals(hgh.getChain()) && hgh.getPdbFile().equals(modelFile))
+ {
+ ignore=true;
+ break;
+ }
+ }
+ }
+ if (!ignore)
+ {
+ AtomSpec atomspec = new AtomSpec(modelFile, chainCode, resNo, atomModel.firstAtomIndex);
+ toSelect.add(atomspec);
+ }
+ }
+ // look for next selected atom
+ atom = arg0.nextSetBit(++atom);
+ }
+ if (toSelect.size()>0 || arg0.isEmpty())
+ {
+ // if we have ignored everything we don't clear the existing highlight
+ getSsm().mouseOverStructure(toSelect);
+ }
+ }
+
+