• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdeedu
  • Sitemap
  • Contact Us
 

kalzium

Avogadro::Engine

Avogadro::Engine Class Reference

#include <engine.h>

Inheritance diagram for Avogadro::Engine:

Inheritance graph
[legend]

List of all members.


Detailed Description

Engine plugin interface.

Author:
Donald Ephraim Curtis <donald-curtis@uiowa.edu>
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  ) 

constructor

Definition at line 39 of file engine.cpp.

Avogadro::Engine::~Engine (  )  [virtual]

deconstructor

Definition at line 43 of file engine.cpp.


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:
true if the rendering was completed successfully, false otherwise
Example
 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.
For more information on the various primitive lists available see PrimitiveQueue.

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]

Returns:
the current color map used by this engine

Definition at line 99 of file engine.cpp.


The documentation for this class was generated from the following files:
  • src/engine.h
  • engine.cpp

kalzium

Skip menu "kalzium"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdeedu

Skip menu "kdeedu"
  • kalzium
  • kanagram
  • kig
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  •   docs
  •   src
  • parley
Generated for kdeedu by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal