#include <GweController.h>
Inheritance diagram for GWE::GweController:


Public Slots | |
| virtual void | executeOpenElement (const GCS::GElementID &id) |
| virtual void | radiateInfluence (const GCS::GElementInfluence &influence, double radius_factor) |
| virtual void | routeInfluence (const GCS::GElementInfluence &influence, const GCS::GElementID &destination) |
| virtual void | removeElementWithNoEnergyLeft (const GCS::GEnergy &changedEnergy) |
| virtual void | shutdown () |
Signals | |
| void | quit () |
Public Member Functions | |
| GweController (GDataController *data, GInformationInterface *info, QObject *parent=0) | |
| virtual | ~GweController () |
| virtual GDataController * | getDataController () |
| virtual const GDataController * | getDataController () const |
| virtual GInformationInterface * | getInformationInterface () |
| virtual GActionInterface * | getActionInterface () |
| virtual void | performAction (const GCS::GElementID &element, const QString &action, QStringList params, const QString &agent=QString()) |
| virtual QStringList | getAvailableActions (const GCS::GElementID &element) const |
| virtual QString | getActionDescription (const GCS::GElementID &element, const QString &action) const |
Protected Slots | |
| virtual void | connectBasicElementSignals (const GCS::GElementID &id) |
Protected Member Functions | |
| virtual QList< GCS::GElement * > | findInRange (GCS::GElement *source, double range_factor, unsigned max_traverse_children=0, unsigned max_traverse_parents=1) |
Protected Attributes | |
| GDataController * | Data |
| GInformationInterface * | InformationInterface |
| GWE::GweController::GweController | ( | GDataController * | data, | |
| GInformationInterface * | info, | |||
| QObject * | parent = 0 | |||
| ) |
Constructor.
| data | the GDataController used |
| GWE::GweController::~GweController | ( | ) | [virtual] |
Virtual destructor to allow clean memory management with derived classes.
| void GWE::GweController::connectBasicElementSignals | ( | const GCS::GElementID & | id | ) | [protected, virtual, slot] |
Connects the following element signals in a standard way, data is the GDataController that is used.
Reimplemented in GWE::GweAdvancedController.
| QList< GCS::GElement * > GWE::GweController::findInRange | ( | GCS::GElement * | source, | |
| double | range_factor, | |||
| unsigned | max_traverse_children = 0, |
|||
| unsigned | max_traverse_parents = 1 | |||
| ) | [protected, virtual] |
Uses the data controller to find all elements that are in the range of the given source element. Elements in range are simply all elements that touch each other.
This method is usually used to find all elements that are affected by an influence.
If the source element has no form, the form of the parent element is used as boundary, until a element with a form is found or traversal count reaches max_depth_parent.
Normally max_traverse_parents is not set to anything larger than 1. If it is necessary it most likely because of a bad element design. Still, it can be useful in some cases.
| source | The element that defines the range of affected elements. | |
| max_traverse_children | Sets the maximum element hierarchy traversal limit in the direction of children; 0 means no children at all, 1 means all direct children, ... | |
| max_traverse_parents | Sets the maximum element hierarchy traversal limit in the direction of parents; 0 means no parents (not even the parent of the source element!), 1 means including the direct parent; a higher value than 1 only makes sense if neither the source nor the parent element have a form attribute. The real maximum of parent traverses is defined by the minimum of this parameter and the number of traversals to the first parent with a form and the number of traversals to the root element. |
| QString GWE::GweController::getActionDescription | ( | const GCS::GElementID & | element, | |
| const QString & | action | |||
| ) | const [virtual] |
| GActionInterface * GWE::GweController::getActionInterface | ( | ) | [virtual] |
The Action interface is usually the controller itself.
| QStringList GWE::GweController::getAvailableActions | ( | const GCS::GElementID & | element | ) | const [virtual] |
Implements GWE::GActionInterface.
| const GDataController * GWE::GweController::getDataController | ( | ) | const [virtual] |
| GDataController * GWE::GweController::getDataController | ( | ) | [virtual] |
| GInformationInterface * GWE::GweController::getInformationInterface | ( | ) | [virtual] |
| void GWE::GweController::performAction | ( | const GCS::GElementID & | element, | |
| const QString & | action, | |||
| QStringList | params, | |||
| const QString & | agent = QString() | |||
| ) | [virtual] |
Performs given action for given element.
Implements GWE::GActionInterface.
| void GWE::GweController::quit | ( | ) | [signal] |
Emitted when the GWE Server should shutdown.
| void GWE::GweController::radiateInfluence | ( | const GCS::GElementInfluence & | influence, | |
| double | radius_factor | |||
| ) | [virtual, slot] |
Forwards given influence to all elements that are near to the sender() of this signal.
| void GWE::GweController::removeElementWithNoEnergyLeft | ( | const GCS::GEnergy & | changedEnergy | ) | [virtual, slot] |
Checks if given element (sender()) has an energy amount of 0 in which case it is deleted.
Usually this slot can be connected to the energyChanged() signal of an element.
| void GWE::GweController::routeInfluence | ( | const GCS::GElementInfluence & | influence, | |
| const GCS::GElementID & | destination | |||
| ) | [virtual, slot] |
Routes an influence from an element to given destination.
| void GWE::GweController::shutdown | ( | ) | [virtual, slot] |
Shuts down the whole World Engine and does all required cleanup beforehand. It is highly recommended to call this slot before shutting down the application.
At the end the quit signal is emitted. In this state all cleanup and shutdown is down and the application can safely quit.
GDataController* GWE::GweController::Data [protected] |
Every GWE Controller needs to have a data controller anyway, so it is already present in this base class and can be used be derived controllers.
The Information interface of this controller.
1.4.7