Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Member Functions | Protected Attributes

vl::Molecule Class Reference

The Molecule class is used to manage and render 3D molecular structures. More...

#include <Molecule.hpp>

Inheritance diagram for vl::Molecule:
vl::Object

List of all members.

Public Member Functions

virtual const char * className ()
 Returns the name of the class.
 Molecule ()
 ~Molecule ()
 Molecule (const Molecule &other)
Moleculeoperator= (const Molecule &other)
void reset ()
void setMoleculeName (const String &name)
const String moleculeName () const
unsigned int id () const
void setId (unsigned int id)
KeyValuestags ()
const KeyValuestags () const
const std::vector< ref< Atom > > & atoms () const
std::vector< ref< Atom > > & atoms ()
int atomCount () const
Atomatom (int index) const
void addAtom (Atom *atom)
void eraseAtom (Atom *atom)
void eraseAtom (int index)
void eraseAllAtoms ()
const std::vector< ref< Bond > > & bonds () const
std::vector< ref< Bond > > & bonds ()
int bondCount () const
Bondbond (int index) const
Bondbond (Atom *a1, Atom *a2)
void addBond (Bond *bond)
BondaddBond (Atom *a1, Atom *a2)
void eraseBond (Bond *bond)
void eraseBond (int bond)
void eraseBond (Atom *a1, Atom *a2)
void eraseBond (int a1, int a2)
void eraseAllBonds ()
void computeAtomAdjacency ()
void incidentBonds (std::vector< Bond * > &inc_bonds, Atom *atom)
const std::vector< ref< Atom > > & cycle (int i) const
 Returns the i-th cycle.
std::vector< ref< Atom > > & cycle (int i)
 Returns the i-th cycle.
const std::vector< std::vector
< ref< Atom > > > & 
cycles () const
 Returns the list of cycles.
std::vector< std::vector< ref
< Atom > > > & 
cycles ()
 Returns the list of cycles.
void prepareForRendering ()
 Generates the geometry representing the current molecule, atom and bond settings.
const ActorTreeactorTree () const
 The ActorTree node containing the Actor[s] representing the molecule.
ActorTreeactorTree ()
 The ActorTree node containing the Actor[s] representing the molecule.
void setCPKAtomColors ()
 Sets all the atoms' color to their CPK color.
void setAtomColors (const fvec4 &color)
 Sets all the atoms' color to the specified color.
void setCalculatedAtomRadii (float percentage=1.0f)
 Sets all the atoms' radii to their calculated atom radii.
void setEmpiricalAtomRadii (float percentage=1.0f)
 Sets all the atoms' radii to their empirical atom radii.
void setCovalentAtomRadii (float percentage=1.0f)
 Sets all the atoms' radii to their covalent atom radii.
void setVanDerWaalsAtomRadii (float percentage=1.0f)
 Sets all the atoms' radii to their van der Waals atom radii.
void setAtomRadii (float radius)
 Sets all the atoms' radii to the specified one.
void setBondRadii (float radius)
 Sets all the bonds' radii to the specified one.
void setAtomTypeVisible (EAtomType type, bool visible)
void setMoleculeStyle (EMoleculeStyle style)
 The rendering style of the molecule.
EMoleculeStyle moleculeStyle () const
 The rendering style of the molecule.
void setAtomDetail (int detail)
 Geometrical detail used to render the atoms, usually between 0 and 3 (default is 2)
int atomDetail () const
 Geometrical detail used to render the atoms, usually between 0 and 3 (default is 2)
void setBondDetail (int detail)
 Geometrical detail used to render the bonds, usually between 5 and 50 (default is 20)
int bondDetail () const
 Geometrical detail used to render the bonds, usually between 5 and 50 (default is 20)
float ringOffset () const
void setRingOffset (float offset)
void setAromaticBondsColor (const fvec4 &color)
void setAromaticRingColor (const fvec4 &color)
const fvec4aromaticRingColor () const
float lineWidth () const
bool smoothLines () const
void setLineWidth (float w)
void setSmoothLines (bool smooth)
TransformtransformTree ()
 The transform tree used by the generated bonds, atoms and labels.
