From: <sh...@us...> - 2008-10-06 15:09:25
|
Revision: 12559 http://cdk.svn.sourceforge.net/cdk/?rev=12559&view=rev Author: shk3 Date: 2008-10-06 15:06:39 +0000 (Mon, 06 Oct 2008) Log Message: ----------- mol files are now scaled to angstrom (roughly) Modified Paths: -------------- cdk/branches/cdk-1.0.x/changelog.txt cdk/branches/cdk-1.0.x/src/org/openscience/cdk/applications/jchempaint/action/SaveAsAction.java Modified: cdk/branches/cdk-1.0.x/changelog.txt =================================================================== --- cdk/branches/cdk-1.0.x/changelog.txt 2008-10-06 14:17:47 UTC (rev 12558) +++ cdk/branches/cdk-1.0.x/changelog.txt 2008-10-06 15:06:39 UTC (rev 12559) @@ -12,6 +12,8 @@ - Direct entry of smiles now works in applet as well - Synchronized menus of application and applet - After zoom to 100%, the molecule is centred on screen +- Undo/redo of cleanup works +- mol files are now scaled to angstrom (roughly) commit ca4d452a3596c2ad0356e728c272092fd591ca77 Author: shk3 <shk3@eb4e18e3-b210-0410-a6ab-dec725e4b171> Modified: cdk/branches/cdk-1.0.x/src/org/openscience/cdk/applications/jchempaint/action/SaveAsAction.java =================================================================== --- cdk/branches/cdk-1.0.x/src/org/openscience/cdk/applications/jchempaint/action/SaveAsAction.java 2008-10-06 14:17:47 UTC (rev 12558) +++ cdk/branches/cdk-1.0.x/src/org/openscience/cdk/applications/jchempaint/action/SaveAsAction.java 2008-10-06 15:06:39 UTC (rev 12559) @@ -50,9 +50,11 @@ import org.openscience.cdk.applications.jchempaint.io.IJCPFileFilter; import org.openscience.cdk.applications.jchempaint.io.JCPFileView; import org.openscience.cdk.applications.jchempaint.io.JCPSaveFileFilter; +import org.openscience.cdk.interfaces.IAtom; import org.openscience.cdk.interfaces.IAtomContainer; import org.openscience.cdk.interfaces.IChemModel; import org.openscience.cdk.interfaces.IChemObject; +import org.openscience.cdk.interfaces.IMoleculeSet; import org.openscience.cdk.io.CDKSourceCodeWriter; import org.openscience.cdk.io.IChemObjectWriter; import org.openscience.cdk.io.MDLWriter; @@ -60,6 +62,7 @@ import org.openscience.cdk.io.SVGWriter; import org.openscience.cdk.io.listener.SwingGUIListener; import org.openscience.cdk.tools.manipulator.ChemModelManipulator; +import org.openscience.cdk.tools.manipulator.MoleculeSetManipulator; /** * Opens a "Save as" dialog @@ -249,11 +252,27 @@ cow.addChemObjectIOListener(new SwingGUIListener(jcpPanel, 4)); } org.openscience.cdk.interfaces.IMoleculeSet som = model.getMoleculeSet(); + this.updateMoleculeCoordinates(som); cow.write(som); cow.close(); return outFile; } + private void updateMoleculeCoordinates(IMoleculeSet som){ + Iterator atomCons = som.molecules(); + while (atomCons.hasNext()) { + IAtomContainer atomCon = (IAtomContainer)atomCons.next(); + for (int i = 0; i < atomCon.getAtomCount(); i++) + { + IAtom currentAtom = atomCon.getAtom(i); + if(jcpPanel.getJChemPaintModel().getRendererModel().getRenderingCoordinate(currentAtom)!=null){ + currentAtom.setPoint2d(new Point2d((Point2d)jcpPanel.getJChemPaintModel().getRendererModel().getRenderingCoordinate(currentAtom))); + currentAtom.setPoint2d(new Point2d(currentAtom.getPoint2d().x*0.0422,currentAtom.getPoint2d().y*0.0422)); + } + } + } + } + protected File saveAsCML2(IChemObject object, File outFile) throws Exception { if(Float.parseFloat(System.getProperty("java.specification.version"))<1.5){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |