Molecule Layouts

I've been doing experimental work on layouts for the CDK. Not for atoms, exactly, for which the StructureDiagramGenerator is doing a pretty good job - could be better, of course, but what couldn't?

No, layout of MoleculeSets, and Reactions. Well actually IMoleculeSets and IReactions. With an ILayout class - my apologies to anyone who doesn't like generics, but it can be quite useful. Anyway, here is an example of what it is looking like at the moment:

Hmmm. Well, it is a grid I suppose. The problems with the ring bonds are known to me, please do not mention them >:|

The code for this is quite short:
IMoleculeSet moleculeSet = makeMolSet();
ILayout<IMoleculeSet> gridLayout = new GridMoleculeSetLayout(3, 3);
makeImage(moleculeSet, gridLayout, "three_by_three", 500, 500);
where the methods 'makeMolSet' and 'makeImage' do what you might expect (I hope :). Similarly:
IMoleculeSet molSet = makeMolSet();
AxisOrientation o = AxisOrientation.PLUS_X_PLUS_Y;
ILayout<IMoleculeSet> layout = new LinearMoleculeSetLayout(new StandardMoleculeLayout(), 3, o);
makeImage(molSet, layout, "xypos", 500, 500);
and this produces an image like this:

which is also ... alright. Getting there.


Anonymous said…
Hey - I am really glad to find this. great job!