RDKit
Open-source cheminformatics and machine learning.
RDKit::MolDraw2D_detail Namespace Reference

Classes

class  AtomSymbol
 
class  DrawAnnotation
 
class  DrawMol
 
class  DrawMolMCH
 
class  DrawShape
 
class  DrawShapeArrow
 
class  DrawShapeEllipse
 
class  DrawShapeSimpleLine
 
class  DrawShapePolyLine
 
class  DrawShapeSolidWedge
 
class  DrawShapeDashedWedge
 
class  DrawShapeWavyLine
 
class  DrawShapeArc
 
class  DrawText
 
class  DrawTextCairo
 
class  DrawTextFT
 
class  DrawTextFTCairo
 
class  DrawTextFTJS
 
class  DrawTextFTSVG
 
class  DrawTextJS
 
class  DrawTextNotFT
 
class  DrawTextSVG
 
class  DrawTextFTQt
 
class  DrawTextQt
 
struct  StringRect
 

Enumerations

enum class  TextDrawType : unsigned char { TextDrawNormal = 0 , TextDrawSuperscript , TextDrawSubscript }
 
enum class  OrientType : unsigned char {
  C = 0 , N , E , S ,
  W
}
 
enum class  TextAlignType : unsigned char { MIDDLE = 0 , START , END }
 

Functions

void centerMolForDrawing (RWMol &mol, int confId=1)
 
void prepareStereoGroups (RWMol &mol)
 
bool isLinearAtom (const Atom &atom, const std::vector< Point2D > &atCds)
 
std::string getAtomListText (const Atom &atom)
 
DrawColour getColour (int atom_idx, const MolDrawOptions &drawOptions, const std::vector< int > &atomicNums, const std::vector< int > *highlightAtoms, const std::map< int, DrawColour > *highlightMap)
 
DrawColour getColourByAtomicNum (int atomicNum, const MolDrawOptions &drawOptions)
 
int getHighlightBondWidth (const MolDrawOptions &drawOptions, int bond_idx, const std::map< int, int > *highlight_linewidth_multipliers)
 
void calcDoubleBondLines (const ROMol &mol, double offset, const Bond &bond, const std::vector< Point2D > &at_cds, Point2D &l1s, Point2D &l1f, Point2D &l2s, Point2D &l2f)
 
void calcTripleBondLines (double offset, const Bond &bond, const std::vector< Point2D > &at_cds, Point2D &l1s, Point2D &l1f, Point2D &l2s, Point2D &l2f)
 
Point2D calcPerpendicular (const Point2D &cds1, const Point2D &cds2)
 
Point2D calcInnerPerpendicular (const Point2D &cds1, const Point2D &cds2, const Point2D &cds3)
 
Point2D bondInsideRing (const ROMol &mol, const Bond &bond, const Point2D &cds1, const Point2D &cds2, const std::vector< Point2D > &at_cds)
 
Point2D bondInsideDoubleBond (const ROMol &mol, const Bond &bond, const std::vector< Point2D > &at_cds)
 
void adjustBondEndForString (const Point2D &end2, double padding, const std::vector< std::shared_ptr< StringRect >> &rects, Point2D &moveEnd)
 
void findRadicalExtremes (const std::vector< std::tuple< StringRect, OrientType, int >> &radicals, double &xmin, double &xmax, double &ymin, double &ymax)
 
void findRectExtremes (const StringRect &rect, const TextAlignType &align, double &xmin, double &xmax, double &ymin, double &ymax)
 
void getBondHighlightsForAtoms (const ROMol &mol, const std::vector< int > &highlight_atoms, std::vector< int > &highlight_bonds)
 
std::ostream & operator<< (std::ostream &oss, const OrientType &o)
 
std::ostream & operator<< (std::ostream &oss, const TextAlignType &tat)
 
std::ostream & operator<< (std::ostream &oss, const TextDrawType &tdt)
 
RDKIT_MOLDRAW2D_EXPORT bool setStringDrawMode (const std::string &instring, TextDrawType &draw_mode, size_t &i)
 
std::vector< std::string > atomLabelToPieces (const std::string &label, OrientType orient)
 
int moveToFunction (const FT_Vector *to, void *user)
 
int lineToFunction (const FT_Vector *to, void *user)
 
int conicToFunction (const FT_Vector *control, const FT_Vector *to, void *user)
 
