RDKit: RDKit::MolDraw2DCairo Class Reference

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
Public Member Functions | List of all members
RDKit::MolDraw2DCairo Class Reference

`#include <MolDraw2DCairo.h>`

Inheritance diagram for RDKit::MolDraw2DCairo:

## Public Member Functions
| MolDraw2DCairo (int width, int height, cairo_t *cr, int panelWidth=-1, int panelHeight=-1, bool noFreetype=false)
| MolDraw2DCairo (int width, int height, int panelWidth=-1, int panelHeight=-1, bool noFreetype=false)
| MolDraw2DCairo (const MolDraw2DCairo &)=delete
| MolDraw2DCairo (MolDraw2DCairo &&)=delete
MolDraw2DCairo & | operator= (const MolDraw2DCairo &)=delete
MolDraw2DCairo & | operator= (MolDraw2DCairo &&)=delete
| ~MolDraw2DCairo ()
void | setColour (const DrawColour &col) override
| sets the current draw color
void | finishDrawing ()
void | drawLine (const Point2D &cds1, const Point2D &cds2, bool rawCoords=false) override
void | drawPolygon (const std::vector< Point2D > &cds, bool rawCoords=false) override
void | clearDrawing () override
| clears the contents of the drawing
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) override
| draw a wavy line like that used to indicate unknown stereochemistry
std::string | getDrawingText () const
void | writeDrawingText (const std::string &fName) const
Public Member Functions inherited from RDKit::MolDraw2D
| 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 | 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 | 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 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
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

## Additional Inherited Members
Protected Attributes inherited from RDKit::MolDraw2D
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

Definition at line 27 of file MolDraw2DCairo.h.

## Constructor & Destructor Documentation

## ◆ MolDraw2DCairo() [1/4]

RDKit::MolDraw2DCairo::MolDraw2DCairo | ( | int | width,
|  | int | height,
|  | cairo_t * | cr,
|  | int | panelWidth = -1,
|  | int | panelHeight = -1,
|  | bool | noFreetype = false )
| inline

Definition at line 30 of file MolDraw2DCairo.h.

References RDKit::MolDraw2D::height(), RDKit::MolDraw2D::MolDraw2D(), RDKit::MolDraw2D::panelHeight(), RDKit::MolDraw2D::panelWidth(), and RDKit::MolDraw2D::width().

Referenced by MolDraw2DCairo(), MolDraw2DCairo(), operator=(), and operator=().

## ◆ MolDraw2DCairo() [2/4]

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

Definition at line 37 of file MolDraw2DCairo.h.

References RDKit::MolDraw2D::height(), RDKit::MolDraw2D::MolDraw2D(), RDKit::MolDraw2D::needs_init_, RDKit::MolDraw2D::panelHeight(), RDKit::MolDraw2D::panelWidth(), and RDKit::MolDraw2D::width().

## ◆ MolDraw2DCairo() [3/4]

RDKit::MolDraw2DCairo::MolDraw2DCairo | ( | const MolDraw2DCairo & |  | ) |
| delete

References MolDraw2DCairo().

## ◆ MolDraw2DCairo() [4/4]

RDKit::MolDraw2DCairo::MolDraw2DCairo | ( | MolDraw2DCairo && |  | ) |
| delete

References MolDraw2DCairo().

## ◆ ~MolDraw2DCairo()

RDKit::MolDraw2DCairo::~MolDraw2DCairo | ( |  | ) |
| inline

Definition at line 51 of file MolDraw2DCairo.h.

## Member Function Documentation

## ◆ clearDrawing()

void RDKit::MolDraw2DCairo::clearDrawing | ( |  | ) |
| overridevirtual

clears the contents of the drawing

Reimplemented from RDKit::MolDraw2D.

## ◆ drawLine()

void RDKit::MolDraw2DCairo::drawLine | ( | const Point2D & | cds1,
|  | const Point2D & | cds2,
|  | bool | rawCoords = false )
| overridevirtual

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.

Implements RDKit::MolDraw2D.

## ◆ drawPolygon()

void RDKit::MolDraw2DCairo::drawPolygon | ( | const std::vector< Point2D > & | cds,
|  | bool | rawCoords = false )
| overridevirtual

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.

Implements RDKit::MolDraw2D.

## ◆ drawWavyLine()

void RDKit::MolDraw2DCairo::drawWavyLine | ( | const Point2D & | cds1,
|  | const Point2D & | cds2,
|  | const DrawColour & | col1,
|  | const DrawColour & | col2,
|  | unsigned int | nSegments = 16,
|  | double | vertOffset = 0.05,
|  | bool | rawCoords = false )
| overridevirtual

draw a wavy line like that used to indicate unknown stereochemistry

Reimplemented from RDKit::MolDraw2D.

## ◆ finishDrawing()

void RDKit::MolDraw2DCairo::finishDrawing | ( |  | ) |

## ◆ getDrawingText()

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

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

MolDraw2DCairo & RDKit::MolDraw2DCairo::operator= | ( | const MolDraw2DCairo & |  | ) |
| delete

References MolDraw2DCairo().

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

MolDraw2DCairo & RDKit::MolDraw2DCairo::operator= | ( | MolDraw2DCairo && |  | ) |
| delete

References MolDraw2DCairo().

## ◆ setColour()

void RDKit::MolDraw2DCairo::setColour | ( | const DrawColour & | col | ) |
| overridevirtual

sets the current draw color

Reimplemented from RDKit::MolDraw2D.

## ◆ writeDrawingText()

void RDKit::MolDraw2DCairo::writeDrawingText | ( | const std::string & | fName | ) | const

References RDKit::MolDraw2D::supportsAnnotations().

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

- MolDraw2DCairo.h