#include <VisComponent.h>
Inherits CompositeNode.
Inheritance diagram for VisComponent:
Public Member Functions | |
VisComponent (void) | |
virtual | ~VisComponent (void) |
void | render (const std::vector< unsigned long > &selectedIds, bool enablePicking, bool containerOnly=false) |
void | renderChildren (const std::vector< unsigned long > &selectedIds, bool enablePicking, bool containerOnly=false) |
void | renderBranch (const std::vector< unsigned long > &selectedIds, bool enablePicking, bool containerOnly=false) |
void | renderBranchWithException (const std::vector< unsigned long > &selectedIds, bool enablePicking, bool containerOnly, unsigned long exceptionId) |
void | renderBranchWithException (const std::vector< unsigned long > &selectedIds, bool enablePicking, bool containerOnly, const std::vector< unsigned long > &exceptionId) |
void | startAnimation () |
void | stopAnimation () |
virtual void | animate (float t) |
void | animateRemoving (unsigned int invariants) |
void | animateAdding (const std::vector< unsigned int > &types, unsigned int invariants) |
void | onEvent (LargeDisplayEvent *evt) |
virtual void | resize (unsigned int width, unsigned int height) |
virtual void | drop (bool parentChanged) |
void | convertGlobalToBufferCoords (double globalX, double globalY, double &bufferX, double &bufferY) |
void | convertGlobalToBufferCoords (const Point3f &global, Point3f &buffer) |
void | convertBufferToGlobalCoords (double bufferX, double bufferY, double &globalX, double &globalY) |
void | convertBufferToGlobalCoords (const Point3f &buffer, Point3f &global) |
void | convertPositionToParentBufferCoords (double &parentX, double &parentY) |
void | convertGlobalToComponentCoords (double globalX, double globalY, double &componentX, double &componentY) |
void | convertGlobalToComponentCoords (const Point3f &global, Point3f &component) |
void | convertComponentToGlobalCoords (double componentX, double componentY, double &globalX, double &globalY) |
void | convertComponentToGlobalCoords (const Point3f &component, Point3f &global) |
void | convertPositionToParentCoords (double &parentX, double &parentY) |
void | moveBy (const Point3f &d) |
void | moveBy (float dx, float dy=0, float dz=0) |
void | moveBranchBy (const Point3f &d) |
void | moveBranchBy (float dx, float dy=0, float dz=0) |
void | rotate (double angleRadians) |
void | rotateBranch (double angleRadians) |
void | saveCurrentState () |
void | retrieveState () |
void | retrieveState (unsigned int invariants) |
VisComponentState | obtainTopState () |
void | discardTopState () |
bool | isStateStackEmpty () |
void | addActiveBuffer (IBufferProxy *buffer) |
void | addPassiveBuffer (IBufferProxy *buffer) |
unsigned int | getNumberActiveBuffers () |
unsigned int | getNumberPassiveBuffers () |
void | updatePassiveBuffers () |
void | updateBranchPassiveBuffers () |
void | resizeActiveBuffers () |
void | resizeBranchActiveBuffers () |
unsigned long | getActiveBuffersMemorySizeKBytes () |
void | pushStrategy (VisComponentStrategy *str) |
template<class T> | |
bool | hasStrategy () |
template<class T> | |
T * | getStrategy () |
template<class T> | |
bool | removeStrategy () |
void | destroyLastStrategy () |
void | destroyAllStrategies () |
bool | isInside (unsigned int x, unsigned int y) |
unsigned long | getId () |
void | setId (unsigned long newId) |
void | getIdColor (unsigned char *color) |
void | setIdColor (unsigned char *colorId) |
LargeDisplayManager * | getManager () |
void | setManager (LargeDisplayManager *m) |
VisComponentState | getCurrentState () |
void | setCurrentState (VisComponentState state) |
float | getAnimationStep () |
void | setAnimationStep (float step) |
float | getAnimationParameter () |
void | setAnimationParameter (float value) |
bool | isAnimating () |
void | setAnimating (bool value) |
VisComponentState | getSourceState () |
void | setSourceState (VisComponentState state) |
VisComponentState | getTargetState () |
void | setTargetState (VisComponentState state) |
unsigned int | getRemovingInvariants () |
void | setRemovingInvariants (unsigned int invariants) |
IBufferProxy * | getActiveBuffer (unsigned int propId) |
void | setActiveBuffer (unsigned int propId, IBufferProxy *buffer) |
IBufferProxy * | getActiveBufferByType (unsigned int t) |
IBufferProxy * | getPassiveBuffer (unsigned int propId) |
IBufferProxy * | getPassiveBufferByType (unsigned int t) |
void | setPassiveBuffer (unsigned int propId, IBufferProxy *buffer) |
VisComponentStrategy * | getStrategy () |
void | setStrategy (VisComponentStrategy *str) |
const Point3f & | getPosition () |
void | setPosition (const Point3f &pos) |
void | setPosition (float x, float y) |
void | setPosition (float x, float y, float z) |
double | getRotationAngle () |
void | setRotationAngle (double angle) |
unsigned int | getWidth () |
void | setWidth (unsigned int w) |
unsigned int | getHeight () |
void | setHeight (unsigned int h) |
float | getScaleFactorX () |
float | getScaleFactorY () |
float | getScaleFactorZ () |
void | setScaleFactor (float s) |
void | setScaleFactorX (float s) |
void | setScaleFactorY (float s) |
void | setScaleFactorZ (float s) |
float * | getColor () |
void | setColor (float *c) |
void | setColor (float r, float g, float b, float a=1.0) |
float | getAlpha () |
void | setAlpha (float a) |
template<class T> | |
int | getActiveBufferValue (unsigned int bufferType, unsigned int x, unsigned int y, T &value) |
template<class T> | |
int | getActiveBufferValue (unsigned int bufferType, unsigned int x, unsigned int y, T *value) |
template<class T> | |
int | getPassiveBufferValue (unsigned int bufferType, float x, float y, T &value) |
template<class T> | |
int | getPassiveBufferValue (unsigned int bufferType, unsigned int x, unsigned int y, T *value) |
void | print () |
void | printChildren () |
Static Public Member Functions | |
static void | convertIdToColor (unsigned long id, unsigned char *color) |
static unsigned long | convertColorToId (unsigned char *color) |
Static Public Attributes | |
static const unsigned int | NONE = 0 |
static const unsigned int | POSITION = 1 |
static const unsigned int | ROTATION_ANGLE = 2 |
static const unsigned int | WIDTH = 4 |
static const unsigned int | HEIGHT = 8 |
static const unsigned int | SCALE_FACTOR_X = 16 |
static const unsigned int | SCALE_FACTOR_Y = 32 |
static const unsigned int | SCALE_FACTOR_Z = 64 |
static const unsigned int | COLOR_RED = 128 |
static const unsigned int | COLOR_GREEN = 256 |
static const unsigned int | COLOR_BLUE = 512 |
static const unsigned int | COLOR_ALPHA = 1028 |
Protected Member Functions | |
virtual void | preRender () |
virtual void | postRender () |
Protected Attributes | |
unsigned long | id |
unsigned char | idColor [3] |
LargeDisplayManager * | manager |
VisComponentState | currentState |
std::stack< VisComponentState > | stateStack |
std::vector< IBufferProxy * > | activeBuffers |
std::vector< IBufferProxy * > | passiveBuffers |
VisComponentStrategy * | strategy |
float | animationStep |
float | animationParameter |
bool | animating |
VisComponentState | sourceState |
VisComponentState | targetState |
unsigned int | removingInvariants |
A specialized component is defined by adding one or more behavior strategies, instead of subclassing. The component's i-buffers should also be specified throught the associated strategies. To set a component's strategy, a VisComponentStrategy object should be specified and pushed into the component object's chain of strategies. This defines how the component should draw itself and behave during interaction.
Animation of the component can be defined by using the source and target states (both are VisComponentState objects). The states are linearly interpolated during the component rendering by updating the animation parameter in accord with the current value of the animation step.
This class was refactored from the original VisComponent class written by Andre Miede and Tobias Isenberg in the Interactions Lab at the University of Calgary, Canada.
VisComponent::VisComponent | ( | void | ) |
Constructs a component.
VisComponent::~VisComponent | ( | void | ) | [virtual] |
Destroys this component.
void VisComponent::render | ( | const std::vector< unsigned long > & | selectedIds, | |
bool | enablePicking, | |||
bool | containerOnly = false | |||
) |
Renders this component.
selectedIds | the list of currently selected ids. | |
enablePicking | if true, draw for selection mode (adding the component id). | |
containerOnly | if true, only renders this component if it is a container (i. e., not a leaf). |
void VisComponent::renderChildren | ( | const std::vector< unsigned long > & | selectedIds, | |
bool | enablePicking, | |||
bool | containerOnly = false | |||
) |
Renders the composite children of this component.
selectedIds | the list of currently selected ids. | |
enablePicking | if true, draw for selection mode (adding the component id). | |
containerOnly | if true, only renders this component if it is a container (i. e., not a leaf). |
void VisComponent::renderBranch | ( | const std::vector< unsigned long > & | selectedIds, | |
bool | enablePicking, | |||
bool | containerOnly = false | |||
) |
Renders this component and all its children, which in turn render their children, and so on.
selectedIds | the list of currently selected ids. | |
enablePicking | if true, draw for selection mode (adding the component id). | |
containerOnly | if true, only renders this component if it is a container (i. e., not a leaf). |
void VisComponent::renderBranchWithException | ( | const std::vector< unsigned long > & | selectedIds, | |
bool | enablePicking, | |||
bool | containerOnly, | |||
unsigned long | exceptionId | |||
) |
Renders this component and all its children, which in turn render their children, and so on, except if this component has the specified id.
selectedIds | the list of currently selected ids. | |
enablePicking | if true, draw for selection mode (adding the component id). | |
containerOnly | if true, only renders this component if it is a container (i. e., not a leaf). | |
exceptionId | the id of the component that should not be rendered. |
void VisComponent::renderBranchWithException | ( | const std::vector< unsigned long > & | selectedIds, | |
bool | enablePicking, | |||
bool | containerOnly, | |||
const std::vector< unsigned long > & | exceptionId | |||
) |
Renders this component and all its children, which in turn render their children, and so on, except if the id of this component is in the list of exceptions.
selectedIds | the list of currently selected ids. | |
enablePicking | if true, draw for selection mode (adding the component id). | |
containerOnly | if true, only renders this component if it is a container (i. e., not a leaf). | |
exceptionIds | the list of the ids of the components that should not be rendered. |
void VisComponent::startAnimation | ( | ) |
Starts an animation.
void VisComponent::stopAnimation | ( | ) |
Stops an animation.
void VisComponent::animate | ( | float | t | ) | [virtual] |
Determines what to do at the given animation step. The default behavior is to interpolate the source and target states of this component.
t | the interpolation parameter used to calculate the animation. It should be between 0.0 and 1.0. |
void VisComponent::animateRemoving | ( | unsigned int | invariants | ) |
Animates this component when it is removed from a container. The animation is done by retrieving the state currently on top of this component's stack and setting it as the animation's target state. The current state is set as the animation's source state. After the source and target states are properly set, the animation is triggered to start. The attributes specified as invariants are maintained during the process. This function should be called by a strategy whenever this behavior is required.
invariants | the bitwise OR combination of the constants that identify which attributes should not be retrieved from the previously saved state. |
void VisComponent::animateAdding | ( | const std::vector< unsigned int > & | types, | |
unsigned int | invariants | |||
) |
Animates this component when it is added to a container. If buffer reading is required in order to update the component when inside the container, this is specified by the parameter 'types'. This parameter is forwarded to the readPassiveBuffers() function in this component's strategy in order to have specific actions carried out. If the state stack is empty, this method saves the current state of this component, sets it as the animation's source, and sets the target state as the current state modified by the the specified buffer reading. If there is a state already in the stack, the animation's target is set as this top state altered by reading the specified buffer(s). The attributes specified as invariants are maintained during the process. This function should be called by a strategy whenever this behavior is required.
types | the types of buffers that should be read from the container. | |
invariants | the bitwise OR combination of the constants that identify which attributes should not be retrieved from the previously saved state. |
void VisComponent::onEvent | ( | LargeDisplayEvent * | evt | ) | [inline] |
Handles the given event.
evt | the event to be handled. |
virtual void VisComponent::resize | ( | unsigned int | width, | |
unsigned int | height | |||
) | [inline, virtual] |
Defines what happens when the component is resized. Due to the use of templates for representing the i-buffers, the component's strategy should resize all the active buffers of the associated component.
width | the new width of the component. | |
height | the new height of the component. |
virtual void VisComponent::drop | ( | bool | parentChanged | ) | [inline, virtual] |
Defines what happens when the component is dropped insed another component/container.
parentChanged | true if the component's parent changed with the dropping. |
void VisComponent::convertGlobalToBufferCoords | ( | double | globalX, | |
double | globalY, | |||
double & | bufferX, | |||
double & | bufferY | |||
) |
Converts the given global coordinates (with origin in the bottom left corner of the screen) to this component buffer coordinate frame (with origin in the bottom left corner of this component bounding rectangle, given by its width, height, center/position, and up-vector direction).
globalX | the global x-coordinate | |
globalY | the global y-coordinate | |
bufferX | the calculated x-coordinate in the component buffer frame | |
bufferY | the calculated y-coordinate in the component buffer frame |
Converts the given global coordinates (with origin in the bottom left corner of the screen) to this component buffer coordinate frame (with origin in the bottom left corner of this component bounding rectangle, given by its width, height, center/position, and up-vector direction). OBS.: The conversion is only done for the x and y coordinates. The z coordinate is ignored.
global | the global coordinates to be converted | |
buffer | the calculated coordinates in the component buffer frame |
void VisComponent::convertBufferToGlobalCoords | ( | double | bufferX, | |
double | bufferY, | |||
double & | globalX, | |||
double & | globalY | |||
) |
Converts the given coordinates in this component buffer frame (with origin in the bottom left corner of this component bounding rectangle, given by its width, height, center/position, and up-vector direction) to global coordinates (with origin in the bottom left corner of the screen).
bufferX | the x-coordinate in the component buffer frame | |
bufferY | the y-coordinate in the component buffer frame | |
globalX | the calculated global x-coordinate | |
globalY | the calculated global y-coordinate |
Converts the given coordinates in this component buffer frame (with origin in the bottom left corner of this component bounding rectangle, given by its width, height, center/position, and up-vector direction) to global coordinates (with origin in the bottom left corner of the screen). OBS.: The conversion is only done for the x and y coordinates. The z coordinate is ignored.
buffer | the coordinates in the component buffer frame | |
global | the calculated global coordinates |
void VisComponent::convertPositionToParentBufferCoords | ( | double & | parentX, | |
double & | parentY | |||
) |
Converts the current position of this component to its parent's buffer coordinate frame (if it has a parent).
parentX | the x-coordinate in the parent frame | |
parentY | the y-coordinate in the parent frame |
void VisComponent::convertGlobalToComponentCoords | ( | double | globalX, | |
double | globalY, | |||
double & | componentX, | |||
double & | componentY | |||
) |
Converts the given global coordinates (with origin in the bottom left corner of the screen) to this component coordinate frame (with origin in the center of this component bounding rectangle, given by its width, height, center/position, and rotation angle).
globalX | the global x-coordinate | |
globalY | the global y-coordinate | |
componentX | the calculated x-coordinate in the component frame | |
componentY | the calculated y-coordinate in the component frame |
Converts the given global coordinates (with origin in the bottom left corner of the screen) to this component coordinate frame (with origin in the center of this component bounding rectangle, given by its width, height, center/position, and rotation angle). OBS.: The conversion is only done for the x and y coordinates. The z coordinate is ignored.
global | the global coordinates to be converted | |
component | the calculated coordinates in the component frame |
void VisComponent::convertComponentToGlobalCoords | ( | double | componentX, | |
double | componentY, | |||
double & | globalX, | |||
double & | globalY | |||
) |
Converts the given coordinates in this component frame (with origin in the center of this component bounding rectangle, given by its width, height, center/position, and rotation angle) to global coordinates (with origin in the bottom left corner of the screen).
componentX | the x-coordinate in the component frame | |
componentY | the y-coordinate in the component frame | |
globalX | the calculated global x-coordinate | |
globalY | the calculated global y-coordinate |
Converts the given coordinates in this component frame (with origin in the center of this component bounding rectangle, given by its width, height, center/position, and rotation angle) to global coordinates (with origin in the bottom left corner of the screen). OBS.: The conversion is only done for the x and y coordinates. The z coordinate is ignored.
component | the coordinates in the component buffer frame | |
global | the calculated global coordinates |
void VisComponent::convertPositionToParentCoords | ( | double & | parentX, | |
double & | parentY | |||
) |
Converts the current position of this component to its parent's coordinate frame (if it has a parent).
parentX | the x-coordinate in the parent frame | |
parentY | the y-coordinate in the parent frame |
void VisComponent::moveBy | ( | const Point3f & | d | ) | [inline] |
Moves this component by the given values.
d | the values to move this component by. |
void VisComponent::moveBy | ( | float | dx, | |
float | dy = 0 , |
|||
float | dz = 0 | |||
) | [inline] |
Moves this component by the given values. If only one argument is given, the component is moved only along the x-coordinate. If two arguments are given, the component is moved along the x- and y-coordinates. If all three are given, the component is moved along all three coordinates by the corresponding values.
dx | the value to move this component by in the x-coordinate. | |
dy | the value to move this component by in the y-coordinate. | |
dz | the value to move this component by in the z-coordinate. |
void VisComponent::moveBranchBy | ( | const Point3f & | d | ) |
Moves this component and the composite branch under it by the given values.
d | the values to move this component branch by. |
void VisComponent::moveBranchBy | ( | float | dx, | |
float | dy = 0 , |
|||
float | dz = 0 | |||
) |
Moves this component and the composite branch under it by the given values.
dx | the value to move this component by in the x-coordinate. | |
dy | the value to move this component by in the y-coordinate. | |
dz | the value to move this component by in the z-coordinate. |
void VisComponent::rotate | ( | double | angleRadians | ) | [inline] |
Rotates this component in the x-y plane by the given angle in radians.
angleRadians | the angle to rotate this component by. |
void VisComponent::rotateBranch | ( | double | angleRadians | ) |
Rotates the branch of this component in the x-y plane by the given angle in radians.
angleRadians | the angle to rotate this component by. |
void VisComponent::saveCurrentState | ( | ) | [inline] |
Saves the current state of this component by pushing it to the state stack.
void VisComponent::retrieveState | ( | ) | [inline] |
Retrieves the state at the top of the state stack and sets it as the current state of this component.
void VisComponent::retrieveState | ( | unsigned int | invariants | ) |
Retrieves the state at the top of the state stack and sets it as the current state of this component, keeping the attributes determined by the invariants flag.
invariants | the OR-combination of the identifiers of the attributes that should be kept (i.e., not retrieved). |
VisComponentState VisComponent::obtainTopState | ( | ) | [inline] |
Returns the state currently at the top of state stack.
void VisComponent::discardTopState | ( | ) | [inline] |
Discards the state currently at the top of the state stack.
bool VisComponent::isStateStackEmpty | ( | ) | [inline] |
Returns true if the state stack of this component is empty.
void VisComponent::convertIdToColor | ( | unsigned long | id, | |
unsigned char * | color | |||
) | [static] |
Returns the conversion to RGB values of the given id.
id | the id to be converted. | |
color | the returned RGB color corresponding to the given id. |
unsigned long VisComponent::convertColorToId | ( | unsigned char * | color | ) | [static] |
Returns the id resulting from the conversion of the given color.
color | the color to be converted. |
void VisComponent::addActiveBuffer | ( | IBufferProxy * | buffer | ) | [inline] |
Adds an active i-buffer to this component. The insertion order defines the sequential identifier to access the property (starting at zero). If a property is deleted from this component, all the identifiers have to be shifted.
buffer | the active i-buffer to be added to this component. |
void VisComponent::addPassiveBuffer | ( | IBufferProxy * | buffer | ) | [inline] |
Adds a passive i-buffer to this component. The insertion order defines the sequential identifier to access the property (starting at zero). If a property is deleted from this component, all the identifiers have to be shifted.
buffer | the passive i-buffer to be added to this component. |
unsigned int VisComponent::getNumberActiveBuffers | ( | ) | [inline] |
Returns the number of active buffers currently in this component.
unsigned int VisComponent::getNumberPassiveBuffers | ( | ) | [inline] |
Returns the number of passive buffers currently in this component.
void VisComponent::updatePassiveBuffers | ( | ) |
Updates the passive buffers by searching in the path from this component parent to the root of the composite structure for buffers of the same type as specified in this component's passive buffer list. The first buffer found is associated as the respective passive buffer of this component for a given property.
void VisComponent::updateBranchPassiveBuffers | ( | ) |
Recursively updates the passive buffers of the branch below this component node by searching in the path from this component parent to the root of the composite structure for buffers of the same type as specified in the component's passive buffer list. The first buffer found is associated as the respective passive buffer of the specific component for a given property.
void VisComponent::resizeActiveBuffers | ( | ) |
Resizes all the active buffers of this component. The buffers are set to have the same dimensions as the component's width and height. The virtual dimensions are set with the same values as the actual dimensions.
void VisComponent::resizeBranchActiveBuffers | ( | ) |
Resizes all the active buffers of this component and the components below it in the composition tree. The buffers are set to have the same dimensions as the component's width and height. The virtual dimensions are set with the same values as the actual dimensions.
unsigned long VisComponent::getActiveBuffersMemorySizeKBytes | ( | ) |
Returns the amount of memory allocated by the active buffers of this component in KyloBytes.
void VisComponent::pushStrategy | ( | VisComponentStrategy * | str | ) |
Adds a strategy to the ones associated with this component by pushing it at the front of the strategy chain. Therefore, it will be called *after* the strategies that are already in the chain.
str | a VisComponentStrategy to be added to this component. |
bool VisComponent::hasStrategy | ( | ) | [inline] |
Returns true if this component has a strategy of the class T in the strategy decorator chain.
T* VisComponent::getStrategy | ( | ) | [inline] |
Returns the reference to the specified subclass of VisComponentStrategy associated with this component. If this component does not have such a strategy, NULL is returned.
bool VisComponent::removeStrategy | ( | ) | [inline] |
Removes the first occurrance of the strategy of the given type from the sequence of strategies in this component. It returns true if the strategy is successfully removed, and false is no strategy of the specified class can be found.
void VisComponent::destroyLastStrategy | ( | ) |
Destroys the last strategy in the startegy chain of this component.
void VisComponent::destroyAllStrategies | ( | ) |
Destroys all the strategies in this component's strategy chain.
bool VisComponent::isInside | ( | unsigned int | x, | |
unsigned int | y | |||
) |
Returns true if the given global coordinates are inside the bounding rectangle of this component (given by its widht, height, and position/center). Returns false, otherwise.
unsigned long VisComponent::getId | ( | ) | [inline] |
Returns the unique identifier of this component.
void VisComponent::setId | ( | unsigned long | newId | ) | [inline] |
Sets the unique identifier of this component. It also sets the id color of this component in accord with the set id.
newId | the unique identifier of this component. |
void VisComponent::getIdColor | ( | unsigned char * | color | ) | [inline] |
Returns the color corresponding to the identifier of this component in the given parameter.
color | the color corresponding to the identifier of this component. |
void VisComponent::setIdColor | ( | unsigned char * | colorId | ) | [inline] |
Sets the color corresponding to the identifier of this component.
colorId | the color corresponding to the identifier of this component. |
LargeDisplayManager* VisComponent::getManager | ( | ) | [inline] |
Returns a pointer to the manager of this component.
void VisComponent::setManager | ( | LargeDisplayManager * | m | ) | [inline] |
Sets the pointer to the manager of this component.
m | the pointer to the manager to be set for this component. |
VisComponentState VisComponent::getCurrentState | ( | ) | [inline] |
Returns a copy of the current state object of this component.
void VisComponent::setCurrentState | ( | VisComponentState | state | ) | [inline] |
Sets the current state object of this component.
state | the state object to be set as current. |
float VisComponent::getAnimationStep | ( | ) | [inline] |
Returns the value used for the animation linear step.
void VisComponent::setAnimationStep | ( | float | step | ) | [inline] |
Sets the linear step used for animation.
step | the value of the animation linear step |
float VisComponent::getAnimationParameter | ( | ) | [inline] |
Returns the current value of the animation parameter.
void VisComponent::setAnimationParameter | ( | float | value | ) | [inline] |
Sets the current value of the animation parameter.
value | the value of the animation parameter. |
bool VisComponent::isAnimating | ( | ) | [inline] |
Returns true if an animation is running.
void VisComponent::setAnimating | ( | bool | value | ) | [inline] |
Sets the animation flag of this component (can be used to prevent buffer reading while animating is true).
value | the value to be set to the animating flag. |
VisComponentState VisComponent::getSourceState | ( | ) | [inline] |
Returns the current source state for the animation of this component.
void VisComponent::setSourceState | ( | VisComponentState | state | ) | [inline] |
Sets the current source state for the animation of this component.
state | the state to be made the source of this component animation. |
VisComponentState VisComponent::getTargetState | ( | ) | [inline] |
Returns the current target state for the animation of this component.
void VisComponent::setTargetState | ( | VisComponentState | state | ) | [inline] |
Sets the current target state for the animation of this component.
state | the state to be made the target of this component animation. |
unsigned int VisComponent::getRemovingInvariants | ( | ) | [inline] |
Returns the current invariants for the animation triggered when this component is removed from a container.
void VisComponent::setRemovingInvariants | ( | unsigned int | invariants | ) | [inline] |
Sets the current invariants for the animation triggered when this component is removed from a container.
invariants | the current invariants for removing animation. |
IBufferProxy* VisComponent::getActiveBuffer | ( | unsigned int | propId | ) | [inline] |
Returns the active i-buffer proxy object used to represent the specified property. If there is no buffer for the given id, NULL is returned.
propId | the identifier of the property represented in the buffer. |
void VisComponent::setActiveBuffer | ( | unsigned int | propId, | |
IBufferProxy * | buffer | |||
) | [inline] |
Sets the given IBuffer object as an active buffer associated with the specified property index. If there is no buffer for the given id, nothing is done.
propId | the identifier of the property being set. | |
buffer | the IBufferProxy object representing this property. |
IBufferProxy * VisComponent::getActiveBufferByType | ( | unsigned int | t | ) |
Returns an IBufferProxy object from this component's active buffer list that have the same type as specified. If no buffer of the given type are found, NULL is returned.
t | the type of buffer to be returned. |
IBufferProxy* VisComponent::getPassiveBuffer | ( | unsigned int | propId | ) | [inline] |
Returns the passive i-buffer proxy object used to represent the specified property. If there is no buffer for the given id, NULL is returned.
propId | the identifier of the property represented in the buffer. |
IBufferProxy * VisComponent::getPassiveBufferByType | ( | unsigned int | t | ) |
Returns an IBufferProxy object from this component's passive buffer list that have the same type as specified. If no buffer of the given type are found, NULL is returned.
t | the type of buffer to be returned. |
void VisComponent::setPassiveBuffer | ( | unsigned int | propId, | |
IBufferProxy * | buffer | |||
) | [inline] |
Sets the given IBuffer object as a passive buffer associated with the specified property index. If there is no buffer for the given id, nothing is done.
propId | the identifier of the property being set. | |
buffer | the IBufferProxy object representing this property. |
VisComponentStrategy* VisComponent::getStrategy | ( | ) | [inline] |
Returns the VisComponentStrategy object being used by this component.
void VisComponent::setStrategy | ( | VisComponentStrategy * | str | ) | [inline] |
Sets the VisComponentStrategy to be used by this component.
str | the VisComponentStrategy object to be used by this component. |
const Point3f& VisComponent::getPosition | ( | ) | [inline] |
Returns the position of the current state of this component.
void VisComponent::setPosition | ( | const Point3f & | pos | ) | [inline] |
Sets the position of the current state of this component.
pos | the position to be set to the current state of this component. |
void VisComponent::setPosition | ( | float | x, | |
float | y | |||
) | [inline] |
Sets the position of the current state of this component.
x | the x-coordinate of the position to be set to the current state of this component. | |
y | the y-coordinate of the position to be set to the current state of this component. |
void VisComponent::setPosition | ( | float | x, | |
float | y, | |||
float | z | |||
) | [inline] |
Sets the position of the current state of this component.
x | the x-coordinate of the position to be set to the current state of this component. | |
y | the y-coordinate of the position to be set to the current state of this component. | |
z | the z-coordinate of the position to be set to the current state of this component. |
double VisComponent::getRotationAngle | ( | ) | [inline] |
Returns the rotation angle in radians of the current state of this component.
void VisComponent::setRotationAngle | ( | double | angle | ) | [inline] |
Sets the rotation angle in radians of the current state of this component.
angle | the rotation angle in radians to be set to the current state of this component. |
unsigned int VisComponent::getWidth | ( | ) | [inline] |
Returns the width of the current state of this component.
void VisComponent::setWidth | ( | unsigned int | w | ) | [inline] |
Sets the width of the current state of this component.
w | the width to be set to the current state of this component. |
unsigned int VisComponent::getHeight | ( | ) | [inline] |
Returns the height of the current state of this component.
void VisComponent::setHeight | ( | unsigned int | h | ) | [inline] |
Sets the height of the current state of this component.
h | the height to be set to the current state of this component. |
float VisComponent::getScaleFactorX | ( | ) | [inline] |
Returns the scale factor along the x-coordinate of the current state of this component.
float VisComponent::getScaleFactorY | ( | ) | [inline] |
Returns the scale factor along the y-coordinate of the current state of this component.
float VisComponent::getScaleFactorZ | ( | ) | [inline] |
Returns the scale factor along the z-coordinate of the current state of this component.
void VisComponent::setScaleFactor | ( | float | s | ) | [inline] |
Sets the scale factor of the current state of this component uniformly (i. e., equal in all coordinates).
h | the uniform scale factor to be set to the current state of this component. |
void VisComponent::setScaleFactorX | ( | float | s | ) | [inline] |
Sets the scale factor along the x-coordinate of the current state of this component.
h | the x-coordinate scale factor to be set to the current state of this component. |
void VisComponent::setScaleFactorY | ( | float | s | ) | [inline] |
Sets the scale factor along the y-coordinate of the current state of this component.
h | the y-coordinate scale factor to be set to the current state of this component. |
void VisComponent::setScaleFactorZ | ( | float | s | ) | [inline] |
Sets the scale factor along the z-coordinate of the current state of this component.
h | the z-coordinate scale factor to be set to the current state of this component. |
float* VisComponent::getColor | ( | ) | [inline] |
Returns the RGBA color of the current state of this component.
void VisComponent::setColor | ( | float * | c | ) | [inline] |
Sets the RGBA color of the current state of this component.
c | the RGBA color of the current state of this component. |
void VisComponent::setColor | ( | float | r, | |
float | g, | |||
float | b, | |||
float | a = 1.0 | |||
) | [inline] |
Sets the RGBA color of the current state of this component.
r | the red component of the color of the current state of this component. | |
g | the green component of the color of the current state of this component. | |
b | the blue component of the color of the current state of this component. | |
a | the alpha component of the color of the current state of this component. |
float VisComponent::getAlpha | ( | ) | [inline] |
Returns the alpha component of the RGBA color of the current state of this component.
void VisComponent::setAlpha | ( | float | a | ) | [inline] |
Sets the alpha component of the RGBA color of the current state of this component.
a | the alpha component of the RGBA color of the current state of this component. |
int VisComponent::getActiveBufferValue | ( | unsigned int | bufferType, | |
unsigned int | x, | |||
unsigned int | y, | |||
T & | value | |||
) | [inline] |
Sets the parameter value with the value in the specified passive buffer at the given global coordinates. Returns 0 if successful or 1 if the buffer is not found or the given global coordinates fall out of the buffer range.
bufferType | the constant that identifies the type of the buffer. | |
x | the global x-coordinate of the position of the buffer access. | |
y | the global y-coordinate of the position of the buffer access. | |
value | the variable where the obtianed result is put. | |
T | the data type in the specified buffer. |
int VisComponent::getActiveBufferValue | ( | unsigned int | bufferType, | |
unsigned int | x, | |||
unsigned int | y, | |||
T * | value | |||
) | [inline] |
Fills the array value with the value in the specified active buffer at the given global coordinates. Returns 0 if successful or 1 if the buffer is not found or the given global coordinates fall out of the buffer range, a std::exception is.
bufferType | the constant that identifies the type of the buffer. | |
x | the global x-coordinate of the position of the buffer access. | |
y | the global y-coordinate of the position of the buffer access. | |
value | the variable where the obtianed result is put. | |
T | the data type in the specified buffer. |
int VisComponent::getPassiveBufferValue | ( | unsigned int | bufferType, | |
float | x, | |||
float | y, | |||
T & | value | |||
) | [inline] |
Sets the parameter value with the value in the specified passive buffer at the given global coordinates. Returns 0 if successful or 1 if the buffer is not found or the given global coordinates fall out of the buffer range.
bufferType | the constant that identifies the type of the buffer. | |
x | the global x-coordinate of the position of the buffer access. | |
y | the global y-coordinate of the position of the buffer access. | |
value | the variable where the obtianed result is put. | |
T | the data type in the specified buffer. |
int VisComponent::getPassiveBufferValue | ( | unsigned int | bufferType, | |
unsigned int | x, | |||
unsigned int | y, | |||
T * | value | |||
) | [inline] |
Fills the array value with the value in the specified passive buffer at the given global coordinates. Returns 0 if successful or 1 if the buffer is not found or the given global coordinates fall out of the buffer range.
bufferType | the constant that identifies the type of the buffer. | |
x | the global x-coordinate of the position of the buffer access. | |
y | the global y-coordinate of the position of the buffer access. | |
value | the variable where the obtianed result is put. | |
T | the data type in the specified buffer. |
void VisComponent::print | ( | ) |
Prints the data in this component for debugging purposes.
void VisComponent::printChildren | ( | ) |
Prints the children of this component for debugging purposes.
virtual void VisComponent::preRender | ( | ) | [inline, protected, virtual] |
Executes the subclass specified code before rendering this component.
virtual void VisComponent::postRender | ( | ) | [inline, protected, virtual] |
Executes the subclass specified code after rendering this component.
const unsigned int VisComponent::NONE = 0 [static] |
In retrieving a state, no attribute should be kept (retrieve everything).
const unsigned int VisComponent::POSITION = 1 [static] |
In retrieving a state, keep the position.
const unsigned int VisComponent::ROTATION_ANGLE = 2 [static] |
In retrieving a state, keep the rotation angle.
const unsigned int VisComponent::WIDTH = 4 [static] |
In retrieving a state, keep the width.
const unsigned int VisComponent::HEIGHT = 8 [static] |
In retrieving a state, keep the height.
const unsigned int VisComponent::SCALE_FACTOR_X = 16 [static] |
In retrieving a state, keep the x-coordinate scale factor.
const unsigned int VisComponent::SCALE_FACTOR_Y = 32 [static] |
In retrieving a state, keep the y-coordinate scale factor.
const unsigned int VisComponent::SCALE_FACTOR_Z = 64 [static] |
In retrieving a state, keep the z-coordinate scale factor.
const unsigned int VisComponent::COLOR_RED = 128 [static] |
In retrieving a state, keep the red component of its color.
const unsigned int VisComponent::COLOR_GREEN = 256 [static] |
In retrieving a state, keep the green component of its color.
const unsigned int VisComponent::COLOR_BLUE = 512 [static] |
In retrieving a state, keep the blue component of its color.
const unsigned int VisComponent::COLOR_ALPHA = 1028 [static] |
In retrieving a state, keep the alpha component of its color.
unsigned long VisComponent::id [protected] |
The unique identifier of this component.
unsigned char VisComponent::idColor[3] [protected] |
The color identifier derived from this component id.
LargeDisplayManager* VisComponent::manager [protected] |
The manager that owns this component.
VisComponentState VisComponent::currentState [protected] |
The current state of this commponent.
std::stack<VisComponentState> VisComponent::stateStack [protected] |
The stack that holds previous/alternative states of this component.
std::vector<IBufferProxy*> VisComponent::activeBuffers [protected] |
The collection of active i-Buffers held by this component. This collection is indexed by unsigned int values defined by the VisComponentStrategy object associated with this component. This same object is also responsible for creating the IBuffer objects added to this collection. A component is suppposed to have the same elements in this collection throughout its lifetime. Therefore, performance of insertions and deletions on this collection is not crucial. The most significant aspect is the performance of finding elements for readings and updates. Thus, this operation must be carried out in constant time (O(1)).
std::vector<IBufferProxy*> VisComponent::passiveBuffers [protected] |
The collection of references to the passive i-buffers used by this component. This collection is indexed by unsigned int values defined by the VisComponentStrategy object associated with this component. This same object is also responsible for creating the IBufferProxy objects added to this collection. A component is suppposed to have the same elements in this collection throughout its lifetime (although they might be empty). Therefore, performance of insertions and deletions on this collection is not crucial. The most significant aspect is the performance of finding elements for readings and updates. Thus, this operation must be carried out in constant time (O(1)). The references in this collection must be updated everytime the path from this component to the root component of its composite structure changes. If no component in the path to root has an active buffer of the same type as a given passive buffer request, the reference inside the IBufferProxy object is set to NULL.
VisComponentStrategy* VisComponent::strategy [protected] |
The strategy being used for this component.
float VisComponent::animationStep [protected] |
The size of the linear step used for animation with linear interpolation (between 0 and 1).
float VisComponent::animationParameter [protected] |
The current value used to parameterize animation (between 0 and 1).
bool VisComponent::animating [protected] |
If true, indicates that an animation is running.
VisComponentState VisComponent::sourceState [protected] |
The state where the animation starts.
VisComponentState VisComponent::targetState [protected] |
The state where the animation stops.
unsigned int VisComponent::removingInvariants [protected] |
The exception attributes for the animation triggered when this component is removed from a container.