int cubicToFunction (const FT_Vector *controlOne, const FT_Vector *controlTwo, const FT_Vector *to, void *user)
 
RDKIT_MOLDRAW2D_EXPORT void arcPoints (const Point2D &cds1, const Point2D &cds2, std::vector< Point2D > &res, float startAng=0, float extent=360)
 
RDKIT_MOLDRAW2D_EXPORT void addStereoAnnotation (const ROMol &mol, bool includeRelativeCIP=false)
 add R/S, relative stereo, and E/Z annotations to atoms and bonds More...
 
RDKIT_MOLDRAW2D_EXPORT void addAtomIndices (const ROMol &mol)
 add annotations with atom indices. More...
 
RDKIT_MOLDRAW2D_EXPORT void addBondIndices (const ROMol &mol)
 add annotations with bond indices. More...
 
RDKIT_MOLDRAW2D_EXPORT std::vector< Point2D > getBracketPoints (const Point2D &p1, const Point2D &p2, const Point2D &refPt, const std::vector< std::pair< Point2D, Point2D >> &bondSegments, double bracketFrac=0.1)
 
RDKIT_MOLDRAW2D_EXPORT std::vector< Point2D > handdrawnLine (Point2D cds1, Point2D cds2, double scale, bool shiftBegin=false, bool shiftEnd=false, unsigned nSteps=4, double deviation=0.03, double endShift=0.5)
 
std::string formatDouble (double val)
 
bool doesLineIntersect (const StringRect &rect, const Point2D &end1, const Point2D &end2, double padding)
 
bool doesTriangleIntersect (const StringRect &rect, const Point2D &pt1, const Point2D &pt2, const Point2D &pt3, double padding)
 
bool doesLineIntersectEllipse (const Point2D &centre, double xradius, double yradius, double padding, const Point2D &end1, const Point2D &end2)
 
bool doesLineIntersectArc (const Point2D &centre, double xradius, double yradius, double start_ang, double stop_ang, double padding, const Point2D &end1, const Point2D &end2)
 
bool doLinesIntersect (const Point2D &l1s, const Point2D &l1f, const Point2D &l2s, const Point2D &l2f, Point2D *ip)
 
bool isPointInTriangle (const Point2D &pt, const Point2D &t1, const Point2D &t2, const Point2D &t3)
 

Variables

const int char_widths []
 

Enumeration Type Documentation

◆ OrientType

enum RDKit::MolDraw2D_detail::OrientType : unsigned char
strong
Enumerator
C 
N 
E 
S 
W 

Definition at line 25 of file MolDraw2DHelpers.h.

◆ TextAlignType

enum RDKit::MolDraw2D_detail::TextAlignType : unsigned char
strong
Enumerator
MIDDLE 
START 
END 

Definition at line 26 of file MolDraw2DHelpers.h.

◆ TextDrawType

enum RDKit::MolDraw2D_detail::TextDrawType : unsigned char
strong
Enumerator
TextDrawNormal 
TextDrawSuperscript 
TextDrawSubscript 

Definition at line 34 of file DrawText.h.

Function Documentation

◆ addAtomIndices()

RDKIT_MOLDRAW2D_EXPORT void RDKit::MolDraw2D_detail::addAtomIndices ( const ROMol &  mol)
inline

◆ addBondIndices()

RDKIT_MOLDRAW2D_EXPORT void RDKit::MolDraw2D_detail::addBondIndices ( const ROMol &  mol)
inline

◆ addStereoAnnotation()

RDKIT_MOLDRAW2D_EXPORT void RDKit::MolDraw2D_detail::addStereoAnnotation ( const ROMol &  mol,
bool  includeRelativeCIP = false 
)

add R/S, relative stereo, and E/Z annotations to atoms and bonds

◆ adjustBondEndForString()

void RDKit::MolDraw2D_detail::adjustBondEndForString ( const Point2D &  end2,
double  padding,
const std::vector< std::shared_ptr< StringRect >> &  rects,
Point2D &  moveEnd 
)

◆ arcPoints()

RDKIT_MOLDRAW2D_EXPORT void RDKit::MolDraw2D_detail::arcPoints ( const Point2D &  cds1,
const Point2D &  cds2,
std::vector< Point2D > &  res,
float  startAng = 0,
float  extent = 360 
)

◆ atomLabelToPieces()

