kalzium
Avogadro::Engine Class Reference
#include <engine.h>

Detailed Description
Engine plugin interface.This class provides a an interface for our engines. Subclasses of this class are loaded by the GLWidget and used to render different parts of our project (Molecule, Atom, Bond, Residue) depending on what style of engine we're implementing.
- See also:
- render()
Definition at line 51 of file src/engine.h.
Public Slots | |
| virtual void | addPrimitive (Primitive *primitive) |
| virtual void | updatePrimitive (Primitive *primitive) |
| virtual void | removePrimitive (Primitive *primitive) |
| virtual void | setColorMap (Color &map) |
| virtual Color & | colorMap () |
Signals | |
| void | changed () |
Public Member Functions | |
| Engine (QObject *parent=0) | |
| virtual | ~Engine () |
| virtual QString | name ()=0 |
| virtual QString | description ()=0 |
| virtual bool | render (GLWidget *gl)=0 |
| const PrimitiveQueue & | queue () const |
| virtual double | radius (const Primitive *primitive=0) |
| void | clearQueue () |
| bool | isEnabled () |
| void | setEnabled (bool enabled) |
| virtual QWidget * | settingsWidget () |
Constructor & Destructor Documentation
| Avogadro::Engine::Engine | ( | QObject * | parent = 0 |
) |
| Avogadro::Engine::~Engine | ( | ) | [virtual] |
Member Function Documentation
| virtual QString Avogadro::Engine::name | ( | ) | [pure virtual] |
- Returns:
- the short name of the engine as a QString (ie.
"FooBar")
Reimplemented from QObject.
Implemented in Avogadro::BSDYEngine, Avogadro::LabelEngine, Avogadro::SphereEngine, Avogadro::StickEngine, and Avogadro::WireEngine.
| virtual QString Avogadro::Engine::description | ( | ) | [pure virtual] |
- Returns:
- a simple description of the engine (ie.
"Rendering Atoms and Bonds using FooBar style.")
Implemented in Avogadro::BSDYEngine, Avogadro::LabelEngine, Avogadro::SphereEngine, Avogadro::StickEngine, and Avogadro::WireEngine.
| virtual bool Avogadro::Engine::render | ( | GLWidget * | gl | ) | [pure virtual] |
Render a PrimitiveQueue.
This function is allowed to rendering whatever primitives it wishes. There is no requirement that it render every primitive.
- Parameters:
-
queue This parameter is of type PrimitiveQueue which provides an organized list of Primitive* objects. During generation of the GL view engines will have their render function called at most once. It is the responsibility of the engine to render all of the objects in it's queue if it can.
- Returns:
trueif the rendering was completed successfully,falseotherwise
Engine::render(const PrimitiveQueue *queue) { const QList<Primitive *> *list; glPushName(Primitive::AtomType); list = q->primitiveList(Primitive::AtomType); for( int i=0; i<list->size(); i++ ) { Bond *atom = (*list)[i]; glPushName(atom->GetIdx()); *** render atom *** glPopName(); } glPushName(Primitive::BondType); list = q->primitiveList(Primitive::BondType); for( int i=0; i<list->size(); i++ ) { Bond *bond = (*list)[i]; glPushName(bond->GetIdx()); *** render bond *** glPopName(); } glPopName(); return true; }
- Note:
- To allow picking to happen you need to push the object type and name. If objects cannot be picked this may be omitted.
Implemented in Avogadro::BSDYEngine, Avogadro::LabelEngine, Avogadro::SphereEngine, Avogadro::StickEngine, and Avogadro::WireEngine.
| const PrimitiveQueue & Avogadro::Engine::queue | ( | ) | const |
Definition at line 48 of file engine.cpp.
| double Avogadro::Engine::radius | ( | const Primitive * | primitive = 0 |
) | [virtual] |
Get the radius of the primitive referred to.
- Parameters:
-
primitive is the Primitive to get the radius of
- Returns:
- the radius of the Primitive
Reimplemented in Avogadro::BSDYEngine, Avogadro::SphereEngine, and Avogadro::StickEngine.
Definition at line 53 of file engine.cpp.
| void Avogadro::Engine::clearQueue | ( | ) |
Definition at line 59 of file engine.cpp.
| bool Avogadro::Engine::isEnabled | ( | ) |
Definition at line 64 of file engine.cpp.
| void Avogadro::Engine::setEnabled | ( | bool | enabled | ) |
Definition at line 69 of file engine.cpp.
| QWidget * Avogadro::Engine::settingsWidget | ( | ) | [virtual] |
- Returns:
- a QWidget containing the engine settings or 0 if no settings widget is available
Reimplemented in Avogadro::BSDYEngine.
Definition at line 94 of file engine.cpp.
| void Avogadro::Engine::changed | ( | ) | [signal] |
| void Avogadro::Engine::addPrimitive | ( | Primitive * | primitive | ) | [virtual, slot] |
Reimplemented in Avogadro::BSDYEngine, and Avogadro::StickEngine.
Definition at line 74 of file engine.cpp.
| void Avogadro::Engine::updatePrimitive | ( | Primitive * | primitive | ) | [virtual, slot] |
Reimplemented in Avogadro::BSDYEngine, and Avogadro::StickEngine.
Definition at line 79 of file engine.cpp.
| void Avogadro::Engine::removePrimitive | ( | Primitive * | primitive | ) | [virtual, slot] |
Reimplemented in Avogadro::BSDYEngine, and Avogadro::StickEngine.
Definition at line 84 of file engine.cpp.
| void Avogadro::Engine::setColorMap | ( | Color & | map | ) | [virtual, slot] |
Set the color map to be used for this engine.
default is to color each atom by element
- Parameters:
-
map is the new colors to be used
Definition at line 89 of file engine.cpp.
| Color & Avogadro::Engine::colorMap | ( | ) | [virtual, slot] |
The documentation for this class was generated from the following files:
KDE 4.0 API Reference