Avogadro
1.1.0
|
GL widget class for rendering molecules. More...
#include <avogadro/glwidget.h>
Public Types | |
enum | ProjectionType { Perspective = 1, Orthographic = 2 } |
Public Slots | |
void | setTool (Tool *tool) |
NavigateTool is a super tool. | |
void | setBackground (const QColor &background) |
void | setMolecule (Molecule *molecule) |
void | unselectPrimitive (Primitive *) |
void | unselectAtom (Atom *) |
void | unselectBond (Bond *) |
void | addEngine (Engine *engine) |
void | removeEngine (Engine *engine) |
void | loadDefaultEngines () |
void | reloadEngines () |
void | invalidateDLs () |
void | updateGeometry () |
void | toolsDestroyed () |
void | addTextOverlay (QLabel *label) |
void | addTextOverlay (const QList< QLabel * > &labels) |
Signals | |
void | mousePress (QMouseEvent *event) |
void | mouseRelease (QMouseEvent *event) |
void | mouseMove (QMouseEvent *event) |
void | mouseDoubleClick (QMouseEvent *event) |
void | wheel (QWheelEvent *event) |
void | moleculeChanged (Molecule *newMolecule) |
void | engineAdded (Engine *engine) |
void | engineRemoved (Engine *engine) |
void | resized () |
void | namedSelectionsChanged () |
void | activated (GLWidget *) |
void | unitCellAxesRenderChanged (bool enabled) |
Public Member Functions | |
GLWidget (QWidget *parent=0) | |
GLWidget (const QGLFormat &format, QWidget *parent=0, const GLWidget *shareWidget=0) | |
GLWidget (Molecule *molecule, const QGLFormat &format, QWidget *parent=0, const GLWidget *shareWidget=0) | |
~GLWidget () | |
void | renderText (double x, double y, double z, const QString &str, const QFont &font, int listBase=2000) |
void | setQuickRender (bool enabled) |
bool | quickRender () const |
void | setRenderUnitCellAxes (bool enabled) |
bool | renderUnitCellAxes () const |
int | deviceWidth () |
int | deviceHeight () |
QSize | sizeHint () const |
QSize | minimumSizeHint () const |
double | radius (const Primitive *p) const |
Tool * | tool () const |
QColor | background () const |
void | setColorMap (Color *) |
Color * | colorMap () const |
void | setUndoStack (QUndoStack *undoStack) |
QUndoStack * | undoStack () const |
const Molecule * | molecule () const |
Molecule * | molecule () |
Camera * | camera () const |
QList< Engine * > | engines () const |
QList< GLHit > | hits (int x, int y, int w, int h) |
Primitive * | computeClickedPrimitive (const QPoint &p) |
Atom * | computeClickedAtom (const QPoint &p) |
Bond * | computeClickedBond (const QPoint &p) |
const Eigen::Vector3d & | center () const |
const Eigen::Vector3d & | normalVector () const |
double | radius () const |
const Atom * | farthestAtom () const |
void | setQuality (int quality) |
int | quality () const |
void | setFogLevel (int level) |
int | fogLevel () const |
void | setRenderAxes (bool renderAxes) |
bool | renderAxes () |
void | setRenderDebug (bool renderDebug) |
bool | renderDebug () |
void | setToolGroup (ToolGroup *toolGroup) |
ToolGroup * | toolGroup () const |
void | setExtensions (QList< Extension * > extensions) |
Painter * | painter () const |
void | setUnitCells (int a, int b, int c) |
void | setUnitCellColor (const QColor c) |
void | clearUnitCell () |
int | aCells () |
int | bCells () |
int | cCells () |
void | setProjection (ProjectionType type) |
ProjectionType | projection () const |
void | renderNow () |
virtual void | writeSettings (QSettings &settings) const |
virtual void | readSettings (QSettings &settings) |
Selection Methods | |
These methods are used to manipulate user-selected primitives. Each view tracks a list of selected objects (e.g., atoms) which can be passed to engines, tools, or used for tasks like copying selected atoms, etc. | |
PrimitiveList | selectedPrimitives () const |
void | toggleSelected (PrimitiveList primitives) |
void | toggleSelected () |
void | setSelected (PrimitiveList primitives, bool select=true) |
void | clearSelected () |
bool | isSelected (const Primitive *p) const |
bool | addNamedSelection (const QString &name, PrimitiveList &primitives) |
void | removeNamedSelection (const QString &name) |
void | removeNamedSelection (int index) |
void | renameNamedSelection (int index, const QString &name) |
QList< QString > | namedSelections () |
PrimitiveList | namedSelectionPrimitives (const QString &name) |
PrimitiveList | namedSelectionPrimitives (int index) |
Static Public Member Functions | |
static GLWidget * | current () |
static void | setCurrent (GLWidget *current) |
Static Public Attributes | |
static GLWidget * | m_current = 0 |
Protected Member Functions | |
virtual void | initializeGL () |
virtual void | paintGL () |
virtual void | paintGL2 () |
virtual void | resizeGL (int, int) |
virtual void | paintEvent (QPaintEvent *event) |
virtual void | resizeEvent (QResizeEvent *event) |
virtual bool | event (QEvent *event) |
virtual void | mousePressEvent (QMouseEvent *event) |
virtual void | mouseReleaseEvent (QMouseEvent *event) |
virtual void | mouseMoveEvent (QMouseEvent *event) |
virtual void | wheelEvent (QWheelEvent *event) |
virtual void | mouseDoubleClickEvent (QMouseEvent *event) |
virtual void | keyPressEvent (QKeyEvent *event) |
virtual void | keyReleaseEvent (QKeyEvent *event) |
virtual void | render () |
virtual void | renderCrystal (GLuint displayList) |
virtual void | renderCrystalAxes () |
virtual bool | renderClippedBox (const Eigen::Vector3d &offset, const Eigen::Vector3d &v1, const Eigen::Vector3d &v2, const Eigen::Vector3d &v3, double lineWidth) |
virtual void | renderAxesOverlay () |
virtual void | renderDebugOverlay () |
virtual void | renderTextOverlay () |
Properties | |
QColor | background |
GL widget class for rendering molecules.
This widget provides a 3D graphical view of a molecule. In terms of the Model-View architecture we consider the Molecule the model and GLWidget a view of this model. The widget relies on various Engine subclasses to handle the rendering of the 3d objects.
Each engine is allocated a PrimitiveList object. This queue contains all primitivew which that engine is responsible for rendering for this GLWidget. Thus, we can have one queue containing only the bonds, and one queue containing only the atoms which would allow bonds and atoms to be rendered by two different engines.
The type of projection
Avogadro::GLWidget::GLWidget | ( | QWidget * | parent = 0 | ) |
Constructor.
parent | the widget parent. |
Avogadro::GLWidget::GLWidget | ( | const QGLFormat & | format, |
QWidget * | parent = 0 , |
||
const GLWidget * | shareWidget = 0 |
||
) | [explicit] |
Constructor.
format | the QGLFormat information. |
parent | the widget parent. |
shareWidget | a widget to share the same graphics -- i.e., the underlying GLPainterDevice |
Avogadro::GLWidget::GLWidget | ( | Molecule * | molecule, |
const QGLFormat & | format, | ||
QWidget * | parent = 0 , |
||
const GLWidget * | shareWidget = 0 |
||
) |
Constructor.
molecule | the molecule to view. |
format | the QGLFormat information. |
parent | the widget parent. |
shareWidget | a widget to share the same graphics -- i.e., the underlying GLPainterDevice |
References setMolecule().
Destructor.
int Avogadro::GLWidget::aCells | ( | ) |
void Avogadro::GLWidget::activated | ( | GLWidget * | ) | [signal] |
Signal that this GLWidget was activated.
Referenced by mousePressEvent().
void Avogadro::GLWidget::addEngine | ( | Engine * | engine | ) | [slot] |
Add an engine to the GLWidget.
engine | Engine to add to this widget. |
References QObject::connect(), engineAdded(), invalidateDLs(), moleculeChanged(), setMolecule(), Avogadro::Engine::setPainterDevice(), and QWidget::update().
Referenced by loadDefaultEngines().
bool Avogadro::GLWidget::addNamedSelection | ( | const QString & | name, |
PrimitiveList & | primitives | ||
) |
Add a new named selection.
name | name of the new selection. |
primitives | the primitives ids. |
References QList::append(), Avogadro::Primitive::AtomType, Avogadro::Primitive::BondType, Avogadro::Primitive::id(), QObject::name(), and namedSelectionsChanged().
void Avogadro::GLWidget::addTextOverlay | ( | QLabel * | label | ) | [slot] |
void Avogadro::GLWidget::addTextOverlay | ( | const QList< QLabel * > & | labels | ) | [slot] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Adds the QLabels in labels to the list of strings drawn in the text overlay.
References QList::constBegin(), and QList::constEnd().
QColor Avogadro::GLWidget::background | ( | ) | const |
Referenced by setBackground().
int Avogadro::GLWidget::bCells | ( | ) |
Camera * Avogadro::GLWidget::camera | ( | ) | const |
Referenced by render(), Avogadro::Navigate::rotate(), Avogadro::Navigate::translate(), and Avogadro::Navigate::zoom().
int Avogadro::GLWidget::cCells | ( | ) |
const Vector3d & Avogadro::GLWidget::center | ( | ) | const |
void Avogadro::GLWidget::clearSelected | ( | ) |
Deselect all objects.
void Avogadro::GLWidget::clearUnitCell | ( | ) |
Clear the unit cell data.
References QWidget::update(), and updateGeometry().
Color * Avogadro::GLWidget::colorMap | ( | ) | const |
References Avogadro::PluginManager::factories(), and Avogadro::PluginManager::instance().
Referenced by setColorMap().
Atom * Avogadro::GLWidget::computeClickedAtom | ( | const QPoint & | p | ) |
Take a point and figure out which is the closest Atom under that point.
p | the point on the widget that was clicked. |
References Avogadro::Molecule::atom(), Avogadro::Primitive::AtomType, hits(), molecule(), Avogadro::GLHit::name(), Avogadro::GLHit::type(), QPoint::x(), and QPoint::y().
Bond * Avogadro::GLWidget::computeClickedBond | ( | const QPoint & | p | ) |
Take a point and figure out which is the closest Bond under that point.
p | the point on the widget that was clicked. |
References Avogadro::Molecule::bond(), Avogadro::Primitive::BondType, hits(), molecule(), Avogadro::GLHit::name(), Avogadro::GLHit::type(), QPoint::x(), and QPoint::y().
Primitive * Avogadro::GLWidget::computeClickedPrimitive | ( | const QPoint & | p | ) |
Take a point and figure out which is the closest Primitive under that point.
p | the point on the widget that was clicked. |
References Avogadro::Molecule::atom(), Avogadro::Primitive::AtomType, Avogadro::Molecule::bond(), Avogadro::Primitive::BondType, hits(), molecule(), Avogadro::GLHit::name(), Avogadro::GLHit::type(), QPoint::x(), and QPoint::y().
GLWidget * Avogadro::GLWidget::current | ( | ) | [static] |
int Avogadro::GLWidget::deviceHeight | ( | ) | [inline] |
int Avogadro::GLWidget::deviceWidth | ( | ) | [inline] |
void Avogadro::GLWidget::engineAdded | ( | Engine * | engine | ) | [signal] |
Signal that an Engine has been added to the GLWidget.
Referenced by addEngine().
void Avogadro::GLWidget::engineRemoved | ( | Engine * | engine | ) | [signal] |
Signal that an Engine has been removed from the GLWidget.
Referenced by removeEngine().
QList< Engine * > Avogadro::GLWidget::engines | ( | ) | const |
Referenced by loadDefaultEngines().
bool Avogadro::GLWidget::event | ( | QEvent * | event | ) | [protected, virtual] |
const Atom * Avogadro::GLWidget::farthestAtom | ( | ) | const |
int Avogadro::GLWidget::fogLevel | ( | ) | const |
QList< GLHit > Avogadro::GLWidget::hits | ( | int | x, |
int | y, | ||
int | w, | ||
int | h | ||
) |
Get the hits for a region starting at (x, y) of size (w * h).
References QList::append(), QGLWidget::doneCurrent(), Avogadro::Engine::isEnabled(), QGLWidget::makeCurrent(), molecule(), QObject::name(), Avogadro::Engine::renderPick(), QWidget::x(), and QWidget::y().
Referenced by computeClickedAtom(), computeClickedBond(), and computeClickedPrimitive().
void Avogadro::GLWidget::initializeGL | ( | ) | [protected, virtual] |
Virtual function called by QGLWidget on initialization of the GL area.
Reimplemented from QGLWidget.
References QGLWidget::context(), QMessageBox::critical(), QGLWidget::isValid(), QGLWidget::qglClearColor(), and QObject::tr().
Referenced by paintEvent(), and resizeEvent().
void Avogadro::GLWidget::invalidateDLs | ( | ) | [slot] |
Signal that something changed and the display lists should be invalidated.
Referenced by addEngine(), setMolecule(), and setQuality().
bool Avogadro::GLWidget::isSelected | ( | const Primitive * | p | ) | const |
void Avogadro::GLWidget::keyPressEvent | ( | QKeyEvent * | event | ) | [protected, virtual] |
Response to key press events.
event | the key event information |
Reimplemented from QWidget.
References QEvent::isAccepted(), Avogadro::Tool::keyPressEvent(), and QWidget::update().
void Avogadro::GLWidget::keyReleaseEvent | ( | QKeyEvent * | event | ) | [protected, virtual] |
Response to key release events.
event | the key event information |
Reimplemented from QWidget.
References QEvent::isAccepted(), and Avogadro::Tool::keyReleaseEvent().
void Avogadro::GLWidget::loadDefaultEngines | ( | ) | [slot] |
Reset to default engines (one of each factory).
References addEngine(), Avogadro::PluginFactory::createInstance(), engines(), Avogadro::PluginManager::factories(), Avogadro::Engine::identifier(), Avogadro::PluginManager::instance(), removeEngine(), and Avogadro::Engine::setEnabled().
Referenced by readSettings().
QSize Avogadro::GLWidget::minimumSizeHint | ( | ) | const [virtual] |
Virtual function setting the minimum size hit for this widget.
Reimplemented from QWidget.
Referenced by sizeHint().
const Molecule * Avogadro::GLWidget::molecule | ( | ) | const |
Referenced by computeClickedAtom(), computeClickedBond(), computeClickedPrimitive(), hits(), and setMolecule().
void Avogadro::GLWidget::moleculeChanged | ( | Molecule * | newMolecule | ) | [signal] |
Signal that the Molecule has changed.
Referenced by addEngine(), and setMolecule().
void Avogadro::GLWidget::mouseDoubleClick | ( | QMouseEvent * | event | ) | [signal] |
Signal for the mouse double-click event which is passed to the tools.
Referenced by mouseDoubleClickEvent().
void Avogadro::GLWidget::mouseDoubleClickEvent | ( | QMouseEvent * | event | ) | [protected, virtual] |
Virtual function reaction to a mouse double-click while in the GL rendering area.
Reimplemented from QWidget.
References QEvent::isAccepted(), mouseDoubleClick(), Avogadro::Tool::mouseDoubleClickEvent(), and QWidget::update().
void Avogadro::GLWidget::mouseMove | ( | QMouseEvent * | event | ) | [signal] |
Signal for the mouse move event which is passed to the tools.
Referenced by mouseMoveEvent().
void Avogadro::GLWidget::mouseMoveEvent | ( | QMouseEvent * | event | ) | [protected, virtual] |
Virtual function reaction to mouse being moved in the GL rendering area.
Reimplemented from QWidget.
References QEvent::isAccepted(), mouseMove(), and Avogadro::Tool::mouseMoveEvent().
void Avogadro::GLWidget::mousePress | ( | QMouseEvent * | event | ) | [signal] |
Signal for the mouse press event which is passed to the tools.
Referenced by mousePressEvent().
void Avogadro::GLWidget::mousePressEvent | ( | QMouseEvent * | event | ) | [protected, virtual] |
Virtual function reaction to mouse press in the GL rendering area.
Reimplemented from QWidget.
References activated(), QEvent::isAccepted(), mousePress(), and Avogadro::Tool::mousePressEvent().
void Avogadro::GLWidget::mouseRelease | ( | QMouseEvent * | event | ) | [signal] |
Signal for the mouse release event which is passed to the tools.
Referenced by mouseReleaseEvent().
void Avogadro::GLWidget::mouseReleaseEvent | ( | QMouseEvent * | event | ) | [protected, virtual] |
Virtual function reaction to mouse release in the GL rendering area.
Reimplemented from QWidget.
References QEvent::isAccepted(), mouseRelease(), Avogadro::Tool::mouseReleaseEvent(), and QWidget::update().
PrimitiveList Avogadro::GLWidget::namedSelectionPrimitives | ( | const QString & | name | ) |
Get the primitives of a named selections by name.
name | name of the selection. |
References QObject::name().
Get the primitives of a named selections by index. Using the index is useful in Models.
index | index of the selection. |
References Avogadro::PrimitiveList::append().
Get the names of all named selections.
References QList::append().
void Avogadro::GLWidget::namedSelectionsChanged | ( | ) | [signal] |
Named selections have changed.
Referenced by addNamedSelection(), removeNamedSelection(), and renameNamedSelection().
const Vector3d & Avogadro::GLWidget::normalVector | ( | ) | const |
Painter * Avogadro::GLWidget::painter | ( | ) | const |
Returns the Painter of this widget. For instance, to draw a sphere in this widget, you could do:
painter()->drawSphere(center, radius)
Referenced by renderAxesOverlay().
void Avogadro::GLWidget::paintEvent | ( | QPaintEvent * | event | ) | [protected, virtual] |
Virtual function called when the GL area needs repainting.
Reimplemented from QGLWidget.
References initializeGL(), QGLWidget::makeCurrent(), paintGL(), QGLWidget::qglClearColor(), QGLWidget::swapBuffers(), and QWidget::updatesEnabled().
void Avogadro::GLWidget::paintGL | ( | ) | [protected, virtual] |
Virtual function called by GLWidget before render() to set up the display correctly.
Reimplemented from QGLWidget.
References QWidget::height(), render(), resizeGL(), and QWidget::width().
Referenced by paintEvent(), and renderNow().
void Avogadro::GLWidget::paintGL2 | ( | ) | [protected, virtual] |
int Avogadro::GLWidget::quality | ( | ) | const |
bool Avogadro::GLWidget::quickRender | ( | ) | const |
double Avogadro::GLWidget::radius | ( | const Primitive * | p | ) | const |
References Avogadro::Engine::isEnabled(), radius(), and Avogadro::Engine::radius().
double Avogadro::GLWidget::radius | ( | ) | const |
void Avogadro::GLWidget::readSettings | ( | QSettings & | settings | ) | [virtual] |
Read the settings of the GLWidget and restore them.
References loadDefaultEngines(), setFogLevel(), setQuality(), QVariant::toInt(), QSettings::value(), and QVariant::value().
void Avogadro::GLWidget::reloadEngines | ( | ) | [slot] |
Reload the engine plugins.
References QSettings::beginWriteArray(), QSettings::endArray(), and QSettings::setArrayIndex().
void Avogadro::GLWidget::removeEngine | ( | Engine * | engine | ) | [slot] |
Remove an engine from the GLWidget.
engine | Engine to remove from this widget. |
References QObject::deleteLater(), QObject::disconnect(), engineRemoved(), and QWidget::update().
Referenced by loadDefaultEngines().
void Avogadro::GLWidget::removeNamedSelection | ( | const QString & | name | ) |
Remove a named selection by name.
name | name of the selection to remove. |
References QObject::name(), and namedSelectionsChanged().
void Avogadro::GLWidget::removeNamedSelection | ( | int | index | ) |
Remove a named selection by index. Using the index is useful in Models.
index | index of the selection to remove. |
void Avogadro::GLWidget::renameNamedSelection | ( | int | index, |
const QString & | name | ||
) |
Rename a named selection by index. Using the index is useful in Models.
index | index of the selection to rename. |
References QString::isEmpty(), QObject::name(), and namedSelectionsChanged().
void Avogadro::GLWidget::render | ( | ) | [protected, virtual] |
Render the scene. To be used in both modes GL_RENDER and GL_SELECT. This function calls the render functions of the engines as well as the paint events of the tools and is where everything drawn onto the widget is called from.
References camera(), QMetaObject::invokeMethod(), Avogadro::Engine::isEnabled(), Avogadro::Engine::layers(), Avogadro::Camera::modelview(), Avogadro::Tool::paint(), renderAxesOverlay(), renderCrystal(), Avogadro::Engine::renderOpaque(), renderTextOverlay(), Avogadro::Engine::renderTransparent(), Avogadro::Engine::shader(), tool(), and Avogadro::Engine::Transparent.
Referenced by paintGL(), and paintGL2().
bool Avogadro::GLWidget::renderAxes | ( | ) |
Referenced by setRenderAxes().
void Avogadro::GLWidget::renderAxesOverlay | ( | ) | [protected, virtual] |
Render x, y, z axes as an overlay on the bottom left of the widget.
References Avogadro::Painter::drawCone(), Avogadro::Painter::drawCylinder(), Avogadro::Painter::drawSphere(), painter(), and Avogadro::Painter::setColor().
Referenced by render().
bool Avogadro::GLWidget::renderClippedBox | ( | const Eigen::Vector3d & | offset, |
const Eigen::Vector3d & | v1, | ||
const Eigen::Vector3d & | v2, | ||
const Eigen::Vector3d & | v3, | ||
double | lineWidth | ||
) | [protected, virtual] |
Renders a parallelepiped with defining edge vectors v1, v2, v3, with offset offset. If the cube intersects the viewing volume's near-plane, an appropriate line-loop is rendered at the intersection to prevent "missing corners" that are visually disturbing.
See http://davidlonie.blogspot.com/2011/04/gracefully-clipping-parallelepiped-in.html for pictures of what this does.
offset | Origin for edge vectors |
v1 | Vector defining one edge starting from offset |
v2 | Vector defining a second edge starting from offset |
v3 | Vector defining a third edge starting from offset |
lineWidth | Width of the lines used to draw the edges |
Referenced by renderCrystalAxes().
void Avogadro::GLWidget::renderCrystal | ( | GLuint | displayList | ) | [protected, virtual] |
Render a full crystal cell Called by render() automatically
displayList | the display list of the primitive unit cell |
References renderCrystalAxes(), QWidget::x(), and QWidget::y().
Referenced by render().
void Avogadro::GLWidget::renderCrystalAxes | ( | ) | [protected, virtual] |
Render crystal unit cell axes called by renderCrystal() automatically
References renderClippedBox().
Referenced by renderCrystal().
bool Avogadro::GLWidget::renderDebug | ( | ) |
Referenced by setRenderDebug().
void Avogadro::GLWidget::renderDebugOverlay | ( | ) | [protected, virtual] |
References renderTextOverlay().
void Avogadro::GLWidget::renderNow | ( | ) |
Trigger a render for GL2PS.
References paintGL().
void Avogadro::GLWidget::renderTextOverlay | ( | ) | [protected, virtual] |
Render a text overlay. This renders all valid strings added by addTextOverlay, as well as debug info if needed.
References QList::append(), QList::size(), QObject::tr(), and QWidget::y().
Referenced by render(), and renderDebugOverlay().
bool Avogadro::GLWidget::renderUnitCellAxes | ( | ) | const |
void Avogadro::GLWidget::resized | ( | ) | [signal] |
Signal that the GLWidget has resized. Can be used to update child widgets, see overlay extension for example.
Referenced by resizeEvent().
void Avogadro::GLWidget::resizeEvent | ( | QResizeEvent * | event | ) | [protected, virtual] |
Called on resize of the GLWidget to perform resizing of the display.
Reimplemented from QGLWidget.
References initializeGL(), QGLWidget::isValid(), QGLWidget::makeCurrent(), resized(), resizeGL(), QResizeEvent::size(), and QSize::width().
void Avogadro::GLWidget::resizeGL | ( | int | width, |
int | height | ||
) | [protected, virtual] |
Virtual function called whn the GL area is resized
Reimplemented from QGLWidget.
Referenced by paintGL(), and resizeEvent().
void Avogadro::GLWidget::setBackground | ( | const QColor & | background | ) | [slot] |
Set the background color of the rendering area (the default is black).
background | the new background color. |
References background().
void Avogadro::GLWidget::setColorMap | ( | Color * | colorMap | ) |
Set the current global color map for Primitives.
References colorMap().
void Avogadro::GLWidget::setCurrent | ( | GLWidget * | current | ) | [static] |
void Avogadro::GLWidget::setExtensions | ( | QList< Extension * > | extensions | ) |
Set the extensions.
void Avogadro::GLWidget::setFogLevel | ( | int | level | ) |
level | Set the global fog level of the widget. |
Referenced by readSettings().
void Avogadro::GLWidget::setMolecule | ( | Molecule * | molecule | ) | [slot] |
Set the molecule model for this view.
molecule | the molecule to view. |
References QObject::connect(), QObject::disconnect(), invalidateDLs(), molecule(), moleculeChanged(), unselectAtom(), unselectBond(), unselectPrimitive(), QWidget::update(), and updateGeometry().
Referenced by addEngine(), and GLWidget().
Set the type of projection
type | type of projection |
References QWidget::update(), and updateGeometry().
void Avogadro::GLWidget::setQuality | ( | int | quality | ) |
quality | set the global quality of the widget. |
References invalidateDLs().
Referenced by readSettings().
void Avogadro::GLWidget::setQuickRender | ( | bool | enabled | ) |
enabled | True if quick render is desired when moving the view. |
References QWidget::enabled.
void Avogadro::GLWidget::setRenderAxes | ( | bool | renderAxes | ) |
Set to render x, y, z axes as an overlay in the bottom left of the widget.
References renderAxes(), and QWidget::update().
void Avogadro::GLWidget::setRenderDebug | ( | bool | renderDebug | ) |
Set to render the "debug info" (i.e., FPS, number of atoms, etc.)
References renderDebug(), and QWidget::update().
void Avogadro::GLWidget::setRenderUnitCellAxes | ( | bool | enabled | ) |
enabled | True if we should render the unit cell axes |
References QWidget::enabled, and unitCellAxesRenderChanged().
void Avogadro::GLWidget::setSelected | ( | PrimitiveList | primitives, |
bool | select = true |
||
) |
Change the selection status for the atoms in the supplied list. All objects in the list will have the same selection status.
primitives | the set of objects to update. |
select | whether to select or deselect the objects. |
References Avogadro::Primitive::update().
void Avogadro::GLWidget::setTool | ( | Tool * | tool | ) | [slot] |
NavigateTool is a super tool.
Set the active Tool of the GLWidget.
References tool().
Referenced by setToolGroup().
void Avogadro::GLWidget::setToolGroup | ( | ToolGroup * | toolGroup | ) |
Set the ToolGroup of the GLWidget.
References Avogadro::ToolGroup::activeTool(), QObject::connect(), QObject::disconnect(), Avogadro::Plugin::identifier(), setTool(), tool(), toolGroup(), and toolsDestroyed().
void Avogadro::GLWidget::setUndoStack | ( | QUndoStack * | undoStack | ) |
undoStack | the new undoStack. |
References undoStack().
void Avogadro::GLWidget::setUnitCellColor | ( | const QColor | c | ) |
Set the color of unit cells
c | color of unit cells |
void Avogadro::GLWidget::setUnitCells | ( | int | a, |
int | b, | ||
int | c | ||
) |
Set the number of unit cells for a periodic molecule like a crystal a, b, and c, are the three primitive unit cell axes. Does nothing if the molecule does not have a unit cell defined.
a | number of unit cells to display along the a axis. |
b | number of unit cells to display along the b axis. |
c | number of unit cells to display along the c axis. |
References QWidget::update(), and updateGeometry().
QSize Avogadro::GLWidget::sizeHint | ( | ) | const [virtual] |
Virtual function setting the size hint for this widget.
Reimplemented from QWidget.
References minimumSizeHint().
void Avogadro::GLWidget::toggleSelected | ( | PrimitiveList | primitives | ) |
Toggle the selection for the atoms in the supplied list. That is, if the primitive is selected, deselect it and vice-versa.
primitives | the set of objects to update. |
void Avogadro::GLWidget::toggleSelected | ( | ) |
Toggle the selection for the GLWidget, that is if the primitive is selected, deselect it and vice-versa.
Tool * Avogadro::GLWidget::tool | ( | ) | const |
Referenced by render(), setTool(), and setToolGroup().
ToolGroup * Avogadro::GLWidget::toolGroup | ( | ) | const |
Referenced by setToolGroup().
void Avogadro::GLWidget::toolsDestroyed | ( | ) | [slot] |
One or more tools are deleted..
Referenced by setToolGroup().
QUndoStack * Avogadro::GLWidget::undoStack | ( | ) | const |
Referenced by setUndoStack().
void Avogadro::GLWidget::unitCellAxesRenderChanged | ( | bool | enabled | ) | [signal] |
Signal that the unit cell axis display has changed
Referenced by setRenderUnitCellAxes().
void Avogadro::GLWidget::unselectAtom | ( | Atom * | a | ) | [slot] |
An atom, was removed, so update the selection
References unselectPrimitive().
Referenced by setMolecule().
void Avogadro::GLWidget::unselectBond | ( | Bond * | b | ) | [slot] |
A bond, was removed, so update the selection
References unselectPrimitive().
Referenced by setMolecule().
void Avogadro::GLWidget::unselectPrimitive | ( | Primitive * | p | ) | [slot] |
A primitive, was removed, so update the selection
Referenced by setMolecule(), unselectAtom(), and unselectBond().
void Avogadro::GLWidget::updateGeometry | ( | ) | [slot] |
update the Molecule geometry.
Reimplemented from QWidget.
References QList::at(), Avogadro::Atom::pos(), and QWidget::x().
Referenced by clearUnitCell(), setMolecule(), setProjection(), and setUnitCells().
void Avogadro::GLWidget::wheel | ( | QWheelEvent * | event | ) | [signal] |
Signal for the mouse wheel event which is passed to the tools.
Referenced by wheelEvent().
void Avogadro::GLWidget::wheelEvent | ( | QWheelEvent * | event | ) | [protected, virtual] |
Virtual function reaction to mouse while in the GL rendering area.
Reimplemented from QWidget.
References QEvent::isAccepted(), wheel(), and Avogadro::Tool::wheelEvent().
void Avogadro::GLWidget::writeSettings | ( | QSettings & | settings | ) | const [virtual] |
Write the settings of the GLWidget in order to save them to disk.
References QSettings::beginWriteArray(), QSettings::endArray(), QSettings::remove(), QSettings::setArrayIndex(), and QSettings::setValue().
GLWidget * Avogadro::GLWidget::m_current = 0 [static] |
Static pointer to the current GLWidget.
Referenced by current(), and setCurrent().