OEImageTableOptions

class OEImageTableOptions

This class represents the OEImageTableOptions class that encapsulates properties that determine how an image table is depicted.

The OEImageTableOptions class stores the following properties:

Property

Get method

Set method

Corresponding namespace / class / type

number of columns

NumColumns

integer greater than 0

number of rows

NumRows

integer greater than 1

width of columns

SetColumnWidths

vector of non zero integers

height of rows

SetRowHeights

vector of non zero integers

cell font size

SetBaseFontSize

positive non-zero integer

pen used around cells cells

GetCellBorderPen

SetCellBorderPen

OEPen

table cell color

GetCellColor

SetCellColor

OEColor

table cell font

GetCellFont

SetCellFont

OEFont

header

HasHeader

SetHeader

boolean

header color

GetHeaderColor

SetHeaderColor

OEColor

header font

GetHeaderFont

SetHeaderFont

OEFont

table margins

GetMargin

SetMargin / SetMargins

positive floating point number in the range of \([0.0, 25.0]\)

stub column

HasStubColumn

SetStubColumn

boolean

stub column color

GetStubColumnColor

SetStubColumnColor

OEColor

stub column font

GetStubColumnFont

SetStubColumnFont

OEFont

Constructors

OEImageTableOptions(unsigned int rows, unsigned int cols,
                    unsigned int style=OEImageTableStyle::Default)

Creates an OEImageTableOptions object with the given parameters.

rows

The total number of rows in the table including the header.

cols

The total number of columns in the table including the stub column.

style

This value has to be from the OEImageTableStyle namespace.

Note

By default, the columns and rows of a table are created with equal widths and heights. The relative width and height ratio of the columns and rows can be adjusted using the OEImageTableOptions.SetColumnWidths and OEImageTableOptions.SetRowHeights methods, respectively.

Example (Example of generating a 4 x 4 image table with header and ‘MediumBlue’ style)

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
../../_images/OEImageTableOptions_Default.png

Example of generating a 4 x 4 image table with header and ‘MediumBlue’ style

OEImageTableOptions(const OEImageTableOptions &rhs)

Copy constructor.

operator=

OEImageTableOptions &operator=(const OEImageTableOptions &)

Assignment operator.

GetCellBorderPen

const OEPen &GetCellBorderPen() const

Returns the pen that is used to mark the border of the cells in the table.

GetCellColor

const OESystem::OEColor GetCellColor(bool even=true) const

Returns the color used to highlight the ‘body’ cells in the table. A cell is considered to be part of the ‘body’ of the table if it is neither in the header nor in the stub column.

even

This parameter determines whether to return the color of the even or odd rows in the table.

GetCellFont

const OEFont GetCellFont() const

Returns the font used by the OEImageTable.DrawText method to draw text on the ‘body’ cells.

See also

GetHeaderColor

const OESystem::OEColor GetHeaderColor() const

Returns the color used to highlight the ‘header’ cells in the table.

GetHeaderFont

const OEFont GetHeaderFont() const

Returns the font used by the OEImageTable.DrawText method to draw text on the ‘header’ cells.

GetMargin

double GetMargin(unsigned int margin) const

Returns the ratio of a specific margin of the table.

margin

This value has to be from the OEMargin namespace.

GetStubColumnColor

const OESystem::OEColor GetStubColumnColor() const

Returns the color used to highlight the ‘stub column’ cells in the table.

GetStubColumnFont

const OEFont GetStubColumnFont() const

Returns the font used by the OEImageTable.DrawText method to draw text on the ‘stub column’ cells.

HasHeader

bool HasHeader() const

Returns whether a table has a ‘header’ row. By default, a table is generated with a ‘header’ row.

HasStubColumn

bool HasStubColumn() const

Returns whether the table has a ‘stub’ column. By default, a table is generated without a ‘stub’ column.

NumColumns

unsigned int NumColumns() const

Returns the total number of columns in the table including the stub column.

NumRows

unsigned int NumRows() const

Returns the total number of rows in the table including the header row.

SetBaseFontSize

void SetBaseFontSize(unsigned int fontsize)

Controls the font size in add table cells (including cells of header, stub column and body).

See also

The other properties of the used fonts can be controlled with the following methods:

SetCellBorderPen

void SetCellBorderPen(const OEPen &pen)

Sets the pen that is used to mark the border of the cells in the table.

Example (Example of using the SetCellBorderPen method)

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
pen = oedepict.OEPen(oechem.OEBlack, oechem.OEDarkBlue, oedepict.OEFill_Off, 2.0)
tableopts.SetCellBorderPen(pen)
../../_images/OEImageTableOptions_SetCellBorderPen.png

Example of using the SetCellBorderPen method

SetCellColor

void SetCellColor(const OESystem::OEColor &color, bool even=true)

Sets the color used to highlight the ‘body’ cells in the table. A cell is considered to be part of the ‘body’ of the table if it is neither in the header nor in the stub column.

color

The color of the cells.

even

This parameter determines whether the color is applied to the even or to the odd rows of the table.

Example (Example of using the SetCellColor method)

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
evenrow = True
tableopts.SetCellColor(oechem.OELightGrey, not evenrow)
../../_images/OEImageTableOptions_SetCellColor.png

Example of using the SetCellColor method

SetCellFont

void SetCellFont(const OEFont &font)

