Hi Jason,
The original design was set up to make it relatively straightforward to
make your own drawing class, so it's disappointing you aren't finding it
so.  I guess we've become focussed on getting Cairo and SVG pictures to
work, and have forgotten to keep this in mind.
A good place to start might be overriding the virtual functions
getDrawCoords() and getAtomCoords().  These transform from atom coordinates
to draw coordinates and vice versa.  You will need to override both, and
make sure they are consistent.  For reasons that demonstrate that the whole
drawing system needs re-factoring, the code for setting the scales switches
between the two coordinate systems in ways that are impossible to defend.
It's a bit like the human eye - it's where we've ended up, but not how
you'd design it if you were starting from scratch.  The other thing might
be to override the non-virtual calculateScale() functions.  There is a
class data member needs_scale_ which would probably be exactly what you
want except that it's private so you won't be able to see or alter it in
your derived class.  That's something we could think about making access
functions for.
I hope this helps.  If not, please do get back to me either privately or
via the list.  It would be useful for future development to find out how
you get on and what would have made it easier for you.

Best,
Dave




On Sun, Jul 26, 2020 at 8:37 PM Jason Biggs <jasondbi...@gmail.com> wrote:

> I'm trying to use the MolDraw2D class in C++ to generate all the graphics
> primitives for a molecule, which I then pass into my own graphics engine to
> make an image.  I'm doing this by making a new class that is a subclass of
> MolDraw2D, similar to MolDraw2DSVG, and overriding the drawXXX methods.
>
> But I find that when I call drawMolecule on a molecule that already has 2D
> coordinates, the lines that get drawn have all been rescaled and
> translated.  I need to turn off this, I need for the coordinates used to
> make the lines match the existing conformer.  I know this is somehow
> related to the width and height used in the MolDraw2D constructor, and I
> see that there are options fixedBondLength, fixedScale, as well as a
> setScale method.  But I'm not clear on what values to set in these to set
> the rescaling to 1 and translation to 0.
>
> Thanks
> Jason Biggs
>
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>


-- 
David Cosgrove
Freelance computational chemistry and chemoinformatics developer
http://cozchemix.co.uk
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to