Next: Molecule
Up: Molecule objects
Previous: BaseMolecule
  Contents
Subsections
DrawMolecule
Files: |
DrawMolecule.h,
DrawMolecule.C |
Derived from: |
\bf BaseMolecule, \bf Displayable |
Global instance (if any): |
none |
Used in optional component: |
Part of main VMD code |
DrawMolecule is derived from BaseMolecule, and is the next
level in the Molecule class hierarchy. It embodies the level of
control and functionality responsible for creating a graphical image of
the molecule. It is derived from Displayable (actually, from
Displayable3D), and so will be part of the Scene that will
be drawn by a DisplayDevice.
Each DrawMolecule keeps a list of DrawMolItem objects; each
DrawMolItem is also a Displayable, and is responsible for a
single representation of the molecule. Each representation contains
a display list used to draw a single view of the molecule. To define a
single representation, each DrawMolItem contains one instance each
of the following objects:
- AtomColor - defines how to color each atom in the representation.
- AtomRep - defines what shape to draw the components of the
representation.
- AtomSel - determines which atoms out of all the ones in the
molecule are to be drawn in that representation.
When a new DrawMolecule is created (i.e. when a new Molecule
is created), it is added as a child Displayable to a global
MoleculeList object. Thus, you can rotate just the MoleculeList,
and this will rotate all the molecules at the same time. When a molecule
is first displayed, it is scaled and translated to fit within a -1 ... 1
size box centered around the origin. In order to have all the molecules be
the proper size in relation to each other, and to preserve the spatial
position of the molecules, only one molecule is used to determine the
scaling and translation positions, and the others then use those same
scaling and translation values.
Each DrawMolItem added to this object are added as child
Displayable objects of DrawMolecule, and so scaling and rotating
the molecule will do so to all the DrawMolItem objects at the same
time.
- int active - is this molecule an active one? This is used
by MoleculeList.
- int needRedraw - a flag indicating whether this item needs
to reconstruct its display list during the prepare routine. After the
display list is remade, this flag is cleared.
- ResizeArray<DrawMolItem *> repList - the list of
representations.
- int atom_displayed(int) - returns TRUE if any of the
representations are currently displaying the given atom.
- int components(void) - returns the number of representations
in the molecule.
- DrawMolItem *component(int) - return a pointer to the Nth
representation.
- int del_rep(int) - delete the Nth representation, and return
the success.
- virtual void set_name(char *) - used to change or set the
name of the molecule. Called during the create phase of molecule
construction.
- virtual void create_cmdlist(void) - regenerates the
display list, which contains the list of primitive drawing commands
necessary to draw the object.
- virtual int create(void) - the version of create for
DrawMolecule ... this is called by derived classes after they have
read in and initialized the molecule. The DrawMolecule version of
create will then call the BaseMolecule's create routine, and finally
then construct the initial version of the display list.
- virtual void prepare(DisplayDevice *) - provided since this
is a Displayable object. This determines if the display list needs
to be reconstructed, and if so it does the reconstruction.
- virtual int add_rep(AtomColor *, AtomRep *, AtomSel *) -
requests for a new representation to be made, using the given objects to
describe what the representation should be. Returns success.
- virtual int change_rep(int, AtomColor *, AtomRep *, AtomSel *)
- changes the Nth representation to use the new settings specified in the
given objects.
The user should never create a DrawMolecule directly; it should instead
be used as a base class for Molecule.
Next: Molecule
Up: Molecule objects
Previous: BaseMolecule
  Contents
vmd@ks.uiuc.edu