Sets the font used by the OEImageTable.DrawText method to draw text on the ‘body’ cells. A cell is considered to be part of the ‘body’ of the table if it is neither in the header nor in the stub column.

Example (Example of using the SetCellFont method)

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
font = oedepict.OEFont(oedepict.OEFontFamily_Default,
                       oedepict.OEFontStyle_Italic | oedepict.OEFontStyle_Bold,
                       8, oedepict.OEAlignment_Left, oechem.OEDarkRed)
tableopts.SetCellFont(font)
../../_images/OEImageTableOptions_SetCellFont.png

Example of using the SetCellFont method

SetColumnWidths

bool SetColumnWidths(const std::vector<unsigned int> &widths)

Sets the relative widths of the columns.

widths

The relative widths of the columns. The size of the vector has to be OEImageTableOptions.NumColumns().

Example (Example of using the SetColumnWidths method)

The following example show how to adjust the width ratio of the columns.

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
tableopts.SetColumnWidths([20, 10, 20, 10])
../../_images/OEImageTableOptions_SetColumnWidths.png

Example of using the SetColumnWidths method

SetHeader

bool SetHeader(bool has)

Sets whether to have a ‘header’ row in the table.

Example (Example of using the SetHeader method)

By default, a table is generated with a header row on the top. The following example show how to remove the header.

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
tableopts.SetHeader(False)
../../_images/OEImageTableOptions_SetHeader.png

Example of using the SetHeader method

SetHeaderColor

void SetHeaderColor(const OESystem::OEColor &color)

Sets the color used to highlight the ‘header’ cells in the table.

Example (Example of using the SetHeaderColor method)

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
tableopts.SetHeaderColor(oechem.OELightGrey)
../../_images/OEImageTableOptions_SetHeaderColor.png

Example of using the SetHeaderColor method

SetHeaderFont

void SetHeaderFont(const OEFont &font)

Sets the font used by the OEImageTable.DrawText method to draw text on the ‘header’ cells.

Example (Example of using the SetHeaderFont method)

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
font = oedepict.OEFont(oedepict.OEFontFamily_Default, oedepict.OEFontStyle_Default, 12,
                       oedepict.OEAlignment_Right, oechem.OEPinkTint)
tableopts.SetHeaderFont(font)
../../_images/OEImageTableOptions_SetHeaderFont.png

Example of using the SetHeaderFont method

SetMargin

bool SetMargin(unsigned int marginloc, double margin)

Sets the size of a specific margin of the table.

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 image on which the table will be drawn and has to be in the range of \([0.0, 25.0]\). For example, 10.0% means, that the left and right margin are 10% of the total width of the image, and the top and bottom margins are 10% of the total height of the image.

Example (Example of using the SetMargin method)

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
tableopts.SetMargin(oedepict.OEMargin_Left, 10.0)
tableopts.SetMargin(oedepict.OEMargin_Right, 10.0)
../../_images/OEImageTableOptions_SetMargin.png

Example of using the SetMargin method

SetMargins

bool SetMargins(double margin)

Sets the size of all margins of the table.

margin

This number is considered as a percentage of either the width or the height of image on which the table will be drawn and has to be in the range of \([0.0, 25.0]\). For example, 10.0% means, that the left and right margin are 10% of the total width of the image, and the top and bottom margins are 10% of the total height of the image.

Example (Example of using the SetMargins method)

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
tableopts.SetMargins(10.0)
../../_images/OEImageTableOptions_SetMargins.png

Example of using the SetMargins method

SetRowHeights

bool SetRowHeights(const std::vector<unsigned int> &heights)

Sets the relative heights of the rows.

heights

The relative heights of the rows. The size of the vector has to be OEImageTableOptions.NumRows().

Example (Example of using the SetRowHeights method)

The following example show how to adjust the height ratio of the rows.

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
tableopts.SetRowHeights([10, 20, 30, 40])
../../_images/OEImageTableOptions_SetRowHeights.png

Example of using the SetRowHeights method

SetStubColumn

bool SetStubColumn(bool has)

Sets whether to have a ‘stub’ column in the table.

Example (Example of using the SetStubColumn method)

By default, a table is generated without a ‘stub’ column. The following example show how to add one on the left.

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
tableopts.SetStubColumn(True)
../../_images/OEImageTableOptions_SetStubColumn.png

Example of using the SetStubColumn method

SetStubColumnColor

void SetStubColumnColor(const OESystem::OEColor & color)

Sets the color used to highlight the ‘stub’ cells in the table.

Example (Example of using the SetStubColumnColor method)

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
tableopts.SetStubColumn(True)
tableopts.SetStubColumnColor(oechem.OELightGrey)
../../_images/OEImageTableOptions_SetStubColumnColor.png

Example of using the SetStubColumnColor method

SetStubColumnFont

void SetStubColumnFont(const OEFont &font)

Sets the font used by the OEImageTable.DrawText method to draw text on the ‘stub column’ cells.

Example (Example of using the SetStubColumnFont method)

tableopts = oedepict.OEImageTableOptions(4, 4, oedepict.OEImageTableStyle_MediumBlue)
tableopts.SetStubColumn(True)
font = oedepict.OEFont(oedepict.OEFontFamily_Default, oedepict.OEFontStyle_Default, 12,
                       oedepict.OEAlignment_Right, oechem.OEPinkTint)
tableopts.SetStubColumnFont(font)
../../_images/OEImageTableOptions_SetStubColumnFont.png

Example of using the SetStubColumnFont method