32 #ifndef Molecule_INCLUDE_ONCE 33 #define Molecule_INCLUDE_ONCE 79 unsigned int id()
const {
return mId; }
80 void setId(
unsigned int id) { mId = id; }
85 const std::vector< ref<Atom> >&
atoms()
const {
return mAtoms; }
86 std::vector< ref<Atom> >&
atoms() {
return mAtoms; }
88 int atomCount()
const {
return (
int)mAtoms.size(); }
89 const Atom* atom(
int index)
const;
90 Atom* atom(
int index);
91 void addAtom(
Atom* atom);
92 void eraseAtom(
Atom*atom);
93 void eraseAtom(
int index);
96 const std::vector< ref<Bond> >&
bonds()
const {
return mBonds; }
97 std::vector< ref<Bond> >&
bonds() {
return mBonds; }
99 int bondCount()
const {
return (
int)mBonds.size(); }
100 const Bond* bond(
int index)
const;
101 Bond* bond(
int index);
104 void addBond(
Bond* bond);
106 void eraseBond(
Bond*bond);
107 void eraseBond(
int bond);
109 void eraseBond(
int a1,
int a2);
110 void eraseAllBonds();
112 void computeAtomAdjacency();
113 void incidentBonds(std::vector<Bond*>& inc_bonds,
Atom* atom);
116 const std::vector< ref<Atom> >&
cycle(
int i)
const {
return mCycles[i]; }
118 std::vector< ref<Atom> >&
cycle(
int i) {
return mCycles[i]; }
121 const std::vector< std::vector< ref<Atom> > >&
cycles()
const {
return mCycles; }
123 std::vector< std::vector< ref<Atom> > >&
cycles() {
return mCycles; }
128 void prepareForRendering();
136 void setCPKAtomColors();
138 void setAtomColors(
const fvec4& color);
141 void setCalculatedAtomRadii(
float percentage=1.0f);
143 void setEmpiricalAtomRadii(
float percentage=1.0f);
145 void setCovalentAtomRadii(
float percentage=1.0f);
147 void setVanDerWaalsAtomRadii(
float percentage=1.0f);
149 void setAtomRadii(
float radius);
151 void setBondRadii(
float radius);
153 void setAtomTypeVisible(
EAtomType type,
bool visible);
173 void setAromaticBondsColor(
const fvec4& color);
234 if (atoms().size() == atoms().capacity())
235 atoms().reserve(atoms().size() + bonus);
239 if (bonds().size() == bonds().capacity())
240 bonds().reserve(bonds().size() + bonus);
242 void wireframeStyle();
244 void ballAndStickStyle();
246 void generateRings();
247 void generateAtomLabels();
256 std::vector< std::vector< ref<Atom> > >
mCycles;
The Molecule class is used to manage and render 3D molecular structures.
const Transform * transformTree() const
The transform tree used by the generated bonds, atoms and labels.
std::vector< ref< Bond > > & bonds()
std::map< ref< Bond >, ref< Actor > > mBondToActorMap
An abstract class representing a file.
Transform * transformTree()
The transform tree used by the generated bonds, atoms and labels.
void setAtomDetail(int detail)
Geometrical detail used to render the atoms, usually between 0 and 3 (default is 2) ...
EMoleculeStyle moleculeStyle() const
The rendering style of the molecule.
A Renderable that renders text with a given Font.
The String class implements an advanced UTF16 (Unicode BMP) string manipulation engine.
const std::vector< ref< Atom > > & cycle(int i) const
Returns the i-th cycle.
void setShowAtomNames(bool show)
Globally defines whether the atom names should be rendered or not. See also Atom::setShowAtomName().
#define VLMOLECULE_EXPORT
EMoleculeStyle mMoleculeStyle
void setSmoothLines(bool smooth)
void setBondDetail(int detail)
Geometrical detail used to render the bonds, usually between 5 and 50 (default is 20) ...
std::map< ref< Actor >, ref< Bond > > & actorToBondMap()
Maps an Actor to it's corresponding Bond.
int atomDetail() const
Geometrical detail used to render the atoms, usually between 0 and 3 (default is 2) ...
ref< Text > mAtomLabelTemplate
const std::vector< ref< Bond > > & bonds() const
bool mMoleculeToActorMapEnabled
ref< ActorTree > mActorTree
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.
const std::map< ref< Bond >, ref< Actor > > & bondToActorMap() const
Maps a Bond to it's corresponding Actor.
const std::vector< ref< Atom > > & atoms() const
void setMoleculeToActorMapEnabled(bool enabled)
If enabled the atomToActorMap() and bondToActorMap() maps will be compiled next time the molecule's g...
std::vector< ref< Atom > > & atoms()
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
const std::map< ref< Actor >, ref< Bond > > & actorToBondMap() const
Maps an Actor to it's corresponding Bond.
void setMoleculeName(const String &name)
std::vector< ref< Bond > > mBonds
Visualization Library main namespace.
void setRingOffset(float offset)
std::map< ref< Atom >, ref< Actor > > & atomToActorMap()
Maps an Atom to it's corresponding Actor.
EMoleculeStyle
Defines the main molecule styles.
void setLineWidth(float w)
ref< Transform > mTransformTree
void prepareBondInsert(int bonus=100)
void setActorToMoleculeMapEnabled(bool enabled)
If enabled the actorToAtomMap() and actorToBondMap() maps will be compiled next time the molecule's g...
ActorTree * actorTree()
The ActorTree node containing the Actor[s] representing the molecule.
std::map< ref< Actor >, ref< Atom > > mActorToAtomMap
The base class for all the reference counted objects.
void setId(unsigned int id)
const std::map< ref< Actor >, ref< Atom > > & actorToAtomMap() const
Maps an Actor to it's corresponding Atom.
bool showAtomNames() const
Globally defines whether the atom names should be rendered or not. See also Atom::setShowAtomName().
const KeyValues * tags() const
const ActorTree * actorTree() const
The ActorTree node containing the Actor[s] representing the molecule.
std::vector< ref< Atom > > mAtoms
Defines the sequence of Shader objects used to render an Actor.
Molecule(const Molecule &other)
void setMoleculeStyle(EMoleculeStyle style)
The rendering style of the molecule.
std::map< ref< Actor >, ref< Bond > > mActorToBondMap
const Effect * atomLabelEffect() const
The Effect used to render the atom labels.
void prepareAtomInsert(int bonus=100)
const String moleculeName() const
ref< Effect > mAtomLabelEffect
const Text * atomLabelTemplate() const
The text settings to be used to render the atom labels.
The Bond class represents a bond to be used with the Molecule class.
std::vector< std::vector< ref< Atom > > > & cycles()
Returns the list of cycles.
std::map< ref< Atom >, ref< Actor > > mAtomToActorMap
Effect * atomLabelEffect()
The Effect used to render the atom labels.
void setAromaticRingColor(const fvec4 &color)
std::map< ref< Actor >, ref< Atom > > & actorToAtomMap()
Maps an Actor to it's corresponding Atom.
The Atom class represents an atom to be used with the Molecule class.
Text * atomLabelTemplate()
The text settings to be used to render the atom labels.
bool mActorToMoleculeMapEnabled
VLMOLECULE_EXPORT bool loadMOL2(const String &path, std::vector< ref< Molecule > > &structures)
Loads a Tripos MOL2 file.
The ActorTree class implements a generic tree whose nodes contain Actors.
const fvec4 & aromaticRingColor() const
std::map< ref< Bond >, ref< Actor > > & bondToActorMap()
Maps a Bond to it's corresponding Actor.
bool isActorToMoleculeMapEnabled() const
If enabled the actorToAtomMap() and actorToBondMap() maps will be compiled next time the molecule's g...
bool isMoleculeToActorMapEnabled() const
If enabled the atomToActorMap() and bondToActorMap() maps will be compiled next time the molecule's g...
const std::map< ref< Atom >, ref< Actor > > & atomToActorMap() const
Maps an Atom to it's corresponding Actor.
A set of key/value pairs usually used to associate generic information, tags, attributes etc...
std::vector< std::vector< ref< Atom > > > mCycles
int bondDetail() const
Geometrical detail used to render the bonds, usually between 5 and 50 (default is 20) ...