RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
RDKit::MolDraw2D_detail::DrawText Class Referenceabstract

#include <DrawText.h>

Inheritance diagram for RDKit::MolDraw2D_detail::DrawText:
RDKit::MolDraw2D_detail::DrawTextFT RDKit::MolDraw2D_detail::DrawTextNotFT RDKit::MolDraw2D_detail::DrawTextFTCairo RDKit::MolDraw2D_detail::DrawTextFTJS RDKit::MolDraw2D_detail::DrawTextFTQt RDKit::MolDraw2D_detail::DrawTextFTSVG RDKit::MolDraw2D_detail::DrawTextCairo RDKit::MolDraw2D_detail::DrawTextJS RDKit::MolDraw2D_detail::DrawTextQt RDKit::MolDraw2D_detail::DrawTextSVG

Public Member Functions

virtual ~DrawText ()=0
 
 DrawText (double max_fnt_sz, double min_fnt_sz)
 
 DrawText (const DrawText &)=delete
 
 DrawText (DrawText &&)=delete
 
DrawTextoperator= (const DrawText &)=delete
 
DrawTextoperator= (DrawText &&)=delete
 
DrawColour constcolour () 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
 
bool setFontScale (double new_scale, bool ignoreLimits=false)
 
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
 
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, TextAlignType textAlign=TextAlignType::MIDDLE) const
 
virtual void drawString (const std::string &str, const Point2D &cds, TextAlignType align)
 drawString centres the string on cds.
 
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, TextAlignType talign, 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
 
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
 
virtual void getStringRects (const std::string &text, std::vector< std::shared_ptr< StringRect > > &rects, std::vector< TextDrawType > &draw_modes, std::vector< char > &draw_chars) const =0
 
void drawChars (const Point2D &a_cds, const std::vector< std::shared_ptr< StringRect > > &rects, const std::vector< TextDrawType > &draw_modes, const std::vector< char > &draw_chars)
 

Public Attributes

DrawColour colour_
 
double font_scale_
 
double max_font_size_
 
double min_font_size_
 
double base_font_size_ = DEFAULT_FONT_SCALE
 

Static Public Attributes

static constexpr double DEFAULT_FONT_SCALE
 
static constexpr double SUBS_SCALE = 0.66
 
static constexpr double SUPER_SCALE = 0.66
 

Detailed Description

Definition at line 46 of file DrawText.h.

Constructor & Destructor Documentation

◆ ~DrawText()

virtual RDKit::MolDraw2D_detail::DrawText::~DrawText ( )
pure virtual

◆ DrawText() [1/3]

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

◆ DrawText() [2/3]

RDKit::MolDraw2D_detail::DrawText::DrawText ( const DrawText )
delete

◆ DrawText() [3/3]

RDKit::MolDraw2D_detail::DrawText::DrawText ( DrawText &&  )
delete

Member Function Documentation

◆ adjustLineForString()

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

◆ adjustStringRectsForSuperSubScript()

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

◆ alignString()

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

◆ baseFontSize()

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

◆ colour()

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

◆ doesLineIntersect() [1/2]

bool RDKit::MolDraw2D_detail::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::MolDraw2D_detail::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::MolDraw2D_detail::DrawText::doesRectIntersect ( const std::string &  label,
OrientType  orient,
const Point2D cds,
const StringRect rect 
) const

◆ doesRectIntersect() [2/2]

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

◆ doesStringIntersect() [1/2]

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

◆ drawChar()

◆ drawChars()

void RDKit::MolDraw2D_detail::DrawText::drawChars ( const Point2D a_cds,
const std::vector< std::shared_ptr< StringRect > > &  rects,
const std::vector< TextDrawType > &  draw_modes,
const std::vector< char > &  draw_chars 
)

◆ drawString() [1/2]

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

◆ drawString() [2/2]

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

drawString centres the string on cds.

◆ drawStringRects()

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

◆ fontScale()

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

◆ fontSize()

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

◆ getFontFile()

virtual std::string RDKit::MolDraw2D_detail::DrawText::getFontFile ( ) const
inlinevirtual

Reimplemented in RDKit::MolDraw2D_detail::DrawTextFT.

Definition at line 77 of file DrawText.h.

◆ getStringExtremes()

void RDKit::MolDraw2D_detail::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() [1/2]

void RDKit::MolDraw2D_detail::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,
TextAlignType  textAlign = TextAlignType::MIDDLE 
) const

◆ getStringRects() [2/2]

virtual void RDKit::MolDraw2D_detail::DrawText::getStringRects ( const std::string &  text,
std::vector< std::shared_ptr< StringRect > > &  rects,
std::vector< TextDrawType > &  draw_modes,
std::vector< char > &  draw_chars 
) const
pure virtual

◆ getStringSize()

virtual void RDKit::MolDraw2D_detail::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::MolDraw2D_detail::DrawText::maxFontSize ( ) const

◆ minFontSize()

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

◆ operator=() [1/2]

DrawText & RDKit::MolDraw2D_detail::DrawText::operator= ( const DrawText )
delete

◆ operator=() [2/2]

DrawText & RDKit::MolDraw2D_detail::DrawText::operator= ( DrawText &&  )
delete

◆ selectScaleFactor()

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

◆ setBaseFontSize()

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

◆ setColour()

void RDKit::MolDraw2D_detail::DrawText::setColour ( const DrawColour col)

◆ setFontFile()

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

Reimplemented in RDKit::MolDraw2D_detail::DrawTextFT.

Definition at line 78 of file DrawText.h.

References RDUNUSED_PARAM.

◆ setFontScale()

bool RDKit::MolDraw2D_detail::DrawText::setFontScale ( double  new_scale,
bool  ignoreLimits = false 
)

◆ setFontSize()

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

◆ setMaxFontSize()

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

◆ setMinFontSize()

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

Member Data Documentation

◆ base_font_size_

double RDKit::MolDraw2D_detail::DrawText::base_font_size_ = DEFAULT_FONT_SCALE

Definition at line 173 of file DrawText.h.

◆ colour_

DrawColour RDKit::MolDraw2D_detail::DrawText::colour_

Definition at line 169 of file DrawText.h.

◆ DEFAULT_FONT_SCALE

constexpr double RDKit::MolDraw2D_detail::DrawText::DEFAULT_FONT_SCALE
staticconstexpr
Initial value:
=
0.6

Definition at line 50 of file DrawText.h.

◆ font_scale_

double RDKit::MolDraw2D_detail::DrawText::font_scale_

Definition at line 170 of file DrawText.h.

◆ max_font_size_

double RDKit::MolDraw2D_detail::DrawText::max_font_size_

Definition at line 171 of file DrawText.h.

◆ min_font_size_

double RDKit::MolDraw2D_detail::DrawText::min_font_size_

Definition at line 172 of file DrawText.h.

◆ SUBS_SCALE

constexpr double RDKit::MolDraw2D_detail::DrawText::SUBS_SCALE = 0.66
staticconstexpr

Definition at line 166 of file DrawText.h.

◆ SUPER_SCALE

constexpr double RDKit::MolDraw2D_detail::DrawText::SUPER_SCALE = 0.66
staticconstexpr

Definition at line 167 of file DrawText.h.


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