![]() |
Chemical Data Processing Library Python API - Version 1.2.3
|
Implements the 2D visualization of multiple chemical structures arranged in a grid. More...
Classes | |
class | Cell |
Data structure storing the contents of a grid cell. More... | |
Public Member Functions | |
None | __init__ () |
Constructs and initializes a StructureGridView2D instance for the visualization of multiple chemical structures. | |
None | __init__ (StructureGridView2D grid_view) |
Constructs a copy of the StructureGridView2D instance grid_view. More... | |
bool | write (str file_name) |
bool | write (str file_name, str fmt) |
bool | write (str file_name, Base.DataFormat fmt) |
bool | write (Base.OStream os, str fmt) |
bool | write (Base.OStream os, Base.DataFormat fmt) |
FontMetrics | getFontMetrics () |
Returns a reference to the used font metrics object. More... | |
None | setCellSize (float width, float height) |
Allows to specify the desired width and height of the cells in grid output renderings. More... | |
float | getCellWidth () |
Returns the active grid cell width. More... | |
float | getCellHeight () |
Returns the active grid cell height. More... | |
None | resize (int num_rows, int num_cols) |
Chnages the current number of grid rows and columns. More... | |
int | getNumRows () |
Returns the current number of grid rows. More... | |
int | getNumColumns () |
Returns the current number of grid columns. More... | |
None | clearStructures () |
Clears all specified structures. More... | |
None | clearAllText () |
Clears all specified text blocks. More... | |
StructureGridView2D | assign (StructureGridView2D grid_view) |
Performs a copy assignment of the specified StructureGridView2D instance. More... | |
Cell | __call__ (int row, int col) |
Returns the Cell instance storing the contents of the specified grid cell. More... | |
Cell | __getitem__ (tuple row_and_col) |
![]() | |
None | render (Renderer2D renderer) |
Renders the visual representation of the model using the specified Vis.Renderer2D instance. More... | |
None | setFontMetrics (FontMetrics font_metrics) |
Specifies a font metrics object that will be used to measure the dimension of text labels. More... | |
None | getModelBounds (Rectangle2D bounds) |
Calculates the bounding rectangle of the visualized model. More... | |
![]() | |
None | setParameter (LookupKey key, Any value) |
bool | removeParameter (LookupKey key) |
Removes the entry for the control-parameter specified by key. More... | |
Any | getParameter (LookupKey key, bool throw_=False, bool local=False) |
Returns the value of the control-parameter specified by key. More... | |
Any | getParameterOrDefault (LookupKey key, Any def_value, bool local=False) |
bool | isParameterSet (LookupKey key, bool local=False) |
Tells whether or not a value has been assigned to the control-parameter specified by key. More... | |
None | clearParameters () |
Erases all container entries. More... | |
None | addParameters (ControlParameterContainer cntnr) |
Adds the control-parameter value entries in the ControlParameterContainer instance cntnr. More... | |
None | copyParameters (ControlParameterContainer cntnr) |
Replaces the current set of properties by a copy of the entries in cntnr. More... | |
int | getNumParameters () |
Returns the number of container entries. More... | |
int | registerParameterChangedCallback (VoidLookupKeyAnyFunctor func) |
Registers a callback target function that gets invoked when the value of a control-parameter has changed. More... | |
None | unregisterParameterChangedCallback (int id) |
Unregisters the callback specified by id. More... | |
int | registerParameterRemovedCallback (VoidLookupKeyFunctor func) |
Registers a callback target function that gets invoked when a control-parameter entry has been removed. More... | |
None | unregisterParameterRemovedCallback (int id) |
Unregisters the callback specified by id. More... | |
int | registerParentChangedCallback (VoidFunctor func) |
Registers a callback target function that gets invoked when the parent container has been changed or was detached. More... | |
None | unregisterParentChangedCallback (int id) |
Unregisters the callback specified by id. More... | |
ControlParameterContainer | getParent () |
Returns a reference to the parent control-parameter container. More... | |
None | setParent (ControlParameterContainer cntnr) |
Sets or removes the parent control-parameter container used to resolve requests for missing entries. More... | |
list | getParameterKeys () |
list | getParameterValues () |
list | getParameters () |
Returns a reference to itself. More... | |
int | getObjectID () |
Returns the numeric identifier (ID) of the wrapped C++ class instance. More... | |
Any | __getitem__ (LookupKey key) |
None | __setitem__ (LookupKey key, Any value) |
bool | __delitem__ (LookupKey self) |
bool | __contains__ (LookupKey self, bool key) |
Returns the result of the membership test operation self in arg1 . More... | |
int | __len__ () |
Static Public Attributes | |
float | DEF_CELL_WIDTH = 250.0 |
The default grid cell width. | |
float | DEF_CELL_HEIGHT = 250.0 |
The default grid cell height. | |
Properties | |
cellWidth = property(getCellWidth) | |
cellHeight = property(getCellHeight) | |
numRows = property(getNumRows) | |
numColumns = property(getNumColumns) | |
fontMetrics = property(getFontMetrics, setFontMetrics) | |
![]() | |
objectID = property(getObjectID) | |
parent = property(getParent, setParent) | |
parameterKeys = property(getParameterKeys) | |
parameterValues = property(getParameterValues) | |
parameters = property(getParameters) | |
numParameters = property(getNumParameters) | |
Implements the 2D visualization of multiple chemical structures arranged in a grid.
StructureGridView2D
visualizes one or more molecules as 2D structure diagrams arranged in a grid of arbitrary size.
StructureGridView2D
relies on Vis.StructureView2D for 2D structure visualization and thus supports all all of its parameters controlling the graphical details of the generated structure diagrams (colors, fonts, line-widths etc.). Structure visualization parameters of a StructureGridView2D
instance can be set for individual grid cells as well as for the whole grid. Furthermore, any Chem.Atom, Chem.Bond and Chem.MolecularGraph relevant for 2D visualization properties will also be regarded (see Vis.StructureView2D for the list of supported properties). Properties of the visualized structures have a higher priority than the corresponding control-parameters of the grid cells hosting the structures. Likewise, control-parameters set for individual grid cells override the corresponding settings of the StructureGridView2D
instance.
Each grid cell can host up to nine text blocks which are located at the corners, edges and the cell center. Text blocks are stored as Vis.TextBlockPrimitive2D instances which allow the text to span multiple lines and support the styling (colors, italic, bold, sub/super-scripting, etc.) of individual text fragments.
StructureGridView2D
supports the following control-parameters in addition to the ones regarded by Vis.StructureView2D:
Control-Parameter | Description |
---|---|
Vis.ControlParameter.OUTPUT_SCALING_FACTOR | Specifies a factor for the scaling of logical to drawing surface coordinates |
Vis.ControlParameter.GRID_VIEW_BORDER_PEN | Specifies the pen used for drawing a rectangle enclosing all cells of the grid |
Vis.ControlParameter.GRID_VIEW_ROW_SEPARATOR_PEN | Specifies the pen used for drawing lines separating the grid rows |
Vis.ControlParameter.GRID_VIEW_COLUMN_SEPARATOR_PEN | Specifies the pen used for drawing lines separating the grid columns |
Vis.ControlParameter.GRID_VIEW_MARGIN | Specifies the amount of free space added around the grid borderline |
Vis.ControlParameter.GRID_VIEW_CELL_PADDING | Specifies the amount of free space added around the content of the grid cells |
Vis.ControlParameter.GRID_VIEW_TEXT_FONT | Specifies the font used for text blocks |
Vis.ControlParameter.GRID_VIEW_TEXT_COLOR | Specifies the default text color |
Default values for most of the control-parameters are defined in namespace Vis.ControlParameterDefault.
None CDPL.Vis.StructureGridView2D.__init__ | ( | StructureGridView2D | grid_view | ) |
Constructs a copy of the StructureGridView2D
instance grid_view.
grid_view | The StructureGridView2D instance to copy; |
bool CDPL.Vis.StructureGridView2D.write | ( | str | file_name | ) |
file_name |
bool CDPL.Vis.StructureGridView2D.write | ( | str | file_name, |
str | fmt | ||
) |
file_name | |
fmt |
bool CDPL.Vis.StructureGridView2D.write | ( | str | file_name, |
Base.DataFormat | fmt | ||
) |
file_name | |
fmt |
bool CDPL.Vis.StructureGridView2D.write | ( | Base.OStream | os, |
str | fmt | ||
) |
os | |
fmt |
bool CDPL.Vis.StructureGridView2D.write | ( | Base.OStream | os, |
Base.DataFormat | fmt | ||
) |
os | |
fmt |
FontMetrics CDPL.Vis.StructureGridView2D.getFontMetrics | ( | ) |
Returns a reference to the used font metrics object.
None CDPL.Vis.StructureGridView2D.setCellSize | ( | float | width, |
float | height | ||
) |
Allows to specify the desired width and height of the cells in grid output renderings.
The default width and height is given by the constants DEF_CELL_WIDTH and DEF_CELL_HEIGHT, respectively.
width | The new cell width. |
height | The new cell height. |
Base.ValueError | if either width or height is negative. |
float CDPL.Vis.StructureGridView2D.getCellWidth | ( | ) |
Returns the active grid cell width.
float CDPL.Vis.StructureGridView2D.getCellHeight | ( | ) |
Returns the active grid cell height.
None CDPL.Vis.StructureGridView2D.resize | ( | int | num_rows, |
int | num_cols | ||
) |
Chnages the current number of grid rows and columns.
The grid gets resized dynamically if a cell outside the currently sized grid is requested by call. Calling this method is thus only necessary if a specific grid size is desired. Any already existing cells that are located outside the new grid dimensions will be deleted.
num_rows | The new numer of grid rows. |
num_cols | The new numer of grid columns. |
int CDPL.Vis.StructureGridView2D.getNumRows | ( | ) |
Returns the current number of grid rows.
int CDPL.Vis.StructureGridView2D.getNumColumns | ( | ) |
Returns the current number of grid columns.
None CDPL.Vis.StructureGridView2D.clearStructures | ( | ) |
Clears all specified structures.
None CDPL.Vis.StructureGridView2D.clearAllText | ( | ) |
Clears all specified text blocks.
StructureGridView2D CDPL.Vis.StructureGridView2D.assign | ( | StructureGridView2D | grid_view | ) |
Performs a copy assignment of the specified StructureGridView2D
instance.
grid_view | The StructureGridView2D instance to copy. |
Cell CDPL.Vis.StructureGridView2D.__call__ | ( | int | row, |
int | col | ||
) |
Returns the Cell instance storing the contents of the specified grid cell.
If row and col specify a cell outside of the current grid bounds the grid will not be automatically resized to accommodate the new cell. For such cells a reference to an "empty" Cell instance is returned. The same is done for not yet touched cells (within the current grid bounds).
row | The zero-based row index of the cell. |
col | The zero-based columns index of the cell. |
Cell CDPL.Vis.StructureGridView2D.__getitem__ | ( | tuple | row_and_col | ) |
row_and_col |