Chemical Data Processing Library C++ API - Version 1.1.1
|
Implements the 2D visualization of chemical reactions. More...
#include <ReactionView2D.hpp>
Public Types | |
typedef std::shared_ptr< ReactionView2D > | SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated ReactionView2D instances. More... | |
Public Types inherited from CDPL::Base::ControlParameterContainer | |
typedef ParameterMap::value_type | ParameterEntry |
A Base::LookupKey / Base::Any pair used to store the control-parameter values and associated keys. More... | |
typedef ParameterMap::const_iterator | ConstParameterIterator |
A constant iterator used to iterate over the control-parameter entries. More... | |
typedef std::function< void(const LookupKey &, const Any &)> | ParameterChangedCallbackFunction |
A functor class that wraps callback target functions which get invoked when the value of a control-parameter has changed. More... | |
typedef std::function< void(const LookupKey &)> | ParameterRemovedCallbackFunction |
A functor class that wraps callback target functions which get invoked when a control-parameter entry has been removed. More... | |
typedef std::function< void()> | ParentChangedCallbackFunction |
A functor class that wraps callback target functions which get invoked when the parent container has been changed or was detached. More... | |
Public Member Functions | |
ReactionView2D (const Chem::Reaction *rxn=0) | |
Constructs and initializes a ReactionView2D instance for the visualization of the chemical reaction specified by rxn. More... | |
~ReactionView2D () | |
Destructor. More... | |
void | render (Renderer2D &renderer) |
Renders the visual representation of the model using the specified Vis::Renderer2D instance. More... | |
void | setFontMetrics (FontMetrics *font_metrics) |
Specifies a font metrics object that will be used to measure the dimension of text labels. More... | |
FontMetrics * | getFontMetrics () const |
Returns a pointer to the used font metrics object. More... | |
void | setReaction (const Chem::Reaction *rxn) |
Specifies the chemical reaction to visualize. More... | |
const Chem::Reaction * | getReaction () const |
Returns a pointer to the visualized chemical reaction. More... | |
void | getModelBounds (Rectangle2D &bounds) |
Calculates the bounding rectangle of the visualized model. More... | |
Public Member Functions inherited from CDPL::Vis::View2D | |
virtual | ~View2D () |
Virtual destructor. More... | |
Public Member Functions inherited from CDPL::Base::ControlParameterContainer | |
std::size_t | getNumParameters () const |
Returns the number of container entries. More... | |
template<typename T > | |
void | setParameter (const LookupKey &key, T &&val) |
Sets the value of the control-parameter specified by key to val. More... | |
const Any & | getParameter (const LookupKey &key, bool throw_=false, bool local=false) const |
Returns the value of the control-parameter specified by key. More... | |
template<typename T > | |
const T & | getParameter (const LookupKey &key, bool local=false) const |
Returns the value of the control-parameter specified by key as a const reference to an object of type T. More... | |
template<typename T > | |
const T & | getParameterOrDefault (const LookupKey &key, const T &def_val, bool local=false) const |
Returns the value of the control-parameter specified by key as a const reference to an object of type T, or the default value def_val if a stored value does not exist. More... | |
bool | removeParameter (const LookupKey &key) |
Removes the entry for the control-parameter specified by key. More... | |
void | clearParameters () |
Erases all container entries. More... | |
bool | isParameterSet (const LookupKey &key, bool local=false) const |
Tells whether or not a value has been assigned to the control-parameter specified by key. More... | |
void | addParameters (const ControlParameterContainer &cntnr) |
Adds the control-parameter value entries in the ControlParameterContainer instance cntnr. More... | |
void | copyParameters (const ControlParameterContainer &cntnr) |
Replaces the current set of properties by a copy of the entries in cntnr. More... | |
ConstParameterIterator | getParametersBegin () const |
Returns a constant iterator pointing to the beginning of the entries. More... | |
ConstParameterIterator | getParametersEnd () const |
Returns a constant iterator pointing to the end of the entries. More... | |
ConstParameterIterator | begin () const |
Returns a constant iterator pointing to the beginning of the entries. More... | |
ConstParameterIterator | end () const |
Returns a constant iterator pointing to the end of the entries. More... | |
void | setParent (const ControlParameterContainer *cntnr) |
Sets or removes the parent control-parameter container used to resolve requests for missing entries. More... | |
const ControlParameterContainer * | getParent () const |
Returns a pointer to the parent control-parameter container. More... | |
std::size_t | registerParameterChangedCallback (const ParameterChangedCallbackFunction &func) |
Registers a callback target function that gets invoked when the value of a control-parameter has changed. More... | |
void | unregisterParameterChangedCallback (std::size_t id) |
Unregisters the callback specified by id. More... | |
std::size_t | registerParameterRemovedCallback (const ParameterRemovedCallbackFunction &func) |
Registers a callback target function that gets invoked when a control-parameter entry has been removed. More... | |
void | unregisterParameterRemovedCallback (std::size_t id) |
Unregisters the callback specified by id. More... | |
std::size_t | registerParentChangedCallback (const ParentChangedCallbackFunction &func) |
Registers a callback target function that gets invoked when the parent container has been changed or was detached. More... | |
void | unregisterParentChangedCallback (std::size_t id) |
Unregisters the callback specified by id. More... | |
const ControlParameterContainer & | getParameters () const |
Returns a const reference to itself. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from CDPL::Base::ControlParameterContainer | |
ControlParameterContainer () | |
Constructs an empty ControlParameterContainer instance. More... | |
ControlParameterContainer (const ControlParameterContainer &cntnr) | |
Constructs a copy of the ControlParameterContainer instance cntnr. More... | |
virtual | ~ControlParameterContainer () |
Destructor. More... | |
ControlParameterContainer & | operator= (const ControlParameterContainer &cntnr) |
Assignment operator. More... | |
Implements the 2D visualization of chemical reactions.
ReactionView2D
visualizes chemical reactions in the form of schematic reaction equations in which the reaction components are depicted as 2D structure diagrams (also known as skeletal formulas [WSKF] or structural formulas [WSTF]).
Graphical details of a reaction depiction are customizable on a ReactionView2D
instance level by control-parameters and on a visualized data object level by setting appropriate Chem::Reaction, Chem::MolecularGraph, Chem::Atom or Chem::Bond properties. Properties of the visualized data objects have a higher priority than control-parameters of the ReactionView2D
instance and properties of Chem::Atom or Chem::Bond objects override corresponding properties of the parent Chem::MolecularGraph instance.
ReactionView2D
supports the following control-parameters:
Control-Parameter | Description |
---|---|
Vis::ControlParameter::VIEWPORT | Specifies a rectangular viewport area which constrains the location and size of the generated reaction diagram |
Vis::ControlParameter::SIZE_ADJUSTMENT | Specifies how to adjust the size of the reaction diagram relative to the available viewport area |
Vis::ControlParameter::ALIGNMENT | Specifies the alignment of the reaction diagram within the viewport area |
Vis::ControlParameter::BACKGROUND_COLOR | Specifies the backround color of the reaction diagram |
Vis::ControlParameter::ATOM_COLOR | Specifies the color of atom labels |
Vis::ControlParameter::ATOM_COLOR_TABLE | Specifies a lookup table for the atom type dependent coloring of atom labels |
Vis::ControlParameter::USE_CALCULATED_ATOM_COORDINATES | Specifies whether or not to use calculated atom coordinates |
Vis::ControlParameter::ATOM_LABEL_FONT | Specifies the font for atom element and query match expression labels |
Vis::ControlParameter::ATOM_LABEL_SIZE | Specifies the size of atom element and query match expression labels |
Vis::ControlParameter::SECONDARY_ATOM_LABEL_FONT | Specifies the font for text labels that show the value of various atomic properties |
Vis::ControlParameter::SECONDARY_ATOM_LABEL_SIZE | Specifies the size of text labels that show the value of various atomic properties |
Vis::ControlParameter::ATOM_LABEL_MARGIN | Specifies the margin of free space around atom labels |
Vis::ControlParameter::RADICAL_ELECTRON_DOT_SIZE | Specifies the size of radical electron dots |
Vis::ControlParameter::SHOW_EXPLICIT_HYDROGENS | Specifies whether or not to show explicit hydrogen atoms |
Vis::ControlParameter::SHOW_CARBONS | Specifies whether or not to show the element label of carbon atoms |
Vis::ControlParameter::SHOW_CHARGES | Specifies whether or not to show the formal charge of atoms |
Vis::ControlParameter::SHOW_ISOTOPES | Specifies whether or not to show the isotopic mass of atoms |
Vis::ControlParameter::SHOW_HYDROGEN_COUNTS | Specifies whether or not to show the implicit hydrogen count of connected atoms |
Vis::ControlParameter::SHOW_NON_CARBON_HYDROGEN_COUNTS | Specifies whether or not to show the implicit hydrogen count of connected non-carbon atoms |
Vis::ControlParameter::SHOW_ATOM_QUERY_INFOS | Specifies whether or not to show query atom match expressions |
Vis::ControlParameter::SHOW_ATOM_REACTION_INFOS | Specifies whether or not to show reaction atom-atom mapping numbers |
Vis::ControlParameter::SHOW_RADICAL_ELECTRONS | Specifies whether or not to draw radical electron dots |
Vis::ControlParameter::BOND_LENGTH | Specifies the desired average bond length |
Vis::ControlParameter::BOND_COLOR | Specifies the color of bonds |
Vis::ControlParameter::BOND_LINE_WIDTH | Specifies the width of bond lines |
Vis::ControlParameter::BOND_LINE_SPACING | Specifies the distance between the lines of double and triple bonds |
Vis::ControlParameter::STEREO_BOND_WEDGE_WIDTH | Specifies the width of wedge-shaped stereo bonds |
Vis::ControlParameter::STEREO_BOND_HASH_SPACING | Specifies the distance between the hashes of down stereo bonds |
Vis::ControlParameter::REACTION_CENTER_LINE_LENGTH | Specifies the length of the lines in reaction center marks |
Vis::ControlParameter::REACTION_CENTER_LINE_SPACING | Specifies the distance between the lines in reaction center marks |
Vis::ControlParameter::DOUBLE_BOND_TRIM_LENGTH | Specifies 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_LENGTH | Specifies the amount by which the non-central lines of triple bonds have to be trimmed at each line end |
Vis::ControlParameter::BOND_LABEL_FONT | Specifies the font for bond labels |
Vis::ControlParameter::BOND_LABEL_SIZE | Specifies the size of bond labels |
Vis::ControlParameter::BOND_LABEL_MARGIN | Specifies the margin of free space around bond labels |
Vis::ControlParameter::SHOW_BOND_REACTION_INFOS | Specifies whether or not to draw reaction center marks |
Vis::ControlParameter::SHOW_BOND_QUERY_INFOS | Specifies whether or not to show query bond match expressions |
Vis::ControlParameter::SHOW_STEREO_BONDS | Specifies whether or not to draw stereo bonds |
Vis::ControlParameter::REACTION_ARROW_STYLE | Specifies the style of the reaction arrow |
Vis::ControlParameter::REACTION_ARROW_COLOR | Specifies the color of the reaction arrow |
Vis::ControlParameter::REACTION_ARROW_LENGTH | Specifies the length of the reaction arrow |
Vis::ControlParameter::REACTION_ARROW_HEAD_LENGTH | Specifies the head length of the reaction arrow |
Vis::ControlParameter::REACTION_ARROW_HEAD_WIDTH | Specifies the head width of the reaction arrow |
Vis::ControlParameter::REACTION_ARROW_SHAFT_WIDTH | Specifies the shaft width of the reaction arrow |
Vis::ControlParameter::REACTION_ARROW_LINE_WIDTH | Specifies the line width of the reaction arrow outline |
Vis::ControlParameter::REACTION_COMPONENT_LAYOUT | Specifies the style of the reaction product and reactant layout |
Vis::ControlParameter::REACTION_COMPONENT_LAYOUT_DIRECTION | Specifies the main direction of the reaction product and reactant layout |
Vis::ControlParameter::REACTION_COMPONENT_MARGIN | Specifies the amount of free space that is added horizontally and vertically to the bounds of a reaction component |
Vis::ControlParameter::SHOW_REACTION_REACTANTS | Specifies whether or not to show the reactants of the reaction |
Vis::ControlParameter::SHOW_REACTION_AGENTS | Specifies whether or not to show the agents of the reaction |
Vis::ControlParameter::SHOW_REACTION_PRODUCTS | Specifies whether or not to show the products of the reaction |
Vis::ControlParameter::REACTION_AGENT_ALIGNMENT | Specifies the vertical alignment of the reaction agents relative to the reaction arrow |
Vis::ControlParameter::REACTION_AGENT_LAYOUT | Specifies the style of the reaction agent layout |
Vis::ControlParameter::REACTION_AGENT_LAYOUT_DIRECTION | Specifies the main direction of the reaction agent layout |
Vis::ControlParameter::REACTION_PLUS_SIGN_COLOR | Specifies the color of the '+' signs between the components of the reaction |
Vis::ControlParameter::REACTION_PLUS_SIGN_SIZE | Specifies the size of the '+' signs between the components of the reaction |
Vis::ControlParameter::REACTION_PLUS_SIGN_LINE_WIDTH | Specifies the line width of the '+' signs between the components of the reaction |
Vis::ControlParameter::SHOW_REACTION_PLUS_SIGNS | Specifies whether or not to draw '+' signs between the components of the reaction |
Default values for most of the control-parameters are defined in namespace Vis::ControlParameterDefault.
Supported Chem::Reaction properties:
Chem::Reaction Property | Description |
---|---|
Vis::ReactionProperty::ARROW_STYLE | Specifies the style of the reaction arrow |
Vis::ReactionProperty::ARROW_COLOR | Specifies the color of the reaction arrow |
Vis::ReactionProperty::ARROW_LENGTH | Specifies the length of the reaction arrow |
Vis::ReactionProperty::ARROW_HEAD_LENGTH | Specifies the head length of the reaction arrow |
Vis::ReactionProperty::ARROW_HEAD_WIDTH | Specifies the head width of the reaction arrow |
Vis::ReactionProperty::ARROW_SHAFT_WIDTH | Specifies the shaft width of the reaction arrow |
Vis::ReactionProperty::ARROW_LINE_WIDTH | Specifies the line width of the reaction arrow outline |
Vis::ReactionProperty::COMPONENT_LAYOUT | Specifies the style of the reaction product and reactant layout |
Vis::ReactionProperty::COMPONENT_LAYOUT_DIRECTION | Specifies the main direction of the reaction product and reactant layout |
Vis::ReactionProperty::COMPONENT_MARGIN | Specifies the amount of free space that is added horizontally and vertically to the bounds of a reaction component |
Vis::ReactionProperty::SHOW_REACTANTS | Specifies whether or not to show reactants of the reactions |
Vis::ReactionProperty::SHOW_AGENTS | Specifies whether or not to show the agents of the reaction |
Vis::ReactionProperty::SHOW_PRODUCTS | Specifies whether or not to show the products of the reaction |
Vis::ReactionProperty::AGENT_ALIGNMENT | Specifies the vertical alignment of the reaction agents relative to the reaction arrow |
Vis::ReactionProperty::AGENT_LAYOUT | Specifies the style of the reaction agent layout |
Vis::ReactionProperty::AGENT_LAYOUT_DIRECTION | Specifies the main direction of the reaction agent layout |
Vis::ReactionProperty::PLUS_SIGN_COLOR | Specifies the color of the '+' signs between the components of the reaction |
Vis::ReactionProperty::PLUS_SIGN_SIZE | Specifies the size of the '+' signs between the components of the reaction |
Vis::ReactionProperty::PLUS_SIGN_LINE_WIDTH | Specifies the line width of the '+' signs between the components of the reaction |
Vis::ReactionProperty::SHOW_PLUS_SIGNS | Specifies whether or not to draw '+' signs between the components of the reaction |
Supported Chem::MolecularGraph properties:
Chem::MolecularGraph Property | Description |
---|---|
Vis::MolecularGraphProperty::ATOM_COLOR_TABLE | Specifies a lookup table for the atom type dependent coloring of atom labels |
Vis::MolecularGraphProperty::ATOM_COLOR | Specifies the color of atom labels |
Vis::MolecularGraphProperty::ATOM_LABEL_FONT | Specifies the font for atom element and query match expression labels |
Vis::MolecularGraphProperty::ATOM_LABEL_SIZE | Specifies the size of atom element and query match expression labels |
Vis::MolecularGraphProperty::SECONDARY_ATOM_LABEL_FONT | Specifies the font for text labels that show the value of various atomic properties |
Vis::MolecularGraphProperty::SECONDARY_ATOM_LABEL_SIZE | Specifies the size of text labels that show the value of various atomic properties |
Vis::MolecularGraphProperty::ATOM_LABEL_MARGIN | Specifies the margin of free space around atom labels |
Vis::MolecularGraphProperty::RADICAL_ELECTRON_DOT_SIZE | Specifies the size of radical electron dots |
Vis::MolecularGraphProperty::BOND_COLOR | Specifies the color of bonds |
Vis::MolecularGraphProperty::BOND_LINE_WIDTH | Specifies the width of bond lines |
Vis::MolecularGraphProperty::BOND_LINE_SPACING | Specifies the distance between the lines of double and triple bonds |
Vis::MolecularGraphProperty::STEREO_BOND_WEDGE_WIDTH | Specifies the width of wedge-shaped stereo bonds |
Vis::MolecularGraphProperty::STEREO_BOND_HASH_SPACING | Specifies the distance between the hashes of down stereo bonds |
Vis::MolecularGraphProperty::REACTION_CENTER_LINE_LENGTH | Specifies the length of the lines in reaction center marks |
Vis::MolecularGraphProperty::REACTION_CENTER_LINE_SPACING | Specifies the distance between the lines in reaction center marks |
Vis::MolecularGraphProperty::DOUBLE_BOND_TRIM_LENGTH | Specifies 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_LENGTH | Specifies the amount by which the non-central lines of triple bonds have to be trimmed at each line end |
Vis::MolecularGraphProperty::BOND_LABEL_FONT | Specifies the font for bond labels |
Vis::MolecularGraphProperty::BOND_LABEL_SIZE | Specifies the size of bond labels |
Vis::MolecularGraphProperty::BOND_LABEL_MARGIN | Specifies the margin of free space around bond labels |
Supported Chem::Atom properties:
Chem::Atom Property | Description |
---|---|
Vis::AtomProperty::COLOR | Specifies the color of text labels |
Vis::AtomProperty::LABEL_FONT | Specifies the font for atom element and query match expression labels |
Vis::AtomProperty::LABEL_SIZE | Specifies the size of atom element and query match expression labels |
Vis::AtomProperty::SECONDARY_LABEL_FONT | Specifies the font for text labels that show the value of various atomic properties |
Vis::AtomProperty::SECONDARY_LABEL_SIZE | Specifies the size of text labels that show the value of various atomic properties |
Vis::AtomProperty::LABEL_MARGIN | Specifies the margin of free space around text labels |
Vis::AtomProperty::RADICAL_ELECTRON_DOT_SIZE | Specifies the size of radical electron dots |
Supported Chem::Bond properties:
Chem::Bond Property | Description |
---|---|
Vis::BondProperty::COLOR | Specifies the color of the bond |
Vis::BondProperty::LINE_WIDTH | Specifies the width of bond lines |
Vis::BondProperty::LINE_SPACING | Specifies the distance between the lines of double and triple bonds |
Vis::BondProperty::STEREO_BOND_WEDGE_WIDTH | Specifies the width of wedge-shaped stereo bonds |
Vis::BondProperty::STEREO_BOND_HASH_SPACING | Specifies the distance between the hashes of down stereo bonds |
Vis::BondProperty::REACTION_CENTER_LINE_LENGTH | Specifies the length of the lines in reaction center marks |
Vis::BondProperty::REACTION_CENTER_LINE_SPACING | Specifies the distance between the lines in reaction center marks |
Vis::BondProperty::DOUBLE_BOND_TRIM_LENGTH | Specifies 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_LENGTH | Specifies the amount by which the non-central lines of triple bonds have to be trimmed at each line end |
Vis::BondProperty::LABEL_FONT | Specifies the font for bond labels |
Vis::BondProperty::LABEL_SIZE | Specifies the size of bond labels |
Vis::BondProperty::LABEL_MARGIN | Specifies the margin of free space around bond labels |
typedef std::shared_ptr<ReactionView2D> CDPL::Vis::ReactionView2D::SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated ReactionView2D
instances.
CDPL::Vis::ReactionView2D::ReactionView2D | ( | const Chem::Reaction * | rxn = 0 | ) |
Constructs and initializes a ReactionView2D
instance for the visualization of the chemical reaction specified by rxn.
rxn | A pointer to the Chem::Reaction object to visualize. |
CDPL::Vis::ReactionView2D::~ReactionView2D | ( | ) |
Destructor.
|
virtual |
Renders the visual representation of the model using the specified Vis::Renderer2D instance.
renderer | The Renderer2D instance. |
Implements CDPL::Vis::View2D.
|
virtual |
Specifies a font metrics object that will be used to measure the dimension of text labels.
font_metrics | A pointer to the font metrics object or null. |
Implements CDPL::Vis::View2D.
FontMetrics* CDPL::Vis::ReactionView2D::getFontMetrics | ( | ) | const |
Returns a pointer to the used font metrics object.
void CDPL::Vis::ReactionView2D::setReaction | ( | const Chem::Reaction * | rxn | ) |
Specifies the chemical reaction to visualize.
If the components of a chemical reaction or any properties have changed after this method has been called for a Chem::Reaction object, the method needs to be called again for the object to make the changes visible.
rxn | A pointer to the Chem::Reaction object to visualize, or null. |
const Chem::Reaction* CDPL::Vis::ReactionView2D::getReaction | ( | ) | const |
Returns a pointer to the visualized chemical reaction.
|
virtual |
Calculates the bounding rectangle of the visualized model.
bounds | A Rectangle2D object storing the calculated bounding rectangle. |
Implements CDPL::Vis::View2D.