GBE::GReparentAgent Class Reference

Handles element restructuring of child elements according to their positions. More...

#include <GReparentAgent.h>

Inheritance diagram for GBE::GReparentAgent:

Inheritance graph
[legend]
Collaboration diagram for GBE::GReparentAgent:

Collaboration graph
[legend]
List of all members.

Public Slots

virtual void receiveInfluence (const GCS::GElementInfluence &influence)

Public Member Functions

 GReparentAgent ()
virtual ~GReparentAgent ()

Protected Member Functions

void performReparenting (const GCS::GElementID &new_parent, const GCS::GVector3 &pos_add, const GCS::GVector3 &rotate, double angle)

Detailed Description

Handles element restructuring of child elements according to their positions.

Author:
Raphael Langerhorst
When receiving influences from child elements and these influences are GPositionalInfluence or compatible, the agent checks if the child is still in the context of itself - the child's current parent. If the child has left its current parent (according to position and size), a reparent influence is created and sent to the child and the new parent so they can change their child/parent settings. When the child has left this element it is reparented to this element's parent.

If a reparent influence is received, the agent updates the parent/child information of the element and emits a reparent signal (NOT influence!) to let the GWE know about it.

This agent also handles reparenting of itself into another child of the same parent. This happens when this element is completely enclosed in another element of the same parent. On such cases a reparenting influence is sent to the current parent and the new child so they can update their child/parent data.

In all cases the reparented element has to perform form transformation because position and rotation is always relative to the current parent. The required transformation information is included in the reparenting influence which is sent by the element/agent that detects reparenting.

Position and size information is stored in the form attribute of an element. GRadiatingAgent is taking care of influence radiation which is required for this agent to work as these influences include the position and size information.

Bug:
Rotation is not properly handled on reparenting.


Constructor & Destructor Documentation

GBE::GReparentAgent::GReparentAgent (  ) 

Constructor.

GBE::GReparentAgent::~GReparentAgent (  )  [virtual]

Virtual Destructor.


Member Function Documentation

void GBE::GReparentAgent::performReparenting ( const GCS::GElementID new_parent,
const GCS::GVector3 pos_add,
const GCS::GVector3 rotate,
double  angle 
) [protected]

Do the actual reparenting. This is done by the reparented element.

void GBE::GReparentAgent::receiveInfluence ( const GCS::GElementInfluence influence  )  [virtual, slot]

Analyses given influence and checks for reparenting to the source of the influence. At this point this element also checks for reparenting into the parent's parent.

Todo:
do second reparenting check on formChanged()


The documentation for this class was generated from the following files:
Generated on Thu Nov 16 07:49:26 2006 for G System by  doxygen 1.4.7