RDKit::DrawText Class Referenceabstract

`#include <DrawText.h>`

Inheritance diagram for RDKit::DrawText:

## Public Member Functions

| DrawText (double max_fnt_sz, double min_fnt_sz)
virtual | ~DrawText ()
DrawColour const & | colour () const
void | setColour (const DrawColour &col)
double | fontSize () const
void | setFontSize (double new_size)
double | baseFontSize () const
void | setBaseFontSize (double new_size)
double | maxFontSize () const
void | setMaxFontSize (double new_max)
double | minFontSize () const
void | setMinFontSize (double new_max)
double | fontScale () const
void | setFontScale (double new_scale)
virtual std::string | getFontFile () const
virtual void | setFontFile (const std::string &font_file)
virtual void | getStringSize (const std::string &label, double &label_width, double &label_height) const
| using the current scale, work out the size of the label More...
void | getStringExtremes (const std::string &label, OrientType orient, double &x_min, double &y_min, double &x_max, double &y_max, bool dontSplit=false) const
void | getStringRects (const std::string &text, OrientType orient, std::vector< std::shared_ptr< StringRect >> &rects, std::vector< TextDrawType > &draw_modes, std::vector< char > &draw_chars, bool dontSplit=false) const
virtual void | drawString (const std::string &str, const Point2D &cds, TextAlignType align)
| drawString centres the string on cds. More...
void | drawString (const std::string &label, const Point2D &cds, OrientType orient)
void | adjustLineForString (const std::string &label, OrientType orient, const Point2D &end1, Point2D &end2) const
virtual void | drawChar (char c, const Point2D &cds)=0
void | drawStringRects (const std::string &label, OrientType orient, const Point2D &cds, MolDraw2D &mol_draw) const
bool | doesRectIntersect (const std::string &label, OrientType orient, const Point2D &cds, const StringRect &rect) const
bool | doesRectIntersect (const std::vector< std::shared_ptr< StringRect >> &rects, const Point2D &cds, const StringRect &rect) const
bool | doesLineIntersect (const std::string &label, OrientType orient, const Point2D &cds, const Point2D &end1, const Point2D &end2, double padding) const
bool | doesLineIntersect (const std::vector< std::shared_ptr< StringRect >> &rects, const Point2D &cds, const Point2D &end1, const Point2D &end2, double padding) const
bool | doesStringIntersect (const std::vector< std::shared_ptr< StringRect >> &rects, const Point2D &cds1, const std::string &label2, OrientType orient2, const Point2D &cds2) const
bool | doesStringIntersect (const std::string &label1, OrientType orient1, const Point2D &cds1, const std::string &label2, OrientType orient2, const Point2D &cds2) const

## Static Public Attributes

static constexpr double | FONT_SIZE = 0.6

## Protected Member Functions

virtual void | alignString (TextAlignType align, const std::vector< TextDrawType > &draw_modes, std::vector< std::shared_ptr< StringRect >> &rects) const
void | adjustStringRectsForSuperSubScript (const std::vector< TextDrawType > &draw_modes, std::vector< std::shared_ptr< StringRect >> &rects) const
double | selectScaleFactor (char c, TextDrawType draw_type) const

## Static Protected Attributes

constexpr static double | SUBS_SCALE = 0.66
constexpr static double | SUPER_SCALE = 0.66

## Detailed Description

Definition at line 38 of file DrawText.h.

## Constructor & Destructor Documentation

## DrawText()

RDKit::DrawText::DrawText | ( | double | max_fnt_sz,
|  | double | min_fnt_sz
| ) |  |

## ~DrawText()

virtual RDKit::DrawText::~DrawText | ( |  | ) |

inline virtual

Definition at line 43 of file DrawText.h.

## Member Function Documentation

## adjustLineForString()

void RDKit::DrawText::adjustLineForString | ( | const std::string & | label,
|  | OrientType | orient,
|  | const Point2D & | end1,
|  | Point2D & | end2
| ) |  | const

## adjustStringRectsForSuperSubScript()

void RDKit::DrawText::adjustStringRectsForSuperSubScript | ( | const std::vector< TextDrawType > & | draw_modes,
|  | std::vector< std::shared_ptr< StringRect >> & | rects
| ) |  | const

protected

## alignString()

virtual void RDKit::DrawText::alignString | ( | TextAlignType | align,
|  | const std::vector< TextDrawType > & | draw_modes,
|  | std::vector< std::shared_ptr< StringRect >> & | rects
| ) |  | const

protected virtual

## baseFontSize()

double RDKit::DrawText::baseFontSize | ( |  | ) | const

## colour()

DrawColour const& RDKit::DrawText::colour | ( |  | ) | const

## doesLineIntersect() [1/2]

bool RDKit::DrawText::doesLineIntersect | ( | const std::string & | label,
|  | OrientType | orient,
|  | const Point2D & | cds,
|  | const Point2D & | end1,
|  | const Point2D & | end2,
|  | double | padding
| ) |  | const

## doesLineIntersect() [2/2]