const TransformtransformTree () const
 The transform tree used by the generated bonds, atoms and labels.
TextatomLabelTemplate ()
 The text settings to be used to render the atom labels.
const TextatomLabelTemplate () const
 The text settings to be used to render the atom labels.
void setShowAtomNames (bool show)
 Globally defines whether the atom names should be rendered or not. See also Atom::setShowAtomName().
bool showAtomNames () const
 Globally defines whether the atom names should be rendered or not. See also Atom::setShowAtomName().
const EffectatomLabelEffect () const
 The Effect used to render the atom labels.
EffectatomLabelEffect ()
 The Effect used to render the atom labels.

Protected Member Functions

void prepareAtomInsert (int bonus=100)
void prepareBondInsert (int bonus=100)
void wireframeStyle ()
void atomsStyle ()
void ballAndStickStyle ()
void sticksStyle ()
void generateRings ()
void generateAtomLabels ()
void generateAtomLabel (const Atom *atom, Transform *tr)

Protected Attributes

fvec4 mAromaticRingColor
ref< ActorTreemActorTree
ref< TransformmTransformTree
std::vector< ref< Atom > > mAtoms
std::vector< ref< Bond > > mBonds
std::vector< std::vector< ref
< Atom > > > 
mCycles
String mMoleculeName
ref< KeyValuesmTags
ref< TextmAtomLabelTemplate
ref< EffectmAtomLabelEffect
unsigned int mId
EMoleculeStyle mMoleculeStyle
int mAtomDetail
int mBondDetail
float mRingOffset
float mLineWidth
bool mSmoothLines
bool mShowAtomNames

Detailed Description

The Molecule class is used to manage and render 3D molecular structures.

See also:
pagGuideMolecule.png

Definition at line 64 of file Molecule.hpp.


Constructor & Destructor Documentation

Molecule::Molecule (  )

Definition at line 38 of file Molecule.cpp.

References vl::EN_BLEND, mAtomLabelEffect, reset(), and VL_DEBUG_SET_OBJECT_NAME.

vl::Molecule::~Molecule (  ) [inline]

Definition at line 70 of file Molecule.hpp.

vl::Molecule::Molecule ( const Molecule other ) [inline]

Definition at line 71 of file Molecule.hpp.


Member Function Documentation

virtual const char* vl::Molecule::className (  ) [inline, virtual]

Returns the name of the class.

Reimplemented from vl::Object.

Definition at line 67 of file Molecule.hpp.

Molecule & Molecule::operator= ( const Molecule other )
void Molecule::reset (  )
void vl::Molecule::setMoleculeName ( const String name ) [inline]

Definition at line 76 of file Molecule.hpp.

const String vl::Molecule::moleculeName (  ) const [inline]

Definition at line 77 of file Molecule.hpp.

unsigned int vl::Molecule::id (  ) const [inline]

Definition at line 79 of file Molecule.hpp.

void vl::Molecule::setId ( unsigned int  id ) [inline]

Definition at line 80 of file Molecule.hpp.

KeyValues* vl::Molecule::tags (  ) [inline]

Definition at line 82 of file Molecule.hpp.

Referenced by reset().

const KeyValues* vl::Molecule::tags (  ) const [inline]

Definition at line 83 of file Molecule.hpp.

const std::vector< ref<Atom> >& vl::Molecule::atoms (  ) const [inline]
std::vector< ref<Atom> >& vl::Molecule::atoms (  ) [inline]

Definition at line 86 of file Molecule.hpp.

int vl::Molecule::atomCount (  ) const [inline]

Definition at line 88 of file Molecule.hpp.

Referenced by vl::RingExtractor::bootstrap(), and computeAtomAdjacency().

Atom * Molecule::atom ( int  index ) const
void Molecule::addAtom ( Atom atom )

Definition at line 109 of file Molecule.cpp.

References atoms(), and prepareAtomInsert().

void Molecule::eraseAtom ( Atom atom )

Definition at line 131 of file Molecule.cpp.

References atom(), atoms(), eraseBond(), and incidentBonds().

void Molecule::eraseAtom ( int  index )

Definition at line 122 of file Molecule.cpp.

