RDKit: RDKit::MolDraw2DSVG Class Reference

| RDKit Open-source cheminformatics and machine learning.

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
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)
| MolDraw2DSVG (int width, int height, int panelWidth=-1, int panelHeight=-1)
void | setFontSize (double new_size)
void | setColour (const DrawColour &col)
| sets the current draw color More...
void | finishDrawing ()
void | drawLine (const Point2D &cds1, const Point2D &cds2)
| draws a line from `cds1` to `cds2` using the current drawing style More...
void | drawString (const std::string &str, const Point2D &cds)
| drawString centres the string on cds. More...
void | drawPolygon (const std::vector< Point2D > &cds)
| draw a polygon More...
void | drawEllipse (const Point2D &cds1, const Point2D &cds2)
| draw an ellipse More...
void | clearDrawing ()
| clears the contes of the drawingd] More...
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...
void | getStringSize (const std::string &label, double &label_width, double &label_height) const
std::string | getDrawingText () const
void | tagAtoms (const ROMol &mol)
Public Member Functions inherited from RDKit::MolDraw2D
| MolDraw2D (int width, int height, int panelWidth=-1, int panelHeight=-1)
| constructor for a particular size More...
virtual | ~MolDraw2D ()
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=NULL, const std::map< int, DrawColour > *highlight_bond_map=NULL, const std::map< int, double > *highlight_radii=NULL, int confId=-1)
| draw a single molecule More...
virtual void | drawMolecule (const ROMol &mol, const std::vector< int > *highlight_atoms=NULL, const std::map< int, DrawColour > *highlight_map=NULL, const std::map< int, double > *highlight_radii=NULL, int confId=-1)
virtual void | drawMolecule (const ROMol &mol, const std::string &legend, const std::vector< int > *highlight_atoms=NULL, const std::map< int, DrawColour > *highlight_map=NULL, const std::map< int, double > *highlight_radii=NULL, int confId=-1)
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=NULL, const std::map< int, DrawColour > *highlight_bond_map=NULL, const std::map< int, double > *highlight_radii=NULL, int confId=-1)
virtual void | drawMolecules (const std::vector< ROMol * > &mols, const std::vector< std::string > *legends=NULL, const std::vector< std::vector< int > > *highlight_atoms=NULL, const std::vector< std::vector< int > > *highlight_bonds=NULL, const std::vector< std::map< int, DrawColour > > *highlight_atom_maps=NULL, const std::vector< std::map< int, DrawColour > > *highlight_bond_maps=NULL, const std::vector< std::map< int, double > > *highlight_radii=NULL, const std::vector< int > *confIds=NULL)
| draw multiple molecules in a grid More...
virtual void | drawReaction (const ChemicalReaction &rxn, bool highlightByReactant=false, const std::vector< DrawColour > *highlightColorsReactants=NULL, const std::vector< int > *confIds=NULL)
| draw a ChemicalReaction 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...
double | scale () const
| returns the drawing scale (conversion from molecular coords -> drawing More...
void | calculateScale (int width, int height)
| calculates the drawing scale (conversion from molecular coords -> drawing More...
void | calculateScale ()
void | setScale (int width, int height, const Point2D &minv, const Point2D &maxv)
| 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 ()
| returns the drawing offset (in drawing coords) More...
virtual double | fontSize () const
| returns the font size (in nolecule units) 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 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...
bool | setStringDrawMode (const std::string &instring, TextDrawType &draw_mode, int &i) const
virtual void | drawTriangle (const Point2D &cds1, const Point2D &cds2, const Point2D &cds3)
| draw a triange More...
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 bool | fillPolys () const
| set whether or not polygons are being filled More...
virtual void | setFillPolys (bool val)
| returns ehther or not polygons should be filled More...
MolDrawOptions & | drawOptions ()
| returns our current drawing options More...
const MolDrawOptions & | drawOptions () const
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 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...

## Additional Inherited Members
Public Types inherited from RDKit::MolDraw2D
enum | OrientType { C = 0, N, E, S, W }
enum | TextDrawType { TextDrawNormal = 0, TextDrawSuperscript, TextDrawSubscript }
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 ()
Point2D | calcPerpendicular (const Point2D &cds1, const Point2D &cds2)

## Detailed Description

Definition at line 26 of file MolDraw2DSVG.h.

## Constructor & Destructor Documentation

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

Definition at line 29 of file MolDraw2DSVG.h.

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

Definition at line 35 of file MolDraw2DSVG.h.

References clearDrawing(), drawEllipse(), drawLine(), drawPolygon(), drawString(), drawWavyLine(), finishDrawing(), getStringSize(), setColour(), and setFontSize().

## Member Function Documentation

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

clears the contes of the drawingd]

Implements RDKit::MolDraw2D.

Referenced by MolDraw2DSVG().

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

draw an ellipse

Reimplemented from RDKit::MolDraw2D.

Referenced by MolDraw2DSVG().

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

draws a line from `cds1` to `cds2` using the current drawing style

Implements RDKit::MolDraw2D.

Referenced by MolDraw2DSVG().

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

draw a polygon

Implements RDKit::MolDraw2D.

Referenced by MolDraw2DSVG().

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

drawString centres the string on cds.

Reimplemented from RDKit::MolDraw2D.

Referenced by MolDraw2DSVG().

void RDKit::MolDraw2DSVG::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 from RDKit::MolDraw2D.

Referenced by MolDraw2DSVG().

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

Referenced by MolDraw2DSVG().

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

Definition at line 67 of file MolDraw2DSVG.h.

References tagAtoms().

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

Implements RDKit::MolDraw2D.

Referenced by MolDraw2DSVG().

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

sets the current draw color

Reimplemented from RDKit::MolDraw2D.

Referenced by MolDraw2DSVG().

void RDKit::MolDraw2DSVG::setFontSize | ( | double | new_size | ) |
| virtual

set font size in molecule coordinate units. That's probably Angstrom for RDKit.

Reimplemented from RDKit::MolDraw2D.

Referenced by MolDraw2DSVG().

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

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

Reimplemented from RDKit::MolDraw2D.

Referenced by getDrawingText().

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

- MolDraw2DSVG.h