bool RDKit::DrawText::doesLineIntersect | ( | const std::vector< std::shared_ptr< StringRect >> & | rects,
|  | const Point2D & | cds,
|  | const Point2D & | end1,
|  | const Point2D & | end2,
|  | double | padding
| ) |  | const

## doesRectIntersect() [1/2]

bool RDKit::DrawText::doesRectIntersect | ( | const std::string & | label,
|  | OrientType | orient,
|  | const Point2D & | cds,
|  | const StringRect & | rect
| ) |  | const

## doesRectIntersect() [2/2]

bool RDKit::DrawText::doesRectIntersect | ( | const std::vector< std::shared_ptr< StringRect >> & | rects,
|  | const Point2D & | cds,
|  | const StringRect & | rect
| ) |  | const

## doesStringIntersect() [1/2]

bool RDKit::DrawText::doesStringIntersect | ( | const std::string & | label1,
|  | OrientType | orient1,
|  | const Point2D & | cds1,
|  | const std::string & | label2,
|  | OrientType | orient2,
|  | const Point2D & | cds2
| ) |  | const

## doesStringIntersect() [2/2]

bool RDKit::DrawText::doesStringIntersect | ( | const std::vector< std::shared_ptr< StringRect >> & | rects,
|  | const Point2D & | cds1,
|  | const std::string & | label2,
|  | OrientType | orient2,
|  | const Point2D & | cds2
| ) |  | const

## drawChar()

virtual void RDKit::DrawText::drawChar | ( | char | c,
|  | const Point2D & | cds
| ) |  |

pure virtual

Implemented in RDKit::DrawTextQt, RDKit::DrawTextSVG, RDKit::DrawTextJS, RDKit::DrawTextFT, and RDKit::DrawTextCairo.

## drawString() [1/2]

void RDKit::DrawText::drawString | ( | const std::string & | label,
|  | const Point2D & | cds,
|  | OrientType | orient
| ) |  |

## drawString() [2/2]

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

virtual

drawString centres the string on cds.

## drawStringRects()

void RDKit::DrawText::drawStringRects | ( | const std::string & | label,
|  | OrientType | orient,
|  | const Point2D & | cds,
|  | MolDraw2D & | mol_draw
| ) |  | const

## fontScale()

double RDKit::DrawText::fontScale | ( |  | ) | const

## fontSize()

double RDKit::DrawText::fontSize | ( |  | ) | const

## getFontFile()

virtual std::string RDKit::DrawText::getFontFile | ( |  | ) | const

inline virtual

Reimplemented in RDKit::DrawTextFT.

Definition at line 61 of file DrawText.h.

## getStringExtremes()

void RDKit::DrawText::getStringExtremes | ( | const std::string & | label,
|  | OrientType | orient,
|  | double & | x_min,
|  | double & | y_min,
|  | double & | x_max,
|  | double & | y_max,
|  | bool | dontSplit = `false`
| ) |  | const

## getStringRects()

void RDKit::DrawText::getStringRects | ( | const std::string & | text,
|  | OrientType | orient,
|  | std::vector< std::shared_ptr< StringRect >> & | rects,
|  | std::vector< TextDrawType > & | draw_modes,
|  | std::vector< char > & | draw_chars,
|  | bool | dontSplit = `false`
| ) |  | const

## getStringSize()

virtual void RDKit::DrawText::getStringSize | ( | const std::string & | label,
|  | double & | label_width,
|  | double & | label_height
| ) |  | const

virtual

using the current scale, work out the size of the label

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 be accounted for in the width and height.

## maxFontSize()

double RDKit::DrawText::maxFontSize | ( |  | ) | const

## minFontSize()

double RDKit::DrawText::minFontSize | ( |  | ) | const

## selectScaleFactor()

double RDKit::DrawText::selectScaleFactor | ( | char | c,
|  | TextDrawType | draw_type
| ) |  | const

protected

## setBaseFontSize()

void RDKit::DrawText::setBaseFontSize | ( | double | new_size | ) |

## setColour()

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

## setFontFile()

virtual void RDKit::DrawText::setFontFile | ( | const std::string & | font_file | ) |

inline virtual

Reimplemented in RDKit::DrawTextFT.

Definition at line 62 of file DrawText.h.

References RDUNUSED_PARAM.

## setFontScale()

void RDKit::DrawText::setFontScale | ( | double | new_scale | ) |

## setFontSize()

void RDKit::DrawText::setFontSize | ( | double | new_size | ) |

## setMaxFontSize()

void RDKit::DrawText::setMaxFontSize | ( | double | new_max | ) |

## setMinFontSize()

void RDKit::DrawText::setMinFontSize | ( | double | new_max | ) |

## Member Data Documentation

## FONT_SIZE

constexpr double RDKit::DrawText::FONT_SIZE = 0.6

static constexpr

Definition at line 40 of file DrawText.h.

## SUBS_SCALE

constexpr static double RDKit::DrawText::SUBS_SCALE = 0.66

static constexpr protected

Definition at line 134 of file DrawText.h.

## SUPER_SCALE

constexpr static double RDKit::DrawText::SUPER_SCALE = 0.66

static constexpr protected

Definition at line 135 of file DrawText.h.

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

- DrawText.h