#include <BoundedContainerStrategy.h>
Inherited by BeltContainerStrategy.
Inheritance diagram for BoundedContainerStrategy:
Public Member Functions | |
BoundedContainerStrategy (unsigned int nControlPoints=4, unsigned int subdivLevels=4) | |
~BoundedContainerStrategy (void) | |
void | initialize (bool rounded) |
virtual Point3f | getRandomInsidePoint () |
Spline | getOuterSpline () |
void | setOuterSpline (Spline s) |
Spline | getOuterBorderSpline () |
void | setOuterBorderSpline (Spline s) |
float * | getColor () |
void | setColor (float *c) |
float * | getBorderColor () |
void | setBorderColor (float *c) |
float * | getSelectedColor () |
void | setSelectedColor (float *c) |
float | getBorderWidth () |
void | setBorderWidth (float w) |
unsigned int | getNumControlPoints () |
void | setNumControlPoints (unsigned int n) |
unsigned int | getSplineLevels () |
void | setSplineLevels (unsigned int n) |
bool | getDisplayControlPoints () |
void | setDisplayControlPoints (bool value) |
Protected Member Functions | |
virtual void | createDisplayLists () |
virtual void | setDefaultBounds (bool rounded) |
void | calculateOuterBorder () |
virtual void | adjustSizeAndPosition () |
virtual void | evaluateSplines () |
void | updateShape (bool recalculateButtonBuffer) |
virtual void | drawInnerRegion () |
virtual void | drawBorder (bool noColor=false) |
virtual void | drawControlPoints () |
virtual void | moveControlPointBy (unsigned int index, double dx, double dy) |
void | initProperties () |
void | draw (const std::vector< unsigned long > &selectedIds) |
void | drawForPicking () |
void | onEvent (LargeDisplayEvent *evt) |
void | resize (unsigned int width, unsigned int height) |
virtual void | fillButtonBuffer (IBuffer< unsigned char > *buffer) |
void | fillMaskBuffer () |
unsigned char | getButtonValue (unsigned int x, unsigned int y) |
int | obtainIndex (std::vector< unsigned char > &values, unsigned char v) |
virtual void | initializeCPButtonValues () |
Protected Attributes | |
Spline | outerSpline |
Spline | outerBorderSpline |
float | color [4] |
float | borderColor [4] |
float | selectedColor [4] |
float | borderWidth |
unsigned int | numControlPoints |
unsigned int | splineLevels |
unsigned int | dlInnerRegion |
unsigned int | dlOuterBorder |
unsigned int | dlOuterBorderSelected |
unsigned int | dlOuterBorderPicking |
int | selectedControlPoint |
bool | borderSelected |
int | previousX |
int | previousY |
bool | updateChildrenAfterReshape |
bool | displayControlPoints |
IBuffer< bool > * | maskBuffer |
unsigned int | maskBufferType |
unsigned int | buttonBufferType |
unsigned char | noButtonValue |
unsigned char | translationAreaButtonValue |
unsigned char | rntAreaButtonValue |
std::vector< unsigned char > | cpOuterButtonValues |
This is based on the BoundedContainerGL class in the original implementation of the Tabletop Framework done by T. Isenberg and A. Miede in the Interactions Lab at the University of Calgary, Canada.
BoundedContainerStrategy::BoundedContainerStrategy | ( | unsigned int | nControlPoints = 4 , |
|
unsigned int | subdivLevels = 4 | |||
) |
Constructs a bounded container strategy.
nControlPoints | the number of control points in the curve. | |
subdivLevels | the number of times sundivision should be applied to the curve. |
BoundedContainerStrategy::~BoundedContainerStrategy | ( | void | ) |
Destroys this strategy.
void BoundedContainerStrategy::initialize | ( | bool | rounded | ) |
Initializes this component with a default shape (must be done after setting this strategy's component).
rounded | indicates if the curve shape should be rounded. |
Point3f BoundedContainerStrategy::getRandomInsidePoint | ( | ) | [virtual] |
Returns a random point inside the inner region of the bounded container.
Spline BoundedContainerStrategy::getOuterSpline | ( | ) | [inline] |
Returns the outer spline that defines this container bounds.
void BoundedContainerStrategy::setOuterSpline | ( | Spline | s | ) | [inline] |
Sets the outer spline that defines this container bounds.
s | the outer spline that defines this container bounds. |
Spline BoundedContainerStrategy::getOuterBorderSpline | ( | ) | [inline] |
Returns the outer border spline that defines this container bounds.
void BoundedContainerStrategy::setOuterBorderSpline | ( | Spline | s | ) | [inline] |
Sets the outer border spline that defines this container bounds.
s | the outer border spline that defines this container bounds. |
float* BoundedContainerStrategy::getColor | ( | ) | [inline] |
Returns the color used to draw the inner region of the container (using an array of 4 floats).
void BoundedContainerStrategy::setColor | ( | float * | c | ) | [inline] |
Sets the color to be used for drawing the inner region of the container (using an array of 4 floats).
c | the color to be used for drawing the inner region of the container. |
float* BoundedContainerStrategy::getBorderColor | ( | ) | [inline] |
Returns the color used to draw the border of the container (using an array of 4 floats).
void BoundedContainerStrategy::setBorderColor | ( | float * | c | ) | [inline] |
Sets the color to be used for drawing the border of the container (using an array of 4 floats).
c | the color to be used for drawing the border of the container. |
float* BoundedContainerStrategy::getSelectedColor | ( | ) | [inline] |
Returns the color used to draw the selected border (using an array of 4 floats).
void BoundedContainerStrategy::setSelectedColor | ( | float * | c | ) | [inline] |
Sets the color to be used for drawing the selected border (using an array of 4 floats).
c | the color to be used for drawing the selected border. |
float BoundedContainerStrategy::getBorderWidth | ( | ) | [inline] |
Returns the value of the border line width.
void BoundedContainerStrategy::setBorderWidth | ( | float | w | ) | [inline] |
Sets the value of the border line width.
f | the value to be used as the border line width. |
unsigned int BoundedContainerStrategy::getNumControlPoints | ( | ) | [inline] |
Returns the number of control points in the outer splines.
void BoundedContainerStrategy::setNumControlPoints | ( | unsigned int | n | ) | [inline] |
Sets the number of control points in the outer splines.
n | the number of control points in the outer splines. |
unsigned int BoundedContainerStrategy::getSplineLevels | ( | ) | [inline] |
Returns the number of subdivision levels applied to the splines.
void BoundedContainerStrategy::setSplineLevels | ( | unsigned int | n | ) | [inline] |
Sets the number of subdivision levels applied to the splines.
n | the number of subdivision levels applied to the splines. |
bool BoundedContainerStrategy::getDisplayControlPoints | ( | ) | [inline] |
Returns true if the boundary control points should be displayed and false otherwise.
void BoundedContainerStrategy::setDisplayControlPoints | ( | bool | value | ) | [inline] |
Sets if the boundary control points should be displayed.
value | true if the boundary control points should be displayed. |
void BoundedContainerStrategy::createDisplayLists | ( | ) | [protected, virtual] |
Creates the display lists for drawing the container.
Reimplemented in BeltContainerStrategy.
void BoundedContainerStrategy::setDefaultBounds | ( | bool | rounded | ) | [protected, virtual] |
Sets the control points of the bounding spline as an ellipse/rectangular shape.
rounded | if true the container has a rounded shape, otherwise its shape is rectangular. |
Reimplemented in BeltContainerStrategy.
void BoundedContainerStrategy::calculateOuterBorder | ( | ) | [protected] |
Calculates the outer border spline from the evaluated outer spline.
void BoundedContainerStrategy::adjustSizeAndPosition | ( | ) | [protected, virtual] |
Adjusts the size of the associated component by obtaining the minimum and maximum coordinates of the region given by the bounded container splines (i.e., the axis-aligned bounding rectangle around the component) and the position of the associated component's center based on the calculated dimensions.
Reimplemented in BeltContainerStrategy.
void BoundedContainerStrategy::evaluateSplines | ( | ) | [protected, virtual] |
Evaluates the splines for the outer bounds and its border using the current control points for the outer bounds spline.
Reimplemented in BeltContainerStrategy.
void BoundedContainerStrategy::updateShape | ( | bool | recalculateButtonBuffer | ) | [protected] |
Updates the shape of this container by re-evaluating the splines with the current control points, resizing and repositioning the component, and resizing and resetting the active buffers.
void BoundedContainerStrategy::drawInnerRegion | ( | ) | [protected, virtual] |
Draws the inner region of the container.
Reimplemented in BeltContainerStrategy.
void BoundedContainerStrategy::drawBorder | ( | bool | noColor = false |
) | [protected, virtual] |
Draws the border of the container.
noColor | if true the color of the vertices is not set. |
Reimplemented in BeltContainerStrategy.
void BoundedContainerStrategy::drawControlPoints | ( | ) | [protected, virtual] |
Draws the control points of the bounds spline of the container.
Reimplemented in BeltContainerStrategy.
void BoundedContainerStrategy::moveControlPointBy | ( | unsigned int | index, | |
double | dx, | |||
double | dy | |||
) | [protected, virtual] |
Moves the control point given the specified index by the given values along the x- and y-axes.
index | the index of the control point. | |
dx | the displacement along the x-axis. | |
dy | the displacement along the y-axis. |
Reimplemented in BeltContainerStrategy.
void BoundedContainerStrategy::initProperties | ( | ) | [protected] |
Initializes the properties (i. e., i-buffers) of the associated component.
Reimplemented in CurrentBeltContainerStrategy.
void BoundedContainerStrategy::draw | ( | const std::vector< unsigned long > & | selectedIds | ) | [protected] |
Defines the drawing strategy for the associated component.
enablePicking | if true, draw for selection mode (adding the component id). |
void BoundedContainerStrategy::drawForPicking | ( | ) | [protected] |
Defines the drawing strategy for the associated component that should be used for picking.
void BoundedContainerStrategy::onEvent | ( | LargeDisplayEvent * | evt | ) | [protected] |
Handles the given event.
evt | the event to be handled. |
Reimplemented in BeltContainerStrategy, and CurrentBeltContainerStrategy.
void BoundedContainerStrategy::resize | ( | unsigned int | width, | |
unsigned int | height | |||
) | [protected] |
Defines the strategy to be used when the associated component is resized.
width | the new width of the component. | |
height | the new height of the component. |
Reimplemented in CurrentBeltContainerStrategy.
void BoundedContainerStrategy::fillButtonBuffer | ( | IBuffer< unsigned char > * | buffer | ) | [protected, virtual] |
Fills the button buffer with the inside area, the border (movable), and the control points (incremental indices after last available).
buffer | the buffer to be filled. |
Reimplemented in BeltContainerStrategy.
void BoundedContainerStrategy::fillMaskBuffer | ( | ) | [protected] |
Initializes the mask buffer with the shape of a circle to be used for adding the control points to the button buffer.
unsigned char BoundedContainerStrategy::getButtonValue | ( | unsigned int | x, | |
unsigned int | y | |||
) | [protected] |
Returns the value of the current active button buffer of the associated component at the given global coordinates. If there is no button buffer currently active for the associated component or the coordinates are not inside the buffer, a constant value for NO_BUTTON is returned.
x | the x global coordinate to be checked. | |
y | the y global coordinate to be checked. |
int BoundedContainerStrategy::obtainIndex | ( | std::vector< unsigned char > & | values, | |
unsigned char | v | |||
) | [protected] |
Returns the index of the position that has the given target value in the given list of button values. If the value is not found, -1 is returned.
values | the list of button values. | |
v | the value to be looked for. |
void BoundedContainerStrategy::initializeCPButtonValues | ( | ) | [protected, virtual] |
Initializes the list with the button values of the control points.
Reimplemented in BeltContainerStrategy.
Spline BoundedContainerStrategy::outerSpline [protected] |
The spline defining the outer bounds of the container.
Spline BoundedContainerStrategy::outerBorderSpline [protected] |
The spline defining the border of the outer bounds of the container.
float BoundedContainerStrategy::color[4] [protected] |
The color of the associated component.
float BoundedContainerStrategy::borderColor[4] [protected] |
The color of the border of the associated component.
float BoundedContainerStrategy::selectedColor[4] [protected] |
The color of the border or a control point when selected.
float BoundedContainerStrategy::borderWidth [protected] |
The width of the container border.
unsigned int BoundedContainerStrategy::numControlPoints [protected] |
The number of control points in the splines.
unsigned int BoundedContainerStrategy::splineLevels [protected] |
The level of the splines.
unsigned int BoundedContainerStrategy::dlInnerRegion [protected] |
The display list identifier for the inner region.
unsigned int BoundedContainerStrategy::dlOuterBorder [protected] |
The display list identifier for the border.
unsigned int BoundedContainerStrategy::dlOuterBorderSelected [protected] |
The display list identifier for the border when selected.
unsigned int BoundedContainerStrategy::dlOuterBorderPicking [protected] |
The display list identifier for the border when picking.
int BoundedContainerStrategy::selectedControlPoint [protected] |
The index of the currently selected control point (-1, if none).
bool BoundedContainerStrategy::borderSelected [protected] |
Indicates that the border is currently selected.
int BoundedContainerStrategy::previousX [protected] |
The previous x-coordinate of the cursor position.
int BoundedContainerStrategy::previousY [protected] |
The previous y-coordinate of the cursor position.
bool BoundedContainerStrategy::updateChildrenAfterReshape [protected] |
Indicates if the children of the container should be updated after reshaping.
bool BoundedContainerStrategy::displayControlPoints [protected] |
Toggles control point rendering for the boundaries.
IBuffer<bool>* BoundedContainerStrategy::maskBuffer [protected] |
This buffer gives a mask to be used for writing the control point values.
unsigned int BoundedContainerStrategy::maskBufferType [protected] |
Mask buffer type identifier.
unsigned int BoundedContainerStrategy::buttonBufferType [protected] |
Button buffer type identifier.
unsigned char BoundedContainerStrategy::noButtonValue [protected] |
No button value.
unsigned char BoundedContainerStrategy::translationAreaButtonValue [protected] |
Translation area button value.
unsigned char BoundedContainerStrategy::rntAreaButtonValue [protected] |
RNT area button value.
std::vector<unsigned char> BoundedContainerStrategy::cpOuterButtonValues [protected] |
List of button values of each control point.