CDK, JCP, SWT, AWT...

And other TLAs (three-letter acronyms)...

So, in trying to find out what the status of the JChemPaint code, there seems to be a lot of stuff, but not all of it works. So, in order to understand the plan, and as a suggested architecture, have this diagram:

It's not proper UML, but the package symbols are right. What this sketch suggests is that if there is graphics-independant code in the cdk.renderer package, then this package would take a molecule (or a reaction set, or a chemobject, etc) and 'render' it into graphical objects.

These would then be passed (the "renderer objects" oval) to the package (n.b.cdk.jchempaint or o.o.jchempaint) that is actually using a Graphics or GC object to draw with. Otherwise, the renderer package is really doing nothing useful.

Comments

One thing to consider is that the input for the Renderer is not just IMolecule, but also things like IReaction.

In relation to this, we likely need rendering modules, which one can easily plugin in and out... for example, a module to draw reaction boxes, and electron movement arrows...

Now, a tree or list of rendering objects is a good idea, but we need to come up with a design which integrates well with such a modular design too...
gilleain said…
I saw the IRenderer2D interface methods (paintMoleculeSet, paintReactionSet, etc).

I suppose it might be nice to have these as modules, but I can't see the use-case for it. It seems like YAGNI applies:

http://en.wikipedia.org/wiki/You_Ain%27t_Gonna_Need_It

But, I could be wrong...

In principle, there is no problem making the intermediate representation in a modular fashion, but at the moment the test implementation only renders bonds, rings, and atom symbols so there's a way to go :)
The alternative is to add many options to the Renderer2DModel, such as: drawReactionBoxes, drawElectronMovements, etc...

We do need this one way or another...