Skip to content

Jchempaint rendering modules

rwst edited this page May 23, 2012 · 3 revisions

The builder is defined as:

IChemObjectBuilder builder = new NonotificationChemObjectBuilder();

Basic

CDK code JChemPaint output Comment
IAtom atom = builder.newAtom("C");
atom.setHydrogenCount(2);
The implicit hydrogens are always placed away from connecting bonds.
IAtom atom0 = builder.newAtom("C");
IAtom atom1 = builder.newAtom("C");
IBond bond = builder.newBond(atom0, atom1, IBond.Order.SINGLE);
IAtom atom0 = builder.newAtom("C");
IAtom atom1 = builder.newAtom("C");
IBond bond = builder.newBond(atom0, atom1, IBond.Order.DOUBLE);
IAtom atom0 = builder.newAtom("C");
IAtom atom1 = builder.newAtom("C");
IBond bond = builder.newBond(atom0, atom1, IBond.Order.TRIPLE);
IAtom atom0 = builder.newAtom("C");
atom0.setFormalCharge(1);
IAtom atom0 = builder.newAtom("C");
atom0.setFormalCharge(-1);

Extra

CDK code JChemPaint output Comment
IAtom atom0 = builder.newAtom("C");
atom0.setMassNumber(13);
IAtomContainer benzene = builder.newAtomContainer();
IAtom atom0 = builder.newAtom("C"); benzene.addAtom(atom0);
IAtom atom1 = builder.newAtom("C"); benzene.addAtom(atom1);
IAtom atom2 = builder.newAtom("C"); benzene.addAtom(atom2);
IAtom atom3 = builder.newAtom("C"); benzene.addAtom(atom3);
IAtom atom4 = builder.newAtom("C"); benzene.addAtom(atom4);
IAtom atom5 = builder.newAtom("C"); benzene.addAtom(atom5);
benzene.addBond(builder.newBond(atom0, atom1, SINGLE));
benzene.addBond(builder.newBond(atom0, atom1, DOUBLE));
benzene.addBond(builder.newBond(atom0, atom1, SINGLE));
benzene.addBond(builder.newBond(atom0, atom1, DOUBLE));
benzene.addBond(builder.newBond(atom0, atom1, SINGLE));
benzene.addBond(builder.newBond(atom0, atom1, DOUBLE));
renderParams.setAromaticityRings(true);
This requires ring and aromaticity detection, hence extra.

Controller Feedback

CDK code JChemPaint output Comment
IAtom atom0 = builder.newAtom("C");
renderParam.setHightighted(atom0);
IAtom atom0 = builder.newAtom("C");
IAtom atom1 = builder.newAtom("C");
IBond bond0 = builder.newBond(atom0, atom1, IBond.Order.SINGLE);
IAtomContainer highlighted = builder.newAtomContainer();
highlighted.addAtom(atom0);
highlighted.addAtom(atom1);
highlighted.addBond(bond0);
renderParam.setHightighted(highlighted);