#include <glsimplemoleculeview.h>
Inheritance diagram for GLSimpleMoleculeView:
It does not allow chaning of the molecule and is used in the program CrdView. Brabosphere uses the derived class GLMoleculeView with more features.
Definition at line 40 of file glsimplemoleculeview.h.
Public Types | |
enum | DisplayStyle { None, Lines, Tubes, BallAndStick, VanDerWaals } |
enum | DisplaySource { Molecule, Forces } |
Public Slots | |
void | updateAtomSet (const bool reset=false) |
Updates the view under influence of changes in the atomset. | |
void | selectAll (const bool update=true) |
Selects all atoms. | |
void | unselectAll (const bool update=true) |
Unselects all atoms. | |
Public Member Functions | |
GLSimpleMoleculeView (AtomSet *atomset, QWidget *parent=0, const char *name=0) | |
~GLSimpleMoleculeView () | |
The default destructor. | |
unsigned int | displayStyle (const DisplaySource source) const |
Returns the display style of a certain primitive. | |
bool | isShowingElements () const |
Returns whether the atom elements are shown. | |
bool | isShowingNumbers () const |
Returns whether the atom numbers are shown. | |
bool | isShowingCharges (const unsigned int type) const |
Returns whether the atomic charges of the specified type are shown. | |
unsigned int | selectedAtoms () const |
Returns the number of selected atoms. | |
void | loadCML (QDomElement *root) |
Loads the view settings from a QDomElement. | |
void | saveCML (QDomElement *root) |
Saves the view settings to a QDomElement. | |
void | setDisplayStyle (const DisplaySource source, const unsigned int style) |
Sets the display style for a certain primitive. Does not redraw the scene. | |
void | setLabels (const bool element, const bool number, const unsigned int type) |
Sets up showing of the atom labels. Does not redraw the scene. | |
Static Public Member Functions | |
static void | setParameters (GLMoleculeParameters params) |
Updates the OpenGL parameters and makes sure they are adapted at the next call to updateGL(). | |
Protected Types | |
enum | SelectionType { SELECTION_NONE, SELECTION_ATOM, SELECTION_BOND, SELECTION_ANGLE, SELECTION_TORSION, SELECTION_GROUP, SELECTION_BONDS, SELECTION_FORCES } |
enum | ShapeTypes { SHAPE_ATOMS, SHAPE_BONDS, SHAPE_FORCES, SHAPE_LABELS, SHAPE_IC, SHAPE_SELECTION, SHAPE_NEXT } |
Protected Slots | |
void | reorderShapes () |
Orders all drawn shapes according to their opacity. | |
Protected Member Functions | |
virtual void | keyPressEvent (QKeyEvent *e) |
Overridden from GLView::keyPressEvent. | |
virtual void | initializeGL () |
Overridden from QGLWidget::initializeGL(). Initializes the OpenGL window. | |
virtual void | drawItem (const unsigned int) |
Draws the item shapes[index]. | |
virtual void | updateGLSettings () |
Updates the OpenGL settings. | |
virtual float | boundingSphereRadius () |
Calculates the radius of the bounding sphere. | |
void | clicked (const QPoint &position) |
Implementation of GLView::clicked(). Handles mouse click events. | |
virtual void | updateShapes () |
Updates the contents of the shapes vector. | |
Protected Attributes | |
GLfloat | centerX |
X-offset needed to center the molecule. | |
GLfloat | centerY |
Y-offset needed to center the moelcule. | |
GLfloat | centerZ |
Z-offset needed to center the molecule. | |
unsigned int | selectionType |
Keeps track of the type of selection. | |
std::list< unsigned int > | selectionList |
List that holds the selected atoms and their order. | |
std::vector< ShapeProperties > | shapes |
the list of shapes ordered by opacity. | |
Static Protected Attributes | |
static GLMoleculeParameters | moleculeParameters |
Holds the OpenGL molecule parameters. | |
Private Types | |
enum | Directions { DIRECTION_X, DIRECTION_Y, DIRECTION_Z } |
enum | StartIndices { START_ATOMS = 100, START_BONDS = 1, START_FORCES = 2, START_SELECTEDATOMS = 3, START_SELECTEDBONDS = 4 } |
Private Member Functions | |
GLuint | makeObjects (const int numSlices) |
Generates the shapes for the atoms and the bonds. | |
void | changeObjects (const GLuint startList, const int numSlices) |
Changes the quality of the atom and bond shapes. | |
void | selectEntity (const QPoint position) |
Selects the entity (atom, bond, etc.) pointed to by the mouse position. | |
void | processSelection (const unsigned int id) |
Changes the selection according to the change in selection of the entity with an ID id. | |
void | centerMolecule () |
Calculates the translations needed to center the molecule. | |
void | drawScene () |
Implementation of the pure virtual GLView::drawScene(). | |
void | drawAtoms () |
Draws the atoms in the OpenGL scene. | |
void | drawBonds () |
Draws the bonds in the OpenGL scene in a format depending in the OpenGL parameters. | |
void | drawLabels () |
Draws the element types and numbers. | |
void | drawForces () |
Draws the forces. | |
void | drawICValue () |
Draws the value for the currently selected internal coordinate. | |
void | drawSelections () |
Draws the selected atoms and internal coordinates. | |
Private Attributes | |
int | atomObject |
The OpenGL atom shape object pointer. | |
int | bondObject |
The OpenGL bond shape object pointer. | |
int | forceObjectLines |
The OpenGL force shape object pointer for lines style. | |
int | forceObjectTubes |
The OpenGL force shape object pointer for tubes style. | |
unsigned int | moleculeStyle |
The rendering style of the molecule. | |
unsigned int | forcesStyle |
The rendering style of the forces. | |
bool | showElements |
Is true if elements should be shown. | |
bool | showNumbers |
Is true if atom numbers should be shown. | |
unsigned int | chargeType |
Determines the type of charges to be shown. | |
AtomSet * | atoms |
The list of atoms. | |
GLfloat | selectionLineWidth |
The linewidth for drawing selected bonds. | |
GLfloat | selectionPointSize |
The pointsize for drawing selected atoms. | |
float | scaleFactor |
scalefactor for scenes exceeding 50A in radius | |
QFont | labelFont |
The font used to render labels and other values. | |
Static Private Attributes | |
static const float | cylinderHeight = 10.0f |
The cylinder height. A too low value shows severe bugs in the Mesa OpenGL implementation. | |
Classes | |
struct | ShapeProperties |
Utility struct for sorting of shapes by decreasing opacity. More... |
|
Definition at line 50 of file glsimplemoleculeview.h. |
|
Definition at line 52 of file glsimplemoleculeview.h. |
|
Definition at line 78 of file glsimplemoleculeview.h. |
|
Definition at line 81 of file glsimplemoleculeview.h. |
|
Definition at line 119 of file glsimplemoleculeview.h. |
|
Definition at line 120 of file glsimplemoleculeview.h. |
|
Definition at line 59 of file glsimplemoleculeview.cpp. |
|
The default destructor.
Definition at line 84 of file glsimplemoleculeview.cpp. |
|
Returns the display style of a certain primitive.
Definition at line 92 of file glsimplemoleculeview.cpp. |
|
Returns whether the atom elements are shown.
Definition at line 102 of file glsimplemoleculeview.cpp. |
|
Returns whether the atom numbers are shown.
Definition at line 109 of file glsimplemoleculeview.cpp. |
|
Returns whether the atomic charges of the specified type are shown.
Definition at line 116 of file glsimplemoleculeview.cpp. |
|
Returns the number of selected atoms.
Definition at line 123 of file glsimplemoleculeview.cpp. |
|
Loads the view settings from a QDomElement.
Definition at line 129 of file glsimplemoleculeview.cpp. |
|
Saves the view settings to a QDomElement.
Definition at line 180 of file glsimplemoleculeview.cpp. |
|
Sets the display style for a certain primitive. Does not redraw the scene.
Definition at line 202 of file glsimplemoleculeview.cpp. |
|
Sets up showing of the atom labels. Does not redraw the scene.
Definition at line 223 of file glsimplemoleculeview.cpp. |
|
Updates the OpenGL parameters and makes sure they are adapted at the next call to updateGL().
Definition at line 236 of file glsimplemoleculeview.cpp. |
|
Updates the view under influence of changes in the atomset. It has to be called under the following conditions:
Definition at line 249 of file glsimplemoleculeview.cpp. |
|
Selects all atoms.
Definition at line 302 of file glsimplemoleculeview.cpp. |
|
Unselects all atoms.
Definition at line 328 of file glsimplemoleculeview.cpp. |
|
Orders all drawn shapes according to their opacity.
Definition at line 344 of file glsimplemoleculeview.cpp. |
|
Overridden from GLView::keyPressEvent. Handles key presses for font changes (no public interface yet) Reimplemented from GLView. Reimplemented in GLMoleculeView. Definition at line 356 of file glsimplemoleculeview.cpp. |
|
Overridden from QGLWidget::initializeGL(). Initializes the OpenGL window.
Reimplemented from GLView. Definition at line 377 of file glsimplemoleculeview.cpp. |
|
Draws the item shapes[index]. It should be overridden by a subclass to draw new shapes. It is not made pure virtual because implementation is not mandatory. Reimplemented in GLMoleculeView. Definition at line 419 of file glsimplemoleculeview.cpp. |
|
Updates the OpenGL settings. It is only called when an update is really needed (determined by staticUpdateIndex != updateIndex in GLView). Reimplemented from GLView. Definition at line 435 of file glsimplemoleculeview.cpp. |
|
Calculates the radius of the bounding sphere.
Implements GLView. Reimplemented in GLMoleculeView. Definition at line 391 of file glsimplemoleculeview.cpp. |
|
Implementation of GLView::clicked(). Handles mouse click events.
Reimplemented from GLView. Definition at line 428 of file glsimplemoleculeview.cpp. |
|
Updates the contents of the shapes vector.
Reimplemented in GLMoleculeView. Definition at line 475 of file glsimplemoleculeview.cpp. |
|
Generates the shapes for the atoms and the bonds.
Definition at line 518 of file glsimplemoleculeview.cpp. |
|
Changes the quality of the atom and bond shapes.
Definition at line 527 of file glsimplemoleculeview.cpp. |
|
Selects the entity (atom, bond, etc.) pointed to by the mouse position.
Definition at line 586 of file glsimplemoleculeview.cpp. |
|
Changes the selection according to the change in selection of the entity with an ID id.
Definition at line 644 of file glsimplemoleculeview.cpp. |
|
Calculates the translations needed to center the molecule. The center of mass cannot be used, just the largest extents of the molecule. Definition at line 693 of file glsimplemoleculeview.cpp. |
|
Implementation of the pure virtual GLView::drawScene(). Changed from protected to private as subclasses should implement drawItem. Does the drawing of the OpenGL scene (called from paintGL). The default state is lighting enabled. If certain routine need to disable lighting they are required to enable it again at the end. Implements GLView. Definition at line 733 of file glsimplemoleculeview.cpp. |
|
Draws the atoms in the OpenGL scene.
Definition at line 814 of file glsimplemoleculeview.cpp. |
|
Draws the bonds in the OpenGL scene in a format depending in the OpenGL parameters. if bonds don't need to be selected individually, all bonds can be stored together in an OpenGL display list. Definition at line 852 of file glsimplemoleculeview.cpp. |
|
Draws the element types and numbers.
Definition at line 972 of file glsimplemoleculeview.cpp. |
|
Draws the forces. If forces don't need to be selected individually, all forces can be stored together in an OpenGL display list. Definition at line 1021 of file glsimplemoleculeview.cpp. |
|
Draws the value for the currently selected internal coordinate.
Definition at line 1104 of file glsimplemoleculeview.cpp. |
|
Draws the selected atoms and internal coordinates.
Definition at line 1247 of file glsimplemoleculeview.cpp. |
|
X-offset needed to center the molecule.
Definition at line 107 of file glsimplemoleculeview.h. |
|
Y-offset needed to center the moelcule.
Definition at line 108 of file glsimplemoleculeview.h. |
|
Z-offset needed to center the molecule.
Definition at line 109 of file glsimplemoleculeview.h. |
|
Keeps track of the type of selection.
Definition at line 110 of file glsimplemoleculeview.h. |
|
List that holds the selected atoms and their order.
Definition at line 111 of file glsimplemoleculeview.h. |
|
the list of shapes ordered by opacity.
Definition at line 112 of file glsimplemoleculeview.h. |
|
Initial value: {5, 1.0f, 0.2f, 0.2f, BallAndStick, Tubes, 1000, false, true, 0x00FF00, 0x00FFFF, 0xFFFF00, 50, 0xFFFF0, false, 100}
Definition at line 115 of file glsimplemoleculeview.h. |
|
The OpenGL atom shape object pointer.
Definition at line 137 of file glsimplemoleculeview.h. |
|
The OpenGL bond shape object pointer.
Definition at line 138 of file glsimplemoleculeview.h. |
|
The OpenGL force shape object pointer for lines style.
Definition at line 139 of file glsimplemoleculeview.h. |
|
The OpenGL force shape object pointer for tubes style.
Definition at line 140 of file glsimplemoleculeview.h. |
|
The rendering style of the molecule.
Definition at line 141 of file glsimplemoleculeview.h. |
|
The rendering style of the forces.
Definition at line 142 of file glsimplemoleculeview.h. |
|
Is true if elements should be shown.
Definition at line 143 of file glsimplemoleculeview.h. |
|
Is true if atom numbers should be shown.
Definition at line 144 of file glsimplemoleculeview.h. |
|
Determines the type of charges to be shown.
Definition at line 145 of file glsimplemoleculeview.h. |
|
The list of atoms.
Reimplemented in GLMoleculeView. Definition at line 146 of file glsimplemoleculeview.h. |
|
The linewidth for drawing selected bonds.
Definition at line 147 of file glsimplemoleculeview.h. |
|
The pointsize for drawing selected atoms.
Definition at line 148 of file glsimplemoleculeview.h. |
|
scalefactor for scenes exceeding 50A in radius
Definition at line 149 of file glsimplemoleculeview.h. |
|
The font used to render labels and other values.
Definition at line 150 of file glsimplemoleculeview.h. |
|
The cylinder height. A too low value shows severe bugs in the Mesa OpenGL implementation.
Definition at line 153 of file glsimplemoleculeview.h. |