std::vector<std::string> RDKit::MolDraw2D_detail::atomLabelToPieces ( const std::string &  label,
OrientType  orient 
)

◆ bondInsideDoubleBond()

Point2D RDKit::MolDraw2D_detail::bondInsideDoubleBond ( const ROMol &  mol,
const Bond &  bond,
const std::vector< Point2D > &  at_cds 
)

◆ bondInsideRing()

Point2D RDKit::MolDraw2D_detail::bondInsideRing ( const ROMol &  mol,
const Bond &  bond,
const Point2D &  cds1,
const Point2D &  cds2,
const std::vector< Point2D > &  at_cds 
)

◆ calcDoubleBondLines()

void RDKit::MolDraw2D_detail::calcDoubleBondLines ( const ROMol &  mol,
double  offset,
const Bond &  bond,
const std::vector< Point2D > &  at_cds,
Point2D &  l1s,
Point2D &  l1f,
Point2D &  l2s,
Point2D &  l2f 
)

◆ calcInnerPerpendicular()

Point2D RDKit::MolDraw2D_detail::calcInnerPerpendicular ( const Point2D &  cds1,
const Point2D &  cds2,
const Point2D &  cds3 
)

◆ calcPerpendicular()

Point2D RDKit::MolDraw2D_detail::calcPerpendicular ( const Point2D &  cds1,
const Point2D &  cds2 
)

◆ calcTripleBondLines()

void RDKit::MolDraw2D_detail::calcTripleBondLines ( double  offset,
const Bond &  bond,
const std::vector< Point2D > &  at_cds,
Point2D &  l1s,
Point2D &  l1f,
Point2D &  l2s,
Point2D &  l2f 
)

◆ centerMolForDrawing()

void RDKit::MolDraw2D_detail::centerMolForDrawing ( RWMol &  mol,
int  confId = 1 
)

◆ conicToFunction()

int RDKit::MolDraw2D_detail::conicToFunction ( const FT_Vector *  control,
const FT_Vector *  to,
void *  user 
)

◆ cubicToFunction()

int RDKit::MolDraw2D_detail::cubicToFunction ( const FT_Vector *  controlOne,
const FT_Vector *  controlTwo,
const FT_Vector *  to,
void *  user 
)

◆ doesLineIntersect()

bool RDKit::MolDraw2D_detail::doesLineIntersect ( const StringRect &  rect,
const Point2D &  end1,
const Point2D &  end2,
double  padding 
)

◆ doesLineIntersectArc()

bool RDKit::MolDraw2D_detail::doesLineIntersectArc ( const Point2D &  centre,
double  xradius,
double  yradius,
double  start_ang,
double  stop_ang,
double  padding,
const Point2D &  end1,
const Point2D &  end2 
)

◆ doesLineIntersectEllipse()

bool RDKit::MolDraw2D_detail::doesLineIntersectEllipse ( const Point2D &  centre,
double  xradius,
double  yradius,
double  padding,
const Point2D &  end1,
const Point2D &  end2 
)

◆ doesTriangleIntersect()

bool RDKit::MolDraw2D_detail::doesTriangleIntersect ( const StringRect &  rect,
const Point2D &  pt1,
const Point2D &  pt2,
const Point2D &  pt3,
double  padding 
)

◆ doLinesIntersect()

bool RDKit::MolDraw2D_detail::doLinesIntersect ( const Point2D &  l1s,
const Point2D &  l1f,
const Point2D &  l2s,
const Point2D &  l2f,
Point2D *  ip 
)

◆ findRadicalExtremes()

void RDKit::MolDraw2D_detail::findRadicalExtremes ( const std::vector< std::tuple< StringRect, OrientType, int >> &  radicals,
double &  xmin,
double &  xmax,
double &  ymin,
double &  ymax 
)

◆ findRectExtremes()

void RDKit::MolDraw2D_detail::findRectExtremes ( const StringRect &  rect,
const TextAlignType &  align,
double &  xmin,
double &  xmax,
double &  ymin,
double &  ymax 
)

◆ formatDouble()

std::string RDKit::MolDraw2D_detail::formatDouble ( double  val)
inline

Definition at line 109 of file MolDraw2DDetails.h.

◆ getAtomListText()

std::string RDKit::MolDraw2D_detail::getAtomListText ( const Atom &  atom)

◆ getBondHighlightsForAtoms()

