Dear CDK community,
When I try to render the molecule from InChI=1S/H2O/h1H2, the renderer
generates image with zero height/width. Is there any limitation in CDK
preventing this molecule from being rendered? Is it somehow related to
the fact that this molecule has no carbons?
Thanks in advance.
CDK v1.4.5.
The code:
> String inchi = "InChI=1S/H2O/h1H2";
>
> IMoleculeSet moleculeSet =
> ConnectivityChecker.partitionIntoMolecules(InChIGeneratorFactory
> .getInstance().getInChIToStructure(inchi,
> DefaultChemObjectBuilder.getInstance()).getAtomContainer());
>
> StructureDiagramGenerator sdg = new StructureDiagramGenerator();
>
> sdg.setMolecule(moleculeSet.getMolecule(0));
> sdg.generateCoordinates();
>
> IMolecule molecule = sdg.getMolecule();
>
> BufferedImage image = new BufferedImage(MAX_IMAGE_WIDTH, MAX_IMAGE_HEIGHT,
> BufferedImage.TYPE_INT_RGB);
>
> Graphics2D graphics = image.createGraphics();
>
> IRenderer<IAtomContainer> chemicalMoleculeRenderer = new
> AtomContainerRenderer(Arrays.asList(new BasicSceneGenerator(),
> new BasicBondGenerator(), new BasicAtomGenerator()), new
> AWTFontManager());
>
> chemicalMoleculeRenderer.setup(molecule, new Rectangle(image.getWidth(),
> image.getHeight()));
>
> Rectangle imageRect = chemicalMoleculeRenderer.paint(molecule, new
> AWTDrawVisitor(graphics));
>
> logger.debug("Drawing the molecule " + imageRect);
This outputs in my case:
Drawing the molecule java.awt.Rectangle[x=300,y=300,width=0,height=0]
--
With best regards,
Dmitry
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user