RDKit
Open-source cheminformatics and machine learning.
RDKit::MolDraw2D Class Referenceabstract

MolDraw2D is the base class for doing 2D renderings of molecules. More...

#include <MolDraw2D.h>

Inheritance diagram for RDKit::MolDraw2D:
RDKit::MolDraw2DCairo RDKit::MolDraw2DJS RDKit::MolDraw2DQt RDKit::MolDraw2DSVG RDKit::MolDraw2Dwx

Public Member Functions

 MolDraw2D (int width, int height, int panelWidth, int panelHeight)
 constructor for a particular size More...
 
virtual ~MolDraw2D ()
 

Transformations

std::unique_ptr< DrawTexttext_drawer_
 
std::vector< std::pair< std::string, std::string > > d_metadata
 
unsigned int d_numMetadataEntries = 0
 
virtual Point2D getDrawCoords (const Point2D &mol_cds) const
 
virtual Point2D getDrawCoords (int at_num) const
 returns the drawing coordinates of a particular atom More...
 
virtual Point2D getAtomCoords (const std::pair< int, int > &screen_cds) const
 
virtual Point2D getAtomCoords (const std::pair< double, double > &screen_cds) const
 
virtual Point2D getAtomCoords (int at_num) const
 returns the molecular coordinates of a particular atom More...
 
virtual int width () const
 return the width of the drawing area. More...
 
virtual int height () const
 return the height of the drawing area. More...
 
virtual int panelWidth () const
 return the width of the drawing panels. More...
 
virtual int panelHeight () const
 return the height of the drawing panels. More...
 
virtual int drawHeight () const
 
double scale () const
 
void calculateScale (int width, int height, const ROMol &mol, const std::vector< int > *highlight_atoms=nullptr, const std::map< int, double > *highlight_radii=nullptr, int confId=-1)
 
void calculateScale (int width, int height, const std::vector< ROMol * > &mols, const std::vector< std::vector< int >> *highlight_atoms, const std::vector< std::map< int, double >> *highlight_radii, const std::vector< int > *confIds, std::vector< std::unique_ptr< RWMol >> &tmols)
 
void centrePicture (int width, int height)
 
void setScale (int width, int height, const Point2D &minv, const Point2D &maxv, const ROMol *mol=nullptr)
 explicitly sets the scaling factors for the drawing More...
 
void setOffset (int x, int y)
 sets the drawing offset (in drawing coords) More...
 
Point2D offset () const
 returns the drawing offset (in drawing coords) More...
 
Point2D minPt () const
 returns the minimum point of the drawing (in molecular coords) More...
 
Point2D range () const
 returns the width and height of the grid (in molecular coords) More...
 
virtual double fontSize () const
 font size in drawing coordinate units. That's probably pixels. More...
 
virtual void setFontSize (double new_size)
 
virtual void setColour (const DrawColour &col)
 sets the current draw color More...
 
virtual DrawColour colour () const
 returns the current draw color More...
 
virtual void setDash (const DashPattern &patt)
 sets the current dash pattern More...
 
virtual const DashPatterndash () const
 returns the current dash pattern More...
 
virtual void setLineWidth (int width)
 sets the current line width More...
 
virtual int lineWidth () const
 returns the current line width More...
 
virtual void getStringSize (const std::string &label, double &label_width, double &label_height) const
 
void getLabelSize (const std::string &label, OrientType orient, double &label_width, double &label_height) const
 
void getStringExtremes (const std::string &label, OrientType orient, const Point2D &cds, double &x_min, double &y_min, double &x_max, double &y_max) const
 
virtual void drawString (const std::string &str, const Point2D &cds)
 drawString centres the string on cds. More...
 
virtual void drawString (const std::string &str, const Point2D &cds, TextAlignType align)
 
virtual void drawTriangle (const Point2D &cds1, const Point2D &cds2, const Point2D &cds3)
 draw a triangle More...
 
virtual void drawEllipse (const Point2D &cds1, const Point2D &cds2)
 draw an ellipse More...
 
virtual void drawArc (const Point2D &centre, double radius, double ang1, double ang2)
 
virtual void drawArc (const Point2D &centre, double xradius, double yradius, double ang1, double ang2)
 
