Exception while exporting .cdx file to EMF drawing

User 366e966a35

21-12-2010 16:26:45

Hello!


I programmatically read a molecule from .cdx file and then try to export it to EMF drawing. During this conversion an exception occurs:


 java.util.NoSuchElementException
at java.util.TreeMap.key(TreeMap.java:1206)
at java.util.TreeMap.firstKey(TreeMap.java:267)
at java.util.TreeSet.first(TreeSet.java:377)
at org.freehep.graphicsio.ImageGraphics2D.getPreferredImageWriter(ImageGraphics2D.java:453)
at org.freehep.graphicsio.ImageGraphics2D.writeImage(ImageGraphics2D.java:405)
at org.freehep.graphicsio.emf.gdi.AlphaBlend.write(AlphaBlend.java:139)
at org.freehep.graphicsio.emf.EMFTag.write(EMFTag.java:45)
at org.freehep.util.io.TaggedOutputStream.writeTag(TaggedOutputStream.java:89)
at org.freehep.graphicsio.emf.EMFOutputStream.writeTag(EMFOutputStream.java:242)
at org.freehep.graphicsio.emf.EMFGraphics2D.writeImage(EMFGraphics2D.java:424)
at org.freehep.graphicsio.AbstractVectorGraphicsIO.drawImage(AbstractVectorGraphicsIO.java:482)
at org.freehep.graphicsio.AbstractVectorGraphicsIO.drawImage(AbstractVectorGraphicsIO.java:379)
at chemaxon.marvin.paint.internal.MolPainter.paintAtom(Unknown Source)
at chemaxon.marvin.paint.internal.MolPainter.paintObjects(Unknown Source)
at chemaxon.marvin.paint.internal.MolPainter.paintDocument(Unknown Source)
at chemaxon.marvin.paint.internal.MolPainter.paintDocument(Unknown Source)
at chemaxon.marvin.io.formats.image.ImageExport.paint(Unknown Source)
at chemaxon.marvin.io.formats.vectgraphics.VectGraphicsExport.convert(Unknown Source)
at chemaxon.struc.Molecule.exportToObject(Unknown Source)
at chemaxon.struc.Molecule.exportToObject(Unknown Source)
at chemaxon.struc.Molecule.exportToBinFormat(Unknown Source)
at chemaxon.struc.Molecule.toBinFormat(Unknown Source)



I tried to export a molecule to EMF picture with MolExporter and Molecule.toBinFormat() with no difference. Export string is "emf:scale30". Sample files are included in the archive.


Is this a bug or a misuse of MarvinSketch API?


Thank you!

ChemAxon 7c2d26e5cf

21-12-2010 17:51:08

Which Marvin version you have?

User 366e966a35

21-12-2010 21:10:25

I'm using MarvinSketch version 5.3.8.

ChemAxon 7c2d26e5cf

23-12-2010 13:48:51

I have tested your cdx files with the attached example by using Marvin Beans 5.3.8. But I did not met any error message on the console. The EMF file is created properly.


The most relevant part of my code is copied here:

User 366e966a35

24-12-2010 13:16:53

The issue is closed. It occurres because I don't use MarvinSketch as a bunch of separate jars (as it comes), but rather repack almost all jars into single jar file. During this operation I erroneously skipped the content of META-INF/services/ folders of FreeHEP jars, and it led to an exception.

ChemAxon 7c2d26e5cf

26-12-2010 17:00:22

I am glad that the problem was solved. Thanks for the feedback.

User 366e966a35

27-12-2010 08:12:06

Tamas, thank you for your help!