References atom(), atoms(), eraseBond(), and incidentBonds().

void Molecule::eraseAllAtoms (  )

Definition at line 115 of file Molecule.cpp.

References mAtoms, mBonds, and mCycles.

const std::vector< ref<Bond> >& vl::Molecule::bonds (  ) const [inline]
std::vector< ref<Bond> >& vl::Molecule::bonds (  ) [inline]

Definition at line 96 of file Molecule.hpp.

int vl::Molecule::bondCount (  ) const [inline]

Definition at line 98 of file Molecule.hpp.

Referenced by computeAtomAdjacency(), and incidentBonds().

Bond * Molecule::bond ( int  index ) const
Bond * Molecule::bond ( Atom a1,
Atom a2 
)

Definition at line 159 of file Molecule.cpp.

References vl::Bond::atom1(), vl::Bond::atom2(), bond(), and bonds().

void Molecule::addBond ( Bond bond )

Definition at line 167 of file Molecule.cpp.

References bonds(), and prepareBondInsert().

Bond * Molecule::addBond ( Atom a1,
Atom a2 
)

Definition at line 147 of file Molecule.cpp.

References bond(), bonds(), vl::ref< T >::get(), and prepareBondInsert().

void Molecule::eraseBond ( Bond bond )

Definition at line 173 of file Molecule.cpp.

References bond(), and bonds().

Referenced by eraseAtom(), and eraseBond().

void Molecule::eraseBond ( int  bond )

Definition at line 185 of file Molecule.cpp.

References bonds().

void Molecule::eraseBond ( Atom a1,
Atom a2 
)

Definition at line 189 of file Molecule.cpp.

References vl::Bond::atom1(), vl::Bond::atom2(), bond(), and bonds().

void Molecule::eraseBond ( int  a1,
int  a2 
)

Definition at line 202 of file Molecule.cpp.

References atom(), and eraseBond().

void Molecule::eraseAllBonds (  )

Definition at line 187 of file Molecule.cpp.

References bonds().

void Molecule::computeAtomAdjacency (  )
void Molecule::incidentBonds ( std::vector< Bond * > &  inc_bonds,
Atom atom 
)

Definition at line 215 of file Molecule.cpp.

References atom(), vl::Bond::atom1(), vl::Bond::atom2(), bond(), and bondCount().

Referenced by eraseAtom().

const std::vector< ref<Atom> >& vl::Molecule::cycle ( int  i ) const [inline]
std::vector< ref<Atom> >& vl::Molecule::cycle ( int  i ) [inline]

Returns the i-th cycle.

Definition at line 115 of file Molecule.hpp.

const std::vector< std::vector< ref<Atom> > >& vl::Molecule::cycles (  ) const [inline]
std::vector< std::vector< ref<Atom> > >& vl::Molecule::cycles (  ) [inline]

Returns the list of cycles.

Definition at line 120 of file Molecule.hpp.

void Molecule::prepareForRendering (  )

Generates the geometry representing the current molecule, atom and bond settings.

The actors, geometry, and transforms generated by this function can be found in actorTree() and transformTree().

Definition at line 185 of file Molecule_rendering.cpp.

References vl::MS_AtomsOnly, vl::MS_BallAndStick, vl::MS_Sticks, and vl::MS_Wireframe.

const ActorTree* vl::Molecule::actorTree (  ) const [inline]

The ActorTree node containing the Actor[s] representing the molecule.

Definition at line 128 of file Molecule.hpp.

ActorTree* vl::Molecule::actorTree (  ) [inline]

The ActorTree node containing the Actor[s] representing the molecule.

Definition at line 130 of file Molecule.hpp.

void Molecule::setCPKAtomColors (  )

Sets all the atoms' color to their CPK color.

Definition at line 223 of file Molecule.cpp.

References vl::atomInfo(), atoms(), and vl::atomType().

void Molecule::setAtomColors ( const fvec4 color )

Sets all the atoms' color to the specified color.

Definition at line 229 of file Molecule.cpp.

References atoms().

void Molecule::setCalculatedAtomRadii ( float  percentage = 1.0f )

Sets all the atoms' radii to their calculated atom radii.

Definition at line 235 of file Molecule.cpp.

References vl::atomInfo(), atoms(), and vl::atomType().

void Molecule::setEmpiricalAtomRadii ( float  percentage = 1.0f )

Sets all the atoms' radii to their empirical atom radii.

Definition at line 241 of file Molecule.cpp.

References vl::atomInfo(), atoms(), and vl::atomType().

void Molecule::setCovalentAtomRadii ( float  percentage = 1.0f )

Sets all the atoms' radii to their covalent atom radii.

Definition at line 247 of file Molecule.cpp.

References vl::atomInfo(), atoms(), and vl::atomType().

void Molecule::setVanDerWaalsAtomRadii ( float  percentage = 1.0f )

Sets all the atoms' radii to their van der Waals atom radii.

Definition at line 253 of file Molecule.cpp.

References vl::atomInfo(), atoms(), and vl::atomType().

void Molecule::setAtomRadii ( float  radius )

Sets all the atoms' radii to the specified one.

Definition at line 259 of file Molecule.cpp.

References atoms().

void Molecule::setBondRadii ( float  radius )

Sets all the bonds' radii to the specified one.

Definition at line 265 of file Molecule.cpp.

References bonds().

void Molecule::setAtomTypeVisible ( EAtomType  type,
bool  visible 
)

Definition at line 271 of file Molecule.cpp.

References atom(), atoms(), vl::Atom::atomType(), and vl::Atom::setVisible().

void vl::Molecule::setMoleculeStyle ( EMoleculeStyle  style ) [inline]

The rendering style of the molecule.

Definition at line 153 of file Molecule.hpp.

EMoleculeStyle vl::Molecule::moleculeStyle (  ) const [inline]

The rendering style of the molecule.

Definition at line 155 of file Molecule.hpp.

void vl::Molecule::setAtomDetail ( int  detail ) [inline]

Geometrical detail used to render the atoms, usually between 0 and 3 (default is 2)

Definition at line 158 of file Molecule.hpp.

int vl::Molecule::atomDetail (  ) const [inline]

Geometrical detail used to render the atoms, usually between 0 and 3 (default is 2)

Definition at line 160 of file Molecule.hpp.

void vl::Molecule::setBondDetail ( int  detail ) [inline]

Geometrical detail used to render the bonds, usually between 5 and 50 (default is 20)

Definition at line 163 of file Molecule.hpp.

int vl::Molecule::bondDetail (  ) const [inline]

Geometrical detail used to render the bonds, usually between 5 and 50 (default is 20)

Definition at line 165 of file Molecule.hpp.

float vl::Molecule::ringOffset (  ) const [inline]

Definition at line 167 of file Molecule.hpp.

void vl::Molecule::setRingOffset ( float  offset ) [inline]

Definition at line 168 of file Molecule.hpp.

void Molecule::setAromaticBondsColor ( const fvec4 color )

Definition at line 278 of file Molecule.cpp.

References bonds(), and vl::BT_Aromatic.

void vl::Molecule::setAromaticRingColor ( const fvec4 color ) [inline]

Definition at line 171 of file Molecule.hpp.

const fvec4& vl::Molecule::aromaticRingColor (  ) const [inline]

Definition at line 172 of file Molecule.hpp.

float vl::Molecule::lineWidth (  ) const [inline]

Definition at line 174 of file Molecule.hpp.

bool vl::Molecule::smoothLines (  ) const [inline]

Definition at line 175 of file Molecule.hpp.

void vl::Molecule::setLineWidth ( float  w ) [inline]

Definition at line 177 of file Molecule.hpp.

void vl::Molecule::setSmoothLines ( bool  smooth ) [inline]

Definition at line 178 of file Molecule.hpp.

Transform* vl::Molecule::transformTree (  ) [inline]

The transform tree used by the generated bonds, atoms and labels.

Definition at line 181 of file Molecule.hpp.

const Transform* vl::Molecule::transformTree (  ) const [inline]

The transform tree used by the generated bonds, atoms and labels.

Definition at line 183 of file Molecule.hpp.

Text* vl::Molecule::atomLabelTemplate (  ) [inline]