virtual void drawRect (const Point2D &cds1, const Point2D &cds2)
 draw a rectangle More...
 
virtual void drawAttachmentLine (const Point2D &cds1, const Point2D &cds2, const DrawColour &col, double len=1.0, unsigned int nSegments=16)
 
virtual void drawWavyLine (const Point2D &cds1, const Point2D &cds2, const DrawColour &col1, const DrawColour &col2, unsigned int nSegments=16, double vertOffset=0.05)
 draw a wavy line like that used to indicate unknown stereochemistry More...
 
virtual void drawLine (const Point2D &cds1, const Point2D &cds2, const DrawColour &col1, const DrawColour &col2)
 draw a line where the ends are different colours More...
 
virtual void tagAtoms (const ROMol &mol)
 
virtual bool fillPolys () const
 set whether or not polygons are being filled More...
 
virtual void setFillPolys (bool val)
 returns either or not polygons should be filled More...
 
MolDrawOptionsdrawOptions ()
 returns our current drawing options More...
 
const MolDrawOptionsdrawOptions () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
const std::vector< Point2D > & atomCoords () const
 
const std::vector< std::pair< std::string, OrientType > > & atomSyms () const
 returns the atomic symbols of the current molecule More...
 
virtual void drawArrow (const Point2D &cds1, const Point2D &cds2, bool asPolygon=false, double frac=0.05, double angle=M_PI/6)
 Draw an arrow with either lines or a filled head (when asPolygon is true) More...
 
void tabulaRasa ()
 
virtual bool supportsAnnotations ()
 
virtual void drawAnnotation (const AnnotationType &annotation)
 
bool hasActiveAtmIdx ()
 
int getActiveAtmIdx1 ()
 
int getActiveAtmIdx2 ()
 
void setActiveAtmIdx (int at_idx1=-1, int at_idx2=-1)
 
virtual void doContinuousHighlighting (const ROMol &mol, const std::vector< int > *highlight_atoms, const std::vector< int > *highlight_bonds, const std::map< int, DrawColour > *highlight_atom_map, const std::map< int, DrawColour > *highlight_bond_map, const std::map< int, double > *highlight_radii)
 
virtual void highlightCloseContacts ()
 
virtual void drawBond (const ROMol &mol, const Bond *bond, int at1_idx, int at2_idx, const std::vector< int > *highlight_atoms=nullptr, const std::map< int, DrawColour > *highlight_atom_map=nullptr, const std::vector< int > *highlight_bonds=nullptr, const std::map< int, DrawColour > *highlight_bond_map=nullptr, const std::vector< std::pair< DrawColour, DrawColour >> *bond_colours=nullptr)
 
virtual void drawAtomLabel (int atom_num, const DrawColour &draw_colour)
 
virtual void drawAnnotation (const std::string &note, const StringRect &note_rect)
 DEPRECATED. More...
 
virtual double getDrawLineWidth () const
 
void get2DCoordsForReaction (ChemicalReaction &rxn, Point2D &arrowBegin, Point2D &arrowEnd, std::vector< double > &plusLocs, double spacing, const std::vector< int > *confIds)
 
void get2DCoordsMol (RWMol &mol, double &offset, double spacing, double &maxY, double &minY, int confId, bool shiftAgents, double coordScale)
 

Methods that must be provided by child classes

virtual void clearDrawing ()=0
 clears the contents of the drawing More...
 
virtual void drawLine (const Point2D &cds1, const Point2D &cds2)=0
 
virtual void drawPolygon (const std::vector< Point2D > &cds)=0
 
virtual void drawMolecule (const ROMol &mol, const std::string &legend, const std::vector< int > *highlight_atoms, const std::vector< int > *highlight_bonds, const std::map< int, DrawColour > *highlight_atom_map=nullptr, const std::map< int, DrawColour > *highlight_bond_map=nullptr, const std::map< int, double > *highlight_radii=nullptr, int confId=-1)
 draw a single molecule More...
 
