Hi,

when I try to render a parsed aromatic smiles the double bonds are not displayed even though the molecule's bonds and atoms are flagged correctly (CDKConstants.IsAromatic). Playing with the "isPreserveAromaticity" function, the molecule's flags or atom types did not resolve the problem.

If I use a non-aromatic smiles for benzene the rendering works correctly. Benzene created via the MoleculeFactory also works. Changing the BasicBondGenerator in the AtomContainerRenderer to RingGenerator recovers the the aromaticity of the aromatic benzene smiles (see image).



Has that behaviour been noticed before?

Many thanks,
Stephan
--
Stephan Beisken
Predoctoral Student - Steinbeck Group
European Bioinformatics Institute (EBI)
Wellcome Trust Genome Campus
Hinxton, Cambridge CB10 1SD, UK
Phone +44 1223 49 2633
public static BufferedImage drawImage(IMolecule molecule, int width, int height, boolean isAlpha) {

        double posX = 0;
        double posY = 0;

        BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);

        Graphics2D g2 = (Graphics2D) image.getGraphics();
        g2.setClip(0, 0, width, height);
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g2.setColor(Color.WHITE);
        if (!isAlpha) {
            g2.fillRect(0, 0, width, height);
        }

        @SuppressWarnings("unchecked") AtomContainerRenderer chemicalMoleculeRenderer = new AtomContainerRenderer
                (Arrays.asList(new BasicSceneGenerator(), new BasicBondGenerator(), new BasicAtomGenerator()),
                        new AWTFontManager());

        Rectangle2D bounds = new Rectangle2D.Double(posX, posY, width, height);
        chemicalMoleculeRenderer.paint(molecule, new AWTDrawVisitor(g2), bounds, true);

        return image;
    }
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to