Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#1056 API problem with IGenerator / IAtomContainerGenerator

jchempaint-primary
open
5
2012-11-14
2010-04-16
Egon Willighagen
No

I was wondering if the new CDK-Jchempaint 9 is able to render lone
pairs/radicals. I am using cdk 1.3.4 and tried to do the following code:

List<IAtomContainerGenerator> generators = new
ArrayList<IAtomContainerGenerator>();
generators.add(new BasicBondGenerator());
generators.add(new BasicAtomGenerator());
//this does not work because it implements IGenerator instead of
IAtomContainerGenerator

Oops... yeah, sorry about that. I 'cleaned up' the API in version 9 a
bit, to have further distinguish between AtomContainer and Reaction
rendering, making IGenerator a super interface giving access to the
rendering parameters, so that the code no longer needed separate
methods for generators... but it seems I have been somewhat careless
with the patch... my apologies!

//generators.add(new LonePairGenerator());

That should do it, at least for the lone pairs.

Renderer renderer = new Renderer(generators, new AWTFontManager());

The renderer can only be instantiated using a list of
IAtomContainerGenerator.

Am I doing something wrong here?

No, this is a bug. I'll file it and fix in in version 10 of the patch.

Discussion

  • Ralf Stephan
    Ralf Stephan
    2012-11-14

    This is not a bug. Your call to the constructor misses a boolean parameter at the end, the signature is: public Renderer(List<IGenerator> generators, IFontManager fontManager, boolean useUserSettings)

    The issue is invalid and can be closed.