From: <sh...@us...> - 2009-11-27 10:21:37
|
Revision: 15105 http://cdk.svn.sourceforge.net/cdk/?rev=15105&view=rev Author: shk3 Date: 2009-11-27 10:21:29 +0000 (Fri, 27 Nov 2009) Log Message: ----------- the mergeMolecules now works properly with separate atom containers Modified Paths: -------------- jchempaint/trunk/src/main/org/openscience/jchempaint/controller/ControllerHub.java Modified: jchempaint/trunk/src/main/org/openscience/jchempaint/controller/ControllerHub.java =================================================================== --- jchempaint/trunk/src/main/org/openscience/jchempaint/controller/ControllerHub.java 2009-11-26 18:01:10 UTC (rev 15104) +++ jchempaint/trunk/src/main/org/openscience/jchempaint/controller/ControllerHub.java 2009-11-27 10:21:29 UTC (rev 15105) @@ -2040,7 +2040,7 @@ List<List<IBond>> removedBondss = new ArrayList<List<IBond>>(); List<Map<IBond, Integer>> bondsWithReplacedAtoms = new ArrayList<Map<IBond, Integer>>(); List<IAtom> mergedPartnerAtoms = new ArrayList<IAtom>(); - //Done shifting, now the actual merging. + //Done shifting, now the actual merging. it = model.getMerge().keySet().iterator(); while (it.hasNext()) { List<IBond> removedBonds = new ArrayList<IBond>(); @@ -2055,6 +2055,12 @@ containers.add(container); IAtomContainer container2 = ChemModelManipulator .getRelevantAtomContainer(chemModel, mergedPartnerAtom); + //If the atoms are in different atom containers till now, we merge + //the atom containers first. + if(container!=container2){ + container.add(container2); + chemModel.getMoleculeSet().removeAtomContainer(container2); + } // In the next loop we remove bonds that are redundant, that is // to say bonds that exist on both sides of the parts to be merged @@ -2070,7 +2076,6 @@ atom2) != null) { if (model.getMerge().get(atom).equals( atom2)) { - System.out.println("removing "); IBond redundantBond = container .getBond(atom, mergedAtom); container.removeBond(redundantBond); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |