Chemical Data Processing Library Python API - Version 1.2.0
Public Member Functions | Properties | List of all members
CDPL.Vis.StructureView2D Class Reference

Implements the 2D visualization of chemical structures. More...

+ Inheritance diagram for CDPL.Vis.StructureView2D:

Public Member Functions

None __init__ ()
 Initializes the StructureView2D instance.
 
None __init__ (Chem.MolecularGraph molgraph)
 Constructs and initializes a StructureView2D instance for the visualization of the chemical structure specified by molgraph. More...
 
None setStructure (Chem.MolecularGraph molgraph)
 Specifies the chemical structure to visualize. More...
 
Chem.MolecularGraph getStructure ()
 Returns a reference to the visualized chemical structure. More...
 
FontMetrics getFontMetrics ()
 Returns a reference to the used font metrics object. More...
 
- Public Member Functions inherited from CDPL.Vis.View2D
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...
 
- Public Member Functions inherited from CDPL.Base.ControlParameterContainer
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__ ()
 

Properties

 structure = property(getStructure, setStructure)
 
 fontMetrics = property(getFontMetrics, setFontMetrics)
 
- Properties inherited from CDPL.Base.ControlParameterContainer
 objectID = property(getObjectID)
 
 parent = property(getParent, setParent)
 
 parameterKeys = property(getParameterKeys)
 
 parameterValues = property(getParameterValues)
 
 parameters = property(getParameters)
 
 numParameters = property(getNumParameters)
 

Detailed Description

Implements the 2D visualization of chemical structures.

StructureView2D visualizes chemical structures in the form of 2D structure diagrams (also known as skeletal formulas [WSKF] or structural formulas [WSTF]) that allow for an easy perception of important chemical characteristics like constitution, connectivity and stereochemistry.

Graphical details of the generated structure diagrams (colors, fonts, line-widths etc.) are configurable on a StructureView2D instance level by control-parameters and on a visualized data object level by setting appropriate Chem.Atom, Chem.Bond or Chem.MolecularGraph properties. Properties of the visualized data objects have a higher priority than equivalent control-parameters of the StructureView2D instance and properties of Chem.Atom or Chem.Bond objects override corresponding properties of the parent Chem.MolecularGraph instance.

StructureView2D supports the following control-parameters:

Control-ParameterDescription
Vis.ControlParameter.VIEWPORTSpecifies a rectangular viewport area which constrains the location and size of the generated structure diagram
Vis.ControlParameter.SIZE_ADJUSTMENTSpecifies how to adjust the size of the structure diagram relative to the available viewport area
Vis.ControlParameter.ALIGNMENTSpecifies the alignment of the structure diagram within the viewport area
Vis.ControlParameter.BACKGROUND_COLORSpecifies the backround color of the structure diagram
Vis.ControlParameter.ATOM_COLORSpecifies the color of atom labels
Vis.ControlParameter.ATOM_COLOR_TABLESpecifies a lookup table for the atom type dependent coloring of atom labels
Vis.ControlParameter.USE_CALCULATED_ATOM_COORDINATESSpecifies whether or not to use calculated atom coordinates
Vis.ControlParameter.ATOM_LABEL_FONTSpecifies the font for atom element and query match expression labels
Vis.ControlParameter.ATOM_LABEL_SIZESpecifies the size of atom element and query match expression labels
Vis.ControlParameter.SECONDARY_ATOM_LABEL_FONTSpecifies the font for text labels that show the value of various atomic properties
Vis.ControlParameter.SECONDARY_ATOM_LABEL_SIZESpecifies the size of text labels that show the value of various atomic properties
Vis.ControlParameter.ATOM_CONFIGURATION_LABEL_FONTSpecifies the font for atom configuration labels
Vis.ControlParameter.ATOM_CONFIGURATION_LABEL_SIZESpecifies the size of atom configuration labels
Vis.ControlParameter.ATOM_CONFIGURATION_LABEL_COLORSpecifies the color of atom configuration labels
Vis.ControlParameter.ATOM_CUSTOM_LABEL_FONTSpecifies the font for atom custom labels
Vis.ControlParameter.ATOM_CUSTOM_LABEL_SIZESpecifies the size of atom custom labels
Vis.ControlParameter.ATOM_CUSTOM_LABEL_COLORSpecifies the color of atom custom labels
Vis.ControlParameter.ATOM_LABEL_MARGINSpecifies the margin of free space around atom labels
Vis.ControlParameter.RADICAL_ELECTRON_DOT_SIZESpecifies the size of radical electron dots
Vis.ControlParameter.ATOM_HIGHLIGHT_AREA_SIZESpecifies the minimum size of atom highlighting areas
Vis.ControlParameter.ATOM_HIGHLIGHT_AREA_BRUSHSpecifies the brush to use for filling atom highlighting areas
Vis.ControlParameter.ATOM_HIGHLIGHT_AREA_OUTLINE_PENSpecifies the pen to use for drawing atom highlighting area outlines
Vis.ControlParameter.SHOW_EXPLICIT_HYDROGENSSpecifies whether or not to show explicit hydrogen atoms
Vis.ControlParameter.SHOW_CARBONSSpecifies whether or not to show the element label of carbon atoms
Vis.ControlParameter.SHOW_CHARGESSpecifies whether or not to show the formal charge of atoms
Vis.ControlParameter.SHOW_ISOTOPESSpecifies whether or not to show the isotopic mass of atoms
Vis.ControlParameter.SHOW_HYDROGEN_COUNTSSpecifies whether or not to show the implicit hydrogen count of connected atoms
Vis.ControlParameter.SHOW_NON_CARBON_HYDROGEN_COUNTSSpecifies whether or not to show the implicit hydrogen count of connected non-carbon atoms
Vis.ControlParameter.SHOW_ATOM_QUERY_INFOSSpecifies whether or not to show query atom match expressions
Vis.ControlParameter.SHOW_ATOM_REACTION_INFOSSpecifies whether or not to show reaction atom-atom mapping numbers
Vis.ControlParameter.SHOW_RADICAL_ELECTRONSSpecifies whether or not to draw radical electron dots
Vis.ControlParameter.SHOW_ATOM_CONFIGURATION_LABELSSpecifies whether or not to show atom confiuration labels
Vis.ControlParameter.SHOW_ATOM_CUSTOM_LABELSSpecifies whether or not to show atom confiuration labels
Vis.ControlParameter.ENABLE_ATOM_HIGHLIGHTINGSpecifies whether or not to enable the highlighting of atoms
Vis.ControlParameter.HIGHLIGHT_AREA_OUTLINE_WIDTHSpecifies the line width for drawing atom or bond highlighting area outlines
Vis.ControlParameter.BOND_LENGTHSpecifies the desired average bond length
Vis.ControlParameter.BOND_COLORSpecifies the color of bonds
Vis.ControlParameter.BOND_LINE_WIDTHSpecifies the width of bond lines
Vis.ControlParameter.BOND_LINE_SPACINGSpecifies the distance between the lines of double and triple bonds
Vis.ControlParameter.STEREO_BOND_WEDGE_WIDTHSpecifies the width of wedge-shaped stereo bonds
Vis.ControlParameter.STEREO_BOND_HASH_SPACINGSpecifies the distance between the hashes of down stereo bonds
Vis.ControlParameter.REACTION_CENTER_LINE_LENGTHSpecifies the length of the lines in reaction center marks
Vis.ControlParameter.REACTION_CENTER_LINE_SPACINGSpecifies the distance between lines in reaction center marks
Vis.ControlParameter.DOUBLE_BOND_TRIM_LENGTHSpecifies the amount by which the non-central lines of asymmetric double bonds have to be trimmed at each line end
Vis.ControlParameter.TRIPLE_BOND_TRIM_LENGTHSpecifies the amount by which the non-central lines of triple bonds have to be trimmed at each line end
Vis.ControlParameter.BOND_LABEL_FONTSpecifies the font for bond labels
Vis.ControlParameter.BOND_LABEL_SIZESpecifies the size of bond labels
Vis.ControlParameter.BOND_CONFIGURATION_LABEL_FONTSpecifies the font for bond configuration labels
Vis.ControlParameter.BOND_CONFIGURATION_LABEL_SIZESpecifies the size of bond configuration labels
Vis.ControlParameter.BOND_CONFIGURATION_LABEL_COLORSpecifies the color of bond configuration labels
Vis.ControlParameter.BOND_CUSTOM_LABEL_FONTSpecifies the font for bond custom labels
Vis.ControlParameter.BOND_CUSTOM_LABEL_SIZESpecifies the size of bond custom labels
Vis.ControlParameter.BOND_CUSTOM_LABEL_COLORSpecifies the color of bond custom labels
Vis.ControlParameter.BOND_LABEL_MARGINSpecifies the margin of free space around bond labels
Vis.ControlParameter.BOND_HIGHLIGHT_AREA_WIDTHSpecifies the width of bond highlighting areas
Vis.ControlParameter.BOND_HIGHLIGHT_AREA_BRUSHSpecifies the brush to use for filling bond highlighting areas
Vis.ControlParameter.BOND_HIGHLIGHT_AREA_OUTLINE_PENSpecifies the pen to use for drawing bond highlighting area outlines
Vis.ControlParameter.SHOW_BOND_REACTION_INFOSSpecifies whether or not to draw reaction center marks
Vis.ControlParameter.SHOW_BOND_QUERY_INFOSSpecifies whether or not to show query bond match expressions
Vis.ControlParameter.SHOW_STEREO_BONDSSpecifies whether or not to draw stereo bonds
Vis.ControlParameter.SHOW_BOND_CONFIGURATION_LABELSSpecifies whether or not to show bond confiuration labels
Vis.ControlParameter.SHOW_BOND_CUSTOM_LABELSSpecifies whether or not to show bond confiuration labels
Vis.ControlParameter.ENABLE_BOND_HIGHLIGHTINGSpecifies whether or not to enable the highlighting of bonds

Default values for most of the control-parameters are defined in namespace Vis.ControlParameterDefault.

Supported Chem.MolecularGraph properties:

Chem.MolecularGraph PropertyDescription
Vis.MolecularGraphProperty.ATOM_COLOR_TABLESpecifies a lookup table for the atom type dependent coloring of atom labels
Vis.MolecularGraphProperty.ATOM_COLORSpecifies the color of atom labels
Vis.MolecularGraphProperty.ATOM_LABEL_FONTSpecifies the font for atom element and query match expression labels
Vis.MolecularGraphProperty.ATOM_LABEL_SIZESpecifies the size of atom element and query match expression labels
Vis.MolecularGraphProperty.SECONDARY_ATOM_LABEL_FONTSpecifies the font for text labels that show the value of various atomic properties
Vis.MolecularGraphProperty.SECONDARY_ATOM_LABEL_SIZESpecifies the size of text labels that show the value of various atomic properties
Vis.MolecularGraphProperty.ATOM_CONFIGURATION_LABEL_FONTSpecifies the font for atom configuration labels
Vis.MolecularGraphProperty.ATOM_CONFIGURATION_LABEL_SIZESpecifies the size of atom configuration labels
Vis.MolecularGraphProperty.ATOM_CONFIGURATION_LABEL_COLORSpecifies the color of atom configuration labels
Vis.MolecularGraphProperty.ATOM_CUSTOM_LABEL_FONTSpecifies the font for atom custom labels
Vis.MolecularGraphProperty.ATOM_CUSTOM_LABEL_SIZESpecifies the size of atom custom labels
Vis.MolecularGraphProperty.ATOM_CUSTOM_LABEL_COLORSpecifies the color of atom custom labels
Vis.MolecularGraphProperty.ATOM_LABEL_MARGINSpecifies the margin of free space around atom labels
Vis.MolecularGraphProperty.RADICAL_ELECTRON_DOT_SIZESpecifies the size of radical electron dots
Vis.MolecularGraphProperty.ATOM_HIGHLIGHT_AREA_SIZESpecifies the minimum size of atom highlighting areas
Vis.MolecularGraphProperty.ATOM_HIGHLIGHT_AREA_BRUSHSpecifies the brush to use for filling atom highlighting areas
Vis.MolecularGraphProperty.ATOM_HIGHLIGHT_AREA_OUTLINE_PENSpecifies the pen to use for drawing atom highlighting area outlines
Vis.MolecularGraphProperty.HIGHLIGHT_AREA_OUTLINE_WIDTHSpecifies the line width for drawing atom or bond highlighting area outlines
Vis.MolecularGraphProperty.BOND_COLORSpecifies the color of bonds
Vis.MolecularGraphProperty.BOND_LINE_WIDTHSpecifies the width of bond lines
Vis.MolecularGraphProperty.BOND_LINE_SPACINGSpecifies the distance between the lines of double and triple bonds
Vis.MolecularGraphProperty.STEREO_BOND_WEDGE_WIDTHSpecifies the width of wedge-shaped stereo bonds
Vis.MolecularGraphProperty.STEREO_BOND_HASH_SPACINGSpecifies the distance between the hashes of down stereo bonds
Vis.MolecularGraphProperty.REACTION_CENTER_LINE_LENGTHSpecifies the length of the lines in reaction center marks
Vis.MolecularGraphProperty.REACTION_CENTER_LINE_SPACINGSpecifies the distance between the lines in reaction center marks
Vis.MolecularGraphProperty.DOUBLE_BOND_TRIM_LENGTHSpecifies the amount by which the non-central lines of asymmetric double bonds have to be trimmed at each line end
Vis.MolecularGraphProperty.TRIPLE_BOND_TRIM_LENGTHSpecifies the amount by which the non-central lines of triple bonds have to be trimmed at each line end
Vis.MolecularGraphProperty.BOND_LABEL_FONTSpecifies the font for bond labels
Vis.MolecularGraphProperty.BOND_LABEL_SIZESpecifies the size of bond labels
Vis.MolecularGraphProperty.BOND_CONFIGURATION_LABEL_FONTSpecifies the font for bond configuration labels
Vis.MolecularGraphProperty.BOND_CONFIGURATION_LABEL_SIZESpecifies the size of bond configuration labelsVis.MolecularGraphProperty.BOND_CONFIGURATION_LABEL_COLORSpecifies the color of bond configuration labels
Vis.MolecularGraphProperty.BOND_CUSTOM_LABEL_FONTSpecifies the font for bond custom labels
Vis.MolecularGraphProperty.BOND_CUSTOM_LABEL_SIZESpecifies the size of bond custom labelsVis.MolecularGraphProperty.BOND_CUSTOM_LABEL_COLORSpecifies the color of bond custom labels
Vis.MolecularGraphProperty.BOND_LABEL_MARGINSpecifies the margin of free space around bond labels
Vis.MolecularGraphProperty.BOND_HIGHLIGHT_AREA_WIDTHSpecifies the width of bond highlighting areas
Vis.MolecularGraphProperty.BOND_HIGHLIGHT_AREA_BRUSHSpecifies the brush to use for filling bond highlighting areas
Vis.MolecularGraphProperty.BOND_HIGHLIGHT_AREA_OUTLINE_PENSpecifies the pen to use for drawing bond highlighting area outlines

Supported Chem.Atom properties:

Chem.Atom PropertyDescription
Vis.AtomProperty.COLORSpecifies the color of text labels
Vis.AtomProperty.LABEL_FONTSpecifies the font for atom element and query match expression labels
Vis.AtomProperty.LABEL_SIZESpecifies the size of atom element and query match expression labels
Vis.AtomProperty.SECONDARY_LABEL_FONTSpecifies the font for text labels that show the value of various atomic properties
Vis.AtomProperty.SECONDARY_LABEL_SIZESpecifies the size of text labels that show the value of various atomic properties
Vis.AtomProperty.LABEL_MARGINSpecifies the margin of free space around atom labels
Vis.AtomProperty.CONFIGURATION_LABEL_FONTSpecifies the font for atom configuration labels
Vis.AtomProperty.CONFIGURATION_LABEL_SIZESpecifies the size of atom configuration labels
Vis.AtomProperty.CONFIGURATION_LABEL_COLORSpecifies the color of atom configuration labels
Vis.AtomProperty.CUSTOM_LABEL_FONTSpecifies the font for atom custom labels
Vis.AtomProperty.CUSTOM_LABEL_SIZESpecifies the size of atom custom labels
Vis.AtomProperty.CUSTOM_LABEL_COLORSpecifies the color of atom custom labels
Vis.AtomProperty.RADICAL_ELECTRON_DOT_SIZESpecifies the size of radical electron dots
Vis.AtomProperty.HIGHLIGHT_AREA_BRUSHSpecifies the brush to use for filling highlighting areas
Vis.AtomProperty.HIGHLIGHT_AREA_OUTLINE_PENSpecifies the pen to use for drawing highlighting area outlines

