OEHighlightLabel

class OEHighlightLabel

The OEHighlightLabel class allows the customization the style of the label that can be position on molecule depiction by calling the OEAddLabel function.

The OEHighlightLabel class stores the following properties:

Property

Get method

Set method

Corresponding namespace / class / type

text

GetText

OEHighlightLabel constructors

string

bounding box pen

GetBoundingBoxPen

SetBoundingBoxPen

OEPen

label font

GetFont

SetFont

OEFont

label font scale

GetFontScale

SetFontScale

positive floating point number in the range of [0.25, 1.5] or 0.0

Constructors

OEHighlightLabel(const std::string &text)

Creates an OEHighlightLabel object with default style.

text

The text that is going to be positioned on the molecule depiction.

Example:

OEHighlightLabel label = new OEHighlightLabel("match");
../../_images/OEHighlightLabel_Default.png

Example of adding label with default style

OEHighlightLabel(const std::string &text, const OEFont &font)

Creates an OEHighlightLabel object with user-defined font.

text

The text that is going to be positioned on the molecule depiction.

font

The OEFont object that encapsulates properties that determine the display style of text.

See also

Example:

OEFont font = new OEFont(OEFontFamily.Courier, OEFontStyle.Bold, 12,
                             OEAlignment.Center, OEChem.OEDarkRed);
OEHighlightLabel label = new OEHighlightLabel("match", font);
../../_images/OEHighlightLabel_Font.png

Example of adding label with user-defined font

OEHighlightLabel(const std::string &text, const OESystem::OEColor &color)

Creates an OEHighlightLabel object with user-defined border color.

text

The text that is going to be positioned on the molecule depiction.

color

The color of the border around the label.

Example:

../../_images/OEHighlightLabel_Color.png

Example of adding label with user-defined border color

See also

GetBoundingBoxPen

const OEPen &GetBoundingBoxPen() const

Returns the pen that is used to draw a border around the label.

See also

GetFont

const OEFont &GetFont() const

Returns the font of the label.

See also

GetFontScale

double GetFontScale() const

Returns the multiplier that can be used to increase or decrease the font size of the label relative to the font size used to render labels of the of the depicted molecule. The default value is 0.75.

See also

GetText

std::string GetText() const

Returns the text of the label.

SetBoundingBoxPen

void SetBoundingBoxPen(const OEPen &pen)

Sets the pen that is used to draw a border around the label.

Example:

OEHighlightLabel label = new OEHighlightLabel("match");
OEPen pen = new OEPen(new OEColor(255, 220, 220), OEChem.OEDarkRed, OEFill.On, 16.0, OEStipple.ShortDash);
label.SetBoundingBoxPen(pen);
../../_images/OEHighlightLabel_SetBoundingBoxPen.png

Example of adding label with user-defined border

See also

SetFont

void SetFont(const OEFont &font)

Set the font of the label.

Example:

OEHighlightLabel label = new OEHighlightLabel("match");
OEFont font = new OEFont(OEFontFamily.Default, OEFontStyle.Default, 12,
                             OEAlignment.Center, OEChem.OEDarkRed);
label.SetFont(font);
../../_images/OEHighlightLabel_SetFont.png

Example of adding label with user-defined font

Note

The size of fonts of the label depends on:

See also

SetFontScale

void SetFontScale(double scale)

Sets the multiplier that can be used to increase or decrease the font size of the label relative to the font size used to render atom labels of the of the depicted molecule.

scale

This value has to be either 0.0 or in a range of [0.25, 1.50]. The default value is 0.75.

In case of 0.0, the label is not scaled with the molecule but rather fixed font size is used regardless of the size of the depicted molecule.

Example:

OEHighlightLabel label = new OEHighlightLabel("match");
label.SetFontScale(1.2);
../../_images/OEHighlightLabel_SetFontScale.png

Example of adding label with user-defined font scaling