OB has no 2D depiction built in as yet. Craig has some apparently 
compatible code running on the emolecules site and Tim has some nicely 
written undeployed classes for 2D depiction in 
http://github.com/timvdm/OBDepict/tree/master .
In this code OBDepict draws the molecule and an abstract class 
OBPainter does the rendering. There are three derived classes, all of 
which use an external library for the graphics.

I have tweaked OBDepict and written an SVGPainter implementation that
uses no libraries. This can be called programatically to write to a
stream and there is also an output format with extra capabilities. It
renders single molecules with a defined scale (by bond length), With 
multiple molecules it exploits SVG's characteristics and displays them 
in an approximately square table which fills the space available. When 
there are a lot of them, the molecules can become rather tiny, but 
some Javascript is embedded to zoom with the mousewheel and and pan by
dragging (like a map) when the files are viewed in Firefox or Opera.
I expect other standards-compliant programs (which excludes Internet
Explorer) would also work. Having a set of molecules (for instance 
from a substructure search) laid out in front of you like thisis a 
good way of doing an initial appraisal.

2D coordinates are used if present, or automatically generated by
--gen2D for 0D and 3D molecules. The background can be white or black.
(I have slightly changed some of the colors in element.txt to
facilitate this. I hope this doesn't cause problems.) There is also an
option to display with aliases, like COOH, if they are present.

The division between what OBDepict, SVGPainter and SVGFormat each 
handle is a little uneasy and the code sadly is more messy than Tim's 
original. Depiction is a huge topic and there is a lot more to be done.

Chris




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to