From: Egon W. <eg...@us...> - 2004-02-17 15:44:57
|
Update of /cvsroot/jmol/Jmol/src/org/openscience/jmol/app In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13501/src/org/openscience/jmol/app Modified Files: JmolEditBus.java Log Message: Implemented showChemModel() Index: JmolEditBus.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/org/openscience/jmol/app/JmolEditBus.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- JmolEditBus.java 31 Oct 2003 15:10:41 -0000 1.1 +++ JmolEditBus.java 17 Feb 2004 15:36:02 -0000 1.2 @@ -27,10 +27,12 @@ import org.openscience.cdk.applications.plugin.CDKEditBus; import org.openscience.cdk.ChemFile; import org.openscience.cdk.ChemModel; +import org.openscience.cdk.ChemSequence; import org.openscience.cdk.Atom; import org.openscience.cdk.AtomContainer; import org.openscience.cdk.exception.CDKException; import org.openscience.cdk.geometry.GeometryTools; +import org.openscience.cdk.geometry.CrystalGeometryTools; import org.openscience.cdk.tools.AtomTypeFactory; import org.openscience.cdk.tools.ChemFileManipulator; @@ -57,10 +59,12 @@ Atom[] atoms = atomContainer.getAtoms(); // check if there is any content if (atoms.length == 0) { + System.err.println("ChemFile does not contain atoms."); return; } // check wether there are 3D coordinates - if (!GeometryTools.has3DCoordinates(atomContainer)) { + if (!GeometryTools.has3DCoordinates(atomContainer) && + !CrystalGeometryTools.hasCrystalCoordinates(atomContainer)) { System.err.println("Cannot display chemistry without 3D coordinates"); return; } @@ -86,7 +90,11 @@ } public void showChemModel(ChemModel model) { - throw new NoSuchMethodError(); + ChemFile file = new ChemFile(); + ChemSequence sequence = new ChemSequence(); + sequence.addChemModel(model); + file.addChemSequence(sequence); + showChemFile(file); } public ChemModel getChemModel() { |