On Thu, Oct 3, 2013 at 5:47 PM, Michał Nowotka <mmm...@gmail.com> wrote: > Hi Greg et al, > > I was thinking about html5 renderer. We can use Raphaeljs for this. In > the documentation you can find Paper.add method: > > http://raphaeljs.com/reference.html#Paper.add > > Which accepts JSON describing primitives and their attributes > (coordinates, colors, etc.). > > So the task would be to write another Canvas class returning such JSON > object. This should be pretty easy but the question is: where such a > class should be placed: > > 1. rdkit.sping.JSON > 2. rdkit.Chem.Draw.jsonCanvas > > Both options are far from perfect. Choosing 1, all other image formats > will be produced by sping.
Sping should die anyway :) > Choosing 2, no other formats will be produced at all. See > https://github.com/rdkit/rdkit/blob/master/rdkit/Chem/Draw/__init__.py > > IMO there is a wrong assumption formulated in Draw/__init__.py that > Canvas class has to support all possible image types: > > https://github.com/rdkit/rdkit/blob/master/rdkit/Chem/Draw/__init__.py#L131 > > Notice that in MolToMPL imageType parameter is completely ignored: > > https://github.com/rdkit/rdkit/blob/master/rdkit/Chem/Draw/__init__.py#L183 > > Of course we can add another method to Draw/__init__.py like MolToJSON > but we will loose generality. > > It seems like the whole image generation part requires some redesign > because it's not DRY enough... Right. My earlier refactoring on that part when only that far, I wanted to completely get rid of the "if backend == X" logic and use injection of a canvas backend in the canvasbase class that would allow writing the molecular data into it and get back the resulting artifact for output. I guess if you want to add it quickly the MolToJSON approach is the obvious choice. -- Gianluca Sforna http://morefedora.blogspot.com http://identi.ca/giallu - http://twitter.com/giallu ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk _______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss