RDKit::MolDraw2DSVG Class Reference

`#include <MolDraw2DSVG.h>`

Inheritance diagram for RDKit::MolDraw2DSVG:

## Public Member Functions

| MolDraw2DSVG (int width, int height, std::ostream &os, int panelWidth=-1, int panelHeight=-1, bool noFreetype=false)
| MolDraw2DSVG (int width, int height, int panelWidth=-1, int panelHeight=-1, bool noFreetype=false)
void | setColour (const DrawColour &col) override
| sets the current draw color More...
void | finishDrawing ()
void | drawLine (const Point2D &cds1, const Point2D &cds2) override
void | drawPolygon (const std::vector< Point2D > &cds) override
void | drawEllipse (const Point2D &cds1, const Point2D &cds2) override
| draw an ellipse More...
void | clearDrawing () override
| clears the contents of the drawing More...
void | drawWavyLine (const Point2D &cds1, const Point2D &cds2, const DrawColour &col1, const DrawColour &col2, unsigned int nSegments=16, double vertOffset=0.05) override
| draw a wavy line like that used to indicate unknown stereochemistry More...
std::string | getDrawingText () const
void | tagAtoms (const ROMol &mol) override
void | tagAtoms (const ROMol &mol, double radius, const std::map< std::string, std::string > &events={})
void | addMoleculeMetadata (const ROMol &mol, int confId=-1) const
void | addMoleculeMetadata (const std::vector< ROMol * > &mols, const std::vector< int > confIds={}) const
void | drawAnnotation (const AnnotationType &annot) override
virtual void | tagAtoms (const ROMol &mol)
Public Member Functions inherited from RDKit::MolDraw2D
| MolDraw2D (int width, int height, int panelWidth, int panelHeight)
| constructor for a particular size More...
virtual | ~MolDraw2D ()
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 DrawColour | colour () const
| returns the current draw color More...
virtual void | setDash (const DashPattern &patt)
| sets the current dash pattern More...
virtual const DashPattern & | dash () 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 | 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 | drawLine (const Point2D &cds1, const Point2D &cds2, const DrawColour &col1, const DrawColour &col2)
| draw a line where the ends are different colours More...
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...
MolDrawOptions & | drawOptions ()
| returns our current drawing options More...
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. 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 ()
bool | hasActiveAtmIdx ()
int | getActiveAtmIdx1 ()
int | getActiveAtmIdx2 ()
void | setActiveAtmIdx (int at_idx1=-1, int at_idx2=-1)
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...

## Protected Member Functions

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) override
void | drawAtomLabel (int atom_num, const DrawColour &draw_colour) override
void | drawAnnotation (const std::string &note, const StringRect &note_rect) override
| DEPRECATED. More...
virtual void | outputClasses ()
Protected Member Functions inherited from RDKit::MolDraw2D
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 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)

## Additional Inherited Members

Protected Attributes inherited from RDKit::MolDraw2D
std::unique_ptr< DrawText > | text_drawer_
std::vector< std::pair< std::string, std::string > > | d_metadata
unsigned int | d_numMetadataEntries = 0

## Detailed Description

Definition at line 28 of file MolDraw2DSVG.h.

## Constructor & Destructor Documentation

## MolDraw2DSVG() [1/2]

RDKit::MolDraw2DSVG::MolDraw2DSVG | ( | int | width,
|  | int | height,
|  | std::ostream & | os,
|  | int | panelWidth = `-1`,
|  | int | panelHeight = `-1`,
|  | bool | noFreetype = `false`
| ) |  |

inline

Definition at line 31 of file MolDraw2DSVG.h.

## MolDraw2DSVG() [2/2]

RDKit::MolDraw2DSVG::MolDraw2DSVG | ( | int | width,
|  | int | height,
|  | int | panelWidth = `-1`,
|  | int | panelHeight = `-1`,
|  | bool | noFreetype = `false`
| ) |  |

inline

Definition at line 39 of file MolDraw2DSVG.h.

## Member Function Documentation

## addMoleculeMetadata() [1/2]

void RDKit::MolDraw2DSVG::addMoleculeMetadata | ( | const ROMol & | mol,
|  | int | confId = `-1`
| ) |  | const

## addMoleculeMetadata() [2/2]

void RDKit::MolDraw2DSVG::addMoleculeMetadata | ( | const std::vector< ROMol * > & | mols,
|  | const std::vector< int > | confIds = `{}`
| ) |  | const

## clearDrawing()

void RDKit::MolDraw2DSVG::clearDrawing | ( |  | ) |

override virtual

clears the contents of the drawing

Implements RDKit::MolDraw2D.

## drawAnnotation() [1/2]

void RDKit::MolDraw2DSVG::drawAnnotation | ( | const AnnotationType & | annot | ) |

override virtual

Reimplemented from RDKit::MolDraw2D.

## drawAnnotation() [2/2]

void RDKit::MolDraw2DSVG::drawAnnotation | ( | const std::string & | note,
|  | const StringRect & | note_rect
| ) |  |

inline override protected virtual

DEPRECATED.

Reimplemented from RDKit::MolDraw2D.

Definition at line 99 of file MolDraw2DSVG.h.

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

## drawAtomLabel()

void RDKit::MolDraw2DSVG::drawAtomLabel | ( | int | atom_num,
|  | const DrawColour & | draw_colour
| ) |  |

override protected virtual

Reimplemented from RDKit::MolDraw2D.

## drawBond()

void RDKit::MolDraw2DSVG::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`
| ) |  |

override protected virtual

Reimplemented from RDKit::MolDraw2D.

## drawEllipse()

void RDKit::MolDraw2DSVG::drawEllipse | ( | const Point2D & | cds1,
|  | const Point2D & | cds2
| ) |  |

override virtual

draw an ellipse

Reimplemented from RDKit::MolDraw2D.

## drawLine()

void RDKit::MolDraw2DSVG::drawLine | ( | const Point2D & | cds1,
|  | const Point2D & | cds2
| ) |  |

override virtual

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

Implements RDKit::MolDraw2D.

## drawPolygon()

void RDKit::MolDraw2DSVG::drawPolygon | ( | const std::vector< Point2D > & | cds | ) |

override 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.

Implements RDKit::MolDraw2D.

## drawWavyLine()

void RDKit::MolDraw2DSVG::drawWavyLine | ( | const Point2D & | cds1,
|  | const Point2D & | cds2,
|  | const DrawColour & | col1,
|  | const DrawColour & | col2,
|  | unsigned int | nSegments = `16`,
|  | double | vertOffset = `0.05`
| ) |  |

override virtual

draw a wavy line like that used to indicate unknown stereochemistry

Reimplemented from RDKit::MolDraw2D.

## finishDrawing()

void RDKit::MolDraw2DSVG::finishDrawing | ( |  | ) |

## getDrawingText()

std::string RDKit::MolDraw2DSVG::getDrawingText | ( |  | ) | const

inline

Definition at line 64 of file MolDraw2DSVG.h.

## outputClasses()

virtual void RDKit::MolDraw2DSVG::outputClasses | ( |  | ) |

protected virtual

## setColour()

void RDKit::MolDraw2DSVG::setColour | ( | const DrawColour & | col | ) |

override virtual

sets the current draw color

Reimplemented from RDKit::MolDraw2D.

## tagAtoms() [1/3]

virtual void RDKit::MolDraw2D::tagAtoms

inline

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

Definition at line 638 of file MolDraw2D.h.

## tagAtoms() [2/3]

void RDKit::MolDraw2DSVG::tagAtoms | ( | const ROMol & | mol | ) |

inline override virtual

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

Reimplemented from RDKit::MolDraw2D.

Definition at line 69 of file MolDraw2DSVG.h.

References tagAtoms().

Referenced by tagAtoms().

## tagAtoms() [3/3]

void RDKit::MolDraw2DSVG::tagAtoms | ( | const ROMol & | mol,
|  | double | radius,
|  | const std::map< std::string, std::string > & | events = `{}`
| ) |  |

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

- MolDraw2DSVG.h