void RDKit::MolDraw2D_detail::getBondHighlightsForAtoms ( const ROMol &  mol,
const std::vector< int > &  highlight_atoms,
std::vector< int > &  highlight_bonds 
)

◆ getBracketPoints()

RDKIT_MOLDRAW2D_EXPORT std::vector<Point2D> RDKit::MolDraw2D_detail::getBracketPoints ( const Point2D &  p1,
const Point2D &  p2,
const Point2D &  refPt,
const std::vector< std::pair< Point2D, Point2D >> &  bondSegments,
double  bracketFrac = 0.1 
)

◆ getColour()

DrawColour RDKit::MolDraw2D_detail::getColour ( int  atom_idx,
const MolDrawOptions &  drawOptions,
const std::vector< int > &  atomicNums,
const std::vector< int > *  highlightAtoms,
const std::map< int, DrawColour > *  highlightMap 
)

◆ getColourByAtomicNum()

DrawColour RDKit::MolDraw2D_detail::getColourByAtomicNum ( int  atomicNum,
const MolDrawOptions &  drawOptions 
)

◆ getHighlightBondWidth()

int RDKit::MolDraw2D_detail::getHighlightBondWidth ( const MolDrawOptions &  drawOptions,
int  bond_idx,
const std::map< int, int > *  highlight_linewidth_multipliers 
)

◆ handdrawnLine()

RDKIT_MOLDRAW2D_EXPORT std::vector<Point2D> RDKit::MolDraw2D_detail::handdrawnLine ( Point2D  cds1,
Point2D  cds2,
double  scale,
bool  shiftBegin = false,
bool  shiftEnd = false,
unsigned  nSteps = 4,
double  deviation = 0.03,
double  endShift = 0.5 
)

◆ isLinearAtom()

bool RDKit::MolDraw2D_detail::isLinearAtom ( const Atom &  atom,
const std::vector< Point2D > &  atCds 
)

◆ isPointInTriangle()

bool RDKit::MolDraw2D_detail::isPointInTriangle ( const Point2D &  pt,
const Point2D &  t1,
const Point2D &  t2,
const Point2D &  t3 
)

◆ lineToFunction()

int RDKit::MolDraw2D_detail::lineToFunction ( const FT_Vector *  to,
void *  user 
)

◆ moveToFunction()

int RDKit::MolDraw2D_detail::moveToFunction ( const FT_Vector *  to,
void *  user 
)

◆ operator<<() [1/3]

std::ostream& RDKit::MolDraw2D_detail::operator<< ( std::ostream &  oss,
const OrientType &  o 
)

◆ operator<<() [2/3]

std::ostream& RDKit::MolDraw2D_detail::operator<< ( std::ostream &  oss,
const TextAlignType &  tat 
)

◆ operator<<() [3/3]

std::ostream& RDKit::MolDraw2D_detail::operator<< ( std::ostream &  oss,
const TextDrawType &  tdt 
)

◆ prepareStereoGroups()

void RDKit::MolDraw2D_detail::prepareStereoGroups ( RWMol &  mol)

◆ setStringDrawMode()

RDKIT_MOLDRAW2D_EXPORT bool RDKit::MolDraw2D_detail::setStringDrawMode ( const std::string &  instring,
TextDrawType &  draw_mode,
size_t &  i 
)

establishes whether to put string draw mode into super- or sub-script mode based on contents of instring from i onwards. Increments i appropriately

Returns
true or false depending on whether it did something or not

Variable Documentation

◆ char_widths

const int RDKit::MolDraw2D_detail::char_widths[]
Initial value:
= {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 278, 278, 355, 556, 556, 889, 667, 222, 333, 333,
389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556,
556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667,
611, 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667,
611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 222, 556,
556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556,
556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334,
584, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 333, 556, 556, 167, 556, 556, 556,
556, 191, 333, 556, 333, 333, 500, 500, 0, 556, 556, 556, 278, 0,
537, 350, 222, 333, 333, 556, 1000, 1000, 0, 611, 0, 333, 333, 333,
333, 333, 333, 333, 333, 0, 333, 333, 0, 333, 333, 333, 1000, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1000, 0, 370, 0, 0, 0, 0, 556, 778, 1000, 365, 0, 0,
0, 0, 0, 889, 0, 0, 0, 278, 0, 0, 222, 611, 944, 611,
0, 0, 834}

Definition at line 33 of file MolDraw2DDetails.h.