The text settings to be used to render the atom labels.

Definition at line 186 of file Molecule.hpp.

const Text* vl::Molecule::atomLabelTemplate (  ) const [inline]

The text settings to be used to render the atom labels.

Definition at line 188 of file Molecule.hpp.

void vl::Molecule::setShowAtomNames ( bool  show ) [inline]

Globally defines whether the atom names should be rendered or not. See also Atom::setShowAtomName().

Definition at line 191 of file Molecule.hpp.

bool vl::Molecule::showAtomNames (  ) const [inline]

Globally defines whether the atom names should be rendered or not. See also Atom::setShowAtomName().

Definition at line 193 of file Molecule.hpp.

const Effect* vl::Molecule::atomLabelEffect (  ) const [inline]

The Effect used to render the atom labels.

Definition at line 196 of file Molecule.hpp.

Effect* vl::Molecule::atomLabelEffect (  ) [inline]

The Effect used to render the atom labels.

Definition at line 198 of file Molecule.hpp.

void vl::Molecule::prepareAtomInsert ( int  bonus = 100 ) [inline, protected]

Definition at line 201 of file Molecule.hpp.

Referenced by addAtom().

void vl::Molecule::prepareBondInsert ( int  bonus = 100 ) [inline, protected]

Definition at line 206 of file Molecule.hpp.

Referenced by addBond().

void Molecule::wireframeStyle (  ) [protected]
void Molecule::atomsStyle (  ) [protected]
void Molecule::ballAndStickStyle (  ) [protected]
void Molecule::sticksStyle (  ) [protected]
void Molecule::generateRings (  ) [protected]
void Molecule::generateAtomLabels (  ) [protected]
void Molecule::generateAtomLabel ( const Atom atom,
Transform tr 
) [protected]

Member Data Documentation

Definition at line 220 of file Molecule.hpp.

Referenced by operator=(), and reset().

Definition at line 221 of file Molecule.hpp.

Referenced by reset().

Definition at line 222 of file Molecule.hpp.

std::vector< ref<Atom> > vl::Molecule::mAtoms [protected]

Definition at line 223 of file Molecule.hpp.

Referenced by atom(), eraseAllAtoms(), and reset().

std::vector< ref<Bond> > vl::Molecule::mBonds [protected]

Definition at line 224 of file Molecule.hpp.

Referenced by bond(), eraseAllAtoms(), and reset().

std::vector< std::vector< ref<Atom> > > vl::Molecule::mCycles [protected]

Definition at line 225 of file Molecule.hpp.

Referenced by eraseAllAtoms(), operator=(), and reset().

Definition at line 226 of file Molecule.hpp.

Referenced by operator=(), and reset().

Definition at line 227 of file Molecule.hpp.

Referenced by operator=().

Definition at line 228 of file Molecule.hpp.

Definition at line 229 of file Molecule.hpp.

Referenced by Molecule().

unsigned int vl::Molecule::mId [protected]

Definition at line 230 of file Molecule.hpp.

Referenced by reset().

Definition at line 231 of file Molecule.hpp.

Referenced by operator=(), and reset().

int vl::Molecule::mAtomDetail [protected]

Definition at line 232 of file Molecule.hpp.

Referenced by operator=(), and reset().

int vl::Molecule::mBondDetail [protected]

Definition at line 233 of file Molecule.hpp.

Referenced by operator=(), and reset().

float vl::Molecule::mRingOffset [protected]

Definition at line 234 of file Molecule.hpp.

Referenced by operator=(), and reset().

float vl::Molecule::mLineWidth [protected]

Definition at line 235 of file Molecule.hpp.

Referenced by operator=(), and reset().

bool vl::Molecule::mSmoothLines [protected]

Definition at line 236 of file Molecule.hpp.

Referenced by operator=(), and reset().

bool vl::Molecule::mShowAtomNames [protected]

Definition at line 237 of file Molecule.hpp.

Referenced by reset().


The documentation for this class was generated from the following files:

Visualization Library v2011.05.1142 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 26 2011 22:51:47.
Permission is granted to use this page to write and publish articles regarding Visualization Library.