virtual void drawMolecule (const ROMol &mol, const std::vector< int > *highlight_atoms=nullptr, const std::map< int, DrawColour > *highlight_map=nullptr, const std::map< int, double > *highlight_radii=nullptr, int confId=-1)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
virtual void drawMolecule (const ROMol &mol, const std::string &legend, const std::vector< int > *highlight_atoms=nullptr, const std::map< int, DrawColour > *highlight_map=nullptr, const std::map< int, double > *highlight_radii=nullptr, int confId=-1)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
virtual void drawMolecule (const ROMol &mol, const std::vector< int > *highlight_atoms, const std::vector< int > *highlight_bonds, const std::map< int, DrawColour > *highlight_atom_map=nullptr, const std::map< int, DrawColour > *highlight_bond_map=nullptr, const std::map< int, double > *highlight_radii=nullptr, int confId=-1)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
virtual void drawMoleculeWithHighlights (const ROMol &mol, const std::string &legend, const std::map< int, std::vector< DrawColour >> &highlight_atom_map, const std::map< int, std::vector< DrawColour >> &highlight_bond_map, const std::map< int, double > &highlight_radii, const std::map< int, int > &highlight_linewidth_multipliers, int confId=-1)
 draw molecule with multiple colours allowed per atom. More...
 
virtual void drawMolecules (const std::vector< ROMol * > &mols, const std::vector< std::string > *legends=nullptr, const std::vector< std::vector< int >> *highlight_atoms=nullptr, const std::vector< std::vector< int >> *highlight_bonds=nullptr, const std::vector< std::map< int, DrawColour >> *highlight_atom_maps=nullptr, const std::vector< std::map< int, DrawColour >> *highlight_bond_maps=nullptr, const std::vector< std::map< int, double >> *highlight_radii=nullptr, const std::vector< int > *confIds=nullptr)
 draw multiple molecules in a grid More...
 
virtual void drawReaction (const ChemicalReaction &rxn, bool highlightByReactant=false, const std::vector< DrawColour > *highlightColorsReactants=nullptr, const std::vector< int > *confIds=nullptr)
 draw a ChemicalReaction More...
 

Detailed Description

MolDraw2D is the base class for doing 2D renderings of molecules.

Definition at line 337 of file MolDraw2D.h.

Constructor & Destructor Documentation

◆ MolDraw2D()

RDKit::MolDraw2D::MolDraw2D ( int  width,
int  height,
int  panelWidth,
int  panelHeight 
)

constructor for a particular size

Parameters
width: width (in pixels) of the rendering
height: height (in pixels) of the rendering
panelWidth: (optional) width (in pixels) of a single panel
panelHeight: (optional) height (in pixels) of a single panel

The panelWidth and panelHeight arguments are used to provide the sizes of the panels individual molecules are drawn in when drawMolecules() is called.

◆ ~MolDraw2D()

virtual RDKit::MolDraw2D::~MolDraw2D ( )
virtual

Member Function Documentation

◆ atomCoords()

const std::vector<Point2D>& RDKit::MolDraw2D::atomCoords ( ) const
inline

returns the coordinates of the atoms of the current molecule in molecular coordinates

Definition at line 651 of file MolDraw2D.h.

References PRECONDITION.

◆ atomSyms()

const std::vector<std::pair<std::string, OrientType> >& RDKit::MolDraw2D::atomSyms ( ) const
inline

returns the atomic symbols of the current molecule

Definition at line 656 of file MolDraw2D.h.

References PRECONDITION.

◆ calculateScale() [1/2]

void RDKit::MolDraw2D::calculateScale ( int  width,
int  height,
const ROMol mol,
const std::vector< int > *  highlight_atoms = nullptr,
const std::map< int, double > *  highlight_radii = nullptr,
int  confId = -1 
)

calculates the drawing scale (conversion from molecular coords -> drawing coords)

◆ calculateScale() [2/2]

void RDKit::MolDraw2D::calculateScale ( int  width,
int  height,
const std::vector< ROMol * > &  mols,
const std::vector< std::vector< int >> *  highlight_atoms,
const std::vector< std::map< int, double >> *  highlight_radii,
const std::vector< int > *  confIds,
std::vector< std::unique_ptr< RWMol >> &  tmols 
)

overload calculate a single scale that will suit all molecules. For use by drawMolecules primarily.

◆ centrePicture()

void RDKit::MolDraw2D::centrePicture ( int  width,
int  height 
)

◆ clearDrawing()

