Simple implementation of Transformable. More...
#include <SimpleTransformable.hpp>
Public Member Functions | |
SimpleTransformable (const Tag &tag) | |
virtual void | associate () |
virtual Extent | getExtent () |
virtual Vector | getPosition () |
virtual void | onNodeEvent (NodeEvent &event) |
Protected Member Functions | |
void | updatePositionExtent () |
Private Attributes | |
bool | valid |
list< Transformation * > | transforms |
Extent | extent |
Vector | position |
Simple implementation of Transformable.
Extent getExtent | ( | ) | [virtual] |
Implements Transformable.
Vector getPosition | ( | ) | [virtual] |
Lazily calculates the position only when requested and the position is determined to be invalid. Currently this is implemented by adding listeners to all the Transform ancestors of the shape. When one of the transforms is modified a flag is set to invalid. After the position is requested and calculated again the flag is set to valid. This way it can be requested multiple times but only calculated once when it is needed.
Implements Transformable.
void onNodeEvent | ( | NodeEvent & | event | ) | [inline, virtual] |
Invalidates the position when a transform changes.
Implements NodeListener.
Reimplemented in Boolean.
void updatePositionExtent | ( | ) | [protected] |
Updates the position and extent, then validates the position.