From: <sh...@us...> - 2009-08-17 17:06:50
|
Revision: 14732 http://cdk.svn.sourceforge.net/cdk/?rev=14732&view=rev Author: shk3 Date: 2009-08-17 17:06:44 +0000 (Mon, 17 Aug 2009) Log Message: ----------- everyting in jcp needed for the undefined stereo stuff Modified Paths: -------------- jchempaint/trunk/.classpath jchempaint/trunk/src/main/org/openscience/jchempaint/action/ChangeModeAction.java jchempaint/trunk/src/main/org/openscience/jchempaint/action/CopyPasteAction.java jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JCPGUI_applet.properties jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JCPGUI_stable.properties jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JChemPaintResources.properties Added Paths: ----------- jchempaint/trunk/src/main/org/openscience/jchempaint/resources/small-bin/undefined_bond.gif jchempaint/trunk/src/main/org/openscience/jchempaint/resources/small-bin/undefined_stereo_bond.gif Modified: jchempaint/trunk/.classpath =================================================================== --- jchempaint/trunk/.classpath 2009-08-17 14:45:41 UTC (rev 14731) +++ jchempaint/trunk/.classpath 2009-08-17 17:06:44 UTC (rev 14732) @@ -12,6 +12,6 @@ <classpathentry kind="lib" path="lib/fest-util-1.1.jar"/> <classpathentry kind="lib" path="lib/fest-assert-1.1.jar"/> <classpathentry kind="lib" path="lib/fest-reflect-1.1.jar"/> - <classpathentry combineaccessrules="false" kind="src" path="/org.openscience.cdk"/> + <classpathentry combineaccessrules="false" kind="src" path="/jchempaint-primary"/> <classpathentry kind="output" path="bin"/> </classpath> Modified: jchempaint/trunk/src/main/org/openscience/jchempaint/action/ChangeModeAction.java =================================================================== --- jchempaint/trunk/src/main/org/openscience/jchempaint/action/ChangeModeAction.java 2009-08-17 14:45:41 UTC (rev 14731) +++ jchempaint/trunk/src/main/org/openscience/jchempaint/action/ChangeModeAction.java 2009-08-17 17:06:44 UTC (rev 14732) @@ -107,6 +107,14 @@ hub.setActiveDrawModule(new AlterBondStereoModule( hub, Direction.DOWN)); hub.getController2DModel().setDrawElement("C"); + } else if (type.equals("undefined_bond")) { + hub.setActiveDrawModule(new AlterBondStereoModule( + hub, Direction.UNDEFINED)); + hub.getController2DModel().setDrawElement("C"); + } else if (type.equals("undefined_stereo_bond")) { + hub.setActiveDrawModule(new AlterBondStereoModule( + hub, Direction.EZ_UNDEFINED)); + hub.getController2DModel().setDrawElement("C"); } else if (type.equals("triangle")) { hub.setActiveDrawModule(new AddRingModule(hub, 3, false)); hub.getController2DModel().setDrawElement("C"); Modified: jchempaint/trunk/src/main/org/openscience/jchempaint/action/CopyPasteAction.java =================================================================== --- jchempaint/trunk/src/main/org/openscience/jchempaint/action/CopyPasteAction.java 2009-08-17 14:45:41 UTC (rev 14731) +++ jchempaint/trunk/src/main/org/openscience/jchempaint/action/CopyPasteAction.java 2009-08-17 17:06:44 UTC (rev 14732) @@ -64,6 +64,7 @@ import org.openscience.cdk.interfaces.IMolecule; import org.openscience.cdk.interfaces.IReaction; import org.openscience.cdk.io.IChemObjectWriter; +import org.openscience.cdk.io.INChIPlainTextReader; import org.openscience.cdk.io.ISimpleChemObjectReader; import org.openscience.cdk.io.MDLV2000Reader; import org.openscience.cdk.io.MDLWriter; @@ -193,23 +194,21 @@ ); sdg.generateCoordinates(); } catch (Exception ex) { - if (content.startsWith("InChI")) { // handle it as an InChI + if (content.indexOf("INChI")>-1) { // handle it as an InChI try { - InChIGeneratorFactory inchiFactory = new InChIGeneratorFactory(); - InChIToStructure inchiToStructure = inchiFactory.getInChIToStructure(content,jcpPanel.getChemModel().getBuilder()); - INCHI_RET status = inchiToStructure.getReturnStatus(); - if (status == INCHI_RET.OKAY) { - IAtomContainer atomContainer = inchiToStructure.getAtomContainer(); - toPaste = atomContainer.getBuilder().newMolecule(atomContainer); - StructureDiagramGenerator sdg = - new StructureDiagramGenerator((IMolecule)toPaste); + StringReader sr = new StringReader(content); + INChIPlainTextReader inchireader = new INChIPlainTextReader(sr); + IChemFile mol = DefaultChemObjectBuilder.getInstance().newChemFile(); + toPaste = ((IChemFile) inchireader.read(mol)).getChemSequence(0).getChemModel(0).getMoleculeSet().getMolecule(0); + StructureDiagramGenerator sdg = + new StructureDiagramGenerator((IMolecule)toPaste); - sdg.setTemplateHandler( - new TemplateHandler(toPaste.getBuilder()) - ); - sdg.generateCoordinates(); } - } catch (Exception e2) { - //we do nothing + sdg.setTemplateHandler( + new TemplateHandler(toPaste.getBuilder()) + ); + sdg.generateCoordinates(); + } catch (Exception e2) { + e2.printStackTrace(); } } } Modified: jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JCPGUI_applet.properties =================================================================== --- jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JCPGUI_applet.properties 2009-08-17 14:45:41 UTC (rev 14731) +++ jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JCPGUI_applet.properties 2009-08-17 17:06:44 UTC (rev 14732) @@ -103,6 +103,6 @@ uppertoolbar=select lasso eraser undo redo zoomin zoomout plus minus move righttoolbar=periodictable enterelement C H O N P S F Cl Br I lowertoolbar=triangle square pentagon hexagon heptagon octagon benzene -lefttoolbar=bond up_bond down_bond +lefttoolbar=bond up_bond down_bond undefined_bond undefined_stereo_bond Modified: jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JCPGUI_stable.properties =================================================================== --- jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JCPGUI_stable.properties 2009-08-17 14:45:41 UTC (rev 14731) +++ jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JCPGUI_stable.properties 2009-08-17 17:06:44 UTC (rev 14732) @@ -100,10 +100,10 @@ # toolbar definition # ####################################################### -uppertoolbar=select lasso eraser undo redo plus minus move +uppertoolbar=select lasso eraser undo redo zoomin zoomout plus minus move righttoolbar=periodictable enterelement C H O N P S F Cl Br I lowertoolbar=triangle square pentagon hexagon heptagon octagon benzene -lefttoolbar=bond up_bond down_bond +lefttoolbar=bond up_bond down_bond undefined_bond undefined_stereo_bond #open saveAs cyclesymbol move cleanup atomatommapping Modified: jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JChemPaintResources.properties =================================================================== --- jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JChemPaintResources.properties 2009-08-17 14:45:41 UTC (rev 14731) +++ jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JChemPaintResources.properties 2009-08-17 17:06:44 UTC (rev 14732) @@ -64,6 +64,8 @@ rotationImage=resources/small-bin/rotation.gif up_bondImage=resources/small-bin/up_bond.gif down_bondImage=resources/small-bin/down_bond.gif +undefined_bondImage=resources/small-bin/undefined_bond.gif +undefined_stereo_bondImage=resources/small-bin/undefined_stereo_bond.gif normalizeImage=resources/small-bin/normalize.gif undoImage=resources/small-bin/undo.gif redoImage=resources/small-bin/redo.gif @@ -211,6 +213,8 @@ benzeneAction=org.openscience.jchempaint.action.ChangeModeAction@benzene up_bondAction=org.openscience.jchempaint.action.ChangeModeAction@up_bond down_bondAction=org.openscience.jchempaint.action.ChangeModeAction@down_bond +undefined_bondAction=org.openscience.jchempaint.action.ChangeModeAction@undefined_bond +undefined_stereo_bondAction=org.openscience.jchempaint.action.ChangeModeAction@undefined_stereo_bond atomatommappingAction=org.openscience.jchempaint.action.ChangeModeAction@atomatommapping ####################################################### @@ -238,6 +242,8 @@ rotationLabel=rotation up_bondLabel=up_bond down_bondLabel=down_bond +undefined_bondLabel=undefined_bond +undefined_stereo_bondLabel=undefined_stereo_bond normalizeLabel=normalize undoLabel=undo redoLabel=redo Added: jchempaint/trunk/src/main/org/openscience/jchempaint/resources/small-bin/undefined_bond.gif =================================================================== (Binary files differ) Property changes on: jchempaint/trunk/src/main/org/openscience/jchempaint/resources/small-bin/undefined_bond.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: jchempaint/trunk/src/main/org/openscience/jchempaint/resources/small-bin/undefined_stereo_bond.gif =================================================================== (Binary files differ) Property changes on: jchempaint/trunk/src/main/org/openscience/jchempaint/resources/small-bin/undefined_stereo_bond.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |