RDKit: RDKit::MolDraw2D Class Reference

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
RDKit::MolDraw2D Class Referenceabstract

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

`#include <MolDraw2D.h>`

Inheritance diagram for RDKit::MolDraw2D:

## Public Member Functions
| MolDraw2D (int width, int height, int panelWidth, int panelHeight)
| constructor for a particular size
| MolDraw2D (const MolDraw2D &rhs)=delete
| MolDraw2D (MolDraw2D &&rhs)=delete
MolDraw2D & | operator= (const MolDraw2D &rhs)=delete
MolDraw2D & | operator= (MolDraw2D &&rhs)=delete
virtual | ~MolDraw2D ()
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
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.
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.
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.
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.
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
void | drawReaction (const ChemicalReaction &rxn, bool highlightByReactant=false, const std::vector< DrawColour > *highlightColorsReactants=nullptr, const std::vector< int > *confIds=nullptr)
| draw a ChemicalReaction
std::pair< int, int > | getMolSize (const ROMol &mol, const std::string &legend="", const std::vector< int > *highlight_atoms=nullptr, const std::vector< int > *highlight_bonds=nullptr, 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)
| returns the size of the box for the molecule with current drawing settings
virtual void | clearDrawing ()
| clears the contents of the drawing
virtual void | drawLine (const Point2D &cds1, const Point2D &cds2, bool rawCoords=false)=0
virtual void | drawPolygon (const std::vector< Point2D > &cds, bool rawCoords=false)=0
virtual void | drawLine (const Point2D &cds1, const Point2D &cds2, const DrawColour &col1, const DrawColour &col2, bool rawCoords=false)
| draw a line where the ends are different colours
virtual void | drawTriangle (const Point2D &cds1, const Point2D &cds2, const Point2D &cds3, bool rawCoords=false)
| draw a triangle
virtual void | drawEllipse (const Point2D &cds1, const Point2D &cds2, bool rawCoords=false)
| draw an ellipse
virtual void | drawArc (const Point2D &centre, double radius, double ang1, double ang2, bool rawCoords=false)
virtual void | drawArc (const Point2D &centre, double xradius, double yradius, double ang1, double ang2, bool rawCoords=false)
virtual void | drawRect (const Point2D &cds1, const Point2D &cds2, bool rawCoords=false)
| draw a rectangle given two opposite corners
virtual void | drawAttachmentLine (const Point2D &cds1, const Point2D &cds2, const DrawColour &col, double len=1.0, unsigned int nSegments=16, bool rawCoords=false)
virtual void | drawWavyLine (const Point2D &cds1, const Point2D &cds2, const DrawColour &col1, const DrawColour &col2, unsigned int nSegments=16, double vertOffset=0.05, bool rawCoords=false)
| draw a wavy line like that used to indicate unknown stereochemistry
virtual void | drawArrow (const Point2D &cds1, const Point2D &cds2, bool asPolygon=false, double frac=0.05, double angle=M_PI/6, const DrawColour &col=DrawColour(0.0, 0.0, 0.0), bool rawCoords=false)
virtual void | drawPlus (const Point2D &cds, int plusWidth, const DrawColour &col, bool rawCoords=false)
virtual void | drawString (const std::string &str, const Point2D &cds, bool rawCoords=false)
| drawString centres the string on cds.
virtual void | drawString (const std::string &str, const Point2D &cds, MolDraw2D_detail::TextAlignType align, bool rawCoords=false)
const std::vector< Point2D > & | atomCoords () const
const std::vector< std::pair< std::string, MolDraw2D_detail::OrientType > > & | atomSyms () const
| returns the atomic symbols of the activeMolIdx_ molecule
int | width () const
| return the width of the drawing area.
int | height () const
| return the height of the drawing area.
int | panelWidth () const
| return the width of the drawing panels.
int | panelHeight () const
| return the height of the drawing panels.
void | setFlexiMode (bool mode)
bool | flexiMode () const
int | drawHeight () const
double | getDrawLineWidth () const
double | scale () const
void | setScale (double newScale)
| explicitly sets the scaling factors for the drawing
void | setScale (int width, int height, const Point2D &minv, const Point2D &maxv, const ROMol *mol=nullptr)
void | setOffset (int x, int y)
| sets the drawing offset (in drawing coords)
Point2D | offset () const
| returns the drawing offset (in drawing coords)
Point2D | minPt () const
| returns the minimum point of the drawing (in molecular coords)
Point2D | range () const
| returns the width and height of the grid (in molecular coords)
virtual double | fontSize () const
| font size in drawing coordinate units. That's probably pixels.
virtual void | setFontSize (double new_size)
virtual void | setColour (const DrawColour &col)
| sets the current draw color
virtual DrawColour | colour () const
| returns the current draw color
virtual void | setDash (const DashPattern &patt)
| sets the current dash pattern
virtual const DashPattern & | dash () const
| returns the current dash pattern
virtual void | setLineWidth (double width)
| sets the current line width
virtual double | lineWidth () const
| returns the current line width
virtual void | getStringSize (const std::string &label, double &label_width, double &label_height) const
void | getLabelSize (const std::string &label, MolDraw2D_detail::OrientType orient, double &label_width, double &label_height) const
void | getStringExtremes (const std::string &label, MolDraw2D_detail::OrientType orient, const Point2D &cds, double &x_min, double &y_min, double &x_max, double &y_max) const
virtual void | tagAtoms (const ROMol &mol)
virtual bool | fillPolys () const
| set whether or not polygons are being filled
virtual void | setFillPolys (bool val)
| returns either or not polygons should be filled
MolDrawOptions & | drawOptions ()
| returns our current drawing options
const MolDrawOptions & | drawOptions () const
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
virtual bool | supportsAnnotations () const
void | setActiveMolIdx (int newIdx)
bool | hasActiveAtmIdx () const
int | getActiveAtmIdx1 () const
int | getActiveAtmIdx2 () const
void | setActiveAtmIdx (int at_idx1=-1, int at_idx2=-1)
bool | hasActiveBndIdx () const
int | getActiveBndIdx () const
void | setActiveBndIdx (int bnd_idx=-1)
void | setActiveClass (std::string actClass=std::string(""))
std::string | getActiveClass () const
Transformations
virtual Point2D | getDrawCoords (const Point2D &mol_cds) const
virtual Point2D | getDrawCoords (int at_num) const
| returns the drawing coordinates of a particular atom
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

## Protected Attributes
std::unique_ptr< MolDraw2D_detail::DrawText > | text_drawer_
std::string | d_activeClass
bool | needs_init_ = true
std::vector< std::pair< std::string, std::string > > | d_metadata
unsigned int | d_numMetadataEntries = 0

## Detailed Description

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

Definition at line 47 of file MolDraw2D.h.

## Constructor & Destructor Documentation

## ◆ MolDraw2D() [1/3]

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

constructor for a particular size

Parameters

  width | : width (in pixels) of the rendering set this to -1 to have the canvas size set automatically
  height | : height (in pixels) of the rendering set this to -1 to have the canvas size set automatically
  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.

References height(), panelHeight(), panelWidth(), and width().

Referenced by MolDraw2D(), MolDraw2D(), RDKit::MolDraw2DCairo::MolDraw2DCairo(), RDKit::MolDraw2DCairo::MolDraw2DCairo(), RDKit::MolDraw2DJS::MolDraw2DJS(), RDKit::MolDraw2Dwx::MolDraw2Dwx(), operator=(), and operator=().

## ◆ MolDraw2D() [2/3]

RDKit::MolDraw2D::MolDraw2D | ( | const MolDraw2D & | rhs | ) |
| delete

References MolDraw2D().

## ◆ MolDraw2D() [3/3]

RDKit::MolDraw2D::MolDraw2D | ( | MolDraw2D && | rhs | ) |
| delete

References MolDraw2D().

## ◆ ~MolDraw2D()

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

## Member Function Documentation

## ◆ atomCoords()

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

returns the coordinates of the atoms of the activeMolIdx_ molecule in molecular coordinates.

## ◆ atomSyms()

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

returns the atomic symbols of the activeMolIdx_ molecule

## ◆ clearDrawing()

virtual void RDKit::MolDraw2D::clearDrawing | ( |  | ) |
| inlinevirtual

clears the contents of the drawing

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

Definition at line 212 of file MolDraw2D.h.

References needs_init_.

## ◆ colour()

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

returns the current draw color

Definition at line 382 of file MolDraw2D.h.

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

## ◆ dash()

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

returns the current dash pattern

Definition at line 386 of file MolDraw2D.h.

## ◆ drawArc() [1/2]

virtual void RDKit::MolDraw2D::drawArc | ( | const Point2D & | centre,
|  | double | radius,
|  | double | ang1,
|  | double | ang2,
|  | bool | rawCoords = false )
| virtual

## ◆ drawArc() [2/2]

virtual void RDKit::MolDraw2D::drawArc | ( | const Point2D & | centre,
|  | double | xradius,
|  | double | yradius,
|  | double | ang1,
|  | double | ang2,
|  | bool | rawCoords = false )
| 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,
|  | const DrawColour & | col = DrawColour(0.0, 0.0, 0.0),
|  | bool | rawCoords = false )
| virtual

Draw an arrow with either lines or a filled head (when asPolygon is true). Angle is the half-angle at the point, so the default gives total angle of 60 degrees at the arrow head.

References M_PI.

## ◆ drawAttachmentLine()

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

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

## ◆ drawEllipse()

virtual void RDKit::MolDraw2D::drawEllipse | ( | const Point2D & | cds1,
|  | const Point2D & | cds2,
|  | bool | rawCoords = false )
| virtual

draw an ellipse

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

## ◆ drawHeight()

int RDKit::MolDraw2D::drawHeight | ( |  | ) | const
| inline

Definition at line 351 of file MolDraw2D.h.

## ◆ drawLine() [1/2]

virtual void RDKit::MolDraw2D::drawLine | ( | const Point2D & | cds1,
|  | const Point2D & | cds2,
|  | bool | rawCoords = false )
| pure virtual

draws a line from `cds1` to `cds2` using the current drawing style in atom coords. If rawCoords is passed as true, the coordinates are used as is, if not they are assumed to be in the molecule coordinate frame and converted with getDrawCoords into canvas coords.

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

## ◆ drawLine() [2/2]

virtual void RDKit::MolDraw2D::drawLine | ( | const Point2D & | cds1,
|  | const Point2D & | cds2,
|  | const DrawColour & | col1,
|  | const DrawColour & | col2,
|  | bool | rawCoords = false )
| virtual

draw a line where the ends are different colours

A Whole bunch of drawing primitives. They may be over-ridden by different renderers, or they may be implemented in terms of drawLine and drawPolygon above. If rawCoords is passed as true,

## ◆ drawMolecule() [1/4]

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 )

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]

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 )

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]

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 )

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]

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 )

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

## ◆ drawMolecules()

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 )

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()

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 )

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 for the bonds. If the highlight style is Lasso (as opposed to the default CircleAndLine) then the colours in the highlight_bond_map will be ignored, although the entries in the map will control which bonds are highlighted. The lasso will be coloured according to the associated atom 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.
  highlight_linewidth_multipliers | : map from atomId -> int, used to vary the width the highlight lines. Only active if drawOptions().fillHighlights is false.
  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 424 of file MolDraw2D.h.

Referenced by RDKit::MolDraw2Dwx::clearDrawing(), lineWidth(), RDKit::setDarkMode(), setLineWidth(), and RDKit::setMonochromeMode().

## ◆ 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 426 of file MolDraw2D.h.

## ◆ drawPlus()

virtual void RDKit::MolDraw2D::drawPlus | ( | const Point2D & | cds,
|  | int | plusWidth,
|  | const DrawColour & | col,
|  | bool | rawCoords = false )
| virtual

## ◆ drawPolygon()

virtual void RDKit::MolDraw2D::drawPolygon | ( | const std::vector< Point2D > & | cds,
|  | bool | rawCoords = false )
| 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. If rawCoords is passed as true, the coordinates are used as is, if not they are assumed to be in the molecule coordinate frame and converted with getDrawCoords into canvas coords.

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

## ◆ drawReaction()

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

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,
|  | bool | rawCoords = false )
| virtual

draw a rectangle given two opposite corners

## ◆ drawString() [1/2]

virtual void RDKit::MolDraw2D::drawString | ( | const std::string & | str,
|  | const Point2D & | cds,
|  | bool | rawCoords = false )
| virtual

drawString centres the string on cds.

## ◆ drawString() [2/2]

virtual void RDKit::MolDraw2D::drawString | ( | const std::string & | str,
|  | const Point2D & | cds,
|  | MolDraw2D_detail::TextAlignType | align,
|  | bool | rawCoords = false )
| virtual

## ◆ drawTriangle()

virtual void RDKit::MolDraw2D::drawTriangle | ( | const Point2D & | cds1,
|  | const Point2D & | cds2,
|  | const Point2D & | cds3,
|  | bool | rawCoords = false )
| 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,
|  | bool | rawCoords = false )
| virtual

draw a wavy line like that used to indicate unknown stereochemistry

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

## ◆ fillPolys()

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

set whether or not polygons are being filled

Definition at line 419 of file MolDraw2D.h.

## ◆ flexiMode()

bool RDKit::MolDraw2D::flexiMode | ( |  | ) | const
| inline

Definition at line 349 of file MolDraw2D.h.

## ◆ fontSize()

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

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

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

## ◆ getActiveAtmIdx1()

int RDKit::MolDraw2D::getActiveAtmIdx1 | ( |  | ) | const
| inline

Definition at line 432 of file MolDraw2D.h.

## ◆ getActiveAtmIdx2()

int RDKit::MolDraw2D::getActiveAtmIdx2 | ( |  | ) | const
| inline

Definition at line 433 of file MolDraw2D.h.

## ◆ getActiveBndIdx()

int RDKit::MolDraw2D::getActiveBndIdx | ( |  | ) | const
| inline

Definition at line 436 of file MolDraw2D.h.

## ◆ getActiveClass()

std::string RDKit::MolDraw2D::getActiveClass | ( |  | ) | const
| inline

Definition at line 443 of file MolDraw2D.h.

References d_activeClass.

## ◆ 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. Prefers globalDrawTrans_ if it exists, otherwise uses drawMols_[activeMolIdx_].

## ◆ getAtomCoords() [2/3]

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

Prefers globalDrawTrans_ if it exists, otherwise uses drawMols_[activeMolIdx_].

## ◆ getAtomCoords() [3/3]

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

returns the molecular coordinates of a particular atom. at_num refers to the atom in activeMolIdx_.

## ◆ 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. Prefers globalDrawTrans_ if it exists, otherwise uses drawMols_[activeMolIdx_].

Referenced by RDKit::MolDraw2Dwx::drawLine(), and RDKit::MolDraw2Dwx::drawPolygon().

## ◆ getDrawCoords() [2/2]

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

returns the drawing coordinates of a particular atom

## ◆ getDrawLineWidth()

double RDKit::MolDraw2D::getDrawLineWidth | ( |  | ) | const

## ◆ getLabelSize()

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

## ◆ getMolSize()

std::pair< int, int > RDKit::MolDraw2D::getMolSize | ( | const ROMol & | mol,
|  | const std::string & | legend = "",
|  | const std::vector< int > * | highlight_atoms = nullptr,
|  | const std::vector< int > * | highlight_bonds = nullptr,
|  | 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 )

returns the size of the box for the molecule with current drawing settings

## ◆ getStringExtremes()

void RDKit::MolDraw2D::getStringExtremes | ( | const std::string & | label,
|  | MolDraw2D_detail::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 | ( |  | ) | const
| inline

Definition at line 431 of file MolDraw2D.h.

## ◆ hasActiveBndIdx()

bool RDKit::MolDraw2D::hasActiveBndIdx | ( |  | ) | const
| inline

Definition at line 435 of file MolDraw2D.h.

## ◆ height()

int RDKit::MolDraw2D::height | ( |  | ) | const
| inline

return the height of the drawing area.

Definition at line 334 of file MolDraw2D.h.

Referenced by RDKit::MolDraw2Dwx::clearDrawing(), RDKit::MolDraw2Dwx::getStringSize(), MolDraw2D(), RDKit::MolDraw2DCairo::MolDraw2DCairo(), RDKit::MolDraw2DCairo::MolDraw2DCairo(), RDKit::MolDraw2DJS::MolDraw2DJS(), RDKit::MolDraw2DQt::MolDraw2DQt(), RDKit::MolDraw2DSVG::MolDraw2DSVG(), RDKit::MolDraw2DSVG::MolDraw2DSVG(), RDKit::MolDraw2Dwx::MolDraw2Dwx(), and setScale().

## ◆ lineWidth()

virtual double RDKit::MolDraw2D::lineWidth | ( |  | ) | const
| inlinevirtual

returns the current line width

Definition at line 393 of file MolDraw2D.h.

References drawOptions().

## ◆ minPt()

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

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

## ◆ offset()

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

returns the drawing offset (in drawing coords)

Definition at line 368 of file MolDraw2D.h.

## ◆ operator=() [1/2]

MolDraw2D & RDKit::MolDraw2D::operator= | ( | const MolDraw2D & | rhs | ) |
| delete

References MolDraw2D().

## ◆ operator=() [2/2]

MolDraw2D & RDKit::MolDraw2D::operator= | ( | MolDraw2D && | rhs | ) |
| delete

References MolDraw2D().

## ◆ panelHeight()

int RDKit::MolDraw2D::panelHeight | ( |  | ) | const
| inline

return the height of the drawing panels.

Definition at line 338 of file MolDraw2D.h.

Referenced by MolDraw2D(), RDKit::MolDraw2DCairo::MolDraw2DCairo(), RDKit::MolDraw2DCairo::MolDraw2DCairo(), RDKit::MolDraw2DJS::MolDraw2DJS(), RDKit::MolDraw2DQt::MolDraw2DQt(), RDKit::MolDraw2DSVG::MolDraw2DSVG(), RDKit::MolDraw2DSVG::MolDraw2DSVG(), and RDKit::MolDraw2Dwx::MolDraw2Dwx().

## ◆ panelWidth()

int RDKit::MolDraw2D::panelWidth | ( |  | ) | const
| inline

return the width of the drawing panels.

Definition at line 336 of file MolDraw2D.h.

Referenced by MolDraw2D(), RDKit::MolDraw2DCairo::MolDraw2DCairo(), RDKit::MolDraw2DCairo::MolDraw2DCairo(), RDKit::MolDraw2DJS::MolDraw2DJS(), RDKit::MolDraw2DQt::MolDraw2DQt(), RDKit::MolDraw2DSVG::MolDraw2DSVG(), RDKit::MolDraw2DSVG::MolDraw2DSVG(), and RDKit::MolDraw2Dwx::MolDraw2Dwx().

## ◆ range()

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

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

## ◆ scale()

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

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

Referenced by RDKit::MolDraw2Dwx::getStringSize(), and RDKit::MolDraw2Dwx::setFontSize().

## ◆ setActiveAtmIdx()

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

## ◆ setActiveBndIdx()

void RDKit::MolDraw2D::setActiveBndIdx | ( | int | bnd_idx = -1 | ) |
| inline

Definition at line 437 of file MolDraw2D.h.

## ◆ setActiveClass()

void RDKit::MolDraw2D::setActiveClass | ( | std::string | actClass = std::string("") | ) |
| inline

Definition at line 440 of file MolDraw2D.h.

References d_activeClass.

## ◆ setActiveMolIdx()

void RDKit::MolDraw2D::setActiveMolIdx | ( | int | newIdx | ) |

## ◆ setColour()

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

sets the current draw color

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

Definition at line 380 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 384 of file MolDraw2D.h.

## ◆ setFillPolys()

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

returns either or not polygons should be filled

Definition at line 421 of file MolDraw2D.h.

## ◆ setFlexiMode()

void RDKit::MolDraw2D::setFlexiMode | ( | bool | mode | ) |
| inline

when FlexiMode is set, molecules will always be drawn with the default values for bond length, font size, etc.

Definition at line 342 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 | ( | double | width | ) |
| inlinevirtual

sets the current line width

Definition at line 389 of file MolDraw2D.h.

References drawOptions(), and width().

## ◆ setOffset()

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

sets the drawing offset (in drawing coords)

Definition at line 363 of file MolDraw2D.h.

## ◆ setScale() [1/2]

void RDKit::MolDraw2D::setScale | ( | double | newScale | ) |

explicitly sets the scaling factors for the drawing

## ◆ setScale() [2/2]

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

References height(), and width().

## ◆ supportsAnnotations()

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

Definition at line 428 of file MolDraw2D.h.

Referenced by RDKit::MolDraw2DCairo::writeDrawingText().

## ◆ 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 417 of file MolDraw2D.h.

References RDUNUSED_PARAM.

## ◆ width()

int RDKit::MolDraw2D::width | ( |  | ) | const
| inline

return the width of the drawing area.

Definition at line 332 of file MolDraw2D.h.

Referenced by RDKit::MolDraw2Dwx::clearDrawing(), RDKit::MolDraw2Dwx::getStringSize(), MolDraw2D(), RDKit::MolDraw2DCairo::MolDraw2DCairo(), RDKit::MolDraw2DCairo::MolDraw2DCairo(), RDKit::MolDraw2DJS::MolDraw2DJS(), RDKit::MolDraw2DQt::MolDraw2DQt(), RDKit::MolDraw2DSVG::MolDraw2DSVG(), RDKit::MolDraw2DSVG::MolDraw2DSVG(), RDKit::MolDraw2Dwx::MolDraw2Dwx(), setLineWidth(), and setScale().

## Member Data Documentation

## ◆ d_activeClass

std::string RDKit::MolDraw2D::d_activeClass
| protected

Definition at line 447 of file MolDraw2D.h.

Referenced by getActiveClass(), and setActiveClass().

## ◆ d_metadata

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

Definition at line 449 of file MolDraw2D.h.

## ◆ d_numMetadataEntries

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

Definition at line 450 of file MolDraw2D.h.

## ◆ needs_init_

bool RDKit::MolDraw2D::needs_init_ = true
| protected

Definition at line 448 of file MolDraw2D.h.

Referenced by clearDrawing(), RDKit::MolDraw2DCairo::MolDraw2DCairo(), and RDKit::MolDraw2DJS::MolDraw2DJS().

## ◆ text_drawer_

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

Definition at line 446 of file MolDraw2D.h.

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

- MolDraw2D.h