virtual void RDKit::MolDraw2D::clearDrawing ( )
pure virtual

clears the contents of the drawing

Implemented in RDKit::MolDraw2DQt, RDKit::MolDraw2DSVG, RDKit::MolDraw2DJS, RDKit::MolDraw2DCairo, and RDKit::MolDraw2Dwx.

◆ colour()

virtual DrawColour RDKit::MolDraw2D::colour ( ) const
inlinevirtual

returns the current draw color

Definition at line 572 of file MolDraw2D.h.

◆ dash()

virtual const DashPattern& RDKit::MolDraw2D::dash ( ) const
inlinevirtual

returns the current dash pattern

Definition at line 576 of file MolDraw2D.h.

◆ doContinuousHighlighting()

virtual void RDKit::MolDraw2D::doContinuousHighlighting ( const ROMol mol,
const std::vector< int > *  highlight_atoms,
const std::vector< int > *  highlight_bonds,
const std::map< int, DrawColour > *  highlight_atom_map,
const std::map< int, DrawColour > *  highlight_bond_map,
const std::map< int, double > *  highlight_radii 
)
protectedvirtual

◆ drawAnnotation() [1/2]

virtual void RDKit::MolDraw2D::drawAnnotation ( const AnnotationType annotation)
virtual

Reimplemented in RDKit::MolDraw2DSVG.

◆ drawAnnotation() [2/2]

virtual void RDKit::MolDraw2D::drawAnnotation ( const std::string &  note,
const StringRect note_rect 
)
inlineprotectedvirtual

DEPRECATED.

Reimplemented in RDKit::MolDraw2DSVG.

Definition at line 894 of file MolDraw2D.h.

References RDKit::AnnotationType::rect_, and RDKit::AnnotationType::text_.

◆ drawArc() [1/2]

virtual void RDKit::MolDraw2D::drawArc ( const Point2D centre,
double  radius,
double  ang1,
double  ang2 
)
virtual

◆ drawArc() [2/2]

virtual void RDKit::MolDraw2D::drawArc ( const Point2D centre,
double  xradius,
double  yradius,
double  ang1,
double  ang2 
)
virtual

◆ drawArrow()

virtual void RDKit::MolDraw2D::drawArrow ( const Point2D cds1,
const Point2D cds2,
bool  asPolygon = false,
double  frac = 0.05,
double  angle = M_PI/6 
)
virtual

Draw an arrow with either lines or a filled head (when asPolygon is true)

◆ drawAtomLabel()

virtual void RDKit::MolDraw2D::drawAtomLabel ( int  atom_num,
const DrawColour draw_colour 
)
protectedvirtual

Reimplemented in RDKit::MolDraw2DSVG.

◆ drawAttachmentLine()

virtual void RDKit::MolDraw2D::drawAttachmentLine ( const Point2D cds1,
const Point2D cds2,
const DrawColour col,
double  len = 1.0,
unsigned int  nSegments = 16 
)
virtual

draw a line indicating the presence of an attachment point (normally a squiggle line perpendicular to a bond)

◆ drawBond()

virtual void RDKit::MolDraw2D::drawBond ( const ROMol mol,
const Bond bond,
int  at1_idx,
int  at2_idx,
const std::vector< int > *  highlight_atoms = nullptr,
const std::map< int, DrawColour > *  highlight_atom_map = nullptr,
const std::vector< int > *  highlight_bonds = nullptr,
const std::map< int, DrawColour > *  highlight_bond_map = nullptr,
const std::vector< std::pair< DrawColour, DrawColour >> *  bond_colours = nullptr 
)
protectedvirtual

Reimplemented in RDKit::MolDraw2DSVG.

◆ drawEllipse()

virtual void RDKit::MolDraw2D::drawEllipse ( const Point2D cds1,
const Point2D cds2 
)
virtual

draw an ellipse

Reimplemented in RDKit::MolDraw2DSVG, and RDKit::MolDraw2DJS.

◆ drawHeight()

virtual int RDKit::MolDraw2D::drawHeight ( ) const
inlinevirtual

Definition at line 527 of file MolDraw2D.h.

◆ drawLine() [1/2]

virtual void RDKit::MolDraw2D::drawLine ( const Point2D cds1,
const Point2D cds2 
)
pure virtual