Supported Chem.Bond properties:

Chem.Bond PropertyDescription
Vis.BondProperty.COLORSpecifies the color of the bond
Vis.BondProperty.LINE_WIDTHSpecifies the width of bond lines
Vis.BondProperty.LINE_SPACINGSpecifies the distance between the lines of double and triple bonds
Vis.BondProperty.STEREO_BOND_WEDGE_WIDTHSpecifies the width of wedge-shaped stereo bonds
Vis.BondProperty.STEREO_BOND_HASH_SPACINGSpecifies the distance between the hashes of down stereo bonds
Vis.BondProperty.REACTION_CENTER_LINE_LENGTHSpecifies the length of the lines in reaction center marks
Vis.BondProperty.REACTION_CENTER_LINE_SPACINGSpecifies the distance between the lines in reaction center marks
Vis.BondProperty.DOUBLE_BOND_TRIM_LENGTHSpecifies the amount by which the non-central lines of asymmetric double bonds have to be trimmed at each line end
Vis.BondProperty.TRIPLE_BOND_TRIM_LENGTHSpecifies the amount by which the non-central lines of triple bonds have to be trimmed at each line end
Vis.BondProperty.LABEL_FONTSpecifies the font for bond labels
Vis.BondProperty.LABEL_SIZESpecifies the size of bond labels
Vis.BondProperty.LABEL_MARGINSpecifies the margin of free space around bond labels
Vis.BondProperty.CONFIGURATION_LABEL_FONTSpecifies the font for bond configuration labels
Vis.BondProperty.CONFIGURATION_LABEL_SIZESpecifies the size of bond configuration labels
Vis.BondProperty.CONFIGURATION_LABEL_COLORSpecifies the color of bond configuration labels
Vis.BondProperty.CUSTOM_LABEL_FONTSpecifies the font for bond custom labels
Vis.BondProperty.CUSTOM_LABEL_SIZESpecifies the size of bond custom labels
Vis.BondProperty.CUSTOM_LABEL_COLORSpecifies the color of bond custom labels
Vis.BondProperty.HIGHLIGHT_AREA_BRUSHSpecifies the brush to use for filling highlighting areas
Vis.BondProperty.HIGHLIGHT_AREA_OUTLINE_PENSpecifies the pen to use for drawing highlighting area outlines

Constructor & Destructor Documentation

◆ __init__()

None CDPL.Vis.StructureView2D.__init__ ( Chem.MolecularGraph  molgraph)

Constructs and initializes a StructureView2D instance for the visualization of the chemical structure specified by molgraph.

Parameters
molgraphA reference to the Chem.MolecularGraph object to visualize.

Member Function Documentation

◆ setStructure()

None CDPL.Vis.StructureView2D.setStructure ( Chem.MolecularGraph  molgraph)

Specifies the chemical structure to visualize.

If the chemical structure or a property has changed after this method has been called for a Chem.MolecularGraph object, the method needs to be called again for the object to make the changes visible.

Parameters
molgraphA reference to the Chem.MolecularGraph object to visualize, or None.

◆ getStructure()

Chem.MolecularGraph CDPL.Vis.StructureView2D.getStructure ( )

Returns a reference to the visualized chemical structure.

Returns
A reference to the visualized Chem.MolecularGraph object, or None if none was specified.

◆ getFontMetrics()

FontMetrics CDPL.Vis.StructureView2D.getFontMetrics ( )

Returns a reference to the used font metrics object.

Returns
A reference to the used font metrics object, or None if none was specified.