OE2DMolDisplayOptions

class OE2DMolDisplayOptions

This class represents the OE2DMolDisplayOptions class that encapsulates properties that determine how a molecule is depicted.

The OE2DMolDisplayOptions class stores the following properties:

Property

Get method

Set method

Corresponding namespace / class / type

aromatic style

GetAromaticStyle

SetAromaticStyle

OEAromaticStyle

atomic number colors

GetAtomColor

SetAtomColor

OEColor

atom color style

GetAtomColorStyle

SetAtomColorStyle

OEAtomColorStyle

atom label font

GetAtomLabelFont

SetAtomLabelFont

OEFont

atom label font scale

GetAtomLabelFontScale

SetAtomLabelFontScale

positive floating point number in the range of [0.5, 3.0] or 0.0

atom property font

GetAtomPropLabelFont

SetAtomPropLabelFont

OEFont

atom property label font scale

GetAtomPropLabelFontScale

SetAtomPropLabelFontScale

positive floating point number in the range of [0.5, 2.0]

atom property initializer

GetAtomPropertyFunctor

SetAtomPropertyFunctor

OEDisplayAtomPropBase

atom stereo style

GetAtomStereoStyle

SetAtomStereoStyle

OEAtomStereoStyle

atom SVG markup

GetAtomSVGMarkupFunctor

SetAtomSVGMarkupFunctor

OEAtomSVGMarkupBase

atom visibility initializer

GetAtomVisibilityFunctor

SetAtomVisibilityFunctor

OEUnaryAtomPred

background color

GetBackgroundColor

SetBackgroundColor

OEColor

bond color style

GetBondColorStyle

SetBondColorStyle

OEBondColorStyle

bond line gap scale

GetBondLineGapScale

SetBondLineGapScale

positive floating point number in the range of [0.5, 2.0]

bond line atom label gap scale

GetBondLineAtomLabelGapScale

SetBondLineAtomLabelGapScale

positive floating point number in the range of [0.5, 2.0]

bond property font

GetBondPropLabelFont

SetBondPropLabelFont

OEFont

bond property label font scale

GetBondPropLabelFontScale

SetBondPropLabelFontScale

positive floating point number in the range of [0.5, 2.0]

bond property initializer

GetBondPropertyFunctor

SetBondPropertyFunctor

OEDisplayBondPropBase

bond stereo style

GetBondStereoStyle

SetBondStereoStyle

OEBondStereoStyle

bond pen

GetDefaultBondPen

SetDefaultBondPen

OEPen

bond width scaling

GetBondWidthScaling

SetBondWidthScaling

boolean

bond SVG markup

GetBondSVGMarkupFunctor

SetBondSVGMarkupFunctor

OEBondSVGMarkupBase

explicit atom label angle

GetExplicitAtomLabelAngle

SetExplicitAtomLabelAngle

positive floating point number in the range of [120.0, 180.0]

height

GetHeight

SetHeight

positive floating point number

hydrogen style

GetHydrogenStyle

SetHydrogenStyle

OEHydrogenStyle

margin(s)

GetMargin

SetMargin, SetMargins

positive floating point number in the range of [2.5, 25.0]

scale

GetScale

SetScale

positive floating point number

super atom label font

GetSuperAtomLabelFont

SetSuperAtomLabelFont

OEFont

super atom display style

GetSuperAtomStyle

SetSuperAtomStyle

OESuperAtomStyle

protective group label font

GetProtectiveGroupLabelFont

SetProtectiveGroupLabelFont

OEFont

protective group display style

HasProtectiveGroupStyle

SetProtectiveGroupStyle

OEProtectiveGroupStyle

title font

GetTitleFont

SetTitleFont

OEFont

title font scale

GetTitleFontScale

SetTitleFontScale

positive floating point number in the range of [0.5, 2.0] or 0.0

title height

GetTitleHeight

SetTitleHeight

OETitleLocation

title location

GetTitleLocation

SetTitleLocation

OETitleLocation

width

GetWidth

SetWidth

positive floating point number

The images below illustrate the three possible molecule display layouts depending on the position of the title. These layouts can be controlled by the following parameters:

Example of molecule display layouts depending on position of the title

title hidden

title at the top

title at the bottom

../../_images/OE2DMolDisplayLayout_TitleHidden.png ../../_images/OE2DMolDisplayLayout_TitleTop.png ../../_images/OE2DMolDisplayLayout_TitleBottom.png

Hint

Even though OEDepict TK provides access to manipulate the properties of the atom and bond displays after the OE2DMolDisplay object is constructed, it is highly recommended to determine the style of the depiction by using the OE2DMolDisplayOptions class. Only by knowing all properties (such as labels, font styles and sizes etc.) in advance can ensure the best depiction layout i.e. that the molecule diagram is rendered without any label clippings and the labels are displayed with the minimum number of overlaps.

Constructors

OE2DMolDisplayOptions()

Default constructor that initializes an OE2DMolDisplayOptions object with the following properties:

See example in Molecule depiction with default options)

Default parameters of OE2DMolDisplayOptions

Property

Default value

aromatic style

OEAromaticStyle.Default

atomic number colors

initialized based on OEAtomColorStyle.Default

atom color style

OEAtomColorStyle.Default

atom label font

OEDepict.OEDefaultFont

atom label font scale

1.0

atom property font

OEFont(OEColor(75, 75, 75))

atom property label font scale

1.0

atom property initializer

OEDisplayNoAtomProp

atom stereo style

OEAtomStereoStyle.Default

atom SVG markup

OEAtomSVGNoMarkup

atom visibility initializer

OEIsTrueAtom

background color

OEDepict.OELightBackgroundColor initialized based on OEAtomColorStyle.Default

bond color style

OEBondColorStyle.Default

bond line gap scale

1.0

bond line atom label gap scale

1.0

bond property font

OEFont(OEColor(75, 75, 75))

bond property label font scale

1.0

bond property initializer

OEDisplayNoBondProp

bond stereo style

OEBondStereoStyle.Default

bond pen

OEDepict.OEBlackPen

bond width scaling

false

bond SVG markup

OEBondSVGNoMarkup

explicit atom label angle

170.0 (degree)

height

0.0 (initialized based on scale)

hydrogen style

OEHydrogenStyle.Default

margins

left and right margin 5.0% of the width; top and bottom margin 5.0% of the height of the molecule display

scale

OEScale.AutoScale

super atom label font

OEFont(OEPink)

super atom display style

OESuperAtomStyle.Default

protective group label font

OEFont(OEPink)

protective group display style

OEProtectiveGroupStyle.Default

title font

OEDepict.OEDefaultFont

title font scale

1.0

title location

OETitleLocation.Default

title height

10% of the height of the molecule display

width

0.0 (initialized based on scale)

../../_images/OE2DMolDisplayOptions_Default.png

Molecule depiction with default options

OE2DMolDisplayOptions(double scale)

Creates an OE2DMolDisplayOptions object with the specified scaling.

scale

A non-negative number that controls the magnification of the depicted molecule.

OE2DMolDisplayOptions(double width, double height, double scale)

Creates an OE2DMolDisplayOptions object with the specified dimension and scaling.

OE2DMolDisplayOptions(const OE2DMolDisplayOptions &rhs)

Copy constructor.

operator=

OE2DMolDisplayOptions &operator=(const OE2DMolDisplayOptions &rhs)

Assignment operator.

GetAromaticStyle

unsigned int GetAromaticStyle() const

Returns the style that controls how aromatic rings are displayed. The return value is taken from the OEAromaticStyle namespace.

GetAtomSVGMarkupFunctor

const OEAtomSVGMarkupBase &GetAtomSVGMarkupFunctor() const

Returns the functor that defines how atoms are marked in svg image. By default, residues are not marked (OEAtomSVGNoMarkup).

GetAtomColor

const OESystem::OEColor &GetAtomColor(unsigned int atomic) const

Returns the color associated with a specific atomic number.

GetAtomColorStyle

unsigned int GetAtomColorStyle() const

Returns the style that is used to define the color of the background and the default color of atom labels. The return value is taken from the OEAtomColorStyle namespace.

GetAtomLabelFont

const OEFont &GetAtomLabelFont() const

Returns the font that is used to initialize the depiction style of the atom labels (OE2DAtomDisplay.GetLabelFont).

GetAtomLabelFontScale

double GetAtomLabelFontScale() const

Returns the multiplier that can be used to increase or decrease the size of the atom label fonts.

GetAtomPropLabelFont

const OEFont &GetAtomPropLabelFont() const

Returns the font that is used to initialize the depiction style of the atom property labels (OE2DAtomDisplay.GetPropertyFont).

GetAtomPropLabelFontScale

double GetAtomPropLabelFontScale() const

Returns the multiplier that can be used to increase or decrease the size of the atom property label fonts.

GetAtomPropertyFunctor

const OEDisplayAtomPropBase &GetAtomPropertyFunctor() const

Returns the functor that is used to initialize the atom property labels (OE2DAtomDisplay.GetProperty).

GetAtomVisibilityFunctor

const OESystem::OEUnaryPredicate<OEChem::OEAtomBase> &GetAtomVisibilityFunctor() const

Returns the functor that is used to identify visible atoms. The default functor is the OEIsTrueAtom class which results in all atoms being displayed.

GetAtomStereoStyle

unsigned int GetAtomStereoStyle() const

Returns the style that controls what atom stereo information is displayed. The return value is taken from the OEAtomStereoStyle namespace.

GetBackgroundColor

const OESystem::OEColor &GetBackgroundColor() const

Returns the color that is used to clear the background of an image (by calling OEImageBase.Clear method) before rendering the molecule.

GetBondColorStyle

unsigned int GetBondColorStyle() const

Returns the style that controls how bonds are colored. The return value is taken from the OEBondColorStyle namespace.

GetBondLineGapScale

double GetBondLineGapScale() const

Returns the multiplier that can be used to increase or decrease the gap between the lines of double and triple bonds.

GetBondLineAtomLabelGapScale

double GetBondLineAtomLabelGapScale() constant

Returns the multiplier that can be used to increase or decrease the gap between the line(s) of bonds and the adjacent atom labels.

GetBondPropLabelFont

const OEFont &GetBondPropLabelFont() const

Returns the font that is used to initialize the depiction style of the bond property labels (OE2DBondDisplay.GetPropertyFont).

GetBondPropLabelFontScale

double GetBondPropLabelFontScale() const

Returns the multiplier that can be used to increase or decrease the size of the bond property label fonts.

GetBondPropertyFunctor

const OEDisplayBondPropBase &GetBondPropertyFunctor() const

Returns the functor that is used to initialize the bond property labels (OE2DBondDisplay.GetProperty).

GetBondStereoStyle

unsigned int GetBondStereoStyle() const

Returns the style that controls what bond stereo information is displayed. The return value is taken from the OEBondStereoStyle namespace.

GetBondSVGMarkupFunctor

const OEBondSVGMarkupBase &GetBondSVGMarkupFunctor() const

Returns the functor that defines how bonds are marked in svg image. By default, residues are not marked (OEBondSVGNoMarkup).

GetBondWidthScaling

bool GetBondWidthScaling() const

Returns whether the line width of the bond are increase or decreased based on the molecule scaling factor (OE2DMolDisplayOptions.GetScale)

GetDefaultBondPen

const OEPen &GetDefaultBondPen() const

Returns the pen that is used to initialize the bond pens (OE2DBondDisplay.GetBgnPen and OE2DBondDisplay.GetBgnPen).

GetExplicitAtomLabelAngle

double GetExplicitAtomLabelAngle() const

In the case of an almost linear X-C-X bond, an explicit “C” label will be drawn if the angle is more that the returned value of this function. 180.0 degree means that the “C” label will never be drawn.

GetHeight

double GetHeight() const

Returns the vertical limit into which the molecule has to be fitted.

GetHydrogenStyle

unsigned int GetHydrogenStyle() const

Returns the style that controls of how implicit and explicit hydrogens are displayed. The return value is taken from the OEHydrogenStyle namespace.

GetMargin

double GetMargin(unsigned int margin) const

Returns the ratio of a specific margin of the OE2DMolDisplayOptions object.

margin

This value has to be from the OEMargin namespace.

GetProtectiveGroupLabelFont

const OEFont &GetProtectiveGroupLabelFont() const

Returns the font that is used to display the protective group labels.

GetProtectiveGroupStyle

unsigned int GetProtectiveGroupStyle() const

Returns the style that controls whether or not specific pre-defined protective group are contracted and labeled with corresponding abbreviations. The return value is taken from the OEProtectiveGroupStyle namespace.

Warning

This is a deprecated API. Please use OE2DMolDisplayOptions.HasProtectiveGroupStyle to determine which protective groups are set.

GetScale

double GetScale() const

Returns the scaling factor used to magnify a molecule.

GetSuperAtomLabelFont

const OEFont &GetSuperAtomLabelFont() const

Returns the font that is used to display the abbreviations of contracted functional groups.

GetSuperAtomStyle

unsigned int GetSuperAtomStyle() const

Returns the style that controls whether or not specific pre-defined functional groups are contracted and labeled with corresponding abbreviations. The return value is taken from the OESuperAtomStyle namespace.

GetTitleFont

Returns the font that is used to display the title of the molecule (i.e. the string returned by the OEMolBase.GetTitle method).

const OEFont &GetTitleFont() const

GetTitleFontScale

Returns the multiplier that can be used to increase or decrease the size of the title font.

double GetTitleFontScale() const

GetTitleLocation

unsigned int GetTitleLocation() const

Returns the position of the molecule title. The return value is taken from the OETitleLocation namespace.

GetTitleHeight

double GetTitleHeight() const

Returns the height of the title area.

GetWidth

double GetWidth() const

Returns the horizontal limit into which the molecule has to be fitted.

HasProtectiveGroupStyle

bool HasProtectiveGroupStyle(unsigned int style)

Returns true if the specific pre-defined protective group style is contracted and labeled with corresponding abbreviations.

style

This value has to be from the OEProtectiveGroupStyle namespace.

SetAromaticStyle

void SetAromaticStyle(unsigned int style)

Sets the style that controls how aromatic rings are displayed.

style

This value has to be from the OEAromaticStyle namespace.

Example: (Figure: Example of using the SetAromaticStyle method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetAromaticStyle(OEAromaticStyle.Circle);
../../_images/OE2DMolDisplayOptions_SetAromaticStyle.png

Example of using the SetAromaticStyle method

SetAtomColor

void SetAtomColor(unsigned int atomic, const OESystem::OEColor &color)

Sets the color associated with a specific atomic number.

atomic

This value has to be from the OEElemNo namespace of OEChem TK.

color

The color being associated with the given atomic number.

Example: (Figure: Example of using the SetAtomColor method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetAtomColor(OEElemNo.O, new OEColor(80, 0, 0)); // very dark red
opts.SetAtomColor(OEElemNo.N, new OEColor(0, 0, 80)); // very dark blue
../../_images/OE2DMolDisplayOptions_SetAtomColor.png

Example of using the SetAtomColor method

Note

  • The color of the atom also depends on the atom color style (OE2DMolDisplayOptions.GetAtomColorStyle).

  • Setting atom color style (OE2DMolDisplayOptions.SetAtomColorStyle) to WhiteMonochrome sets white background and black color for all atoms. Likewise, setting atom color style to BlackMonochrome sets black background and white color for all atoms. But, user can choose to have another color for all atoms (in monochrome atom color style) by setting another atom color (OE2DMolDisplayOptions.SetAtomColor) for Carbon atoms. The example in Listing 4 demonstrates setting non-default atom colors in monochrome mode. Setting atom color for other than Carbon atoms sets color of only specified atom types, not for all atoms.

SetAtomColorStyle

void SetAtomColorStyle(unsigned int style)

Sets the style that is used to define the color of the background and the default color of atom labels.

style

This value has to be from the OEAtomColorStyle namespace.

Example: (Figure: Example of using the SetAtomColorStyle method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetAtomColorStyle(OEAtomColorStyle.BlackMonochrome);
../../_images/OE2DMolDisplayOptions_SetAtomColorStyle.png

Example of using the SetAtomColorStyle method

SetAtomLabelFont

void SetAtomLabelFont(const OEFont &font)

Sets the font that is used to initialize the depiction style of the atom labels (OE2DAtomDisplay.GetLabelFont).

Example: (Figure: Example of using the SetAtomLabelFont method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
OEFont font = new OEFont();
font.SetFamily(OEFontFamily.Courier);
font.SetStyle(OEFontStyle.Bold);
opts.SetAtomLabelFont(font);
../../_images/OE2DMolDisplayOptions_SetAtomLabelFont.png

Example of using the SetAtomLabelFont method

Note

../../_images/AtomLabelFontScaling.png

Example of scaling the font of the atom label along with the molecule

SetAtomLabelFontScale

void SetAtomLabelFontScale(double scale)

Sets the multiplier that can be used increase or decrease the size of the fonts of the atom labels.

scale

This value has to be either 0.0 or in a range of [0.5, 3.0]. See examples in Figure: Examples of scaling the font of the atom label relative to the molecule

In case of 0.0, the atom labels are not scaled with the molecule but rather fixed font size are used regardless of the size of the molecule. See example in Figure: Example of atom labels with fixed font size

../../_images/AtomLabelFontScalingFactor.png

Examples of scaling the font of the atom label relative to the molecule

../../_images/NoAtomLabelFontScaling.png

Example of atom labels with fixed font size

Example: (Figure: Example of using the SetAtomLabelFontScale method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetAtomLabelFontScale(1.5);
../../_images/OE2DMolDisplayOptions_SetAtomLabelFontScale.png

Example of using the SetAtomLabelFontScale method

SetAtomPropLabelFont

void SetAtomPropLabelFont(const OEFont &font)

Sets the font that is used to initialize the depiction style of the atom property labels (OE2DAtomDisplay.GetPropertyFont).

Example: (Figure: Example of using the SetAtomPropLabelFont method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
OEFont font = new OEFont();
font.SetStyle(OEFontStyle.Bold);
font.SetColor(oechem.getOEDarkGreen());
opts.SetAtomPropLabelFont(font);
opts.SetAtomPropertyFunctor(new OEDisplayAtomIdx());
../../_images/OE2DMolDisplayOptions_SetAtomPropLabelFont.png

Example of using the SetAtomPropLabelFont method

Note

../../_images/AtomPropLabelFontScaling.png

Example of scaling the font of the atom property labels along with the molecule

SetAtomPropLabelFontScale

void SetAtomPropLabelFontScale(double scale)

Sets the multiplier that can be used increase or decrease the size of the fonts of the atom property labels.

scale

This value has to be in the range of [0.5, 2.0]. See examples in Figure: Examples of scaling the font of the atom property labels relative to the molecule

../../_images/AtomPropLabelFontScalingFactor.png

Examples of scaling the font of the atom property labels relative to the molecule

Example: (Figure: Example of using the SetAtomPropLabelFontScale method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetAtomPropLabelFontScale(1.5);
opts.SetAtomPropertyFunctor(new OEDisplayAtomIdx());
../../_images/OE2DMolDisplayOptions_SetAtomPropLabelFontScale.png

Example of using the SetAtomPropLabelFontScale method

SetAtomPropertyFunctor

void SetAtomPropertyFunctor(const OEDisplayAtomPropBase &func)

Sets the functor that is used to initialize the atom property labels (OE2DAtomDisplay.GetProperty)

Example: (Figure: Example of using the SetAtomPropertyFunctor method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetAtomPropertyFunctor(new OEDisplayAtomIdx());
../../_images/OE2DMolDisplayOptions_SetAtomPropertyFunctor.png

Example of using the SetAtomPropertyFunctor method

Hint

It is recommended to use the OE2DMolDisplayOptions.SetAtomPropertyFunctor method to define the atom property labels when the OE2DMolDisplay object is constructed. All labels displayed on the molecule diagram have to be known in advance in order to be able to minimize the number of label clashes and clippings when calculating the positions of the bond property labels.

See example of user-defined atom properties in Displaying Atom Properties section.

SetAtomStereoStyle

void SetAtomStereoStyle(unsigned int style)

Sets the style that controls what atom stereo information is displayed.

style

This value has to be from the OEAtomStereoStyle namespace.

Example: (Figure: Example of using the SetAtomStereoStyle method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetAtomStereoStyle(OEAtomStereoStyle.Display.All|OEAtomStereoStyle.HashWedgeStyle.Standard);
../../_images/OE2DMolDisplayOptions_SetAtomStereoStyle.png

Example of using the SetAtomStereoStyle method

SetAtomSVGMarkupFunctor

void SetAtomSVGMarkupFunctor(const OEAtomSVGMarkupBase &func)

Sets the functor that defines how atoms are marked in svg image. Drawing elements representing atoms in svg image are grouped together in the following format in which the <group id> and <class name> strings are defined by the given functor:

<g id='<group id>' class='<class name>'>
..
list of drawing elements
..
</g>

Note

This setting has only effect when generating .svg images.

SetAtomVisibilityFunctor

void SetAtomVisibilityFunctor(const OESystem::OEUnaryPredicate<OEChem::OEAtomBase> &func)

Sets the functor that is used to identify visible atoms.

Example: (Figure: Example of using the SetAtomVisibilityFunctor method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetAtomVisibilityFunctor(new OEAtomIsInRing());
../../_images/OE2DMolDisplayOptions_SetAtomVisibilityFunctor.png

Example of using the SetAtomVisibilityFunctor method to only display rings

Hint

It is recommended to use the OE2DMolDisplayOptions.SetAtomVisibilityFunctor method to identify the visible atoms when the OE2DMolDisplay object is constructed. All objects displayed in the molecule diagram have to be known in advance in order to be able to correctly size and scale the molecule.

See additional examples of atom visibility control in the Displaying Atom Properties section.

SetBackgroundColor

void SetBackgroundColor(const OESystem::OEColor &color)

Sets the color that is used to clear the background of an image (by calling OEImageBase.Clear method) before rendering the molecule.

Example: (Figure: Example of using the SetBackgroundColor method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetBackgroundColor(oechem.getOEYellowTint());
../../_images/OE2DMolDisplayOptions_SetBackgroundColor.png

Example of using the SetBackgroundColor method

SetBondColorStyle

void SetBondColorStyle(unsigned int style)

Sets the style that controls how bonds are colored.

style

This value has to be from the OEBondColorStyle namespace.

Example: (Figure: Example of using the SetBondColorStyle method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetBondColorStyle(OEBondColorStyle.Monochrome);
../../_images/OE2DMolDisplayOptions_SetBondColorStyle.png

Example of using the SetBondColorStyle method

SetBondLineGapScale

void SetBondLineGapScale(double scale)

Sets the multiplier that can be used increase or decrease the gap between the lines of double and triple bonds.

scale

This value has to be in the range of [0.5, 2.0]. See examples in Figure: Examples of altering the gap between the lines of double and triple bonds

../../_images/BondLineGapScale.png

Examples of altering the gap between the lines of double and triple bonds

Example: (Figure: Example of using the SetBondLineGapScale method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetBondLineGapScale(0.5);
../../_images/OE2DMolDisplayOptions_SetBondLineGapScale.png

Example of using the SetBondLineGapScale method

SetBondLineAtomLabelGapScale

void SetBondLineAtomLabelGapScale(double scale)

Sets the multiplier that can be used to increase or decrease the gap between the line(s) of bonds and the adjacent atom labels.

scale

This value has to be in the range of [0.5, 2.0]. See examples in Figure: Examples of altering the gap between the line(s) of bonds and adjacent atom labels

../../_images/BondLineAtomLabelGapScale.png

Examples of altering the gap between the line(s) of bonds and adjacent atom labels

Example: (Figure: Example of using the SetBondLineAtomLabelGapScale method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetBondLineAtomLabelGapScale(2.0);
../../_images/OE2DMolDisplayOptions_SetBondLineAtomLabelGapScale.png

Example of using the SetBondLineAtomLabelGapScale method

SetBondPropLabelFont

void SetBondPropLabelFont(const OEFont &color)

Sets the font that is used to initialize the depiction style of the bond property labels (OE2DBondDisplay.GetPropertyFont).

Example: (Figure: Example of using the SetBondPropLabelFont method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
OEFont font = new OEFont();
font.SetStyle(OEFontStyle.Bold);
font.SetColor(oechem.getOEDarkGreen());
opts.SetBondPropLabelFont(font);
opts.SetBondPropertyFunctor(new OEDisplayBondIdx());
../../_images/OE2DMolDisplayOptions_SetBondPropLabelFont.png

Example of using the SetBondPropLabelFont method

Note

../../_images/BondPropLabelFontScaling.png

Example of scaling the font of the bond property labels along with the molecule

SetBondPropLabelFontScale

void SetBondPropLabelFontScale(double scale)

Sets the multiplier that can be used increase or decrease the size of the fonts of the bond property labels.

scale

This value has to be in the range of [0.5, 2.0]. See examples in Figure:*Examples of scaling the font of the bond property labels relative to the molecule SetBondPropLabelFontScale method

../../_images/BondPropLabelFontScalingFactor.png

Examples of scaling the font of the bond property labels relative to the molecule

Example: (Figure: Example of using the SetBondPropLabelFontScale method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetBondPropLabelFontScale(1.5);
opts.SetBondPropertyFunctor(new OEDisplayBondIdx());
../../_images/OE2DMolDisplayOptions_SetBondPropLabelFontScale.png

Example of using the SetBondPropLabelFontScale method

SetBondPropertyFunctor

void SetBondPropertyFunctor(const OEDisplayBondPropBase &func)

Sets the functor that is used to initialize the bond property labels (OE2DBondDisplay.GetProperty)

Example: (Figure: Example of using the SetBondPropertyFunctor method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetBondPropertyFunctor(new OEDisplayBondIdx());
../../_images/OE2DMolDisplayOptions_SetBondPropertyFunctor.png

Example of using the SetBondPropertyFunctor method

Hint

It is recommended to use the OE2DMolDisplayOptions.SetBondPropertyFunctor method to define the bond property labels when the OE2DMolDisplay object is constructed. All labels displayed on the molecule diagram have to be known in advance in order to be able to minimize the number of label clashes and clippings when calculating the positions of the bond property labels.

See example of user-defined bond properties in Displaying Bond Properties section.

SetBondStereoStyle

void SetBondStereoStyle(unsigned int style)

Sets the style that controls what bond stereo information is displayed.

style

This value has to be from the OEBondStereoStyle namespace.

Example: (Figure: Example of using the SetBondStereoStyle method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetBondStereoStyle(OEBondStereoStyle.Display.All);
../../_images/OE2DMolDisplayOptions_SetBondStereoStyle.png

Example of using the SetBondStereoStyle method

SetBondSVGMarkupFunctor

void SetBondSVGMarkupFunctor(const OEBondSVGMarkupBase &func)

Sets the functor that defines how bonds are marked in svg image. Drawing elements representing bonds in svg image are grouped together in the following format in which the <group id> and <class name> strings are defined by the given functor:

<g id='<group id>' class='<class name>'>
..
list of drawing elements
..
</g>

Note

This setting has only effect when generating .svg images.

SetBondWidthScaling

void SetBondWidthScaling(bool scale)

Sets whether the line width of the bond are increase or decreased based on the molecule scaling factor (OE2DMolDisplayOptions.GetScale). See examples in Figure: Examples of bond line width.

Note

../../_images/BondWidthScaling.png

Examples of bond line width: (A) scaling the line width of the bonds relative to the molecule; (B) using constant line width that does not depend on the molecule scaling

Example: (Figure: Example of using the SetBondWithScaling method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetBondWidthScaling(true);
../../_images/OE2DMolDisplayOptions_SetBondWidthScaling.png

Example of using the SetBondWidthScaling method

SetDefaultBondPen

void SetDefaultBondPen(const OEPen &pen)

Sets the pen that is used to initialize the bond pens (OE2DBondDisplay.GetBgnPen and OE2DBondDisplay.GetEndPen)

Example: (Figure: Example of using the SetDefaultBondPen method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
OEPen pen = new OEPen(oechem.getOEBlack(), oechem.getOEBlack(), OEFill.On, 5.0);
opts.SetDefaultBondPen(pen);
../../_images/OE2DMolDisplayOptions_SetDefaultBondPen.png

Example of using the SetDefaultBondPen method

Note

SetDimensions

void SetDimensions(double width, double height, double scale)

Sets parameters that control the size of the depicted molecule.

width

A non-negative number that controls the horizontal limit.

height

A non-negative number that controls the vertical limit.

scale

A non-negative number that controls the magnification of the depicted molecule. OEScale.AutoScale scaling means that the molecule is scaled to maximally fit the given dimensions.

Example: (Figure: Example of using the SetDimensions method)

OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions();
double width  = 180.0;
double height = 180.0;
double scale  = 20.0;
opts.SetDimensions(width, height, scale);
../../_images/OE2DMolDisplayOptions_SetDimensions.png

Example of using the SetDimensions method

SetExplicitAtomLabelAngle

void SetExplicitAtomLabelAngle(const double angle)

In the case of an almost linear X-C-X bond, an explicit “C” label will be drawn if the angle is more that the given angle. 180.0 degree means that the “C” label will never be drawn.

../../_images/OE2DMolDisplay_SetExplicitAtomLabelAngle.png

Example of using the SetExplicitAtomLabelAngle method

SetHeight

void SetHeight(double height)

Sets the vertical limit into which the molecule has to be fitted.

height

This number has to be non-negative number.

Example: (Figure: Example of using the SetHeight method)

OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions();
opts.SetHeight(150.0);
opts.SetBackgroundColor(oechem.getOELightGrey());
../../_images/OE2DMolDisplayOptions_SetHeight.png

Example of using the SetHeight method

SetHydrogenStyle

void SetHydrogenStyle(unsigned int style)

Sets the style that controls how implicit and explicit hydrogens are displayed.

style

This value has to be from the OEHydrogenStyle namespace.

Example: (Figure: Example of using the SetHydrogenStyle method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetHydrogenStyle(OEHydrogenStyle.ImplicitTerminal);
../../_images/OE2DMolDisplayOptions_SetHydrogenStyle.png

Example of using the SetHydrogenStyle method

SetMargin

void SetMargin(unsigned int marginloc, double margin)

Sets the size of a specific margin of the OE2DMolDisplayOptions object.

marginloc

This value has to be from the OEMargin namespace.

margin

This number is considered as a percentage of either the width or the height of the molecule display and has to be in the range of [2.5%, 25.0%]. See example in Table: Example of setting specific margins to 5% (default), 15% and 25%. For example, when setting a margin to 15.0%:

  • in case of the top or the bottom margins, it means that the margin will be 15% of the total height of the molecule display

  • in case of the left or the right margins, it means that the margin will be 15% of the total width of the molecule display

Example of setting specific margins to 5% (default), 15% and 25%

top margin

bottom margin

../../_images/OE2DMolDisplayLayout_SetMargin_Top.png ../../_images/OE2DMolDisplayLayout_SetMargin_Bottom.png

left margin

right margin

../../_images/OE2DMolDisplayLayout_SetMargin_Left.png ../../_images/OE2DMolDisplayLayout_SetMargin_Right.png

Example: (Figure: Example of using the SetMargin method)

double width = 240.0;
double height = 180.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetMargin(OEMargin.Bottom, 25.0);
../../_images/OE2DMolDisplayOptions_SetMargin.png

Example of using the SetMargin method

See also

SetMargins

void SetMargins(double margin)

Sets the size of all margins of the OE2DMolDisplayOptions object.

margin

This number is considered as a percentage of either the width or the height of the molecule display and has to be in the range of [2.5%, 25.0%]. For example, 15.0% means, that the left and right margin are 15% of the total width of the molecule display, and the top and bottom margins are 15% of the total height of the molecule display. See example in Figure: Example of setting all margins to 5% (default), 15% and 25%.

../../_images/OE2DMolDisplayLayout_SetMargins.png

Example of setting all margins to 5% (default), 15% and 25%

Example: (Figure: Example of using the SetMargin method)

double width = 240.0;
double height = 180.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetMargins(25.0);
../../_images/OE2DMolDisplayOptions_SetMargins.png

Example of using the SetMargins method

See also

SetProtectiveGroupLabelFont

void SetProtectiveGroupLabelFont(const OEFont &font)

Sets the font that is used to display the abbreviations of contracted functional groups.

Example: (Figure: Example of using the ProtectiveGroupLabelFont method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
OEFont font = new OEFont();
font.SetColor(oechem.getOEDarkRed());
opts.SetProtectiveGroupLabelFont(font);
opts.SetProtectiveGroupStyle(OEProtectiveGroupStyle.All);
../../_images/OE2DMolDisplayOptions_SetProtectiveGroupLabelFont.png

Example of using the SetProtectiveGroupLabelFont method

Note

  • The size of the protective group fonts also depends on the scaling factor used to fit a molecule to a given dimension (OE2DMolDisplayOptions.SetScale).

SetProtectiveGroupStyle

void SetProtectiveGroupStyle(unsigned int style)

Sets the style that controls whether or not specific pre-defined protective group are contracted and labeled with corresponding abbreviations.

style

This value has to be from the OEProtectiveGroupStyle namespace.

Example: (Figure: Example of using the SetProtectiveGroupStyle method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetProtectiveGroupStyle(OEProtectiveGroupStyle.All);
../../_images/OE2DMolDisplayOptions_SetProtectiveGroupStyle.png

Example of using the SetProtectiveGroupStyle method

SetScale

void SetScale(double scale)

Sets the scaling factor used to magnify a molecule.

scale

This number has to be non-negative number.

Example: (Figure: Example of using the SetScale method)

OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions();
opts.SetScale(20.0);
opts.SetBackgroundColor(oechem.getOELightGrey());
../../_images/OE2DMolDisplayOptions_SetScale.png

Example of using the SetScale method

SetSuperAtomLabelFont

void SetSuperAtomLabelFont(const OEFont &font)

Sets the font that is used to display the abbreviations of contracted functional groups.

Example: (Figure: Example of using the SetSuperAtomLabelFont method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
OEFont font = new OEFont();
font.SetColor(oechem.getOEDarkRed());
opts.SetSuperAtomLabelFont(font);
opts.SetSuperAtomStyle(OESuperAtomStyle.All);
../../_images/OE2DMolDisplayOptions_SetSuperAtomLabelFont.png

Example of using the SetSuperAtomLabelFont method

Note

SetSuperAtomStyle

void SetSuperAtomStyle(unsigned int style)

Sets the style that controls whether or not specific pre-defined functional groups are contracted and labeled with corresponding abbreviations.

style

This value has to be from the OESuperAtomStyle namespace.

Example: (Figure: Example of using the SetSuperAtomStyle method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetSuperAtomStyle(OESuperAtomStyle.All);
../../_images/OE2DMolDisplayOptions_SetSuperAtomStyle.png

Example of using the SetSuperAtomStyle method

SetTitleFont

void SetTitleFont(const OEFont &font)

Sets the font that is used to display the title of the molecule (i.e. the string returned by the OEMolBase.GetTitle method).

Example: (Figure: Example of using the SetTitleFont method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
OEFont font = new OEFont();
font.SetStyle(OEFontStyle.Bold);
font.SetColor(oechem.getOEDarkBrown());
opts.SetTitleFont(font);
../../_images/OE2DMolDisplayOptions_SetTitleFont.png

Example of using the SetTitleFont method

Note

The size of the title font also depends on:

See example in Figure: Example of scaling the title along with the molecule

../../_images/TitleFontScaling.png

Example of scaling the title along with molecule

SetTitleFontScale

void SetTitleFontScale(double scale)

Sets the multiplier that can be used increase or decrease the size of the fonts of the atom labels.

scale

This value has to be either 0.0 or in a range of [0.5, 2.0]. See examples in Examples of scaling the font of title relative to the molecule In case of 0.0, the title is not scaled with the molecule but rather fixed font size is used regardless of dimensions of the image. See example in Figure: Example of titles with fixed font size

../../_images/TitleFontScalingFactor.png

Examples of scaling the font of title relative to the molecule

../../_images/NoTitleFontScaling.png

Example of titles with fixed font size

Example: (Figure: Example of using the SetTitleFontScale method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetTitleFontScale(0.5);
../../_images/OE2DMolDisplayOptions_SetTitleFontScale.png

Example of using the SetTitleFontScale method

SetTitleLocation

void SetTitleLocation(unsigned int loc)

Sets the position of the molecule title.

loc

This value has to be from the OETitleLocation namespace.

Example: (Figure: Example of using the SetTitleLocation method)

double width = 300.0;
double height = 200.0;
double scale = OEScale.AutoScale;
OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions(width, height, scale);
opts.SetTitleLocation(OETitleLocation.Bottom);
../../_images/OE2DMolDisplayOptions_SetTitleLocation.png

Example of using the SetTitleLocation method

SetTitleHeight

void SetTitleHeight(double height)

Sets the height of the title area of the OE2DMolDisplayOptions object.

height

This number is considered as a percentage of the height of the molecule display and has to be in the range of [5.0%, 25.0%]. See example in Figure: Example of setting height of the title area to 5%, 10% (default) and 25%.

../../_images/OE2DMolDisplayLayout_SetTitleHeight.png

Example of setting height of the title area to 5%, 10% (default) and 25%

Note

A molecule display has a title area only if the title location is not hidden. See also OETitleLocation namespace.

Example: (Figure: Example of using the SetTitleHeight method)

../../_images/OE2DMolDisplayOptions_SetTitleHeight.png

Example of using the SetTitleHeight method

SetWidth

void SetWidth(double width)

Sets the horizontal limit into which the molecule has to be fitted.

width

This number has to be non-negative number.

Example: (Figure: Example of using the SetWidth method)

OE2DMolDisplayOptions opts = new OE2DMolDisplayOptions();
opts.SetWidth(150.0);
opts.SetBackgroundColor(oechem.getOELightGrey());
../../_images/OE2DMolDisplayOptions_SetWidth.png

Example of using the SetWidth method