RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
RDKit::MolDraw2D_detail Namespace Reference

Classes

class  AtomSymbol
 
class  DrawAnnotation
 
class  DrawMol
 
class  DrawMolMCH
 
class  DrawMolMCHCircleAndLine
 
class  DrawMolMCHLasso
 
class  DrawShape
 
class  DrawShapeArc
 
class  DrawShapeArrow
 
class  DrawShapeDashedWedge
 
class  DrawShapeEllipse
 
class  DrawShapePolyLine
 
class  DrawShapeSimpleLine
 
class  DrawShapeSolidWedge
 
class  DrawShapeWavyLine
 
class  DrawText
 
class  DrawTextCairo
 
class  DrawTextFT
 
class  DrawTextFTCairo
 
class  DrawTextFTJS
 
class  DrawTextFTQt
 
class  DrawTextFTSVG
 
class  DrawTextJS
 
class  DrawTextNotFT
 
class  DrawTextQt
 
class  DrawTextSVG
 
struct  LinePair
 
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)
 
bool isLinearAtom (const Atom &atom, const std::vector< Point2D > &atCds)
 
std::string getAtomListText (const Atom &atom)
 
DrawColour getColourByAtomicNum (int atomicNum, const MolDrawOptions &drawOptions)
 
DrawColour getHighlightBondColour (const Bond *bond, const MolDrawOptions &drawOptions, const std::vector< int > &highlightBonds, const std::map< int, DrawColour > &highlightBondMap, const std::vector< int > &highlightAtoms, const std::map< int, DrawColour > &highlightAtomMap)
 
double getHighlightBondWidth (const MolDrawOptions &drawOptions, int bond_idx, const std::map< int, int > *highlight_linewidth_multipliers)
 
Point2D calcPerpendicular (const Point2D &cds1, const Point2D &cds2)
 
Point2D calcInnerPerpendicular (const Point2D &cds1, const Point2D &cds2, const Point2D &cds3)
 
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)
 
bool areBondsTrans (const Point2D &at1, const Point2D &at2, const Point2D &at3, const Point2D &at4)
 
bool areBondsParallel (const Point2D &at1, const Point2D &at2, const Point2D &at3, const Point2D &at4, double tol=1.0e-4)
 
const AtomotherNeighbor (const Atom *firstAtom, const Atom *secondAtom, int nborNum, const ROMol &mol)
 
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 addAtomIndices (const ROMol &mol)
 add annotations with atom indices.
 
RDKIT_MOLDRAW2D_EXPORT void addBondIndices (const ROMol &mol)
 add annotations with bond indices.
 
RDKIT_MOLDRAW2D_EXPORT std::vector< Point2DgetBracketPoints (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< Point2DhanddrawnLine (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)
 
RDKIT_MOLDRAW2D_EXPORT bool doesLineIntersect (const StringRect &rect, const Point2D &end1, const Point2D &end2, double padding)
 
RDKIT_MOLDRAW2D_EXPORT bool doesTriangleIntersect (const StringRect &rect, const Point2D &pt1, const Point2D &pt2, const Point2D &pt3, double padding)
 
RDKIT_MOLDRAW2D_EXPORT bool doesLineIntersectEllipse (const Point2D &centre, double xradius, double yradius, double padding, const Point2D &end1, const Point2D &end2)
 
RDKIT_MOLDRAW2D_EXPORT bool doesLineIntersectArc (const Point2D &centre, double xradius, double yradius, double start_ang, double stop_ang, double padding, const Point2D &end1, const Point2D &end2)
 
RDKIT_MOLDRAW2D_EXPORT bool doLinesIntersect (const Point2D &l1s, const Point2D &l1f, const Point2D &l2s, const Point2D &l2f, Point2D *ip)
 
RDKIT_MOLDRAW2D_EXPORT bool isPointInTriangle (const Point2D &pt, const Point2D &t1, const Point2D &t2, const Point2D &t3)
 
RDKIT_MOLDRAW2D_EXPORT std::vector< std::tuple< Point2D, Point2D, Point2D, Point2D > > getWavyLineSegments (const Point2D &p1, const Point2D &p2, unsigned int nSegments, double vertOffset)
 
RDKIT_MOLDRAW2D_EXPORT void calcArrowHead (Point2D &arrowEnd, Point2D &arrow1, Point2D &arrow2, const Point2D &arrowBegin, bool asPolygon, double frac, double angle)
 
RDKIT_MOLDRAW2D_EXPORT void adjustLineEndForEllipse (const Point2D &centre, double xradius, double yradius, Point2D p1, Point2D &p2)
 

Variables

const int char_widths []
 

Enumeration Type Documentation

◆ OrientType

Enumerator

Definition at line 25 of file MolDraw2DHelpers.h.

◆ TextAlignType

Enumerator
MIDDLE 
START 
END 

Definition at line 26 of file MolDraw2DHelpers.h.

◆ TextDrawType

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

◆ adjustBondEndForString()

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

◆ adjustLineEndForEllipse()

RDKIT_MOLDRAW2D_EXPORT void RDKit::MolDraw2D_detail::adjustLineEndForEllipse ( const Point2D centre,
double  xradius,
double  yradius,
Point2D  p1,
Point2D p2 
)

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

◆ areBondsParallel()

bool RDKit::MolDraw2D_detail::areBondsParallel ( const Point2D at1,
const Point2D at2,
const Point2D at3,
const Point2D at4,
double  tol = 1.0e-4 
)

◆ areBondsTrans()

bool RDKit::MolDraw2D_detail::areBondsTrans ( const Point2D at1,
const Point2D at2,
const Point2D at3,
const Point2D at4 
)

◆ atomLabelToPieces()

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

◆ calcArrowHead()

RDKIT_MOLDRAW2D_EXPORT void RDKit::MolDraw2D_detail::calcArrowHead ( Point2D arrowEnd,
Point2D arrow1,
Point2D arrow2,
const Point2D arrowBegin,
bool  asPolygon,
double  frac,
double  angle 
)

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

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

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

◆ doesLineIntersectArc()

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

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

◆ doesTriangleIntersect()

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

◆ doLinesIntersect()

RDKIT_MOLDRAW2D_EXPORT 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 105 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 
)

◆ getColourByAtomicNum()

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

◆ getHighlightBondColour()

DrawColour RDKit::MolDraw2D_detail::getHighlightBondColour ( const Bond bond,
const MolDrawOptions drawOptions,
const std::vector< int > &  highlightBonds,
const std::map< int, DrawColour > &  highlightBondMap,
const std::vector< int > &  highlightAtoms,
const std::map< int, DrawColour > &  highlightAtomMap 
)

◆ getHighlightBondWidth()

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

◆ getWavyLineSegments()

RDKIT_MOLDRAW2D_EXPORT std::vector< std::tuple< Point2D, Point2D, Point2D, Point2D > > RDKit::MolDraw2D_detail::getWavyLineSegments ( const Point2D p1,
const Point2D p2,
unsigned int  nSegments,
double  vertOffset 
)

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

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

◆ otherNeighbor()

const Atom * RDKit::MolDraw2D_detail::otherNeighbor ( const Atom firstAtom,
const Atom secondAtom,
int  nborNum,
const ROMol 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.