This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IRenderingElement diagram = this.generator.generate(atomCon); | |
double width = bounds.getWidth(); | |
this.dy = bounds.getCenterY(); | |
// draw once | |
this.dx = bounds.getCenterX() - (width / 4); | |
diagram.accept(this); | |
// draw again | |
this.dx += (width / 2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//create a molecule from a smiles, generate 2D coords, and load it into jcp in one line | |
ui.open(cdk.generate2dCoordinates(cdk.fromSMILES("C1=C(=O)CC=C(N)C1")), "net.bioclipse.cdk.ui.editors.jchempaint") | |
// replace the molecule with a new one (cubane) | |
jcp.setModel(cdk.generate2dCoordinates(cdk.fromSMILES("C12C3C4C1C5C4C3C25"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// showing off the scripting potential of the jchempaint editor | |
// create a benzene ring, and save it in the /Vitrual folder | |
cdk.saveMolecule(cdk.generate2dCoordinates(cdk.fromSMILES("c1ccccc1")), "/Virtual/benzene.cml") | |
// open this file in a jchempaint editor | |
ui.open("/Virtual/benzene.cml") | |
// fuse this benzene with another | |
jcp.addPhenyl(jcp.getModel().atomContainer.getBond(0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in one line | |
jcp.getRenderingOptions().setBondWidth(2) | |
// save for multiple use | |
r = jcp.getRenderingOptions() | |
r.setIsCompact(true) | |
// use properties instead of get/set | |
r.wedgeWidth = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.Color; | |
import javax.vecmath.Point2d; | |
import org.openscience.cdk.interfaces.IAtom; | |
import org.openscience.cdk.interfaces.IAtomContainer; | |
import org.openscience.cdk.interfaces.IBond; | |
import org.openscience.cdk.renderer.RendererModel; | |
import org.openscience.cdk.renderer.elements.ElementGroup; | |
import org.openscience.cdk.renderer.elements.IRenderingElement; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.Color; | |
import java.awt.Dimension; | |
import java.awt.Graphics; | |
import java.awt.Graphics2D; | |
import java.awt.Rectangle; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.util.ArrayList; | |
import java.util.List; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void clone(IAtomContainer source, IAtomContainer target) { | |
for (int i = 0; i < source.getAtomCount(); i++) { | |
IAtom atom = (IAtom) source.getAtom(i).clone(); | |
target.addAtom(atom); | |
} | |
for (IBond bond : source.bonds()) { | |
IBond newBond = (IBond)bond.clone(); | |
IAtom[] newAtoms = new IAtom[bond.getAtomCount()]; | |
for (int j = 0; j < bond.getAtomCount(); ++j) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tailor.app; | |
import java.awt.BorderLayout; | |
import java.awt.Dimension; | |
import java.awt.Graphics; | |
import java.awt.GridLayout; | |
import java.awt.Rectangle; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import java.io.File; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package stereo; | |
import java.util.ArrayList; | |
import java.util.List; | |
import org.openscience.cdk.graph.invariant.MorganNumbersTools; | |
import org.openscience.cdk.interfaces.IAtom; | |
import org.openscience.cdk.interfaces.IAtomContainer; | |
import org.openscience.cdk.interfaces.IAtomParity; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package stereo; | |
import java.util.List; | |
import org.junit.Assert; | |
import org.openscience.cdk.CDKTestCase; | |
import org.openscience.cdk.DefaultChemObjectBuilder; | |
import org.openscience.cdk.interfaces.IAtom; | |
import org.openscience.cdk.interfaces.IAtomContainer; | |
import org.openscience.cdk.interfaces.IAtomParity; |
OlderNewer