draws a line from cds1 to cds2 using the current drawing style in atom coords.

Implemented in RDKit::MolDraw2DQt, RDKit::MolDraw2DSVG, RDKit::MolDraw2DJS, RDKit::MolDraw2DCairo, and RDKit::MolDraw2Dwx.

◆ drawLine() [2/2]

virtual void RDKit::MolDraw2D::drawLine ( const Point2D cds1,
const Point2D cds2,
const DrawColour col1,
const DrawColour col2 
)
virtual

draw a line where the ends are different colours

◆ drawMolecule() [1/4]

virtual void RDKit::MolDraw2D::drawMolecule ( const ROMol mol,
const std::string &  legend,
const std::vector< int > *  highlight_atoms,
const std::vector< int > *  highlight_bonds,
const std::map< int, DrawColour > *  highlight_atom_map = nullptr,
const std::map< int, DrawColour > *  highlight_bond_map = nullptr,
const std::map< int, double > *  highlight_radii = nullptr,
int  confId = -1 
)
virtual

draw a single molecule

Parameters
mol: the molecule to draw
legend: the legend (to be drawn under the molecule)
highlight_atoms: (optional) vector of atom ids to highlight
highlight_atoms: (optional) vector of bond ids to highlight
highlight_atom_map: (optional) map from atomId -> DrawColour providing the highlight colors. If not provided the default highlight colour from drawOptions() will be used.
highlight_bond_map: (optional) map from bondId -> DrawColour providing the highlight colors. If not provided the default highlight colour from drawOptions() will be used.
highlight_radii: (optional) map from atomId -> radius (in molecule coordinates) for the radii of atomic highlights. If not provided the default value from drawOptions() will be used.
confId: (optional) conformer ID to be used for atomic coordinates

◆ drawMolecule() [2/4]

virtual void RDKit::MolDraw2D::drawMolecule ( const ROMol mol,
const std::string &  legend,
const std::vector< int > *  highlight_atoms = nullptr,
const std::map< int, DrawColour > *  highlight_map = nullptr,
const std::map< int, double > *  highlight_radii = nullptr,
int  confId = -1 
)
virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ drawMolecule() [3/4]

virtual void RDKit::MolDraw2D::drawMolecule ( const ROMol mol,
const std::vector< int > *  highlight_atoms,
const std::vector< int > *  highlight_bonds,
const std::map< int, DrawColour > *  highlight_atom_map = nullptr,
const std::map< int, DrawColour > *  highlight_bond_map = nullptr,
const std::map< int, double > *  highlight_radii = nullptr,
int  confId = -1 
)
virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ drawMolecule() [4/4]

virtual void RDKit::MolDraw2D::drawMolecule ( const ROMol mol,
const std::vector< int > *  highlight_atoms = nullptr,
const std::map< int, DrawColour > *  highlight_map = nullptr,
const std::map< int, double > *  highlight_radii = nullptr,
int  confId = -1 
)
virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ drawMolecules()

virtual void RDKit::MolDraw2D::drawMolecules ( const std::vector< ROMol * > &  mols,
const std::vector< std::string > *  legends = nullptr,
const std::vector< std::vector< int >> *  highlight_atoms = nullptr,
const std::vector< std::vector< int >> *  highlight_bonds = nullptr,
const std::vector< std::map< int, DrawColour >> *  highlight_atom_maps = nullptr,
const std::vector< std::map< int, DrawColour >> *  highlight_bond_maps = nullptr,
const std::vector< std::map< int, double >> *  highlight_radii = nullptr,
const std::vector< int > *  confIds = nullptr 
)
virtual

draw multiple molecules in a grid

Parameters
mols: the molecules to draw
legends: (optional) the legends (to be drawn under the molecules)
highlight_atoms: (optional) vectors of atom ids to highlight
highlight_atoms: (optional) vectors of bond ids to highlight
highlight_atom_map: (optional) maps from atomId -> DrawColour providing the highlight colors. If not provided the default highlight colour from drawOptions() will be used.
highlight_bond_map: (optional) maps from bondId -> DrawColour providing the highlight colors. If not provided the default highlight colour from drawOptions() will be used.
highlight_radii: (optional) maps from atomId -> radius (in molecule coordinates) for the radii of atomic highlights. If not provided the default value from drawOptions() will be used.
confId: (optional) conformer IDs to be used for atomic coordinates

The panelWidth and panelHeight values will be used to determine the number of rows and columns to be drawn. Theres not a lot of error checking here, so if you provide too many molecules for the number of panes things are likely to get screwed up. If the number of rows or columns ends up being <= 1, molecules will be being drawn in a single row/column.

◆ drawMoleculeWithHighlights()

virtual void RDKit::MolDraw2D::drawMoleculeWithHighlights ( const ROMol mol,
const std::string &  legend,
const std::map< int, std::vector< DrawColour >> &  highlight_atom_map,
const std::map< int, std::vector< DrawColour >> &  highlight_bond_map,
const std::map< int, double > &  highlight_radii,
const std::map< int, int > &  highlight_linewidth_multipliers,
int  confId = -1 
)
virtual

draw molecule with multiple colours allowed per atom.

Parameters
mol: the molecule to draw
legend: the legend (to be drawn under the molecule)
highlight_atom_map: map from atomId -> DrawColours providing the highlight colours.
highlight_bond_map: map from bondId -> DrawColours providing the highlight colours.
highlight_radii: map from atomId -> radius (in molecule coordinates) for the radii of atomic highlights. If not provided for an index, the default value from drawOptions() will be used.
confId: (optional) conformer ID to be used for atomic coordinates

◆ drawOptions() [1/2]

MolDrawOptions& RDKit::MolDraw2D::drawOptions ( )
inline

returns our current drawing options

Definition at line 645 of file MolDraw2D.h.

◆ drawOptions() [2/2]

const MolDrawOptions& RDKit::MolDraw2D::drawOptions ( ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 647 of file MolDraw2D.h.

◆ drawPolygon()

virtual void RDKit::MolDraw2D::drawPolygon ( const std::vector< Point2D > &  cds)
pure virtual

draw a polygon. Note that if fillPolys() returns false, it doesn't close the path. If you want it to in that case, you do it explicitly yourself.

Implemented in RDKit::MolDraw2DQt, RDKit::MolDraw2DSVG, RDKit::MolDraw2DJS, RDKit::MolDraw2DCairo, and RDKit::MolDraw2Dwx.

◆ drawReaction()

virtual void RDKit::MolDraw2D::drawReaction ( const ChemicalReaction rxn,
bool  highlightByReactant = false,
const std::vector< DrawColour > *  highlightColorsReactants = nullptr,
const std::vector< int > *  confIds = nullptr 
)
virtual

draw a ChemicalReaction

Parameters
rxn: the reaction to draw
highlightByReactant: (optional) if this is set, atoms and bonds will be highlighted based on which reactant they come from. Atom map numbers will not be shown.
highlightColorsReactants: (optional) provide a vector of colors for the reactant highlighting.
confIds: (optional) vector of confIds to use for rendering. These are numbered by reactants, then agents, then products.

◆ drawRect()

virtual void RDKit::MolDraw2D::drawRect ( const Point2D cds1,
const Point2D cds2 
)
virtual

draw a rectangle

◆ drawString() [1/2]

virtual void RDKit::MolDraw2D::drawString ( const std::string &  str,
const Point2D cds 
)
virtual

drawString centres the string on cds.

◆ drawString() [2/2]

virtual void RDKit::MolDraw2D::drawString ( const std::string &  str,
const Point2D cds,
TextAlignType  align 
)
virtual

◆ drawTriangle()

virtual void RDKit::MolDraw2D::drawTriangle ( const Point2D cds1,
const Point2D cds2,
const Point2D cds3 
)
virtual

draw a triangle

◆ drawWavyLine()

virtual void RDKit::MolDraw2D::drawWavyLine ( const Point2D cds1,
const Point2D cds2,
const DrawColour col1,
const DrawColour col2,
unsigned int  nSegments = 16,
double  vertOffset = 0.05 
)
virtual

draw a wavy line like that used to indicate unknown stereochemistry

Reimplemented in RDKit::MolDraw2DSVG, and RDKit::MolDraw2DCairo.

◆ fillPolys()

virtual bool RDKit::MolDraw2D::fillPolys ( ) const
inlinevirtual

set whether or not polygons are being filled

Definition at line 640 of file MolDraw2D.h.

◆ fontSize()

virtual double RDKit::MolDraw2D::fontSize ( ) const
virtual

font size in drawing coordinate units. That's probably pixels.

◆ get2DCoordsForReaction()

void RDKit::MolDraw2D::get2DCoordsForReaction ( ChemicalReaction rxn,
Point2D arrowBegin,
Point2D arrowEnd,
std::vector< double > &  plusLocs,
double  spacing,
const std::vector< int > *  confIds 
)
protected

◆ get2DCoordsMol()

void RDKit::MolDraw2D::get2DCoordsMol ( RWMol mol,
double &  offset,
double  spacing,
double &  maxY,
double &  minY,
int  confId,
bool  shiftAgents,
double  coordScale 
)
protected

◆ getActiveAtmIdx1()

int RDKit::MolDraw2D::getActiveAtmIdx1 ( )
inline

Definition at line 672 of file MolDraw2D.h.

◆ getActiveAtmIdx2()

int RDKit::MolDraw2D::getActiveAtmIdx2 ( )
inline

Definition at line 673 of file MolDraw2D.h.

◆ getAtomCoords() [1/3]

virtual Point2D RDKit::MolDraw2D::getAtomCoords ( const std::pair< double, double > &  screen_cds) const
virtual

transform a point from drawing coordinates to the molecule coordinate system

◆ getAtomCoords() [2/3]

virtual Point2D RDKit::MolDraw2D::getAtomCoords ( const std::pair< int, int > &  screen_cds) const
virtual

◆ getAtomCoords() [3/3]

virtual Point2D RDKit::MolDraw2D::getAtomCoords ( int  at_num) const
virtual

returns the molecular coordinates of a particular atom

◆ getDrawCoords() [1/2]

virtual Point2D RDKit::MolDraw2D::getDrawCoords ( const Point2D mol_cds) const
virtual

transform a point from the molecule coordinate system into the drawing coordinate system

◆ getDrawCoords() [2/2]

virtual Point2D RDKit::MolDraw2D::getDrawCoords ( int  at_num) const
virtual

returns the drawing coordinates of a particular atom

◆ getDrawLineWidth()

virtual double RDKit::MolDraw2D::getDrawLineWidth ( ) const
protectedvirtual

◆ getLabelSize()

void RDKit::MolDraw2D::getLabelSize ( const std::string &  label,
OrientType  orient,
double &  label_width,
double &  label_height 
) const

◆ getStringExtremes()

void RDKit::MolDraw2D::getStringExtremes ( const std::string &  label,
OrientType  orient,
const Point2D cds,
double &  x_min,
double &  y_min,
double &  x_max,
double &  y_max 
) const

◆ getStringSize()

virtual void RDKit::MolDraw2D::getStringSize ( const std::string &  label,
double &  label_width,
double &  label_height 
) const
virtual

using the current scale, work out the size of the label in molecule coordinates.

Bear in mind when implementing this, that, for example, NH2 will appear as NH2 to convey that the 2 is a subscript, and this needs to accounted for in the width and height.

Reimplemented in RDKit::MolDraw2Dwx.

◆ hasActiveAtmIdx()

bool RDKit::MolDraw2D::hasActiveAtmIdx ( )
inline

Definition at line 671 of file MolDraw2D.h.

◆ height()

virtual int RDKit::MolDraw2D::height ( ) const
inlinevirtual

return the height of the drawing area.

Definition at line 522 of file MolDraw2D.h.

◆ highlightCloseContacts()

virtual void RDKit::MolDraw2D::highlightCloseContacts ( )
protectedvirtual

◆ lineWidth()

virtual int RDKit::MolDraw2D::lineWidth ( ) const
inlinevirtual

returns the current line width

Definition at line 581 of file MolDraw2D.h.

◆ minPt()

Point2D RDKit::MolDraw2D::minPt ( ) const
inline

returns the minimum point of the drawing (in molecular coords)

Definition at line 561 of file MolDraw2D.h.

◆ offset()

Point2D RDKit::MolDraw2D::offset ( ) const
inline

returns the drawing offset (in drawing coords)

Definition at line 558 of file MolDraw2D.h.

◆ panelHeight()

virtual int RDKit::MolDraw2D::panelHeight ( ) const
inlinevirtual

return the height of the drawing panels.

Definition at line 526 of file MolDraw2D.h.

◆ panelWidth()

virtual int RDKit::MolDraw2D::panelWidth ( ) const
inlinevirtual

return the width of the drawing panels.

Definition at line 524 of file MolDraw2D.h.

◆ range()

Point2D RDKit::MolDraw2D::range ( ) const
inline

returns the width and height of the grid (in molecular coords)

Definition at line 563 of file MolDraw2D.h.

◆ scale()

double RDKit::MolDraw2D::scale ( ) const
inline

returns the drawing scale (conversion from molecular coords -> drawing coords)

Definition at line 531 of file MolDraw2D.h.

◆ setActiveAtmIdx()

void RDKit::MolDraw2D::setActiveAtmIdx ( int  at_idx1 = -1,
int  at_idx2 = -1 
)
inline

Definition at line 674 of file MolDraw2D.h.

◆ setColour()

virtual void RDKit::MolDraw2D::setColour ( const DrawColour col)
inlinevirtual

sets the current draw color

Reimplemented in RDKit::MolDraw2DQt, RDKit::MolDraw2DSVG, RDKit::MolDraw2DCairo, and RDKit::MolDraw2Dwx.

Definition at line 570 of file MolDraw2D.h.

Referenced by RDKit::MolDraw2Dwx::setColour().

◆ setDash()

virtual void RDKit::MolDraw2D::setDash ( const DashPattern patt)
inlinevirtual

sets the current dash pattern

Definition at line 574 of file MolDraw2D.h.

◆ setFillPolys()

virtual void RDKit::MolDraw2D::setFillPolys ( bool  val)
inlinevirtual

returns either or not polygons should be filled

Definition at line 642 of file MolDraw2D.h.

◆ setFontSize()

virtual void RDKit::MolDraw2D::setFontSize ( double  new_size)
virtual

Reimplemented in RDKit::MolDraw2Dwx.

Referenced by RDKit::MolDraw2Dwx::setFontSize().

◆ setLineWidth()

virtual void RDKit::MolDraw2D::setLineWidth ( int  width)
inlinevirtual

sets the current line width

Definition at line 579 of file MolDraw2D.h.

◆ setOffset()

void RDKit::MolDraw2D::setOffset ( int  x,
int  y 
)
inline

sets the drawing offset (in drawing coords)

Definition at line 553 of file MolDraw2D.h.

◆ setScale()

void RDKit::MolDraw2D::setScale ( int  width,
int  height,
const Point2D minv,
const Point2D maxv,
const ROMol mol = nullptr 
)

explicitly sets the scaling factors for the drawing

◆ supportsAnnotations()

virtual bool RDKit::MolDraw2D::supportsAnnotations ( )
inlinevirtual

Definition at line 668 of file MolDraw2D.h.

◆ tabulaRasa()

void RDKit::MolDraw2D::tabulaRasa ( )

◆ tagAtoms()

virtual void RDKit::MolDraw2D::tagAtoms ( const ROMol mol)
inlinevirtual

adds additional information about the atoms to the output. Does not make sense for all renderers.

Reimplemented in RDKit::MolDraw2DSVG.

Definition at line 638 of file MolDraw2D.h.

References RDUNUSED_PARAM.

◆ width()

virtual int RDKit::MolDraw2D::width ( ) const
inlinevirtual

return the width of the drawing area.

Definition at line 520 of file MolDraw2D.h.

Member Data Documentation

◆ d_metadata

std::vector<std::pair<std::string, std::string> > RDKit::MolDraw2D::d_metadata
protected

Definition at line 870 of file MolDraw2D.h.

◆ d_numMetadataEntries

unsigned int RDKit::MolDraw2D::d_numMetadataEntries = 0
protected

Definition at line 871 of file MolDraw2D.h.

◆ text_drawer_

std::unique_ptr<DrawText> RDKit::MolDraw2D::text_drawer_
protected

Definition at line 685 of file MolDraw2D.h.


The documentation for this class was generated from the following file: